Version Description
(05 Oct 2022) =
* Fixed: Issue making survey reminder notice not dismissible.
* Added: Ctrl
+/
or Cmd
+/
as shortcut for commenting out code in the snippet editor.
* Added: Additional hooks to various snippet actions, thanks to contributions made by ancient-spirit.
* Added: Fold markers, additional keyboard shortcuts and keymap options to snippet editor,
thanks to contributions made by Amaral Krichman.
* Improved: Removed duplicate tables exist query. (#).
* Improved: Enabled 'add paragraphs and formatting' option by default for newly inserted content snippets.
* Added: WP-CLI commands for retrieving, activating, deactivating, deleting, creating, updating, exporting and importing snippets.
* Fixed: Path to iron visible when updating the pro plugin.
Release Info
Developer | bungeshea |
Plugin | Code Snippets |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.1.1 to 3.2.1
- assets/icon.svg +88 -0
- assets/menu-icon.svg +6 -0
- build/assets/icon.svg +88 -0
- build/assets/menu-icon.svg +6 -0
- build/code-snippets.php +98 -0
- build/css/_base.scss +29 -0
- build/css/_editor.scss +111 -0
- build/css/_type-badges.scss +60 -0
- build/css/edit.scss +110 -0
- build/css/edit/_tags.scss +31 -0
- build/css/edit/_tooltips.scss +64 -0
- build/css/edit/_types.scss +79 -0
- build/css/manage.scss +310 -0
- build/css/prism.scss +17 -0
- build/css/settings.scss +69 -0
- build/dist/edit-rtl.css +3 -0
- build/dist/edit.css +2 -0
- build/dist/edit.js +1 -0
- {css/min → build/dist}/editor-themes/3024-day.css +0 -0
- {css/min → build/dist}/editor-themes/3024-night.css +0 -0
- {css/min → build/dist}/editor-themes/abbott.css +0 -0
- {css/min → build/dist}/editor-themes/abcdef.css +0 -0
- {css/min → build/dist}/editor-themes/ambiance-mobile.css +0 -0
- {css/min → build/dist}/editor-themes/ambiance.css +0 -0
- {css/min → build/dist}/editor-themes/ayu-dark.css +0 -0
- {css/min → build/dist}/editor-themes/ayu-mirage.css +0 -0
- {css/min → build/dist}/editor-themes/base16-dark.css +0 -0
- {css/min → build/dist}/editor-themes/base16-light.css +0 -0
- {css/min → build/dist}/editor-themes/bespin.css +0 -0
- {css/min → build/dist}/editor-themes/blackboard.css +0 -0
- {css/min → build/dist}/editor-themes/cobalt.css +0 -0
- {css/min → build/dist}/editor-themes/colorforth.css +0 -0
- {css/min → build/dist}/editor-themes/darcula.css +0 -0
- {css/min → build/dist}/editor-themes/dracula.css +0 -0
- {css/min → build/dist}/editor-themes/duotone-dark.css +0 -0
- {css/min → build/dist}/editor-themes/duotone-light.css +0 -0
- {css/min → build/dist}/editor-themes/eclipse.css +0 -0
- {css/min → build/dist}/editor-themes/elegant.css +0 -0
- {css/min → build/dist}/editor-themes/erlang-dark.css +0 -0
- {css/min → build/dist}/editor-themes/gruvbox-dark.css +0 -0
- {css/min → build/dist}/editor-themes/hopscotch.css +0 -0
- {css/min → build/dist}/editor-themes/icecoder.css +0 -0
- {css/min → build/dist}/editor-themes/idea.css +0 -0
- {css/min → build/dist}/editor-themes/isotope.css +0 -0
- {css/min → build/dist}/editor-themes/juejin.css +0 -0
- {css/min → build/dist}/editor-themes/lesser-dark.css +0 -0
- {css/min → build/dist}/editor-themes/liquibyte.css +0 -0
- {css/min → build/dist}/editor-themes/lucario.css +0 -0
- {css/min → build/dist}/editor-themes/material-darker.css +0 -0
- {css/min → build/dist}/editor-themes/material-ocean.css +0 -0
- {css/min → build/dist}/editor-themes/material-palenight.css +0 -0
- {css/min → build/dist}/editor-themes/material.css +0 -0
- {css/min → build/dist}/editor-themes/mbo.css +0 -0
- {css/min → build/dist}/editor-themes/mdn-like.css +0 -0
- {css/min → build/dist}/editor-themes/midnight.css +0 -0
- {css/min → build/dist}/editor-themes/monokai.css +0 -0
- {css/min → build/dist}/editor-themes/moxer.css +0 -0
- {css/min → build/dist}/editor-themes/neat.css +0 -0
- {css/min → build/dist}/editor-themes/neo.css +0 -0
- {css/min → build/dist}/editor-themes/night.css +0 -0
- {css/min → build/dist}/editor-themes/nord.css +0 -0
- {css/min → build/dist}/editor-themes/oceanic-next.css +0 -0
- {css/min → build/dist}/editor-themes/panda-syntax.css +0 -0
- {css/min → build/dist}/editor-themes/paraiso-dark.css +0 -0
- {css/min → build/dist}/editor-themes/paraiso-light.css +0 -0
- {css/min → build/dist}/editor-themes/pastel-on-dark.css +0 -0
- {css/min → build/dist}/editor-themes/railscasts.css +0 -0
- {css/min → build/dist}/editor-themes/rubyblue.css +0 -0
- {css/min → build/dist}/editor-themes/seti.css +0 -0
- {css/min → build/dist}/editor-themes/shadowfox.css +0 -0
- {css/min → build/dist}/editor-themes/solarized.css +0 -0
- {css/min → build/dist}/editor-themes/ssms.css +0 -0
- {css/min → build/dist}/editor-themes/the-matrix.css +0 -0
- {css/min → build/dist}/editor-themes/tomorrow-night-bright.css +0 -0
- {css/min → build/dist}/editor-themes/tomorrow-night-eighties.css +0 -0
- {css/min → build/dist}/editor-themes/ttcn.css +0 -0
- {css/min → build/dist}/editor-themes/twilight.css +0 -0
- {css/min → build/dist}/editor-themes/vibrant-ink.css +0 -0
- {css/min → build/dist}/editor-themes/xq-dark.css +0 -0
- {css/min → build/dist}/editor-themes/xq-light.css +0 -0
- {css/min → build/dist}/editor-themes/yeti.css +0 -0
- {css/min → build/dist}/editor-themes/yonce.css +0 -0
- {css/min → build/dist}/editor-themes/zenburn.css +0 -0
- build/dist/editor.js +1 -0
- build/dist/manage-rtl.css +3 -0
- build/dist/manage.css +2 -0
- build/dist/manage.js +1 -0
- build/dist/mce.js +1 -0
- build/dist/prism.css +2 -0
- build/dist/prism.js +2 -0
- build/dist/prism.js.LICENSE.txt +8 -0
- build/dist/settings.css +2 -0
- build/dist/settings.js +1 -0
- {js/min → build/dist}/tags.js +1 -1
- build/dist/tags.js.LICENSE.txt +12 -0
- build/js/edit-tags.ts +3 -0
- build/js/edit.ts +11 -0
- build/js/edit/clipboard.ts +24 -0
- build/js/edit/editor.ts +37 -0
- build/js/edit/shortcode.ts +42 -0
- build/js/edit/tabs.ts +60 -0
- build/js/edit/tags.ts +21 -0
- build/js/edit/validate.ts +23 -0
- build/js/editor.ts +14 -0
- build/js/manage.ts +5 -0
- build/js/manage/activation.ts +68 -0
- build/js/manage/priority.ts +23 -0
- build/js/manage/requests.ts +48 -0
- build/js/mce.ts +114 -0
- build/js/php-lint.ts +153 -0
- build/js/prism.ts +21 -0
- build/js/settings.ts +5 -0
- build/js/settings/editor-preview.ts +47 -0
- build/js/settings/tabs.ts +50 -0
- build/js/types/editor.ts +30 -0
- build/js/types/modules.d.ts +60 -0
- build/js/types/snippet.ts +12 -0
- build/js/types/window.ts +15 -0
- build/license.txt +358 -0
- build/php/admin-menus/class-admin-menu.php +229 -0
- build/php/admin-menus/class-edit-menu.php +859 -0
- build/php/admin-menus/class-import-menu.php +163 -0
- build/php/admin-menus/class-manage-menu.php +304 -0
- build/php/admin-menus/class-settings-menu.php +248 -0
- build/php/class-active-snippets.php +67 -0
- build/php/class-admin.php +344 -0
- build/php/class-contextual-help.php +188 -0
- build/php/class-db.php +306 -0
- build/php/class-list-table.php +1305 -0
- build/php/class-plugin.php +322 -0
- build/php/class-rest-api.php +74 -0
- build/php/class-snippet.php +630 -0
- build/php/class-upgrade.php +214 -0
- build/php/class-validator.php +261 -0
- build/php/editor.php +121 -0
- build/php/export/class-export-attachment.php +53 -0
- {php → build/php/export}/class-export.php +65 -43
- {php → build/php/export}/class-import.php +1 -5
- build/php/front-end/class-frontend.php +326 -0
- build/php/front-end/mce-strings.php +51 -0
- build/php/load.php +61 -0
- build/php/settings/class-setting-field.php +249 -0
- build/php/settings/editor-preview.php +111 -0
- build/php/settings/settings-fields.php +234 -0
- build/php/settings/settings.php +294 -0
- build/php/snippet-ops.php +571 -0
- build/php/strings.php +60 -0
- build/php/uninstall.php +83 -0
- build/php/views/edit.php +140 -0
- build/php/views/import.php +111 -0
- build/php/views/manage.php +101 -0
- build/php/views/partials/edit-scopes.php +116 -0
- build/php/views/partials/editor-shortcuts.php +65 -0
- build/readme.txt +283 -0
- build/uninstall.php +18 -0
- build/vendor/autoload.php +7 -0
- build/vendor/composer/ClassLoader.php +481 -0
- build/vendor/composer/InstalledVersions.php +337 -0
- build/vendor/composer/LICENSE +21 -0
- build/vendor/composer/autoload_classmap.php +30 -0
- build/vendor/composer/autoload_namespaces.php +9 -0
- build/vendor/composer/autoload_psr4.php +10 -0
- build/vendor/composer/autoload_real.php +57 -0
- build/vendor/composer/autoload_static.php +56 -0
- build/vendor/composer/installed.json +160 -0
- build/vendor/composer/installed.php +44 -0
- build/vendor/composer/installers/LICENSE +19 -0
- build/vendor/composer/installers/composer.json +122 -0
- build/vendor/composer/installers/phpstan.neon.dist +10 -0
- build/vendor/composer/installers/src/Composer/Installers/AglInstaller.php +21 -0
- build/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +49 -0
- build/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +137 -0
- build/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +126 -0
- build/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +66 -0
- build/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php +32 -0
- build/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +13 -0
- build/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php +35 -0
- build/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php +21 -0
- build/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php +50 -0
- build/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php +16 -0
- build/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +22 -0
- build/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php +29 -0
- build/vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/GravInstaller.php +30 -0
- build/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php +25 -0
- build/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/Installer.php +298 -0
- build/vendor/composer/installers/src/Composer/Installers/ItopInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php +15 -0
- build/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php +18 -0
- build/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php +27 -0
- build/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php +16 -0
- build/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +37 -0
- build/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/MantisBTInstaller.php +23 -0
- build/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php +48 -0
- build/vendor/composer/installers/src/Composer/Installers/MayaInstaller.php +33 -0
- build/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +51 -0
- build/vendor/composer/installers/src/Composer/Installers/MiaoxingInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +119 -0
- build/vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +59 -0
- build/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +48 -0
- build/vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php +24 -0
- build/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php +14 -0
- build/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +59 -0
- build/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/PantheonInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php +21 -0
- build/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php +32 -0
- build/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php +29 -0
- build/vendor/composer/installers/src/Composer/Installers/Plugin.php +27 -0
- build/vendor/composer/installers/src/Composer/Installers/PortoInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php +22 -0
- build/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +63 -0
- build/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php +24 -0
- build/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php +22 -0
- build/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +60 -0
- build/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +35 -0
- build/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +25 -0
- build/vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +47 -0
- build/vendor/composer/installers/src/Composer/Installers/SyliusInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php +26 -0
- build/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php +16 -0
- build/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php +38 -0
- build/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php +30 -0
- build/vendor/composer/installers/src/Composer/Installers/TastyIgniterInstaller.php +32 -0
- build/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php +14 -0
- build/vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php +10 -0
- build/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php +49 -0
- build/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +21 -0
- build/vendor/composer/installers/src/Composer/Installers/WinterInstaller.php +58 -0
- build/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php +9 -0
- build/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +12 -0
- build/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php +32 -0
- build/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php +11 -0
- build/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php +10 -0
- build/vendor/composer/installers/src/bootstrap.php +13 -0
- build/vendor/composer/platform_check.php +26 -0
- code-snippets.php +2 -3
- css/_base.scss +29 -0
- css/_editor.scss +111 -0
- css/_type-badges.scss +60 -0
- css/edit.scss +110 -0
- css/edit/_tags.scss +31 -0
- css/edit/_tooltips.scss +64 -0
- css/edit/_types.scss +79 -0
- css/font/code-snippets.eot +0 -0
- css/font/code-snippets.svg +0 -11
- css/font/code-snippets.ttf +0 -0
- css/font/code-snippets.woff +0 -0
- css/manage.scss +310 -0
- css/min/edit-rtl.css +0 -2
- css/min/edit.css +0 -1
- css/min/manage-rtl.css +0 -2
- css/min/manage.css +0 -1
- css/min/menu-icon.css +0 -1
- css/min/prism.css +0 -1
- css/min/settings.css +0 -1
- css/prism.scss +17 -0
- css/settings.scss +69 -0
- dist/edit-rtl.css +1 -0
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
+
<svg
|
3 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4 |
+
xmlns:cc="http://creativecommons.org/ns#"
|
5 |
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6 |
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7 |
+
xmlns="http://www.w3.org/2000/svg"
|
8 |
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9 |
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10 |
+
width="527.87659"
|
11 |
+
viewBox="0 0 527.87659 527.89307"
|
12 |
+
height="527.89307"
|
13 |
+
version="1.1"
|
14 |
+
id="svg3782"
|
15 |
+
sodipodi:docname="icon.svg"
|
16 |
+
style="fill:none"
|
17 |
+
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
18 |
+
<metadata
|
19 |
+
id="metadata3786">
|
20 |
+
<rdf:RDF>
|
21 |
+
<cc:Work
|
22 |
+
rdf:about="">
|
23 |
+
<dc:format>image/svg+xml</dc:format>
|
24 |
+
<dc:type
|
25 |
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
26 |
+
<dc:title></dc:title>
|
27 |
+
</cc:Work>
|
28 |
+
</rdf:RDF>
|
29 |
+
</metadata>
|
30 |
+
<sodipodi:namedview
|
31 |
+
pagecolor="#ffffff"
|
32 |
+
bordercolor="#666666"
|
33 |
+
borderopacity="1"
|
34 |
+
objecttolerance="10"
|
35 |
+
gridtolerance="10"
|
36 |
+
guidetolerance="10"
|
37 |
+
inkscape:pageopacity="0"
|
38 |
+
inkscape:pageshadow="2"
|
39 |
+
inkscape:window-width="1920"
|
40 |
+
inkscape:window-height="1001"
|
41 |
+
id="namedview3784"
|
42 |
+
showgrid="false"
|
43 |
+
fit-margin-top="0"
|
44 |
+
fit-margin-left="0"
|
45 |
+
fit-margin-right="0"
|
46 |
+
fit-margin-bottom="0"
|
47 |
+
inkscape:zoom="1.0727273"
|
48 |
+
inkscape:cx="316.73339"
|
49 |
+
inkscape:cy="269.5705"
|
50 |
+
inkscape:window-x="-9"
|
51 |
+
inkscape:window-y="-9"
|
52 |
+
inkscape:window-maximized="1"
|
53 |
+
inkscape:current-layer="svg3782" />
|
54 |
+
<path
|
55 |
+
d="m 485.43,293.72732 c 51.43,-29.68 51.43,-103.88 0,-133.56 l -238.79,-137.79 c -51.41,-29.661998 -115.66,7.432 -115.66,66.779 v 275.58 c 0,59.35 64.25,96.44 115.66,66.78 l 238.79,-137.79 z"
|
56 |
+
id="path3769"
|
57 |
+
inkscape:connector-curvature="0"
|
58 |
+
style="fill:#08c5d1;stroke:#ffffff;stroke-width:8" />
|
59 |
+
<path
|
60 |
+
d="m 358.46,293.72732 c 51.42,-29.68 51.42,-103.88 0,-133.56 l -238.8,-137.79 C 68.251,-7.284678 4,29.80932 4,89.15632 v 275.58 c 0,59.35 64.251,96.44 115.66,66.78 l 238.8,-137.79 z"
|
61 |
+
id="path3771"
|
62 |
+
inkscape:connector-curvature="0"
|
63 |
+
style="fill:#d46f4d;stroke:#ffffff;stroke-width:8" />
|
64 |
+
<g
|
65 |
+
clip-path="url(#clip0)"
|
66 |
+
id="g3775"
|
67 |
+
transform="translate(0,6.947322)">
|
68 |
+
<path
|
69 |
+
d="m 186.95,222.05 65.43,-55.94 c 1.84,-1.57 1.84,-4.13 0,-5.7 -12.9,-11.02 -33.81,-11.02 -46.7,0 l -45.42,38.83 -9.77,-8.36 c 1.69,-3.67 2.63,-7.67 2.63,-11.85 0,-17.82 -16.9,-32.27 -37.75,-32.27 -20.841,0 -37.738,14.45 -37.738,32.27 0,17.82 16.897,32.26 37.738,32.26 1.79,0 3.54,-0.1 5.26,-0.31 l 12.94,11.07 -12.94,11.07 c -1.72,-0.21 -3.47,-0.32 -5.26,-0.32 -20.841,0 -37.738,14.45 -37.738,32.27 0,17.82 16.897,32.26 37.738,32.26 20.85,0 37.75,-14.44 37.75,-32.26 0,-4.19 -0.94,-8.18 -2.63,-11.85 l 9.77,-8.36 45.42,38.83 c 12.89,11.02 33.8,11.02 46.7,0 1.84,-1.58 1.84,-4.13 0,-5.71 z m -71.58,-32.27 c -6.93,0 -12.58,-4.82 -12.58,-10.75 0,-5.93 5.65,-10.76 12.58,-10.76 6.94,0 12.58,4.83 12.58,10.76 0,5.93 -5.64,10.75 -12.58,10.75 z m 0,86.04 c -6.93,0 -12.58,-4.82 -12.58,-10.75 0,-5.93 5.65,-10.76 12.58,-10.76 6.94,0 12.58,4.83 12.58,10.76 0,5.93 -5.64,10.75 -12.58,10.75 z"
|
70 |
+
id="path3773"
|
71 |
+
inkscape:connector-curvature="0"
|
72 |
+
style="fill:#ffffff" />
|
73 |
+
</g>
|
74 |
+
<defs
|
75 |
+
id="defs3780">
|
76 |
+
<clipPath
|
77 |
+
id="clip0">
|
78 |
+
<rect
|
79 |
+
width="176.13"
|
80 |
+
transform="translate(77.632,136.01)"
|
81 |
+
height="172.08"
|
82 |
+
id="rect3777"
|
83 |
+
x="0"
|
84 |
+
y="0"
|
85 |
+
style="fill:#ffffff" />
|
86 |
+
</clipPath>
|
87 |
+
</defs>
|
88 |
+
</svg>
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
|
2 |
+
<g>
|
3 |
+
<path fill="transparent"
|
4 |
+
d="M191.968 464.224h158.912c23.68 0 42.656 19.2 42.656 42.656 0 11.488-4.48 21.984-11.968 29.632l0.192 0.448-108.768 108.736c-75.104 75.136-75.104 196.512 0 271.584 74.88 74.848 196.448 74.848 271.552 0 74.88-75.104 74.88-196.48 0-271.584-21.76-21.504-47.36-37.12-74.464-46.272l28.608-28.576h365.248c87.040 0 157.856-74.016 159.968-166.4 0-1.472 0.224-2.752 0-4.256-2.112-23.904-22.368-42.656-46.912-42.656h-264.96l191.328-191.328c17.504-17.504 18.56-45.024 3.2-63.36-1.024-1.28-2.080-2.144-3.2-3.2-66.528-63.552-169.152-65.92-230.56-4.48l-262.368 262.368h-46.528c12.8-25.6 20.032-54.624 20.032-85.344 0-106.016-85.952-192-192-192-106.016 0-191.968 85.984-191.968 192 0.032 106.080 85.984 192.032 192 192.032zM277.312 272.256c0 47.136-38.176 85.344-85.344 85.344-47.136 0-85.312-38.176-85.312-85.344s38.176-85.344 85.312-85.344c47.168 0 85.344 38.208 85.344 85.344zM469.088 721.312c33.28 33.248 33.28 87.264 0 120.512-33.28 33.472-87.264 33.472-120.736 0-33.28-33.248-33.28-87.264 0-120.512 33.472-33.504 87.456-33.504 120.736 0z" />
|
5 |
+
</g>
|
6 |
+
</svg>
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
+
<svg
|
3 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4 |
+
xmlns:cc="http://creativecommons.org/ns#"
|
5 |
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
6 |
+
xmlns:svg="http://www.w3.org/2000/svg"
|
7 |
+
xmlns="http://www.w3.org/2000/svg"
|
8 |
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
9 |
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
10 |
+
width="527.87659"
|
11 |
+
viewBox="0 0 527.87659 527.89307"
|
12 |
+
height="527.89307"
|
13 |
+
version="1.1"
|
14 |
+
id="svg3782"
|
15 |
+
sodipodi:docname="icon.svg"
|
16 |
+
style="fill:none"
|
17 |
+
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
18 |
+
<metadata
|
19 |
+
id="metadata3786">
|
20 |
+
<rdf:RDF>
|
21 |
+
<cc:Work
|
22 |
+
rdf:about="">
|
23 |
+
<dc:format>image/svg+xml</dc:format>
|
24 |
+
<dc:type
|
25 |
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
26 |
+
<dc:title></dc:title>
|
27 |
+
</cc:Work>
|
28 |
+
</rdf:RDF>
|
29 |
+
</metadata>
|
30 |
+
<sodipodi:namedview
|
31 |
+
pagecolor="#ffffff"
|
32 |
+
bordercolor="#666666"
|
33 |
+
borderopacity="1"
|
34 |
+
objecttolerance="10"
|
35 |
+
gridtolerance="10"
|
36 |
+
guidetolerance="10"
|
37 |
+
inkscape:pageopacity="0"
|
38 |
+
inkscape:pageshadow="2"
|
39 |
+
inkscape:window-width="1920"
|
40 |
+
inkscape:window-height="1001"
|
41 |
+
id="namedview3784"
|
42 |
+
showgrid="false"
|
43 |
+
fit-margin-top="0"
|
44 |
+
fit-margin-left="0"
|
45 |
+
fit-margin-right="0"
|
46 |
+
fit-margin-bottom="0"
|
47 |
+
inkscape:zoom="1.0727273"
|
48 |
+
inkscape:cx="316.73339"
|
49 |
+
inkscape:cy="269.5705"
|
50 |
+
inkscape:window-x="-9"
|
51 |
+
inkscape:window-y="-9"
|
52 |
+
inkscape:window-maximized="1"
|
53 |
+
inkscape:current-layer="svg3782" />
|
54 |
+
<path
|
55 |
+
d="m 485.43,293.72732 c 51.43,-29.68 51.43,-103.88 0,-133.56 l -238.79,-137.79 c -51.41,-29.661998 -115.66,7.432 -115.66,66.779 v 275.58 c 0,59.35 64.25,96.44 115.66,66.78 l 238.79,-137.79 z"
|
56 |
+
id="path3769"
|
57 |
+
inkscape:connector-curvature="0"
|
58 |
+
style="fill:#08c5d1;stroke:#ffffff;stroke-width:8" />
|
59 |
+
<path
|
60 |
+
d="m 358.46,293.72732 c 51.42,-29.68 51.42,-103.88 0,-133.56 l -238.8,-137.79 C 68.251,-7.284678 4,29.80932 4,89.15632 v 275.58 c 0,59.35 64.251,96.44 115.66,66.78 l 238.8,-137.79 z"
|
61 |
+
id="path3771"
|
62 |
+
inkscape:connector-curvature="0"
|
63 |
+
style="fill:#d46f4d;stroke:#ffffff;stroke-width:8" />
|
64 |
+
<g
|
65 |
+
clip-path="url(#clip0)"
|
66 |
+
id="g3775"
|
67 |
+
transform="translate(0,6.947322)">
|
68 |
+
<path
|
69 |
+
d="m 186.95,222.05 65.43,-55.94 c 1.84,-1.57 1.84,-4.13 0,-5.7 -12.9,-11.02 -33.81,-11.02 -46.7,0 l -45.42,38.83 -9.77,-8.36 c 1.69,-3.67 2.63,-7.67 2.63,-11.85 0,-17.82 -16.9,-32.27 -37.75,-32.27 -20.841,0 -37.738,14.45 -37.738,32.27 0,17.82 16.897,32.26 37.738,32.26 1.79,0 3.54,-0.1 5.26,-0.31 l 12.94,11.07 -12.94,11.07 c -1.72,-0.21 -3.47,-0.32 -5.26,-0.32 -20.841,0 -37.738,14.45 -37.738,32.27 0,17.82 16.897,32.26 37.738,32.26 20.85,0 37.75,-14.44 37.75,-32.26 0,-4.19 -0.94,-8.18 -2.63,-11.85 l 9.77,-8.36 45.42,38.83 c 12.89,11.02 33.8,11.02 46.7,0 1.84,-1.58 1.84,-4.13 0,-5.71 z m -71.58,-32.27 c -6.93,0 -12.58,-4.82 -12.58,-10.75 0,-5.93 5.65,-10.76 12.58,-10.76 6.94,0 12.58,4.83 12.58,10.76 0,5.93 -5.64,10.75 -12.58,10.75 z m 0,86.04 c -6.93,0 -12.58,-4.82 -12.58,-10.75 0,-5.93 5.65,-10.76 12.58,-10.76 6.94,0 12.58,4.83 12.58,10.76 0,5.93 -5.64,10.75 -12.58,10.75 z"
|
70 |
+
id="path3773"
|
71 |
+
inkscape:connector-curvature="0"
|
72 |
+
style="fill:#ffffff" />
|
73 |
+
</g>
|
74 |
+
<defs
|
75 |
+
id="defs3780">
|
76 |
+
<clipPath
|
77 |
+
id="clip0">
|
78 |
+
<rect
|
79 |
+
width="176.13"
|
80 |
+
transform="translate(77.632,136.01)"
|
81 |
+
height="172.08"
|
82 |
+
id="rect3777"
|
83 |
+
x="0"
|
84 |
+
y="0"
|
85 |
+
style="fill:#ffffff" />
|
86 |
+
</clipPath>
|
87 |
+
</defs>
|
88 |
+
</svg>
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
|
2 |
+
<g>
|
3 |
+
<path fill="transparent"
|
4 |
+
d="M191.968 464.224h158.912c23.68 0 42.656 19.2 42.656 42.656 0 11.488-4.48 21.984-11.968 29.632l0.192 0.448-108.768 108.736c-75.104 75.136-75.104 196.512 0 271.584 74.88 74.848 196.448 74.848 271.552 0 74.88-75.104 74.88-196.48 0-271.584-21.76-21.504-47.36-37.12-74.464-46.272l28.608-28.576h365.248c87.040 0 157.856-74.016 159.968-166.4 0-1.472 0.224-2.752 0-4.256-2.112-23.904-22.368-42.656-46.912-42.656h-264.96l191.328-191.328c17.504-17.504 18.56-45.024 3.2-63.36-1.024-1.28-2.080-2.144-3.2-3.2-66.528-63.552-169.152-65.92-230.56-4.48l-262.368 262.368h-46.528c12.8-25.6 20.032-54.624 20.032-85.344 0-106.016-85.952-192-192-192-106.016 0-191.968 85.984-191.968 192 0.032 106.080 85.984 192.032 192 192.032zM277.312 272.256c0 47.136-38.176 85.344-85.344 85.344-47.136 0-85.312-38.176-85.312-85.344s38.176-85.344 85.312-85.344c47.168 0 85.344 38.208 85.344 85.344zM469.088 721.312c33.28 33.248 33.28 87.264 0 120.512-33.28 33.472-87.264 33.472-120.736 0-33.28-33.248-33.28-87.264 0-120.512 33.472-33.504 87.456-33.504 120.736 0z" />
|
5 |
+
</g>
|
6 |
+
</svg>
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Code Snippets - An easy, clean and simple way to add code snippets to your site.
|
4 |
+
*
|
5 |
+
* If you're interested in helping to develop Code Snippets, or perhaps contribute
|
6 |
+
* to the localization, please see https://github.com/sheabunge/code-snippets
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
* @author Shea Bunge <shea@codesnippets.pro>
|
10 |
+
* @copyright 2012-2022 Shea Bunge
|
11 |
+
* @license GPL-2.0-or-later https://spdx.org/licenses/GPL-2.0-or-later.html
|
12 |
+
* @version 3.2.1
|
13 |
+
* @link https://github.com/sheabunge/code-snippets
|
14 |
+
*/
|
15 |
+
|
16 |
+
/*
|
17 |
+
Plugin Name: Code Snippets
|
18 |
+
Plugin URI: https://codesnippets.pro
|
19 |
+
Description: An easy, clean and simple way to run code snippets on your site. No need to edit to your theme's functions.php file again!
|
20 |
+
Author: Code Snippets Pro
|
21 |
+
Author URI: https://codesnippets.pro
|
22 |
+
Version: 3.2.1
|
23 |
+
License: GPL-2.0-or-later
|
24 |
+
License URI: license.txt
|
25 |
+
Text Domain: code-snippets
|
26 |
+
Requires PHP: 5.6
|
27 |
+
Requires at least: 3.6
|
28 |
+
*/
|
29 |
+
|
30 |
+
/* Exit if accessed directly */
|
31 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
/* If a version of code snippets has already been loaded, then deactivate this plugin. */
|
36 |
+
if ( defined( 'CODE_SNIPPETS_FILE' ) ) {
|
37 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
38 |
+
deactivate_plugins( array( 'code-snippets/code-snippets.php' ), true );
|
39 |
+
|
40 |
+
if ( ! function_exists( 'code_snippets_deactivated_old_version_notice' ) ) {
|
41 |
+
/**
|
42 |
+
* Display a message informing the user that this plugin has been deactivated.
|
43 |
+
*/
|
44 |
+
function code_snippets_deactivated_old_version_notice() {
|
45 |
+
echo '<div class="error fade"><p>';
|
46 |
+
esc_html_e( 'Another version of Code Snippets appears to be installed. Deactivating this version.', 'code-snippets' );
|
47 |
+
echo '</p></div>';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
add_action( 'admin_notices', 'code_snippets_deactivated_old_version_notice', 11 );
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* The full path to the main file of this plugin
|
57 |
+
*
|
58 |
+
* This can later be passed to functions such as
|
59 |
+
* plugin_dir_path(), plugins_url() and plugin_basename()
|
60 |
+
* to retrieve information about plugin paths
|
61 |
+
*
|
62 |
+
* @since 2.0
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
define( 'CODE_SNIPPETS_FILE', __FILE__ );
|
66 |
+
|
67 |
+
if ( version_compare( phpversion(), '5.6', '>=' ) ) {
|
68 |
+
require_once __DIR__ . '/php/load.php';
|
69 |
+
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( ! function_exists( 'code_snippets_php_version_notice' ) ) {
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Display a warning message and deactivate the plugin if the user is using an incompatible version of PHP
|
77 |
+
*
|
78 |
+
* @since 3.0.0
|
79 |
+
*/
|
80 |
+
function code_snippets_php_version_notice() {
|
81 |
+
echo '<div class="error fade"><p>';
|
82 |
+
echo '<p><strong>', esc_html__( 'Code Snippets requires PHP 5.6 or later.', 'code-snippets' ), '</strong><br>';
|
83 |
+
|
84 |
+
$update_url = function_exists( 'wp_get_default_update_php_url' ) ?
|
85 |
+
wp_get_default_update_php_url() :
|
86 |
+
'https://wordpress.org/support/update-php/';
|
87 |
+
|
88 |
+
/* translators: %s: Update PHP URL */
|
89 |
+
$text = __( 'Please <a href="%s">upgrade your server to the latest version of PHP</a> to continue using Code Snippets.', 'code-snippets' );
|
90 |
+
|
91 |
+
echo wp_kses( sprintf( $text, $update_url ), array( 'a' => array( 'href' => array() ) ) );
|
92 |
+
echo '</p></div>';
|
93 |
+
|
94 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
95 |
+
}
|
96 |
+
|
97 |
+
add_action( 'admin_notices', 'code_snippets_php_version_notice' );
|
98 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
$php-active: #0073aa;
|
3 |
+
$php-inactive: #579;
|
4 |
+
$php-background: #78c8e6;
|
5 |
+
|
6 |
+
$css-inactive: #b452cd;
|
7 |
+
$css-active: #7d26cd;
|
8 |
+
$css-background: #551a8b;
|
9 |
+
$css-highlight: #8000ff;
|
10 |
+
|
11 |
+
$html-active: #548b54;
|
12 |
+
$html-background: #548b54;
|
13 |
+
$html-highlight: $html-active;
|
14 |
+
|
15 |
+
$js-inactive: #cd6600;
|
16 |
+
$js-active: #d44500;
|
17 |
+
$js-background: #cd6600;
|
18 |
+
$js-highlight: #cd6600;
|
19 |
+
|
20 |
+
|
21 |
+
@mixin link-colors($color, $lightness: 15%) {
|
22 |
+
a {
|
23 |
+
color: $color;
|
24 |
+
|
25 |
+
&:hover, &:active, &:focus {
|
26 |
+
color: lighten($color, $lightness);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/codemirror-colorpicker/dist/codemirror-colorpicker.css';
|
2 |
+
|
3 |
+
.CodeMirror {
|
4 |
+
border: 1px solid #dfdfdf;
|
5 |
+
border-radius: 3px;
|
6 |
+
background-color: #fff;
|
7 |
+
height: auto !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.CodeMirror-code {
|
11 |
+
outline: none;
|
12 |
+
}
|
13 |
+
|
14 |
+
.CodeMirror-focused .cm-matchhighlight {
|
15 |
+
color: white !important;
|
16 |
+
outline: 1px solid green;
|
17 |
+
}
|
18 |
+
|
19 |
+
/* Add a bit of extra space above the editor */
|
20 |
+
.CodeMirror-sizer {
|
21 |
+
|
22 |
+
&::before, &::after {
|
23 |
+
display: block;
|
24 |
+
color: #bbb;
|
25 |
+
}
|
26 |
+
|
27 |
+
&::before {
|
28 |
+
content: '';
|
29 |
+
padding-bottom: 5px;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Fix cursor color with rubyblue theme (see https://goo.gl/3HDgRm */
|
34 |
+
.cm-s-rubyblue .CodeMirror-cursor {
|
35 |
+
border-left: 1px solid white !important;
|
36 |
+
}
|
37 |
+
|
38 |
+
[class*="CodeMirror-lint-marker"], [class*="CodeMirror-lint-message"], .CodeMirror-lint-marker-multiple {
|
39 |
+
background-image: none;
|
40 |
+
}
|
41 |
+
|
42 |
+
.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
|
43 |
+
cursor: help;
|
44 |
+
}
|
45 |
+
|
46 |
+
.CodeMirror-lint-marker-multiple {
|
47 |
+
position: absolute;
|
48 |
+
top: 0;
|
49 |
+
}
|
50 |
+
|
51 |
+
[class*="CodeMirror-lint-marker"]:before {
|
52 |
+
font: normal 18px/1 dashicons;
|
53 |
+
position: relative;
|
54 |
+
top: -2px;
|
55 |
+
}
|
56 |
+
|
57 |
+
[class*="CodeMirror-lint-message"]:before {
|
58 |
+
font: normal 16px/1 dashicons;
|
59 |
+
left: 16px;
|
60 |
+
position: absolute;
|
61 |
+
}
|
62 |
+
|
63 |
+
.CodeMirror-lint-message-error,
|
64 |
+
.CodeMirror-lint-message-warning {
|
65 |
+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
66 |
+
margin: 5px 0 2px;
|
67 |
+
padding: 3px 12px 3px 28px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.CodeMirror-lint-message-warning {
|
71 |
+
background-color: #fff8e5;
|
72 |
+
border-left: 4px solid #ffb900;
|
73 |
+
}
|
74 |
+
|
75 |
+
.CodeMirror-lint-marker-warning::before, .CodeMirror-lint-message-warning::before {
|
76 |
+
content: "\f534";
|
77 |
+
color: #f6a306;
|
78 |
+
}
|
79 |
+
|
80 |
+
.CodeMirror-lint-message-error {
|
81 |
+
background-color: #fbeaea;
|
82 |
+
border-left: 4px solid #dc3232;
|
83 |
+
}
|
84 |
+
|
85 |
+
.CodeMirror-lint-marker-error::before, .CodeMirror-lint-message-error::before {
|
86 |
+
content: "\f153";
|
87 |
+
color: #dc3232;
|
88 |
+
}
|
89 |
+
|
90 |
+
.CodeMirror-lint-tooltip {
|
91 |
+
background: none;
|
92 |
+
border: none;
|
93 |
+
border-radius: 0;
|
94 |
+
direction: ltr;
|
95 |
+
}
|
96 |
+
|
97 |
+
.CodeMirror .CodeMirror-matchingbracket {
|
98 |
+
background: rgba(255, 150, 0, .3);
|
99 |
+
color: inherit;
|
100 |
+
}
|
101 |
+
|
102 |
+
.CodeMirror .CodeMirror-linenumber {
|
103 |
+
color: #666;
|
104 |
+
}
|
105 |
+
|
106 |
+
.CodeMirror-foldmarker {
|
107 |
+
color: inherit;
|
108 |
+
margin-left: 0.25em;
|
109 |
+
margin-right: 0.25em;
|
110 |
+
font-weight: bold;
|
111 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import 'base';
|
2 |
+
|
3 |
+
.nav-tab .badge, .snippet-type-badge, .go-pro-button .badge {
|
4 |
+
font-size: 10px;
|
5 |
+
text-transform: uppercase;
|
6 |
+
border: 1px solid;
|
7 |
+
padding: 1px 2px;
|
8 |
+
border-radius: 5px;
|
9 |
+
}
|
10 |
+
|
11 |
+
.nav-tab .badge, .button .snippet-type-badge, .go-pro-button .badge,
|
12 |
+
h1 .snippet-type-badge, h2 .snippet-type-badge, h3 .snippet-type-badge {
|
13 |
+
/* rtl:ignore */
|
14 |
+
margin-left: 3px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.nav-tab span,
|
18 |
+
.nav-tab .badge {
|
19 |
+
vertical-align: middle;
|
20 |
+
}
|
21 |
+
|
22 |
+
$badges: (php: $php-active, css: $css-highlight, js: $js-highlight, html: $html-active);
|
23 |
+
|
24 |
+
@each $type, $color in $badges {
|
25 |
+
.nav-tab[data-type=#{$type}] .badge, .snippet-type-badge[data-type=#{$type}] {
|
26 |
+
color: $color;
|
27 |
+
border-color: currentColor;
|
28 |
+
}
|
29 |
+
|
30 |
+
.nav-tab-inactive[data-type=#{$type}]:hover .badge {
|
31 |
+
color: $color;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
.nav-tab-button .dashicons-external {
|
36 |
+
font-size: 15px;
|
37 |
+
color: #666;
|
38 |
+
vertical-align: middle;
|
39 |
+
}
|
40 |
+
|
41 |
+
.nav-tab.nav-tab-inactive {
|
42 |
+
background: #f6f7f7;
|
43 |
+
border-color: #f6f7f7;
|
44 |
+
text-shadow: 0 1px 0 #fff;
|
45 |
+
float: right;
|
46 |
+
|
47 |
+
&, .badge {
|
48 |
+
color: #a7aaad;
|
49 |
+
}
|
50 |
+
|
51 |
+
&:hover {
|
52 |
+
color: #50575e;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
.go-pro-button .badge {
|
57 |
+
color: #ce0000;
|
58 |
+
border-color: #ce0000;
|
59 |
+
margin-left: 1px;
|
60 |
+
}
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/@jcubic/tagger/tagger.css';
|
2 |
+
@import 'editor';
|
3 |
+
|
4 |
+
@import 'type-badges';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Custom styling for the single snippet admin page
|
8 |
+
*/
|
9 |
+
|
10 |
+
.form-table th {
|
11 |
+
width: auto;
|
12 |
+
}
|
13 |
+
|
14 |
+
h2 {
|
15 |
+
/* Provide some decent space between the fields and titles */
|
16 |
+
margin: 25px 0 15px 0;
|
17 |
+
|
18 |
+
&:first-of-type {
|
19 |
+
margin-top: 20px;
|
20 |
+
}
|
21 |
+
|
22 |
+
label {
|
23 |
+
cursor: auto;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
.inactive-snippet, .active-snippet {
|
28 |
+
#title {
|
29 |
+
border-left-width: 4px;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
.active-snippet #title {
|
34 |
+
border-left-color: #46b450;
|
35 |
+
}
|
36 |
+
|
37 |
+
.inactive-snippet #title {
|
38 |
+
border-left-color: #bbb;
|
39 |
+
}
|
40 |
+
|
41 |
+
.erroneous-snippet #title {
|
42 |
+
border-left-color: #dc3232;
|
43 |
+
}
|
44 |
+
|
45 |
+
#snippet-form {
|
46 |
+
margin-top: 10px
|
47 |
+
}
|
48 |
+
|
49 |
+
/* Position the description heading on the same level as the editor buttons */
|
50 |
+
label[for='snippet_description'] h3 div {
|
51 |
+
position: absolute;
|
52 |
+
}
|
53 |
+
|
54 |
+
/* Add spacing in between the action buttons */
|
55 |
+
.button + .button {
|
56 |
+
margin-left: .5em;
|
57 |
+
}
|
58 |
+
|
59 |
+
.submit-inline {
|
60 |
+
float: right;
|
61 |
+
}
|
62 |
+
|
63 |
+
p.snippet-scope, .snippet-scope p {
|
64 |
+
margin-top: 15px;
|
65 |
+
}
|
66 |
+
|
67 |
+
.snippet-scope label,
|
68 |
+
.html-shortcode-options strong {
|
69 |
+
display: inline-block;
|
70 |
+
margin-right: 1.5em;
|
71 |
+
}
|
72 |
+
|
73 |
+
.below-editor {
|
74 |
+
display: flex;
|
75 |
+
justify-content: space-between;
|
76 |
+
}
|
77 |
+
|
78 |
+
.snippet-priority {
|
79 |
+
|
80 |
+
label {
|
81 |
+
font-weight: bold;
|
82 |
+
cursor: help;
|
83 |
+
font-size: 1.1em;
|
84 |
+
padding-right: 0.5em;
|
85 |
+
}
|
86 |
+
|
87 |
+
input {
|
88 |
+
width: 4em;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
.snippet-editor {
|
93 |
+
position: relative;
|
94 |
+
}
|
95 |
+
|
96 |
+
.CodeMirror {
|
97 |
+
width: 100%;
|
98 |
+
}
|
99 |
+
|
100 |
+
.wrap h2.nav-tab-wrapper {
|
101 |
+
border-bottom: none;
|
102 |
+
}
|
103 |
+
|
104 |
+
.code-snippets-copy-text {
|
105 |
+
color: inherit;
|
106 |
+
}
|
107 |
+
|
108 |
+
@import 'edit/tooltips';
|
109 |
+
@import 'edit/types';
|
110 |
+
@import 'edit/tags';
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.tagger {
|
3 |
+
border: 0;
|
4 |
+
|
5 |
+
ul {
|
6 |
+
border: 1px solid #dfdfdf;
|
7 |
+
border-radius: 3px;
|
8 |
+
background-color: #fff;
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
.tagger-new ul,
|
13 |
+
.tagger > ul > li:not(.tagger-new) > a,
|
14 |
+
.tagger li:not(.tagger-new) > span {
|
15 |
+
border-radius: 6px;
|
16 |
+
border: 1px solid #cad8f3;
|
17 |
+
background-color: #dee7f8;
|
18 |
+
|
19 |
+
&:hover {
|
20 |
+
background-color: #bbcef1;
|
21 |
+
border-color: #6d95e0;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
.tagger-new ul,
|
26 |
+
.tagger > ul > li:not(.tagger-new) {
|
27 |
+
a, a:visited {
|
28 |
+
color: #555;
|
29 |
+
font-size: 1.1em;
|
30 |
+
}
|
31 |
+
}
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.editor-help-tooltip {
|
3 |
+
cursor: help;
|
4 |
+
padding: 0.3em 0.3em 0;
|
5 |
+
display: inline-block;
|
6 |
+
font-size: 10px;
|
7 |
+
background: transparent !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.snippet-editor-help {
|
11 |
+
position: absolute;
|
12 |
+
right: 5px;
|
13 |
+
top: 5px;
|
14 |
+
|
15 |
+
&:hover .editor-help-text {
|
16 |
+
visibility: visible;
|
17 |
+
opacity: 1;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
.editor-help-text {
|
22 |
+
visibility: hidden;
|
23 |
+
background-color: #555;
|
24 |
+
color: #fff;
|
25 |
+
padding: 5px;
|
26 |
+
border-radius: 6px;
|
27 |
+
position: absolute;
|
28 |
+
z-index: 99;
|
29 |
+
top: 125%;
|
30 |
+
right: 0;
|
31 |
+
margin-right: -10px;
|
32 |
+
opacity: 0;
|
33 |
+
transition: opacity 0.3s;
|
34 |
+
white-space: nowrap;
|
35 |
+
font-size: small;
|
36 |
+
|
37 |
+
&::after {
|
38 |
+
content: "";
|
39 |
+
position: absolute;
|
40 |
+
bottom: 100%;
|
41 |
+
right: 0;
|
42 |
+
margin-right: 10px;
|
43 |
+
border: 5px solid transparent;
|
44 |
+
border-bottom-color: #555;
|
45 |
+
}
|
46 |
+
|
47 |
+
td:first-child {
|
48 |
+
padding-right: 0.5em;
|
49 |
+
}
|
50 |
+
|
51 |
+
.mac-key {
|
52 |
+
display: none;
|
53 |
+
}
|
54 |
+
|
55 |
+
&.platform-mac {
|
56 |
+
.mac-key {
|
57 |
+
display: inline;
|
58 |
+
}
|
59 |
+
|
60 |
+
.pc-key {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.CodeMirror-sizer {
|
3 |
+
min-height: 300px !important;
|
4 |
+
box-sizing: border-box;
|
5 |
+
padding-bottom: 1.5em !important;
|
6 |
+
|
7 |
+
&::after {
|
8 |
+
position: absolute;
|
9 |
+
bottom: 0;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
.snippet-scope {
|
14 |
+
display: none;
|
15 |
+
|
16 |
+
.description {
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
[data-snippet-type=php] {
|
22 |
+
|
23 |
+
.php-scopes-list {
|
24 |
+
display: block;
|
25 |
+
}
|
26 |
+
|
27 |
+
.CodeMirror-sizer {
|
28 |
+
padding-bottom: 0 !important;
|
29 |
+
}
|
30 |
+
|
31 |
+
.CodeMirror-sizer::before {
|
32 |
+
content: '<?php';
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
[data-snippet-type=css] {
|
37 |
+
|
38 |
+
.css-scopes-list {
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
|
42 |
+
.CodeMirror-sizer::before {
|
43 |
+
content: '<style>';
|
44 |
+
}
|
45 |
+
|
46 |
+
.CodeMirror-sizer::after {
|
47 |
+
content: '</style>';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
[data-snippet-type=js] {
|
52 |
+
|
53 |
+
.js-scopes-list {
|
54 |
+
display: block;
|
55 |
+
}
|
56 |
+
|
57 |
+
.CodeMirror-sizer::before {
|
58 |
+
content: '<script>';
|
59 |
+
}
|
60 |
+
|
61 |
+
.CodeMirror-sizer::after {
|
62 |
+
content: '</script>';
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
[data-snippet-type=html] {
|
67 |
+
|
68 |
+
.html-scopes-list {
|
69 |
+
display: block;
|
70 |
+
}
|
71 |
+
|
72 |
+
.CodeMirror-sizer::before {
|
73 |
+
content: '<!-- begin content -->';
|
74 |
+
}
|
75 |
+
|
76 |
+
.CodeMirror-sizer::after {
|
77 |
+
content: '<!-- end content -->';
|
78 |
+
}
|
79 |
+
}
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Custom styling for the snippets table
|
3 |
+
*/
|
4 |
+
|
5 |
+
$active-color: #2196f3;
|
6 |
+
$inactive-color: #ccc;
|
7 |
+
|
8 |
+
@import 'type-badges';
|
9 |
+
|
10 |
+
.wp-core-ui .button.nav-tab-button {
|
11 |
+
margin-left: 0.5em;
|
12 |
+
color: #50575e;
|
13 |
+
float: left;
|
14 |
+
border: 1px solid #c3c4c7;
|
15 |
+
background: #dcdcde;
|
16 |
+
|
17 |
+
&:hover {
|
18 |
+
background-color: #fff;
|
19 |
+
color: #3c434a;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
.column-name {
|
24 |
+
|
25 |
+
.dashicons {
|
26 |
+
font-size: 16px;
|
27 |
+
width: 16px;
|
28 |
+
height: 16px;
|
29 |
+
vertical-align: middle;
|
30 |
+
}
|
31 |
+
|
32 |
+
.dashicons-clock {
|
33 |
+
vertical-align: middle;
|
34 |
+
}
|
35 |
+
|
36 |
+
.active-snippet & > a {
|
37 |
+
font-weight: 600;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
.column-priority input {
|
42 |
+
appearance: none;
|
43 |
+
background: none;
|
44 |
+
border: none;
|
45 |
+
box-shadow: none;
|
46 |
+
width: 4em;
|
47 |
+
color: #666;
|
48 |
+
text-align: center;
|
49 |
+
|
50 |
+
&:hover, &:focus, &:active {
|
51 |
+
color: #000;
|
52 |
+
background-color: #f5f5f5;
|
53 |
+
background-color: rgba(0, 0, 0, 0.1);
|
54 |
+
border-radius: 6px;
|
55 |
+
}
|
56 |
+
|
57 |
+
&:disabled {
|
58 |
+
color: inherit;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
.snippet-execution-button,
|
63 |
+
.snippet-activation-switch {
|
64 |
+
display: block;
|
65 |
+
position: relative;
|
66 |
+
}
|
67 |
+
|
68 |
+
.snippet-activation-switch {
|
69 |
+
margin-top: 5px;
|
70 |
+
width: 30px;
|
71 |
+
height: 17px;
|
72 |
+
border-radius: 34px;
|
73 |
+
background-color: #ccc;
|
74 |
+
|
75 |
+
&::before {
|
76 |
+
transition: all .4s;
|
77 |
+
content: "";
|
78 |
+
height: 13px;
|
79 |
+
width: 13px;
|
80 |
+
display: inline-block;
|
81 |
+
margin: 2px;
|
82 |
+
background-color: white;
|
83 |
+
border-radius: 50%;
|
84 |
+
}
|
85 |
+
|
86 |
+
&:hover::before {
|
87 |
+
transform: translateX(40%);
|
88 |
+
}
|
89 |
+
|
90 |
+
.snippets .active-snippet & {
|
91 |
+
background-color: $active-color;
|
92 |
+
|
93 |
+
&::before {
|
94 |
+
transform: translateX(100%);
|
95 |
+
}
|
96 |
+
|
97 |
+
&:hover::before {
|
98 |
+
transform: translateX(60%);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
.snippets .erroneous-snippet &::before {
|
103 |
+
content: '!';
|
104 |
+
transform: translateX(50%);
|
105 |
+
text-align: center;
|
106 |
+
font-weight: bold;
|
107 |
+
line-height: 1;
|
108 |
+
color: #bbb;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
.snippet-execution-button {
|
113 |
+
margin-left: 10px;
|
114 |
+
margin-top: 9px;
|
115 |
+
width: 0;
|
116 |
+
height: 0;
|
117 |
+
border-top: 9px solid transparent;
|
118 |
+
border-bottom: 9px solid transparent;
|
119 |
+
border-left: 10px solid $inactive-color;
|
120 |
+
transition: all 0.3s;
|
121 |
+
|
122 |
+
&::before {
|
123 |
+
content: '';
|
124 |
+
position: absolute;
|
125 |
+
top: -14px;
|
126 |
+
left: -21px;
|
127 |
+
bottom: -14px;
|
128 |
+
right: -8px;
|
129 |
+
border-radius: 50%;
|
130 |
+
border: 1.8px solid $inactive-color;
|
131 |
+
z-index: 2;
|
132 |
+
transition: all .3s;
|
133 |
+
}
|
134 |
+
|
135 |
+
&:hover, &:focus {
|
136 |
+
border-left-color: #579;
|
137 |
+
|
138 |
+
&::before {
|
139 |
+
transform: scale(1.1);
|
140 |
+
border-color: #579;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
.clear-filters {
|
146 |
+
vertical-align: baseline !important;
|
147 |
+
}
|
148 |
+
|
149 |
+
.snippets {
|
150 |
+
|
151 |
+
tr {
|
152 |
+
background: #fff;
|
153 |
+
}
|
154 |
+
|
155 |
+
ol, ul {
|
156 |
+
margin: 0 0 1.5em 1.5em;
|
157 |
+
}
|
158 |
+
|
159 |
+
ul {
|
160 |
+
list-style: disc;
|
161 |
+
}
|
162 |
+
|
163 |
+
th.sortable a, th.sorted a {
|
164 |
+
display: flex;
|
165 |
+
flex-direction: row;
|
166 |
+
}
|
167 |
+
|
168 |
+
.row-actions {
|
169 |
+
color: #ddd;
|
170 |
+
position: relative;
|
171 |
+
left: 0;
|
172 |
+
}
|
173 |
+
|
174 |
+
.column-activate {
|
175 |
+
padding-right: 0 !important;
|
176 |
+
}
|
177 |
+
|
178 |
+
.clear-filters {
|
179 |
+
vertical-align: middle;
|
180 |
+
}
|
181 |
+
|
182 |
+
tfoot th.check-column {
|
183 |
+
padding: 13px 0 0 3px;
|
184 |
+
}
|
185 |
+
|
186 |
+
thead th.check-column,
|
187 |
+
tfoot th.check-column,
|
188 |
+
.inactive-snippet th.check-column {
|
189 |
+
padding-left: 5px;
|
190 |
+
}
|
191 |
+
|
192 |
+
td.column-description {
|
193 |
+
max-width: 700px;
|
194 |
+
}
|
195 |
+
|
196 |
+
.active-snippet, .inactive-snippet {
|
197 |
+
td, th {
|
198 |
+
padding: 10px 9px;
|
199 |
+
border: none;
|
200 |
+
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
.badge {
|
205 |
+
margin-left: 4px;
|
206 |
+
padding: 3px 6px;
|
207 |
+
text-decoration: none;
|
208 |
+
border: medium none;
|
209 |
+
border-radius: 2px;
|
210 |
+
background-color: #e0e0e0;
|
211 |
+
background-color: rgba(0, 0, 0, 0.08);
|
212 |
+
font-size: smaller;
|
213 |
+
line-height: 1.2;
|
214 |
+
|
215 |
+
/* rtl:ignore */
|
216 |
+
.rtl & {
|
217 |
+
float: left;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
tr.active-snippet + tr.inactive-snippet th,
|
222 |
+
tr.active-snippet + tr.inactive-snippet td {
|
223 |
+
border-top: 1px solid rgba(0, 0, 0, 0.03);
|
224 |
+
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02), inset 0 -1px 0 #e1e1e1;
|
225 |
+
}
|
226 |
+
|
227 |
+
&, #all-snippets-table, #search-snippets-table {
|
228 |
+
a.delete:hover {
|
229 |
+
border-bottom: 1px solid #f00;
|
230 |
+
color: #f00;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
#wpbody-content & .column-name {
|
235 |
+
white-space: nowrap; /* prevents wrapping of snippet title */
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
.inactive-snippet {
|
240 |
+
@include link-colors($php-inactive);
|
241 |
+
}
|
242 |
+
|
243 |
+
.active-snippet {
|
244 |
+
|
245 |
+
td, th {
|
246 |
+
background-color: rgba($php-background, 0.06);
|
247 |
+
}
|
248 |
+
|
249 |
+
th.check-column {
|
250 |
+
border-left: 2px solid #2ea2cc;
|
251 |
+
}
|
252 |
+
|
253 |
+
.snippet-activation-switch {
|
254 |
+
background-color: $active-color;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
@mixin snippet-type-colors($type, $active, $inactive, $background, $highlight) {
|
259 |
+
.#{$type}-snippet {
|
260 |
+
@include link-colors($inactive);
|
261 |
+
}
|
262 |
+
|
263 |
+
.#{$type}-snippet.active-snippet {
|
264 |
+
@include link-colors($active);
|
265 |
+
|
266 |
+
td, th {
|
267 |
+
background-color: rgba($background, 0.06);
|
268 |
+
}
|
269 |
+
|
270 |
+
.snippet-activation-switch {
|
271 |
+
background-color: $highlight;
|
272 |
+
}
|
273 |
+
|
274 |
+
th.check-column {
|
275 |
+
border-left-color: $highlight;
|
276 |
+
}
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
@include snippet-type-colors(css, $css-active, $css-inactive, $css-background, $css-highlight);
|
281 |
+
@include snippet-type-colors(html, $html-active, $html-active, $html-background, $html-highlight);
|
282 |
+
@include snippet-type-colors(js, $js-active, $js-inactive, $js-background, $js-highlight);
|
283 |
+
|
284 |
+
@media screen and (max-width: 782px) {
|
285 |
+
p.search-box {
|
286 |
+
float: left;
|
287 |
+
position: initial;
|
288 |
+
margin: 1em 0 0 0;
|
289 |
+
height: auto;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
.wp-list-table .is-expanded td.column-activate.activate {
|
294 |
+
/* fix for mobile layout */
|
295 |
+
display: table-cell !important;
|
296 |
+
}
|
297 |
+
|
298 |
+
.nav-tab-wrapper + .subsubsub, p.search-box {
|
299 |
+
margin: 10px 0 0 0;
|
300 |
+
}
|
301 |
+
|
302 |
+
.snippet-type-description {
|
303 |
+
border-bottom: 1px solid #ccc;
|
304 |
+
margin: 0;
|
305 |
+
padding: 1em 0;
|
306 |
+
}
|
307 |
+
|
308 |
+
.code-snippets-notice a.notice-dismiss {
|
309 |
+
text-decoration: none;
|
310 |
+
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/prismjs/themes/prism.css';
|
2 |
+
@import '../node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css';
|
3 |
+
@import '../node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css';
|
4 |
+
@import '../node_modules/prismjs/plugins/toolbar/prism-toolbar.css';
|
5 |
+
@import '../node_modules/prismjs/plugins/inline-color/prism-inline-color.css';
|
6 |
+
@import '../node_modules/prismjs/plugins/previewers/prism-previewers.css';
|
7 |
+
@import '../node_modules/prismjs/plugins/autolinker/prism-autolinker.css';
|
8 |
+
|
9 |
+
:not(.is-style-prism-shades-of-purple) pre[class*=language-].line-numbers .line-highlight {
|
10 |
+
box-sizing: border-box;
|
11 |
+
padding: 0;
|
12 |
+
margin: 1em 0 0;
|
13 |
+
}
|
14 |
+
|
15 |
+
.is-style-prism-coy-without-shadows pre[class*=language-] .line-highlight {
|
16 |
+
margin-top: 0;
|
17 |
+
}
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import 'editor';
|
2 |
+
|
3 |
+
$sections: general, description_editor, editor, license;
|
4 |
+
|
5 |
+
p.submit {
|
6 |
+
max-width: 1020px;
|
7 |
+
|
8 |
+
.button-secondary {
|
9 |
+
float: right;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
.nav-tab-wrapper {
|
14 |
+
margin-bottom: 1em;
|
15 |
+
}
|
16 |
+
|
17 |
+
input[type=number] {
|
18 |
+
width: 4em;
|
19 |
+
}
|
20 |
+
|
21 |
+
.CodeMirror {
|
22 |
+
max-width: 800px;
|
23 |
+
width: 100%;
|
24 |
+
padding-right: 1em;
|
25 |
+
}
|
26 |
+
|
27 |
+
.CodeMirror-sizer::before {
|
28 |
+
content: '<?php';
|
29 |
+
}
|
30 |
+
|
31 |
+
body.no-js {
|
32 |
+
.nav-tab-wrapper {
|
33 |
+
display: none;
|
34 |
+
}
|
35 |
+
|
36 |
+
.settings-section {
|
37 |
+
display: block !important;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
body.js {
|
42 |
+
|
43 |
+
.settings-section-title {
|
44 |
+
border: 0;
|
45 |
+
clip: rect(1px, 1px, 1px, 1px);
|
46 |
+
clip-path: inset(50%);
|
47 |
+
height: 1px;
|
48 |
+
margin: -1px;
|
49 |
+
overflow: hidden;
|
50 |
+
padding: 0;
|
51 |
+
position: absolute;
|
52 |
+
width: 1px;
|
53 |
+
word-wrap: normal !important;
|
54 |
+
}
|
55 |
+
|
56 |
+
.nav-tab:not(.nav-tab-active) {
|
57 |
+
cursor: pointer;
|
58 |
+
}
|
59 |
+
|
60 |
+
.settings-section {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
|
64 |
+
@each $section in $sections {
|
65 |
+
.wrap[data-active-tab=#{$section}] .#{$section}-settings {
|
66 |
+
display: block;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.tagger{border:1px solid #909497}.tagger input[type=hidden]{display:none}.tagger>ul{align-items:center;box-sizing:border-box;display:flex;height:auto;justify-content:space-between;padding:4px 0;width:100%}.tagger ul{list-style:none;margin:0}.tagger>ul>li{margin:.4rem 0;padding-right:10px}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#000}.tagger .tagger-new ul,.tagger li:not(.tagger-new)>span,.tagger>ul>li:not(.tagger-new)>a{background:#b1c3d7;border:1px solid #4181ed;border-radius:3px;padding:4px 8px 4px 4px}.tagger li a.close{filter:alpha(opacity=100);float:none;font-size:16px;line-height:16px;margin-right:4px;opacity:1;padding:4px}.tagger li a.close:hover{color:#fff}.tagger li:not(.tagger-new) a{text-decoration:none}.tagger .tagger-new input{background:transparent;border:none;box-shadow:none;outline:none;padding-right:0;width:100%}.tagger .tagger-new{flex-grow:1;position:relative}.tagger .tagger-new ul{padding:5px}.tagger .tagger-completion{position:absolute;z-index:100}.tagger.wrap>ul{flex-wrap:wrap;justify-content:start}.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";right:0;position:absolute;left:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-right:10px solid transparent;border-left:10px solid transparent;display:none;height:0;right:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-right:9px solid transparent;border-left:9px solid transparent;content:"";height:0;right:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-right:3px solid transparent;border-left:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;right:0;margin:2px;pointer-events:none;position:absolute;left:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(-90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{right:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(-90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;right:0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:-2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 2px 0 0;position:absolute;-webkit-user-select:text;-moz-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-left:40px;padding:0 9px 0 5px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-right:1px;padding-left:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;left:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;left:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:left;padding:10px 5px 10px 15px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-left:30px;padding:12px 12px 0 0}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-left:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-left:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;right:0;opacity:0;pointer-events:none;position:absolute;left:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;right:0;position:absolute;left:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;right:0;padding:3px 0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 14px 5px 5px;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-left:10px;text-align:left}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;right:0;overflow:auto;position:absolute;left:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 14px 5px 5px;pointer-events:none;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-left:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;right:auto;position:absolute;left:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;right:0;top:50%;transform:translateX(50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{right:0;transform:translateX(-50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-right:5px;padding-left:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-left:0;padding-left:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-left:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-left:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;right:-1px;left:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-right-radius:3px;border-top-left-radius:3px;bottom:auto;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;right:auto;overflow:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{right:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{right:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid #000;content:"";height:0;right:2px;position:absolute;top:0;transform:translateX(50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;bottom:0;content:"";height:0;right:2px;position:absolute;transform:translateX(50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;right:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;left:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;right:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-right:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 8px 0 0;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;right:50%;overflow:hidden;transform:none;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:left;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 4px 0 0;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-right:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 10px 10px 20px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;right:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-right:0!important;padding-right:0!important;padding-left:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-left:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-left:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;left:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{right:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-right:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;right:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 28px 3px 12px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-right:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-right:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:rtl}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.CodeMirror-foldmarker{color:inherit;font-weight:700;margin-right:.25em;margin-left:.25em}.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-right:3px}.nav-tab .badge,.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab-inactive[data-type=php]:hover .badge{color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab-inactive[data-type=css]:hover .badge{color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab-inactive[data-type=js]:hover .badge{color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-inactive[data-type=html]:hover .badge{color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.nav-tab.nav-tab-inactive{background:#f6f7f7;border-color:#f6f7f7;float:left;text-shadow:0 1px 0 #fff}.nav-tab.nav-tab-inactive,.nav-tab.nav-tab-inactive .badge{color:#a7aaad}.nav-tab.nav-tab-inactive:hover{color:#50575e}.go-pro-button .badge{border-color:#ce0000;color:#ce0000;margin-right:1px}.form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-right-width:4px}.active-snippet #title{border-right-color:#46b450}.inactive-snippet #title{border-right-color:#bbb}.erroneous-snippet #title{border-right-color:#dc3232}#snippet-form{margin-top:10px}label[for=snippet_description] h3 div{position:absolute}.button+.button{margin-right:.5em}.submit-inline{float:left}.snippet-scope p,p.snippet-scope{margin-top:15px}.html-shortcode-options strong,.snippet-scope label{display:inline-block;margin-left:1.5em}.below-editor{display:flex;justify-content:space-between}.snippet-priority label{cursor:help;font-size:1.1em;font-weight:700;padding-left:.5em}.snippet-priority input{width:4em}.snippet-editor{position:relative}.CodeMirror{width:100%}.wrap h2.nav-tab-wrapper{border-bottom:none}.code-snippets-copy-text{color:inherit}.editor-help-tooltip{background:transparent!important;cursor:help;display:inline-block;font-size:10px;padding:.3em .3em 0}.snippet-editor-help{position:absolute;left:5px;top:5px}.snippet-editor-help:hover .editor-help-text{opacity:1;visibility:visible}.editor-help-text{background-color:#555;border-radius:6px;color:#fff;font-size:small;margin-left:-10px;opacity:0;padding:5px;position:absolute;left:0;top:125%;transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:99}.editor-help-text:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";margin-left:10px;position:absolute;left:0}.editor-help-text td:first-child{padding-left:.5em}.editor-help-text .mac-key{display:none}.editor-help-text.platform-mac .mac-key{display:inline}.editor-help-text.platform-mac .pc-key{display:none}.CodeMirror-sizer{box-sizing:border-box;min-height:300px!important;padding-bottom:1.5em!important}.CodeMirror-sizer:after{bottom:0;position:absolute}.snippet-scope{display:none}.snippet-scope .description,[data-snippet-type=php] .php-scopes-list{display:block}[data-snippet-type=php] .CodeMirror-sizer{padding-bottom:0!important}[data-snippet-type=php] .CodeMirror-sizer:before{content:"<?php"}[data-snippet-type=css] .css-scopes-list{display:block}[data-snippet-type=css] .CodeMirror-sizer:before{content:"<style>"}[data-snippet-type=css] .CodeMirror-sizer:after{content:"</style>"}[data-snippet-type=js] .js-scopes-list{display:block}[data-snippet-type=js] .CodeMirror-sizer:before{content:"<script>"}[data-snippet-type=js] .CodeMirror-sizer:after{content:"</script>"}[data-snippet-type=html] .html-scopes-list{display:block}[data-snippet-type=html] .CodeMirror-sizer:before{content:"<!-- begin content -->"}[data-snippet-type=html] .CodeMirror-sizer:after{content:"<!-- end content -->"}.tagger{border:0}.tagger ul{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px}.tagger li:not(.tagger-new)>span,.tagger-new ul,.tagger>ul>li:not(.tagger-new)>a{background-color:#dee7f8;border:1px solid #cad8f3;border-radius:6px}.tagger li:not(.tagger-new)>span:hover,.tagger-new ul:hover,.tagger>ul>li:not(.tagger-new)>a:hover{background-color:#bbcef1;border-color:#6d95e0}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#555;font-size:1.1em}
|
2 |
+
|
3 |
+
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
.tagger{border:1px solid #909497}.tagger input[type=hidden]{display:none}.tagger>ul{align-items:center;box-sizing:border-box;display:flex;height:auto;justify-content:space-between;padding:4px 0;width:100%}.tagger ul{list-style:none;margin:0}.tagger>ul>li{margin:.4rem 0;padding-left:10px}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#000}.tagger .tagger-new ul,.tagger li:not(.tagger-new)>span,.tagger>ul>li:not(.tagger-new)>a{background:#b1c3d7;border:1px solid #4181ed;border-radius:3px;padding:4px 4px 4px 8px}.tagger li a.close{filter:alpha(opacity=100);float:none;font-size:16px;line-height:16px;margin-left:4px;opacity:1;padding:4px}.tagger li a.close:hover{color:#fff}.tagger li:not(.tagger-new) a{text-decoration:none}.tagger .tagger-new input{background:transparent;border:none;box-shadow:none;outline:none;padding-left:0;width:100%}.tagger .tagger-new{flex-grow:1;position:relative}.tagger .tagger-new ul{padding:5px}.tagger .tagger-completion{position:absolute;z-index:100}.tagger.wrap>ul{flex-wrap:wrap;justify-content:start}.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";left:0;position:absolute;right:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-left:10px solid transparent;border-right:10px solid transparent;display:none;height:0;left:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-left:9px solid transparent;border-right:9px solid transparent;content:"";height:0;left:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-left:3px solid transparent;border-right:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;left:0;margin:2px;pointer-events:none;position:absolute;right:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{left:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 0 0 2px;position:absolute;-webkit-user-select:text;-moz-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-right:40px;padding:0 5px 0 9px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-left:1px;padding-right:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;right:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;right:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:right;padding:10px 15px 10px 5px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-right:30px;padding:12px 0 0 12px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-right:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-right:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;left:0;position:absolute;right:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;left:0;padding:3px 0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 5px 5px 14px;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-right:10px;text-align:right}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;left:0;overflow:auto;position:absolute;right:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 5px 5px 14px;pointer-events:none;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-right:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;left:auto;position:absolute;right:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;left:0;top:50%;transform:translateX(-50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{left:0;transform:translateX(50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(-150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-left:5px;padding-right:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-right:0;padding-right:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-right:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-right:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;left:-1px;right:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-left-radius:3px;border-top-right-radius:3px;bottom:auto;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;left:auto;overflow:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{left:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{left:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;content:"";height:0;left:2px;position:absolute;top:0;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";height:0;left:2px;position:absolute;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;left:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;right:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;left:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-left:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 0 0 8px;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;left:50%;overflow:hidden;transform:none;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:right;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 0 0 4px;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-left:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(-2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 20px 10px 10px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;left:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-left:0!important;padding-left:0!important;padding-right:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-right:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-right:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;right:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{left:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:ltr}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.CodeMirror-foldmarker{color:inherit;font-weight:700;margin-left:.25em;margin-right:.25em}.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-left:3px}.nav-tab .badge,.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab-inactive[data-type=php]:hover .badge{color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab-inactive[data-type=css]:hover .badge{color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab-inactive[data-type=js]:hover .badge{color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-inactive[data-type=html]:hover .badge{color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.nav-tab.nav-tab-inactive{background:#f6f7f7;border-color:#f6f7f7;float:right;text-shadow:0 1px 0 #fff}.nav-tab.nav-tab-inactive,.nav-tab.nav-tab-inactive .badge{color:#a7aaad}.nav-tab.nav-tab-inactive:hover{color:#50575e}.go-pro-button .badge{border-color:#ce0000;color:#ce0000;margin-left:1px}.form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-left-width:4px}.active-snippet #title{border-left-color:#46b450}.inactive-snippet #title{border-left-color:#bbb}.erroneous-snippet #title{border-left-color:#dc3232}#snippet-form{margin-top:10px}label[for=snippet_description] h3 div{position:absolute}.button+.button{margin-left:.5em}.submit-inline{float:right}.snippet-scope p,p.snippet-scope{margin-top:15px}.html-shortcode-options strong,.snippet-scope label{display:inline-block;margin-right:1.5em}.below-editor{display:flex;justify-content:space-between}.snippet-priority label{cursor:help;font-size:1.1em;font-weight:700;padding-right:.5em}.snippet-priority input{width:4em}.snippet-editor{position:relative}.CodeMirror{width:100%}.wrap h2.nav-tab-wrapper{border-bottom:none}.code-snippets-copy-text{color:inherit}.editor-help-tooltip{background:transparent!important;cursor:help;display:inline-block;font-size:10px;padding:.3em .3em 0}.snippet-editor-help{position:absolute;right:5px;top:5px}.snippet-editor-help:hover .editor-help-text{opacity:1;visibility:visible}.editor-help-text{background-color:#555;border-radius:6px;color:#fff;font-size:small;margin-right:-10px;opacity:0;padding:5px;position:absolute;right:0;top:125%;transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:99}.editor-help-text:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";margin-right:10px;position:absolute;right:0}.editor-help-text td:first-child{padding-right:.5em}.editor-help-text .mac-key{display:none}.editor-help-text.platform-mac .mac-key{display:inline}.editor-help-text.platform-mac .pc-key{display:none}.CodeMirror-sizer{box-sizing:border-box;min-height:300px!important;padding-bottom:1.5em!important}.CodeMirror-sizer:after{bottom:0;position:absolute}.snippet-scope{display:none}.snippet-scope .description,[data-snippet-type=php] .php-scopes-list{display:block}[data-snippet-type=php] .CodeMirror-sizer{padding-bottom:0!important}[data-snippet-type=php] .CodeMirror-sizer:before{content:"<?php"}[data-snippet-type=css] .css-scopes-list{display:block}[data-snippet-type=css] .CodeMirror-sizer:before{content:"<style>"}[data-snippet-type=css] .CodeMirror-sizer:after{content:"</style>"}[data-snippet-type=js] .js-scopes-list{display:block}[data-snippet-type=js] .CodeMirror-sizer:before{content:"<script>"}[data-snippet-type=js] .CodeMirror-sizer:after{content:"</script>"}[data-snippet-type=html] .html-scopes-list{display:block}[data-snippet-type=html] .CodeMirror-sizer:before{content:"<!-- begin content -->"}[data-snippet-type=html] .CodeMirror-sizer:after{content:"<!-- end content -->"}.tagger{border:0}.tagger ul{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px}.tagger li:not(.tagger-new)>span,.tagger-new ul,.tagger>ul>li:not(.tagger-new)>a{background-color:#dee7f8;border:1px solid #cad8f3;border-radius:6px}.tagger li:not(.tagger-new)>span:hover,.tagger-new ul:hover,.tagger>ul>li:not(.tagger-new)>a:hover{background-color:#bbcef1;border-color:#6d95e0}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#555;font-size:1.1em}
|
2 |
+
|
@@ -0,0 +1 @@
|
|
|
1 |
+
"use strict";(self.webpackChunkcode_snippets=self.webpackChunkcode_snippets||[]).push([[922],{8042:(t,e,n)=>{function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var o={css:"text/css",js:"javascript",php:"text/x-php",html:"application/x-httpd-php"};function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var a="dashicon-clipboard",c="dashicon-yes";function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var s,f,d,p,v,y=function(t){var e=-1!==document.body.className.indexOf("network-admin"),n=document.querySelector("input[name=snippet_id]"),r=n?parseInt(n.value,10):0,o="[code_snippet";r&&(o+=" id=".concat(r)),e&&(o+=" network=true");var i,a=l(t);try{for(a.s();!(i=a.n()).done;){var c=i.value;c.checked&&(o+=" ".concat(c.value,"=true"))}}catch(t){a.e(t)}finally{a.f()}o+="]";var u=document.querySelector(".html-scopes-list");if(u){var s=u.querySelector(".shortcode-tag");s&&(s.textContent=o)}},m=n(1002);function b(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function g(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){b(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}n(3737),function(){var t,e=window.wp.codeEditor,n=document.getElementById("snippet_code");if(n){var r=e.initialize(n);window.code_snippets_editor=r;var o=r.codemirror.getOption("extraKeys"),i=window.navigator.platform.match("Mac")?"Cmd":"Ctrl",a=function(){var t;return null===(t=document.getElementById("save_snippet"))||void 0===t?void 0:t.click()};if(r.codemirror.setOption("extraKeys",g(g({},"object"===(0,m.Z)(o)?o:{}),{},(b(t={},"".concat(i,"-S"),a),b(t,"".concat(i,"-Enter"),a),t))),window.navigator.platform.match("Mac")){var c=document.querySelector(".editor-help-text");c&&(c.className+=" platform-mac")}var l=document.getElementById("snippet-code-direction");null==l||l.addEventListener("change",(function(){var t;null===(t=window.code_snippets_editor)||void 0===t||t.codemirror.setOption("direction","rtl"===l.value?"rtl":"ltr")}))}else console.error("Could not initialise CodeMirror on textarea.",n)}(),function(){var t=document.getElementById("snippet-type-tabs");if(t){var e,n=document.getElementById("snippet-form"),i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(l)throw a}}}}(t.querySelectorAll(".nav-tab"));try{var a=function(){var r=e.value;r.addEventListener("click",(function(e){if(!r.classList.contains("nav-tab-active")&&!r.classList.contains("nav-tab-inactive")){var i=r.getAttribute("data-type");e.preventDefault(),null==n||n.setAttribute("data-snippet-type",i),function(t,e){var n=t.querySelector(".nav-tab-active");null==n||n.setAttribute("href","#"),null==n||n.classList.remove("nav-tab-active"),e.classList.add("nav-tab-active"),e.removeAttribute("href")}(t,r),function(t,e){var n,r=null===(n=window.code_snippets_editor)||void 0===n?void 0:n.codemirror,i=null==e?void 0:e.querySelector(".".concat(t,"-scopes-list input:first-child"));i&&(i.checked=!0),null==r||r.setOption("lint","php"===t||"css"===t),t in o&&(null==r||r.setOption("mode",o[t]))}(i,n)}}))};for(i.s();!(e=i.n()).done;)a()}catch(t){i.e(t)}finally{i.f()}}}(),function(){var t,e=null===(t=document.querySelector(".html-shortcode-options"))||void 0===t?void 0:t.getElementsByTagName("input");if(e){var n,r=l(e);try{for(r.s();!(n=r.n()).done;)n.value.addEventListener("change",(function(){return y(e)}))}catch(t){r.e(t)}finally{r.f()}}}(),f=document.getElementById("snippet-form"),d=null===(s=window.code_snippets_editor)||void 0===s?void 0:s.codemirror,p=window.code_snippets_edit_i18n,v=document.querySelector("input[name=snippet_name]"),f&&d&&v&&f.addEventListener("submit",(function(t){var e,n=""===v.value.trim(),r=""===d.getValue().trim(),o=n?r?p.missing_title_code:p.missing_title:r?p.missing_code:"";null!=t&&null!==(e=t.submitter)&&void 0!==e&&e.id.startsWith("save_snippet")&&o&&!confirm(o)&&t.preventDefault()})),function(){var t,e=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(l)throw a}}}}(document.querySelectorAll(".code-snippets-copy-text"));try{var n=function(){var e=t.value;navigator.clipboard?e.addEventListener("click",(function(t){t.preventDefault();var n=e.getAttribute("data-text");n&&navigator.clipboard.writeText(n).then((function(){e.classList.replace(a,c),setTimeout((function(){return e.classList.replace(c,a)}),3e3)})).catch((function(t){return console.error(t)}))})):e.style.display="none"};for(e.s();!(t=e.n()).done;)n()}catch(t){e.e(t)}finally{e.f()}}()},1002:(t,e,n)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}n.d(e,{Z:()=>r})}},t=>{t(t.s=8042)}]);
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
|
1 |
+
(()=>{"use strict";var t,e={3737:(t,e,s)=>{const i=window.wp.CodeMirror;function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,i=new Array(e);s<e;s++)i[s]=t[s];return i}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var s=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=s){var i,n,h=[],o=!0,r=!1;try{for(s=s.call(t);!(o=(i=s.next()).done)&&(h.push(i.value),!e||h.length!==e);o=!0);}catch(t){r=!0,n=t}finally{try{o||null==s.return||s.return()}finally{if(r)throw n}}return h}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var r=s(3638),_=s.n(r);function a(t,e){var s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=function(t,e){if(t){if("string"==typeof t)return c(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?c(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h,o=!0,r=!1;return{s:function(){s=s.call(t)},n:function(){var t=s.next();return o=t.done,t},e:function(t){r=!0,h=t},f:function(){try{o||null==s.return||s.return()}finally{if(r)throw h}}}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,i=new Array(e);s<e;s++)i[s]=t[s];return i}var l=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.code=e,this.annotations=[],this.function_names=new Set,this.class_names=new Set}var e,s;return e=t,s=[{key:"lint",value:function(){var t=new(_())({parser:{suppressErrors:!0,version:800},ast:{withPositions:!0}});try{var e=t.parseEval(this.code);if(e.errors&&0<e.errors.length){var s,i=a(e.errors);try{for(i.s();!(s=i.n()).done;){var n=s.value;this.annotate(n.message,n.loc)}}catch(t){i.e(t)}finally{i.f()}}this.visit(e)}catch(n){console.error(n)}}},{key:"visit",value:function(t){if(t.kind&&this.validate(t),"children"in t){var e,s=a(t.children);try{for(s.s();!(e=s.n()).done;){var i=e.value;this.visit(i)}}catch(t){s.e(t)}finally{s.f()}}}},{key:"checkDuplicateIdentifier",value:function(t,e,s){e.has(t.name)?this.annotate("Cannot redeclare ".concat(s," ").concat(t.name,"()"),t.loc):e.add(t.name)}},{key:"validate",value:function(t){var e=t,s=e.name;"name"in e&&"name"in s&&"identifier"===s.kind&&("function"===t.kind?this.checkDuplicateIdentifier(s,this.function_names,"function"):"class"===t.kind&&this.checkDuplicateIdentifier(s,this.class_names,"class"))}},{key:"annotate",value:function(t,e){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error";if(e.start&&e.end){var n=e.end.offset<e.start.offset?[e.end,e.start]:[e.start,e.end],o=h(n,2),r=o[0],_=o[1];this.annotations.push({message:t,severity:s,from:i.Pos(r.line-1,r.column),to:i.Pos(_.line-1,_.column)})}}}],s&&o(e.prototype,s),Object.defineProperty(e,"prototype",{writable:!1}),t}();i.registerHelper("lint","php",(function(t){var e=new l(t);return e.lint(),e.annotations})),(0,i.defineMode)("php-snippet",(function(t){return(0,i.getMode)(t,{name:"application/x-httpd-php",startOpen:!0})}))},7446:(t,e,s)=>{const i=s(1703),n=s(1143),h=function(t,e){this.withPositions=t,this.withSource=e};h.precedence={},[["or"],["xor"],["and"],["="],["?"],["??"],["||"],["&&"],["|"],["^"],["&"],["==","!=","===","!==","<=>"],["<","<=",">",">="],["<<",">>"],["+","-","."],["*","/","%"],["!"],["instanceof"],["cast","silent"],["**"]].forEach((function(t,e){t.forEach((function(t){h.precedence[t]=e+1}))})),h.prototype.isRightAssociative=function(t){return"**"===t||"??"===t},h.prototype.swapLocations=function(t,e,s,i){this.withPositions&&(t.loc.start=e.loc.start,t.loc.end=s.loc.end,this.withSource&&(t.loc.source=i.lexer._input.substring(t.loc.start.offset,t.loc.end.offset)))},h.prototype.resolveLocations=function(t,e,s,i){this.withPositions&&(t.loc.start.offset>e.loc.start.offset&&(t.loc.start=e.loc.start),t.loc.end.offset<s.loc.end.offset&&(t.loc.end=s.loc.end),this.withSource&&(t.loc.source=i.lexer._input.substring(t.loc.start.offset,t.loc.end.offset)))},h.prototype.resolvePrecedence=function(t,e){let s,i,n;return"call"===t.kind?this.resolveLocations(t,t.what,t,e):"propertylookup"===t.kind||"staticlookup"===t.kind||"offsetlookup"===t.kind&&t.offset?this.resolveLocations(t,t.what,t.offset,e):"bin"===t.kind?t.right&&!t.right.parenthesizedExpression&&("bin"===t.right.kind?(i=h.precedence[t.type],n=h.precedence[t.right.type],i&&n&&n<=i&&(t.type!==t.right.type||!this.isRightAssociative(t.type))&&(s=t.right,t.right=t.right.left,this.swapLocations(t,t.left,t.right,e),s.left=this.resolvePrecedence(t,e),this.swapLocations(s,s.left,s.right,e),t=s)):"retif"===t.right.kind&&(i=h.precedence[t.type],n=h.precedence["?"],i&&n&&n<=i&&(s=t.right,t.right=t.right.test,this.swapLocations(t,t.left,t.right,e),s.test=this.resolvePrecedence(t,e),this.swapLocations(s,s.test,s.falseExpr,e),t=s))):"silent"!==t.kind&&"cast"!==t.kind||!t.expr||t.expr.parenthesizedExpression?"unary"===t.kind?t.what&&!t.what.parenthesizedExpression&&("bin"===t.what.kind?(s=t.what,t.what=t.what.left,this.swapLocations(t,t,t.what,e),s.left=this.resolvePrecedence(t,e),this.swapLocations(s,s.left,s.right,e),t=s):"retif"===t.what.kind&&(s=t.what,t.what=t.what.test,this.swapLocations(t,t,t.what,e),s.test=this.resolvePrecedence(t,e),this.swapLocations(s,s.test,s.falseExpr,e),t=s)):"retif"===t.kind?t.falseExpr&&"retif"===t.falseExpr.kind&&!t.falseExpr.parenthesizedExpression&&(s=t.falseExpr,t.falseExpr=s.test,this.swapLocations(t,t.test,t.falseExpr,e),s.test=this.resolvePrecedence(t,e),this.swapLocations(s,s.test,s.falseExpr,e),t=s):"assign"===t.kind?t.right&&"bin"===t.right.kind&&!t.right.parenthesizedExpression&&(i=h.precedence["="],n=h.precedence[t.right.type],i&&n&&n<i&&(s=t.right,t.right=t.right.left,s.left=t,this.swapLocations(s,s.left,t.right,e),t=s)):"expressionstatement"===t.kind&&this.swapLocations(t,t.expression,t,e):"bin"===t.expr.kind?(s=t.expr,t.expr=t.expr.left,this.swapLocations(t,t,t.expr,e),s.left=this.resolvePrecedence(t,e),this.swapLocations(s,s.left,s.right,e),t=s):"retif"===t.expr.kind&&(s=t.expr,t.expr=t.expr.test,this.swapLocations(t,t,t.expr,e),s.test=this.resolvePrecedence(t,e),this.swapLocations(s,s.test,s.falseExpr,e),t=s),t},h.prototype.prepare=function(t,e,s){let o=null;(this.withPositions||this.withSource)&&(o=s.position());const r=this,_=function(){let a=null;const c=Array.prototype.slice.call(arguments);if(c.push(e),r.withPositions||r.withSource){let t=null;r.withSource&&(t=s.lexer._input.substring(o.offset,s.prev[2])),a=new i(t,o,new n(s.prev[0],s.prev[1],s.prev[2])),c.push(a)}t||(t=c.shift());const l=r[t];if("function"!=typeof l)throw new Error('Undefined node "'+t+'"');const u=Object.create(l.prototype);return l.apply(u,c),_.instance=u,_.trailingComments&&(u.trailingComments=_.trailingComments),"function"==typeof _.postBuild&&_.postBuild(u),s.debug&&delete h.stack[_.stackUid],r.resolvePrecedence(u,s)};return s.debug&&(h.stack||(h.stack={},h.stackUid=1),h.stack[++h.stackUid]={position:o,stack:(new Error).stack.split("\n").slice(3,5)},_.stackUid=h.stackUid),_.setTrailingComments=function(t){_.instance?_.instance.setTrailingComments(t):_.trailingComments=t},_.destroy=function(t){e&&(t?t.leadingComments?t.leadingComments=e.concat(t.leadingComments):t.leadingComments=e:s._docIndex=s._docs.length-e.length),s.debug&&delete h.stack[_.stackUid]},_},h.prototype.checkNodes=function(){const t=[];for(const e in h.stack)h.stack.hasOwnProperty(e)&&t.push(h.stack[e]);return h.stack={},t},[s(8965),s(8731),s(691),s(3094),s(9395),s(914),s(9590),s(5600),s(3096),s(5798),s(9259),s(5077),s(9386),s(3527),s(9510),s(2555),s(8593),s(687),s(3224),s(8423),s(3233),s(2266),s(370),s(1847),s(7895),s(8714),s(9315),s(5521),s(6712),s(2682),s(522),s(3444),s(8446),s(2826),s(9979),s(6792),s(3896),s(6846),s(1433),s(7352),s(2693),s(7740),s(1911),s(2872),s(535),s(3034),s(3982),s(7386),s(3765),s(7718),s(9483),s(2324),s(8261),s(1632),s(1920),s(1695),s(5008),s(5734),s(120),s(2743),s(8126),s(1986),s(7614),s(814),s(9238),s(7769),s(7461),s(1658),s(6038),s(9570),s(2210),s(3565),s(7366),s(7692),s(8117),s(2795),s(202),s(69),s(6909),s(8871),s(882),s(2238),s(1777),s(1095),s(9324),s(6291),s(4755),s(7788),s(669),s(7577),s(8653),s(206),s(330),s(9279),s(3832),s(8401),s(3590),s(2460),s(838),s(4960),s(8419),s(85),s(6442),s(1685),s(4954),s(2288),s(6001),s(7406),s(6062)].forEach((function(t){h.prototype[t.kind]=t})),t.exports=h},8965:(t,e,s)=>{const i=s(6846),n="array";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.items=e,this.shortForm=t}))},8731:(t,e,s)=>{const i=s(6846),n="arrowfunc";t.exports=i.extends(n,(function(t,e,s,h,o,r,_,a){i.apply(this,[n,_,a]),this.arguments=t,this.byref=e,this.body=s,this.type=h,this.nullable=o,this.isStatic=r||!1}))},691:(t,e,s)=>{const i=s(6846),n="assign";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.left=t,this.right=e,this.operator=s}))},3094:(t,e,s)=>{const i=s(6846),n="assignref";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.left=t,this.right=e}))},914:(t,e,s)=>{const i=s(814),n="attrgroup";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.attrs=t||[]}))},9395:(t,e,s)=>{const i=s(814),n="attribute";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.name=t,this.args=e}))},9590:(t,e,s)=>{const i=s(2210);t.exports=i.extends("bin",(function(t,e,s,n,h){i.apply(this,["bin",n,h]),this.type=t,this.left=e,this.right=s}))},5600:(t,e,s)=>{const i=s(6291),n="block";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[t||n,s,h]),this.children=e.filter(Boolean)}))},3096:(t,e,s)=>{const i=s(1632),n="boolean";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},5798:(t,e,s)=>{const i=s(6291),n="break";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.level=t}))},9259:(t,e,s)=>{const i=s(6846),n="byref";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.what=t}))},5077:(t,e,s)=>{const i=s(6846),n="call";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.what=t,this.arguments=e}))},9386:(t,e,s)=>{const i=s(6291),n="case";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.test=t,this.body=e}))},3527:(t,e,s)=>{const i=s(2210),n="cast";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.type=t,this.raw=e,this.expr=s}))},9510:(t,e,s)=>{const i=s(6291),n="catch";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.body=t,this.what=e,this.variable=s}))},2555:(t,e,s)=>{const i=s(8714),n="class";t.exports=i.extends(n,(function(t,e,s,h,o,r,_){i.apply(this,[n,t,r,_]),this.isAnonymous=!t,this.extends=e,this.implements=s,this.body=h,this.attrGroups=[],this.parseFlags(o)}))},8593:(t,e,s)=>{const i=s(1847),n="classconstant",h=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[t||n,e,o,r]),this.parseFlags(s),this.attrGroups=h}));h.prototype.parseFlags=function(t){-1===t[0]?this.visibility="":null===t[0]?this.visibility=null:0===t[0]?this.visibility="public":1===t[0]?this.visibility="protected":2===t[0]&&(this.visibility="private")},t.exports=h},687:(t,e,s)=>{const i=s(6846),n="clone";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.what=t}))},3224:(t,e,s)=>{const i=s(6846),n="closure";t.exports=i.extends(n,(function(t,e,s,h,o,r,_,a){i.apply(this,[n,_,a]),this.uses=s,this.arguments=t,this.byref=e,this.type=h,this.nullable=o,this.isStatic=r||!1,this.body=null,this.attrGroups=[]}))},8423:(t,e,s)=>{const i=s(814);t.exports=i.extends("comment",(function(t,e,s,n){i.apply(this,[t,s,n]),this.value=e}))},3233:(t,e,s)=>{const i=s(8423),n="commentblock";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,t,e,s])}))},2266:(t,e,s)=>{const i=s(8423),n="commentline";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,t,e,s])}))},370:(t,e,s)=>{const i=s(814),n="constant";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.name=t,this.value=e}))},1847:(t,e,s)=>{const i=s(6291),n="constantstatement";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[t||n,s,h]),this.constants=e}))},7895:(t,e,s)=>{const i=s(6291),n="continue";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.level=t}))},8714:(t,e,s)=>{const i=s(6291),n="declaration",h=i.extends(n,(function(t,e,s,h){i.apply(this,[t||n,s,h]),this.name=e}));h.prototype.parseFlags=function(t){this.isAbstract=1===t[2],this.isFinal=2===t[2],"class"!==this.kind&&(-1===t[0]?this.visibility="":null===t[0]?this.visibility=null:0===t[0]?this.visibility="public":1===t[0]?this.visibility="protected":2===t[0]&&(this.visibility="private"),this.isStatic=1===t[1])},t.exports=h},9315:(t,e,s)=>{const i=s(5600),n="declare",h=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,e,h,o]),this.directives=t,this.mode=s}));h.MODE_SHORT="short",h.MODE_BLOCK="block",h.MODE_NONE="none",t.exports=h},5521:(t,e,s)=>{const i=s(814),n="declaredirective";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.key=t,this.value=e}))},6712:(t,e,s)=>{const i=s(6291);t.exports=i.extends("do",(function(t,e,s,n){i.apply(this,["do",s,n]),this.test=t,this.body=e}))},2682:(t,e,s)=>{const i=s(6291),n="echo";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.shortForm=e,this.expressions=t}))},522:(t,e,s)=>{const i=s(6846),n="empty";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.expression=t}))},3444:(t,e,s)=>{const i=s(1632),n="encapsed",h=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,t,e,h,o]),this.type=s}));h.TYPE_STRING="string",h.TYPE_SHELL="shell",h.TYPE_HEREDOC="heredoc",h.TYPE_OFFSET="offset",t.exports=h},8446:(t,e,s)=>{const i=s(6846),n="encapsedpart";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.expression=t,this.syntax=e,this.curly=s}))},2826:(t,e,s)=>{const i=s(6846),n="entry";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,o,r]),this.key=t,this.value=e,this.byRef=s,this.unpack=h}))},9979:(t,e,s)=>{const i=s(814),n="error";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,o,r]),this.message=t,this.token=e,this.line=s,this.expected=h}))},6792:(t,e,s)=>{const i=s(6846),n="eval";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.source=t}))},3896:(t,e,s)=>{const i=s(6846),n="exit";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.expression=t,this.useDie=e}))},6846:(t,e,s)=>{const i=s(814),n="expression";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[t||n,e,s])}))},1433:(t,e,s)=>{const i=s(6291),n="expressionstatement";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.expression=t}))},7352:(t,e,s)=>{const i=s(6291);t.exports=i.extends("for",(function(t,e,s,n,h,o,r){i.apply(this,["for",o,r]),this.init=t,this.test=e,this.increment=s,this.shortForm=h,this.body=n}))},2693:(t,e,s)=>{const i=s(6291),n="foreach";t.exports=i.extends(n,(function(t,e,s,h,o,r,_){i.apply(this,[n,r,_]),this.source=t,this.key=e,this.value=s,this.shortForm=o,this.body=h}))},7740:(t,e,s)=>{const i=s(8714),n="function";t.exports=i.extends(n,(function(t,e,s,h,o,r,_){i.apply(this,[n,t,r,_]),this.arguments=e,this.byref=s,this.type=h,this.nullable=o,this.body=null,this.attrGroups=[]}))},1911:(t,e,s)=>{const i=s(6291),n="global";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.items=t}))},2872:(t,e,s)=>{const i=s(6291),n="goto";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.label=t}))},535:(t,e,s)=>{const i=s(6291),n="halt";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.after=t}))},3034:(t,e,s)=>{const i=s(814),n="identifier",h=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.name=t}));t.exports=h},3982:(t,e,s)=>{const i=s(6291);t.exports=i.extends("if",(function(t,e,s,n,h,o){i.apply(this,["if",h,o]),this.test=t,this.body=e,this.alternate=s,this.shortForm=n}))},7386:(t,e,s)=>{const i=s(6846),n="include";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.once=t,this.require=e,this.target=s}))},3765:(t,e,s)=>{const i=s(1632),n="inline";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},7718:(t,e,s)=>{const i=s(8714),n="interface";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,t,o,r]),this.extends=e,this.body=s,this.attrGroups=h}))},9483:(t,e,s)=>{const i=s(6846),n="isset";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.variables=t}))},2324:(t,e,s)=>{const i=s(6291),n="label";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.name=t}))},8261:(t,e,s)=>{const i=s(6846),n="list";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.items=t,this.shortForm=e}))},1632:(t,e,s)=>{const i=s(6846),n="literal";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[t||n,h,o]),this.value=e,s&&(this.raw=s)}))},1703:t=>{t.exports=function(t,e,s){this.source=t,this.start=e,this.end=s}},1920:(t,e,s)=>{const i=s(6846),n="lookup";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[t||n,h,o]),this.what=e,this.offset=s}))},1695:(t,e,s)=>{const i=s(1632),n="magic";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},5008:(t,e,s)=>{const i=s(6846),n="match";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.cond=t,this.arms=e}))},5734:(t,e,s)=>{const i=s(6846),n="matcharm";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.conds=t,this.body=e}))},120:(t,e,s)=>{const i=s(7740),n="method";t.exports=i.extends(n,(function(){i.apply(this,arguments),this.kind=n}))},2743:(t,e,s)=>{const i=s(882),n="name",h=i.extends(n,(function t(e,s,h,o){i.apply(this,[n,h,o]),s?this.resolution=t.RELATIVE_NAME:1===e.length?this.resolution=t.UNQUALIFIED_NAME:e[0]?this.resolution=t.QUALIFIED_NAME:this.resolution=t.FULL_QUALIFIED_NAME,this.name=e.join("\\")}));h.UNQUALIFIED_NAME="uqn",h.QUALIFIED_NAME="qn",h.FULL_QUALIFIED_NAME="fqn",h.RELATIVE_NAME="rn",t.exports=h},1986:(t,e,s)=>{const i=s(6846),n="namedargument";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.name=t,this.value=e}))},8126:(t,e,s)=>{const i=s(5600),n="namespace";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,e,h,o]),this.name=t,this.withBrackets=s||!1}))},7614:(t,e,s)=>{const i=s(6846);t.exports=i.extends("new",(function(t,e,s,n){i.apply(this,["new",s,n]),this.what=t,this.arguments=e}))},814:t=>{const e=function(t,e,s){this.kind=t,e&&(this.leadingComments=e),s&&(this.loc=s)};e.prototype.setTrailingComments=function(t){this.trailingComments=t},e.prototype.destroy=function(t){if(!t)throw new Error("Node already initialized, you must swap with another node");return this.leadingComments&&(t.leadingComments?t.leadingComments=Array.concat(this.leadingComments,t.leadingComments):t.leadingComments=this.leadingComments),this.trailingComments&&(t.trailingComments?t.trailingComments=Array.concat(this.trailingComments,t.trailingComments):t.trailingComments=this.trailingComments),t},e.prototype.includeToken=function(t){return this.loc&&(this.loc.end&&(this.loc.end.line=t.lexer.yylloc.last_line,this.loc.end.column=t.lexer.yylloc.last_column,this.loc.end.offset=t.lexer.offset),t.ast.withSource&&(this.loc.source=t.lexer._input.substring(this.loc.start.offset,t.lexer.offset))),this},e.extends=function(t,e){return e.prototype=Object.create(this.prototype),e.extends=this.extends,e.prototype.constructor=e,e.kind=t,e},t.exports=e},9238:(t,e,s)=>{const i=s(814),n="noop";t.exports=i.extends(n,(function(t,e){i.apply(this,[n,t,e])}))},7769:(t,e,s)=>{const i=s(1632),n="nowdoc";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,t,e,h,o]),this.label=s}))},7461:(t,e,s)=>{const i=s(814),n="nullkeyword";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.raw=t}))},1658:(t,e,s)=>{const i=s(1920),n="nullsafepropertylookup";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},6038:(t,e,s)=>{const i=s(1632),n="number";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},9570:(t,e,s)=>{const i=s(1920),n="offsetlookup";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},2210:(t,e,s)=>{const i=s(6846),n="operation";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[t||n,e,s])}))},3565:(t,e,s)=>{const i=s(8714),n="parameter";t.exports=i.extends(n,(function(t,e,s,h,o,r,_,a,c){i.apply(this,[n,t,a,c]),this.value=s,this.type=e,this.byref=h,this.variadic=o,this.nullable=r,this.flags=_||0,this.attrGroups=[]}))},7366:(t,e,s)=>{const i=s(882),n="parentreference",h=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.raw=t}));t.exports=h},1143:t=>{t.exports=function(t,e,s){this.line=t,this.column=e,this.offset=s}},7692:(t,e,s)=>{const i=s(2210),n="post";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.type=t,this.what=e}))},8117:(t,e,s)=>{const i=s(2210);t.exports=i.extends("pre",(function(t,e,s,n){i.apply(this,["pre",s,n]),this.type=t,this.what=e}))},2795:(t,e,s)=>{const i=s(6846),n="print";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.expression=t}))},202:(t,e,s)=>{const i=s(5600),n="program";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,t,o,r]),this.errors=e,s&&(this.comments=s),h&&(this.tokens=h)}))},69:(t,e,s)=>{const i=s(6291),n="property";t.exports=i.extends(n,(function(t,e,s,h,o,r,_){i.apply(this,[n,r,_]),this.name=t,this.value=e,this.nullable=s,this.type=h,this.attrGroups=o}))},6909:(t,e,s)=>{const i=s(1920),n="propertylookup";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},8871:(t,e,s)=>{const i=s(6291),n="propertystatement",h=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.properties=e,this.parseFlags(s)}));h.prototype.parseFlags=function(t){-1===t[0]?this.visibility="":null===t[0]?this.visibility=null:0===t[0]?this.visibility="public":1===t[0]?this.visibility="protected":2===t[0]&&(this.visibility="private"),this.isStatic=1===t[1]},t.exports=h},882:(t,e,s)=>{const i=s(814),n="reference",h=i.extends(n,(function(t,e,s){i.apply(this,[t||n,e,s])}));t.exports=h},2238:(t,e,s)=>{const i=s(6846),n="retif";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.test=t,this.trueExpr=e,this.falseExpr=s}))},1777:(t,e,s)=>{const i=s(6291),n="return";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.expr=t}))},1095:(t,e,s)=>{const i=s(882),n="selfreference",h=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.raw=t}));t.exports=h},9324:(t,e,s)=>{const i=s(6846),n="silent";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.expr=t}))},6291:(t,e,s)=>{const i=s(814),n="statement";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[t||n,e,s])}))},4755:(t,e,s)=>{const i=s(6291),n="static";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.variables=t}))},669:(t,e,s)=>{const i=s(1920),n="staticlookup";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,e,s,h])}))},7577:(t,e,s)=>{const i=s(882),n="staticreference",h=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.raw=t}));t.exports=h},7788:(t,e,s)=>{const i=s(814),n="staticvariable";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.variable=t,this.defaultValue=e}))},8653:(t,e,s)=>{const i=s(1632),n="string";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,e,h,o,r]),this.unicode=s,this.isDoubleQuote=t}))},206:(t,e,s)=>{const i=s(6291),n="switch";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.test=t,this.body=e,this.shortForm=s}))},330:(t,e,s)=>{const i=s(6291),n="throw";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.what=t}))},9279:(t,e,s)=>{const i=s(8714),n="trait";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,t,s,h]),this.body=e}))},3832:(t,e,s)=>{const i=s(814),n="traitalias";t.exports=i.extends(n,(function(t,e,s,h,o,r){i.apply(this,[n,o,r]),this.trait=t,this.method=e,this.as=s,this.visibility="",h&&(0===h[0]?this.visibility="public":1===h[0]?this.visibility="protected":2===h[0]&&(this.visibility="private"))}))},8401:(t,e,s)=>{const i=s(814),n="traitprecedence";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.trait=t,this.method=e,this.instead=s}))},3590:(t,e,s)=>{const i=s(814),n="traituse";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.traits=t,this.adaptations=e}))},2460:(t,e,s)=>{const i=s(6291);t.exports=i.extends("try",(function(t,e,s,n,h){i.apply(this,["try",n,h]),this.body=t,this.catches=e,this.always=s}))},838:(t,e,s)=>{const i=s(882),n="typereference",h=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.name=t,this.raw=e}));h.types=["int","float","string","bool","object","array","callable","iterable","void","static"],t.exports=h},4960:(t,e,s)=>{const i=s(2210),n="unary";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.type=t,this.what=e}))},8419:(t,e,s)=>{const i=s(8714),n="uniontype";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,null,e,s]),this.types=t}))},85:(t,e,s)=>{const i=s(6291),n="unset";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.variables=t}))},6442:(t,e,s)=>{const i=s(6291),n="usegroup";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.name=t,this.type=e,this.items=s}))},1685:(t,e,s)=>{const i=s(6291),n="useitem",h=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.name=t,this.alias=e,this.type=s}));h.TYPE_CONST="const",h.TYPE_FUNCTION="function",t.exports=h},4954:(t,e,s)=>{const i=s(6846),n="variable";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.name=t,this.curly=e||!1}))},2288:(t,e,s)=>{const i=s(6846),n="variadic";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.what=t}))},6001:(t,e,s)=>{const i=s(6291),n="while";t.exports=i.extends(n,(function(t,e,s,h,o){i.apply(this,[n,h,o]),this.test=t,this.body=e,this.shortForm=s}))},7406:(t,e,s)=>{const i=s(6846),n="yield";t.exports=i.extends(n,(function(t,e,s,h){i.apply(this,[n,s,h]),this.value=t,this.key=e}))},6062:(t,e,s)=>{const i=s(6846),n="yieldfrom";t.exports=i.extends(n,(function(t,e,s){i.apply(this,[n,e,s]),this.value=t}))},3638:(t,e,s)=>{const i=s(6122),n=s(5079),h=s(3155),o=s(7446);function r(t,e){const s=Object.keys(t);let i=s.length;for(;i--;){const n=s[i],h=t[n];null===h?delete e[n]:"function"==typeof h?e[n]=h.bind(e):Array.isArray(h)?e[n]=Array.isArray(e[n])?e[n].concat(h):h:e[n]="object"==typeof h&&"object"==typeof e[n]?r(h,e[n]):h}return e}const _=function(t){if("function"==typeof this)return new this(t);if(this.tokens=h,this.lexer=new i(this),this.ast=new o,this.parser=new n(this.lexer,this.ast),t&&"object"==typeof t){if(t.parser&&(t.lexer||(t.lexer={}),t.parser.version)){if("string"==typeof t.parser.version){let e=t.parser.version.split(".");if(e=100*parseInt(e[0])+parseInt(e[1]),isNaN(e))throw new Error("Bad version number : "+t.parser.version);t.parser.version=e}else if("number"!=typeof t.parser.version)throw new Error("Expecting a number for version");if(t.parser.version<500||t.parser.version>900)throw new Error("Can only handle versions between 5.x to 8.x")}r(t,this),this.lexer.version=this.parser.version}},a=function(t){return"function"==typeof t.write?t.toString():t};_.create=function(t){return new _(t)},_.parseEval=function(t,e){return new _(e).parseEval(t)},_.prototype.parseEval=function(t){return this.lexer.mode_eval=!0,this.lexer.all_tokens=!1,t=a(t),this.parser.parse(t,"eval")},_.parseCode=function(t,e,s){return"object"!=typeof e||s||(s=e,e="unknown"),new _(s).parseCode(t,e)},_.prototype.parseCode=function(t,e){return this.lexer.mode_eval=!1,this.lexer.all_tokens=!1,t=a(t),this.parser.parse(t,e)},_.tokenGetAll=function(t,e){return new _(e).tokenGetAll(t)},_.prototype.tokenGetAll=function(t){this.lexer.mode_eval=!1,this.lexer.all_tokens=!0,t=a(t);const e=this.lexer.EOF,s=this.tokens.values;this.lexer.setInput(t);let i=this.lexer.lex()||e;const n=[];for(;i!=e;){let t=this.lexer.yytext;s.hasOwnProperty(i)&&(t=[s[i],t,this.lexer.yylloc.first_line]),n.push(t),i=this.lexer.lex()||e}return n},t.exports=_,t.exports.tokens=h,t.exports.lexer=i,t.exports.AST=o,t.exports.parser=n,t.exports.combine=r,t.exports.default=_},6122:(t,e,s)=>{const i=function(t){this.engine=t,this.tok=this.engine.tokens.names,this.EOF=1,this.debug=!1,this.all_tokens=!0,this.comment_tokens=!1,this.mode_eval=!1,this.asp_tags=!1,this.short_tags=!1,this.version=800,this.yyprevcol=0,this.keywords={__class__:this.tok.T_CLASS_C,__trait__:this.tok.T_TRAIT_C,__function__:this.tok.T_FUNC_C,__method__:this.tok.T_METHOD_C,__line__:this.tok.T_LINE,__file__:this.tok.T_FILE,__dir__:this.tok.T_DIR,__namespace__:this.tok.T_NS_C,exit:this.tok.T_EXIT,die:this.tok.T_EXIT,function:this.tok.T_FUNCTION,const:this.tok.T_CONST,return:this.tok.T_RETURN,try:this.tok.T_TRY,catch:this.tok.T_CATCH,finally:this.tok.T_FINALLY,throw:this.tok.T_THROW,if:this.tok.T_IF,elseif:this.tok.T_ELSEIF,endif:this.tok.T_ENDIF,else:this.tok.T_ELSE,while:this.tok.T_WHILE,endwhile:this.tok.T_ENDWHILE,do:this.tok.T_DO,for:this.tok.T_FOR,endfor:this.tok.T_ENDFOR,foreach:this.tok.T_FOREACH,endforeach:this.tok.T_ENDFOREACH,declare:this.tok.T_DECLARE,enddeclare:this.tok.T_ENDDECLARE,instanceof:this.tok.T_INSTANCEOF,as:this.tok.T_AS,switch:this.tok.T_SWITCH,endswitch:this.tok.T_ENDSWITCH,case:this.tok.T_CASE,default:this.tok.T_DEFAULT,break:this.tok.T_BREAK,continue:this.tok.T_CONTINUE,goto:this.tok.T_GOTO,echo:this.tok.T_ECHO,print:this.tok.T_PRINT,class:this.tok.T_CLASS,interface:this.tok.T_INTERFACE,trait:this.tok.T_TRAIT,extends:this.tok.T_EXTENDS,implements:this.tok.T_IMPLEMENTS,new:this.tok.T_NEW,clone:this.tok.T_CLONE,var:this.tok.T_VAR,eval:this.tok.T_EVAL,include:this.tok.T_INCLUDE,include_once:this.tok.T_INCLUDE_ONCE,require:this.tok.T_REQUIRE,require_once:this.tok.T_REQUIRE_ONCE,namespace:this.tok.T_NAMESPACE,use:this.tok.T_USE,insteadof:this.tok.T_INSTEADOF,global:this.tok.T_GLOBAL,isset:this.tok.T_ISSET,empty:this.tok.T_EMPTY,__halt_compiler:this.tok.T_HALT_COMPILER,static:this.tok.T_STATIC,abstract:this.tok.T_ABSTRACT,final:this.tok.T_FINAL,private:this.tok.T_PRIVATE,protected:this.tok.T_PROTECTED,public:this.tok.T_PUBLIC,unset:this.tok.T_UNSET,list:this.tok.T_LIST,array:this.tok.T_ARRAY,callable:this.tok.T_CALLABLE,or:this.tok.T_LOGICAL_OR,and:this.tok.T_LOGICAL_AND,xor:this.tok.T_LOGICAL_XOR,match:this.tok.T_MATCH},this.castKeywords={int:this.tok.T_INT_CAST,integer:this.tok.T_INT_CAST,real:this.tok.T_DOUBLE_CAST,double:this.tok.T_DOUBLE_CAST,float:this.tok.T_DOUBLE_CAST,string:this.tok.T_STRING_CAST,binary:this.tok.T_STRING_CAST,array:this.tok.T_ARRAY_CAST,object:this.tok.T_OBJECT_CAST,bool:this.tok.T_BOOL_CAST,boolean:this.tok.T_BOOL_CAST,unset:this.tok.T_UNSET_CAST}};i.prototype.setInput=function(t){return this._input=t,this.size=t.length,this.yylineno=1,this.offset=0,this.yyprevcol=0,this.yytext="",this.yylloc={first_offset:0,first_line:1,first_column:0,prev_offset:0,prev_line:1,prev_column:0,last_line:1,last_column:0},this.tokens=[],this.version>703?this.keywords.fn=this.tok.T_FN:delete this.keywords.fn,this.done=this.offset>=this.size,!this.all_tokens&&this.mode_eval?(this.conditionStack=["INITIAL"],this.begin("ST_IN_SCRIPTING")):(this.conditionStack=[],this.begin("INITIAL")),this.heredoc_label={label:"",length:0,indentation:0,indentation_uses_spaces:!1,finished:!1,first_encaps_node:!1,toString:function(){this.label}},this},i.prototype.input=function(){const t=this._input[this.offset];return t?(this.yytext+=t,this.offset++,"\r"===t&&"\n"===this._input[this.offset]&&(this.yytext+="\n",this.offset++),"\n"===t||"\r"===t?(this.yylloc.last_line=++this.yylineno,this.yyprevcol=this.yylloc.last_column,this.yylloc.last_column=0):this.yylloc.last_column++,t):""},i.prototype.unput=function(t){if(1===t)this.offset--,"\n"===this._input[this.offset]&&"\r"===this._input[this.offset-1]&&(this.offset--,t++),"\r"===this._input[this.offset]||"\n"===this._input[this.offset]?(this.yylloc.last_line--,this.yylineno--,this.yylloc.last_column=this.yyprevcol):this.yylloc.last_column--,this.yytext=this.yytext.substring(0,this.yytext.length-t);else if(t>0)if(this.offset-=t,t<this.yytext.length){this.yytext=this.yytext.substring(0,this.yytext.length-t),this.yylloc.last_line=this.yylloc.first_line,this.yylloc.last_column=this.yyprevcol=this.yylloc.first_column;for(let t=0;t<this.yytext.length;t++){let e=this.yytext[t];"\r"===e?(e=this.yytext[++t],this.yyprevcol=this.yylloc.last_column,this.yylloc.last_line++,this.yylloc.last_column=0,"\n"!==e&&("\r"===e?this.yylloc.last_line++:this.yylloc.last_column++)):"\n"===e?(this.yyprevcol=this.yylloc.last_column,this.yylloc.last_line++,this.yylloc.last_column=0):this.yylloc.last_column++}this.yylineno=this.yylloc.last_line}else this.yytext="",this.yylloc.last_line=this.yylineno=this.yylloc.first_line,this.yylloc.last_column=this.yylloc.first_column;return this},i.prototype.tryMatch=function(t){return t===this.ahead(t.length)},i.prototype.tryMatchCaseless=function(t){return t===this.ahead(t.length).toLowerCase()},i.prototype.ahead=function(t){let e=this._input.substring(this.offset,this.offset+t);return"\r"===e[e.length-1]&&"\n"===this._input[this.offset+t+1]&&(e+="\n"),e},i.prototype.consume=function(t){for(let e=0;e<t;e++){const t=this._input[this.offset];if(!t)break;this.yytext+=t,this.offset++,"\r"===t&&"\n"===this._input[this.offset]&&(this.yytext+="\n",this.offset++,e++),"\n"===t||"\r"===t?(this.yylloc.last_line=++this.yylineno,this.yyprevcol=this.yylloc.last_column,this.yylloc.last_column=0):this.yylloc.last_column++}return this},i.prototype.getState=function(){return{yytext:this.yytext,offset:this.offset,yylineno:this.yylineno,yyprevcol:this.yyprevcol,yylloc:{first_offset:this.yylloc.first_offset,first_line:this.yylloc.first_line,first_column:this.yylloc.first_column,last_line:this.yylloc.last_line,last_column:this.yylloc.last_column},heredoc_label:this.heredoc_label}},i.prototype.setState=function(t){return this.yytext=t.yytext,this.offset=t.offset,this.yylineno=t.yylineno,this.yyprevcol=t.yyprevcol,this.yylloc=t.yylloc,t.heredoc_label&&(this.heredoc_label=t.heredoc_label),this},i.prototype.appendToken=function(t,e){return this.tokens.push([t,e]),this},i.prototype.lex=function(){this.yylloc.prev_offset=this.offset,this.yylloc.prev_line=this.yylloc.last_line,this.yylloc.prev_column=this.yylloc.last_column;let t=this.next()||this.lex();if(!this.all_tokens){for(;t===this.tok.T_WHITESPACE||!this.comment_tokens&&(t===this.tok.T_COMMENT||t===this.tok.T_DOC_COMMENT)||t===this.tok.T_OPEN_TAG;)t=this.next()||this.lex();if(t==this.tok.T_OPEN_TAG_WITH_ECHO)return this.tok.T_ECHO;if(t===this.tok.T_CLOSE_TAG)return";"}return this.yylloc.prev_offset||(this.yylloc.prev_offset=this.yylloc.first_offset,this.yylloc.prev_line=this.yylloc.first_line,this.yylloc.prev_column=this.yylloc.first_column),t},i.prototype.begin=function(t){if(this.conditionStack.push(t),this.curCondition=t,this.stateCb=this["match"+t],"function"!=typeof this.stateCb)throw new Error('Undefined condition state "'+t+'"');return this},i.prototype.popState=function(){const t=this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0];if(this.curCondition=this.conditionStack[this.conditionStack.length-1],this.stateCb=this["match"+this.curCondition],"function"!=typeof this.stateCb)throw new Error('Undefined condition state "'+this.curCondition+'"');return t},i.prototype.next=function(){let t;if(this._input||(this.done=!0),this.yylloc.first_offset=this.offset,this.yylloc.first_line=this.yylloc.last_line,this.yylloc.first_column=this.yylloc.last_column,this.yytext="",this.done)return this.yylloc.prev_offset=this.yylloc.first_offset,this.yylloc.prev_line=this.yylloc.first_line,this.yylloc.prev_column=this.yylloc.first_column,this.EOF;if(this.tokens.length>0?(t=this.tokens.shift(),"object"==typeof t[1]?this.setState(t[1]):this.consume(t[1]),t=t[0]):t=this.stateCb.apply(this,[]),this.offset>=this.size&&0===this.tokens.length&&(this.done=!0),this.debug){let e=t;e="number"==typeof e?this.engine.tokens.values[e]:'"'+e+'"';const s=new Error(e+"\tfrom "+this.yylloc.first_line+","+this.yylloc.first_column+"\t - to "+this.yylloc.last_line+","+this.yylloc.last_column+'\t"'+this.yytext+'"');console.error(s.stack)}return t},[s(1782),s(990),s(4775),s(8851),s(7497),s(5446),s(3021),s(8860),s(7599)].forEach((function(t){for(const e in t)i.prototype[e]=t[e]})),t.exports=i},1782:t=>{t.exports={matchST_ATTRIBUTE:function(){let t=0,e=this.input();if(this.is_WHITESPACE()){do{e=this.input()}while(this.is_WHITESPACE());return this.unput(1),null}switch(e){case"]":return 0===t?this.popState():t--,"]";case"(":case")":case":":case"=":return this.consume_TOKEN();case"[":return t++,"[";case",":return",";case'"':return this.ST_DOUBLE_QUOTES();case"'":return this.T_CONSTANT_ENCAPSED_STRING();case"/":if("/"===this._input[this.offset])return this.T_COMMENT();if("*"===this._input[this.offset])return this.input(),this.T_DOC_COMMENT()}if(this.is_LABEL_START()||"\\"===e){for(;this.offset<this.size;){const t=this.input();if(!this.is_LABEL()&&"\\"!==t){t&&this.unput(1);break}}return this.tok.T_STRING}if(this.is_NUM())return this.consume_NUM();throw new Error(`Bad terminal sequence "${e}" at line ${this.yylineno} (offset ${this.offset})`)}}},990:t=>{t.exports={T_COMMENT:function(){for(;this.offset<this.size;){const t=this.input();if("\n"===t||"\r"===t)return this.tok.T_COMMENT;if("?"===t&&!this.aspTagMode&&">"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT;if("%"===t&&this.aspTagMode&&">"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT}return this.tok.T_COMMENT},T_DOC_COMMENT:function(){let t=this.input(),e=this.tok.T_COMMENT;if("*"===t){if(t=this.input(),this.is_WHITESPACE()&&(e=this.tok.T_DOC_COMMENT),"/"===t)return e;this.unput(1)}for(;this.offset<this.size;)if(t=this.input(),"*"===t&&"/"===this._input[this.offset]){this.input();break}return e}}},4775:t=>{t.exports={nextINITIAL:function(){return this.conditionStack.length>1&&"INITIAL"===this.conditionStack[this.conditionStack.length-1]?this.popState():this.begin("ST_IN_SCRIPTING"),this},matchINITIAL:function(){for(;this.offset<this.size;){let t=this.input();if("<"==t)if(t=this.ahead(1),"?"==t){if(this.tryMatch("?=")){this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO,3).nextINITIAL();break}if(this.tryMatchCaseless("?php")&&(t=this._input[this.offset+4]," "===t||"\t"===t||"\n"===t||"\r"===t)){this.unput(1).appendToken(this.tok.T_OPEN_TAG,6).nextINITIAL();break}if(this.short_tags){this.unput(1).appendToken(this.tok.T_OPEN_TAG,2).nextINITIAL();break}}else if(this.asp_tags&&"%"==t){if(this.tryMatch("%=")){this.aspTagMode=!0,this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO,3).nextINITIAL();break}this.aspTagMode=!0,this.unput(1).appendToken(this.tok.T_OPEN_TAG,2).nextINITIAL();break}}return this.yytext.length>0&&this.tok.T_INLINE_HTML}}},8851:t=>{let e=10,s="2147483648";e=19,s="9223372036854775808",t.exports={consume_NUM:function(){let t=this.yytext[0],e="."===t;if("0"===t)if(t=this.input(),"x"===t||"X"===t){if(t=this.input(),"_"!==t&&this.is_HEX())return this.consume_HNUM();this.unput(t?2:1)}else if("b"===t||"B"===t){if(t=this.input(),"_"!==t&&"0"===t||"1"===t)return this.consume_BNUM();this.unput(t?2:1)}else this.is_NUM()||t&&this.unput(1);for(;this.offset<this.size;){const s=t;if(t=this.input(),"_"===t){if("_"===s){this.unput(2);break}if("."===s){this.unput(1);break}if("e"===s||"E"===s){this.unput(2);break}}else{if("."===t){if(e){this.unput(1);break}if("_"===s){this.unput(2);break}e=!0;continue}if("e"===t||"E"===t){if("_"===s){this.unput(1);break}let e=2;if(t=this.input(),"+"!==t&&"-"!==t||(e=3,t=this.input()),this.is_NUM_START())return this.consume_LNUM(),this.tok.T_DNUMBER;this.unput(t?e:e-1);break}}if(!this.is_NUM()){t&&this.unput(1);break}}return e?this.tok.T_DNUMBER:this.yytext.length<18||this.yytext.length<19||19==this.yytext.length&&this.yytext<"9223372036854775808"?this.tok.T_LNUMBER:this.tok.T_DNUMBER},consume_HNUM:function(){for(;this.offset<this.size;){const t=this.input();if(!this.is_HEX()){t&&this.unput(1);break}}return this.tok.T_LNUMBER},consume_LNUM:function(){for(;this.offset<this.size;){const t=this.input();if(!this.is_NUM()){t&&this.unput(1);break}}return this.tok.T_LNUMBER},consume_BNUM:function(){let t;for(;this.offset<this.size;)if(t=this.input(),"0"!==t&&"1"!==t&&"_"!==t){t&&this.unput(1);break}return this.tok.T_LNUMBER}}},7497:t=>{t.exports={matchST_LOOKING_FOR_PROPERTY:function(){let t=this.input();if("-"===t){if(t=this.input(),">"===t)return this.tok.T_OBJECT_OPERATOR;t&&this.unput(1)}else{if(this.is_WHITESPACE())return this.tok.T_WHITESPACE;if(this.is_LABEL_START())return this.consume_LABEL(),this.popState(),this.tok.T_STRING}return this.popState(),t&&this.unput(1),!1},matchST_LOOKING_FOR_VARNAME:function(){let t=this.input();if(this.popState(),this.begin("ST_IN_SCRIPTING"),this.is_LABEL_START()){if(this.consume_LABEL(),t=this.input(),"["===t||"}"===t)return this.unput(1),this.tok.T_STRING_VARNAME;this.unput(this.yytext.length)}else t&&this.unput(1);return!1},matchST_VAR_OFFSET:function(){const t=this.input();if(this.is_NUM_START())return this.consume_NUM(),this.tok.T_NUM_STRING;if("]"===t)return this.popState(),"]";if("$"===t){if(this.input(),this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_VARIABLE;throw new Error("Unexpected terminal")}if(this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_STRING;if(this.is_WHITESPACE()||"\\"===t||"'"===t||"#"===t)return this.tok.T_ENCAPSED_AND_WHITESPACE;if("["===t||"{"===t||"}"===t||'"'===t||"`"===t||this.is_TOKEN())return t;throw new Error("Unexpected terminal")}}},5446:t=>{t.exports={matchST_IN_SCRIPTING:function(){let t=this.input();switch(t){case" ":case"\t":case"\n":case"\r":case"\r\n":return this.T_WHITESPACE();case"#":return"["===this._input[this.offset]?(this.input(),this.begin("ST_ATTRIBUTE"),this.tok.T_ATTRIBUTE):this.T_COMMENT();case"/":return"/"===this._input[this.offset]?this.T_COMMENT():"*"===this._input[this.offset]?(this.input(),this.T_DOC_COMMENT()):this.consume_TOKEN();case"'":return this.T_CONSTANT_ENCAPSED_STRING();case'"':return this.ST_DOUBLE_QUOTES();case"`":return this.begin("ST_BACKQUOTE"),"`";case"?":if(!this.aspTagMode&&this.tryMatch(">")){this.input();const t=this._input[this.offset];return"\n"!==t&&"\r"!==t||this.input(),this.conditionStack.length>1&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG}return this.consume_TOKEN();case"%":return this.aspTagMode&&">"===this._input[this.offset]?(this.input(),t=this._input[this.offset],"\n"!==t&&"\r"!==t||this.input(),this.aspTagMode=!1,this.conditionStack.length>1&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG):this.consume_TOKEN();case"{":return this.begin("ST_IN_SCRIPTING"),"{";case"}":return this.conditionStack.length>2&&this.popState(),"}";default:if("."===t){if(t=this.input(),this.is_NUM_START())return this.consume_NUM();t&&this.unput(1)}if(this.is_NUM_START())return this.consume_NUM();if(this.is_LABEL_START())return this.consume_LABEL().T_STRING();if(this.is_TOKEN())return this.consume_TOKEN()}throw new Error('Bad terminal sequence "'+t+'" at line '+this.yylineno+" (offset "+this.offset+")")},T_WHITESPACE:function(){for(;this.offset<this.size;){const t=this.input();if(" "!==t&&"\t"!==t&&"\n"!==t&&"\r"!==t){t&&this.unput(1);break}}return this.tok.T_WHITESPACE}}},3021:t=>{const e=["\n","\r"],s=["\n","\r",";"],i=s.concat(["\t"," ",",","]",")","/","=","!"]);t.exports={T_CONSTANT_ENCAPSED_STRING:function(){let t;for(;this.offset<this.size;)if(t=this.input(),"\\"==t)this.input();else if("'"==t)break;return this.tok.T_CONSTANT_ENCAPSED_STRING},is_HEREDOC:function(){const t=this.offset;if("<"===this._input[this.offset-1]&&"<"===this._input[this.offset]&&"<"===this._input[this.offset+1]){if(this.offset+=3,this.is_TABSPACE())for(;this.offset<this.size&&(this.offset++,this.is_TABSPACE()););let s=this._input[this.offset-1];if("'"===s||'"'===s?this.offset++:s=null,this.is_LABEL_START()){let i=this.offset-1;for(;this.offset<this.size&&(this.offset++,this.is_LABEL()););const n=this._input.substring(i,this.offset-1);if((!s||s===this._input[this.offset-1])&&(s&&this.offset++,e.includes(this._input[this.offset-1])))return this.heredoc_label.label=n,this.heredoc_label.length=n.length,this.heredoc_label.finished=!1,i=this.offset-t,this.offset=t,this.consume(i),"'"===s?this.begin("ST_NOWDOC"):this.begin("ST_HEREDOC"),this.prematch_ENDOFDOC(),this.tok.T_START_HEREDOC}}return this.offset=t,!1},ST_DOUBLE_QUOTES:function(){let t;for(;this.offset<this.size;)if(t=this.input(),"\\"==t)this.input();else{if('"'==t)break;if("$"==t){if(t=this.input(),"{"==t||this.is_LABEL_START()){this.unput(2);break}t&&this.unput(1)}else if("{"==t){if(t=this.input(),"$"==t){this.unput(2);break}t&&this.unput(1)}}if('"'==t)return this.tok.T_CONSTANT_ENCAPSED_STRING;{let t=1;return"b"!==this.yytext[0]&&"B"!==this.yytext[0]||(t=2),this.yytext.length>2&&this.appendToken(this.tok.T_ENCAPSED_AND_WHITESPACE,this.yytext.length-t),this.unput(this.yytext.length-t),this.begin("ST_DOUBLE_QUOTES"),this.yytext}},isDOC_MATCH:function(t,n){const h=this._input[t-2];if(!e.includes(h))return!1;let o=!1,r=!1,_=0,a=this._input[t-1];if(this.version>=703){for(;"\t"===a||" "===a;)" "===a?o=!0:"\t"===a&&(r=!0),a=this._input[t+_],_++;if(t+=_,e.includes(this._input[t-1]))return!1}if(this._input.substring(t-1,t-1+this.heredoc_label.length)===this.heredoc_label.label){const e=this._input[t-1+this.heredoc_label.length];if((this.version>=703?i:s).includes(e)){if(n){if(this.consume(_),o&&r)throw new Error("Parse error: mixing spaces and tabs in ending marker at line "+this.yylineno+" (offset "+this.offset+")")}else this.heredoc_label.indentation=_,this.heredoc_label.indentation_uses_spaces=o,this.heredoc_label.first_encaps_node=!0;return!0}}return!1},prematch_ENDOFDOC:function(){this.heredoc_label.indentation_uses_spaces=!1,this.heredoc_label.indentation=0,this.heredoc_label.first_encaps_node=!0;let t=this.offset+1;for(;t<this._input.length;){if(this.isDOC_MATCH(t,!1))return;if(!e.includes(this._input[t-1]))for(;!e.includes(this._input[t++])&&t<this._input.length;);t++}},matchST_NOWDOC:function(){if(this.isDOC_MATCH(this.offset,!0))return this.consume(this.heredoc_label.length),this.popState(),this.tok.T_END_HEREDOC;let t=this._input[this.offset-1];for(;this.offset<this.size;)if(e.includes(t)){if(t=this.input(),this.isDOC_MATCH(this.offset,!0))return this.unput(1).popState(),this.appendToken(this.tok.T_END_HEREDOC,this.heredoc_label.length),this.tok.T_ENCAPSED_AND_WHITESPACE}else t=this.input();return this.tok.T_ENCAPSED_AND_WHITESPACE},matchST_HEREDOC:function(){let t=this.input();if(this.isDOC_MATCH(this.offset,!0))return this.consume(this.heredoc_label.length-1),this.popState(),this.tok.T_END_HEREDOC;for(;this.offset<this.size;)if("\\"===t&&(t=this.input(),e.includes(t)||(t=this.input())),e.includes(t)){if(t=this.input(),this.isDOC_MATCH(this.offset,!0))return this.unput(1).popState(),this.appendToken(this.tok.T_END_HEREDOC,this.heredoc_label.length),this.tok.T_ENCAPSED_AND_WHITESPACE}else if("$"===t){if(t=this.input(),"{"===t)return this.begin("ST_LOOKING_FOR_VARNAME"),this.yytext.length>2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){const t=this.offset,e=this.consume_VARIABLE();return this.yytext.length>this.offset-t+2?(this.appendToken(e,this.offset-t+2),this.unput(this.offset-t+2),this.tok.T_ENCAPSED_AND_WHITESPACE):e}}else if("{"===t){if(t=this.input(),"$"===t)return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN)}else t=this.input();return this.tok.T_ENCAPSED_AND_WHITESPACE},consume_VARIABLE:function(){this.consume_LABEL();const t=this.input();if("["==t)return this.unput(1),this.begin("ST_VAR_OFFSET"),this.tok.T_VARIABLE;if("-"===t){if(">"===this.input())return this.input(),this.is_LABEL_START()&&this.begin("ST_LOOKING_FOR_PROPERTY"),this.unput(3),this.tok.T_VARIABLE;this.unput(2)}else t&&this.unput(1);return this.tok.T_VARIABLE},matchST_BACKQUOTE:function(){let t=this.input();if("$"===t){if(t=this.input(),"{"===t)return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===t){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if("`"===t)return this.popState(),"`";for(;this.offset<this.size;){if("\\"===t)this.input();else{if("`"===t){this.unput(1),this.popState(),this.appendToken("`",1);break}if("$"===t){if(t=this.input(),"{"===t)return this.begin("ST_LOOKING_FOR_VARNAME"),this.yytext.length>2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){const t=this.offset,e=this.consume_VARIABLE();return this.yytext.length>this.offset-t+2?(this.appendToken(e,this.offset-t+2),this.unput(this.offset-t+2),this.tok.T_ENCAPSED_AND_WHITESPACE):e}continue}if("{"===t){if(t=this.input(),"$"===t)return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);continue}}t=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE},matchST_DOUBLE_QUOTES:function(){let t=this.input();if("$"===t){if(t=this.input(),"{"===t)return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===t){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if('"'===t)return this.popState(),'"';for(;this.offset<this.size;){if("\\"===t)this.input();else{if('"'===t){this.unput(1),this.popState(),this.appendToken('"',1);break}if("$"===t){if(t=this.input(),"{"===t)return this.begin("ST_LOOKING_FOR_VARNAME"),this.yytext.length>2?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){const t=this.offset,e=this.consume_VARIABLE();return this.yytext.length>this.offset-t+2?(this.appendToken(e,this.offset-t+2),this.unput(this.offset-t+2),this.tok.T_ENCAPSED_AND_WHITESPACE):e}t&&this.unput(1)}else if("{"===t){if(t=this.input(),"$"===t)return this.begin("ST_IN_SCRIPTING"),this.yytext.length>2?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);t&&this.unput(1)}}t=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE}}},8860:t=>{t.exports={T_STRING:function(){const t=this.yytext.toLowerCase();let e=this.keywords[t];if("number"!=typeof e)if("yield"===t)this.version>=700&&this.tryMatch(" from")?(this.consume(5),e=this.tok.T_YIELD_FROM):e=this.tok.T_YIELD;else if(e=this.tok.T_STRING,"b"===t||"B"===t){const t=this.input(1);if('"'===t)return this.ST_DOUBLE_QUOTES();if("'"===t)return this.T_CONSTANT_ENCAPSED_STRING();t&&this.unput(1)}return e},consume_TOKEN:function(){const t=this._input[this.offset-1],e=this.tokenTerminals[t];return e?e.apply(this,[]):this.yytext},tokenTerminals:{$:function(){return this.offset++,this.is_LABEL_START()?(this.offset--,this.consume_LABEL(),this.tok.T_VARIABLE):(this.offset--,"$")},"-":function(){const t=this._input[this.offset];return">"===t?(this.begin("ST_LOOKING_FOR_PROPERTY").input(),this.tok.T_OBJECT_OPERATOR):"-"===t?(this.input(),this.tok.T_DEC):"="===t?(this.input(),this.tok.T_MINUS_EQUAL):"-"},"\\":function(){return this.tok.T_NS_SEPARATOR},"/":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_DIV_EQUAL):"/"},":":function(){return":"===this._input[this.offset]?(this.input(),this.tok.T_DOUBLE_COLON):":"},"(":function(){const t=this.offset;if(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),this.is_LABEL_START()){const t=this.yytext.length;this.consume_LABEL();const e=this.yytext.substring(t-1).toLowerCase(),s=this.castKeywords[e];if("number"==typeof s&&(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),")"===this._input[this.offset-1]))return s}return this.unput(this.offset-t),"("},"=":function(){const t=this._input[this.offset];return">"===t?(this.input(),this.tok.T_DOUBLE_ARROW):"="===t?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_IDENTICAL):(this.input(),this.tok.T_IS_EQUAL):"="},"+":function(){const t=this._input[this.offset];return"+"===t?(this.input(),this.tok.T_INC):"="===t?(this.input(),this.tok.T_PLUS_EQUAL):"+"},"!":function(){return"="===this._input[this.offset]?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_NOT_IDENTICAL):(this.input(),this.tok.T_IS_NOT_EQUAL):"!"},"?":function(){return this.version>=700&&"?"===this._input[this.offset]?this.version>=704&&"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_COALESCE_EQUAL):(this.input(),this.tok.T_COALESCE):this.version>=800&&"-"===this._input[this.offset]&&">"===this._input[this.offset+1]?(this.consume(2),this.tok.T_NULLSAFE_OBJECT_OPERATOR):"?"},"<":function(){let t=this._input[this.offset];return"<"===t?(t=this._input[this.offset+1],"="===t?(this.consume(2),this.tok.T_SL_EQUAL):"<"===t&&this.is_HEREDOC()?this.tok.T_START_HEREDOC:(this.input(),this.tok.T_SL)):"="===t?(this.input(),this.version>=700&&">"===this._input[this.offset]?(this.input(),this.tok.T_SPACESHIP):this.tok.T_IS_SMALLER_OR_EQUAL):">"===t?(this.input(),this.tok.T_IS_NOT_EQUAL):"<"},">":function(){let t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_IS_GREATER_OR_EQUAL):">"===t?(t=this._input[this.offset+1],"="===t?(this.consume(2),this.tok.T_SR_EQUAL):(this.input(),this.tok.T_SR)):">"},"*":function(){const t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_MUL_EQUAL):"*"===t?(this.input(),"="===this._input[this.offset]?(this.input(),this.tok.T_POW_EQUAL):this.tok.T_POW):"*"},".":function(){const t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_CONCAT_EQUAL):"."===t&&"."===this._input[this.offset+1]?(this.consume(2),this.tok.T_ELLIPSIS):"."},"%":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_MOD_EQUAL):"%"},"&":function(){const t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_AND_EQUAL):"&"===t?(this.input(),this.tok.T_BOOLEAN_AND):"&"},"|":function(){const t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_OR_EQUAL):"|"===t?(this.input(),this.tok.T_BOOLEAN_OR):"|"},"^":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_XOR_EQUAL):"^"}}}},7599:t=>{t.exports={is_NUM:function(){const t=this._input.charCodeAt(this.offset-1);return t>47&&t<58||95===t},is_NUM_START:function(){const t=this._input.charCodeAt(this.offset-1);return t>47&&t<58},is_LABEL:function(){const t=this._input.charCodeAt(this.offset-1);return t>96&&t<123||t>64&&t<91||95===t||t>47&&t<58||t>126},is_LABEL_START:function(){const t=this._input.charCodeAt(this.offset-1);return t>64&&t<91||t>96&&t<123||95===t||t>126},consume_LABEL:function(){for(;this.offset<this.size;){const t=this.input();if(!this.is_LABEL()){t&&this.unput(1);break}}return this},is_TOKEN:function(){const t=this._input[this.offset-1];return-1!==";:,.\\[]()|^&+-/*=%!~$<>?@".indexOf(t)},is_WHITESPACE:function(){const t=this._input[this.offset-1];return" "===t||"\t"===t||"\n"===t||"\r"===t},is_TABSPACE:function(){const t=this._input[this.offset-1];return" "===t||"\t"===t},consume_TABSPACE:function(){for(;this.offset<this.size;){const t=this.input();if(!this.is_TABSPACE()){t&&this.unput(1);break}}return this},is_HEX:function(){const t=this._input.charCodeAt(this.offset-1);return t>47&&t<58||t>64&&t<71||t>96&&t<103||95===t}}},5079:(t,e,s)=>{const i=s(1143);function n(t){return"."!=t&&","!=t&&!isNaN(parseFloat(t))&&isFinite(t)}const h=function(t,e){this.lexer=t,this.ast=e,this.tok=t.tok,this.EOF=t.EOF,this.token=null,this.prev=null,this.debug=!1,this.version=800,this.extractDoc=!1,this.extractTokens=!1,this.suppressErrors=!1;const s=function(t){return[t,null]};this.entries={IDENTIFIER:new Map([this.tok.T_ABSTRACT,this.tok.T_ARRAY,this.tok.T_AS,this.tok.T_BREAK,this.tok.T_CALLABLE,this.tok.T_CASE,this.tok.T_CATCH,this.tok.T_CLASS,this.tok.T_CLASS_C,this.tok.T_CLONE,this.tok.T_CONST,this.tok.T_CONTINUE,this.tok.T_DECLARE,this.tok.T_DEFAULT,this.tok.T_DIR,this.tok.T_DO,this.tok.T_ECHO,this.tok.T_ELSE,this.tok.T_ELSEIF,this.tok.T_EMPTY,this.tok.T_ENDDECLARE,this.tok.T_ENDFOR,this.tok.T_ENDFOREACH,this.tok.T_ENDIF,this.tok.T_ENDSWITCH,this.tok.T_ENDWHILE,this.tok.T_EVAL,this.tok.T_EXIT,this.tok.T_EXTENDS,this.tok.T_FILE,this.tok.T_FINAL,this.tok.T_FINALLY,this.tok.T_FN,this.tok.T_FOR,this.tok.T_FOREACH,this.tok.T_FUNC_C,this.tok.T_FUNCTION,this.tok.T_GLOBAL,this.tok.T_GOTO,this.tok.T_IF,this.tok.T_IMPLEMENTS,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_INSTANCEOF,this.tok.T_INSTEADOF,this.tok.T_INTERFACE,this.tok.T_ISSET,this.tok.T_LINE,this.tok.T_LIST,this.tok.T_LOGICAL_AND,this.tok.T_LOGICAL_OR,this.tok.T_LOGICAL_XOR,this.tok.T_MATCH,this.tok.T_METHOD_C,this.tok.T_NAMESPACE,this.tok.T_NEW,this.tok.T_NS_C,this.tok.T_PRINT,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_PUBLIC,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_RETURN,this.tok.T_STATIC,this.tok.T_SWITCH,this.tok.T_THROW,this.tok.T_TRAIT,this.tok.T_TRY,this.tok.T_UNSET,this.tok.T_USE,this.tok.T_VAR,this.tok.T_WHILE,this.tok.T_YIELD].map(s)),VARIABLE:new Map([this.tok.T_VARIABLE,"$","&",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_NAMESPACE,this.tok.T_STATIC].map(s)),SCALAR:new Map([this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C,'"','b"','B"',"-",this.tok.T_NS_SEPARATOR].map(s)),T_MAGIC_CONST:new Map([this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C].map(s)),T_MEMBER_FLAGS:new Map([this.tok.T_PUBLIC,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_STATIC,this.tok.T_ABSTRACT,this.tok.T_FINAL].map(s)),EOS:new Map([";",this.EOF,this.tok.T_INLINE_HTML].map(s)),EXPR:new Map(["@","-","+","!","~","(","`",this.tok.T_LIST,this.tok.T_CLONE,this.tok.T_INC,this.tok.T_DEC,this.tok.T_NEW,this.tok.T_ISSET,this.tok.T_EMPTY,this.tok.T_MATCH,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_EVAL,this.tok.T_INT_CAST,this.tok.T_DOUBLE_CAST,this.tok.T_STRING_CAST,this.tok.T_ARRAY_CAST,this.tok.T_OBJECT_CAST,this.tok.T_BOOL_CAST,this.tok.T_UNSET_CAST,this.tok.T_EXIT,this.tok.T_PRINT,this.tok.T_YIELD,this.tok.T_STATIC,this.tok.T_FUNCTION,this.tok.T_FN,this.tok.T_VARIABLE,"$",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_STRING,this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C,'"','b"','B"',"-",this.tok.T_NS_SEPARATOR].map(s))}};h.prototype.getTokenName=function(t){return n(t)?t==this.EOF?"the end of file (EOF)":this.lexer.engine.tokens.values[t]:"'"+t+"'"},h.prototype.parse=function(t,e){this._errors=[],this.filename=e||"eval",this.currentNamespace=[""],this.extractDoc?this._docs=[]:this._docs=null,this.extractTokens?this._tokens=[]:this._tokens=null,this._docIndex=0,this._lastNode=null,this.lexer.setInput(t),this.lexer.all_tokens=this.extractTokens,this.lexer.comment_tokens=this.extractDoc,this.length=this.lexer._input.length,this.innerList=!1,this.innerListForm=!1;const s=this.node("program"),i=[];for(this.next();this.token!=this.EOF;)i.push(this.read_start());0===i.length&&this.extractDoc&&this._docs.length>this._docIndex&&i.push(this.node("noop")()),this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset];const n=s(i,this._errors,this._docs,this._tokens);if(this.debug){const t=this.ast.checkNodes();if(t.length>0)throw t.forEach((function(t){t.position&&console.log("Node at line "+t.position.line+", column "+t.position.column),console.log(t.stack.join("\n"))})),new Error("Some nodes are not closed")}return n},h.prototype.raiseError=function(t,e,s,i){if(t+=" on line "+this.lexer.yylloc.first_line,!this.suppressErrors){const e=new SyntaxError(t,this.filename,this.lexer.yylloc.first_line);throw e.lineNumber=this.lexer.yylloc.first_line,e.fileName=this.filename,e.columnNumber=this.lexer.yylloc.first_column,e}const n=this.ast.prepare("error",null,this)(t,i,this.lexer.yylloc.first_line,s);return this._errors.push(n),n},h.prototype.error=function(t){let e="Parse Error : syntax error",s=this.getTokenName(this.token),i="";if(this.token!==this.EOF){if(n(this.token)){let t=this.text();t.length>10&&(t=t.substring(0,7)+"..."),s="'"+t+"' ("+s+")"}e+=", unexpected "+s}return t&&!Array.isArray(t)&&((n(t)||1===t.length)&&(i=", expecting "+this.getTokenName(t)),e+=i),this.raiseError(e,i,t,s)},h.prototype.position=function(){return new i(this.lexer.yylloc.first_line,this.lexer.yylloc.first_column,this.lexer.yylloc.first_offset)},h.prototype.node=function(t){if(this.extractDoc){let e=null;this._docIndex<this._docs.length&&(e=this._docs.slice(this._docIndex),this._docIndex=this._docs.length,this.debug&&(console.log(new Error("Append docs on "+t)),console.log(e)));const s=this.ast.prepare(t,e,this);return s.postBuild=function(t){if(this._docIndex<this._docs.length)if(this._lastNode){const t=this.prev[2];let e=this._docIndex;for(;e<this._docs.length&&!(this._docs[e].offset>t);e++);e>this._docIndex&&(this._lastNode.setTrailingComments(this._docs.slice(this._docIndex,e)),this._docIndex=e)}else this.token===this.EOF&&(t.setTrailingComments(this._docs.slice(this._docIndex)),this._docIndex=this._docs.length);this._lastNode=t}.bind(this),s}return this.ast.prepare(t,null,this)},h.prototype.expectEndOfStatement=function(t){if(";"===this.token)t&&";"===this.lexer.yytext&&t.includeToken(this);else if(this.token!==this.tok.T_INLINE_HTML&&this.token!==this.EOF)return this.error(";"),!1;return this.next(),!0};const o=["parser.next","parser.node","parser.showlog"];h.prototype.showlog=function(){const t=(new Error).stack.split("\n");let e;for(let s=2;s<t.length;s++){e=t[s].trim();let i=!1;for(let t=0;t<o.length;t++)if(e.substring(3,3+o[t].length)===o[t]){i=!0;break}if(!i)break}return console.log("Line "+this.lexer.yylloc.first_line+" : "+this.getTokenName(this.token)+">"+this.lexer.yytext+"< @--\x3e"+e),this},h.prototype.expect=function(t){if(Array.isArray(t)){if(-1===t.indexOf(this.token))return this.error(t),!1}else if(this.token!=t)return this.error(t),!1;return!0},h.prototype.text=function(){return this.lexer.yytext},h.prototype.next=function(){if(";"===this.token&&";"!==this.lexer.yytext||(this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset]),this.lex(),this.debug&&this.showlog(),this.extractDoc)for(;this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT;)this.token===this.tok.T_COMMENT?this._docs.push(this.read_comment()):this._docs.push(this.read_doc_comment());return this},h.prototype.lex=function(){if(this.extractTokens)do{if(this.token=this.lexer.lex()||this.EOF,this.token===this.EOF)return this;let t=this.lexer.yytext;if(t=this.lexer.engine.tokens.values.hasOwnProperty(this.token)?[this.lexer.engine.tokens.values[this.token],t,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset]:[null,t,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset],this._tokens.push(t),this.token===this.tok.T_CLOSE_TAG)return this.token=";",this;if(this.token===this.tok.T_OPEN_TAG_WITH_ECHO)return this.token=this.tok.T_ECHO,this}while(this.token===this.tok.T_WHITESPACE||!this.extractDoc&&(this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT)||this.token===this.tok.T_OPEN_TAG);else this.token=this.lexer.lex()||this.EOF;return this},h.prototype.is=function(t){return Array.isArray(t)?-1!==t.indexOf(this.token):this.entries[t].has(this.token)},[s(3489),s(1395),s(1482),s(8356),s(8658),s(8573),s(3897),s(660),s(7616),s(2932),s(3912),s(510),s(5289),s(4394),s(8414)].forEach((function(t){for(const e in t){if(h.prototype.hasOwnProperty(e))throw new Error("Function "+e+" is already defined - collision");h.prototype[e]=t[e]}})),t.exports=h},3489:t=>{t.exports={read_array:function(){let t=null,e=!1;const s=this.node("array");this.token===this.tok.T_ARRAY?(this.next().expect("("),t=")"):(e=!0,t="]");let i=[];return this.next().token!==t&&(i=this.read_array_pair_list(e)),this.expect(t),this.next(),s(e,i)},read_array_pair_list:function(t){const e=this;return this.read_list((function(){return e.read_array_pair(t)}),",",!0)},read_array_pair:function(t){if(!t&&")"===this.token||t&&"]"===this.token)return;if(","===this.token)return this.node("noop")();const e=this.node("entry");let s=null,i=null,n=!1,h=!1;if("&"===this.token)this.next(),n=!0,i=this.read_variable(!0,!1);else if(this.token===this.tok.T_ELLIPSIS&&this.version>=704)this.next(),"&"===this.token&&this.error(),h=!0,i=this.read_expr();else{const t=this.read_expr();this.token===this.tok.T_DOUBLE_ARROW?(this.next(),s=t,"&"===this.token?(this.next(),n=!0,i=this.read_variable(!0,!1)):i=this.read_expr()):i=t}return e(s,i,n,h)}}},1395:t=>{t.exports={read_class_declaration_statement:function(t){const e=this.node("class"),s=this.read_class_modifiers();if(this.token!==this.tok.T_CLASS)return this.error(this.tok.T_CLASS),this.next(),null;this.next().expect(this.tok.T_STRING);let i=this.node("identifier");const n=this.text();this.next(),i=i(n);const h=this.read_extends_from(),o=this.read_implements_list();this.expect("{");const r=e(i,h,o,this.next().read_class_body(),s);return t&&(r.attrGroups=t),r},read_class_modifiers:function(){return[0,0,this.read_class_modifier()]},read_class_modifier:function(){return this.token===this.tok.T_ABSTRACT?(this.next(),1):this.token===this.tok.T_FINAL?(this.next(),2):0},read_class_body:function(){let t=[],e=[];for(;this.token!==this.EOF&&"}"!==this.token;){if(this.token===this.tok.T_COMMENT){t.push(this.read_comment());continue}if(this.token===this.tok.T_DOC_COMMENT){t.push(this.read_doc_comment());continue}if(this.token===this.tok.T_USE){t=t.concat(this.read_trait_use_statement());continue}this.token===this.tok.T_ATTRIBUTE&&(e=this.read_attr_list());const s=this.position(),i=this.read_member_flags(!1);if(this.token!==this.tok.T_CONST)if(this.token===this.tok.T_VAR&&(this.next().expect(this.tok.T_VARIABLE),i[0]=null,i[1]=0),this.token===this.tok.T_FUNCTION)t.push(this.read_function(!1,i,e,s)),e=[];else if(this.token===this.tok.T_VARIABLE||this.version>=704&&("?"===this.token||this.token===this.tok.T_CALLABLE||this.token===this.tok.T_ARRAY||this.token===this.tok.T_NS_SEPARATOR||this.token===this.tok.T_STRING||this.token===this.tok.T_NAMESPACE)){const s=this.read_variable_list(i,e);e=[],this.expect(";"),this.next(),t=t.concat(s)}else this.error([this.tok.T_CONST,this.tok.T_VARIABLE,this.tok.T_FUNCTION]),this.next();else{const s=this.read_constant_list(i,e);this.expect(";")&&this.next(),t=t.concat(s)}}return this.expect("}"),this.next(),t},read_variable_list:function(t,e){const s=this.node("propertystatement"),i=this.read_list((function(){const t=this.node("property"),[s,i]=this.read_optional_type();this.expect(this.tok.T_VARIABLE);let n=this.node("identifier");const h=this.text().substring(1);return this.next(),n=n(h),";"===this.token||","===this.token?t(n,null,s,i,e||[]):"="===this.token?t(n,this.next().read_expr(),s,i,e||[]):(this.expect([",",";","="]),t(n,null,s,i,e||[]))}),",");return s(null,i,t)},read_constant_list:function(t,e){this.expect(this.tok.T_CONST)&&this.next();const s=this.node("classconstant"),i=this.read_list((function(){const t=this.node("constant");let e=null,s=null;if(this.token===this.tok.T_STRING||this.version>=700&&this.is("IDENTIFIER")){e=this.node("identifier");const t=this.text();this.next(),e=e(t)}else this.expect("IDENTIFIER");return this.expect("=")&&(s=this.next().read_expr()),t(e,s)}),",");return s(null,i,t,e||[])},read_member_flags:function(t){const e=[-1,-1,-1];if(this.is("T_MEMBER_FLAGS")){let s=0,i=0;do{switch(this.token){case this.tok.T_PUBLIC:s=0,i=0;break;case this.tok.T_PROTECTED:s=0,i=1;break;case this.tok.T_PRIVATE:s=0,i=2;break;case this.tok.T_STATIC:s=1,i=1;break;case this.tok.T_ABSTRACT:s=2,i=1;break;case this.tok.T_FINAL:s=2,i=2}t&&(0==s&&2==i?(this.expect([this.tok.T_PUBLIC,this.tok.T_PROTECTED]),i=-1):2==s&&1==i&&(this.error(),i=-1)),-1!==e[s]?this.error():-1!==i&&(e[s]=i)}while(this.next().is("T_MEMBER_FLAGS"))}return-1==e[1]&&(e[1]=0),-1==e[2]&&(e[2]=0),e},read_optional_type:function(){let t=!1;"?"===this.token&&(t=!0,this.next());let e=this.read_types();if(t&&!e&&this.raiseError("Expecting a type definition combined with nullable operator"),!t&&!e)return[!1,null];if("|"===this.token){e=[e];do{this.next();const t=this.read_type();if(!t){this.raiseError("Expecting a type definition");break}e.push(t)}while("|"===this.token)}return[t,e]},read_interface_declaration_statement:function(t){const e=this.node("interface");if(this.token!==this.tok.T_INTERFACE)return this.error(this.tok.T_INTERFACE),this.next(),null;this.next().expect(this.tok.T_STRING);let s=this.node("identifier");const i=this.text();this.next(),s=s(i);const n=this.read_interface_extends_list();return this.expect("{"),e(s,n,this.next().read_interface_body(),t||[])},read_interface_body:function(){let t=[],e=[];for(;this.token!==this.EOF&&"}"!==this.token;){if(this.token===this.tok.T_COMMENT){t.push(this.read_comment());continue}if(this.token===this.tok.T_DOC_COMMENT){t.push(this.read_doc_comment());continue}const s=this.position();e=this.read_attr_list();const i=this.read_member_flags(!0);if(this.token==this.tok.T_CONST){const s=this.read_constant_list(i,e);this.expect(";")&&this.next(),t=t.concat(s),e=[]}else if(this.token===this.tok.T_FUNCTION){const n=this.read_function_declaration(2,i,e,s);n.parseFlags(i),t.push(n),this.expect(";")&&this.next(),e=[]}else this.error([this.tok.T_CONST,this.tok.T_FUNCTION]),this.next()}return this.expect("}")&&this.next(),t},read_trait_declaration_statement:function(){const t=this.node("trait");if(this.token!==this.tok.T_TRAIT)return this.error(this.tok.T_TRAIT),this.next(),null;this.next().expect(this.tok.T_STRING);let e=this.node("identifier");const s=this.text();return this.next(),e=e(s),this.expect("{"),t(e,this.next().read_class_body())},read_trait_use_statement:function(){const t=this.node("traituse");this.expect(this.tok.T_USE)&&this.next();const e=[this.read_namespace_name()];let s=null;for(;","===this.token;)e.push(this.next().read_namespace_name());if("{"===this.token){for(s=[];this.next().token!==this.EOF&&"}"!==this.token;)s.push(this.read_trait_use_alias()),this.expect(";");this.expect("}")&&this.next()}else this.expect(";")&&this.next();return t(e,s)},read_trait_use_alias:function(){const t=this.node();let e,s=null;if(this.is("IDENTIFIER")){e=this.node("identifier");const t=this.text();this.next(),e=e(t)}else if(e=this.read_namespace_name(),this.token===this.tok.T_DOUBLE_COLON)if(this.next(),this.token===this.tok.T_STRING||this.version>=700&&this.is("IDENTIFIER")){s=e,e=this.node("identifier");const t=this.text();this.next(),e=e(t)}else this.expect(this.tok.T_STRING);else e=e.name;if(this.token===this.tok.T_INSTEADOF)return t("traitprecedence",s,e,this.next().read_name_list());if(this.token===this.tok.T_AS){let i=null,n=null;if(this.next().is("T_MEMBER_FLAGS")&&(i=this.read_member_flags()),this.token===this.tok.T_STRING||this.version>=700&&this.is("IDENTIFIER")){n=this.node("identifier");const t=this.text();this.next(),n=n(t)}else!1===i&&this.expect(this.tok.T_STRING);return t("traitalias",s,e,n,i)}return this.expect([this.tok.T_AS,this.tok.T_INSTEADOF]),t("traitalias",s,e,null,null)}}},1482:t=>{t.exports={read_comment:function(){const t=this.text();let e=this.ast.prepare("/*"===t.substring(0,2)?"commentblock":"commentline",null,this);const s=this.lexer.yylloc.first_offset,i=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),e=e(t),e.offset=s,this.prev=i,e},read_doc_comment:function(){let t=this.ast.prepare("commentblock",null,this);const e=this.lexer.yylloc.first_offset,s=this.text(),i=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),t=t(s),t.offset=e,this.prev=i,t}}},8356:t=>{t.exports={read_expr:function(t){const e=this.node();if("@"===this.token)return t||(t=this.next().read_expr()),e("silent",t);if(t||(t=this.read_expr_item()),"|"===this.token)return e("bin","|",t,this.next().read_expr());if("&"===this.token)return e("bin","&",t,this.next().read_expr());if("^"===this.token)return e("bin","^",t,this.next().read_expr());if("."===this.token)return e("bin",".",t,this.next().read_expr());if("+"===this.token)return e("bin","+",t,this.next().read_expr());if("-"===this.token)return e("bin","-",t,this.next().read_expr());if("*"===this.token)return e("bin","*",t,this.next().read_expr());if("/"===this.token)return e("bin","/",t,this.next().read_expr());if("%"===this.token)return e("bin","%",t,this.next().read_expr());if(this.token===this.tok.T_POW)return e("bin","**",t,this.next().read_expr());if(this.token===this.tok.T_SL)return e("bin","<<",t,this.next().read_expr());if(this.token===this.tok.T_SR)return e("bin",">>",t,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_OR)return e("bin","||",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_OR)return e("bin","or",t,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_AND)return e("bin","&&",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_AND)return e("bin","and",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_XOR)return e("bin","xor",t,this.next().read_expr());if(this.token===this.tok.T_IS_IDENTICAL)return e("bin","===",t,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_IDENTICAL)return e("bin","!==",t,this.next().read_expr());if(this.token===this.tok.T_IS_EQUAL)return e("bin","==",t,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_EQUAL)return e("bin","!=",t,this.next().read_expr());if("<"===this.token)return e("bin","<",t,this.next().read_expr());if(">"===this.token)return e("bin",">",t,this.next().read_expr());if(this.token===this.tok.T_IS_SMALLER_OR_EQUAL)return e("bin","<=",t,this.next().read_expr());if(this.token===this.tok.T_IS_GREATER_OR_EQUAL)return e("bin",">=",t,this.next().read_expr());if(this.token===this.tok.T_SPACESHIP)return e("bin","<=>",t,this.next().read_expr());if(this.token===this.tok.T_INSTANCEOF&&(t=e("bin","instanceof",t,this.next().read_class_name_reference()),";"!==this.token&&this.token!==this.tok.T_INLINE_HTML&&this.token!==this.EOF&&(t=this.read_expr(t))),this.token===this.tok.T_COALESCE)return e("bin","??",t,this.next().read_expr());if("?"===this.token){let s=null;return":"!==this.next().token&&(s=this.read_expr()),this.expect(":")&&this.next(),e("retif",t,s,this.read_expr())}return e.destroy(t),t},read_expr_cast:function(t){return this.node("cast")(t,this.text(),this.next().read_expr())},read_isset_variable:function(){return this.read_expr()},read_isset_variables:function(){return this.read_function_list(this.read_isset_variable,",")},read_internal_functions_in_yacc:function(){let t=null;switch(this.token){case this.tok.T_ISSET:{t=this.node("isset"),this.next().expect("(")&&this.next();const e=this.read_isset_variables();this.expect(")")&&this.next(),t=t(e)}break;case this.tok.T_EMPTY:{t=this.node("empty"),this.next().expect("(")&&this.next();const e=this.read_expr();this.expect(")")&&this.next(),t=t(e)}break;case this.tok.T_INCLUDE:t=this.node("include")(!1,!1,this.next().read_expr());break;case this.tok.T_INCLUDE_ONCE:t=this.node("include")(!0,!1,this.next().read_expr());break;case this.tok.T_EVAL:{t=this.node("eval"),this.next().expect("(")&&this.next();const e=this.read_expr();this.expect(")")&&this.next(),t=t(e)}break;case this.tok.T_REQUIRE:t=this.node("include")(!1,!0,this.next().read_expr());break;case this.tok.T_REQUIRE_ONCE:t=this.node("include")(!0,!0,this.next().read_expr())}return t},read_optional_expr:function(t){return this.token!==t?this.read_expr():null},read_exit_expr:function(){let t=null;return"("===this.token&&(this.next(),t=this.read_optional_expr(")"),this.expect(")")&&this.next()),t},read_expr_item:function(){let t,e,s=[];if("+"===this.token)return this.node("unary")("+",this.next().read_expr());if("-"===this.token)return this.node("unary")("-",this.next().read_expr());if("!"===this.token)return this.node("unary")("!",this.next().read_expr());if("~"===this.token)return this.node("unary")("~",this.next().read_expr());if("("===this.token)return e=this.next().read_expr(),e.parenthesizedExpression=!0,this.expect(")")&&this.next(),this.handleDereferencable(e);if("`"===this.token)return this.read_encapsed_string("`");if(this.token===this.tok.T_LIST){let e=null;const s=this.innerList;t=this.node("list"),s||(e=this.node("assign")),this.next().expect("(")&&this.next(),this.innerList||(this.innerList=!0);const i=this.read_array_pair_list(!1);this.expect(")")&&this.next();let n=!1;for(let t=0;t<i.length;t++)if(null!==i[t]&&"noop"!==i[t].kind){n=!0;break}return n||this.raiseError("Fatal Error : Cannot use empty list on line "+this.lexer.yylloc.first_line),s?t(i,!1):(this.innerList=!1,this.expect("=")?e(t(i,!1),this.next().read_expr(),"="):t(i,!1))}if(this.token===this.tok.T_ATTRIBUTE&&(s=this.read_attr_list()),this.token===this.tok.T_CLONE)return this.node("clone")(this.next().read_expr());switch(this.token){case this.tok.T_INC:return this.node("pre")("+",this.next().read_variable(!1,!1));case this.tok.T_DEC:return this.node("pre")("-",this.next().read_variable(!1,!1));case this.tok.T_NEW:return this.read_new_expr();case this.tok.T_ISSET:case this.tok.T_EMPTY:case this.tok.T_INCLUDE:case this.tok.T_INCLUDE_ONCE:case this.tok.T_EVAL:case this.tok.T_REQUIRE:case this.tok.T_REQUIRE_ONCE:return this.read_internal_functions_in_yacc();case this.tok.T_MATCH:return this.read_match_expression();case this.tok.T_INT_CAST:return this.read_expr_cast("int");case this.tok.T_DOUBLE_CAST:return this.read_expr_cast("float");case this.tok.T_STRING_CAST:return this.read_expr_cast(-1!==this.text().indexOf("binary")?"binary":"string");case this.tok.T_ARRAY_CAST:return this.read_expr_cast("array");case this.tok.T_OBJECT_CAST:return this.read_expr_cast("object");case this.tok.T_BOOL_CAST:return this.read_expr_cast("bool");case this.tok.T_UNSET_CAST:return this.read_expr_cast("unset");case this.tok.T_THROW:return this.version<800&&this.raiseError("PHP 8+ is required to use throw as an expression"),this.node("throw")(this.next().read_expr());case this.tok.T_EXIT:{const e="die"===this.lexer.yytext.toLowerCase();return t=this.node("exit"),this.next(),t(this.read_exit_expr(),e)}case this.tok.T_PRINT:return this.node("print")(this.next().read_expr());case this.tok.T_YIELD:{let e=null,s=null;return t=this.node("yield"),this.next().is("EXPR")&&(e=this.read_expr(),this.token===this.tok.T_DOUBLE_ARROW&&(s=e,e=this.next().read_expr())),t(e,s)}case this.tok.T_YIELD_FROM:return t=this.node("yieldfrom"),e=this.next().read_expr(),t(e);case this.tok.T_FN:case this.tok.T_FUNCTION:return this.read_inline_function(void 0,s);case this.tok.T_STATIC:{const t=[this.token,this.lexer.getState()];if(this.next(),this.token===this.tok.T_FUNCTION||this.version>=704&&this.token===this.tok.T_FN)return this.read_inline_function([0,1,0],s);this.lexer.tokens.push(t),this.next()}}if(this.is("VARIABLE")){t=this.node(),e=this.read_variable(!1,!1);const s="identifier"===e.kind||"staticlookup"===e.kind&&"identifier"===e.offset.kind;switch(this.token){case"=":return s&&this.error("VARIABLE"),"&"==this.next().token?this.read_assignref(t,e):t("assign",e,this.read_expr(),"=");case this.tok.T_PLUS_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"+=");case this.tok.T_MINUS_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"-=");case this.tok.T_MUL_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"*=");case this.tok.T_POW_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"**=");case this.tok.T_DIV_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"/=");case this.tok.T_CONCAT_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),".=");case this.tok.T_MOD_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"%=");case this.tok.T_AND_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"&=");case this.tok.T_OR_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"|=");case this.tok.T_XOR_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"^=");case this.tok.T_SL_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"<<=");case this.tok.T_SR_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),">>=");case this.tok.T_COALESCE_EQUAL:return s&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"??=");case this.tok.T_INC:return s&&this.error("VARIABLE"),this.next(),t("post","+",e);case this.tok.T_DEC:return s&&this.error("VARIABLE"),this.next(),t("post","-",e);default:t.destroy(e)}}else{if(this.is("SCALAR")){if(t=this.node(),e=this.read_scalar(),"array"===e.kind&&e.shortForm&&"="===this.token){const s=this.convertToList(e);return e.loc&&(s.loc=e.loc),t("assign",s,this.next().read_expr(),"=")}return t.destroy(e),this.handleDereferencable(e)}this.error("EXPR"),this.next()}return e},convertToList:function(t){const e=t.items.map((t=>(t.value&&"array"===t.value.kind&&t.value.shortForm&&(t.value=this.convertToList(t.value)),t))),s=this.node("list")(e,!0);return t.loc&&(s.loc=t.loc),t.leadingComments&&(s.leadingComments=t.leadingComments),t.trailingComments&&(s.trailingComments=t.trailingComments),s},read_assignref:function(t,e){let s;return this.next(),this.token===this.tok.T_NEW?(this.version>=700&&this.error(),s=this.read_new_expr()):s=this.read_variable(!1,!1),t("assignref",e,s)},read_inline_function:function(t,e){if(this.token===this.tok.T_FUNCTION){const s=this.read_function(!0,t,e);return s.attrGroups=e,s}!this.version>=704&&this.raiseError("Arrow Functions are not allowed");const s=this.node("arrowfunc");this.expect(this.tok.T_FN)&&this.next();const i=this.is_reference();this.expect("(")&&this.next();const n=this.read_parameter_list();this.expect(")")&&this.next();let h=!1,o=null;":"===this.token&&("?"===this.next().token&&(h=!0,this.next()),o=this.read_types()),this.expect(this.tok.T_DOUBLE_ARROW)&&this.next();const r=s(n,i,this.read_expr(),o,h,!!t);return r.attrGroups=e,r},read_match_expression:function(){const t=this.node("match");this.expect(this.tok.T_MATCH)&&this.next(),this.version<800&&this.raiseError("Match statements are not allowed before PHP 8");let e=null,s=[];return this.expect("(")&&this.next(),e=this.read_expr(),this.expect(")")&&this.next(),this.expect("{")&&this.next(),s=this.read_match_arms(),this.expect("}")&&this.next(),t(e,s)},read_match_arms:function(){return this.read_list((()=>this.read_match_arm()),",",!0)},read_match_arm:function(){if("}"!==this.token)return this.node("matcharm")(this.read_match_arm_conds(),this.read_expr())},read_match_arm_conds:function(){let t=[];if(this.token===this.tok.T_DEFAULT)t=null,this.next();else for(t.push(this.read_expr());","===this.token;){if(this.next(),this.token===this.tok.T_DOUBLE_ARROW)return this.next(),t;t.push(this.read_expr())}return this.expect(this.tok.T_DOUBLE_ARROW)&&this.next(),t},read_attribute(){const t=this.text();let e=[];return this.next(),"("===this.token&&(e=this.read_argument_list()),this.node("attribute")(t,e)},read_attr_list(){const t=[];if(this.token===this.tok.T_ATTRIBUTE)do{const e=this.node("attrgroup")([]);for(this.next(),e.attrs.push(this.read_attribute());","===this.token;)this.next(),"]"!==this.token&&e.attrs.push(this.read_attribute());t.push(e),this.expect("]"),this.next()}while(this.token===this.tok.T_ATTRIBUTE);return t},read_new_expr:function(){const t=this.node("new");this.expect(this.tok.T_NEW)&&this.next();let e=[];const s=this.read_attr_list();if(this.token===this.tok.T_CLASS){const i=this.node("class");"("===this.next().token&&(e=this.read_argument_list());const n=this.read_extends_from(),h=this.read_implements_list();let o=null;this.expect("{")&&(o=this.next().read_class_body());const r=i(null,n,h,o,[0,0,0]);return r.attrGroups=s,t(r,e)}const i=this.read_new_class_name();return"("===this.token&&(e=this.read_argument_list()),t(i,e)},read_new_class_name:function(){if(this.token===this.tok.T_NS_SEPARATOR||this.token===this.tok.T_STRING||this.token===this.tok.T_NAMESPACE){let t=this.read_namespace_name(!0);return this.token===this.tok.T_DOUBLE_COLON&&(t=this.read_static_getter(t)),t}if(this.is("VARIABLE"))return this.read_variable(!0,!1);this.expect([this.tok.T_STRING,"VARIABLE"])},handleDereferencable:function(t){for(;this.token!==this.EOF;)if(this.token===this.tok.T_OBJECT_OPERATOR||this.token===this.tok.T_DOUBLE_COLON)t=this.recursive_variable_chain_scan(t,!1,!1,!0);else if(this.token===this.tok.T_CURLY_OPEN||"["===this.token)t=this.read_dereferencable(t);else{if("("!==this.token)return t;t=this.node("call")(t,this.read_argument_list())}return t}}},8658:t=>{t.exports={is_reference:function(){return"&"==this.token&&(this.next(),!0)},is_variadic:function(){return this.token===this.tok.T_ELLIPSIS&&(this.next(),!0)},read_function:function(t,e,s,i){const n=this.read_function_declaration(t?1:e?2:0,e&&1===e[1],s||[],i);return e&&1==e[2]?(n.parseFlags(e),this.expect(";")&&this.next()):(this.expect("{")&&(n.body=this.read_code_block(!1),n.loc&&n.body.loc&&(n.loc.end=n.body.loc.end)),!t&&e&&n.parseFlags(e)),n},read_function_declaration:function(t,e,s,i){let n="function";1===t?n="closure":2===t&&(n="method");const h=this.node(n);this.expect(this.tok.T_FUNCTION)&&this.next();const o=this.is_reference();let r=!1,_=[],a=null,c=!1;if(1!==t){const e=this.node("identifier");2===t?this.version>=700?this.token===this.tok.T_STRING||this.is("IDENTIFIER")?(r=this.text(),this.next()):this.version<704&&this.error("IDENTIFIER"):this.token===this.tok.T_STRING?(r=this.text(),this.next()):this.error("IDENTIFIER"):this.version>=700?this.token===this.tok.T_STRING?(r=this.text(),this.next()):this.version>=704?this.expect("(")||this.next():(this.error(this.tok.T_STRING),this.next()):(this.expect(this.tok.T_STRING)&&(r=this.text()),this.next()),r=e(r)}this.expect("(")&&this.next();const l=this.read_parameter_list();this.expect(")")&&this.next(),1===t&&(_=this.read_lexical_vars()),":"===this.token&&("?"===this.next().token&&(c=!0,this.next()),a=this.read_types());return(t=>(t.attrGroups=s||[],i&&t.loc&&(t.loc.start=i,t.loc.source&&(t.loc.source=this.lexer._input.substr(t.loc.start.offset,t.loc.end.offset-t.loc.start.offset))),t))(1===t?h(l,o,_,a,c,e):h(r,l,o,a,c))},read_lexical_vars:function(){let t=[];return this.token===this.tok.T_USE&&(this.next(),this.expect("(")&&this.next(),t=this.read_lexical_var_list(),this.expect(")")&&this.next()),t},read_list_with_dangling_comma:function(t){const e=[];for(;this.token!=this.EOF;){if(e.push(t()),","!=this.token){if(")"==this.token)break;this.error([",",")"]);break}if(this.next(),this.version>=800&&")"===this.token)return e}return e},read_lexical_var_list:function(){return this.read_list_with_dangling_comma(this.read_lexical_var.bind(this))},read_lexical_var:function(){if("&"===this.token)return this.read_byref(this.read_lexical_var.bind(this));const t=this.node("variable");this.expect(this.tok.T_VARIABLE);const e=this.text().substring(1);return this.next(),t(e,!1)},read_parameter_list:function(){return")"!=this.token?this.read_list_with_dangling_comma(this.read_parameter.bind(this)):[]},read_parameter:function(){const t=this.node("parameter");let e=null,s=null,i=null,n=!1,h=[];this.token===this.tok.T_ATTRIBUTE&&(h=this.read_attr_list());const o=this.read_promoted();"?"===this.token&&(this.next(),n=!0),i=this.read_types(),n&&!i&&this.raiseError("Expecting a type definition combined with nullable operator");const r=this.is_reference(),_=this.is_variadic();if(this.expect(this.tok.T_VARIABLE)){e=this.node("identifier");const t=this.text().substring(1);this.next(),e=e(t)}"="==this.token&&(s=this.next().read_expr());const a=t(e,i,s,r,_,n,o);return h&&(a.attrGroups=h),a},read_types(){const t=[],e=this.node("uniontype");let s=this.read_type();if(!s)return null;for(t.push(s);"|"===this.token;)this.next(),s=this.read_type(),t.push(s);return 1===t.length?t[0]:e(t)},read_promoted(){return this.token===this.tok.T_PUBLIC?(this.next(),1):this.token===this.tok.T_PROTECTED?(this.next(),2):this.token===this.tok.T_PRIVATE?(this.next(),4):0},read_argument_list:function(){let t=[];return this.expect("(")&&this.next(),")"!==this.token&&(t=this.read_non_empty_argument_list()),this.expect(")")&&this.next(),t},read_non_empty_argument_list:function(){let t=!1;return this.read_function_list(function(){const e=this.read_argument();return e&&(t&&this.raiseError("Unexpected argument after a variadic argument"),"variadic"===e.kind&&(t=!0)),e}.bind(this),",")},read_argument:function(){if(this.token===this.tok.T_ELLIPSIS)return this.node("variadic")(this.next().read_expr());if(this.token===this.tok.T_STRING||Object.values(this.lexer.keywords).includes(this.token)){const t=this.lexer.getState(),e=this.lexer.lex();if(this.lexer.setState(t),":"===e)return this.version<800&&this.raiseError("PHP 8+ is required to use named arguments"),this.node("namedargument")(this.text(),this.next().next().read_expr())}return this.read_expr()},read_type:function(){const t=this.node();if(this.token===this.tok.T_ARRAY||this.token===this.tok.T_CALLABLE){const e=this.text();return this.next(),t("typereference",e.toLowerCase(),e)}if(this.token===this.tok.T_STRING||this.token===this.tok.T_STATIC){const e=this.text(),s=[this.token,this.lexer.getState()];return this.next(),this.token!==this.tok.T_NS_SEPARATOR&&this.ast.typereference.types.indexOf(e.toLowerCase())>-1?t("typereference",e.toLowerCase(),e):(this.lexer.tokens.push(s),this.next(),t.destroy(),this.read_namespace_name())}return this.token===this.tok.T_NAMESPACE||this.token===this.tok.T_NS_SEPARATOR?(t.destroy(),this.read_namespace_name()):(t.destroy(),null)}}},8573:t=>{t.exports={read_if:function(){const t=this.node("if"),e=this.next().read_if_expr();let s=null,i=null,n=!1;if(":"===this.token){n=!0,this.next(),s=this.node("block");const t=[];for(;this.token!==this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){i=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){i=this.read_else_short();break}t.push(this.read_inner_statement())}s=s(null,t),this.expect(this.tok.T_ENDIF)&&this.next(),this.expectEndOfStatement()}else s=this.read_statement(),this.token===this.tok.T_ELSEIF?i=this.read_if():this.token===this.tok.T_ELSE&&(i=this.next().read_statement());return t(e,s,i,n)},read_if_expr:function(){this.expect("(")&&this.next();const t=this.read_expr();return this.expect(")")&&this.next(),t},read_elseif_short:function(){let t=null;const e=this.node("if"),s=this.next().read_if_expr();this.expect(":")&&this.next();const i=this.node("block"),n=[];for(;this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){t=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){t=this.read_else_short();break}n.push(this.read_inner_statement())}return e(s,i(null,n),t,!0)},read_else_short:function(){this.next().expect(":")&&this.next();const t=this.node("block"),e=[];for(;this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;)e.push(this.read_inner_statement());return t(null,e)}}},3897:t=>{t.exports={read_while:function(){const t=this.node("while");this.expect(this.tok.T_WHILE)&&this.next();let e=null,s=null,i=!1;return this.expect("(")&&this.next(),e=this.read_expr(),this.expect(")")&&this.next(),":"===this.token?(i=!0,s=this.read_short_form(this.tok.T_ENDWHILE)):s=this.read_statement(),t(e,s,i)},read_do:function(){const t=this.node("do");this.expect(this.tok.T_DO)&&this.next();let e=null,s=null;return s=this.read_statement(),this.expect(this.tok.T_WHILE)&&(this.next().expect("(")&&this.next(),e=this.read_expr(),this.expect(")")&&this.next(),this.expect(";")&&this.next()),t(e,s)},read_for:function(){const t=this.node("for");this.expect(this.tok.T_FOR)&&this.next();let e=[],s=[],i=[],n=null,h=!1;return this.expect("(")&&this.next(),";"!==this.token?(e=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),";"!==this.token?(s=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),")"!==this.token?(i=this.read_list(this.read_expr,","),this.expect(")")&&this.next()):this.next(),":"===this.token?(h=!0,n=this.read_short_form(this.tok.T_ENDFOR)):n=this.read_statement(),t(e,s,i,n,h)},read_foreach:function(){const t=this.node("foreach");this.expect(this.tok.T_FOREACH)&&this.next();let e=null,s=null,i=null,n=null,h=!1;return this.expect("(")&&this.next(),e=this.read_expr(),this.expect(this.tok.T_AS)&&(this.next(),i=this.read_foreach_variable(),this.token===this.tok.T_DOUBLE_ARROW&&(s=i,i=this.next().read_foreach_variable())),s&&"list"===s.kind&&this.raiseError("Fatal Error : Cannot use list as key element"),this.expect(")")&&this.next(),":"===this.token?(h=!0,n=this.read_short_form(this.tok.T_ENDFOREACH)):n=this.read_statement(),t(e,s,i,n,h)},read_foreach_variable:function(){if(this.token===this.tok.T_LIST||"["===this.token){const t="["===this.token,e=this.node("list");this.next(),!t&&this.expect("(")&&this.next();const s=this.read_array_pair_list(t);return this.expect(t?"]":")")&&this.next(),e(s,t)}return this.read_variable(!1,!1)}}},660:t=>{t.exports={read_start:function(){return this.token==this.tok.T_NAMESPACE?this.read_namespace():this.read_top_statement()}}},7616:t=>{t.exports={read_namespace:function(){const t=this.node("namespace");let e,s;return this.expect(this.tok.T_NAMESPACE)&&this.next(),s="{"==this.token?{name:[""]}:this.read_namespace_name(),this.currentNamespace=s,";"==this.token?(this.currentNamespace=s,e=this.next().read_top_statements(),this.expect(this.EOF),t(s.name,e,!1)):"{"==this.token?(this.currentNamespace=s,e=this.next().read_top_statements(),this.expect("}")&&this.next(),0===e.length&&this.extractDoc&&this._docs.length>this._docIndex&&e.push(this.node("noop")()),t(s.name,e,!0)):"("===this.token?(s.resolution=this.ast.reference.RELATIVE_NAME,s.name=s.name.substring(1),t.destroy(),this.node("call")(s,this.read_argument_list())):(this.error(["{",";"]),this.currentNamespace=s,e=this.read_top_statements(),this.expect(this.EOF),t(s,e,!1))},read_namespace_name:function(t){const e=this.node();let s=!1;this.token===this.tok.T_NAMESPACE&&(this.next().expect(this.tok.T_NS_SEPARATOR)&&this.next(),s=!0);const i=this.read_list(this.tok.T_STRING,this.tok.T_NS_SEPARATOR,!0);if(!s&&1===i.length&&(t||"("!==this.token)){if("parent"===i[0].toLowerCase())return e("parentreference",i[0]);if("self"===i[0].toLowerCase())return e("selfreference",i[0])}return e("name",i,s)},read_use_statement:function(){let t=this.node("usegroup"),e=[],s=null;this.expect(this.tok.T_USE)&&this.next();const i=this.read_use_type();return e.push(this.read_use_declaration(!1)),","===this.token?e=e.concat(this.next().read_use_declarations(!1)):"{"===this.token&&(s=e[0].name,e=this.next().read_use_declarations(null===i),this.expect("}")&&this.next()),t=t(s,i,e),this.expect(";")&&this.next(),t},read_class_name_reference:function(){return this.read_variable(!0,!1)},read_use_declaration:function(t){const e=this.node("useitem");let s=null;t&&(s=this.read_use_type());const i=this.read_namespace_name(),n=this.read_use_alias();return e(i.name,n,s)},read_use_declarations:function(t){const e=[this.read_use_declaration(t)];for(;","===this.token;){if(this.next(),t){if(this.token!==this.tok.T_FUNCTION&&this.token!==this.tok.T_CONST&&this.token!==this.tok.T_STRING)break}else if(this.token!==this.tok.T_STRING&&this.token!==this.tok.T_NS_SEPARATOR)break;e.push(this.read_use_declaration(t))}return e},read_use_alias:function(){let t=null;if(this.token===this.tok.T_AS&&this.next().expect(this.tok.T_STRING)){const e=this.node("identifier"),s=this.text();this.next(),t=e(s)}return t},read_use_type:function(){return this.token===this.tok.T_FUNCTION?(this.next(),this.ast.useitem.TYPE_FUNCTION):this.token===this.tok.T_CONST?(this.next(),this.ast.useitem.TYPE_CONST):null}}},2932:t=>{const e={"\\":"\\",$:"$",n:"\n",r:"\r",t:"\t",f:String.fromCharCode(12),v:String.fromCharCode(11),e:String.fromCharCode(27)};t.exports={resolve_special_chars:function(t,s){return s?t.replace(/\\"/,'"').replace(/\\([\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}|u{([0-9a-fA-F]+)})/g,((t,s,i)=>e[s]?e[s]:"x"===s[0]||"X"===s[0]?String.fromCodePoint(parseInt(s.substr(1),16)):"u"===s[0]?String.fromCodePoint(parseInt(i,16)):String.fromCodePoint(parseInt(s,8)))):t.replace(/\\\\/g,"\\").replace(/\\'/g,"'")},remove_heredoc_leading_whitespace_chars:function(t,e,s,i){if(0===e)return t;this.check_heredoc_indentation_level(t,e,s,i);const n=s?" ":"\t",h=new RegExp(`\\n${n}{${e}}`,"g"),o=new RegExp(`^${n}{${e}}`);return i&&(t=t.replace(o,"")),t.replace(h,"\n")},check_heredoc_indentation_level:function(t,e,s,i){const n=t.length;let h=0,o=0,r=!0;const _=s?" ":"\t";let a=!1;if(!i){if(h=t.indexOf("\n"),-1===h)return;h++}for(;h<n;)r?t[h]===_?o++:a=!0:r=!1,"\n"!==t[h]&&a&&o<e?this.raiseError(`Invalid body indentation level (expecting an indentation at least ${e})`):a=!1,"\n"===t[h]&&(r=!0,o=0),h++},read_dereferencable_scalar:function(){let t=null;switch(this.token){case this.tok.T_CONSTANT_ENCAPSED_STRING:{let e=this.node("string");const s=this.text();let i=0;"b"!==s[0]&&"B"!==s[0]||(i=1);const n='"'===s[i];this.next(),e=e(n,this.resolve_special_chars(s.substring(i+1,s.length-1),n),1===i,s),t=this.token===this.tok.T_DOUBLE_COLON?this.read_static_getter(e):e}break;case this.tok.T_ARRAY:case"[":t=this.read_array()}return t},read_scalar:function(){if(this.is("T_MAGIC_CONST"))return this.get_magic_constant();{let t,e;switch(this.token){case this.tok.T_LNUMBER:case this.tok.T_DNUMBER:{const e=this.node("number");return t=this.text(),this.next(),e(t,null)}case this.tok.T_START_HEREDOC:if("ST_NOWDOC"===this.lexer.curCondition){const s=this.lexer.yylloc.first_offset;e=this.node("nowdoc"),t=this.next().text(),this.lexer.heredoc_label.indentation>0&&(t=t.substring(0,t.length-this.lexer.heredoc_label.indentation));const i=t[t.length-1];"\n"===i?t="\r"===t[t.length-2]?t.substring(0,t.length-2):t.substring(0,t.length-1):"\r"===i&&(t=t.substring(0,t.length-1)),this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE)&&this.next(),this.expect(this.tok.T_END_HEREDOC)&&this.next();const n=this.lexer._input.substring(s,this.lexer.yylloc.first_offset);return e=e(this.remove_heredoc_leading_whitespace_chars(t,this.lexer.heredoc_label.indentation,this.lexer.heredoc_label.indentation_uses_spaces,this.lexer.heredoc_label.first_encaps_node),n,this.lexer.heredoc_label.label),e}return this.read_encapsed_string(this.tok.T_END_HEREDOC);case'"':return this.read_encapsed_string('"');case'b"':case'B"':return this.read_encapsed_string('"',!0);case this.tok.T_CONSTANT_ENCAPSED_STRING:case this.tok.T_ARRAY:case"[":return this.read_dereferencable_scalar();default:{const t=this.error("SCALAR");return this.next(),t}}}},read_dereferencable:function(t){let e,s;const i=this.node("offsetlookup");return"["===this.token?(s=this.next().read_expr(),this.expect("]")&&this.next(),e=i(t,s)):this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES&&(s=this.read_encapsed_string_item(!1),e=i(t,s)),e},read_encapsed_string_item:function(t){const e=this.node("encapsedpart");let s,i,n,h=null,o=!1,r=this.node();if(this.token===this.tok.T_ENCAPSED_AND_WHITESPACE){const e=this.text();this.next(),r=r("string",!1,this.version>=703&&!this.lexer.heredoc_label.finished?this.remove_heredoc_leading_whitespace_chars(this.resolve_special_chars(e,t),this.lexer.heredoc_label.indentation,this.lexer.heredoc_label.indentation_uses_spaces,this.lexer.heredoc_label.first_encaps_node):e,!1,e)}else if(this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES){if(h="simple",o=!0,n=null,this.next().token===this.tok.T_STRING_VARNAME){n=this.node("variable");const t=this.text();this.next(),"["===this.token?(n=n(t,!1),i=this.node("offsetlookup"),s=this.next().read_expr(),this.expect("]")&&this.next(),r=i(n,s)):r=n(t,!1)}else r=r("variable",this.read_expr(),!1);this.expect("}")&&this.next()}else if(this.token===this.tok.T_CURLY_OPEN)h="complex",r.destroy(),r=this.next().read_variable(!1,!1),this.expect("}")&&this.next();else if(this.token===this.tok.T_VARIABLE){if(h="simple",r.destroy(),r=this.read_simple_variable(),"["===this.token&&(i=this.node("offsetlookup"),s=this.next().read_encaps_var_offset(),this.expect("]")&&this.next(),r=i(r,s)),this.token===this.tok.T_OBJECT_OPERATOR){i=this.node("propertylookup"),this.next().expect(this.tok.T_STRING);const t=this.node("identifier");n=this.text(),this.next(),r=i(r,t(n))}}else{this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE);const t=this.text();this.next(),r.destroy(),r=r("string",!1,t,!1,t)}return this.lexer.heredoc_label.first_encaps_node=!1,e(r,h,o)},read_encapsed_string:function(t,e=!1){const s=this.lexer.yylloc.first_offset;let i=this.node("encapsed");this.next();const n=this.lexer.yylloc.prev_offset-(e?1:0),h=[];let o=null;for(o="`"===t?this.ast.encapsed.TYPE_SHELL:'"'===t?this.ast.encapsed.TYPE_STRING:this.ast.encapsed.TYPE_HEREDOC;this.token!==t&&this.token!==this.EOF;)h.push(this.read_encapsed_string_item(!0));if(h.length>0&&"encapsedpart"===h[h.length-1].kind&&"string"===h[h.length-1].expression.kind){const t=h[h.length-1].expression,e=t.value[t.value.length-1];"\n"===e?"\r"===t.value[t.value.length-2]?t.value=t.value.substring(0,t.value.length-2):t.value=t.value.substring(0,t.value.length-1):"\r"===e&&(t.value=t.value.substring(0,t.value.length-1))}return this.expect(t)&&this.next(),i=i(h,this.lexer._input.substring("heredoc"===o?s:n-1,this.lexer.yylloc.first_offset),o),t===this.tok.T_END_HEREDOC&&(i.label=this.lexer.heredoc_label.label,this.lexer.heredoc_label.finished=!0),i},get_magic_constant:function(){const t=this.node("magic"),e=this.text();return this.next(),t(e.toUpperCase(),e)}}},3912:t=>{t.exports={read_top_statements:function(){let t=[];for(;this.token!==this.EOF&&"}"!==this.token;){const e=this.read_top_statement();e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t},read_top_statement:function(){let t=[];switch(this.token===this.tok.T_ATTRIBUTE&&(t=this.read_attr_list()),this.token){case this.tok.T_FUNCTION:return this.read_function(!1,!1,t);case this.tok.T_ABSTRACT:case this.tok.T_FINAL:case this.tok.T_CLASS:return this.read_class_declaration_statement(t);case this.tok.T_INTERFACE:return this.read_interface_declaration_statement(t);case this.tok.T_TRAIT:return this.read_trait_declaration_statement();case this.tok.T_USE:return this.read_use_statement();case this.tok.T_CONST:{const t=this.node("constantstatement"),e=this.next().read_const_list();return this.expectEndOfStatement(),t(null,e)}case this.tok.T_NAMESPACE:return this.read_namespace();case this.tok.T_HALT_COMPILER:{const t=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),this.expect(";"),this.lexer.done=!0,t(this.lexer._input.substring(this.lexer.offset))}default:return this.read_statement()}},read_inner_statements:function(){let t=[];for(;this.token!=this.EOF&&"}"!==this.token;){const e=this.read_inner_statement();e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t},read_const_list:function(){return this.read_list((function(){this.expect(this.tok.T_STRING);const t=this.node("constant");let e=this.node("identifier");const s=this.text();return this.next(),e=e(s),this.expect("=")?t(e,this.next().read_expr()):t(e,null)}),",",!1)},read_declare_list:function(){const t=[];for(;this.token!=this.EOF&&")"!==this.token;){this.expect(this.tok.T_STRING);const e=this.node("declaredirective");let s=this.node("identifier");const i=this.text();this.next(),s=s(i);let n=null;if(this.expect("=")&&(n=this.next().read_expr()),t.push(e(s,n)),","!==this.token)break;this.next()}return t},read_inner_statement:function(){let t=[];switch(this.token===this.tok.T_ATTRIBUTE&&(t=this.read_attr_list()),this.token){case this.tok.T_FUNCTION:{const e=this.read_function(!1,!1);return e.attrGroups=t,e}case this.tok.T_ABSTRACT:case this.tok.T_FINAL:case this.tok.T_CLASS:return this.read_class_declaration_statement();case this.tok.T_INTERFACE:return this.read_interface_declaration_statement();case this.tok.T_TRAIT:return this.read_trait_declaration_statement();case this.tok.T_HALT_COMPILER:{this.raiseError("__HALT_COMPILER() can only be used from the outermost scope");let t=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),t=t(this.lexer._input.substring(this.lexer.offset)),this.expect(";")&&this.next(),t}default:return this.read_statement()}},read_statement:function(){switch(this.token){case"{":return this.read_code_block(!1);case this.tok.T_IF:return this.read_if();case this.tok.T_SWITCH:return this.read_switch();case this.tok.T_FOR:return this.read_for();case this.tok.T_FOREACH:return this.read_foreach();case this.tok.T_WHILE:return this.read_while();case this.tok.T_DO:return this.read_do();case this.tok.T_COMMENT:return this.read_comment();case this.tok.T_DOC_COMMENT:return this.read_doc_comment();case this.tok.T_RETURN:{const t=this.node("return");this.next();const e=this.read_optional_expr(";");return this.expectEndOfStatement(),t(e)}case this.tok.T_BREAK:case this.tok.T_CONTINUE:{const t=this.node(this.token===this.tok.T_CONTINUE?"continue":"break");this.next();const e=this.read_optional_expr(";");return this.expectEndOfStatement(),t(e)}case this.tok.T_GLOBAL:{const t=this.node("global"),e=this.next().read_list(this.read_simple_variable,",");return this.expectEndOfStatement(),t(e)}case this.tok.T_STATIC:{const t=[this.token,this.lexer.getState()],e=this.node();if(this.next().token===this.tok.T_DOUBLE_COLON){this.lexer.tokens.push(t);const s=this.next().read_expr();return this.expectEndOfStatement(s),e("expressionstatement",s)}if(this.token===this.tok.T_FUNCTION)return this.read_function(!0,[0,1,0]);const s=this.read_variable_declarations();return this.expectEndOfStatement(),e("static",s)}case this.tok.T_ECHO:{const t=this.node("echo"),e=this.text(),s="<?="===e||"<%="===e,i=this.next().read_function_list(this.read_expr,",");return this.expectEndOfStatement(),t(i,s)}case this.tok.T_INLINE_HTML:{const t=this.text();let e=this.lexer.yylloc.first_offset>0?this.lexer._input[this.lexer.yylloc.first_offset-1]:null;const s="\r"===e||"\n"===e;s&&"\n"===e&&this.lexer.yylloc.first_offset>1&&"\r"===this.lexer._input[this.lexer.yylloc.first_offset-2]&&(e="\r\n");const i=this.node("inline");return this.next(),i(t,s?e+t:t)}case this.tok.T_UNSET:{const t=this.node("unset");this.next().expect("(")&&this.next();const e=this.read_function_list(this.read_variable,",");return this.expect(")")&&this.next(),this.expect(";")&&this.next(),t(e)}case this.tok.T_DECLARE:{const t=this.node("declare"),e=[];let s;this.next().expect("(")&&this.next();const i=this.read_declare_list();if(this.expect(")")&&this.next(),":"===this.token){for(this.next();this.token!=this.EOF&&this.token!==this.tok.T_ENDDECLARE;)e.push(this.read_top_statement());0===e.length&&this.extractDoc&&this._docs.length>this._docIndex&&e.push(this.node("noop")()),this.expect(this.tok.T_ENDDECLARE)&&this.next(),this.expectEndOfStatement(),s=this.ast.declare.MODE_SHORT}else if("{"===this.token){for(this.next();this.token!=this.EOF&&"}"!==this.token;)e.push(this.read_top_statement());0===e.length&&this.extractDoc&&this._docs.length>this._docIndex&&e.push(this.node("noop")()),this.expect("}")&&this.next(),s=this.ast.declare.MODE_BLOCK}else this.expect(";")&&this.next(),s=this.ast.declare.MODE_NONE;return t(i,e,s)}case this.tok.T_TRY:return this.read_try();case this.tok.T_THROW:{const t=this.node("throw"),e=this.next().read_expr();return this.expectEndOfStatement(),t(e)}case";":return this.next(),null;case this.tok.T_STRING:{const t=this.node(),e=[this.token,this.lexer.getState()],s=this.text();let i=this.node("identifier");if(":"===this.next().token)return i=i(s),this.next(),t("label",i);i.destroy(),t.destroy(),this.lexer.tokens.push(e);const n=this.node("expressionstatement"),h=this.next().read_expr();return this.expectEndOfStatement(h),n(h)}case this.tok.T_GOTO:{const t=this.node("goto");let e=null;if(this.next().expect(this.tok.T_STRING)){e=this.node("identifier");const t=this.text();this.next(),e=e(t),this.expectEndOfStatement()}return t(e)}default:{const t=this.node("expressionstatement"),e=this.read_expr();return this.expectEndOfStatement(e),t(e)}}},read_code_block:function(t){const e=this.node("block");this.expect("{")&&this.next();const s=t?this.read_top_statements():this.read_inner_statements();return 0===s.length&&this.extractDoc&&this._docs.length>this._docIndex&&s.push(this.node("noop")()),this.expect("}")&&this.next(),e(null,s)}}},510:t=>{t.exports={read_switch:function(){const t=this.node("switch");this.expect(this.tok.T_SWITCH)&&this.next(),this.expect("(")&&this.next();const e=this.read_expr();this.expect(")")&&this.next();const s=":"===this.token;return t(e,this.read_switch_case_list(),s)},read_switch_case_list:function(){let t=null;const e=this.node("block"),s=[];for("{"===this.token?t="}":":"===this.token?t=this.tok.T_ENDSWITCH:this.expect(["{",":"]),this.next(),";"===this.token&&this.next();this.token!==this.EOF&&this.token!==t;)s.push(this.read_case_list(t));return 0===s.length&&this.extractDoc&&this._docs.length>this._docIndex&&s.push(this.node("noop")()),this.expect(t)&&this.next(),t===this.tok.T_ENDSWITCH&&this.expectEndOfStatement(),e(null,s)},read_case_list:function(t){const e=this.node("case");let s=null;this.token===this.tok.T_CASE?s=this.next().read_expr():this.token===this.tok.T_DEFAULT?this.next():this.expect([this.tok.T_CASE,this.tok.T_DEFAULT]),this.expect([":",";"])&&this.next();const i=this.node("block"),n=[];for(;this.token!==this.EOF&&this.token!==t&&this.token!==this.tok.T_CASE&&this.token!==this.tok.T_DEFAULT;)n.push(this.read_inner_statement());return e(s,i(null,n))}}},5289:t=>{t.exports={read_try:function(){this.expect(this.tok.T_TRY);const t=this.node("try");let e=null;const s=[],i=this.next().read_statement();for(;this.token===this.tok.T_CATCH;){const t=this.node("catch");this.next().expect("(")&&this.next();const e=this.read_list(this.read_namespace_name,"|",!1);let i=null;this.token===this.tok.T_VARIABLE&&(i=this.read_variable(!0,!1)),this.expect(")"),s.push(t(this.next().read_statement(),e,i))}return this.token===this.tok.T_FINALLY&&(e=this.next().read_statement()),t(i,s,e)}}},4394:t=>{t.exports={read_short_form:function(t){const e=this.node("block"),s=[];for(this.expect(":")&&this.next();this.token!=this.EOF&&this.token!==t;)s.push(this.read_inner_statement());return 0===s.length&&this.extractDoc&&this._docs.length>this._docIndex&&s.push(this.node("noop")()),this.expect(t)&&this.next(),this.expectEndOfStatement(),e(null,s)},read_function_list:function(t,e){const s=[];do{if(this.token==e&&this.version>=703&&s.length>0){s.push(this.node("noop")());break}if(s.push(t.apply(this,[])),this.token!=e)break;if(")"==this.next().token&&this.version>=703)break}while(this.token!=this.EOF);return s},read_list:function(t,e,s){const i=[];if(this.token==e&&(s&&i.push("function"==typeof t?this.node("noop")():null),this.next()),"function"==typeof t)do{const s=t.apply(this,[]);if(s&&i.push(s),this.token!=e)break}while(this.next().token!=this.EOF);else{if(!this.expect(t))return[];for(i.push(this.text());this.next().token!=this.EOF&&this.token==e&&this.next().token==t;)i.push(this.text())}return i},read_name_list:function(){return this.read_list(this.read_namespace_name,",",!1)},read_byref:function(t){let e=this.node("byref");this.next(),e=e(null);const s=t();return s&&(this.ast.swapLocations(s,e,s,this),s.byref=!0),s},read_variable_declarations:function(){return this.read_list((function(){const t=this.node("staticvariable");let e=this.node("variable");if(this.expect(this.tok.T_VARIABLE)){const t=this.text().substring(1);this.next(),e=e(t,!1)}else e=e("#ERR",!1);return"="===this.token?t(e,this.next().read_expr()):e}),",")},read_extends_from:function(){return this.token===this.tok.T_EXTENDS?this.next().read_namespace_name():null},read_interface_extends_list:function(){return this.token===this.tok.T_EXTENDS?this.next().read_name_list():null},read_implements_list:function(){return this.token===this.tok.T_IMPLEMENTS?this.next().read_name_list():null}}},8414:t=>{t.exports={read_variable:function(t,e){let s;if("&"===this.token)return this.read_byref(this.read_variable.bind(this,t,e));if(this.is([this.tok.T_VARIABLE,"$"]))s=this.read_reference_variable(e);else if(this.is([this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_NAMESPACE])){s=this.node();const t=this.read_namespace_name();if(this.token!=this.tok.T_DOUBLE_COLON&&"("!=this.token&&-1===["parentreference","selfreference"].indexOf(t.kind)){const e=t.name.toLowerCase();"true"===e?s=t.destroy(s("boolean",!0,t.name)):"false"===e?s=t.destroy(s("boolean",!1,t.name)):"null"===e?s=t.destroy(s("nullkeyword",t.name)):(s.destroy(t),s=t)}else s.destroy(t),s=t}else if(this.token===this.tok.T_STATIC){s=this.node("staticreference");const t=this.text();this.next(),s=s(t)}else this.expect("VARIABLE");return this.token===this.tok.T_DOUBLE_COLON&&(s=this.read_static_getter(s,e)),this.recursive_variable_chain_scan(s,t,e)},read_static_getter:function(t,e){const s=this.node("staticlookup");let i,n;return this.next().is([this.tok.T_VARIABLE,"$"])?i=this.read_reference_variable(e):this.token===this.tok.T_STRING||this.token===this.tok.T_CLASS||this.version>=700&&this.is("IDENTIFIER")?(i=this.node("identifier"),n=this.text(),this.next(),i=i(n)):"{"===this.token?(i=this.node("literal"),n=this.next().read_expr(),this.expect("}")&&this.next(),i=i("literal",n,null),this.expect("(")):(this.error([this.tok.T_VARIABLE,this.tok.T_STRING]),i=this.node("identifier"),n=this.text(),this.next(),i=i(n)),s(t,i)},read_what:function(t=!1){let e=null,s=null;switch(this.next().token){case this.tok.T_STRING:e=this.node("identifier"),s=this.text(),this.next(),e=e(s),t&&this.token===this.tok.T_OBJECT_OPERATOR&&this.error();break;case this.tok.T_VARIABLE:e=this.node("variable"),s=this.text().substring(1),this.next(),e=e(s,!1);break;case"$":e=this.node(),this.next().expect(["$","{",this.tok.T_VARIABLE]),"{"===this.token?(s=this.next().read_expr(),this.expect("}")&&this.next(),e=e("variable",s,!0)):(s=this.read_expr(),e=e("variable",s,!1));break;case"{":e=this.node("encapsedpart"),s=this.next().read_expr(),this.expect("}")&&this.next(),e=e(s,"complex",!1);break;default:this.error([this.tok.T_STRING,this.tok.T_VARIABLE,"$","{"]),e=this.node("identifier"),s=this.text(),this.next(),e=e(s)}return e},recursive_variable_chain_scan:function(t,e,s){let i,n;t:for(;this.token!=this.EOF;)switch(this.token){case"(":if(e)return t;t=this.node("call")(t,this.read_argument_list());break;case"[":case"{":{const e="["===this.token;i=this.node("offsetlookup"),this.next(),n=!1,s?(n=this.read_encaps_var_offset(),this.expect(e?"]":"}")&&this.next()):(e?"]"!==this.token:"}"!==this.token)?(n=this.read_expr(),this.expect(e?"]":"}")&&this.next()):this.next(),t=i(t,n);break}case this.tok.T_DOUBLE_COLON:"staticlookup"===t.kind&&"identifier"===t.offset.kind&&this.error(),i=this.node("staticlookup"),t=i(t,this.read_what(!0));break;case this.tok.T_OBJECT_OPERATOR:i=this.node("propertylookup"),t=i(t,this.read_what());break;case this.tok.T_NULLSAFE_OBJECT_OPERATOR:i=this.node("nullsafepropertylookup"),t=i(t,this.read_what());break;default:break t}return t},read_encaps_var_offset:function(){let t=this.node();if(this.token===this.tok.T_STRING){const e=this.text();this.next(),t=t("identifier",e)}else if(this.token===this.tok.T_NUM_STRING){const e=this.text();this.next(),t=t("number",e,null)}else if("-"===this.token){this.next();const e=-1*this.text();this.expect(this.tok.T_NUM_STRING)&&this.next(),t=t("number",e,null)}else if(this.token===this.tok.T_VARIABLE){const e=this.text().substring(1);this.next(),t=t("variable",e,!1)}else{this.expect([this.tok.T_STRING,this.tok.T_NUM_STRING,"-",this.tok.T_VARIABLE]);const e=this.text();this.next(),t=t("identifier",e)}return t},read_reference_variable:function(t){let e,s=this.read_simple_variable();for(;this.token!=this.EOF;){const i=this.node();if("{"!=this.token||t){i.destroy();break}e=this.next().read_expr(),this.expect("}")&&this.next(),s=i("offsetlookup",s,e)}return s},read_simple_variable:function(){let t,e=this.node("variable");if(this.expect([this.tok.T_VARIABLE,"$"])&&this.token===this.tok.T_VARIABLE)t=this.text().substring(1),this.next(),e=e(t,!1);else switch("$"===this.token&&this.next(),this.token){case"{":{const t=this.next().read_expr();this.expect("}")&&this.next(),e=e(t,!0);break}case"$":e=e(this.read_simple_variable(),!1);break;case this.tok.T_VARIABLE:{t=this.text().substring(1);const s=this.node("variable");this.next(),e=e(s(t,!1),!1);break}default:this.error(["{","$",this.tok.T_VARIABLE]),t=this.text(),this.next(),e=e(t,!1)}return e}}},3155:t=>{t.exports={values:{101:"T_HALT_COMPILER",102:"T_USE",103:"T_ENCAPSED_AND_WHITESPACE",104:"T_OBJECT_OPERATOR",105:"T_STRING",106:"T_DOLLAR_OPEN_CURLY_BRACES",107:"T_STRING_VARNAME",108:"T_CURLY_OPEN",109:"T_NUM_STRING",110:"T_ISSET",111:"T_EMPTY",112:"T_INCLUDE",113:"T_INCLUDE_ONCE",114:"T_EVAL",115:"T_REQUIRE",116:"T_REQUIRE_ONCE",117:"T_NAMESPACE",118:"T_NS_SEPARATOR",119:"T_AS",120:"T_IF",121:"T_ENDIF",122:"T_WHILE",123:"T_DO",124:"T_FOR",125:"T_SWITCH",126:"T_BREAK",127:"T_CONTINUE",128:"T_RETURN",129:"T_GLOBAL",130:"T_STATIC",131:"T_ECHO",132:"T_INLINE_HTML",133:"T_UNSET",134:"T_FOREACH",135:"T_DECLARE",136:"T_TRY",137:"T_THROW",138:"T_GOTO",139:"T_FINALLY",140:"T_CATCH",141:"T_ENDDECLARE",142:"T_LIST",143:"T_CLONE",144:"T_PLUS_EQUAL",145:"T_MINUS_EQUAL",146:"T_MUL_EQUAL",147:"T_DIV_EQUAL",148:"T_CONCAT_EQUAL",149:"T_MOD_EQUAL",150:"T_AND_EQUAL",151:"T_OR_EQUAL",152:"T_XOR_EQUAL",153:"T_SL_EQUAL",154:"T_SR_EQUAL",155:"T_INC",156:"T_DEC",157:"T_BOOLEAN_OR",158:"T_BOOLEAN_AND",159:"T_LOGICAL_OR",160:"T_LOGICAL_AND",161:"T_LOGICAL_XOR",162:"T_SL",163:"T_SR",164:"T_IS_IDENTICAL",165:"T_IS_NOT_IDENTICAL",166:"T_IS_EQUAL",167:"T_IS_NOT_EQUAL",168:"T_IS_SMALLER_OR_EQUAL",169:"T_IS_GREATER_OR_EQUAL",170:"T_INSTANCEOF",171:"T_INT_CAST",172:"T_DOUBLE_CAST",173:"T_STRING_CAST",174:"T_ARRAY_CAST",175:"T_OBJECT_CAST",176:"T_BOOL_CAST",177:"T_UNSET_CAST",178:"T_EXIT",179:"T_PRINT",180:"T_YIELD",181:"T_YIELD_FROM",182:"T_FUNCTION",183:"T_DOUBLE_ARROW",184:"T_DOUBLE_COLON",185:"T_ARRAY",186:"T_CALLABLE",187:"T_CLASS",188:"T_ABSTRACT",189:"T_TRAIT",190:"T_FINAL",191:"T_EXTENDS",192:"T_INTERFACE",193:"T_IMPLEMENTS",194:"T_VAR",195:"T_PUBLIC",196:"T_PROTECTED",197:"T_PRIVATE",198:"T_CONST",199:"T_NEW",200:"T_INSTEADOF",201:"T_ELSEIF",202:"T_ELSE",203:"T_ENDSWITCH",204:"T_CASE",205:"T_DEFAULT",206:"T_ENDFOR",207:"T_ENDFOREACH",208:"T_ENDWHILE",209:"T_CONSTANT_ENCAPSED_STRING",210:"T_LNUMBER",211:"T_DNUMBER",212:"T_LINE",213:"T_FILE",214:"T_DIR",215:"T_TRAIT_C",216:"T_METHOD_C",217:"T_FUNC_C",218:"T_NS_C",219:"T_START_HEREDOC",220:"T_END_HEREDOC",221:"T_CLASS_C",222:"T_VARIABLE",223:"T_OPEN_TAG",224:"T_OPEN_TAG_WITH_ECHO",225:"T_CLOSE_TAG",226:"T_WHITESPACE",227:"T_COMMENT",228:"T_DOC_COMMENT",229:"T_ELLIPSIS",230:"T_COALESCE",231:"T_POW",232:"T_POW_EQUAL",233:"T_SPACESHIP",234:"T_COALESCE_EQUAL",235:"T_FN",236:"T_NULLSAFE_OBJECT_OPERATOR",237:"T_MATCH",238:"T_ATTRIBUTE"},names:{T_HALT_COMPILER:101,T_USE:102,T_ENCAPSED_AND_WHITESPACE:103,T_OBJECT_OPERATOR:104,T_STRING:105,T_DOLLAR_OPEN_CURLY_BRACES:106,T_STRING_VARNAME:107,T_CURLY_OPEN:108,T_NUM_STRING:109,T_ISSET:110,T_EMPTY:111,T_INCLUDE:112,T_INCLUDE_ONCE:113,T_EVAL:114,T_REQUIRE:115,T_REQUIRE_ONCE:116,T_NAMESPACE:117,T_NS_SEPARATOR:118,T_AS:119,T_IF:120,T_ENDIF:121,T_WHILE:122,T_DO:123,T_FOR:124,T_SWITCH:125,T_BREAK:126,T_CONTINUE:127,T_RETURN:128,T_GLOBAL:129,T_STATIC:130,T_ECHO:131,T_INLINE_HTML:132,T_UNSET:133,T_FOREACH:134,T_DECLARE:135,T_TRY:136,T_THROW:137,T_GOTO:138,T_FINALLY:139,T_CATCH:140,T_ENDDECLARE:141,T_LIST:142,T_CLONE:143,T_PLUS_EQUAL:144,T_MINUS_EQUAL:145,T_MUL_EQUAL:146,T_DIV_EQUAL:147,T_CONCAT_EQUAL:148,T_MOD_EQUAL:149,T_AND_EQUAL:150,T_OR_EQUAL:151,T_XOR_EQUAL:152,T_SL_EQUAL:153,T_SR_EQUAL:154,T_INC:155,T_DEC:156,T_BOOLEAN_OR:157,T_BOOLEAN_AND:158,T_LOGICAL_OR:159,T_LOGICAL_AND:160,T_LOGICAL_XOR:161,T_SL:162,T_SR:163,T_IS_IDENTICAL:164,T_IS_NOT_IDENTICAL:165,T_IS_EQUAL:166,T_IS_NOT_EQUAL:167,T_IS_SMALLER_OR_EQUAL:168,T_IS_GREATER_OR_EQUAL:169,T_INSTANCEOF:170,T_INT_CAST:171,T_DOUBLE_CAST:172,T_STRING_CAST:173,T_ARRAY_CAST:174,T_OBJECT_CAST:175,T_BOOL_CAST:176,T_UNSET_CAST:177,T_EXIT:178,T_PRINT:179,T_YIELD:180,T_YIELD_FROM:181,T_FUNCTION:182,T_DOUBLE_ARROW:183,T_DOUBLE_COLON:184,T_ARRAY:185,T_CALLABLE:186,T_CLASS:187,T_ABSTRACT:188,T_TRAIT:189,T_FINAL:190,T_EXTENDS:191,T_INTERFACE:192,T_IMPLEMENTS:193,T_VAR:194,T_PUBLIC:195,T_PROTECTED:196,T_PRIVATE:197,T_CONST:198,T_NEW:199,T_INSTEADOF:200,T_ELSEIF:201,T_ELSE:202,T_ENDSWITCH:203,T_CASE:204,T_DEFAULT:205,T_ENDFOR:206,T_ENDFOREACH:207,T_ENDWHILE:208,T_CONSTANT_ENCAPSED_STRING:209,T_LNUMBER:210,T_DNUMBER:211,T_LINE:212,T_FILE:213,T_DIR:214,T_TRAIT_C:215,T_METHOD_C:216,T_FUNC_C:217,T_NS_C:218,T_START_HEREDOC:219,T_END_HEREDOC:220,T_CLASS_C:221,T_VARIABLE:222,T_OPEN_TAG:223,T_OPEN_TAG_WITH_ECHO:224,T_CLOSE_TAG:225,T_WHITESPACE:226,T_COMMENT:227,T_DOC_COMMENT:228,T_ELLIPSIS:229,T_COALESCE:230,T_POW:231,T_POW_EQUAL:232,T_SPACESHIP:233,T_COALESCE_EQUAL:234,T_FN:235,T_NULLSAFE_OBJECT_OPERATOR:236,T_MATCH:237,T_ATTRIBUTE:238}}}},s={};function i(t){var n=s[t];if(void 0!==n)return n.exports;var h=s[t]={exports:{}};return e[t](h,h.exports,i),h.exports}i.m=e,t=[],i.O=(e,s,n,h)=>{if(!s){var o=1/0;for(c=0;c<t.length;c++){for(var[s,n,h]=t[c],r=!0,_=0;_<s.length;_++)(!1&h||o>=h)&&Object.keys(i.O).every((t=>i.O[t](s[_])))?s.splice(_--,1):(r=!1,h<o&&(o=h));if(r){t.splice(c--,1);var a=n();void 0!==a&&(e=a)}}return e}h=h||0;for(var c=t.length;c>0&&t[c-1][2]>h;c--)t[c]=t[c-1];t[c]=[s,n,h]},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={189:0};i.O.j=e=>0===t[e];var e=(e,s)=>{var n,h,[o,r,_]=s,a=0;if(o.some((e=>0!==t[e]))){for(n in r)i.o(r,n)&&(i.m[n]=r[n]);if(_)var c=_(i)}for(e&&e(s);a<o.length;a++)h=o[a],i.o(t,h)&&t[h]&&t[h][0](),t[h]=0;return i.O(c)},s=self.webpackChunkcode_snippets=self.webpackChunkcode_snippets||[];s.forEach(e.bind(null,0)),s.push=e.bind(null,s.push.bind(s))})();var n=i(3737);n=i.O(n)})();
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-right:3px}.nav-tab .badge,.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab-inactive[data-type=php]:hover .badge{color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab-inactive[data-type=css]:hover .badge{color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab-inactive[data-type=js]:hover .badge{color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-inactive[data-type=html]:hover .badge{color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.nav-tab.nav-tab-inactive{background:#f6f7f7;border-color:#f6f7f7;float:left;text-shadow:0 1px 0 #fff}.nav-tab.nav-tab-inactive,.nav-tab.nav-tab-inactive .badge{color:#a7aaad}.nav-tab.nav-tab-inactive:hover{color:#50575e}.go-pro-button .badge{border-color:#ce0000;color:#ce0000;margin-right:1px}.wp-core-ui .button.nav-tab-button{background:#dcdcde;border:1px solid #c3c4c7;color:#50575e;float:right;margin-right:.5em}.wp-core-ui .button.nav-tab-button:hover{background-color:#fff;color:#3c434a}.column-name .dashicons{font-size:16px;height:16px;vertical-align:middle;width:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;box-shadow:none;color:#666;text-align:center;width:4em}.column-priority input:active,.column-priority input:focus,.column-priority input:hover{background-color:#f5f5f5;background-color:rgba(0,0,0,.1);border-radius:6px;color:#000}.column-priority input:disabled{color:inherit}.snippet-activation-switch,.snippet-execution-button{display:block;position:relative}.snippet-activation-switch{background-color:#ccc;border-radius:34px;height:17px;margin-top:5px;width:30px}.snippet-activation-switch:before{background-color:#fff;border-radius:50%;content:"";display:inline-block;height:13px;margin:2px;transition:all .4s;width:13px}.snippet-activation-switch:hover:before{transform:translateX(-40%)}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch:before{transform:translateX(-100%)}.snippets .active-snippet .snippet-activation-switch:hover:before{transform:translateX(-60%)}.snippets .erroneous-snippet .snippet-activation-switch:before{color:#bbb;content:"!";font-weight:700;line-height:1;text-align:center;transform:translateX(-50%)}.snippet-execution-button{border-bottom:9px solid transparent;border-right:10px solid #ccc;border-top:9px solid transparent;height:0;margin-right:10px;margin-top:9px;transition:all .3s;width:0}.snippet-execution-button:before{border:1.8px solid #ccc;border-radius:50%;bottom:-14px;content:"";right:-21px;position:absolute;left:-8px;top:-14px;transition:all .3s;z-index:2}.snippet-execution-button:focus,.snippet-execution-button:hover{border-right-color:#579}.snippet-execution-button:focus:before,.snippet-execution-button:hover:before{border-color:#579;transform:scale(1.1)}.clear-filters{vertical-align:baseline!important}.snippets tr{background:#fff}.snippets ol,.snippets ul{margin:0 1.5em 1.5em 0}.snippets ul{list-style:disc}.snippets th.sortable a,.snippets th.sorted a{display:flex;flex-direction:row}.snippets .row-actions{color:#ddd;right:0;position:relative}.snippets .column-activate{padding-left:0!important}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th.check-column{padding:13px 3px 0 0}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-right:5px}.snippets td.column-description{max-width:700px}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{border:none;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);padding:10px 9px}.snippets .badge{background-color:#e0e0e0;background-color:rgba(0,0,0,.08);border:none;border-radius:2px;font-size:smaller;line-height:1.2;margin-right:4px;padding:3px 6px;text-decoration:none}.rtl .snippets .badge{float:right}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}.inactive-snippet a{color:#579}.inactive-snippet a:active,.inactive-snippet a:focus,.inactive-snippet a:hover{color:#819db9}.active-snippet td,.active-snippet th{background-color:rgba(120,200,230,.06)}.active-snippet th.check-column{border-right:2px solid #2ea2cc}.active-snippet .snippet-activation-switch{background-color:#2196f3}.css-snippet a{color:#b452cd}.css-snippet a:active,.css-snippet a:focus,.css-snippet a:hover{color:#ce8dde}.css-snippet.active-snippet a{color:#7d26cd}.css-snippet.active-snippet a:active,.css-snippet.active-snippet a:focus,.css-snippet.active-snippet a:hover{color:#a25ee1}.css-snippet.active-snippet td,.css-snippet.active-snippet th{background-color:rgba(85,26,139,.06)}.css-snippet.active-snippet .snippet-activation-switch{background-color:#8000ff}.css-snippet.active-snippet th.check-column{border-right-color:#8000ff}.html-snippet a{color:#548b54}.html-snippet a:active,.html-snippet a:focus,.html-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet a{color:#548b54}.html-snippet.active-snippet a:active,.html-snippet.active-snippet a:focus,.html-snippet.active-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet td,.html-snippet.active-snippet th{background-color:rgba(84,139,84,.06)}.html-snippet.active-snippet .snippet-activation-switch{background-color:#548b54}.html-snippet.active-snippet th.check-column{border-right-color:#548b54}.js-snippet a{color:#cd6600}.js-snippet a:active,.js-snippet a:focus,.js-snippet a:hover{color:#ff8c1b}.js-snippet.active-snippet a{color:#d44500}.js-snippet.active-snippet a:active,.js-snippet.active-snippet a:focus,.js-snippet.active-snippet a:hover{color:#ff6a22}.js-snippet.active-snippet td,.js-snippet.active-snippet th{background-color:rgba(205,102,0,.06)}.js-snippet.active-snippet .snippet-activation-switch{background-color:#cd6600}.js-snippet.active-snippet th.check-column{border-right-color:#cd6600}@media screen and (max-width:782px){p.search-box{float:right;height:auto;margin:1em 0 0;position:static}}.wp-list-table .is-expanded td.column-activate.activate{display:table-cell!important}.nav-tab-wrapper+.subsubsub,p.search-box{margin:10px 0 0}.snippet-type-description{border-bottom:1px solid #ccc;margin:0;padding:1em 0}.code-snippets-notice a.notice-dismiss{text-decoration:none}
|
2 |
+
|
3 |
+
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-left:3px}.nav-tab .badge,.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab-inactive[data-type=php]:hover .badge{color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab-inactive[data-type=css]:hover .badge{color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab-inactive[data-type=js]:hover .badge{color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-inactive[data-type=html]:hover .badge{color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.nav-tab.nav-tab-inactive{background:#f6f7f7;border-color:#f6f7f7;float:right;text-shadow:0 1px 0 #fff}.nav-tab.nav-tab-inactive,.nav-tab.nav-tab-inactive .badge{color:#a7aaad}.nav-tab.nav-tab-inactive:hover{color:#50575e}.go-pro-button .badge{border-color:#ce0000;color:#ce0000;margin-left:1px}.wp-core-ui .button.nav-tab-button{background:#dcdcde;border:1px solid #c3c4c7;color:#50575e;float:left;margin-left:.5em}.wp-core-ui .button.nav-tab-button:hover{background-color:#fff;color:#3c434a}.column-name .dashicons{font-size:16px;height:16px;vertical-align:middle;width:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;box-shadow:none;color:#666;text-align:center;width:4em}.column-priority input:active,.column-priority input:focus,.column-priority input:hover{background-color:#f5f5f5;background-color:rgba(0,0,0,.1);border-radius:6px;color:#000}.column-priority input:disabled{color:inherit}.snippet-activation-switch,.snippet-execution-button{display:block;position:relative}.snippet-activation-switch{background-color:#ccc;border-radius:34px;height:17px;margin-top:5px;width:30px}.snippet-activation-switch:before{background-color:#fff;border-radius:50%;content:"";display:inline-block;height:13px;margin:2px;transition:all .4s;width:13px}.snippet-activation-switch:hover:before{transform:translateX(40%)}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch:before{transform:translateX(100%)}.snippets .active-snippet .snippet-activation-switch:hover:before{transform:translateX(60%)}.snippets .erroneous-snippet .snippet-activation-switch:before{color:#bbb;content:"!";font-weight:700;line-height:1;text-align:center;transform:translateX(50%)}.snippet-execution-button{border-bottom:9px solid transparent;border-left:10px solid #ccc;border-top:9px solid transparent;height:0;margin-left:10px;margin-top:9px;transition:all .3s;width:0}.snippet-execution-button:before{border:1.8px solid #ccc;border-radius:50%;bottom:-14px;content:"";left:-21px;position:absolute;right:-8px;top:-14px;transition:all .3s;z-index:2}.snippet-execution-button:focus,.snippet-execution-button:hover{border-left-color:#579}.snippet-execution-button:focus:before,.snippet-execution-button:hover:before{border-color:#579;transform:scale(1.1)}.clear-filters{vertical-align:baseline!important}.snippets tr{background:#fff}.snippets ol,.snippets ul{margin:0 0 1.5em 1.5em}.snippets ul{list-style:disc}.snippets th.sortable a,.snippets th.sorted a{display:flex;flex-direction:row}.snippets .row-actions{color:#ddd;left:0;position:relative}.snippets .column-activate{padding-right:0!important}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets td.column-description{max-width:700px}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{border:none;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);padding:10px 9px}.snippets .badge{background-color:#e0e0e0;background-color:rgba(0,0,0,.08);border:none;border-radius:2px;font-size:smaller;line-height:1.2;margin-left:4px;padding:3px 6px;text-decoration:none}.rtl .snippets .badge{float:left}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}.inactive-snippet a{color:#579}.inactive-snippet a:active,.inactive-snippet a:focus,.inactive-snippet a:hover{color:#819db9}.active-snippet td,.active-snippet th{background-color:rgba(120,200,230,.06)}.active-snippet th.check-column{border-left:2px solid #2ea2cc}.active-snippet .snippet-activation-switch{background-color:#2196f3}.css-snippet a{color:#b452cd}.css-snippet a:active,.css-snippet a:focus,.css-snippet a:hover{color:#ce8dde}.css-snippet.active-snippet a{color:#7d26cd}.css-snippet.active-snippet a:active,.css-snippet.active-snippet a:focus,.css-snippet.active-snippet a:hover{color:#a25ee1}.css-snippet.active-snippet td,.css-snippet.active-snippet th{background-color:rgba(85,26,139,.06)}.css-snippet.active-snippet .snippet-activation-switch{background-color:#8000ff}.css-snippet.active-snippet th.check-column{border-left-color:#8000ff}.html-snippet a{color:#548b54}.html-snippet a:active,.html-snippet a:focus,.html-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet a{color:#548b54}.html-snippet.active-snippet a:active,.html-snippet.active-snippet a:focus,.html-snippet.active-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet td,.html-snippet.active-snippet th{background-color:rgba(84,139,84,.06)}.html-snippet.active-snippet .snippet-activation-switch{background-color:#548b54}.html-snippet.active-snippet th.check-column{border-left-color:#548b54}.js-snippet a{color:#cd6600}.js-snippet a:active,.js-snippet a:focus,.js-snippet a:hover{color:#ff8c1b}.js-snippet.active-snippet a{color:#d44500}.js-snippet.active-snippet a:active,.js-snippet.active-snippet a:focus,.js-snippet.active-snippet a:hover{color:#ff6a22}.js-snippet.active-snippet td,.js-snippet.active-snippet th{background-color:rgba(205,102,0,.06)}.js-snippet.active-snippet .snippet-activation-switch{background-color:#cd6600}.js-snippet.active-snippet th.check-column{border-left-color:#cd6600}@media screen and (max-width:782px){p.search-box{float:left;height:auto;margin:1em 0 0;position:static}}.wp-list-table .is-expanded td.column-activate.activate{display:table-cell!important}.nav-tab-wrapper+.subsubsub,p.search-box{margin:10px 0 0}.snippet-type-description{border-bottom:1px solid #ccc;margin:0;padding:1em 0}.code-snippets-notice a.notice-dismiss{text-decoration:none}
|
2 |
+
|
@@ -0,0 +1 @@
|
|
|
1 |
+
(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},e(t,n)}function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&e(t,n)}var r=function(t,e,n,r){var o,i,a,c,u=document.getElementById("code_snippets_ajax_nonce"),l=e.querySelector(".column-id");u&&null!=l&&l.textContent&&parseInt(l.textContent,10)&&(n.id=parseInt(l.textContent,10),n.shared_network=Boolean(e.className.match(/\bshared-network-snippet\b/)),n.network=n.shared_network||"-network"===window.pagenow.substring(window.pagenow.length-"-network".length),n.scope=null!==(o=e.getAttribute("data-snippet-scope"))&&void 0!==o?o:n.scope,i="action=update_code_snippet&_ajax_nonce=".concat(u.value,"&field=").concat(t,"&snippet=").concat(JSON.stringify(n)),a=r,(c=new XMLHttpRequest).open("POST",window.ajaxurl,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded charset=UTF-8"),c.onload=function(){200>c.status||400<=c.status||(console.info(c.responseText),null==a||a(JSON.parse(c.responseText)))},c.send(i))};function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(){i=function(t,e){return new a(t,void 0,e)};var r=RegExp.prototype,o=new WeakMap;function a(t,n,r){var i=new RegExp(t,n);return o.set(i,r||o.get(t)),e(i,a.prototype)}function c(t,e){var n=o.get(e);return Object.keys(n).reduce((function(e,r){return e[r]=t[n[r]],e}),Object.create(null))}return n(a,RegExp),a.prototype.exec=function(t){var e=r.exec.call(this,t);return e&&(e.groups=c(e,this)),e},a.prototype[Symbol.replace]=function(e,n){if("string"==typeof n){var i=o.get(this);return r[Symbol.replace].call(this,e,n.replace(/\$<([^>]+)>/g,(function(t,e){return"$"+i[e]})))}if("function"==typeof n){var a=this;return r[Symbol.replace].call(this,e,(function(){var e=arguments;return"object"!=t(e[e.length-1])&&(e=[].slice.call(e)).push(c(e,a)),n.apply(this,e)}))}return r[Symbol.replace].call(this,e,n)},i.apply(this,arguments)}var a=function(t,e){if(null!=t&&t.textContent){var n=parseInt(t.textContent.replace(i(/\((\d+)\)/,{count:1}),"$1"),10);n+=e?1:-1,t.textContent="(".concat(n,")")}else console.error("Could not update view count.",t)};function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}!function(){var t,e=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw a}}}}(document.getElementsByClassName("snippet-activation-switch"));try{var n=function(){var e=t.value;e.addEventListener("click",(function(t){return function(t,e){var n,o=window.code_snippets_manage_i18n,i=null==t||null===(n=t.parentElement)||void 0===n?void 0:n.parentElement;if(i){var c=i.className.match(/\b(?:in)?active-snippet\b/);if(c){e.preventDefault();var u="inactive-snippet"===c[0];r("active",i,{active:u},(function(t){var e=i.querySelector(".snippet-activation-switch");if(t.success){i.className=u?i.className.replace(/\binactive-snippet\b/,"active-snippet"):i.className.replace(/\bactive-snippet\b/,"inactive-snippet");var n=document.querySelector(".subsubsub"),r=null==n?void 0:n.querySelector(".active .count"),c=null==n?void 0:n.querySelector(".inactive .count");r&&a(r,u),c&&a(c,u),e.title=u?o.deactivate:o.activate}else i.className+=" erroneous-snippet",e.title=o.activation_error}))}}else console.error("Could not toggle snippet active status.",i)}(e,t)}))};for(e.s();!(t=e.n()).done;)n()}catch(t){e.e(t)}finally{e.f()}}(),function(){var t,e=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(document.getElementsByClassName("snippet-priority"));try{var n=function(){var e=t.value;e.addEventListener("input",(function(){return o=null===(n=(t=e).parentElement)||void 0===n?void 0:n.parentElement,i={priority:parseFloat(t.value)},void(o?r("priority",o,i):console.error("Could not update snippet information.",i,o));var t,n,o,i})),e.disabled=!1};for(e.s();!(t=e.n()).done;)n()}catch(t){e.e(t)}finally{e.f()}}()})();
|
@@ -0,0 +1 @@
|
|
|
1 |
+
(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const t=window.tinymce;var n=function(e){return Object.keys(e).map((function(t){return{text:e[Number(t)],value:t}}))},o=function(e,t){return{text:t.getLang("code_snippets.insert_source_menu"),onclick:function(){e.windowManager.open({title:t.getLang("code_snippets.insert_source_title"),body:[{type:"listbox",name:"id",label:t.getLang("code_snippets.snippet_label"),values:n(t.getLang("code_snippets.all_snippets"))},{type:"checkbox",name:"line_numbers",label:t.getLang("code_snippets.show_line_numbers_label")}],onsubmit:function(t){var n=parseInt(t.data.id,10);if(n){var o="";t.data.line_numbers&&(o+=" line_numbers=true"),e.insertContent("[code_snippet_source id=".concat(n).concat(o,"]"))}}},{})}}},r=function(t,o){return{text:o.getLang("code_snippets.insert_content_menu"),onclick:function(){t.windowManager.open({title:o.getLang("code_snippets.insert_content_title"),body:[{type:"listbox",name:"id",label:o.getLang("code_snippets.snippet_label"),values:n(o.getLang("code_snippets.content_snippets"))},{type:"checkbox",name:"php",label:o.getLang("code_snippets.php_att_label")},{type:"checkbox",name:"format",label:o.getLang("code_snippets.format_att_label")},{type:"checkbox",name:"shortcodes",label:o.getLang("code_snippets.shortcodes_att_label")}],onsubmit:function(n){var o,r,a=parseInt(n.data.id,10);if(a){for(var i="",c=0,s=Object.entries(n.data);c<s.length;c++){var l=(o=s[c],r=2,function(e){if(Array.isArray(e))return e}(o)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw r}}return a}}(o,r)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(o,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=l[0],u=l[1];"id"!==p&&u&&(i+=" ".concat(p,"=").concat(u))}t.insertContent("[code_snippet id=".concat(a).concat(i,"]"))}}},{})}}};t.PluginManager.add("code_snippets",(function(e){var n=t.activeEditor;e.addButton("code_snippets",{icon:"code",menu:[o(e,n),r(e,n)],type:"menubutton"})}))})();
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
code[class*=language-],pre[class*=language-]{word-wrap:normal;background:none;color:#000;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;-webkit-hyphens:none;hyphens:none;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px #fff;white-space:pre;word-break:normal;word-spacing:normal}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{background:#b3d4fc;text-shadow:none}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{background:#b3d4fc;text-shadow:none}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{margin:.5em 0;overflow:auto;padding:1em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{border-radius:.3em;padding:.1em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{background:hsla(0,0%,100%,.5);color:#9a6e3a}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}pre[data-line]{padding:1em 0 1em 3em;position:relative}.line-highlight{background:hsla(24,20%,50%,.08);background:linear-gradient(90deg,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));left:0;line-height:inherit;margin-top:1em;padding-bottom:inherit;padding-left:0;padding-right:0;padding-top:inherit;pointer-events:none;position:absolute;right:0;white-space:pre}@media print{.line-highlight{color-adjust:exact;-webkit-print-color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{background-color:hsla(24,20%,50%,.4);border-radius:999px;box-shadow:0 1px #fff;color:#f5f2f0;content:attr(data-start);font:700 65%/1.5 sans-serif;left:.6em;min-width:1em;padding:0 .5em;position:absolute;text-align:center;text-shadow:none;top:.4em;vertical-align:.3em}.line-highlight[data-end]:after{bottom:.4em;content:attr(data-end);top:auto}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:hsla(0,0%,50%,.2)}pre[class*=language-].line-numbers{counter-reset:linenumber;padding-left:3.8em;position:relative}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{border-right:1px solid #999;font-size:100%;left:-3.8em;letter-spacing:-1px;pointer-events:none;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:3em}.line-numbers-rows>span{counter-increment:linenumber;display:block}.line-numbers-rows>span:before{color:#999;content:counter(linenumber);display:block;padding-right:.8em;text-align:right}div.code-toolbar{position:relative}div.code-toolbar>.toolbar{opacity:0;position:absolute;right:.2em;top:.3em;transition:opacity .3s ease-in-out;z-index:10}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:none;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{background:#f5f2f0;background:hsla(0,0%,88%,.2);border-radius:.5em;box-shadow:0 2px 0 0 rgba(0,0,0,.2);color:#bbb;font-size:.8em;padding:0 .5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}span.inline-color-wrapper{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9ImdyYXkiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTAgMGgxdjFIMHptMSAxaDF2MUgxeiIvPjwvc3ZnPg==");background-position:50%;background-size:110%;border:1px solid #fff;box-sizing:border-box;display:inline-block;height:1.333ch;margin:0 .333ch;outline:1px solid rgba(0,0,0,.5);overflow:hidden;width:1.333ch}span.inline-color{display:block;height:120%;width:120%}.prism-previewer,.prism-previewer:after,.prism-previewer:before{pointer-events:none;position:absolute}.prism-previewer,.prism-previewer:after{left:50%}.prism-previewer{height:32px;margin-left:-16px;margin-top:-48px;opacity:0;transition:opacity .25s;width:32px;z-index:10}.prism-previewer.flipped{margin-bottom:-48px;margin-top:0}.prism-previewer:after,.prism-previewer:before{content:"";pointer-events:none;position:absolute}.prism-previewer:before{border:5px solid #fff;border-radius:10px;bottom:-5px;box-shadow:inset 0 0 3px rgba(0,0,0,.5),0 0 10px rgba(0,0,0,.75);left:-5px;right:-5px;top:-5px}.prism-previewer:after{border:7px solid rgba(255,0,0,0);border-top-color:#fff;height:0;margin:5px 0 0 -7px;top:100%;width:0}.prism-previewer.flipped:after{border-bottom-color:#fff;border-top-color:rgba(255,0,0,0);bottom:100%;margin-bottom:5px;margin-top:0;top:auto}.prism-previewer.active{opacity:1}.prism-previewer-angle:before{background:#fff;border-radius:50%}.prism-previewer-angle:after{margin-top:4px}.prism-previewer-angle svg{height:32px;transform:rotate(-90deg);width:32px}.prism-previewer-angle[data-negative] svg{transform:scaleX(-1) rotate(-90deg)}.prism-previewer-angle circle{fill:transparent;stroke:#2e3538;stroke-opacity:.9;stroke-width:32;stroke-dasharray:0,500}.prism-previewer-gradient{background-image:linear-gradient(45deg,#bbb 25%,transparent 0,transparent 75%,#bbb 0,#bbb),linear-gradient(45deg,#bbb 25%,#eee 0,#eee 75%,#bbb 0,#bbb);background-position:0 0,5px 5px;background-size:10px 10px;margin-left:-32px;width:64px}.prism-previewer-gradient:before{content:none}.prism-previewer-gradient div{border:5px solid #fff;border-radius:10px;bottom:-5px;box-shadow:inset 0 0 3px rgba(0,0,0,.5),0 0 10px rgba(0,0,0,.75);left:-5px;position:absolute;right:-5px;top:-5px}.prism-previewer-color{background-image:linear-gradient(45deg,#bbb 25%,transparent 0,transparent 75%,#bbb 0,#bbb),linear-gradient(45deg,#bbb 25%,#eee 0,#eee 75%,#bbb 0,#bbb);background-position:0 0,5px 5px;background-size:10px 10px}.prism-previewer-color:before{background-clip:padding-box;background-color:inherit}.prism-previewer-easing{background:#333;height:60px;margin-left:-30px;margin-top:-76px;width:60px}.prism-previewer-easing.flipped{margin-bottom:-116px}.prism-previewer-easing svg{height:60px;width:60px}.prism-previewer-easing circle{fill:#2e3538;stroke:#fff}.prism-previewer-easing path{fill:none;stroke:#fff;stroke-linecap:round;stroke-width:4}.prism-previewer-easing line{stroke:#fff;stroke-opacity:.5;stroke-width:2}@-webkit-keyframes prism-previewer-time{0%{stroke-dasharray:0,500;stroke-dashoffset:0}50%{stroke-dasharray:100,500;stroke-dashoffset:0}to{stroke-dasharray:0,500;stroke-dashoffset:-100}}@keyframes prism-previewer-time{0%{stroke-dasharray:0,500;stroke-dashoffset:0}50%{stroke-dasharray:100,500;stroke-dashoffset:0}to{stroke-dasharray:0,500;stroke-dashoffset:-100}}.prism-previewer-time:before{background:#fff;border-radius:50%}.prism-previewer-time:after{margin-top:4px}.prism-previewer-time svg{height:32px;transform:rotate(-90deg);width:32px}.prism-previewer-time circle{fill:transparent;stroke:#2e3538;stroke-opacity:.9;stroke-width:32;stroke-dasharray:0,500;stroke-dashoffset:0;-webkit-animation:prism-previewer-time 3s linear infinite;animation:prism-previewer-time 3s linear infinite}.token a{color:inherit}:not(.is-style-prism-shades-of-purple) pre[class*=language-].line-numbers .line-highlight{box-sizing:border-box;margin:1em 0 0;padding:0}.is-style-prism-coy-without-shadows pre[class*=language-] .line-highlight{margin-top:0}
|
2 |
+
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/*! For license information please see prism.js.LICENSE.txt */
|
2 |
+
(()=>{var e={5433:()=>{Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}},8325:(e,t,n)=>{var a=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,a={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof r?new r(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var a,r;switch(n=n||{},i.util.type(t)){case"Object":if(r=i.util.objId(t),n[r])return n[r];for(var s in a={},n[r]=a,t)t.hasOwnProperty(s)&&(a[s]=e(t[s],n));return a;case"Array":return r=i.util.objId(t),n[r]?n[r]:(a=[],n[r]=a,t.forEach((function(t,i){a[i]=e(t,n)})),a);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(a){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(a.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var a="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(a))return!1;e=e.parentElement}return!!n}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var r=(a=a||i.languages)[e],s={};for(var o in r)if(r.hasOwnProperty(o)){if(o==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(o)||(s[o]=r[o])}var u=a[e];return a[e]=s,i.languages.DFS(i.languages,(function(t,n){n===u&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,a,r){r=r||{};var s=i.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],a||o);var l=t[o],u=i.util.type(l);"Object"!==u||r[s(l)]?"Array"!==u||r[s(l)]||(r[s(l)]=!0,e(l,n,o,r)):(r[s(l)]=!0,e(l,n,null,r))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),i.hooks.run("before-all-elements-highlight",a);for(var r,s=0;r=a.elements[s++];)i.highlightElement(r,!0===t,a.callback)},highlightElement:function(t,n,a){var r=i.util.getLanguage(t),s=i.languages[r];i.util.setLanguage(t,r);var o=t.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&i.util.setLanguage(o,r);var l={element:t,language:r,grammar:s,code:t.textContent};function u(e){l.highlightedCode=e,i.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,i.hooks.run("after-highlight",l),i.hooks.run("complete",l),a&&a.call(l.element)}if(i.hooks.run("before-sanity-check",l),(o=l.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!l.code)return i.hooks.run("complete",l),void(a&&a.call(l.element));if(i.hooks.run("before-highlight",l),l.grammar)if(n&&e.Worker){var c=new Worker(i.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else u(i.highlight(l.code,l.grammar,l.language));else u(i.util.encode(l.code))},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(i.hooks.run("before-tokenize",a),!a.grammar)throw new Error('The language "'+a.language+'" has no grammar.');return a.tokens=i.tokenize(a.code,a.grammar),i.hooks.run("after-tokenize",a),r.stringify(i.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest}var i=new l;return u(i,i.head,e),o(e,i,t,i.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}},Token:r};function r(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function s(e,t,n,a){e.lastIndex=t;var i=e.exec(n);if(i&&a&&i[1]){var r=i[1].length;i.index+=r,i[0]=i[0].slice(r)}return i}function o(e,t,n,a,l,d){for(var g in n)if(n.hasOwnProperty(g)&&n[g]){var p=n[g];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==g+","+m)return;var f=p[m],h=f.inside,b=!!f.lookbehind,y=!!f.greedy,v=f.alias;if(y&&!f.pattern.global){var k=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,k+"g")}for(var P=f.pattern||f,w=a.next,x=l;w!==t.tail&&!(d&&x>=d.reach);x+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof r)){var S,L=1;if(y){if(!(S=s(P,x,e,b))||S.index>=e.length)break;var F=S.index,C=S.index+S[0].length,_=x;for(_+=w.value.length;F>=_;)_+=(w=w.next).value.length;if(x=_-=w.value.length,w.value instanceof r)continue;for(var E=w;E!==t.tail&&(_<C||"string"==typeof E.value);E=E.next)L++,_+=E.value.length;L--,A=e.slice(x,_),S.index-=x}else if(!(S=s(P,0,A,b)))continue;F=S.index;var T=S[0],z=A.slice(0,F),$=A.slice(F+T.length),j=x+A.length;d&&j>d.reach&&(d.reach=j);var O=w.prev;if(z&&(O=u(t,O,z),x+=z.length),c(t,O,L),w=u(t,O,new r(g,h?i.tokenize(T,h):T,v,T)),$&&u(t,w,$),L>1){var N={cause:g+","+m,reach:j};o(e,t,n,w.prev,x,N),d&&N.reach>d.reach&&(d.reach=N.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function u(e,t,n){var a=t.next,i={value:n,prev:t,next:a};return t.next=i,a.prev=i,e.length++,i}function c(e,t,n){for(var a=t.next,i=0;i<n&&a!==e.tail;i++)a=a.next;t.next=a,a.prev=t,e.length-=i}if(e.Prism=i,r.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n)})),a}var r={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(r.classes,s):r.classes.push(s)),i.hooks.run("wrap",r);var o="";for(var l in r.attributes)o+=" "+l+'="'+(r.attributes[l]||"").replace(/"/g,""")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+o+">"+r.content+"</"+r.tag+">"},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,r=n.code,s=n.immediateClose;e.postMessage(i.highlight(r,i.languages[a],a)),s&&e.close()}),!1),i):i;var d=i.util.currentScript();function g(){i.manual||i.highlightAll()}if(d&&(i.filename=d.src,d.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var p=document.readyState;"loading"===p||"interactive"===p&&d&&d.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=a),void 0!==n.g&&(n.g.Prism=a)},5251:()=>{!function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(Prism)},9980:()=>{Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript},6854:()=>{!function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,a,i,r){if(n.language===a){var s=n.tokenStack=[];n.code=n.code.replace(i,(function(e){if("function"==typeof r&&!r(e))return e;for(var i,o=s.length;-1!==n.code.indexOf(i=t(a,o));)++o;return s[o]=e,i})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,a){if(n.language===a&&n.tokenStack){n.grammar=e.languages[a];var i=0,r=Object.keys(n.tokenStack);!function s(o){for(var l=0;l<o.length&&!(i>=r.length);l++){var u=o[l];if("string"==typeof u||u.content&&"string"==typeof u.content){var c=r[i],d=n.tokenStack[c],g="string"==typeof u?u:u.content,p=t(a,c),m=g.indexOf(p);if(m>-1){++i;var f=g.substring(0,m),h=new e.Token(a,e.tokenize(d,n.grammar),"language-"+a,d),b=g.substring(m+p.length),y=[];f&&y.push.apply(y,s([f])),y.push(h),b&&y.push.apply(y,s([b])),"string"==typeof u?o.splice.apply(o,[l,1].concat(y)):u.content=y}}else u.content&&s(u.content)}return o}(n.tokens)}}}})}(Prism)},4335:()=>{Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};a["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:a},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml},9425:()=>{Prism.languages.insertBefore("php","variable",{this:{pattern:/\$this\b/,alias:"keyword"},global:/\$(?:GLOBALS|HTTP_RAW_POST_DATA|_(?:COOKIE|ENV|FILES|GET|POST|REQUEST|SERVER|SESSION)|argc|argv|http_response_header|php_errormsg)\b/,scope:{pattern:/\b[\w\\]+::/,inside:{keyword:/\b(?:parent|self|static)\b/,punctuation:/::|\\/}}})},9945:()=>{!function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,r=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:i,punctuation:r};var s={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},o=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:s}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:s}}];e.languages.insertBefore("php","variable",{string:o,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:o,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:a,operator:i,punctuation:r}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",(function(t){/<\?/.test(t.code)&&e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")}))}(Prism)},2317:()=>{!function(){if("undefined"!=typeof Prism){var e=/\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&!$'()*,;@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/,t=/\b\S+@[\w.]+[a-z]{2}/,n=/\[([^\]]+)\]\(([^)]+)\)/,a=["comment","url","attr-value","string"];Prism.plugins.autolinker={processGrammar:function(i){i&&!i["url-link"]&&(Prism.languages.DFS(i,(function(i,r,s){a.indexOf(s)>-1&&!Array.isArray(r)&&(r.pattern||(r=this[i]={pattern:r}),r.inside=r.inside||{},"comment"==s&&(r.inside["md-link"]=n),"attr-value"==s?Prism.languages.insertBefore("inside","punctuation",{"url-link":e},r):r.inside["url-link"]=e,r.inside["email-link"]=t)})),i["url-link"]=e,i["email-link"]=t)}},Prism.hooks.add("before-highlight",(function(e){Prism.plugins.autolinker.processGrammar(e.grammar)})),Prism.hooks.add("wrap",(function(e){if(/-link$/.test(e.type)){e.tag="a";var t=e.content;if("email-link"==e.type&&0!=t.indexOf("mailto:"))t="mailto:"+t;else if("md-link"==e.type){var a=e.content.match(n);t=a[2],e.content=a[1]}e.attributes.href=t;try{e.content=decodeURIComponent(e.content)}catch(e){}}}))}}()},6263:()=>{!function(){function e(e){var t=document.createElement("textarea");t.value=e.getText(),t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{var n=document.execCommand("copy");setTimeout((function(){n?e.success():e.error()}),1)}catch(t){setTimeout((function(){e.error(t)}),1)}document.body.removeChild(t)}"undefined"!=typeof Prism&&"undefined"!=typeof document&&(Prism.plugins.toolbar?Prism.plugins.toolbar.registerButton("copy-to-clipboard",(function(t){var n=t.element,a=function(e){var t={copy:"Copy","copy-error":"Press Ctrl+C to copy","copy-success":"Copied!","copy-timeout":5e3};for(var n in t){for(var a="data-prismjs-"+n,i=e;i&&!i.hasAttribute(a);)i=i.parentElement;i&&(t[n]=i.getAttribute(a))}return t}(n),i=document.createElement("button");i.className="copy-to-clipboard-button",i.setAttribute("type","button");var r=document.createElement("span");return i.appendChild(r),o("copy"),function(t,n){t.addEventListener("click",(function(){!function(t){navigator.clipboard?navigator.clipboard.writeText(t.getText()).then(t.success,(function(){e(t)})):e(t)}(n)}))}(i,{getText:function(){return n.textContent},success:function(){o("copy-success"),s()},error:function(){o("copy-error"),setTimeout((function(){!function(e){window.getSelection().selectAllChildren(e)}(n)}),1),s()}}),i;function s(){setTimeout((function(){o("copy")}),a["copy-timeout"])}function o(e){r.textContent=a[e],i.setAttribute("data-copy-state",e)}})):console.warn("Copy to Clipboard plugin loaded before Toolbar plugin."))}()},5088:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/g,t=/^#?((?:[\da-f]){3,4}|(?:[\da-f]{2}){3,4})$/i,n=[function(e){var n=t.exec(e);if(n){for(var a=(e=n[1]).length>=6?2:1,i=e.length/a,r=1==a?1/15:1/255,s=[],o=0;o<i;o++){var l=parseInt(e.substr(o*a,a),16);s.push(l*r)}return 3==i&&s.push(1),"rgba("+s.slice(0,3).map((function(e){return String(Math.round(255*e))})).join(",")+","+String(Number(s[3].toFixed(3)))+")"}},function(e){var t=(new Option).style;return t.color=e,t.color?e:void 0}];Prism.hooks.add("wrap",(function(t){if("color"===t.type||t.classes.indexOf("color")>=0){for(var a,i=t.content,r=i.split(e).join(""),s=0,o=n.length;s<o&&!a;s++)a=n[s](r);if(!a)return;var l='<span class="inline-color-wrapper"><span class="inline-color" style="background-color:'+a+';"></span></span>';t.content=l+i}}))}}()},8921:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",n="linkable-line-numbers",a=!0;Prism.plugins.lineHighlight={highlightLines:function(i,l,u){var c=(l="string"==typeof l?l:i.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),d=+i.getAttribute("data-line-offset")||0,g=(function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML=" <br /> ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(i).lineHeight),p=Prism.util.isActive(i,t),m=i.querySelector("code"),f=p?i:m||i,h=[],b=m&&f!=m?function(e,t){var n=getComputedStyle(e),a=getComputedStyle(t);function i(e){return+e.substr(0,e.length-2)}return t.offsetTop+i(a.borderTopWidth)+i(a.paddingTop)-i(n.paddingTop)}(i,m):0;c.forEach((function(e){var t=e.split("-"),n=+t[0],a=+t[1]||n,r=i.querySelector('.line-highlight[data-range="'+e+'"]')||document.createElement("div");if(h.push((function(){r.setAttribute("aria-hidden","true"),r.setAttribute("data-range",e),r.className=(u||"")+" line-highlight"})),p&&Prism.plugins.lineNumbers){var s=Prism.plugins.lineNumbers.getLine(i,n),o=Prism.plugins.lineNumbers.getLine(i,a);if(s){var l=s.offsetTop+b+"px";h.push((function(){r.style.top=l}))}if(o){var c=o.offsetTop-s.offsetTop+o.offsetHeight+"px";h.push((function(){r.style.height=c}))}}else h.push((function(){r.setAttribute("data-start",String(n)),a>n&&r.setAttribute("data-end",String(a)),r.style.top=(n-d-1)*g+b+"px",r.textContent=new Array(a-n+2).join(" \n")}));h.push((function(){r.style.width=i.scrollWidth+"px"})),h.push((function(){f.appendChild(r)}))}));var y=i.id;if(p&&Prism.util.isActive(i,n)&&y){s(i,n)||h.push((function(){i.classList.add(n)}));var v=parseInt(i.getAttribute("data-start")||"1");r(".line-numbers-rows > span",i).forEach((function(e,t){var n=t+v;e.onclick=function(){var e=y+"."+n;a=!1,location.hash=e,setTimeout((function(){a=!0}),1)}}))}return function(){h.forEach(o)}}};var i=0;Prism.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(l(t)){var n=0;r(".line-highlight",t).forEach((function(e){n+=e.textContent.length,e.parentNode.removeChild(e)})),n&&/^(?: \n)+$/.test(e.code.slice(-n))&&(e.code=e.code.slice(0,-n))}})),Prism.hooks.add("complete",(function e(n){var a=n.element.parentElement;if(l(a)){clearTimeout(i);var r=Prism.plugins.lineNumbers,o=n.plugins&&n.plugins.lineNumbers;s(a,t)&&r&&!o?Prism.hooks.add("line-numbers",e):(Prism.plugins.lineHighlight.highlightLines(a)(),i=setTimeout(u,1))}})),window.addEventListener("hashchange",u),window.addEventListener("resize",(function(){r("pre").filter(l).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(o)}))}function r(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function s(e,t){return e.classList.contains(t)}function o(e){e()}function l(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&Prism.util.isActive(e,n)))}function u(){var e=location.hash.slice(1);r(".temporary.line-highlight").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var n=e.slice(0,e.lastIndexOf(".")),i=document.getElementById(n);i&&(i.hasAttribute("data-line")||i.setAttribute("data-line",""),Prism.plugins.lineHighlight.highlightLines(i,t,"temporary ")(),a&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}()},8759:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e="line-numbers",t=/\n(?!$)/g,n=Prism.plugins.lineNumbers={getLine:function(t,n){if("PRE"===t.tagName&&t.classList.contains(e)){var a=t.querySelector(".line-numbers-rows");if(a){var i=parseInt(t.getAttribute("data-start"),10)||1,r=i+(a.children.length-1);n<i&&(n=i),n>r&&(n=r);var s=n-i;return a.children[s]}}},resize:function(e){i([e])},assumeViewportIndependence:!0},a=void 0;window.addEventListener("resize",(function(){n.assumeViewportIndependence&&a===window.innerWidth||(a=window.innerWidth,i(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers"))))})),Prism.hooks.add("complete",(function(n){if(n.code){var a=n.element,r=a.parentNode;if(r&&/pre/i.test(r.nodeName)&&!a.querySelector(".line-numbers-rows")&&Prism.util.isActive(a,e)){a.classList.remove(e),r.classList.add(e);var s,o=n.code.match(t),l=o?o.length+1:1,u=new Array(l+1).join("<span></span>");(s=document.createElement("span")).setAttribute("aria-hidden","true"),s.className="line-numbers-rows",s.innerHTML=u,r.hasAttribute("data-start")&&(r.style.counterReset="linenumber "+(parseInt(r.getAttribute("data-start"),10)-1)),n.element.appendChild(s),i([r]),Prism.hooks.run("line-numbers",n)}}})),Prism.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function i(e){if(0!=(e=e.filter((function(e){var t,n=(t=e,t?window.getComputedStyle?getComputedStyle(t):t.currentStyle||null:null)["white-space"];return"pre-wrap"===n||"pre-line"===n}))).length){var n=e.map((function(e){var n=e.querySelector("code"),a=e.querySelector(".line-numbers-rows");if(n&&a){var i=e.querySelector(".line-numbers-sizer"),r=n.textContent.split(t);i||((i=document.createElement("span")).className="line-numbers-sizer",n.appendChild(i)),i.innerHTML="0",i.style.display="block";var s=i.getBoundingClientRect().height;return i.innerHTML="",{element:e,lines:r,lineHeights:[],oneLinerHeight:s,sizer:i}}})).filter(Boolean);n.forEach((function(e){var t=e.sizer,n=e.lines,a=e.lineHeights,i=e.oneLinerHeight;a[n.length-1]=void 0,n.forEach((function(e,n){if(e&&e.length>1){var r=t.appendChild(document.createElement("span"));r.style.display="block",r.textContent=e}else a[n]=i}))})),n.forEach((function(e){for(var t=e.sizer,n=e.lineHeights,a=0,i=0;i<n.length;i++)void 0===n[i]&&(n[i]=t.children[a++].getBoundingClientRect().height)})),n.forEach((function(e){var t=e.sizer,n=e.element.querySelector(".line-numbers-rows");t.style.display="none",t.innerHTML="",e.lineHeights.forEach((function(e,t){n.children[t].style.height=e+"px"}))}))}}}()},9470:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&Function.prototype.bind){var e,t,n={gradient:{create:(e={},t=function(t){if(e[t])return e[t];var n=t.match(/^(\b|\B-[a-z]{1,10}-)((?:repeating-)?(?:linear|radial)-gradient)/),a=n&&n[1],i=n&&n[2],r=t.replace(/^(?:\b|\B-[a-z]{1,10}-)(?:repeating-)?(?:linear|radial)-gradient\(|\)$/g,"").split(/\s*,\s*/);return i.indexOf("linear")>=0?e[t]=function(e,t,n){var a="180deg";return/^(?:-?(?:\d+(?:\.\d+)?|\.\d+)(?:deg|rad)|to\b|top|right|bottom|left)/.test(n[0])&&(a=n.shift()).indexOf("to ")<0&&(a.indexOf("top")>=0?a=a.indexOf("left")>=0?"to bottom right":a.indexOf("right")>=0?"to bottom left":"to bottom":a.indexOf("bottom")>=0?a=a.indexOf("left")>=0?"to top right":a.indexOf("right")>=0?"to top left":"to top":a.indexOf("left")>=0?a="to right":a.indexOf("right")>=0?a="to left":e&&(a.indexOf("deg")>=0?a=90-parseFloat(a)+"deg":a.indexOf("rad")>=0&&(a=Math.PI/2-parseFloat(a)+"rad"))),t+"("+a+","+n.join(",")+")"}(a,i,r):i.indexOf("radial")>=0?e[t]=function(e,t,n){if(n[0].indexOf("at")<0){var a="center",i="ellipse",r="farthest-corner";if(/\b(?:bottom|center|left|right|top)\b|^\d+/.test(n[0])&&(a=n.shift().replace(/\s*-?\d+(?:deg|rad)\s*/,"")),/\b(?:circle|closest|contain|cover|ellipse|farthest)\b/.test(n[0])){var s=n.shift().split(/\s+/);!s[0]||"circle"!==s[0]&&"ellipse"!==s[0]||(i=s.shift()),s[0]&&(r=s.shift()),"cover"===r?r="farthest-corner":"contain"===r&&(r="clothest-side")}return t+"("+i+" "+r+" at "+a+","+n.join(",")+")"}return t+"("+n.join(",")+")"}(0,i,r):e[t]=i+"("+r.join(",")+")"},function(){new Prism.plugins.Previewer("gradient",(function(e){return this.firstChild.style.backgroundImage="",this.firstChild.style.backgroundImage=t(e),!!this.firstChild.style.backgroundImage}),"*",(function(){this._elt.innerHTML="<div></div>"}))}),tokens:{gradient:{pattern:/(?:\b|\B-[a-z]{1,10}-)(?:repeating-)?(?:linear|radial)-gradient\((?:(?:hsl|rgb)a?\(.+?\)|[^\)])+\)/gi,inside:{function:/[\w-]+(?=\()/,punctuation:/[(),]/}}},languages:{css:!0,less:!0,sass:[{lang:"sass",before:"punctuation",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["variable-line"]},{lang:"sass",before:"punctuation",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["property-line"]}],scss:!0,stylus:[{lang:"stylus",before:"func",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property-declaration"].inside},{lang:"stylus",before:"func",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]}},angle:{create:function(){new Prism.plugins.Previewer("angle",(function(e){var t,n,a=parseFloat(e),i=e.match(/[a-z]+$/i);if(!a||!i)return!1;switch(i=i[0]){case"deg":t=360;break;case"grad":t=400;break;case"rad":t=2*Math.PI;break;case"turn":t=1}return n=100*a/t,n%=100,this[(a<0?"set":"remove")+"Attribute"]("data-negative",""),this.querySelector("circle").style.strokeDasharray=Math.abs(n)+",500",!0}),"*",(function(){this._elt.innerHTML='<svg viewBox="0 0 64 64"><circle r="16" cy="32" cx="32"></circle></svg>'}))},tokens:{angle:/(?:\b|\B-|(?=\B\.))(?:\d+(?:\.\d+)?|\.\d+)(?:deg|g?rad|turn)\b/i},languages:{css:!0,less:!0,markup:{lang:"markup",before:"punctuation",inside:"inside",root:Prism.languages.markup&&Prism.languages.markup.tag.inside["attr-value"]},sass:[{lang:"sass",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["property-line"]},{lang:"sass",before:"operator",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["variable-line"]}],scss:!0,stylus:[{lang:"stylus",before:"func",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property-declaration"].inside},{lang:"stylus",before:"func",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]}},color:{create:function(){new Prism.plugins.Previewer("color",(function(e){return this.style.backgroundColor="",this.style.backgroundColor=e,!!this.style.backgroundColor}))},tokens:{color:[Prism.languages.css.hexcode].concat(Prism.languages.css.color)},languages:{css:!1,less:!0,markup:{lang:"markup",before:"punctuation",inside:"inside",root:Prism.languages.markup&&Prism.languages.markup.tag.inside["attr-value"]},sass:[{lang:"sass",before:"punctuation",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["variable-line"]},{lang:"sass",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["property-line"]}],scss:!1,stylus:[{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property-declaration"].inside},{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]}},easing:{create:function(){new Prism.plugins.Previewer("easing",(function(e){var t=(e={linear:"0,0,1,1",ease:".25,.1,.25,1","ease-in":".42,0,1,1","ease-out":"0,0,.58,1","ease-in-out":".42,0,.58,1"}[e]||e).match(/-?(?:\d+(?:\.\d+)?|\.\d+)/g);if(4===t.length){t=t.map((function(e,t){return 100*(t%2?1-e:e)})),this.querySelector("path").setAttribute("d","M0,100 C"+t[0]+","+t[1]+", "+t[2]+","+t[3]+", 100,0");var n=this.querySelectorAll("line");return n[0].setAttribute("x2",t[0]),n[0].setAttribute("y2",t[1]),n[1].setAttribute("x2",t[2]),n[1].setAttribute("y2",t[3]),!0}return!1}),"*",(function(){this._elt.innerHTML='<svg viewBox="-20 -20 140 140" width="100" height="100"><defs><marker id="prism-previewer-easing-marker" viewBox="0 0 4 4" refX="2" refY="2" markerUnits="strokeWidth"><circle cx="2" cy="2" r="1.5" /></marker></defs><path d="M0,100 C20,50, 40,30, 100,0" /><line x1="0" y1="100" x2="20" y2="50" marker-start="url(#prism-previewer-easing-marker)" marker-end="url(#prism-previewer-easing-marker)" /><line x1="100" y1="0" x2="40" y2="30" marker-start="url(#prism-previewer-easing-marker)" marker-end="url(#prism-previewer-easing-marker)" /></svg>'}))},tokens:{easing:{pattern:/\bcubic-bezier\((?:-?(?:\d+(?:\.\d+)?|\.\d+),\s*){3}-?(?:\d+(?:\.\d+)?|\.\d+)\)\B|\b(?:ease(?:-in)?(?:-out)?|linear)(?=\s|[;}]|$)/i,inside:{function:/[\w-]+(?=\()/,punctuation:/[(),]/}}},languages:{css:!0,less:!0,sass:[{lang:"sass",inside:"inside",before:"punctuation",root:Prism.languages.sass&&Prism.languages.sass["variable-line"]},{lang:"sass",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["property-line"]}],scss:!0,stylus:[{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property-declaration"].inside},{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]}},time:{create:function(){new Prism.plugins.Previewer("time",(function(e){var t=parseFloat(e),n=e.match(/[a-z]+$/i);return!(!t||!n||(n=n[0],this.querySelector("circle").style.animationDuration=2*t+n,0))}),"*",(function(){this._elt.innerHTML='<svg viewBox="0 0 64 64"><circle r="16" cy="32" cx="32"></circle></svg>'}))},tokens:{time:/(?:\b|\B-|(?=\B\.))(?:\d+(?:\.\d+)?|\.\d+)m?s\b/i},languages:{css:!0,less:!0,markup:{lang:"markup",before:"punctuation",inside:"inside",root:Prism.languages.markup&&Prism.languages.markup.tag.inside["attr-value"]},sass:[{lang:"sass",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["property-line"]},{lang:"sass",before:"operator",inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["variable-line"]}],scss:!0,stylus:[{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property-declaration"].inside},{lang:"stylus",before:"hexcode",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]}}},a="token",i="active",r="flipped",s=function(e,t,n,a){this._elt=null,this._type=e,this._token=null,this.updater=t,this._mouseout=this.mouseout.bind(this),this.initializer=a;var i=this;n||(n=["*"]),Array.isArray(n)||(n=[n]),n.forEach((function(e){"string"!=typeof e&&(e=e.lang),s.byLanguages[e]||(s.byLanguages[e]=[]),s.byLanguages[e].indexOf(i)<0&&s.byLanguages[e].push(i)})),s.byType[e]=this};for(var o in s.prototype.init=function(){this._elt||(this._elt=document.createElement("div"),this._elt.className="prism-previewer prism-previewer-"+this._type,document.body.appendChild(this._elt),this.initializer&&this.initializer())},s.prototype.isDisabled=function(e){do{if(e.hasAttribute&&e.hasAttribute("data-previewers"))return-1===(e.getAttribute("data-previewers")||"").split(/\s+/).indexOf(this._type)}while(e=e.parentNode);return!1},s.prototype.check=function(e){if(!e.classList.contains(a)||!this.isDisabled(e)){do{if(e.classList&&e.classList.contains(a)&&e.classList.contains(this._type))break}while(e=e.parentNode);e&&e!==this._token&&(this._token=e,this.show())}},s.prototype.mouseout=function(){this._token.removeEventListener("mouseout",this._mouseout,!1),this._token=null,this.hide()},s.prototype.show=function(){var e,t,n,a;if(this._elt||this.init(),this._token)if(this.updater.call(this._elt,this._token.textContent)){this._token.addEventListener("mouseout",this._mouseout,!1);var s=(t=(e=this._token.getBoundingClientRect()).left,n=e.top,t-=(a=document.documentElement.getBoundingClientRect()).left,{top:n-=a.top,right:innerWidth-t-e.width,bottom:innerHeight-n-e.height,left:t,width:e.width,height:e.height});this._elt.classList.add(i),s.top-this._elt.offsetHeight>0?(this._elt.classList.remove(r),this._elt.style.top=s.top+"px",this._elt.style.bottom=""):(this._elt.classList.add(r),this._elt.style.bottom=s.bottom+"px",this._elt.style.top=""),this._elt.style.left=s.left+Math.min(200,s.width/2)+"px"}else this.hide()},s.prototype.hide=function(){this._elt.classList.remove(i)},s.byLanguages={},s.byType={},s.initEvents=function(e,t){var n=[];s.byLanguages[t]&&(n=n.concat(s.byLanguages[t])),s.byLanguages["*"]&&(n=n.concat(s.byLanguages["*"])),e.addEventListener("mouseover",(function(e){var t=e.target;n.forEach((function(e){e.check(t)}))}),!1)},Prism.plugins.Previewer=s,Prism.hooks.add("before-highlight",(function(e){for(var t in n){var a=n[t].languages;if(e.language&&a[e.language]&&!a[e.language].initialized){var i=a[e.language];Array.isArray(i)||(i=[i]),i.forEach((function(i){var r,s,o,l;!0===i?(r="important",s=e.language,i=e.language):(r=i.before||"important",s=i.inside||i.lang,o=i.root||Prism.languages,l=i.skip,i=e.language),!l&&Prism.languages[i]&&(Prism.languages.insertBefore(s,r,n[t].tokens,o),e.grammar=Prism.languages[i],a[e.language]={initialized:!0})}))}}})),Prism.hooks.add("after-highlight",(function(e){(s.byLanguages["*"]||s.byLanguages[e.language])&&s.initEvents(e.element,e.language)})),n)n[o].create()}}()},2695:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var e={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",ino:"Arduino",arff:"ARFF",armasm:"ARM Assembly","arm-asm":"ARM Assembly",art:"Arturo",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",asmatmel:"Atmel AVR Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",avisynth:"AviSynth",avs:"AviSynth","avro-idl":"Avro IDL",avdl:"Avro IDL",awk:"AWK",gawk:"GAWK",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",cue:"CUE",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gap:"GAP (CAS)",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",gettext:"gettext",po:"gettext",glsl:"GLSL",gn:"GN",gni:"GN","linker-script":"GNU Linker Script",ld:"GNU Linker Script","go-module":"Go module","go-mod":"Go module",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",keepalived:"Keepalived Configure",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",magma:"Magma (CAS)",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",maxscript:"MAXScript",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras","plant-uml":"PlantUML",plantuml:"PlantUML",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",cshtml:"Razor C#",razor:"Razor C#",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",res:"ReScript",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",stata:"Stata Ado",iecst:"Structured Text (IEC 61131-3)",supercollider:"SuperCollider",sclang:"SuperCollider",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trickle:"trickle",troy:"troy",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uorazor:"UO Razor Script",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly","web-idl":"Web IDL",webidl:"Web IDL",wiki:"Wiki markup",wolfram:"Wolfram language",nb:"Mathematica Notebook",wl:"Wolfram language",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",(function(t){var n=t.element.parentNode;if(n&&/pre/i.test(n.nodeName)){var a,i=n.getAttribute("data-language")||e[t.language]||((a=t.language)?(a.substring(0,1).toUpperCase()+a.substring(1)).replace(/s(?=cript)/,"S"):a);if(i){var r=document.createElement("span");return r.textContent=i,r}}}))}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}()},5206:()=>{!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e=[],t={},n=function(){};Prism.plugins.toolbar={};var a=Prism.plugins.toolbar.registerButton=function(n,a){var i;i="function"==typeof a?a:function(e){var t;return"function"==typeof a.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){a.onClick.call(this,e)}))):"string"==typeof a.url?(t=document.createElement("a")).href=a.url:t=document.createElement("span"),a.className&&t.classList.add(a.className),t.textContent=a.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=i)},i=Prism.plugins.toolbar.hook=function(a){var i=a.element.parentNode;if(i&&/pre/i.test(i.nodeName)&&!i.parentNode.classList.contains("code-toolbar")){var r=document.createElement("div");r.classList.add("code-toolbar"),i.parentNode.insertBefore(r,i),r.appendChild(i);var s=document.createElement("div");s.classList.add("toolbar");var o=e,l=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(a.element);l&&(o=l.map((function(e){return t[e]||n}))),o.forEach((function(e){var t=e(a);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),s.appendChild(n)}})),r.appendChild(s)}};a("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,a,i=t.getAttribute("data-label");try{a=document.querySelector("template#"+i)}catch(e){}return a?n=a.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=i),n}})),Prism.hooks.add("complete",i)}}()}},t={};function n(a){var i=t[a];if(void 0!==i)return i.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(8325);n(4335),n(6854),n(9945),n(9425),n(8921),n(8759),n(5433),n(5251),n(9980),n(5206),n(2695),n(6263),n(5088),n(9470),n(2317),document.addEventListener("readystatechange",(function(){"complete"===document.readyState&&e.highlightAll()}))})()})();
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
3 |
+
*
|
4 |
+
* @license MIT <https://opensource.org/licenses/MIT>
|
5 |
+
* @author Lea Verou <https://lea.verou.me>
|
6 |
+
* @namespace
|
7 |
+
* @public
|
8 |
+
*/
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";left:0;position:absolute;right:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-left:10px solid transparent;border-right:10px solid transparent;display:none;height:0;left:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-left:9px solid transparent;border-right:9px solid transparent;content:"";height:0;left:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-left:3px solid transparent;border-right:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;left:0;margin:2px;pointer-events:none;position:absolute;right:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{left:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 0 0 2px;position:absolute;-webkit-user-select:text;-moz-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-right:40px;padding:0 5px 0 9px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-left:1px;padding-right:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;right:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;right:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:right;padding:10px 15px 10px 5px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-right:30px;padding:12px 0 0 12px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-right:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-right:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;left:0;position:absolute;right:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;left:0;padding:3px 0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 5px 5px 14px;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-right:10px;text-align:right}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;left:0;overflow:auto;position:absolute;right:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 5px 5px 14px;pointer-events:none;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-right:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;left:auto;position:absolute;right:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;left:0;top:50%;transform:translateX(-50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{left:0;transform:translateX(50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(-150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-left:5px;padding-right:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-right:0;padding-right:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-right:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-right:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;left:-1px;right:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-left-radius:3px;border-top-right-radius:3px;bottom:auto;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;left:auto;overflow:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{left:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{left:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;content:"";height:0;left:2px;position:absolute;top:0;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";height:0;left:2px;position:absolute;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;left:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;right:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;left:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-left:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 0 0 8px;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;left:50%;overflow:hidden;transform:none;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:right;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 0 0 4px;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-left:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(-2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 20px 10px 10px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;left:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-left:0!important;padding-left:0!important;padding-right:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-right:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-right:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;right:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{left:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:ltr}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.CodeMirror-foldmarker{color:inherit;font-weight:700;margin-left:.25em;margin-right:.25em}p.submit{max-width:1020px}p.submit .button-secondary{float:right}.nav-tab-wrapper{margin-bottom:1em}input[type=number]{width:4em}.CodeMirror{max-width:800px;padding-right:1em;width:100%}.CodeMirror-sizer:before{content:"<?php"}body.no-js .nav-tab-wrapper{display:none}body.no-js .settings-section{display:block!important}body.js .settings-section-title{clip:rect(1px,1px,1px,1px);word-wrap:normal!important;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}body.js .nav-tab:not(.nav-tab-active){cursor:pointer}body.js .settings-section{display:none}body.js .wrap[data-active-tab=description_editor] .description_editor-settings,body.js .wrap[data-active-tab=editor] .editor-settings,body.js .wrap[data-active-tab=general] .general-settings,body.js .wrap[data-active-tab=license] .license-settings{display:block}
|
2 |
+
|
@@ -0,0 +1 @@
|
|
|
1 |
+
"use strict";(self.webpackChunkcode_snippets=self.webpackChunkcode_snippets||[]).push([[571],{3986:(e,t,n)=>{var r=n(1002);function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(){c=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,i){var a=new RegExp(e,r);return t.set(a,i||t.get(e)),o(a,n.prototype)}function a(e,n){var r=t.get(n);return Object.keys(r).reduce((function(t,n){return t[n]=e[r[n]],t}),Object.create(null))}return i(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);return n&&(n.groups=a(n,this)),n},n.prototype[Symbol.replace]=function(n,o){if("string"==typeof o){var i=t.get(this);return e[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+i[t]})))}if("function"==typeof o){var c=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=(0,r.Z)(e[e.length-1])&&(e=[].slice.call(e)).push(a(e,c)),o.apply(this,e)}))}return e[Symbol.replace].call(this,n,o)},c.apply(this,arguments)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n(3737),function(){var e,t=document.getElementById("settings-sections-tabs");if(t){var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return c=e.done,e},e:function(e){u=!0,i=e},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw i}}}}(null!==(e=t.querySelectorAll(".nav-tab"))&&void 0!==e?e:[]);try{var o=function(){var e=n.value;e.addEventListener("click",(function(n){n.preventDefault();var r=e.getAttribute("data-section");r&&(function(e,t,n){var r,o;null===(r=e.querySelector(".nav-tab-active"))||void 0===r||r.classList.remove("nav-tab-active"),t.classList.add("nav-tab-active"),null===(o=e.closest(".wrap"))||void 0===o||o.setAttribute("data-active-tab",n)}(t,e,r),function(e){var t;"editor"===e&&(null===(t=window.code_snippets_editor_preview)||void 0===t||t.codemirror.refresh())}(r),function(e){var t=document.querySelector("input[name=_wp_http_referer]");if(t){var n=t.value.replace(c(/([&?]section=)[^&]+/,{base:1}),"$1".concat(e));t.value=n+(n===t.value?"§ion=".concat(e):"")}else console.error("could not find http referer")}(r))}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}else console.error("Could not find snippets tabs")}(),function(){var e,t=function(){var e=window.wp.codeEditor,t=document.getElementById("code_snippets_editor_preview");if(t)return window.code_snippets_editor_preview=e.initialize(t),window.code_snippets_editor_preview.codemirror;console.error("Could not initialise CodeMirror on textarea.",t)}(),n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}(window.code_snippets_editor_settings);try{var r=function(){var n=e.value,r=document.querySelector('[name="code_snippets_settings[editor]['.concat(n.name,']"]'));null==r||r.addEventListener("change",(function(){var e=n.codemirror,o=function(){switch(n.type){case"select":return(e=r).options[e.selectedIndex].value;case"checkbox":return r.checked;case"number":return parseInt(r.value,10);default:return null}var e}();null!==o&&(null==t||t.setOption(e,o))}))};for(n.s();!(e=n.n()).done;)r()}catch(e){n.e(e)}finally{n.f()}}()},1002:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Z:()=>r})}},e=>{e(e.s=3986)}]);
|
@@ -1,2 +1,2 @@
|
|
1 |
/*! For license information please see tags.js.LICENSE.txt */
|
2 |
-
(()=>{var t={8870:(t,e,n)=>{var i;"undefined"!=typeof window?window:n.g,void 0===(i=function(t){var e,n=(e="innerText"in document.createElement("div")?"innerText":"textContent",function(t){return t[e]});function i(t,e){if(t.length)return Array.from(t).map((function(t){return new i(t,e)}));if(!(this instanceof i))return new i(t,e);var n=a({},i.defaults,e);this.init(t,n)}function a(){if(arguments.length<2)return arguments[0];var t=arguments[0];return[].slice.call(arguments).reduce((function(t,e){return s(e)&&Object.keys(e).forEach((function(n){s(e[n])&&s(t[n])?t[n]=a({},t[n],e[n]):t[n]=e[n]})),t})),t}function s(t){return"object"==typeof t&&null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function l(e,n,i){return e=document.createElement(e),Object.keys(n).forEach((function(t){"style"===t?Object.keys(n.style).forEach((function(t){e.style[t]=n.style[t]})):e.setAttribute(t,n[t])})),i!==t&&i.forEach((function(t){var n;n="string"==typeof t?document.createTextNode(t):l.apply(null,t),e.appendChild(n)})),e}function o(t){return t.replace(/([-\\^$[\]()+{}?*.|])/g,"\\$1")}var r=0;return i.defaults={allow_duplicates:!1,allow_spaces:!0,completion:{list:[],delay:400,min_length:2},tag_limit:-1,add_on_blur:!1,link:function(t){return"/tag/"+t}},i.fn=i.prototype={init:function(t,e){this._id=++r,this._settings=e||{},this._ul=document.createElement("ul"),this._input=t;var n=document.createElement("div");e.wrap?n.className="tagger wrap":n.className="tagger",this._input.setAttribute("hidden","hidden"),this._input.setAttribute("type","hidden");var i=document.createElement("li");i.className="tagger-new",this._new_input_tag=document.createElement("input"),this.tags_from_input(),i.appendChild(this._new_input_tag),this._completion=document.createElement("div"),this._completion.className="tagger-completion",this._ul.appendChild(i),t.parentNode.replaceChild(n,t),n.appendChild(t),n.appendChild(this._ul),i.appendChild(this._completion),this._add_events(),this._settings.completion.list instanceof Array&&this._build_completion(this._settings.completion.list)},_add_events:function(){var t=this;this._ul.addEventListener("click",(function(e){e.target.className.match(/close/)&&(t._remove_tag(e.target),e.preventDefault())})),this._settings.add_on_blur&&this._new_input_tag.addEventListener("blur",(function(e){t.add_tag(t._new_input_tag.value.trim())&&(t._new_input_tag.value="")})),this._new_input_tag.addEventListener("keydown",(function(e){if(13===e.keyCode||188===e.keyCode||32===e.keyCode&&!t._settings.allow_spaces)t.add_tag(t._new_input_tag.value.trim())&&(t._new_input_tag.value=""),e.preventDefault();else if(8!==e.keyCode||t._new_input_tag.value)32===e.keyCode&&(e.ctrlKey||e.metaKey)?("function"==typeof t._settings.completion.list&&t.complete(t._new_input_tag.value),t._toggle_completion(!0),e.preventDefault()):t._tag_limit()&&e.preventDefault();else{if(t._tags.length>0){var n=t._ul.querySelector("li:nth-last-child(2)");t._ul.removeChild(n),t._tags.pop(),t._input.value=t._tags.join(",")}e.preventDefault()}})),this._new_input_tag.addEventListener("input",(function(e){var n=t._new_input_tag.value;if(t._tag_selected(n))t.add_tag(n)&&(t._toggle_completion(!1),t._new_input_tag.value="");else{var i=t._settings.completion.min_length;"function"==typeof t._settings.completion.list&&n.length>=i&&t.complete(n),t._toggle_completion(n.length>=i)}})),this._completion.addEventListener("click",(function(e){"a"===e.target.tagName.toLowerCase()&&(t.add_tag(n(e.target)),t._new_input_tag.value="",t._completion.innerHTML="")}))},_tag_selected:function(t){if(this._last_completion&&this._last_completion.includes(t)){var e=new RegExp("^"+o(t));return 1===this._last_completion.filter((function(t){return e.test(t)})).length}return!1},_toggle_completion:function(t){t?this._new_input_tag.setAttribute("list","tagger-completion-"+this._id):this._new_input_tag.removeAttribute("list")},_build_completion:function(t){if(this._completion.innerHTML="",this._last_completion=t,t.length){var e="tagger-completion-"+this._id;this._settings.allow_duplicates||(t=t.filter((t=>!this._tags.includes(t))));var n=l("datalist",{id:e},t.map((function(t){return["option",{},[t]]})));this._completion.appendChild(n)}},complete:function(t){if(this._settings.completion){var e=this._settings.completion.list;if("function"==typeof e){var n=e(t);n&&"function"==typeof n.then?n.then(this._build_completion.bind(this)):n instanceof Array&&this._build_completion(n)}else this._build_completion(e)}},tags_from_input:function(){this._tags=this._input.value.split(/\s*,\s*/).filter(Boolean),this._tags.forEach(this._new_tag.bind(this))},_new_tag:function(t){var e,n=["a",{href:"#",class:"close"},["×"]],i=["span",{class:"label"},[t]],a=this._settings.link(t);e=l("li",{},!1===a?[["span",{},[i,n]]]:[["a",{href:a,target:"_black"},[i,n]]]),this._ul.insertBefore(e,this._new_input_tag.parentNode)},_tag_limit:function(){return this._settings.tag_limit>0&&this._tags.length>=this._settings.tag_limit},add_tag:function(t){return!(!this._settings.allow_duplicates&&-1!==this._tags.indexOf(t)||this._tag_limit()||this.is_empty(t)||(this._new_tag(t),this._tags.push(t),this._input.value=this._tags.join(","),0))},is_empty:function(e){switch(e){case"":case'""':case"''":case"``":case t:case null:return!0;default:return!1}},remove_tag:function(t,e=!0){if(this._tags=this._tags.filter((function(e){return t!==e})),this._input.value=this._tags.join(","),e){var n=Array.from(this._ul.querySelectorAll(".label")),i=new RegExp("^s*"+o(t)+"s*$"),a=n.find((function(t){return t.innerText.match(i)}));if(!a)return!1;var s=a.closest("li");return this._ul.removeChild(s),!0}},_remove_tag:function(t){var e=t.closest("li"),n=e.querySelector(".label").innerText;this._ul.removeChild(e),this.remove_tag(n,!1)}},i}.apply(e,[]))||(t.exports=i)}},e={};function n(i){var a=e[i];if(void 0!==a)return a.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t,e,i=n(8870),a=n.n(i);t=window.code_snippets_tags,(e=document.getElementById("snippet_tags"))&&a()(e,{completion:{list:t.available_tags,delay:400,min_length:2},allow_spaces:t.allow_spaces,allow_duplicates:!1,link:function(){return!1}})})()})();
|
1 |
/*! For license information please see tags.js.LICENSE.txt */
|
2 |
+
(()=>{var t={8870:(t,e,n)=>{var i;"undefined"!=typeof window?window:n.g,void 0===(i=function(t){var e,n=(e="innerText"in document.createElement("div")?"innerText":"textContent",function(t){return t[e]});function i(t,e){if(t.length)return Array.from(t).map((function(t){return new i(t,e)}));if(!(this instanceof i))return new i(t,e);var n=a({},i.defaults,e);this.init(t,n)}function a(){if(arguments.length<2)return arguments[0];var t=arguments[0];return[].slice.call(arguments).reduce((function(t,e){return s(e)&&Object.keys(e).forEach((function(n){s(e[n])&&s(t[n])?t[n]=a({},t[n],e[n]):t[n]=e[n]})),t})),t}function s(t){return"object"==typeof t&&null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function l(e,n,i){return e=document.createElement(e),Object.keys(n).forEach((function(t){"style"===t?Object.keys(n.style).forEach((function(t){e.style[t]=n.style[t]})):e.setAttribute(t,n[t])})),i!==t&&i.forEach((function(t){var n;n="string"==typeof t?document.createTextNode(t):l.apply(null,t),e.appendChild(n)})),e}function o(t){return t.replace(/([-\\^$[\]()+{}?*.|])/g,"\\$1")}var r=0;return i.defaults={allow_duplicates:!1,allow_spaces:!0,completion:{list:[],delay:400,min_length:2},tag_limit:-1,add_on_blur:!1,link:function(t){return"/tag/"+t}},i.fn=i.prototype={init:function(t,e){this._id=++r,this._settings=e||{},this._ul=document.createElement("ul"),this._input=t;var n=document.createElement("div");e.wrap?n.className="tagger wrap":n.className="tagger",this._input.setAttribute("hidden","hidden"),this._input.setAttribute("type","hidden");var i=document.createElement("li");i.className="tagger-new",this._new_input_tag=document.createElement("input"),this.tags_from_input(),i.appendChild(this._new_input_tag),this._completion=document.createElement("div"),this._completion.className="tagger-completion",this._ul.appendChild(i),t.parentNode.replaceChild(n,t),n.appendChild(t),n.appendChild(this._ul),i.appendChild(this._completion),this._add_events(),this._settings.completion.list instanceof Array&&this._build_completion(this._settings.completion.list)},_add_events:function(){var t=this;this._ul.addEventListener("click",(function(e){e.target.className.match(/close/)&&(t._remove_tag(e.target),e.preventDefault())})),this._settings.add_on_blur&&this._new_input_tag.addEventListener("blur",(function(e){t.add_tag(t._new_input_tag.value.trim())&&(t._new_input_tag.value="")})),this._new_input_tag.addEventListener("keydown",(function(e){if(13===e.keyCode||188===e.keyCode||32===e.keyCode&&!t._settings.allow_spaces)t.add_tag(t._new_input_tag.value.trim())&&(t._new_input_tag.value=""),e.preventDefault();else if(8!==e.keyCode||t._new_input_tag.value)32===e.keyCode&&(e.ctrlKey||e.metaKey)?("function"==typeof t._settings.completion.list&&t.complete(t._new_input_tag.value),t._toggle_completion(!0),e.preventDefault()):t._tag_limit()&&e.preventDefault();else{if(t._tags.length>0){var n=t._ul.querySelector("li:nth-last-child(2)");t._ul.removeChild(n),t._tags.pop(),t._input.value=t._tags.join(",")}e.preventDefault()}})),this._new_input_tag.addEventListener("input",(function(e){var n=t._new_input_tag.value;if(t._tag_selected(n))t.add_tag(n)&&(t._toggle_completion(!1),t._new_input_tag.value="");else{var i=t._settings.completion.min_length;"function"==typeof t._settings.completion.list&&n.length>=i&&t.complete(n),t._toggle_completion(n.length>=i)}})),this._completion.addEventListener("click",(function(e){"a"===e.target.tagName.toLowerCase()&&(t.add_tag(n(e.target)),t._new_input_tag.value="",t._completion.innerHTML="")}))},_tag_selected:function(t){if(this._last_completion&&this._last_completion.includes(t)){var e=new RegExp("^"+o(t));return 1===this._last_completion.filter((function(t){return e.test(t)})).length}return!1},_toggle_completion:function(t){t?this._new_input_tag.setAttribute("list","tagger-completion-"+this._id):this._new_input_tag.removeAttribute("list")},_build_completion:function(t){if(this._completion.innerHTML="",this._last_completion=t,t.length){var e="tagger-completion-"+this._id;this._settings.allow_duplicates||(t=t.filter((t=>!this._tags.includes(t))));var n=l("datalist",{id:e},t.map((function(t){return["option",{},[t]]})));this._completion.appendChild(n)}},complete:function(t){if(this._settings.completion){var e=this._settings.completion.list;if("function"==typeof e){var n=e(t);n&&"function"==typeof n.then?n.then(this._build_completion.bind(this)):n instanceof Array&&this._build_completion(n)}else this._build_completion(e)}},tags_from_input:function(){this._tags=this._input.value.split(/\s*,\s*/).filter(Boolean),this._tags.forEach(this._new_tag.bind(this))},_new_tag:function(t){var e,n=["a",{href:"#",class:"close"},["×"]],i=["span",{class:"label"},[t]],a=this._settings.link(t);e=l("li",{},!1===a?[["span",{},[i,n]]]:[["a",{href:a,target:"_black"},[i,n]]]),this._ul.insertBefore(e,this._new_input_tag.parentNode)},_tag_limit:function(){return this._settings.tag_limit>0&&this._tags.length>=this._settings.tag_limit},add_tag:function(t){return!(!this._settings.allow_duplicates&&-1!==this._tags.indexOf(t)||this._tag_limit()||this.is_empty(t)||(this._new_tag(t),this._tags.push(t),this._input.value=this._tags.join(","),0))},is_empty:function(e){switch(e){case"":case'""':case"''":case"``":case t:case null:return!0;default:return!1}},remove_tag:function(t,e=!0){if(this._tags=this._tags.filter((function(e){return t!==e})),this._input.value=this._tags.join(","),e){var n=Array.from(this._ul.querySelectorAll(".label")),i=new RegExp("^s*"+o(t)+"s*$"),a=n.find((function(t){return t.innerText.match(i)}));if(!a)return!1;var s=a.closest("li");return this._ul.removeChild(s),!0}},_remove_tag:function(t){var e=t.closest("li"),n=e.querySelector(".label").innerText;this._ul.removeChild(e),this.remove_tag(n,!1)}},i}.apply(e,[]))||(t.exports=i)}},e={};function n(i){var a=e[i];if(void 0!==a)return a.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t,e,i=n(8870),a=n.n(i);t=window.code_snippets_tags,(e=document.getElementById("snippet_tags"))&&a()(e,{completion:{list:t.available_tags,delay:400,min_length:2},allow_spaces:t.allow_spaces,allow_duplicates:!1,link:function(){return!1}})})()})();
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**@license
|
2 |
+
* _____
|
3 |
+
* |_ _|___ ___ ___ ___ ___
|
4 |
+
* | | | .'| . | . | -_| _|
|
5 |
+
* |_| |__,|_ |_ |___|_|
|
6 |
+
* |___|___| version 0.4.2
|
7 |
+
*
|
8 |
+
* Tagger - Zero dependency, Vanilla JavaScript Tag Editor
|
9 |
+
*
|
10 |
+
* Copyright (c) 2018-2021 Jakub T. Jankiewicz <https://jcubic.pl/me>
|
11 |
+
* Released under the MIT license
|
12 |
+
*/
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
import { loadSnippetTagEditor } from './edit/tags'
|
2 |
+
|
3 |
+
loadSnippetTagEditor()
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { handleFormSubmitValidation } from './edit/validate'
|
2 |
+
import { handleSnippetTypeTabs } from './edit/tabs'
|
3 |
+
import { handleClipboardCopy } from './edit/clipboard'
|
4 |
+
import { handleContentShortcodeOptions } from './edit/shortcode'
|
5 |
+
import { loadSnippetCodeEditor } from './edit/editor'
|
6 |
+
|
7 |
+
loadSnippetCodeEditor()
|
8 |
+
handleSnippetTypeTabs()
|
9 |
+
handleContentShortcodeOptions()
|
10 |
+
handleFormSubmitValidation()
|
11 |
+
handleClipboardCopy()
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const COPY_ICON = 'dashicon-clipboard'
|
2 |
+
const SUCCESS_ICON = 'dashicon-yes'
|
3 |
+
const TIMEOUT = 3000
|
4 |
+
|
5 |
+
export const handleClipboardCopy = () => {
|
6 |
+
for (const button of document.querySelectorAll<HTMLElement>('.code-snippets-copy-text')) {
|
7 |
+
if (navigator.clipboard) {
|
8 |
+
button.addEventListener('click', event => {
|
9 |
+
event.preventDefault()
|
10 |
+
const text = button.getAttribute('data-text')
|
11 |
+
if (text) {
|
12 |
+
navigator.clipboard.writeText(text)
|
13 |
+
.then(() => {
|
14 |
+
button.classList.replace(COPY_ICON, SUCCESS_ICON)
|
15 |
+
setTimeout(() => button.classList.replace(SUCCESS_ICON, COPY_ICON), TIMEOUT)
|
16 |
+
})
|
17 |
+
.catch(error => console.error(error))
|
18 |
+
}
|
19 |
+
})
|
20 |
+
} else {
|
21 |
+
button.style.display = 'none'
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import '../editor'
|
2 |
+
|
3 |
+
export const loadSnippetCodeEditor = () => {
|
4 |
+
const { codeEditor } = window.wp
|
5 |
+
|
6 |
+
const textarea = document.getElementById('snippet_code')
|
7 |
+
|
8 |
+
if (!textarea) {
|
9 |
+
console.error('Could not initialise CodeMirror on textarea.', textarea)
|
10 |
+
return
|
11 |
+
}
|
12 |
+
|
13 |
+
const editor = codeEditor.initialize(textarea)
|
14 |
+
window.code_snippets_editor = editor
|
15 |
+
|
16 |
+
const extraKeys = editor.codemirror.getOption('extraKeys')
|
17 |
+
const controlKey = window.navigator.platform.match('Mac') ? 'Cmd' : 'Ctrl'
|
18 |
+
const saveSnippet = () => document.getElementById('save_snippet')?.click()
|
19 |
+
|
20 |
+
editor.codemirror.setOption('extraKeys', {
|
21 |
+
...'object' === typeof extraKeys ? extraKeys : {},
|
22 |
+
[`${controlKey}-S`]: saveSnippet,
|
23 |
+
[`${controlKey}-Enter`]: saveSnippet,
|
24 |
+
})
|
25 |
+
|
26 |
+
if (window.navigator.platform.match('Mac')) {
|
27 |
+
const helpText = document.querySelector('.editor-help-text')
|
28 |
+
if (helpText) {
|
29 |
+
helpText.className += ' platform-mac'
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
const directionControl = document.getElementById('snippet-code-direction') as HTMLSelectElement | null
|
34 |
+
directionControl?.addEventListener('change', () => {
|
35 |
+
window.code_snippets_editor?.codemirror.setOption('direction', 'rtl' === directionControl.value ? 'rtl' : 'ltr')
|
36 |
+
})
|
37 |
+
}
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const updateShortcode = (options: HTMLCollectionOf<HTMLInputElement>) => {
|
2 |
+
const isNetworkAdmin = -1 !== document.body.className.indexOf('network-admin')
|
3 |
+
|
4 |
+
const snippetIdInput = document.querySelector<HTMLInputElement>('input[name=snippet_id]')
|
5 |
+
const snippetId = snippetIdInput ? parseInt(snippetIdInput.value, 10) : 0
|
6 |
+
|
7 |
+
let shortcode = '[code_snippet'
|
8 |
+
|
9 |
+
if (snippetId) {
|
10 |
+
shortcode += ` id=${snippetId}`
|
11 |
+
}
|
12 |
+
|
13 |
+
if (isNetworkAdmin) {
|
14 |
+
shortcode += ' network=true'
|
15 |
+
}
|
16 |
+
|
17 |
+
for (const option of options) {
|
18 |
+
if (option.checked) {
|
19 |
+
shortcode += ` ${option.value}=true`
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
shortcode += ']'
|
24 |
+
|
25 |
+
const scopes = document.querySelector('.html-scopes-list')
|
26 |
+
if (scopes) {
|
27 |
+
const shortcodeScope = scopes.querySelector('.shortcode-tag')
|
28 |
+
if (shortcodeScope) {
|
29 |
+
shortcodeScope.textContent = shortcode
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
export const handleContentShortcodeOptions = () => {
|
35 |
+
const options = document.querySelector('.html-shortcode-options')?.getElementsByTagName('input')
|
36 |
+
|
37 |
+
if (options) {
|
38 |
+
for (const option of options) {
|
39 |
+
option.addEventListener('change', () => updateShortcode(options))
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { SnippetType } from '../types/snippet'
|
2 |
+
import { EditorConfiguration } from 'codemirror'
|
3 |
+
|
4 |
+
const EDITOR_MODES: Record<SnippetType, string> = {
|
5 |
+
css: 'text/css',
|
6 |
+
js: 'javascript',
|
7 |
+
php: 'text/x-php',
|
8 |
+
html: 'application/x-httpd-php'
|
9 |
+
}
|
10 |
+
|
11 |
+
const selectScope = (type: SnippetType, snippetForm: HTMLElement | null) => {
|
12 |
+
const editor = window.code_snippets_editor?.codemirror
|
13 |
+
const scope = snippetForm?.querySelector<HTMLInputElement>(`.${type}-scopes-list input:first-child`)
|
14 |
+
|
15 |
+
if (scope) {
|
16 |
+
scope.checked = true
|
17 |
+
}
|
18 |
+
|
19 |
+
editor?.setOption('lint' as keyof EditorConfiguration, 'php' === type || 'css' === type)
|
20 |
+
if (type in EDITOR_MODES) {
|
21 |
+
editor?.setOption('mode', EDITOR_MODES[type])
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
const switchTab = (tabsContainer: HTMLElement, tab: Element) => {
|
26 |
+
const prevActive = tabsContainer.querySelector('.nav-tab-active')
|
27 |
+
prevActive?.setAttribute('href', '#')
|
28 |
+
prevActive?.classList.remove('nav-tab-active')
|
29 |
+
|
30 |
+
tab.classList.add('nav-tab-active')
|
31 |
+
tab.removeAttribute('href')
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
export const handleSnippetTypeTabs = () => {
|
36 |
+
const tabsContainer = document.getElementById('snippet-type-tabs')
|
37 |
+
|
38 |
+
if (!tabsContainer) {
|
39 |
+
return
|
40 |
+
}
|
41 |
+
|
42 |
+
const snippetForm = document.getElementById('snippet-form')
|
43 |
+
const tabs = tabsContainer.querySelectorAll('.nav-tab')
|
44 |
+
|
45 |
+
for (const tab of tabs) {
|
46 |
+
tab.addEventListener('click', event => {
|
47 |
+
if (tab.classList.contains('nav-tab-active') || tab.classList.contains('nav-tab-inactive')) return
|
48 |
+
const type = tab.getAttribute('data-type') as SnippetType
|
49 |
+
event.preventDefault()
|
50 |
+
|
51 |
+
// Update the form styles to match the new type.
|
52 |
+
snippetForm?.setAttribute('data-snippet-type', type)
|
53 |
+
|
54 |
+
// Switch the active tab and change the snippet scope.
|
55 |
+
switchTab(tabsContainer, tab)
|
56 |
+
selectScope(type, snippetForm)
|
57 |
+
})
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tagger from '@jcubic/tagger'
|
2 |
+
|
3 |
+
export const loadSnippetTagEditor = () => {
|
4 |
+
const tags = window.code_snippets_tags
|
5 |
+
const tagsField = document.getElementById('snippet_tags')
|
6 |
+
|
7 |
+
if (!tagsField) {
|
8 |
+
return
|
9 |
+
}
|
10 |
+
|
11 |
+
tagger(tagsField, {
|
12 |
+
completion: {
|
13 |
+
list: tags.available_tags,
|
14 |
+
delay: 400,
|
15 |
+
min_length: 2
|
16 |
+
},
|
17 |
+
allow_spaces: tags.allow_spaces,
|
18 |
+
allow_duplicates: false,
|
19 |
+
link: () => false
|
20 |
+
})
|
21 |
+
}
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const handleFormSubmitValidation = () => {
|
2 |
+
const form = document.getElementById('snippet-form')
|
3 |
+
const editor = window.code_snippets_editor?.codemirror
|
4 |
+
const strings = window.code_snippets_edit_i18n
|
5 |
+
const snippetName = document.querySelector('input[name=snippet_name]') as HTMLInputElement
|
6 |
+
|
7 |
+
if (!form || !editor || !snippetName) {
|
8 |
+
return
|
9 |
+
}
|
10 |
+
|
11 |
+
form.addEventListener('submit', (event: SubmitEvent) => {
|
12 |
+
const missingTitle = '' === snippetName.value.trim()
|
13 |
+
const missingCode = '' === editor.getValue().trim()
|
14 |
+
|
15 |
+
const message = missingTitle ?
|
16 |
+
missingCode ? strings.missing_title_code : strings.missing_title :
|
17 |
+
missingCode ? strings.missing_code : ''
|
18 |
+
|
19 |
+
if (event?.submitter?.id.startsWith('save_snippet') && message && !confirm(message)) {
|
20 |
+
event.preventDefault()
|
21 |
+
}
|
22 |
+
})
|
23 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { defineMode, getMode, EditorConfiguration, ModeSpec } from 'codemirror'
|
2 |
+
import './php-lint'
|
3 |
+
|
4 |
+
type ModeSpecOptions = {
|
5 |
+
startOpen: boolean
|
6 |
+
}
|
7 |
+
|
8 |
+
/** Define a new mode which starts the phpmixed mode in php mode instead of html mode */
|
9 |
+
defineMode('php-snippet', (config: EditorConfiguration) =>
|
10 |
+
getMode(config, <ModeSpec<ModeSpecOptions>> {
|
11 |
+
name: 'application/x-httpd-php',
|
12 |
+
startOpen: true
|
13 |
+
})
|
14 |
+
)
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { handleSnippetActivationSwitches } from './manage/activation'
|
2 |
+
import { handleSnippetPriorityChanges } from './manage/priority'
|
3 |
+
|
4 |
+
handleSnippetActivationSwitches()
|
5 |
+
handleSnippetPriorityChanges()
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Snippet } from '../types/snippet'
|
2 |
+
import { updateSnippet } from './requests'
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Update the snippet count of a specific view
|
6 |
+
* @param element
|
7 |
+
* @param increment
|
8 |
+
*/
|
9 |
+
const updateViewCount = (element: HTMLElement, increment: boolean) => {
|
10 |
+
if (element?.textContent) {
|
11 |
+
let count = parseInt(element.textContent.replace(/\((?<count>\d+)\)/, '$1'), 10)
|
12 |
+
count += increment ? 1 : -1
|
13 |
+
element.textContent = `(${count})`
|
14 |
+
} else {
|
15 |
+
console.error('Could not update view count.', element)
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Activate an inactive snippet, or deactivate an active snippet
|
21 |
+
* @param link
|
22 |
+
* @param event
|
23 |
+
*/
|
24 |
+
export const toggleSnippetActive = (link: HTMLAnchorElement, event: Event) => {
|
25 |
+
const strings = window.code_snippets_manage_i18n
|
26 |
+
|
27 |
+
const row = link?.parentElement?.parentElement // Switch < cell < row
|
28 |
+
if (!row) {
|
29 |
+
console.error('Could not toggle snippet active status.', row)
|
30 |
+
return
|
31 |
+
}
|
32 |
+
|
33 |
+
const match = row.className.match(/\b(?:in)?active-snippet\b/)
|
34 |
+
if (!match) return
|
35 |
+
|
36 |
+
event.preventDefault()
|
37 |
+
|
38 |
+
const activating = 'inactive-snippet' === match[0]
|
39 |
+
const snippet: Partial<Snippet> = { active: activating }
|
40 |
+
|
41 |
+
updateSnippet('active', row, snippet, response => {
|
42 |
+
const button = row.querySelector('.snippet-activation-switch') as HTMLAnchorElement
|
43 |
+
|
44 |
+
if (response.success) {
|
45 |
+
row.className = activating ?
|
46 |
+
row.className.replace(/\binactive-snippet\b/, 'active-snippet') :
|
47 |
+
row.className.replace(/\bactive-snippet\b/, 'inactive-snippet')
|
48 |
+
|
49 |
+
const views = document.querySelector('.subsubsub')
|
50 |
+
const activeCount = views?.querySelector<HTMLElement>('.active .count')
|
51 |
+
const inactiveCount = views?.querySelector<HTMLElement>('.inactive .count')
|
52 |
+
|
53 |
+
activeCount ? updateViewCount(activeCount, activating) : null
|
54 |
+
inactiveCount ? updateViewCount(inactiveCount, activating) : null
|
55 |
+
|
56 |
+
button.title = activating ? strings.deactivate : strings.activate
|
57 |
+
} else {
|
58 |
+
row.className += ' erroneous-snippet'
|
59 |
+
button.title = strings.activation_error
|
60 |
+
}
|
61 |
+
})
|
62 |
+
}
|
63 |
+
|
64 |
+
export const handleSnippetActivationSwitches = () => {
|
65 |
+
for (const link of document.getElementsByClassName('snippet-activation-switch')) {
|
66 |
+
link.addEventListener('click', event => toggleSnippetActive(link as HTMLAnchorElement, event))
|
67 |
+
}
|
68 |
+
}
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Snippet } from '../types/snippet'
|
2 |
+
import { updateSnippet } from './requests'
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Update the priority of a snippet
|
6 |
+
*/
|
7 |
+
export const updateSnippetPriority = (element: HTMLInputElement) => {
|
8 |
+
const row = element.parentElement?.parentElement
|
9 |
+
const snippet: Partial<Snippet> = { priority: parseFloat(element.value) }
|
10 |
+
if (row) {
|
11 |
+
updateSnippet('priority', row, snippet)
|
12 |
+
} else {
|
13 |
+
console.error('Could not update snippet information.', snippet, row)
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
export const handleSnippetPriorityChanges = () => {
|
19 |
+
for (const field of document.getElementsByClassName('snippet-priority') as HTMLCollectionOf<HTMLInputElement>) {
|
20 |
+
field.addEventListener('input', () => updateSnippetPriority(field))
|
21 |
+
field.disabled = false
|
22 |
+
}
|
23 |
+
}
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Snippet } from '../types/snippet'
|
2 |
+
|
3 |
+
export type SuccessCallback = (response: { success: boolean, data?: unknown }) => void
|
4 |
+
|
5 |
+
const isNetworkAdmin = () =>
|
6 |
+
'-network' === window.pagenow.substring(window.pagenow.length - '-network'.length)
|
7 |
+
|
8 |
+
const sendSnippetRequest = (query: string, onSuccess?: SuccessCallback) => {
|
9 |
+
const request = new XMLHttpRequest()
|
10 |
+
request.open('POST', window.ajaxurl, true)
|
11 |
+
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded charset=UTF-8')
|
12 |
+
|
13 |
+
request.onload = () => {
|
14 |
+
const success = 200
|
15 |
+
const errorStart = 400
|
16 |
+
if (success > request.status || errorStart <= request.status) return
|
17 |
+
// eslint-disable-next-line no-console
|
18 |
+
console.info(request.responseText)
|
19 |
+
|
20 |
+
onSuccess?.(JSON.parse(request.responseText))
|
21 |
+
}
|
22 |
+
|
23 |
+
request.send(query)
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Update the data of a given snippet using AJAX
|
28 |
+
* @param field
|
29 |
+
* @param row
|
30 |
+
* @param snippet
|
31 |
+
* @param successCallback
|
32 |
+
*/
|
33 |
+
export const updateSnippet = (field: keyof Snippet, row: Element, snippet: Partial<Snippet>, successCallback?: SuccessCallback) => {
|
34 |
+
const nonce = document.getElementById('code_snippets_ajax_nonce') as HTMLInputElement | null
|
35 |
+
const columnId = row.querySelector('.column-id')
|
36 |
+
|
37 |
+
if (!nonce || !columnId?.textContent || !parseInt(columnId.textContent, 10)) {
|
38 |
+
return
|
39 |
+
}
|
40 |
+
|
41 |
+
snippet.id = parseInt(columnId.textContent, 10)
|
42 |
+
snippet.shared_network = Boolean(row.className.match(/\bshared-network-snippet\b/))
|
43 |
+
snippet.network = snippet.shared_network || isNetworkAdmin()
|
44 |
+
snippet.scope = row.getAttribute('data-snippet-scope') ?? snippet.scope
|
45 |
+
|
46 |
+
const queryString = `action=update_code_snippet&_ajax_nonce=${nonce.value}&field=${field}&snippet=${JSON.stringify(snippet)}`
|
47 |
+
sendSnippetRequest(queryString, successCallback)
|
48 |
+
}
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import * as tinymce from 'tinymce'
|
2 |
+
import { Editor } from 'tinymce'
|
3 |
+
|
4 |
+
interface SourceShortcodeOps {
|
5 |
+
id: string
|
6 |
+
line_numbers: boolean
|
7 |
+
}
|
8 |
+
|
9 |
+
interface ContentShortcodeOps {
|
10 |
+
id: string
|
11 |
+
php: boolean
|
12 |
+
format: boolean
|
13 |
+
shortcodes: boolean
|
14 |
+
}
|
15 |
+
|
16 |
+
interface WordPressEditor extends Editor {
|
17 |
+
getLang: (s: string) => string | Record<string, string>
|
18 |
+
}
|
19 |
+
|
20 |
+
const convertToValues = (array: Record<string, string>) =>
|
21 |
+
Object.keys(array).map(key => ({
|
22 |
+
text: array[Number(key)],
|
23 |
+
value: key
|
24 |
+
}))
|
25 |
+
|
26 |
+
const insertContentMenu = (editor: Editor, activeEditor: WordPressEditor) => ({
|
27 |
+
text: activeEditor.getLang('code_snippets.insert_source_menu'),
|
28 |
+
onclick: () => {
|
29 |
+
editor.windowManager.open({
|
30 |
+
title: activeEditor.getLang('code_snippets.insert_source_title'),
|
31 |
+
body: [
|
32 |
+
{
|
33 |
+
type: 'listbox',
|
34 |
+
name: 'id',
|
35 |
+
label: activeEditor.getLang('code_snippets.snippet_label'),
|
36 |
+
values: convertToValues(activeEditor.getLang('code_snippets.all_snippets') as Record<string, string>),
|
37 |
+
},
|
38 |
+
{
|
39 |
+
type: 'checkbox',
|
40 |
+
name: 'line_numbers',
|
41 |
+
label: activeEditor.getLang('code_snippets.show_line_numbers_label'),
|
42 |
+
}
|
43 |
+
],
|
44 |
+
onsubmit: (event: { data: SourceShortcodeOps }) => {
|
45 |
+
const id = parseInt(event.data.id, 10)
|
46 |
+
if (!id) return
|
47 |
+
|
48 |
+
let atts = ''
|
49 |
+
|
50 |
+
if (event.data.line_numbers) {
|
51 |
+
atts += ' line_numbers=true'
|
52 |
+
}
|
53 |
+
|
54 |
+
editor.insertContent(`[code_snippet_source id=${id}${atts}]`)
|
55 |
+
}
|
56 |
+
}, {})
|
57 |
+
}
|
58 |
+
})
|
59 |
+
|
60 |
+
const insertSourceMenu = (editor: Editor, ed: WordPressEditor) => ({
|
61 |
+
text: ed.getLang('code_snippets.insert_content_menu'),
|
62 |
+
onclick: () => {
|
63 |
+
editor.windowManager.open({
|
64 |
+
title: ed.getLang('code_snippets.insert_content_title'),
|
65 |
+
body: [
|
66 |
+
{
|
67 |
+
type: 'listbox',
|
68 |
+
name: 'id',
|
69 |
+
label: ed.getLang('code_snippets.snippet_label'),
|
70 |
+
values: convertToValues(ed.getLang('code_snippets.content_snippets') as Record<string, string>),
|
71 |
+
},
|
72 |
+
{
|
73 |
+
type: 'checkbox',
|
74 |
+
name: 'php',
|
75 |
+
label: ed.getLang('code_snippets.php_att_label'),
|
76 |
+
},
|
77 |
+
{
|
78 |
+
type: 'checkbox',
|
79 |
+
name: 'format',
|
80 |
+
label: ed.getLang('code_snippets.format_att_label'),
|
81 |
+
},
|
82 |
+
{
|
83 |
+
type: 'checkbox',
|
84 |
+
name: 'shortcodes',
|
85 |
+
label: ed.getLang('code_snippets.shortcodes_att_label'),
|
86 |
+
}
|
87 |
+
],
|
88 |
+
onsubmit: (event: { data: ContentShortcodeOps }) => {
|
89 |
+
const id = parseInt(event.data.id, 10)
|
90 |
+
if (!id) return
|
91 |
+
|
92 |
+
let atts = ''
|
93 |
+
|
94 |
+
for (const [opt, val] of Object.entries(event.data)) {
|
95 |
+
if ('id' !== opt && val) {
|
96 |
+
atts += ` ${opt}=${val}`
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
editor.insertContent(`[code_snippet id=${id}${atts}]`)
|
101 |
+
}
|
102 |
+
}, {})
|
103 |
+
}
|
104 |
+
})
|
105 |
+
|
106 |
+
tinymce.PluginManager.add('code_snippets', editor => {
|
107 |
+
const activeEditor = tinymce.activeEditor as WordPressEditor
|
108 |
+
|
109 |
+
editor.addButton('code_snippets', {
|
110 |
+
icon: 'code',
|
111 |
+
menu: [insertContentMenu(editor, activeEditor), insertSourceMenu(editor, activeEditor)],
|
112 |
+
type: 'menubutton'
|
113 |
+
})
|
114 |
+
})
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Based on work distributed under the BSD 3-Clause License (https://rawgit.com/glayzzle/codemirror-linter/master/LICENSE)
|
3 |
+
*/
|
4 |
+
|
5 |
+
import Parser, { Block, Location, Node } from 'php-parser'
|
6 |
+
import * as CodeMirror from 'codemirror'
|
7 |
+
|
8 |
+
type Annotation = { message: string, severity: string, from: CodeMirror.Position, to: CodeMirror.Position }
|
9 |
+
|
10 |
+
interface Identifier extends Node {
|
11 |
+
name: string
|
12 |
+
}
|
13 |
+
|
14 |
+
interface Declaration extends Node {
|
15 |
+
name: Identifier | string
|
16 |
+
}
|
17 |
+
|
18 |
+
class Linter {
|
19 |
+
private readonly code: string
|
20 |
+
|
21 |
+
private readonly function_names: Set<string>
|
22 |
+
|
23 |
+
private readonly class_names: Set<string>
|
24 |
+
|
25 |
+
public readonly annotations: Annotation[]
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Constructor.
|
29 |
+
* @param code
|
30 |
+
*/
|
31 |
+
constructor(code: string) {
|
32 |
+
this.code = code
|
33 |
+
this.annotations = []
|
34 |
+
|
35 |
+
this.function_names = new Set()
|
36 |
+
this.class_names = new Set()
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Lint the provided code.
|
41 |
+
*/
|
42 |
+
lint() {
|
43 |
+
const parser = new Parser({
|
44 |
+
parser: {
|
45 |
+
suppressErrors: true,
|
46 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
47 |
+
// @ts-ignore types file has not been updated to support this
|
48 |
+
version: 800
|
49 |
+
},
|
50 |
+
ast: {
|
51 |
+
withPositions: true
|
52 |
+
}
|
53 |
+
})
|
54 |
+
|
55 |
+
try {
|
56 |
+
const ast = parser.parseEval(this.code)
|
57 |
+
|
58 |
+
// Process any errors caught by the parser.
|
59 |
+
if (ast.errors && 0 < ast.errors.length) {
|
60 |
+
for (const error of ast.errors) {
|
61 |
+
this.annotate(error.message as string, error.loc)
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
// Visit each node to perform additional checks.
|
66 |
+
this.visit(ast)
|
67 |
+
|
68 |
+
} catch (error) {
|
69 |
+
// eslint-disable-next-line no-console
|
70 |
+
console.error(error)
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Visit nodes recursively.
|
76 |
+
* @param node
|
77 |
+
*/
|
78 |
+
visit(node: Node) {
|
79 |
+
|
80 |
+
if (node.kind) {
|
81 |
+
this.validate(node)
|
82 |
+
}
|
83 |
+
|
84 |
+
if ('children' in node) {
|
85 |
+
const block = node as Block
|
86 |
+
for (const child of block.children) {
|
87 |
+
this.visit(child)
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Check whether a given identifier has already been defined, creating an annotation if so.
|
94 |
+
* @param identifier
|
95 |
+
* @param registry
|
96 |
+
* @param label
|
97 |
+
*/
|
98 |
+
checkDuplicateIdentifier(identifier: Identifier, registry: Set<string>, label: string) {
|
99 |
+
if (registry.has(identifier.name)) {
|
100 |
+
this.annotate(`Cannot redeclare ${label} ${identifier.name}()`, identifier.loc)
|
101 |
+
} else {
|
102 |
+
registry.add(identifier.name)
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Perform additional validations on nodes.
|
108 |
+
* @param node
|
109 |
+
*/
|
110 |
+
validate(node: Node) {
|
111 |
+
const decl = node as Declaration
|
112 |
+
const ident = decl.name as Identifier
|
113 |
+
|
114 |
+
if (!('name' in decl && 'name' in ident) || 'identifier' !== ident.kind) {
|
115 |
+
return
|
116 |
+
}
|
117 |
+
|
118 |
+
if ('function' === node.kind) {
|
119 |
+
this.checkDuplicateIdentifier(ident, this.function_names, 'function')
|
120 |
+
|
121 |
+
} else if ('class' === node.kind) {
|
122 |
+
this.checkDuplicateIdentifier(ident, this.class_names, 'class')
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Create a lint annotation.
|
128 |
+
* @param message
|
129 |
+
* @param location
|
130 |
+
* @param severity
|
131 |
+
*/
|
132 |
+
annotate(message: string, location: Location, severity = 'error') {
|
133 |
+
if (!location.start || !location.end) return
|
134 |
+
|
135 |
+
const [start, end] = location.end.offset < location.start.offset ?
|
136 |
+
[location.end, location.start] :
|
137 |
+
[location.start, location.end]
|
138 |
+
|
139 |
+
this.annotations.push({
|
140 |
+
message,
|
141 |
+
severity,
|
142 |
+
from: CodeMirror.Pos(start.line as number - 1, start.column as number),
|
143 |
+
to: CodeMirror.Pos(end.line as number - 1, end.column as number)
|
144 |
+
})
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
CodeMirror.registerHelper('lint', 'php', (text: string) => {
|
149 |
+
const linter = new Linter(text)
|
150 |
+
linter.lint()
|
151 |
+
|
152 |
+
return linter.annotations
|
153 |
+
})
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import * as Prism from 'prismjs'
|
2 |
+
import 'prismjs/components/prism-markup'
|
3 |
+
import 'prismjs/components/prism-markup-templating'
|
4 |
+
import 'prismjs/components/prism-clike'
|
5 |
+
import 'prismjs/components/prism-css'
|
6 |
+
import 'prismjs/components/prism-php'
|
7 |
+
import 'prismjs/components/prism-javascript'
|
8 |
+
import 'prismjs/plugins/line-highlight/prism-line-highlight'
|
9 |
+
import 'prismjs/plugins/line-numbers/prism-line-numbers'
|
10 |
+
import 'prismjs/plugins/toolbar/prism-toolbar'
|
11 |
+
import 'prismjs/plugins/show-language/prism-show-language'
|
12 |
+
import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard'
|
13 |
+
import 'prismjs/plugins/inline-color/prism-inline-color'
|
14 |
+
import 'prismjs/plugins/previewers/prism-previewers'
|
15 |
+
import 'prismjs/plugins/autolinker/prism-autolinker'
|
16 |
+
|
17 |
+
document.addEventListener('readystatechange', () => {
|
18 |
+
if ('complete' === document.readyState) {
|
19 |
+
Prism.highlightAll()
|
20 |
+
}
|
21 |
+
})
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { handleSettingsTabs } from './settings/tabs'
|
2 |
+
import { handleEditorPreviewUpdates } from './settings/editor-preview'
|
3 |
+
|
4 |
+
handleSettingsTabs()
|
5 |
+
handleEditorPreviewUpdates()
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import '../editor'
|
2 |
+
|
3 |
+
const parseSelect = (select: HTMLSelectElement) => select.options[select.selectedIndex].value
|
4 |
+
const parseCheckbox = (checkbox: HTMLInputElement) => checkbox.checked
|
5 |
+
const parseNumber = (input: HTMLInputElement) => parseInt(input.value, 10)
|
6 |
+
|
7 |
+
const initialiseCodeMirror = () => {
|
8 |
+
const { codeEditor } = window.wp
|
9 |
+
const textarea = document.getElementById('code_snippets_editor_preview')
|
10 |
+
|
11 |
+
if (textarea) {
|
12 |
+
window.code_snippets_editor_preview = codeEditor.initialize(textarea)
|
13 |
+
return window.code_snippets_editor_preview.codemirror
|
14 |
+
}
|
15 |
+
|
16 |
+
console.error('Could not initialise CodeMirror on textarea.', textarea)
|
17 |
+
}
|
18 |
+
|
19 |
+
export const handleEditorPreviewUpdates = () => {
|
20 |
+
const editor = initialiseCodeMirror()
|
21 |
+
const editorSettings = window.code_snippets_editor_settings
|
22 |
+
|
23 |
+
for (const setting of editorSettings) {
|
24 |
+
const element = document.querySelector(`[name="code_snippets_settings[editor][${setting.name}]"]`)
|
25 |
+
|
26 |
+
element?.addEventListener('change', () => {
|
27 |
+
const opt = setting.codemirror
|
28 |
+
|
29 |
+
const value = (() => {
|
30 |
+
switch (setting.type) {
|
31 |
+
case 'select':
|
32 |
+
return parseSelect(element as HTMLSelectElement)
|
33 |
+
case 'checkbox':
|
34 |
+
return parseCheckbox(element as HTMLInputElement)
|
35 |
+
case 'number':
|
36 |
+
return parseNumber(element as HTMLInputElement)
|
37 |
+
default:
|
38 |
+
return null
|
39 |
+
}
|
40 |
+
})()
|
41 |
+
|
42 |
+
if (null !== value) {
|
43 |
+
editor?.setOption(opt, value)
|
44 |
+
}
|
45 |
+
})
|
46 |
+
}
|
47 |
+
}
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const selectTab = (tabsWrapper: Element, tab: Element, section: string) => {
|
2 |
+
// Swap the active tab class from the previously active tab to the current one.
|
3 |
+
tabsWrapper.querySelector('.nav-tab-active')?.classList.remove('nav-tab-active')
|
4 |
+
tab.classList.add('nav-tab-active')
|
5 |
+
|
6 |
+
// Update the current active tab attribute so that only the active tab is displayed.
|
7 |
+
tabsWrapper.closest('.wrap')?.setAttribute('data-active-tab', section)
|
8 |
+
}
|
9 |
+
|
10 |
+
// Refresh the editor preview if we're viewing the editor section.
|
11 |
+
const refreshEditorPreview = (section: string) => {
|
12 |
+
if ('editor' === section) {
|
13 |
+
window.code_snippets_editor_preview?.codemirror.refresh()
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
// Update the http referer value so that any redirections lead back to this tab.
|
18 |
+
const updateHttpReferer = (section: string) => {
|
19 |
+
const httpReferer = document.querySelector<HTMLInputElement>('input[name=_wp_http_referer]')
|
20 |
+
if (!httpReferer) {
|
21 |
+
console.error('could not find http referer')
|
22 |
+
return
|
23 |
+
}
|
24 |
+
|
25 |
+
const newReferer = httpReferer.value.replace(/(?<base>[&?]section=)[^&]+/, `$1${section}`)
|
26 |
+
httpReferer.value = newReferer + (newReferer === httpReferer.value ? `§ion=${section}` : '')
|
27 |
+
}
|
28 |
+
|
29 |
+
export const handleSettingsTabs = () => {
|
30 |
+
const tabsWrapper = document.getElementById('settings-sections-tabs')
|
31 |
+
if (!tabsWrapper) {
|
32 |
+
console.error('Could not find snippets tabs')
|
33 |
+
return
|
34 |
+
}
|
35 |
+
|
36 |
+
const tabs = tabsWrapper.querySelectorAll('.nav-tab') ?? []
|
37 |
+
|
38 |
+
for (const tab of tabs) {
|
39 |
+
tab.addEventListener('click', event => {
|
40 |
+
event.preventDefault()
|
41 |
+
const section = tab.getAttribute('data-section')
|
42 |
+
|
43 |
+
if (section) {
|
44 |
+
selectTab(tabsWrapper, tab, section)
|
45 |
+
refreshEditorPreview(section)
|
46 |
+
updateHttpReferer(section)
|
47 |
+
}
|
48 |
+
})
|
49 |
+
}
|
50 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Editor, EditorConfiguration } from 'codemirror'
|
2 |
+
|
3 |
+
export interface EditorOption {
|
4 |
+
name: string
|
5 |
+
type: 'checkbox' | 'number' | 'select'
|
6 |
+
codemirror: keyof EditorConfiguration
|
7 |
+
}
|
8 |
+
|
9 |
+
export interface CodeEditorInstance {
|
10 |
+
codemirror: Editor
|
11 |
+
settings: CodeEditorSettings
|
12 |
+
}
|
13 |
+
|
14 |
+
export interface CodeEditorSettings {
|
15 |
+
codemirror: EditorConfiguration
|
16 |
+
csslint: Record<string, unknown>
|
17 |
+
htmlhint: Record<string, unknown>
|
18 |
+
jshint: Record<string, unknown>
|
19 |
+
onTabNext: () => void
|
20 |
+
onTabPrevious: () => void
|
21 |
+
onChangeLintingErrors: () => void
|
22 |
+
onUpdateErrorNotice: () => void
|
23 |
+
}
|
24 |
+
|
25 |
+
export interface WordPressUtils {
|
26 |
+
codeEditor: {
|
27 |
+
initialize: (textarea: Element, options?: Partial<CodeEditorSettings>) => CodeEditorInstance
|
28 |
+
defaultSettings: CodeEditorSettings
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
declare module 'gulp-rtlcss' {
|
2 |
+
import { Transform } from 'stream'
|
3 |
+
import { ConfigOptions } from 'rtlcss'
|
4 |
+
export default function (config?: ConfigOptions): Transform
|
5 |
+
}
|
6 |
+
|
7 |
+
declare module 'gulp-remove-sourcemaps' {
|
8 |
+
import { Transform } from 'stream'
|
9 |
+
export default function (): Transform
|
10 |
+
}
|
11 |
+
|
12 |
+
declare module 'postcss-easy-import' {
|
13 |
+
import { Plugin } from 'postcss'
|
14 |
+
export default function (opts: {
|
15 |
+
prefix: string | boolean
|
16 |
+
extensions: string | string[]
|
17 |
+
}): Plugin
|
18 |
+
}
|
19 |
+
|
20 |
+
declare module 'postcss-hexrgba' {
|
21 |
+
import { Plugin } from 'postcss'
|
22 |
+
export default function (): Plugin
|
23 |
+
}
|
24 |
+
|
25 |
+
declare module 'gulp-eslint' {
|
26 |
+
import { Transform } from 'stream'
|
27 |
+
export default gulpEslint
|
28 |
+
|
29 |
+
const gulpEslint: {
|
30 |
+
(): Transform
|
31 |
+
format(formatter?: string, output?: WritableStream): Transform
|
32 |
+
formatEach(formatter?: string, output?: WritableStream): Transform
|
33 |
+
failAfterError(): Transform
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
declare module 'gulp-phpcs' {
|
38 |
+
import { Transform } from 'stream'
|
39 |
+
const phpcs: {
|
40 |
+
(options?: {
|
41 |
+
bin?: string
|
42 |
+
severity?: number
|
43 |
+
warningSeverity?: number
|
44 |
+
errorSeverity?: number
|
45 |
+
standard?: string
|
46 |
+
encoding?: string
|
47 |
+
report?: string
|
48 |
+
showSniffCode?: boolean
|
49 |
+
sniffs?: string[]
|
50 |
+
ignore?: string[]
|
51 |
+
cwd?: string
|
52 |
+
colors?: boolean
|
53 |
+
}): Transform
|
54 |
+
reporter(name: 'fail' | 'log' | 'file', options?: {
|
55 |
+
failOnFirst?: boolean
|
56 |
+
path?: string
|
57 |
+
}): Transform
|
58 |
+
}
|
59 |
+
export default phpcs
|
60 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export type SnippetType = 'css' | 'js' | 'php' | 'html'
|
2 |
+
|
3 |
+
export interface Snippet {
|
4 |
+
id: number
|
5 |
+
name: string
|
6 |
+
scope: string
|
7 |
+
active: boolean
|
8 |
+
network: boolean
|
9 |
+
shared_network: boolean
|
10 |
+
priority: number
|
11 |
+
type: SnippetType
|
12 |
+
}
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { CodeEditorInstance, EditorOption, WordPressUtils } from './editor'
|
2 |
+
|
3 |
+
declare global {
|
4 |
+
interface Window {
|
5 |
+
pagenow: string
|
6 |
+
ajaxurl: string
|
7 |
+
wp: WordPressUtils
|
8 |
+
code_snippets_tags: { allow_spaces: boolean, available_tags: string[] }
|
9 |
+
code_snippets_editor?: CodeEditorInstance
|
10 |
+
code_snippets_editor_preview?: CodeEditorInstance
|
11 |
+
code_snippets_editor_settings: EditorOption[]
|
12 |
+
code_snippets_edit_i18n: Record<string, string>
|
13 |
+
code_snippets_manage_i18n: Record<string, string>
|
14 |
+
}
|
15 |
+
}
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Code Snippets – WordPress Plugin
|
2 |
+
|
3 |
+
Copyright 2012-2022 Shea Bunge
|
4 |
+
|
5 |
+
This program is free software: you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License as published by
|
7 |
+
the Free Software Foundation, either version 2 of the License, or
|
8 |
+
(at your option) any later version.
|
9 |
+
|
10 |
+
This program is distributed in the hope that it will be useful,
|
11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
GNU General Public License for more details.
|
14 |
+
|
15 |
+
You should have received a copy of the GNU General Public License
|
16 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
17 |
+
|
18 |
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
19 |
+
|
20 |
+
GNU GENERAL PUBLIC LICENSE
|
21 |
+
Version 2, June 1991
|
22 |
+
|
23 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
24 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
+
Everyone is permitted to copy and distribute verbatim copies
|
26 |
+
of this license document, but changing it is not allowed.
|
27 |
+
|
28 |
+
Preamble
|
29 |
+
|
30 |
+
The licenses for most software are designed to take away your
|
31 |
+
freedom to share and change it. By contrast, the GNU General Public
|
32 |
+
License is intended to guarantee your freedom to share and change free
|
33 |
+
software--to make sure the software is free for all its users. This
|
34 |
+
General Public License applies to most of the Free Software
|
35 |
+
Foundation's software and to any other program whose authors commit to
|
36 |
+
using it. (Some other Free Software Foundation software is covered by
|
37 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
38 |
+
your programs, too.
|
39 |
+
|
40 |
+
When we speak of free software, we are referring to freedom, not
|
41 |
+
price. Our General Public Licenses are designed to make sure that you
|
42 |
+
have the freedom to distribute copies of free software (and charge for
|
43 |
+
this service if you wish), that you receive source code or can get it
|
44 |
+
if you want it, that you can change the software or use pieces of it
|
45 |
+
in new free programs; and that you know you can do these things.
|
46 |
+
|
47 |
+
To protect your rights, we need to make restrictions that forbid
|
48 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
49 |
+
These restrictions translate to certain responsibilities for you if you
|
50 |
+
distribute copies of the software, or if you modify it.
|
51 |
+
|
52 |
+
For example, if you distribute copies of such a program, whether
|
53 |
+
gratis or for a fee, you must give the recipients all the rights that
|
54 |
+
you have. You must make sure that they, too, receive or can get the
|
55 |
+
source code. And you must show them these terms so they know their
|
56 |
+
rights.
|
57 |
+
|
58 |
+
We protect your rights with two steps: (1) copyright the software, and
|
59 |
+
(2) offer you this license which gives you legal permission to copy,
|
60 |
+
distribute and/or modify the software.
|
61 |
+
|
62 |
+
Also, for each author's protection and ours, we want to make certain
|
63 |
+
that everyone understands that there is no warranty for this free
|
64 |
+
software. If the software is modified by someone else and passed on, we
|
65 |
+
want its recipients to know that what they have is not the original, so
|
66 |
+
that any problems introduced by others will not reflect on the original
|
67 |
+
authors' reputations.
|
68 |
+
|
69 |
+
Finally, any free program is threatened constantly by software
|
70 |
+
patents. We wish to avoid the danger that redistributors of a free
|
71 |
+
program will individually obtain patent licenses, in effect making the
|
72 |
+
program proprietary. To prevent this, we have made it clear that any
|
73 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
74 |
+
|
75 |
+
The precise terms and conditions for copying, distribution and
|
76 |
+
modification follow.
|
77 |
+
|
78 |
+
GNU GENERAL PUBLIC LICENSE
|
79 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
80 |
+
|
81 |
+
0. This License applies to any program or other work which contains
|
82 |
+
a notice placed by the copyright holder saying it may be distributed
|
83 |
+
under the terms of this General Public License. The "Program", below,
|
84 |
+
refers to any such program or work, and a "work based on the Program"
|
85 |
+
means either the Program or any derivative work under copyright law:
|
86 |
+
that is to say, a work containing the Program or a portion of it,
|
87 |
+
either verbatim or with modifications and/or translated into another
|
88 |
+
language. (Hereinafter, translation is included without limitation in
|
89 |
+
the term "modification".) Each licensee is addressed as "you".
|
90 |
+
|
91 |
+
Activities other than copying, distribution and modification are not
|
92 |
+
covered by this License; they are outside its scope. The act of
|
93 |
+
running the Program is not restricted, and the output from the Program
|
94 |
+
is covered only if its contents constitute a work based on the
|
95 |
+
Program (independent of having been made by running the Program).
|
96 |
+
Whether that is true depends on what the Program does.
|
97 |
+
|
98 |
+
1. You may copy and distribute verbatim copies of the Program's
|
99 |
+
source code as you receive it, in any medium, provided that you
|
100 |
+
conspicuously and appropriately publish on each copy an appropriate
|
101 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
102 |
+
notices that refer to this License and to the absence of any warranty;
|
103 |
+
and give any other recipients of the Program a copy of this License
|
104 |
+
along with the Program.
|
105 |
+
|
106 |
+
You may charge a fee for the physical act of transferring a copy, and
|
107 |
+
you may at your option offer warranty protection in exchange for a fee.
|
108 |
+
|
109 |
+
2. You may modify your copy or copies of the Program or any portion
|
110 |
+
of it, thus forming a work based on the Program, and copy and
|
111 |
+
distribute such modifications or work under the terms of Section 1
|
112 |
+
above, provided that you also meet all of these conditions:
|
113 |
+
|
114 |
+
a) You must cause the modified files to carry prominent notices
|
115 |
+
stating that you changed the files and the date of any change.
|
116 |
+
|
117 |
+
b) You must cause any work that you distribute or publish, that in
|
118 |
+
whole or in part contains or is derived from the Program or any
|
119 |
+
part thereof, to be licensed as a whole at no charge to all third
|
120 |
+
parties under the terms of this License.
|
121 |
+
|
122 |
+
c) If the modified program normally reads commands interactively
|
123 |
+
when run, you must cause it, when started running for such
|
124 |
+
interactive use in the most ordinary way, to print or display an
|
125 |
+
announcement including an appropriate copyright notice and a
|
126 |
+
notice that there is no warranty (or else, saying that you provide
|
127 |
+
a warranty) and that users may redistribute the program under
|
128 |
+
these conditions, and telling the user how to view a copy of this
|
129 |
+
License. (Exception: if the Program itself is interactive but
|
130 |
+
does not normally print such an announcement, your work based on
|
131 |
+
the Program is not required to print an announcement.)
|
132 |
+
|
133 |
+
These requirements apply to the modified work as a whole. If
|
134 |
+
identifiable sections of that work are not derived from the Program,
|
135 |
+
and can be reasonably considered independent and separate works in
|
136 |
+
themselves, then this License, and its terms, do not apply to those
|
137 |
+
sections when you distribute them as separate works. But when you
|
138 |
+
distribute the same sections as part of a whole which is a work based
|
139 |
+
on the Program, the distribution of the whole must be on the terms of
|
140 |
+
this License, whose permissions for other licensees extend to the
|
141 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
142 |
+
|
143 |
+
Thus, it is not the intent of this section to claim rights or contest
|
144 |
+
your rights to work written entirely by you; rather, the intent is to
|
145 |
+
exercise the right to control the distribution of derivative or
|
146 |
+
collective works based on the Program.
|
147 |
+
|
148 |
+
In addition, mere aggregation of another work not based on the Program
|
149 |
+
with the Program (or with a work based on the Program) on a volume of
|
150 |
+
a storage or distribution medium does not bring the other work under
|
151 |
+
the scope of this License.
|
152 |
+
|
153 |
+
3. You may copy and distribute the Program (or a work based on it,
|
154 |
+
under Section 2) in object code or executable form under the terms of
|
155 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
156 |
+
|
157 |
+
a) Accompany it with the complete corresponding machine-readable
|
158 |
+
source code, which must be distributed under the terms of Sections
|
159 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
160 |
+
|
161 |
+
b) Accompany it with a written offer, valid for at least three
|
162 |
+
years, to give any third party, for a charge no more than your
|
163 |
+
cost of physically performing source distribution, a complete
|
164 |
+
machine-readable copy of the corresponding source code, to be
|
165 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
166 |
+
customarily used for software interchange; or,
|
167 |
+
|
168 |
+
c) Accompany it with the information you received as to the offer
|
169 |
+
to distribute corresponding source code. (This alternative is
|
170 |
+
allowed only for noncommercial distribution and only if you
|
171 |
+
received the program in object code or executable form with such
|
172 |
+
an offer, in accord with Subsection b above.)
|
173 |
+
|
174 |
+
The source code for a work means the preferred form of the work for
|
175 |
+
making modifications to it. For an executable work, complete source
|
176 |
+
code means all the source code for all modules it contains, plus any
|
177 |
+
associated interface definition files, plus the scripts used to
|
178 |
+
control compilation and installation of the executable. However, as a
|
179 |
+
special exception, the source code distributed need not include
|
180 |
+
anything that is normally distributed (in either source or binary
|
181 |
+
form) with the major components (compiler, kernel, and so on) of the
|
182 |
+
operating system on which the executable runs, unless that component
|
183 |
+
itself accompanies the executable.
|
184 |
+
|
185 |
+
If distribution of executable or object code is made by offering
|
186 |
+
access to copy from a designated place, then offering equivalent
|
187 |
+
access to copy the source code from the same place counts as
|
188 |
+
distribution of the source code, even though third parties are not
|
189 |
+
compelled to copy the source along with the object code.
|
190 |
+
|
191 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
192 |
+
except as expressly provided under this License. Any attempt
|
193 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
194 |
+
void, and will automatically terminate your rights under this License.
|
195 |
+
However, parties who have received copies, or rights, from you under
|
196 |
+
this License will not have their licenses terminated so long as such
|
197 |
+
parties remain in full compliance.
|
198 |
+
|
199 |
+
5. You are not required to accept this License, since you have not
|
200 |
+
signed it. However, nothing else grants you permission to modify or
|
201 |
+
distribute the Program or its derivative works. These actions are
|
202 |
+
prohibited by law if you do not accept this License. Therefore, by
|
203 |
+
modifying or distributing the Program (or any work based on the
|
204 |
+
Program), you indicate your acceptance of this License to do so, and
|
205 |
+
all its terms and conditions for copying, distributing or modifying
|
206 |
+
the Program or works based on it.
|
207 |
+
|
208 |
+
6. Each time you redistribute the Program (or any work based on the
|
209 |
+
Program), the recipient automatically receives a license from the
|
210 |
+
original licensor to copy, distribute or modify the Program subject to
|
211 |
+
these terms and conditions. You may not impose any further
|
212 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
213 |
+
You are not responsible for enforcing compliance by third parties to
|
214 |
+
this License.
|
215 |
+
|
216 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
217 |
+
infringement or for any other reason (not limited to patent issues),
|
218 |
+
conditions are imposed on you (whether by court order, agreement or
|
219 |
+
otherwise) that contradict the conditions of this License, they do not
|
220 |
+
excuse you from the conditions of this License. If you cannot
|
221 |
+
distribute so as to satisfy simultaneously your obligations under this
|
222 |
+
License and any other pertinent obligations, then as a consequence you
|
223 |
+
may not distribute the Program at all. For example, if a patent
|
224 |
+
license would not permit royalty-free redistribution of the Program by
|
225 |
+
all those who receive copies directly or indirectly through you, then
|
226 |
+
the only way you could satisfy both it and this License would be to
|
227 |
+
refrain entirely from distribution of the Program.
|
228 |
+
|
229 |
+
If any portion of this section is held invalid or unenforceable under
|
230 |
+
any particular circumstance, the balance of the section is intended to
|
231 |
+
apply and the section as a whole is intended to apply in other
|
232 |
+
circumstances.
|
233 |
+
|
234 |
+
It is not the purpose of this section to induce you to infringe any
|
235 |
+
patents or other property right claims or to contest validity of any
|
236 |
+
such claims; this section has the sole purpose of protecting the
|
237 |
+
integrity of the free software distribution system, which is
|
238 |
+
implemented by public license practices. Many people have made
|
239 |
+
generous contributions to the wide range of software distributed
|
240 |
+
through that system in reliance on consistent application of that
|
241 |
+
system; it is up to the author/donor to decide if he or she is willing
|
242 |
+
to distribute software through any other system and a licensee cannot
|
243 |
+
impose that choice.
|
244 |
+
|
245 |
+
This section is intended to make thoroughly clear what is believed to
|
246 |
+
be a consequence of the rest of this License.
|
247 |
+
|
248 |
+
8. If the distribution and/or use of the Program is restricted in
|
249 |
+
certain countries either by patents or by copyrighted interfaces, the
|
250 |
+
original copyright holder who places the Program under this License
|
251 |
+
may add an explicit geographical distribution limitation excluding
|
252 |
+
those countries, so that distribution is permitted only in or among
|
253 |
+
countries not thus excluded. In such case, this License incorporates
|
254 |
+
the limitation as if written in the body of this License.
|
255 |
+
|
256 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
257 |
+
of the General Public License from time to time. Such new versions will
|
258 |
+
be similar in spirit to the present version, but may differ in detail to
|
259 |
+
address new problems or concerns.
|
260 |
+
|
261 |
+
Each version is given a distinguishing version number. If the Program
|
262 |
+
specifies a version number of this License which applies to it and "any
|
263 |
+
later version", you have the option of following the terms and conditions
|
264 |
+
either of that version or of any later version published by the Free
|
265 |
+
Software Foundation. If the Program does not specify a version number of
|
266 |
+
this License, you may choose any version ever published by the Free Software
|
267 |
+
Foundation.
|
268 |
+
|
269 |
+
10. If you wish to incorporate parts of the Program into other free
|
270 |
+
programs whose distribution conditions are different, write to the author
|
271 |
+
to ask for permission. For software which is copyrighted by the Free
|
272 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
273 |
+
make exceptions for this. Our decision will be guided by the two goals
|
274 |
+
of preserving the free status of all derivatives of our free software and
|
275 |
+
of promoting the sharing and reuse of software generally.
|
276 |
+
|
277 |
+
NO WARRANTY
|
278 |
+
|
279 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
280 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
281 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
282 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
283 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
284 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
285 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
286 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
287 |
+
REPAIR OR CORRECTION.
|
288 |
+
|
289 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
290 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
291 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
292 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
293 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
294 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
295 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
296 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
297 |
+
POSSIBILITY OF SUCH DAMAGES.
|
298 |
+
|
299 |
+
END OF TERMS AND CONDITIONS
|
300 |
+
|
301 |
+
How to Apply These Terms to Your New Programs
|
302 |
+
|
303 |
+
If you develop a new program, and you want it to be of the greatest
|
304 |
+
possible use to the public, the best way to achieve this is to make it
|
305 |
+
free software which everyone can redistribute and change under these terms.
|
306 |
+
|
307 |
+
To do so, attach the following notices to the program. It is safest
|
308 |
+
to attach them to the start of each source file to most effectively
|
309 |
+
convey the exclusion of warranty; and each file should have at least
|
310 |
+
the "copyright" line and a pointer to where the full notice is found.
|
311 |
+
|
312 |
+
<one line to give the program's name and a brief idea of what it does.>
|
313 |
+
Copyright (C) <year> <name of author>
|
314 |
+
|
315 |
+
This program is free software; you can redistribute it and/or modify
|
316 |
+
it under the terms of the GNU General Public License as published by
|
317 |
+
the Free Software Foundation; either version 2 of the License, or
|
318 |
+
(at your option) any later version.
|
319 |
+
|
320 |
+
This program is distributed in the hope that it will be useful,
|
321 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
322 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
323 |
+
GNU General Public License for more details.
|
324 |
+
|
325 |
+
You should have received a copy of the GNU General Public License along
|
326 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
327 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
328 |
+
|
329 |
+
Also add information on how to contact you by electronic and paper mail.
|
330 |
+
|
331 |
+
If the program is interactive, make it output a short notice like this
|
332 |
+
when it starts in an interactive mode:
|
333 |
+
|
334 |
+
Gnomovision version 69, Copyright (C) year name of author
|
335 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
336 |
+
This is free software, and you are welcome to redistribute it
|
337 |
+
under certain conditions; type `show c' for details.
|
338 |
+
|
339 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
340 |
+
parts of the General Public License. Of course, the commands you use may
|
341 |
+
be called something other than `show w' and `show c'; they could even be
|
342 |
+
mouse-clicks or menu items--whatever suits your program.
|
343 |
+
|
344 |
+
You should also get your employer (if you work as a programmer) or your
|
345 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
346 |
+
necessary. Here is a sample; alter the names:
|
347 |
+
|
348 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
349 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
350 |
+
|
351 |
+
<signature of Ty Coon>, 1 April 1989
|
352 |
+
Ty Coon, President of Vice
|
353 |
+
|
354 |
+
This General Public License does not permit incorporating your program into
|
355 |
+
proprietary programs. If your program is a subroutine library, you may
|
356 |
+
consider it more useful to permit linking proprietary applications with the
|
357 |
+
library. If this is what you want to do, use the GNU Lesser General
|
358 |
+
Public License instead of this License.
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Base class for a plugin admin menu.
|
7 |
+
*/
|
8 |
+
abstract class Admin_Menu {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* The snippet page short name
|
12 |
+
*
|
13 |
+
* @var string
|
14 |
+
*/
|
15 |
+
public $name;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The label shown in the admin menu
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $label;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The text used for the page title
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
public $title;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The base slug for the top-level admin menu.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $base_slug;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* The slug for this admin menu.
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
protected $slug;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor
|
47 |
+
*
|
48 |
+
* @param string $name The snippet page short name.
|
49 |
+
* @param string $label The label shown in the admin menu.
|
50 |
+
* @param string $title The text used for the page title.
|
51 |
+
*/
|
52 |
+
public function __construct( $name, $label, $title ) {
|
53 |
+
$this->name = $name;
|
54 |
+
$this->label = $label;
|
55 |
+
$this->title = $title;
|
56 |
+
|
57 |
+
$this->base_slug = code_snippets()->get_menu_slug();
|
58 |
+
$this->slug = code_snippets()->get_menu_slug( $name );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Register action and filter hooks
|
63 |
+
*/
|
64 |
+
public function run() {
|
65 |
+
if ( ! code_snippets()->is_compact_menu() ) {
|
66 |
+
add_action( 'admin_menu', array( $this, 'register' ) );
|
67 |
+
add_action( 'network_admin_menu', array( $this, 'register' ) );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Add a sub-menu to the Snippets menu
|
73 |
+
*
|
74 |
+
* @param string $slug Menu slug.
|
75 |
+
* @param string $label Label shown in admin menu.
|
76 |
+
* @param string $title Page title.
|
77 |
+
*
|
78 |
+
* @uses add_submenu_page() to register a submenu
|
79 |
+
*/
|
80 |
+
public function add_menu( $slug, $label, $title ) {
|
81 |
+
$hook = add_submenu_page(
|
82 |
+
$this->base_slug,
|
83 |
+
$title,
|
84 |
+
$label,
|
85 |
+
code_snippets()->get_cap(),
|
86 |
+
$slug,
|
87 |
+
array( $this, 'render' )
|
88 |
+
);
|
89 |
+
|
90 |
+
add_action( 'load-' . $hook, array( $this, 'load' ) );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Register the admin menu
|
95 |
+
*/
|
96 |
+
public function register() {
|
97 |
+
$this->add_menu( $this->slug, $this->label, $this->title );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Render the content of a vew template
|
102 |
+
*
|
103 |
+
* @param string $name Name of view template to render.
|
104 |
+
*/
|
105 |
+
protected function render_view( $name ) {
|
106 |
+
include dirname( PLUGIN_FILE ) . '/php/views/' . $name . '.php';
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Render the menu
|
111 |
+
*/
|
112 |
+
public function render() {
|
113 |
+
$this->render_view( $this->name );
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Print the status and error messages
|
118 |
+
*/
|
119 |
+
abstract protected function print_messages();
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Retrieve a result message based on a posted status
|
123 |
+
*
|
124 |
+
* @param array $messages List of possible messages to display.
|
125 |
+
* @param string $request_var Name of $_REQUEST variable to check.
|
126 |
+
* @param string $class Class to use on buttons. Default 'updated'.
|
127 |
+
*
|
128 |
+
* @return bool Whether a result message was printed.
|
129 |
+
*/
|
130 |
+
protected function print_result_message( $messages, $request_var = 'result', $class = 'updated' ) {
|
131 |
+
|
132 |
+
if ( empty( $_REQUEST[ $request_var ] ) ) {
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
|
136 |
+
$result = sanitize_key( $_REQUEST[ $request_var ] );
|
137 |
+
|
138 |
+
if ( isset( $messages[ $result ] ) ) {
|
139 |
+
printf(
|
140 |
+
'<div id="message" class="%2$s fade"><p>%1$s</p></div>',
|
141 |
+
wp_kses_post( $messages[ $result ] ),
|
142 |
+
esc_attr( $class )
|
143 |
+
);
|
144 |
+
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Print a result message based on a posted status
|
153 |
+
*
|
154 |
+
* @param array $messages List of possible messages to display.
|
155 |
+
* @param string $request_var Name of $_REQUEST variable to check.
|
156 |
+
* @param string $class Class to use on buttons. Default 'updated'.
|
157 |
+
*/
|
158 |
+
protected function show_result_message( $messages, $request_var = 'result', $class = 'updated' ) {
|
159 |
+
$message = $this->get_result_message( $messages, $request_var, $class );
|
160 |
+
|
161 |
+
if ( $message ) {
|
162 |
+
echo wp_kses_post( $message );
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Executed when the admin page is loaded
|
168 |
+
*/
|
169 |
+
public function load() {
|
170 |
+
/* Make sure the user has permission to be here */
|
171 |
+
if ( ! current_user_can( code_snippets()->get_cap() ) ) {
|
172 |
+
wp_die( esc_html__( 'You are not authorized to access this page.', 'code-snippets' ) );
|
173 |
+
}
|
174 |
+
|
175 |
+
/* Create the snippet tables if they don't exist */
|
176 |
+
$db = code_snippets()->db;
|
177 |
+
|
178 |
+
if ( is_multisite() ) {
|
179 |
+
$db->create_missing_table( $db->ms_table );
|
180 |
+
}
|
181 |
+
$db->create_missing_table( $db->table );
|
182 |
+
|
183 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Enqueue scripts and stylesheets for the admin page, if necessary
|
188 |
+
*/
|
189 |
+
abstract public function enqueue_assets();
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Render a list of links to other pages in the page title
|
193 |
+
*
|
194 |
+
* @param array $actions List of actions to render as links, as array values.
|
195 |
+
*/
|
196 |
+
protected function page_title_actions( $actions ) {
|
197 |
+
|
198 |
+
foreach ( $actions as $action ) {
|
199 |
+
if ( 'settings' === $action && ! isset( code_snippets()->admin->menus['settings'] ) ) {
|
200 |
+
continue;
|
201 |
+
}
|
202 |
+
|
203 |
+
$url = code_snippets()->get_menu_url( $action );
|
204 |
+
|
205 |
+
if ( isset( $_GET['type'] ) && in_array( $_GET['type'], Snippet::get_types(), true ) ) {
|
206 |
+
$url = add_query_arg( 'type', sanitize_key( wp_unslash( $_GET['type'] ) ), $url );
|
207 |
+
}
|
208 |
+
|
209 |
+
printf( '<a href="%s" class="page-title-action">', esc_url( $url ) );
|
210 |
+
|
211 |
+
switch ( $action ) {
|
212 |
+
case 'manage':
|
213 |
+
echo esc_html_x( 'Manage', 'snippets', 'code-snippets' );
|
214 |
+
break;
|
215 |
+
case 'add':
|
216 |
+
echo esc_html_x( 'Add New', 'snippet', 'code-snippets' );
|
217 |
+
break;
|
218 |
+
case 'import':
|
219 |
+
echo esc_html_x( 'Import', 'snippets', 'code-snippets' );
|
220 |
+
break;
|
221 |
+
case 'settings':
|
222 |
+
echo esc_html_x( 'Settings', 'snippets', 'code-snippets' );
|
223 |
+
break;
|
224 |
+
}
|
225 |
+
|
226 |
+
echo '</a>';
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
@@ -0,0 +1,859 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use function Code_Snippets\Settings\get_setting;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* This class handles the add/edit menu
|
9 |
+
*/
|
10 |
+
class Edit_Menu extends Admin_Menu {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The snippet object currently being edited
|
14 |
+
*
|
15 |
+
* @var Snippet
|
16 |
+
* @see Edit_Menu::load_snippet_data()
|
17 |
+
*/
|
18 |
+
protected $snippet = null;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Constructor
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
parent::__construct(
|
26 |
+
'edit',
|
27 |
+
_x( 'Edit Snippet', 'menu label', 'code-snippets' ),
|
28 |
+
__( 'Edit Snippet', 'code-snippets' )
|
29 |
+
);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Register action and filter hooks
|
34 |
+
*/
|
35 |
+
public function run() {
|
36 |
+
parent::run();
|
37 |
+
$this->remove_debug_bar_codemirror();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Register the admin menu
|
42 |
+
*/
|
43 |
+
public function register() {
|
44 |
+
parent::register();
|
45 |
+
|
46 |
+
/* Only preserve the edit menu if we are currently editing a snippet */
|
47 |
+
if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] !== $this->slug ) {
|
48 |
+
remove_submenu_page( $this->base_slug, $this->slug );
|
49 |
+
}
|
50 |
+
|
51 |
+
/* Add New Snippet menu */
|
52 |
+
$this->add_menu(
|
53 |
+
code_snippets()->get_menu_slug( 'add' ),
|
54 |
+
_x( 'Add New', 'menu label', 'code-snippets' ),
|
55 |
+
__( 'Add New Snippet', 'code-snippets' )
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Executed when the menu is loaded
|
61 |
+
*/
|
62 |
+
public function load() {
|
63 |
+
parent::load();
|
64 |
+
|
65 |
+
// Retrieve the current snippet object.
|
66 |
+
$this->load_snippet_data();
|
67 |
+
|
68 |
+
$screen = get_current_screen();
|
69 |
+
$edit_hook = get_plugin_page_hookname( $this->slug, $this->base_slug );
|
70 |
+
if ( $screen->in_admin( 'network' ) ) {
|
71 |
+
$edit_hook .= '-network';
|
72 |
+
}
|
73 |
+
|
74 |
+
// Disallow visiting the edit snippet page without a valid ID.
|
75 |
+
if ( $screen->base === $edit_hook && ( empty( $_REQUEST['id'] ) || 0 === $this->snippet->id || null === $this->snippet->id ) &&
|
76 |
+
! isset( $_REQUEST['preview'] ) ) {
|
77 |
+
wp_safe_redirect( code_snippets()->get_menu_url( 'add' ) );
|
78 |
+
exit;
|
79 |
+
}
|
80 |
+
|
81 |
+
// Process any submitted actions.
|
82 |
+
$this->process_actions();
|
83 |
+
|
84 |
+
// Load the contextual help tabs.
|
85 |
+
$contextual_help = new Contextual_Help( 'edit' );
|
86 |
+
$contextual_help->load();
|
87 |
+
|
88 |
+
// Register action hooks.
|
89 |
+
if ( get_setting( 'general', 'enable_description' ) ) {
|
90 |
+
add_action( 'code_snippets_edit_snippet', array( $this, 'render_description_editor' ), 9 );
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( get_setting( 'general', 'enable_tags' ) ) {
|
94 |
+
add_action( 'code_snippets_edit_snippet', array( $this, 'render_tags_editor' ) );
|
95 |
+
}
|
96 |
+
|
97 |
+
add_action( 'code_snippets_below_editor', array( $this, 'render_priority_setting' ), 0 );
|
98 |
+
|
99 |
+
if ( is_network_admin() ) {
|
100 |
+
add_action( 'code_snippets_edit_snippet', array( $this, 'render_multisite_sharing_setting' ), 1 );
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( apply_filters( 'code_snippets/extra_save_buttons', true ) ) {
|
104 |
+
add_action( 'code_snippets/admin/code_editor_toolbar', array( $this, 'render_extra_submit_buttons' ) );
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( apply_filters( 'code_snippets/enable_code_direction', is_rtl() ) ) {
|
108 |
+
add_action( 'code_snippets/admin/code_editor_toolbar', array( $this, 'render_direction_setting' ), 11, 0 );
|
109 |
+
}
|
110 |
+
|
111 |
+
$this->process_actions();
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Load the data for the snippet currently being edited
|
116 |
+
*/
|
117 |
+
public function load_snippet_data() {
|
118 |
+
$edit_id = isset( $_REQUEST['id'] ) && intval( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : 0;
|
119 |
+
|
120 |
+
$this->snippet = get_snippet( $edit_id );
|
121 |
+
$snippet = $this->snippet;
|
122 |
+
|
123 |
+
if ( 0 === $edit_id && isset( $_GET['type'] ) && $_GET['type'] !== $snippet->type ) {
|
124 |
+
if ( 'php' === $_GET['type'] ) {
|
125 |
+
$snippet->scope = 'global';
|
126 |
+
} elseif ( 'css' === $_GET['type'] ) {
|
127 |
+
$snippet->scope = 'site-css';
|
128 |
+
} elseif ( 'html' === $_GET['type'] ) {
|
129 |
+
$snippet->scope = 'content';
|
130 |
+
} elseif ( 'js' === $_GET['type'] ) {
|
131 |
+
$snippet->scope = 'site-head-js';
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->snippet = apply_filters( 'code_snippets/admin/load_snippet_data', $snippet );
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Process data sent from the edit page
|
140 |
+
*/
|
141 |
+
private function process_actions() {
|
142 |
+
|
143 |
+
/* Check for a valid nonce */
|
144 |
+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'save_snippet' ) ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
if ( isset( $_POST['save_snippet'] ) || isset( $_POST['save_snippet_execute'] ) ||
|
149 |
+
isset( $_POST['save_snippet_activate'] ) || isset( $_POST['save_snippet_deactivate'] ) ) {
|
150 |
+
$this->save_posted_snippet();
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( isset( $_POST['snippet_id'] ) ) {
|
154 |
+
$snippet_id = intval( $_POST['snippet_id'] );
|
155 |
+
|
156 |
+
/* Delete the snippet if the button was clicked */
|
157 |
+
if ( isset( $_POST['delete_snippet'] ) ) {
|
158 |
+
delete_snippet( $snippet_id );
|
159 |
+
wp_safe_redirect( add_query_arg( 'result', 'delete', code_snippets()->get_menu_url( 'manage' ) ) );
|
160 |
+
exit;
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Export the snippet if the button was clicked */
|
164 |
+
if ( isset( $_POST['export_snippet'] ) ) {
|
165 |
+
$export = new Export_Attachment( $snippet_id );
|
166 |
+
$export->download_snippets_json();
|
167 |
+
}
|
168 |
+
|
169 |
+
/* Download the snippet if the button was clicked */
|
170 |
+
if ( isset( $_POST['download_snippet'] ) ) {
|
171 |
+
$export = new Export_Attachment( $snippet_id );
|
172 |
+
$export->download_snippets_code();
|
173 |
+
}
|
174 |
+
|
175 |
+
do_action( 'code_snippets/admin/process_actions', $snippet_id );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Remove the sharing status from a network snippet
|
181 |
+
*
|
182 |
+
* @param int $snippet_id Snippet ID.
|
183 |
+
*/
|
184 |
+
private function unshare_network_snippet( $snippet_id ) {
|
185 |
+
$shared_snippets = get_site_option( 'shared_network_snippets', array() );
|
186 |
+
|
187 |
+
if ( ! in_array( $snippet_id, $shared_snippets, true ) ) {
|
188 |
+
return;
|
189 |
+
}
|
190 |
+
|
191 |
+
/* Remove the snippet ID from the array */
|
192 |
+
$shared_snippets = array_diff( $shared_snippets, array( $snippet_id ) );
|
193 |
+
update_site_option( 'shared_network_snippets', array_values( $shared_snippets ) );
|
194 |
+
|
195 |
+
/* Deactivate on all sites */
|
196 |
+
$sites = get_sites( [ 'fields' => 'ids' ] );
|
197 |
+
|
198 |
+
foreach ( $sites as $site ) {
|
199 |
+
switch_to_blog( $site );
|
200 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets' );
|
201 |
+
|
202 |
+
if ( is_array( $active_shared_snippets ) ) {
|
203 |
+
$active_shared_snippets = array_diff( $active_shared_snippets, array( $snippet_id ) );
|
204 |
+
update_option( 'active_shared_network_snippets', $active_shared_snippets );
|
205 |
+
}
|
206 |
+
|
207 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
208 |
+
}
|
209 |
+
|
210 |
+
restore_current_blog();
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Display a custom error message when a code error is encountered
|
215 |
+
*
|
216 |
+
* @param string $out Error message content.
|
217 |
+
*
|
218 |
+
* @return string New error message.
|
219 |
+
*/
|
220 |
+
private function code_error_callback( $out ) {
|
221 |
+
$error = error_get_last();
|
222 |
+
|
223 |
+
if ( is_null( $error ) ) {
|
224 |
+
return $out;
|
225 |
+
}
|
226 |
+
|
227 |
+
$m = '<h3>' . esc_html__( "Don't Panic", 'code-snippets' ) . '</h3>';
|
228 |
+
/* translators: %d: line where error was produced */
|
229 |
+
$m .= '<p>' . sprintf( esc_html__( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code-snippets' ), intval( $error['line'] ) ) . '</p>';
|
230 |
+
$m .= '<strong>' . esc_html( $error['message'] ) . '</strong>';
|
231 |
+
$m .= '<p>' . esc_html__( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
|
232 |
+
$m .= '<p>' . esc_html__( 'Please use the back button in your browser to return to the previous page and try to fix the code error.', 'code-snippets' );
|
233 |
+
$m .= ' ' . esc_html__( 'If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.', 'code-snippets' ) . '</p>';
|
234 |
+
|
235 |
+
return $m;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Validate the snippet code before saving to database
|
240 |
+
*
|
241 |
+
* @param Snippet $snippet Snippet object.
|
242 |
+
*
|
243 |
+
* @return bool Whether the code produces errors.
|
244 |
+
*/
|
245 |
+
private function test_code( Snippet $snippet ) {
|
246 |
+
|
247 |
+
if ( empty( $snippet->code ) || 'php' !== $snippet->type ) {
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
|
251 |
+
ob_start( array( $this, 'code_error_callback' ) );
|
252 |
+
|
253 |
+
$result = eval( $snippet->code );
|
254 |
+
|
255 |
+
ob_end_clean();
|
256 |
+
|
257 |
+
do_action( 'code_snippets/after_execute_snippet', $snippet->id, $snippet->code, $result );
|
258 |
+
|
259 |
+
return false === $result;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Save the posted snippet data to the database and redirect
|
264 |
+
*/
|
265 |
+
private function save_posted_snippet() {
|
266 |
+
|
267 |
+
/* Build snippet object from fields with 'snippet_' prefix */
|
268 |
+
$snippet = new Snippet();
|
269 |
+
|
270 |
+
foreach ( $_POST as $field => $value ) {
|
271 |
+
if ( 'snippet_' === substr( $field, 0, 8 ) ) {
|
272 |
+
|
273 |
+
/* Remove the 'snippet_' prefix from field name and set it on the object */
|
274 |
+
$snippet->set_field( substr( $field, 8 ), stripslashes( $value ) );
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
$snippet = apply_filters( 'code_snippets/save/post_set_fields', $snippet );
|
279 |
+
|
280 |
+
if ( isset( $_POST['save_snippet_execute'] ) && 'single-use' !== $snippet->scope ) {
|
281 |
+
unset( $_POST['save_snippet_execute'] );
|
282 |
+
$_POST['save_snippet'] = 'yes';
|
283 |
+
}
|
284 |
+
|
285 |
+
/* Activate or deactivate the snippet before saving if we clicked the button */
|
286 |
+
|
287 |
+
if ( isset( $_POST['save_snippet_execute'] ) ) {
|
288 |
+
$snippet->active = 1;
|
289 |
+
} elseif ( isset( $_POST['snippet_sharing'] ) && 'on' === $_POST['snippet_sharing'] ) {
|
290 |
+
// Shared network snippets cannot be network-activated.
|
291 |
+
$snippet->active = 0;
|
292 |
+
unset( $_POST['save_snippet_activate'], $_POST['save_snippet_deactivate'] );
|
293 |
+
} elseif ( isset( $_POST['save_snippet_activate'] ) ) {
|
294 |
+
$snippet->active = 1;
|
295 |
+
} elseif ( isset( $_POST['save_snippet_deactivate'] ) ) {
|
296 |
+
$snippet->active = 0;
|
297 |
+
}
|
298 |
+
|
299 |
+
if ( 'php' === $snippet->type ) {
|
300 |
+
|
301 |
+
/* Remove <?php and <? from beginning of snippet */
|
302 |
+
$snippet->code = preg_replace( '|^\s*<\?(php)?|', '', $snippet->code );
|
303 |
+
/* Remove ?> from end of snippet */
|
304 |
+
$snippet->code = preg_replace( '|\?>\s*$|', '', $snippet->code );
|
305 |
+
|
306 |
+
/* Deactivate snippet if code contains errors */
|
307 |
+
if ( $snippet->active && 'single-use' !== $snippet->scope ) {
|
308 |
+
$validator = new Validator( $snippet->code );
|
309 |
+
$code_error = $validator->validate();
|
310 |
+
|
311 |
+
if ( ! $code_error ) {
|
312 |
+
$code_error = $this->test_code( $snippet );
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( $code_error ) {
|
316 |
+
$snippet->active = 0;
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
/* Save the snippet to the database */
|
322 |
+
$snippet_id = save_snippet( $snippet );
|
323 |
+
|
324 |
+
/* Update the shared network snippets if necessary */
|
325 |
+
if ( $snippet_id && is_network_admin() ) {
|
326 |
+
|
327 |
+
if ( isset( $_POST['snippet_sharing'] ) && 'on' === $_POST['snippet_sharing'] ) {
|
328 |
+
$shared_snippets = get_site_option( 'shared_network_snippets', array() );
|
329 |
+
|
330 |
+
/* Add the snippet ID to the array if it isn't already */
|
331 |
+
if ( ! in_array( $snippet_id, $shared_snippets, true ) ) {
|
332 |
+
$shared_snippets[] = $snippet_id;
|
333 |
+
update_site_option( 'shared_network_snippets', array_values( $shared_snippets ) );
|
334 |
+
}
|
335 |
+
} else {
|
336 |
+
$this->unshare_network_snippet( $snippet_id );
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
/* If the saved snippet ID is invalid, display an error message */
|
341 |
+
if ( ! $snippet_id || $snippet_id < 1 ) {
|
342 |
+
/* An error occurred */
|
343 |
+
wp_safe_redirect( add_query_arg( 'result', 'save-error', code_snippets()->get_menu_url( 'add' ) ) );
|
344 |
+
exit;
|
345 |
+
}
|
346 |
+
|
347 |
+
/* Display message if a parse error occurred */
|
348 |
+
if ( isset( $code_error ) && $code_error ) {
|
349 |
+
wp_safe_redirect(
|
350 |
+
add_query_arg(
|
351 |
+
array(
|
352 |
+
'id' => $snippet_id,
|
353 |
+
'result' => 'code-error',
|
354 |
+
),
|
355 |
+
code_snippets()->get_menu_url( 'edit' )
|
356 |
+
)
|
357 |
+
);
|
358 |
+
exit;
|
359 |
+
}
|
360 |
+
|
361 |
+
/* Set the result depending on if the snippet was just added */
|
362 |
+
$result = isset( $_POST['snippet_id'] ) ? 'updated' : 'added';
|
363 |
+
|
364 |
+
/* Append a suffix if the snippet was activated or deactivated */
|
365 |
+
if ( isset( $_POST['save_snippet_activate'] ) ) {
|
366 |
+
$result .= '-and-activated';
|
367 |
+
} elseif ( isset( $_POST['save_snippet_deactivate'] ) ) {
|
368 |
+
$result .= '-and-deactivated';
|
369 |
+
} elseif ( isset( $_POST['save_snippet_execute'] ) ) {
|
370 |
+
$result .= '-and-executed';
|
371 |
+
}
|
372 |
+
|
373 |
+
/* Redirect to edit snippet page */
|
374 |
+
$redirect_uri = add_query_arg(
|
375 |
+
array(
|
376 |
+
'id' => $snippet_id,
|
377 |
+
'result' => $result,
|
378 |
+
),
|
379 |
+
code_snippets()->get_menu_url( 'edit' )
|
380 |
+
);
|
381 |
+
|
382 |
+
wp_safe_redirect( esc_url_raw( $redirect_uri ) );
|
383 |
+
exit;
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Add a description editor to the single snippet page
|
388 |
+
*
|
389 |
+
* @param Snippet $snippet The snippet being used for this page.
|
390 |
+
*/
|
391 |
+
public function render_description_editor( Snippet $snippet ) {
|
392 |
+
$settings = Settings\get_settings_values();
|
393 |
+
$settings = $settings['description_editor'];
|
394 |
+
|
395 |
+
echo '<h2><label for="snippet_description">', esc_html__( 'Description', 'code-snippets' ), '</label></h2>';
|
396 |
+
|
397 |
+
remove_editor_styles(); // Stop custom theme styling interfering with the editor.
|
398 |
+
|
399 |
+
wp_editor(
|
400 |
+
$snippet->desc,
|
401 |
+
'description',
|
402 |
+
apply_filters(
|
403 |
+
'code_snippets/admin/description_editor_settings',
|
404 |
+
array(
|
405 |
+
'textarea_name' => 'snippet_description',
|
406 |
+
'textarea_rows' => $settings['rows'],
|
407 |
+
'teeny' => ! $settings['use_full_mce'],
|
408 |
+
'media_buttons' => $settings['media_buttons'],
|
409 |
+
)
|
410 |
+
)
|
411 |
+
);
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Render the interface for editing snippet tags
|
416 |
+
*
|
417 |
+
* @param Snippet $snippet The snippet currently being edited.
|
418 |
+
*/
|
419 |
+
public function render_tags_editor( Snippet $snippet ) {
|
420 |
+
|
421 |
+
?>
|
422 |
+
<h2 style="margin: 25px 0 10px;">
|
423 |
+
<label for="snippet_tags" style="cursor: auto;">
|
424 |
+
<?php esc_html_e( 'Tags', 'code-snippets' ); ?>
|
425 |
+
</label>
|
426 |
+
</h2>
|
427 |
+
|
428 |
+
<input type="text" id="snippet_tags" name="snippet_tags" style="width: 100%;"
|
429 |
+
placeholder="<?php esc_html_e( 'Enter a list of tags; separated by commas', 'code-snippets' ); ?>"
|
430 |
+
value="<?php echo esc_attr( $snippet->tags_list ); ?>" />
|
431 |
+
<?php
|
432 |
+
}
|
433 |
+
|
434 |
+
/**
|
435 |
+
* Render the snippet priority setting
|
436 |
+
*
|
437 |
+
* @param Snippet $snippet The snippet currently being edited.
|
438 |
+
*/
|
439 |
+
public function render_priority_setting( Snippet $snippet ) {
|
440 |
+
if ( 'html' === $snippet->type ) {
|
441 |
+
return;
|
442 |
+
}
|
443 |
+
|
444 |
+
?>
|
445 |
+
<p class="snippet-priority"
|
446 |
+
title="<?php esc_attr_e( 'Snippets with a lower priority number will run before those with a higher number.', 'code-snippets' ); ?>">
|
447 |
+
<label for="snippet_priority"><?php esc_html_e( 'Priority', 'code-snippets' ); ?></label>
|
448 |
+
|
449 |
+
<input name="snippet_priority" type="number" id="snippet_priority"
|
450 |
+
value="<?php echo esc_attr( $snippet->priority ); ?>">
|
451 |
+
</p>
|
452 |
+
<?php
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Render the setting for shared network snippets
|
457 |
+
*
|
458 |
+
* @param Snippet $snippet The snippet currently being edited.
|
459 |
+
*/
|
460 |
+
public function render_multisite_sharing_setting( $snippet ) {
|
461 |
+
$shared_snippets = get_site_option( 'shared_network_snippets', array() );
|
462 |
+
?>
|
463 |
+
|
464 |
+
<div class="snippet-sharing-setting">
|
465 |
+
<h2 class="screen-reader-text"><?php esc_html_e( 'Sharing Settings', 'code-snippets' ); ?></h2>
|
466 |
+
<label for="snippet_sharing">
|
467 |
+
<input type="checkbox" name="snippet_sharing"
|
468 |
+
<?php checked( in_array( $snippet->id, $shared_snippets, true ) ); ?>>
|
469 |
+
<?php esc_html_e( 'Allow this snippet to be activated on individual sites on the network', 'code-snippets' ); ?>
|
470 |
+
</label>
|
471 |
+
</div>
|
472 |
+
|
473 |
+
<?php
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Render additional save buttons above the snippet editor.
|
478 |
+
*
|
479 |
+
* @param Snippet $snippet Snippet currently being edited.
|
480 |
+
*/
|
481 |
+
public function render_extra_submit_buttons( Snippet $snippet ) {
|
482 |
+
|
483 |
+
$actions['save_snippet'] = array(
|
484 |
+
__( 'Save Changes', 'code-snippets' ),
|
485 |
+
__( 'Save Snippet', 'code-snippets' ),
|
486 |
+
);
|
487 |
+
|
488 |
+
if ( 'html' !== $snippet->type ) {
|
489 |
+
|
490 |
+
if ( 'single-use' === $snippet->scope ) {
|
491 |
+
$actions['save_snippet_execute'] = array(
|
492 |
+
__( 'Execute Once', 'code-snippets' ),
|
493 |
+
__( 'Save Snippet and Execute Once', 'code-snippets' ),
|
494 |
+
);
|
495 |
+
|
496 |
+
} elseif ( ! $snippet->shared_network || ! is_network_admin() ) {
|
497 |
+
|
498 |
+
if ( $snippet->active ) {
|
499 |
+
$actions['save_snippet_deactivate'] = array(
|
500 |
+
__( 'Deactivate', 'code-snippets' ),
|
501 |
+
__( 'Save Snippet and Deactivate', 'code-snippets' ),
|
502 |
+
);
|
503 |
+
|
504 |
+
} else {
|
505 |
+
$actions['save_snippet_activate'] = array(
|
506 |
+
__( 'Activate', 'code-snippets' ),
|
507 |
+
__( 'Save Snippet and Activate', 'code-snippets' ),
|
508 |
+
);
|
509 |
+
}
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
foreach ( $actions as $action => $labels ) {
|
514 |
+
$other_attributes = array(
|
515 |
+
'title' => $labels[1],
|
516 |
+
'id' => $action . '_extra',
|
517 |
+
);
|
518 |
+
submit_button( $labels[0], 'secondary small', $action, false, $other_attributes );
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* Render a control for changing the code editor text direction
|
524 |
+
*/
|
525 |
+
public function render_direction_setting() {
|
526 |
+
?>
|
527 |
+
<label class="screen-reader-text" for="snippet-code-direction">
|
528 |
+
<?php esc_html_e( 'Code Direction', 'code-snippets' ); ?>
|
529 |
+
</label>
|
530 |
+
<select id="snippet-code-direction">
|
531 |
+
<option value="ltr"><?php esc_html_e( 'LTR', 'code-snippets' ); ?></option>
|
532 |
+
<option value="rtl"><?php esc_html_e( 'RTL', 'code-snippets' ); ?></option>
|
533 |
+
</select>
|
534 |
+
<?php
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* Retrieve the first error in a snippet's code
|
539 |
+
*
|
540 |
+
* @param int $snippet_id Snippet ID.
|
541 |
+
*
|
542 |
+
* @return array|bool Error if execution failed, otherwise false.
|
543 |
+
*/
|
544 |
+
private function get_snippet_error( $snippet_id ) {
|
545 |
+
|
546 |
+
if ( ! intval( $snippet_id ) ) {
|
547 |
+
return false;
|
548 |
+
}
|
549 |
+
|
550 |
+
$snippet = get_snippet( intval( $snippet_id ) );
|
551 |
+
|
552 |
+
if ( '' === $snippet->code ) {
|
553 |
+
return false;
|
554 |
+
}
|
555 |
+
|
556 |
+
$validator = new Validator( $snippet->code );
|
557 |
+
$error = $validator->validate();
|
558 |
+
|
559 |
+
if ( $error ) {
|
560 |
+
return $error;
|
561 |
+
}
|
562 |
+
|
563 |
+
ob_start();
|
564 |
+
$result = eval( $snippet->code );
|
565 |
+
ob_end_clean();
|
566 |
+
|
567 |
+
if ( false !== $result ) {
|
568 |
+
return false;
|
569 |
+
}
|
570 |
+
|
571 |
+
$error = error_get_last();
|
572 |
+
|
573 |
+
if ( is_null( $error ) ) {
|
574 |
+
return false;
|
575 |
+
}
|
576 |
+
|
577 |
+
return $error;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Print the status and error messages
|
582 |
+
*/
|
583 |
+
protected function print_messages() {
|
584 |
+
|
585 |
+
if ( ! isset( $_REQUEST['result'] ) ) {
|
586 |
+
return;
|
587 |
+
}
|
588 |
+
|
589 |
+
$result = sanitize_key( $_REQUEST['result'] );
|
590 |
+
|
591 |
+
if ( 'code-error' === $result ) {
|
592 |
+
$error = isset( $_REQUEST['id'] ) ? $this->get_snippet_error( intval( $_REQUEST['id'] ) ) : false;
|
593 |
+
|
594 |
+
if ( $error ) {
|
595 |
+
/* translators: %d: line of file where error originated */
|
596 |
+
$text = __( 'The snippet has been deactivated due to an error on line %d:', 'code-snippets' );
|
597 |
+
|
598 |
+
printf(
|
599 |
+
'<div id="message" class="error fade"><p>%s</p><p><strong>%s</strong></p></div>',
|
600 |
+
sprintf( esc_html( $text ), intval( $error['line'] ) ),
|
601 |
+
wp_kses_post( $error['message'] )
|
602 |
+
);
|
603 |
+
|
604 |
+
} else {
|
605 |
+
echo '<div id="message" class="error fade"><p>';
|
606 |
+
esc_html_e( 'The snippet has been deactivated due to an error in the code.', 'code-snippets' );
|
607 |
+
echo '</p></div>';
|
608 |
+
}
|
609 |
+
|
610 |
+
return;
|
611 |
+
}
|
612 |
+
|
613 |
+
if ( 'save-error' === $result ) {
|
614 |
+
echo '<div id="message" class="error fade"><p>';
|
615 |
+
esc_html_e( 'An error occurred when saving the snippet.', 'code-snippets' );
|
616 |
+
echo '</p></div>';
|
617 |
+
return;
|
618 |
+
}
|
619 |
+
|
620 |
+
$messages = array(
|
621 |
+
'added' => __( 'Snippet <strong>added</strong>.', 'code-snippets' ),
|
622 |
+
'updated' => __( 'Snippet <strong>updated</strong>.', 'code-snippets' ),
|
623 |
+
'added-and-activated' => __( 'Snippet <strong>added</strong> and <strong>activated</strong>.', 'code-snippets' ),
|
624 |
+
'updated-and-executed' => __( 'Snippet <strong>added</strong> and <strong>executed</strong>.', 'code-snippets' ),
|
625 |
+
'updated-and-activated' => __( 'Snippet <strong>updated</strong> and <strong>activated</strong>.', 'code-snippets' ),
|
626 |
+
'updated-and-deactivated' => __( 'Snippet <strong>updated</strong> and <strong>deactivated</strong>.', 'code-snippets' ),
|
627 |
+
);
|
628 |
+
|
629 |
+
if ( isset( $messages[ $result ] ) ) {
|
630 |
+
echo '<div id="message" class="updated fade"><p>', wp_kses( $messages[ $result ], [ 'strong' => [] ] ), '</p></div>';
|
631 |
+
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Enqueue assets for the edit menu
|
637 |
+
*/
|
638 |
+
public function enqueue_assets() {
|
639 |
+
$plugin = code_snippets();
|
640 |
+
$rtl = is_rtl() ? '-rtl' : '';
|
641 |
+
|
642 |
+
enqueue_code_editor( $this->snippet->type );
|
643 |
+
|
644 |
+
wp_enqueue_style(
|
645 |
+
'code-snippets-edit',
|
646 |
+
plugins_url( "dist/edit$rtl.css", $plugin->file ),
|
647 |
+
[ 'code-editor' ],
|
648 |
+
$plugin->version
|
649 |
+
);
|
650 |
+
|
651 |
+
wp_enqueue_script(
|
652 |
+
'code-snippets-edit-menu',
|
653 |
+
plugins_url( 'dist/edit.js', $plugin->file ),
|
654 |
+
[ 'code-snippets-code-editor' ],
|
655 |
+
$plugin->version,
|
656 |
+
true
|
657 |
+
);
|
658 |
+
|
659 |
+
wp_localize_script(
|
660 |
+
'code-snippets-edit-menu',
|
661 |
+
'code_snippets_edit_i18n',
|
662 |
+
[
|
663 |
+
'missing_title_code' => esc_attr__( 'This snippet has no code or title. Continue?', 'code-snippets' ),
|
664 |
+
'missing_title' => esc_attr__( 'This snippet has no title. Continue?', 'code-snippets' ),
|
665 |
+
'missing_code' => esc_attr__( 'This snippet has no snippet code. Continue?', 'code-snippets' ),
|
666 |
+
]
|
667 |
+
);
|
668 |
+
|
669 |
+
$this->enqueue_tag_assets();
|
670 |
+
}
|
671 |
+
|
672 |
+
/**
|
673 |
+
* Enqueue the necessary assets for the tag editor
|
674 |
+
*/
|
675 |
+
protected function enqueue_tag_assets() {
|
676 |
+
|
677 |
+
if ( ! get_setting( 'general', 'enable_tags' ) ) {
|
678 |
+
return;
|
679 |
+
}
|
680 |
+
|
681 |
+
wp_enqueue_script(
|
682 |
+
'code-snippets-edit-menu-tags',
|
683 |
+
plugins_url( 'dist/tags.js', code_snippets()->file ),
|
684 |
+
[],
|
685 |
+
code_snippets()->version,
|
686 |
+
true
|
687 |
+
);
|
688 |
+
|
689 |
+
$options = apply_filters(
|
690 |
+
'code_snippets/tag_editor_options',
|
691 |
+
array(
|
692 |
+
'allow_spaces' => true,
|
693 |
+
'available_tags' => get_all_snippet_tags(),
|
694 |
+
)
|
695 |
+
);
|
696 |
+
|
697 |
+
$inline_script = 'var code_snippets_tags = ' . wp_json_encode( $options ) . ';';
|
698 |
+
|
699 |
+
wp_add_inline_script( 'code-snippets-edit-menu-tags', $inline_script, 'before' );
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Remove the old CodeMirror version used by the Debug Bar Console plugin
|
704 |
+
* that is messing up the snippet editor
|
705 |
+
*/
|
706 |
+
public function remove_debug_bar_codemirror() {
|
707 |
+
|
708 |
+
/* Try to discern if we are on the single snippet page as good as we can at this early time */
|
709 |
+
if ( ! is_admin() || 'admin.php' !== $GLOBALS['pagenow'] ) {
|
710 |
+
return;
|
711 |
+
}
|
712 |
+
|
713 |
+
if ( ! isset( $_GET['page'] ) || code_snippets()->get_menu_slug( 'edit' ) !== $_GET['page'] && code_snippets()->get_menu_slug( 'settings' ) !== $_GET['page'] ) {
|
714 |
+
return;
|
715 |
+
}
|
716 |
+
|
717 |
+
remove_action( 'debug_bar_enqueue_scripts', 'debug_bar_console_scripts' );
|
718 |
+
}
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Retrieve a list of submit actions for a given snippet
|
722 |
+
*
|
723 |
+
* @param Snippet $snippet The snippet currently being edited.
|
724 |
+
* @param bool $extra_actions Whether to include additional actions alongside save actions.
|
725 |
+
*
|
726 |
+
* @return array Two-dimensional array with action name keyed to description.
|
727 |
+
*/
|
728 |
+
public function get_actions_list( $snippet, $extra_actions = true ) {
|
729 |
+
$actions = [ 'save_snippet' => __( 'Save Changes', 'code-snippets' ) ];
|
730 |
+
|
731 |
+
if ( 'single-use' === $snippet->scope ) {
|
732 |
+
$actions['save_snippet_execute'] = __( 'Save Changes and Execute Once', 'code-snippets' );
|
733 |
+
|
734 |
+
} elseif ( ! $snippet->shared_network || ! is_network_admin() ) {
|
735 |
+
|
736 |
+
if ( $snippet->active ) {
|
737 |
+
$actions['save_snippet_deactivate'] = __( 'Save Changes and Deactivate', 'code-snippets' );
|
738 |
+
} else {
|
739 |
+
$actions['save_snippet_activate'] = __( 'Save Changes and Activate', 'code-snippets' );
|
740 |
+
}
|
741 |
+
}
|
742 |
+
|
743 |
+
// Make the 'Save and Activate' button the default if the setting is enabled.
|
744 |
+
if ( ! $snippet->active && 'single-use' !== $snippet->scope &&
|
745 |
+
get_setting( 'general', 'activate_by_default' ) ) {
|
746 |
+
$actions = array_reverse( $actions );
|
747 |
+
}
|
748 |
+
|
749 |
+
if ( $extra_actions && 0 !== $snippet->id ) {
|
750 |
+
|
751 |
+
if ( apply_filters( 'code_snippets/enable_downloads', true ) ) {
|
752 |
+
$actions['download_snippet'] = __( 'Download', 'code-snippets' );
|
753 |
+
}
|
754 |
+
|
755 |
+
$actions['export_snippet'] = __( 'Export', 'code-snippets' );
|
756 |
+
$actions['delete_snippet'] = __( 'Delete', 'code-snippets' );
|
757 |
+
}
|
758 |
+
|
759 |
+
return apply_filters( 'code_snippets/admin/submit_actions', $actions, $snippet, $extra_actions );
|
760 |
+
}
|
761 |
+
|
762 |
+
/**
|
763 |
+
* Render the submit buttons for a code snippet
|
764 |
+
*
|
765 |
+
* @param Snippet $snippet The snippet currently being edited.
|
766 |
+
* @param string $size Additional size classes to pass to button.
|
767 |
+
* @param bool $extra_actions Whether to include additional buttons alongside save buttons.
|
768 |
+
*/
|
769 |
+
public function render_submit_buttons( $snippet, $size = '', $extra_actions = true ) {
|
770 |
+
|
771 |
+
$actions = $this->get_actions_list( $snippet, $extra_actions );
|
772 |
+
$type = 'primary';
|
773 |
+
$size = $size ? ' ' . $size : '';
|
774 |
+
|
775 |
+
foreach ( $actions as $action => $label ) {
|
776 |
+
$other = null;
|
777 |
+
|
778 |
+
if ( 'delete_snippet' === $action ) {
|
779 |
+
$other = sprintf(
|
780 |
+
'onclick="%s"',
|
781 |
+
esc_js(
|
782 |
+
sprintf(
|
783 |
+
'return confirm("%s");',
|
784 |
+
esc_html__( 'You are about to permanently delete this snippet.', 'code-snippets' ) . "\n" .
|
785 |
+
esc_html__( "'Cancel' to stop, 'OK' to delete.", 'code-snippets' )
|
786 |
+
)
|
787 |
+
)
|
788 |
+
);
|
789 |
+
}
|
790 |
+
|
791 |
+
submit_button( $label, $type . $size, $action, false, $other );
|
792 |
+
|
793 |
+
if ( 'primary' === $type ) {
|
794 |
+
$type = 'secondary';
|
795 |
+
}
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
/**
|
800 |
+
* Render a list of scopes as ratio controls
|
801 |
+
*
|
802 |
+
* @param array $scopes List of scopes to render, with scope name keyed to label.
|
803 |
+
*/
|
804 |
+
public function print_scopes_list( $scopes ) {
|
805 |
+
$scope_icons = Snippet::get_scope_icons();
|
806 |
+
|
807 |
+
foreach ( $scopes as $scope => $label ) {
|
808 |
+
printf( '<label><input type="radio" name="snippet_scope" value="%s"', esc_attr( $scope ) );
|
809 |
+
checked( $scope, $this->snippet->scope );
|
810 |
+
printf( '> <span class="dashicons dashicons-%s"></span> %s</label>', esc_attr( $scope_icons[ $scope ] ), esc_html( $label ) );
|
811 |
+
}
|
812 |
+
}
|
813 |
+
|
814 |
+
/**
|
815 |
+
* Render a keyboard shortcut as HTML.
|
816 |
+
*
|
817 |
+
* @param array|string $modifiers Modifier keys. Can be 'Cmd', 'Ctrl', 'Shift', 'Option', 'Alt'.
|
818 |
+
* @param string $key Keyboard key.
|
819 |
+
*
|
820 |
+
* @return void
|
821 |
+
*/
|
822 |
+
protected function render_keyboard_shortcut( $modifiers, $key ) {
|
823 |
+
static $keys = null;
|
824 |
+
|
825 |
+
if ( is_null( $keys ) ) {
|
826 |
+
$keys = array(
|
827 |
+
'Cmd' => _x( 'Cmd', 'keyboard key', 'code-snippets' ),
|
828 |
+
'Ctrl' => _x( 'Ctrl', 'keyboard key', 'code-snippets' ),
|
829 |
+
'Shift' => _x( 'Shift', 'keyboard key', 'code-snippets' ),
|
830 |
+
'Option' => _x( 'Option', 'keyboard key', 'code-snippets' ),
|
831 |
+
'Alt' => _x( 'Alt', 'keyboard key', 'code-snippets' ),
|
832 |
+
'Up' => _x( 'Up', 'keyboard key', 'code-snippets' ),
|
833 |
+
'Down' => _x( 'Down', 'keyboard key', 'code-snippets' ),
|
834 |
+
'F' => _x( 'F', 'keyboard key', 'code-snippets' ),
|
835 |
+
'G' => _x( 'G', 'keyboard key', 'code-snippets' ),
|
836 |
+
'R' => _x( 'R', 'keyboard key', 'code-snippets' ),
|
837 |
+
'S' => _x( 'S', 'keyboard key', 'code-snippets' ),
|
838 |
+
'/' => _x( '/', 'keyboard key', 'code-snippets' ),
|
839 |
+
);
|
840 |
+
}
|
841 |
+
|
842 |
+
if ( ! is_array( $modifiers ) ) {
|
843 |
+
$modifiers = array( $modifiers );
|
844 |
+
}
|
845 |
+
|
846 |
+
foreach ( $modifiers as $modifier ) {
|
847 |
+
if ( 'Ctrl' === $modifier || 'Cmd' === $modifier ) {
|
848 |
+
echo '<kbd class="pc-key">', esc_html( $keys['Ctrl'] ), '</kbd>';
|
849 |
+
echo '<kbd class="mac-key">', esc_html( $keys['Cmd'] ), '</kbd>‐';
|
850 |
+
} elseif ( 'Option' === $modifier ) {
|
851 |
+
echo '<span class="mac-key"><kbd class="mac-key">', esc_html( $keys['Option'] ), '</kbd>‐</span>';
|
852 |
+
} else {
|
853 |
+
echo '<kbd>', esc_html( $keys[ $modifier ] ), '</kbd>‐';
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
echo '<kbd>', esc_html( $keys[ $key ] ), '</kbd>';
|
858 |
+
}
|
859 |
+
}
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class handles the import admin menu.
|
7 |
+
*
|
8 |
+
* @since 2.4.0
|
9 |
+
* @package Code_Snippets
|
10 |
+
*/
|
11 |
+
class Import_Menu extends Admin_Menu {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class constructor
|
15 |
+
*/
|
16 |
+
public function __construct() {
|
17 |
+
parent::__construct(
|
18 |
+
'import',
|
19 |
+
_x( 'Import', 'menu label', 'code-snippets' ),
|
20 |
+
__( 'Import Snippets', 'code-snippets' )
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Register action and filter hooks
|
26 |
+
*/
|
27 |
+
public function run() {
|
28 |
+
parent::run();
|
29 |
+
add_action( 'admin_init', array( $this, 'register_importer' ) );
|
30 |
+
add_action( 'load-importer-code-snippets', array( $this, 'load' ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Executed when the menu is loaded
|
35 |
+
*/
|
36 |
+
public function load() {
|
37 |
+
parent::load();
|
38 |
+
|
39 |
+
$contextual_help = new Contextual_Help( 'import' );
|
40 |
+
$contextual_help->load();
|
41 |
+
|
42 |
+
$this->process_import_files();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Process the uploaded import files
|
47 |
+
*/
|
48 |
+
private function process_import_files() {
|
49 |
+
|
50 |
+
/* Ensure the import file exists */
|
51 |
+
if ( ! isset(
|
52 |
+
$_FILES['code_snippets_import_files']['name'],
|
53 |
+
$_FILES['code_snippets_import_files']['type'],
|
54 |
+
$_FILES['code_snippets_import_files']['tmp_name']
|
55 |
+
) ) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
check_admin_referer( 'import_code_snippets_file' );
|
60 |
+
|
61 |
+
$count = 0;
|
62 |
+
$network = is_network_admin();
|
63 |
+
$error = false;
|
64 |
+
|
65 |
+
$upload_files = array_map( 'sanitize_text_field', wp_unslash( $_FILES['code_snippets_import_files']['tmp_name'] ) );
|
66 |
+
$upload_filenames = array_map( 'sanitize_text_field', wp_unslash( $_FILES['code_snippets_import_files']['name'] ) );
|
67 |
+
$upload_mime_types = array_map( 'sanitize_mime_type', wp_unslash( $_FILES['code_snippets_import_files']['type'] ) );
|
68 |
+
|
69 |
+
$dup_action = isset( $_POST['duplicate_action'] ) ? sanitize_key( $_POST['duplicate_action'] ) : 'ignore';
|
70 |
+
|
71 |
+
/* Loop through the uploaded files and import the snippets */
|
72 |
+
|
73 |
+
foreach ( $upload_files as $i => $import_file ) {
|
74 |
+
$ext = pathinfo( $upload_filenames[ $i ] );
|
75 |
+
$ext = $ext['extension'];
|
76 |
+
$mime_type = $upload_mime_types[ $i ];
|
77 |
+
|
78 |
+
$import = new Import( $import_file, $network, $dup_action );
|
79 |
+
|
80 |
+
if ( 'json' === $ext || 'application/json' === $mime_type ) {
|
81 |
+
$result = $import->import_json();
|
82 |
+
} elseif ( 'xml' === $ext || 'text/xml' === $mime_type ) {
|
83 |
+
$result = $import->import_xml();
|
84 |
+
} else {
|
85 |
+
$result = false;
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( false === $result ) {
|
89 |
+
$error = true;
|
90 |
+
} else {
|
91 |
+
$count += count( $result );
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/* Send the amount of imported snippets to the page */
|
96 |
+
$url = add_query_arg( $error ? array( 'error' => true ) : array( 'imported' => $count ) );
|
97 |
+
wp_safe_redirect( esc_url_raw( $url ) );
|
98 |
+
exit;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Add the importer to the Tools > Import menu
|
103 |
+
*/
|
104 |
+
public function register_importer() {
|
105 |
+
|
106 |
+
/* Only register the importer if the current user can manage snippets */
|
107 |
+
if ( ! defined( 'WP_LOAD_IMPORTERS' ) || ! code_snippets()->current_user_can() ) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
/* Register the Code Snippets importer with WordPress */
|
112 |
+
register_importer(
|
113 |
+
'code-snippets',
|
114 |
+
__( 'Code Snippets', 'code-snippets' ),
|
115 |
+
__( 'Import snippets from a code snippets export file', 'code-snippets' ),
|
116 |
+
array( $this, 'render' )
|
117 |
+
);
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Print the status and error messages
|
122 |
+
*/
|
123 |
+
protected function print_messages() {
|
124 |
+
|
125 |
+
if ( ! empty( $_REQUEST['error'] ) ) {
|
126 |
+
echo '<div id="message" class="error fade"><p>';
|
127 |
+
esc_html_e( 'An error occurred when processing the import files.', 'code-snippets' );
|
128 |
+
echo '</p></div>';
|
129 |
+
}
|
130 |
+
|
131 |
+
if ( ! empty( $_REQUEST['imported'] ) && intval( $_REQUEST['imported'] ) >= 0 ) {
|
132 |
+
echo '<div id="message" class="updated fade"><p>';
|
133 |
+
|
134 |
+
$imported = intval( $_REQUEST['imported'] );
|
135 |
+
|
136 |
+
if ( 0 === $imported ) {
|
137 |
+
esc_html_e( 'No snippets were imported.', 'code-snippets' );
|
138 |
+
|
139 |
+
} else {
|
140 |
+
/* translators: 1: amount of snippets imported, 2: link to Snippets menu */
|
141 |
+
$text = _n(
|
142 |
+
'Successfully imported <strong>%1$d</strong> snippet. <a href="%2$s">Have fun!</a>',
|
143 |
+
'Successfully imported <strong>%1$d</strong> snippets. <a href="%2$s">Have fun!</a>',
|
144 |
+
$imported,
|
145 |
+
'code-snippets'
|
146 |
+
);
|
147 |
+
|
148 |
+
printf( wp_kses_post( $text ), esc_html( $imported ), esc_url( code_snippets()->get_menu_url( 'manage' ) ) );
|
149 |
+
}
|
150 |
+
|
151 |
+
echo '</p></div>';
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Empty implementation for enqueue_assets.
|
157 |
+
*
|
158 |
+
* @return void
|
159 |
+
*/
|
160 |
+
public function enqueue_assets() {
|
161 |
+
// none required.
|
162 |
+
}
|
163 |
+
}
|
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class handles the manage snippets menu
|
7 |
+
*
|
8 |
+
* @since 2.4.0
|
9 |
+
* @package Code_Snippets
|
10 |
+
*/
|
11 |
+
class Manage_Menu extends Admin_Menu {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Holds the list table class
|
15 |
+
*
|
16 |
+
* @var List_Table
|
17 |
+
*/
|
18 |
+
public $list_table;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Class constructor
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
parent::__construct(
|
26 |
+
'manage',
|
27 |
+
_x( 'All Snippets', 'menu label', 'code-snippets' ),
|
28 |
+
__( 'Snippets', 'code-snippets' )
|
29 |
+
);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Register action and filter hooks
|
34 |
+
*/
|
35 |
+
public function run() {
|
36 |
+
parent::run();
|
37 |
+
|
38 |
+
if ( code_snippets()->is_compact_menu() ) {
|
39 |
+
add_action( 'admin_menu', array( $this, 'register_compact_menu' ), 2 );
|
40 |
+
add_action( 'network_admin_menu', array( $this, 'register_compact_menu' ), 2 );
|
41 |
+
}
|
42 |
+
|
43 |
+
add_filter( 'set-screen-option', array( $this, 'save_screen_option' ), 10, 3 );
|
44 |
+
add_action( 'wp_ajax_update_code_snippet', array( $this, 'ajax_callback' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Register the top-level 'Snippets' menu and associated 'Manage' subpage
|
49 |
+
*/
|
50 |
+
public function register() {
|
51 |
+
$icon_xml = '<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024"><path fill="transparent" d="M191.968 464.224H350.88c23.68 0 42.656 19.2 42.656 42.656 0 11.488-4.48 21.984-11.968 29.632l.192.448-108.768 108.736c-75.104 75.136-75.104 196.512 0 271.584 74.88 74.848 196.448 74.848 271.552 0 74.88-75.104 74.88-196.48 0-271.584-21.76-21.504-47.36-37.12-74.464-46.272l28.608-28.576h365.248c87.04 0 157.856-74.016 159.968-166.4 0-1.472.224-2.752 0-4.256-2.112-23.904-22.368-42.656-46.912-42.656h-264.96L903.36 166.208c17.504-17.504 18.56-45.024 3.2-63.36-1.024-1.28-2.08-2.144-3.2-3.2-66.528-63.552-169.152-65.92-230.56-4.48L410.432 357.536h-46.528c12.8-25.6 20.032-54.624 20.032-85.344 0-106.016-85.952-192-192-192-106.016 0-191.968 85.984-191.968 192 .032 106.08 85.984 192.032 192 192.032zm85.344-191.968c0 47.136-38.176 85.344-85.344 85.344-47.136 0-85.312-38.176-85.312-85.344s38.176-85.344 85.312-85.344c47.168 0 85.344 38.208 85.344 85.344zm191.776 449.056c33.28 33.248 33.28 87.264 0 120.512-33.28 33.472-87.264 33.472-120.736 0-33.28-33.248-33.28-87.264 0-120.512 33.472-33.504 87.456-33.504 120.736 0z"/></svg>';
|
52 |
+
// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
53 |
+
$encoded_icon = base64_encode( $icon_xml );
|
54 |
+
|
55 |
+
// Register the top-level menu.
|
56 |
+
add_menu_page(
|
57 |
+
__( 'Snippets', 'code-snippets' ),
|
58 |
+
_x( 'Snippets', 'top-level menu label', 'code-snippets' ),
|
59 |
+
code_snippets()->get_cap(),
|
60 |
+
code_snippets()->get_menu_slug(),
|
61 |
+
array( $this, 'render' ),
|
62 |
+
"data:image/svg+xml;base64,$encoded_icon",
|
63 |
+
is_network_admin() ? 21 : 67
|
64 |
+
);
|
65 |
+
|
66 |
+
// Register the sub-menu.
|
67 |
+
parent::register();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add menu pages for the compact menu
|
72 |
+
*/
|
73 |
+
public function register_compact_menu() {
|
74 |
+
|
75 |
+
if ( ! code_snippets()->is_compact_menu() ) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
$sub = code_snippets()->get_menu_slug( isset( $_GET['sub'] ) ? sanitize_key( $_GET['sub'] ) : 'snippets' );
|
80 |
+
|
81 |
+
$classmap = array(
|
82 |
+
'snippets' => 'manage',
|
83 |
+
'add-snippet' => 'edit',
|
84 |
+
'edit-snippet' => 'edit',
|
85 |
+
'import-code-snippets' => 'import',
|
86 |
+
'snippets-settings' => 'settings',
|
87 |
+
);
|
88 |
+
|
89 |
+
if ( isset( $classmap[ $sub ], code_snippets()->admin->menus[ $classmap[ $sub ] ] ) ) {
|
90 |
+
/* @var Admin_Menu $class */
|
91 |
+
$class = code_snippets()->admin->menus[ $classmap[ $sub ] ];
|
92 |
+
} else {
|
93 |
+
$class = $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
/* Add a submenu to the Tools menu */
|
97 |
+
$hook = add_submenu_page(
|
98 |
+
'tools.php',
|
99 |
+
__( 'Snippets', 'code-snippets' ),
|
100 |
+
_x( 'Snippets', 'tools submenu label', 'code-snippets' ),
|
101 |
+
code_snippets()->get_cap(),
|
102 |
+
code_snippets()->get_menu_slug(),
|
103 |
+
array( $class, 'render' )
|
104 |
+
);
|
105 |
+
|
106 |
+
add_action( 'load-' . $hook, array( $class, 'load' ) );
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Executed when the admin page is loaded
|
112 |
+
*/
|
113 |
+
public function load() {
|
114 |
+
parent::load();
|
115 |
+
|
116 |
+
/* Load the contextual help tabs */
|
117 |
+
$contextual_help = new Contextual_Help( 'manage' );
|
118 |
+
$contextual_help->load();
|
119 |
+
|
120 |
+
/* Initialize the list table class */
|
121 |
+
$this->list_table = new List_Table();
|
122 |
+
$this->list_table->prepare_items();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Enqueue scripts and stylesheets for the admin page
|
127 |
+
*/
|
128 |
+
public function enqueue_assets() {
|
129 |
+
$plugin = code_snippets();
|
130 |
+
$rtl = is_rtl() ? '-rtl' : '';
|
131 |
+
|
132 |
+
wp_enqueue_style(
|
133 |
+
'code-snippets-manage',
|
134 |
+
plugins_url( "dist/manage$rtl.css", $plugin->file ),
|
135 |
+
array(),
|
136 |
+
$plugin->version
|
137 |
+
);
|
138 |
+
|
139 |
+
wp_enqueue_script(
|
140 |
+
'code-snippets-manage-js',
|
141 |
+
plugins_url( 'dist/manage.js', $plugin->file ),
|
142 |
+
array(),
|
143 |
+
$plugin->version,
|
144 |
+
true
|
145 |
+
);
|
146 |
+
|
147 |
+
wp_localize_script(
|
148 |
+
'code-snippets-manage-js',
|
149 |
+
'code_snippets_manage_i18n',
|
150 |
+
array(
|
151 |
+
'activate' => __( 'Activate', 'code-snippets' ),
|
152 |
+
'deactivate' => __( 'Deactivate', 'code-snippets' ),
|
153 |
+
'activation_error' => __( 'An error occurred when attempting to activate', 'code-snippets' ),
|
154 |
+
)
|
155 |
+
);
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Print the status and error messages
|
160 |
+
*/
|
161 |
+
protected function print_messages() {
|
162 |
+
|
163 |
+
/* Output a warning if safe mode is active */
|
164 |
+
if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) {
|
165 |
+
echo '<div id="message" class="error fade"><p>';
|
166 |
+
echo wp_kses_post( __( '<strong>Warning:</strong> Safe mode is active and snippets will not execute! Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-config.php</code> to turn off safe mode. <a href="https://help.codesnippets.pro/article/12-safe-mode" target="_blank">Help</a>', 'code-snippets' ) );
|
167 |
+
echo '</p></div>';
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->print_result_message(
|
171 |
+
apply_filters(
|
172 |
+
'code_snippets/manage/result_messages',
|
173 |
+
array(
|
174 |
+
'executed' => __( 'Snippet <strong>executed</strong>.', 'code-snippets' ),
|
175 |
+
'activated' => __( 'Snippet <strong>activated</strong>.', 'code-snippets' ),
|
176 |
+
'activated-multi' => __( 'Selected snippets <strong>activated</strong>.', 'code-snippets' ),
|
177 |
+
'deactivated' => __( 'Snippet <strong>deactivated</strong>.', 'code-snippets' ),
|
178 |
+
'deactivated-multi' => __( 'Selected snippets <strong>deactivated</strong>.', 'code-snippets' ),
|
179 |
+
'deleted' => __( 'Snippet <strong>deleted</strong>.', 'code-snippets' ),
|
180 |
+
'deleted-multi' => __( 'Selected snippets <strong>deleted</strong>.', 'code-snippets' ),
|
181 |
+
'cloned' => __( 'Snippet <strong>cloned</strong>.', 'code-snippets' ),
|
182 |
+
'cloned-multi' => __( 'Selected snippets <strong>cloned</strong>.', 'code-snippets' ),
|
183 |
+
)
|
184 |
+
)
|
185 |
+
);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Handles saving the user's snippets per page preference
|
190 |
+
*
|
191 |
+
* @param mixed $status Current screen option status.
|
192 |
+
* @param string $option The screen option name.
|
193 |
+
* @param mixed $value Screen option value.
|
194 |
+
*
|
195 |
+
* @return mixed
|
196 |
+
*/
|
197 |
+
public function save_screen_option( $status, $option, $value ) {
|
198 |
+
if ( 'snippets_per_page' === $option ) {
|
199 |
+
return $value;
|
200 |
+
}
|
201 |
+
|
202 |
+
return $status;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Update the priority value for a snippet.
|
207 |
+
*
|
208 |
+
* @param Snippet $snippet Snippet to update.
|
209 |
+
*
|
210 |
+
* @return void
|
211 |
+
*/
|
212 |
+
private function update_snippet_priority( Snippet $snippet ) {
|
213 |
+
global $wpdb;
|
214 |
+
$table = code_snippets()->db->get_table_name( $snippet->network );
|
215 |
+
|
216 |
+
$wpdb->update(
|
217 |
+
$table,
|
218 |
+
array( 'priority' => $snippet->priority ),
|
219 |
+
array( 'id' => $snippet->id ),
|
220 |
+
array( '%d' ),
|
221 |
+
array( '%d' )
|
222 |
+
); // db call ok.
|
223 |
+
|
224 |
+
clean_snippets_cache( $table );
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Handle AJAX requests
|
229 |
+
*/
|
230 |
+
public function ajax_callback() {
|
231 |
+
check_ajax_referer( 'code_snippets_manage_ajax' );
|
232 |
+
|
233 |
+
if ( ! isset( $_POST['field'], $_POST['snippet'] ) ) {
|
234 |
+
wp_send_json_error(
|
235 |
+
array(
|
236 |
+
'type' => 'param_error',
|
237 |
+
'message' => 'incomplete request',
|
238 |
+
)
|
239 |
+
);
|
240 |
+
}
|
241 |
+
|
242 |
+
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
243 |
+
$snippet_data = array_map( 'sanitize_text_field', json_decode( wp_unslash( $_POST['snippet'] ), true ) );
|
244 |
+
|
245 |
+
$snippet = new Snippet( $snippet_data );
|
246 |
+
$field = sanitize_key( $_POST['field'] );
|
247 |
+
|
248 |
+
if ( 'priority' === $field ) {
|
249 |
+
|
250 |
+
if ( ! isset( $snippet_data['priority'] ) || ! is_numeric( $snippet_data['priority'] ) ) {
|
251 |
+
wp_send_json_error(
|
252 |
+
array(
|
253 |
+
'type' => 'param_error',
|
254 |
+
'message' => 'missing snippet priority data',
|
255 |
+
)
|
256 |
+
);
|
257 |
+
}
|
258 |
+
|
259 |
+
$this->update_snippet_priority( $snippet );
|
260 |
+
|
261 |
+
} elseif ( 'active' === $field ) {
|
262 |
+
|
263 |
+
if ( ! isset( $snippet_data['active'] ) ) {
|
264 |
+
wp_send_json_error(
|
265 |
+
array(
|
266 |
+
'type' => 'param_error',
|
267 |
+
'message' => 'missing snippet active data',
|
268 |
+
)
|
269 |
+
);
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( $snippet->shared_network ) {
|
273 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
274 |
+
|
275 |
+
if ( in_array( $snippet->id, $active_shared_snippets, true ) !== $snippet->active ) {
|
276 |
+
|
277 |
+
$active_shared_snippets = $snippet->active ?
|
278 |
+
array_merge( $active_shared_snippets, array( $snippet->id ) ) :
|
279 |
+
array_diff( $active_shared_snippets, array( $snippet->id ) );
|
280 |
+
|
281 |
+
update_option( 'active_shared_network_snippets', $active_shared_snippets );
|
282 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
283 |
+
}
|
284 |
+
} else {
|
285 |
+
|
286 |
+
if ( $snippet->active ) {
|
287 |
+
$result = activate_snippet( $snippet->id, $snippet->network );
|
288 |
+
if ( is_string( $result ) ) {
|
289 |
+
wp_send_json_error(
|
290 |
+
array(
|
291 |
+
'type' => 'action_error',
|
292 |
+
'message' => $result,
|
293 |
+
)
|
294 |
+
);
|
295 |
+
}
|
296 |
+
} else {
|
297 |
+
deactivate_snippet( $snippet->id, $snippet->network );
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
wp_send_json_success();
|
303 |
+
}
|
304 |
+
}
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class handles the settings admin menu
|
7 |
+
*
|
8 |
+
* @since 2.4.0
|
9 |
+
* @package Code_Snippets
|
10 |
+
*/
|
11 |
+
class Settings_Menu extends Admin_Menu {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Settings page name as registered with the Settings API.
|
15 |
+
*/
|
16 |
+
const SETTINGS_PAGE = 'code-snippets';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
|
23 |
+
parent::__construct(
|
24 |
+
'settings',
|
25 |
+
_x( 'Settings', 'menu label', 'code-snippets' ),
|
26 |
+
__( 'Snippets Settings', 'code-snippets' )
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Executed when the admin page is loaded
|
32 |
+
*/
|
33 |
+
public function load() {
|
34 |
+
parent::load();
|
35 |
+
|
36 |
+
if ( ! empty( $_GET['reset_settings'] ) ) {
|
37 |
+
|
38 |
+
if ( Settings\are_settings_unified() ) {
|
39 |
+
delete_site_option( 'code_snippets_settings' );
|
40 |
+
} else {
|
41 |
+
delete_option( 'code_snippets_settings' );
|
42 |
+
}
|
43 |
+
|
44 |
+
add_settings_error(
|
45 |
+
'code-snippets-settings-notices',
|
46 |
+
'settings_reset',
|
47 |
+
__( 'All settings have been reset to their defaults.', 'code-snippets' ),
|
48 |
+
'updated'
|
49 |
+
);
|
50 |
+
|
51 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
52 |
+
|
53 |
+
wp_safe_redirect( esc_url_raw( add_query_arg( 'settings-updated', true, remove_query_arg( 'reset_settings' ) ) ) );
|
54 |
+
exit;
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( is_network_admin() ) {
|
58 |
+
if ( Settings\are_settings_unified() ) {
|
59 |
+
$this->update_network_options();
|
60 |
+
} else {
|
61 |
+
wp_safe_redirect( code_snippets()->get_menu_url( 'settings', 'admin' ) );
|
62 |
+
exit;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Enqueue the stylesheet for the settings menu
|
69 |
+
*/
|
70 |
+
public function enqueue_assets() {
|
71 |
+
$plugin = code_snippets();
|
72 |
+
|
73 |
+
Settings\enqueue_editor_preview_assets();
|
74 |
+
|
75 |
+
wp_enqueue_style(
|
76 |
+
'code-snippets-settings',
|
77 |
+
plugins_url( 'dist/settings.css', $plugin->file ),
|
78 |
+
[],
|
79 |
+
$plugin->version
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Retrieve the list of settings sections.
|
85 |
+
*
|
86 |
+
* @return array
|
87 |
+
*/
|
88 |
+
private function get_sections() {
|
89 |
+
global $wp_settings_sections;
|
90 |
+
|
91 |
+
if ( ! isset( $wp_settings_sections[ self::SETTINGS_PAGE ] ) ) {
|
92 |
+
return array();
|
93 |
+
}
|
94 |
+
|
95 |
+
return (array) $wp_settings_sections[ self::SETTINGS_PAGE ];
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Retrieve the name of the settings section currently being viewed.
|
100 |
+
*
|
101 |
+
* @param string $default Name of the default tab displayed.
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*/
|
105 |
+
public function get_current_section( $default = 'general' ) {
|
106 |
+
$sections = $this->get_sections();
|
107 |
+
|
108 |
+
if ( ! $sections ) {
|
109 |
+
return $default;
|
110 |
+
}
|
111 |
+
|
112 |
+
$active_tab = isset( $_REQUEST['section'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['section'] ) ) : $default;
|
113 |
+
return isset( $sections[ $active_tab ] ) ? $active_tab : $default;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Render the admin screen
|
118 |
+
*/
|
119 |
+
public function render() {
|
120 |
+
$update_url = is_network_admin() ? add_query_arg( 'update_site_option', true ) : admin_url( 'options.php' );
|
121 |
+
$current_section = $this->get_current_section();
|
122 |
+
|
123 |
+
?>
|
124 |
+
<div class="code-snippets-settings wrap" data-active-tab="<?php echo esc_attr( $current_section ); ?>">
|
125 |
+
<h1>
|
126 |
+
<?php
|
127 |
+
esc_html_e( 'Settings', 'code-snippets' );
|
128 |
+
|
129 |
+
if ( code_snippets()->is_compact_menu() ) {
|
130 |
+
$actions = [
|
131 |
+
_x( 'Manage', 'snippets', 'code-snippets' ) => code_snippets()->get_menu_url(),
|
132 |
+
_x( 'Add New', 'snippet', 'code-snippets' ) => code_snippets()->get_menu_url( 'add' ),
|
133 |
+
_X( 'Import', 'snippets', 'code-snippets' ) => code_snippets()->get_menu_url( 'import' ),
|
134 |
+
];
|
135 |
+
|
136 |
+
foreach ( $actions as $label => $url ) {
|
137 |
+
printf(
|
138 |
+
'<a href="%s" class="page-title-action">%s</a>',
|
139 |
+
esc_url( $url ),
|
140 |
+
esc_html( $label )
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
?>
|
145 |
+
</h1>
|
146 |
+
|
147 |
+
<?php settings_errors( 'code-snippets-settings-notices' ); ?>
|
148 |
+
|
149 |
+
<form action="<?php echo esc_url( $update_url ); ?>" method="post">
|
150 |
+
<input type="hidden" name="section" value="<?php echo esc_attr( $current_section ); ?>">
|
151 |
+
<?php
|
152 |
+
|
153 |
+
settings_fields( 'code-snippets' );
|
154 |
+
$this->do_settings_tabs();
|
155 |
+
|
156 |
+
?>
|
157 |
+
<p class="submit">
|
158 |
+
<?php submit_button( null, 'primary', 'submit', false ); ?>
|
159 |
+
|
160 |
+
<a class="button button-secondary"
|
161 |
+
href="<?php echo esc_url( add_query_arg( 'reset_settings', true ) ); ?>"><?php
|
162 |
+
esc_html_e( 'Reset to Default', 'code-snippets' ); ?></a>
|
163 |
+
</p>
|
164 |
+
</form>
|
165 |
+
</div>
|
166 |
+
<?php
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Output snippet settings in tabs
|
171 |
+
*/
|
172 |
+
protected function do_settings_tabs() {
|
173 |
+
$sections = $this->get_sections();
|
174 |
+
$active_tab = $this->get_current_section();
|
175 |
+
|
176 |
+
echo '<h2 class="nav-tab-wrapper" id="settings-sections-tabs">';
|
177 |
+
|
178 |
+
foreach ( $sections as $section ) {
|
179 |
+
printf(
|
180 |
+
'<a class="nav-tab%s" data-section="%s" href="%s">%s</a>',
|
181 |
+
esc_attr( $active_tab ) === $section['id'] ? ' nav-tab-active' : '',
|
182 |
+
esc_attr( $section['id'] ),
|
183 |
+
esc_url( add_query_arg( 'section', $section['id'] ) ),
|
184 |
+
esc_html( $section['title'] )
|
185 |
+
);
|
186 |
+
}
|
187 |
+
|
188 |
+
echo '</h2>';
|
189 |
+
|
190 |
+
foreach ( $sections as $section ) {
|
191 |
+
|
192 |
+
if ( $section['title'] ) {
|
193 |
+
printf(
|
194 |
+
'<h2 id="%s-settings" class="settings-section-title">%s</h2>' . "\n",
|
195 |
+
esc_attr( $section['id'] ),
|
196 |
+
esc_html( $section['title'] )
|
197 |
+
);
|
198 |
+
}
|
199 |
+
|
200 |
+
if ( $section['callback'] ) {
|
201 |
+
call_user_func( $section['callback'], $section );
|
202 |
+
}
|
203 |
+
|
204 |
+
printf( '<table class="form-table settings-section %s-settings">', esc_attr( $section['id'] ) );
|
205 |
+
|
206 |
+
do_settings_fields( self::SETTINGS_PAGE, $section['id'] );
|
207 |
+
echo '</table>';
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Fill in for the Settings API in the Network Admin
|
213 |
+
*/
|
214 |
+
public function update_network_options() {
|
215 |
+
|
216 |
+
// Ensure the settings have been saved.
|
217 |
+
if ( empty( $_GET['update_site_option'] ) || empty( $_POST['code_snippets_settings'] ) ) {
|
218 |
+
return;
|
219 |
+
}
|
220 |
+
|
221 |
+
check_admin_referer( 'code-snippets-options' );
|
222 |
+
|
223 |
+
// Retrieve the saved options and save them to the database.
|
224 |
+
$value = map_deep( wp_unslash( $_POST['code_snippets_settings'] ), 'sanitize_key' );
|
225 |
+
update_site_option( 'code_snippets_settings', $value );
|
226 |
+
wp_cache_delete( Settings\CACHE_KEY );
|
227 |
+
|
228 |
+
// Add an updated notice.
|
229 |
+
if ( ! count( get_settings_errors() ) ) {
|
230 |
+
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.', 'code-snippets' ), 'updated' );
|
231 |
+
}
|
232 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
233 |
+
|
234 |
+
// Redirect back to the settings menu.
|
235 |
+
$redirect = add_query_arg( 'settings-updated', 'true', remove_query_arg( 'update_site_option', wp_get_referer() ) );
|
236 |
+
wp_safe_redirect( esc_url_raw( $redirect ) );
|
237 |
+
exit;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Empty implementation for print_messages.
|
242 |
+
*
|
243 |
+
* @return void
|
244 |
+
*/
|
245 |
+
protected function print_messages() {
|
246 |
+
// none required.
|
247 |
+
}
|
248 |
+
}
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class for loading active snippets of various types.
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Active_Snippets {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* List of content snippets.
|
14 |
+
*
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
private $content_snippets = [];
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Class constructor.
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
add_action( 'init', array( $this, 'init' ) );
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Initialise class functions.
|
28 |
+
*/
|
29 |
+
public function init() {
|
30 |
+
$db = code_snippets()->db;
|
31 |
+
$this->content_snippets = $db->fetch_active_snippets( [ 'head-content', 'footer-content' ] );
|
32 |
+
|
33 |
+
add_action( 'wp_head', [ $this, 'load_head_content' ] );
|
34 |
+
add_action( 'wp_footer', [ $this, 'load_footer_content' ] );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Print snippet code fetched from the database from a certain scope.
|
39 |
+
*
|
40 |
+
* @param array $snippets_list List of data fetched.
|
41 |
+
* @param string $scope Name of scope to print.
|
42 |
+
*/
|
43 |
+
private function print_content_snippets( $snippets_list, $scope ) {
|
44 |
+
foreach ( $snippets_list as $snippets ) {
|
45 |
+
foreach ( $snippets as $snippet ) {
|
46 |
+
if ( $scope === $snippet['scope'] ) {
|
47 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
48 |
+
echo "\n", $snippet['code'], "\n";
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Print head content snippets.
|
56 |
+
*/
|
57 |
+
public function load_head_content() {
|
58 |
+
$this->print_content_snippets( $this->content_snippets, 'head-content' );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Print footer content snippets.
|
63 |
+
*/
|
64 |
+
public function load_footer_content() {
|
65 |
+
$this->print_content_snippets( $this->content_snippets, 'footer-content' );
|
66 |
+
}
|
67 |
+
}
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Functions specific to the administration interface
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Admin {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Admin_Menu class instances
|
14 |
+
*
|
15 |
+
* @var array
|
16 |
+
*/
|
17 |
+
public $menus = array();
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Class constructor
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
if ( is_admin() ) {
|
24 |
+
$this->run();
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Initialise classes
|
30 |
+
*/
|
31 |
+
public function load_classes() {
|
32 |
+
$this->menus['manage'] = new Manage_Menu();
|
33 |
+
$this->menus['edit'] = new Edit_Menu();
|
34 |
+
$this->menus['import'] = new Import_Menu();
|
35 |
+
|
36 |
+
if ( is_network_admin() === Settings\are_settings_unified() ) {
|
37 |
+
$this->menus['settings'] = new Settings_Menu();
|
38 |
+
}
|
39 |
+
|
40 |
+
foreach ( $this->menus as $menu ) {
|
41 |
+
$menu->run();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Register action and filter hooks
|
47 |
+
*/
|
48 |
+
public function run() {
|
49 |
+
add_action( 'init', array( $this, 'load_classes' ), 11 );
|
50 |
+
|
51 |
+
add_filter( 'mu_menu_items', array( $this, 'mu_menu_items' ) );
|
52 |
+
add_filter( 'plugin_action_links_' . plugin_basename( PLUGIN_FILE ), array( $this, 'plugin_settings_link' ) );
|
53 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 2 );
|
54 |
+
add_filter( 'debug_information', array( $this, 'debug_information' ) );
|
55 |
+
add_action( 'code_snippets/admin/manage', array( $this, 'print_notices' ) );
|
56 |
+
|
57 |
+
if ( ! empty( $_POST['save_snippet'] ) ) {
|
58 |
+
add_action( 'code_snippets/allow_execute_snippet', array( $this, 'prevent_exec_on_save' ), 10, 3 );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Allow super admins to control site admin access to
|
64 |
+
* snippet admin menus
|
65 |
+
*
|
66 |
+
* Adds a checkbox to the *Settings > Network Settings*
|
67 |
+
* network admin menu
|
68 |
+
*
|
69 |
+
* @param array $menu_items Current mu menu items.
|
70 |
+
*
|
71 |
+
* @return array The modified mu menu items
|
72 |
+
*
|
73 |
+
* @since 1.7.1
|
74 |
+
*/
|
75 |
+
public function mu_menu_items( $menu_items ) {
|
76 |
+
$menu_items['snippets'] = __( 'Snippets', 'code-snippets' );
|
77 |
+
$menu_items['snippets_settings'] = __( 'Snippets » Settings', 'code-snippets' );
|
78 |
+
|
79 |
+
return $menu_items;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Prevent the snippet currently being saved from being executed
|
84 |
+
* so that it is not run twice (once normally, once when validated)
|
85 |
+
*
|
86 |
+
* @param bool $exec Whether the snippet will be executed.
|
87 |
+
* @param int $exec_id ID of the snippet being executed.
|
88 |
+
* @param string $table_name Name of the database table the snippet is stored in.
|
89 |
+
*
|
90 |
+
* @return bool Whether the snippet will be executed.
|
91 |
+
*/
|
92 |
+
public function prevent_exec_on_save( $exec, $exec_id, $table_name ) {
|
93 |
+
|
94 |
+
if ( ! isset( $_POST['save_snippet'], $_POST['snippet_id'] ) ) {
|
95 |
+
return $exec;
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( code_snippets()->db->get_table_name() !== $table_name ) {
|
99 |
+
return $exec;
|
100 |
+
}
|
101 |
+
|
102 |
+
$id = intval( $_POST['snippet_id'] );
|
103 |
+
|
104 |
+
if ( $id === $exec_id ) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
return $exec;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Adds a link pointing to the Manage Snippets page
|
113 |
+
*
|
114 |
+
* @param array $links Existing plugin action links.
|
115 |
+
*
|
116 |
+
* @return array Modified plugin action links
|
117 |
+
* @since 2.0.0
|
118 |
+
*/
|
119 |
+
public function plugin_settings_link( $links ) {
|
120 |
+
$format = '<a href="%1$s" title="%2$s">%3$s</a>';
|
121 |
+
|
122 |
+
array_unshift(
|
123 |
+
$links,
|
124 |
+
sprintf(
|
125 |
+
$format,
|
126 |
+
esc_url( code_snippets()->get_menu_url( 'settings' ) ),
|
127 |
+
esc_html__( 'Change plugin settings', 'code-snippets' ),
|
128 |
+
esc_html__( 'Settings', 'code-snippets' )
|
129 |
+
)
|
130 |
+
);
|
131 |
+
|
132 |
+
array_unshift(
|
133 |
+
$links,
|
134 |
+
sprintf(
|
135 |
+
$format,
|
136 |
+
esc_url( code_snippets()->get_menu_url() ),
|
137 |
+
esc_html__( 'Manage your existing snippets', 'code-snippets' ),
|
138 |
+
esc_html__( 'Snippets', 'code-snippets' )
|
139 |
+
)
|
140 |
+
);
|
141 |
+
|
142 |
+
return $links;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Adds extra links related to the plugin
|
147 |
+
*
|
148 |
+
* @param array $links Existing plugin info links.
|
149 |
+
* @param string $file The plugin the links are for.
|
150 |
+
*
|
151 |
+
* @return array The modified plugin info links.
|
152 |
+
* @since 2.0.0
|
153 |
+
*/
|
154 |
+
public function plugin_meta_links( $links, $file ) {
|
155 |
+
|
156 |
+
/* We only want to affect the Code Snippets plugin listing */
|
157 |
+
if ( plugin_basename( PLUGIN_FILE ) !== $file ) {
|
158 |
+
return $links;
|
159 |
+
}
|
160 |
+
|
161 |
+
$format = '<a href="%1$s" title="%2$s" target="_blank">%3$s</a>';
|
162 |
+
|
163 |
+
/* array_merge appends the links to the end */
|
164 |
+
|
165 |
+
return array_merge(
|
166 |
+
$links,
|
167 |
+
array(
|
168 |
+
sprintf(
|
169 |
+
$format,
|
170 |
+
'https://codesnippets.pro/about/',
|
171 |
+
esc_attr__( 'Find out more about Code Snippets', 'code-snippets' ),
|
172 |
+
esc_html__( 'About', 'code-snippets' )
|
173 |
+
),
|
174 |
+
sprintf(
|
175 |
+
$format,
|
176 |
+
'https://help.codesnippets.pro/',
|
177 |
+
esc_attr__( 'Find out how to get support with Code Snippets', 'code-snippets' ),
|
178 |
+
esc_html__( 'Support', 'code-snippets' )
|
179 |
+
),
|
180 |
+
sprintf(
|
181 |
+
$format,
|
182 |
+
'https://www.facebook.com/groups/codesnippetsplugin/',
|
183 |
+
esc_attr__( 'Join our community on Facebook', 'code-snippets' ),
|
184 |
+
esc_html__( 'FB Community', 'code-snippets' )
|
185 |
+
),
|
186 |
+
sprintf(
|
187 |
+
'<a href="%1$s" title="%2$s" style="color: #d46f4d;">%3$s</a>',
|
188 |
+
'https://codesnippets.pro/pricing/',
|
189 |
+
esc_attr__( 'Upgrade to Code Snippets Pro', 'code-snippets' ),
|
190 |
+
esc_html__( 'Upgrade to Pro', 'code-snippets' )
|
191 |
+
),
|
192 |
+
)
|
193 |
+
);
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Add Code Snippets information to Site Health information.
|
198 |
+
*
|
199 |
+
* @param array $info The Site Health information.
|
200 |
+
*
|
201 |
+
* @return array The updated Site Health information.
|
202 |
+
* @author sc0ttkclark
|
203 |
+
*/
|
204 |
+
public function debug_information( $info ) {
|
205 |
+
$fields = array();
|
206 |
+
|
207 |
+
// fetch all active snippets.
|
208 |
+
$args = array(
|
209 |
+
'active_only' => true,
|
210 |
+
'limit' => 100,
|
211 |
+
);
|
212 |
+
$snippet_objects = get_snippets( array(), null, $args );
|
213 |
+
|
214 |
+
// build the debug information from snippet data.
|
215 |
+
foreach ( $snippet_objects as $snippet ) {
|
216 |
+
$values = [ $snippet->scope_name ];
|
217 |
+
$debug = [];
|
218 |
+
|
219 |
+
if ( $snippet->name ) {
|
220 |
+
$debug[] = 'name: ' . $snippet->name;
|
221 |
+
}
|
222 |
+
|
223 |
+
$debug[] = 'scope: ' . $snippet->scope;
|
224 |
+
|
225 |
+
if ( $snippet->modified ) {
|
226 |
+
/* translators: %s: formatted last modified date */
|
227 |
+
$values[] = sprintf( __( 'Last modified %s', 'code-snippets' ), $snippet->format_modified( false ) );
|
228 |
+
$debug[] = 'modified: ' . $snippet->modified;
|
229 |
+
}
|
230 |
+
|
231 |
+
if ( $snippet->tags ) {
|
232 |
+
$values[] = $snippet->tags_list;
|
233 |
+
$debug[] = 'tags: [' . $snippet->tags_list . ']';
|
234 |
+
}
|
235 |
+
|
236 |
+
$fields[ 'snippet-' . $snippet->id ] = [
|
237 |
+
'label' => $snippet->display_name,
|
238 |
+
'value' => implode( "\n | ", $values ),
|
239 |
+
'debug' => implode( ', ', $debug ),
|
240 |
+
];
|
241 |
+
}
|
242 |
+
|
243 |
+
$snippets_info = array(
|
244 |
+
'label' => __( 'Active Snippets', 'code-snippets' ),
|
245 |
+
'show_count' => true,
|
246 |
+
'fields' => $fields,
|
247 |
+
);
|
248 |
+
|
249 |
+
// attempt to insert the new section right after the Inactive Plugins section.
|
250 |
+
$index = array_search( 'wp-plugins-inactive', array_keys( $info ), true );
|
251 |
+
|
252 |
+
if ( false === $index ) {
|
253 |
+
$info['code-snippets'] = $snippets_info;
|
254 |
+
} else {
|
255 |
+
$info = array_merge(
|
256 |
+
array_slice( $info, 0, $index + 1 ),
|
257 |
+
[ 'code-snippets' => $snippets_info ],
|
258 |
+
array_slice( $info, $index + 1 )
|
259 |
+
);
|
260 |
+
}
|
261 |
+
|
262 |
+
return $info;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Print any admin notices that have not been dismissed.
|
267 |
+
*
|
268 |
+
* @return void
|
269 |
+
*/
|
270 |
+
public function print_notices() {
|
271 |
+
global $current_user;
|
272 |
+
|
273 |
+
$key = 'ignore_code_snippets_survey_message';
|
274 |
+
$dismissed = get_user_meta( $current_user->ID, $key, false );
|
275 |
+
|
276 |
+
if ( isset( $_GET[ $key ], $_REQUEST['_wpnonce'] ) && wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), $key ) ) {
|
277 |
+
add_user_meta( $current_user->ID, $key, sanitize_key( wp_unslash( $_GET[ $key ] ) ), false );
|
278 |
+
return;
|
279 |
+
}
|
280 |
+
|
281 |
+
if ( ! in_array( 'pro', $dismissed, true ) ) {
|
282 |
+
$notice = 'pro';
|
283 |
+
$action_url = 'https://codesnippets.pro/pricing/';
|
284 |
+
$action_label = __( 'Upgrade now', 'code-snippets' );
|
285 |
+
$text = __( '<strong>Code Snippets Pro is here!</strong> Find more about the new features in Pro and our introductory launch offers.', 'code-snippets' );
|
286 |
+
|
287 |
+
} elseif ( ! in_array( 'survey', $dismissed, true ) && ! in_array( 'true', $dismissed, true ) ) {
|
288 |
+
$notice = 'survey';
|
289 |
+
$action_url = 'https://codesnippets.pro/survey/';
|
290 |
+
$action_label = __( 'Take the survey now', 'code-snippets' );
|
291 |
+
$text = __( "<strong>Have feedback on Code Snippets?</strong> Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' );
|
292 |
+
} else {
|
293 |
+
return;
|
294 |
+
}
|
295 |
+
|
296 |
+
printf( '<div class="notice notice-info code-snippets-notice code-snippets-%s-notice is-dismissible"><p>', esc_attr( sanitize_key( $notice ) ) );
|
297 |
+
echo wp_kses( $text, [ 'strong' => [] ] );
|
298 |
+
|
299 |
+
printf(
|
300 |
+
'<a href="%s" class="button secondary" target="_blank" style="margin: auto .5em;">%s</a>',
|
301 |
+
esc_url( $action_url ),
|
302 |
+
esc_html( $action_label )
|
303 |
+
);
|
304 |
+
|
305 |
+
printf(
|
306 |
+
'<a href="%s" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>',
|
307 |
+
esc_url( wp_nonce_url( add_query_arg( $key, $notice ), $key ) ),
|
308 |
+
esc_attr__( 'Dismiss', 'code-snippets' )
|
309 |
+
);
|
310 |
+
|
311 |
+
echo '</p></div>';
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Render a nav tab for a snippet type.
|
316 |
+
*
|
317 |
+
* @param string $type_name Type identifier.
|
318 |
+
* @param string $label Type label.
|
319 |
+
* @param string $current_type Identifier of currently-selected type.
|
320 |
+
*
|
321 |
+
* @return void
|
322 |
+
*/
|
323 |
+
public static function render_snippet_type_tab( $type_name, $label, $current_type = '' ) {
|
324 |
+
if ( $type_name === $current_type ) {
|
325 |
+
printf( '<a class="nav-tab nav-tab-active" data-type="%s">', esc_attr( $type_name ) );
|
326 |
+
|
327 |
+
} elseif ( Plugin::is_pro_type( $type_name ) ) {
|
328 |
+
printf(
|
329 |
+
'<a class="nav-tab nav-tab-inactive" data-type="%s" title="%s" href="https://codesnippets.pro/pricing/" target="_blank">',
|
330 |
+
esc_attr( $type_name ),
|
331 |
+
esc_attr__( 'Available in Code Snippets Pro (external link)', 'code-snippets' )
|
332 |
+
);
|
333 |
+
|
334 |
+
} else {
|
335 |
+
printf(
|
336 |
+
'<a class="nav-tab" href="%s" data-type="%s">',
|
337 |
+
esc_url( add_query_arg( 'type', $type_name ) ),
|
338 |
+
esc_attr( $type_name )
|
339 |
+
);
|
340 |
+
}
|
341 |
+
|
342 |
+
echo esc_html( $label ), 'all' === $type_name ? '' : ' <span class="badge">' . esc_html( $type_name ) . '</span>', '</a>';
|
343 |
+
}
|
344 |
+
}
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use WP_Screen;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* This file holds all the content for the contextual help screens.
|
9 |
+
*
|
10 |
+
* @package Code_Snippets
|
11 |
+
*/
|
12 |
+
class Contextual_Help {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Current screen object
|
16 |
+
*
|
17 |
+
* @see get_current_screen()
|
18 |
+
*
|
19 |
+
* @var WP_Screen
|
20 |
+
*/
|
21 |
+
public $screen;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Name of current screen
|
25 |
+
*
|
26 |
+
* @see get_current_screen()
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $screen_name;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class constructor
|
34 |
+
*
|
35 |
+
* @param string $screen_name Name of current screen.
|
36 |
+
*/
|
37 |
+
public function __construct( $screen_name ) {
|
38 |
+
$this->screen_name = $screen_name;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Load the contextual help
|
43 |
+
*/
|
44 |
+
public function load() {
|
45 |
+
$this->screen = get_current_screen();
|
46 |
+
|
47 |
+
if ( method_exists( $this, "load_{$this->screen_name}_help" ) ) {
|
48 |
+
call_user_func( array( $this, "load_{$this->screen_name}_help" ) );
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->load_help_sidebar();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Load the help sidebar
|
56 |
+
*/
|
57 |
+
private function load_help_sidebar() {
|
58 |
+
$sidebar_links = [
|
59 |
+
'https://wordpress.org/plugins/code-snippets' => __( 'About Plugin', 'code-snippets' ),
|
60 |
+
'https://help.codesnippets.pro/collection/3-faq' => __( 'FAQ', 'code-snippets' ),
|
61 |
+
'https://wordpress.org/support/plugin/code-snippets' => __( 'Support Forum', 'code-snippets' ),
|
62 |
+
'https://codesnippets.pro' => __( 'Plugin Website', 'code-snippets' ),
|
63 |
+
];
|
64 |
+
|
65 |
+
$contents = '<p><strong>' . __( 'For more information:', 'code-snippets' ) . "</strong></p>\n";
|
66 |
+
|
67 |
+
foreach ( $sidebar_links as $url => $label ) {
|
68 |
+
$contents .= "\n" . sprintf( '<p><a href="%s">%s</a></p>', esc_url( $url ), esc_html( $label ) );
|
69 |
+
}
|
70 |
+
|
71 |
+
$this->screen->set_help_sidebar( wp_kses_post( $contents ) );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Add a help tab to the current screen.
|
76 |
+
*
|
77 |
+
* @param string $id Screen ID.
|
78 |
+
* @param string $title Screen title.
|
79 |
+
* @param string|array $paragraphs List of paragraphs to display as content.
|
80 |
+
*
|
81 |
+
* @return void
|
82 |
+
*/
|
83 |
+
private function add_help_tab( $id, $title, $paragraphs ) {
|
84 |
+
$this->screen->add_help_tab(
|
85 |
+
array(
|
86 |
+
'title' => $title,
|
87 |
+
'id' => $id,
|
88 |
+
'content' => wp_kses_post(
|
89 |
+
implode(
|
90 |
+
"\n",
|
91 |
+
array_map(
|
92 |
+
function ( $content ) {
|
93 |
+
return '<p>' . $content . '</p>';
|
94 |
+
},
|
95 |
+
is_array( $paragraphs ) ? $paragraphs : [ $paragraphs ]
|
96 |
+
)
|
97 |
+
)
|
98 |
+
),
|
99 |
+
)
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Reusable introduction text
|
105 |
+
*
|
106 |
+
* @return string
|
107 |
+
*/
|
108 |
+
private function get_intro_text() {
|
109 |
+
return __( 'Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. ', 'code-snippets' );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Register and handle the help tabs for the manage snippets admin page
|
114 |
+
*/
|
115 |
+
private function load_manage_help() {
|
116 |
+
|
117 |
+
$this->add_help_tab(
|
118 |
+
'overview',
|
119 |
+
__( 'Overview', 'code-snippets' ),
|
120 |
+
$this->get_intro_text() .
|
121 |
+
__( 'Here you can manage your existing snippets and perform tasks on them such as activating, deactivating, deleting and exporting.', 'code-snippets' )
|
122 |
+
);
|
123 |
+
|
124 |
+
$this->add_help_tab(
|
125 |
+
'safe-mode',
|
126 |
+
__( 'Safe Mode', 'code-snippets' ),
|
127 |
+
[
|
128 |
+
__( 'Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.', 'code-snippets' ),
|
129 |
+
__( "If something goes wrong with a snippet, and you can't use WordPress, you can cause all snippets to stop executing by turning on <strong>safe mode</strong>.", 'code-snippets' ),
|
130 |
+
__( 'You can find out how to enable safe mode in the <a href="https://help.codesnippets.pro/article/12-safe-mode">Code Snippets Pro Docs</a>.', 'code-snippets' ),
|
131 |
+
]
|
132 |
+
);
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Register and handle the help tabs for the single snippet admin page
|
137 |
+
*/
|
138 |
+
private function load_edit_help() {
|
139 |
+
|
140 |
+
$this->add_help_tab(
|
141 |
+
'overview',
|
142 |
+
__( 'Overview', 'code-snippets' ),
|
143 |
+
[
|
144 |
+
$this->get_intro_text() .
|
145 |
+
__( 'Here you can add a new snippet, or edit an existing one.', 'code-snippets' ),
|
146 |
+
__( "If you're not sure about the types of snippets you can add, take a look at the <a href=\"https://help.codesnippets.pro/collection/2-adding-snippets\">Code Snippets Pro Docs</a> for inspiration.", 'code-snippets' ),
|
147 |
+
]
|
148 |
+
);
|
149 |
+
|
150 |
+
$this->add_help_tab(
|
151 |
+
'adding',
|
152 |
+
__( 'Adding Snippets', 'code-snippets' ),
|
153 |
+
[
|
154 |
+
__( 'You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.', 'code-snippets' ),
|
155 |
+
__( 'Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site.', 'code-snippets' ),
|
156 |
+
]
|
157 |
+
);
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Register and handle the help tabs for the import snippets admin page
|
162 |
+
*/
|
163 |
+
private function load_import_help() {
|
164 |
+
$manage_url = code_snippets()->get_menu_url( 'manage' );
|
165 |
+
|
166 |
+
$this->add_help_tab(
|
167 |
+
'overview',
|
168 |
+
__( 'Overview', 'code-snippets' ),
|
169 |
+
$this->get_intro_text() .
|
170 |
+
__( 'Here you can load snippets from a code snippets export file into the database alongside existing snippets.', 'code-snippets' )
|
171 |
+
);
|
172 |
+
|
173 |
+
$this->add_help_tab(
|
174 |
+
'import',
|
175 |
+
__( 'Importing', 'code-snippets' ),
|
176 |
+
__( 'You can load your snippets from a code snippets export file using this page.', 'code-snippets' ) .
|
177 |
+
/* translators: %s: URL to Snippets admin menu */
|
178 |
+
sprintf( __( 'Imported snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">Manage Snippets</a> page.', 'code-snippets' ), $manage_url )
|
179 |
+
);
|
180 |
+
|
181 |
+
$this->add_help_tab(
|
182 |
+
'export',
|
183 |
+
__( 'Exporting', 'code-snippets' ),
|
184 |
+
/* translators: %s: URL to Manage Snippets admin menu */
|
185 |
+
sprintf( __( 'You can save your snippets to a code snippets export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets' ), $manage_url )
|
186 |
+
);
|
187 |
+
}
|
188 |
+
}
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Functions used to manage the database tables
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class DB {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Unprefixed site-wide table name
|
14 |
+
*/
|
15 |
+
const TABLE_NAME = 'snippets';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Unprefixed network-wide table name
|
19 |
+
*/
|
20 |
+
const MS_TABLE_NAME = 'ms_snippets';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Side-wide table name
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
public $table;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Network-wide table name
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
public $ms_table;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Class constructor
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
$this->set_table_vars();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Register the snippet table names with WordPress
|
45 |
+
*
|
46 |
+
* @since 2.0
|
47 |
+
*/
|
48 |
+
public function set_table_vars() {
|
49 |
+
global $wpdb;
|
50 |
+
|
51 |
+
$this->table = $wpdb->prefix . self::TABLE_NAME;
|
52 |
+
$this->ms_table = $wpdb->base_prefix . self::MS_TABLE_NAME;
|
53 |
+
|
54 |
+
/* Register the snippet table names with WordPress */
|
55 |
+
$wpdb->snippets = $this->table;
|
56 |
+
$wpdb->ms_snippets = $this->ms_table;
|
57 |
+
|
58 |
+
$wpdb->tables[] = self::TABLE_NAME;
|
59 |
+
$wpdb->ms_global_tables[] = self::MS_TABLE_NAME;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Validate the multisite parameter of the get_table_name() function
|
64 |
+
*
|
65 |
+
* @param bool|null $network Value of multisite parameter – true for multisite, false for single-site.
|
66 |
+
*
|
67 |
+
* @return bool Validated value of multisite parameter.
|
68 |
+
*/
|
69 |
+
public static function validate_network_param( $network ) {
|
70 |
+
|
71 |
+
/* If multisite is not active, then the parameter should always be false */
|
72 |
+
if ( ! is_multisite() ) {
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
/* If $multisite is null, try to base it on the current admin page */
|
77 |
+
if ( is_null( $network ) && function_exists( 'is_network_admin' ) ) {
|
78 |
+
$network = is_network_admin();
|
79 |
+
}
|
80 |
+
|
81 |
+
return $network;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Return the appropriate snippet table name
|
86 |
+
*
|
87 |
+
* @param string|bool|null $multisite Whether retrieve the multisite table name (true) or the site table name (false).
|
88 |
+
*
|
89 |
+
* @return string The snippet table name
|
90 |
+
* @since 2.0
|
91 |
+
*/
|
92 |
+
public function get_table_name( $multisite = null ) {
|
93 |
+
|
94 |
+
/* If the first parameter is a string, assume it is a table name */
|
95 |
+
if ( is_string( $multisite ) ) {
|
96 |
+
return $multisite;
|
97 |
+
}
|
98 |
+
|
99 |
+
/* Validate the multisite parameter */
|
100 |
+
$multisite = $this->validate_network_param( $multisite );
|
101 |
+
|
102 |
+
/* return the correct table name depending on the value of $multisite */
|
103 |
+
return $multisite ? $this->ms_table : $this->table;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Determine whether a database table exists.
|
108 |
+
*
|
109 |
+
* @param string $table_name Name of database table to check.
|
110 |
+
* @param boolean $refresh Rerun the query, instead of using a cached value.
|
111 |
+
*
|
112 |
+
* @return bool Whether the database table exists.
|
113 |
+
*/
|
114 |
+
public static function table_exists( $table_name, $refresh = false ) {
|
115 |
+
global $wpdb;
|
116 |
+
static $checked = array();
|
117 |
+
|
118 |
+
if ( $refresh || ! isset( $checked[ $table_name ] ) ) {
|
119 |
+
$checked[ $table_name ] = $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) === $table_name; // cache pass, db call ok.
|
120 |
+
}
|
121 |
+
|
122 |
+
return $checked[ $table_name ];
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Create the snippet tables if they do not already exist
|
127 |
+
*/
|
128 |
+
public function create_missing_tables() {
|
129 |
+
|
130 |
+
/* Create the network snippets table if it doesn't exist */
|
131 |
+
if ( is_multisite() && ! self::table_exists( $this->ms_table ) ) {
|
132 |
+
$this->create_table( $this->ms_table );
|
133 |
+
}
|
134 |
+
|
135 |
+
/* Create the table if it doesn't exist */
|
136 |
+
if ( ! self::table_exists( $this->table ) ) {
|
137 |
+
$this->create_table( $this->table );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Create the snippet tables, or upgrade them if they already exist
|
143 |
+
*/
|
144 |
+
public function create_or_upgrade_tables() {
|
145 |
+
if ( is_multisite() ) {
|
146 |
+
$this->create_table( $this->ms_table );
|
147 |
+
}
|
148 |
+
|
149 |
+
$this->create_table( $this->table );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Create a snippet table if it does not already exist
|
154 |
+
*
|
155 |
+
* @param string $table_name Name of database table.
|
156 |
+
*/
|
157 |
+
public static function create_missing_table( $table_name ) {
|
158 |
+
|
159 |
+
if ( self::table_exists( $table_name ) ) {
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
self::create_table( $table_name );
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Create a single snippet table.
|
168 |
+
*
|
169 |
+
* @param string $table_name The name of the table to create.
|
170 |
+
*
|
171 |
+
* @return bool Whether the table creation was successful.
|
172 |
+
* @since 1.6
|
173 |
+
* @uses dbDelta() to apply the SQL code
|
174 |
+
*/
|
175 |
+
public static function create_table( $table_name ) {
|
176 |
+
global $wpdb;
|
177 |
+
$charset_collate = $wpdb->get_charset_collate();
|
178 |
+
|
179 |
+
/* Create the database table */
|
180 |
+
$sql = "CREATE TABLE $table_name (
|
181 |
+
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
182 |
+
name TINYTEXT NOT NULL,
|
183 |
+
description TEXT NOT NULL,
|
184 |
+
code LONGTEXT NOT NULL,
|
185 |
+
tags LONGTEXT NOT NULL,
|
186 |
+
scope VARCHAR(15) NOT NULL DEFAULT 'global',
|
187 |
+
priority SMALLINT NOT NULL DEFAULT 10,
|
188 |
+
active TINYINT(1) NOT NULL DEFAULT 0,
|
189 |
+
modified DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
190 |
+
PRIMARY KEY (id),
|
191 |
+
KEY scope (scope),
|
192 |
+
KEY active (active)
|
193 |
+
) $charset_collate;";
|
194 |
+
|
195 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
196 |
+
dbDelta( $sql );
|
197 |
+
|
198 |
+
$success = empty( $wpdb->last_error );
|
199 |
+
|
200 |
+
if ( $success ) {
|
201 |
+
do_action( 'code_snippets/create_table', $table_name );
|
202 |
+
}
|
203 |
+
|
204 |
+
return $success;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Build a list of formatting placeholders for an array of data.
|
209 |
+
*
|
210 |
+
* @param int $count Length of data.
|
211 |
+
* @param string $placeholder Placeholder to use. Defaults to string placeholder.
|
212 |
+
*
|
213 |
+
* @return string List of placeholders, ready for inclusion in query.
|
214 |
+
*/
|
215 |
+
private static function build_format_list( $count, $placeholder = '%s' ) {
|
216 |
+
return implode( ',', array_fill( 0, $count, $placeholder ) );
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Fetch a list of active snippets from a database table.
|
221 |
+
*
|
222 |
+
* @param string $table_name Name of table to fetch snippets from.
|
223 |
+
* @param array $scopes List of scopes to include in query.
|
224 |
+
* @param array $active_only Whether to only fetch active snippets from the table.
|
225 |
+
*
|
226 |
+
* @return array|false List of active snippets, if any could be retrieved.
|
227 |
+
*
|
228 |
+
* @phpcs:disable WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
|
229 |
+
*/
|
230 |
+
private static function fetch_snippets_from_table( $table_name, array $scopes, $active_only = true ) {
|
231 |
+
global $wpdb;
|
232 |
+
|
233 |
+
$cache_key = sprintf( 'active_snippets_%s_%s', sanitize_key( join( '_', $scopes ) ), $table_name );
|
234 |
+
$cached_snippets = wp_cache_get( $cache_key, CACHE_GROUP );
|
235 |
+
|
236 |
+
if ( is_array( $cached_snippets ) ) {
|
237 |
+
return $cached_snippets;
|
238 |
+
}
|
239 |
+
|
240 |
+
if ( ! self::table_exists( $table_name ) ) {
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
$scopes_format = self::build_format_list( count( $scopes ) );
|
245 |
+
$extra_where = $active_only ? 'AND active=1' : '';
|
246 |
+
|
247 |
+
$snippets = $wpdb->get_results(
|
248 |
+
$wpdb->prepare(
|
249 |
+
"
|
250 |
+
SELECT id, code, scope, active
|
251 |
+
FROM $table_name
|
252 |
+
WHERE scope IN ($scopes_format) $extra_where
|
253 |
+
ORDER BY priority, id",
|
254 |
+
$scopes
|
255 |
+
),
|
256 |
+
'ARRAY_A'
|
257 |
+
); // db call ok.
|
258 |
+
|
259 |
+
// Cache the full list of snippets.
|
260 |
+
if ( is_array( $snippets ) ) {
|
261 |
+
wp_cache_set( $cache_key, $snippets, CACHE_GROUP );
|
262 |
+
return $snippets;
|
263 |
+
}
|
264 |
+
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Generate the SQL for fetching active snippets from the database.
|
270 |
+
*
|
271 |
+
* @param array|string $scopes List of scopes to retrieve in.
|
272 |
+
*
|
273 |
+
* @return array List of active snippets, indexed by table.
|
274 |
+
*/
|
275 |
+
public function fetch_active_snippets( $scopes ) {
|
276 |
+
$active_snippets = array();
|
277 |
+
|
278 |
+
// Ensure that the list of scopes is an array.
|
279 |
+
if ( ! is_array( $scopes ) ) {
|
280 |
+
$scopes = array( $scopes );
|
281 |
+
}
|
282 |
+
|
283 |
+
// Fetch the active snippets for the current site, if there are any.
|
284 |
+
$snippets = $this->fetch_snippets_from_table( $this->table, $scopes );
|
285 |
+
if ( $snippets ) {
|
286 |
+
$active_snippets[ $this->table ] = $snippets;
|
287 |
+
}
|
288 |
+
|
289 |
+
// If multisite is enabled, fetch all snippets from the network table, and filter down to only active snippets.
|
290 |
+
if ( is_multisite() ) {
|
291 |
+
$active_shared_ids = (array) get_option( 'active_shared_network_snippets', array() );
|
292 |
+
$ms_snippets = $this->fetch_snippets_from_table( $this->ms_table, $scopes, false );
|
293 |
+
|
294 |
+
if ( $ms_snippets ) {
|
295 |
+
$active_snippets[ $this->ms_table ] = array_filter(
|
296 |
+
$ms_snippets,
|
297 |
+
function ( $snippet ) use ( $active_shared_ids ) {
|
298 |
+
return $snippet['active'] || in_array( intval( $snippet['id'] ), $active_shared_ids, true );
|
299 |
+
}
|
300 |
+
);
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
return $active_snippets;
|
305 |
+
}
|
306 |
+
}
|
@@ -0,0 +1,1305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use function Code_Snippets\Settings\get_setting;
|
6 |
+
use WP_List_Table;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Contains the class for handling the snippets table
|
10 |
+
*
|
11 |
+
* @package Code_Snippets
|
12 |
+
*
|
13 |
+
* phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
|
14 |
+
*/
|
15 |
+
|
16 |
+
/* The WP_List_Table base class is not included by default, so we need to load it */
|
17 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
18 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* This class handles the table for the manage snippets menu
|
23 |
+
*
|
24 |
+
* @since 1.5
|
25 |
+
* @package Code_Snippets
|
26 |
+
*/
|
27 |
+
class List_Table extends WP_List_Table {
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Whether the current screen is in the network admin
|
31 |
+
*
|
32 |
+
* @var bool
|
33 |
+
*/
|
34 |
+
public $is_network;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* A list of statuses (views)
|
38 |
+
*
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
public $statuses = array( 'all', 'active', 'inactive', 'recently_activated' );
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Column name to use when ordering the snippets list.
|
45 |
+
*
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $order_by;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Direction to use when ordering the snippets list. Either 'asc' or 'desc'.
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
protected $order_dir;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* The constructor function for our class.
|
59 |
+
* Adds hooks, initializes variables, setups class.
|
60 |
+
*
|
61 |
+
* @phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
|
62 |
+
*/
|
63 |
+
public function __construct() {
|
64 |
+
global $status, $page;
|
65 |
+
$this->is_network = is_network_admin();
|
66 |
+
|
67 |
+
/* Determine the status */
|
68 |
+
$status = apply_filters( 'code_snippets/list_table/default_view', 'all' );
|
69 |
+
if ( isset( $_REQUEST['status'] ) && in_array( sanitize_key( $_REQUEST['status'] ), $this->statuses, true ) ) {
|
70 |
+
$status = sanitize_key( $_REQUEST['status'] );
|
71 |
+
}
|
72 |
+
|
73 |
+
/* Add the search query to the URL */
|
74 |
+
if ( isset( $_REQUEST['s'] ) ) {
|
75 |
+
$_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
/* Add a snippets per page screen option */
|
79 |
+
$page = $this->get_pagenum();
|
80 |
+
|
81 |
+
add_screen_option(
|
82 |
+
'per_page',
|
83 |
+
array(
|
84 |
+
'label' => __( 'Snippets per page', 'code-snippets' ),
|
85 |
+
'default' => 999,
|
86 |
+
'option' => 'snippets_per_page',
|
87 |
+
)
|
88 |
+
);
|
89 |
+
|
90 |
+
add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ) );
|
91 |
+
|
92 |
+
/* Strip the result query arg from the URL */
|
93 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'result' );
|
94 |
+
|
95 |
+
/* Add filters to format the snippet description in the same way the post content is formatted */
|
96 |
+
$filters = [ 'wptexturize', 'convert_smilies', 'convert_chars', 'wpautop', 'shortcode_unautop', 'capital_P_dangit', [ $this, 'wp_kses_desc' ] ];
|
97 |
+
foreach ( $filters as $filter ) {
|
98 |
+
add_filter( 'code_snippets/list_table/column_description', $filter );
|
99 |
+
}
|
100 |
+
|
101 |
+
/* Set up the class */
|
102 |
+
parent::__construct(
|
103 |
+
array(
|
104 |
+
'ajax' => true,
|
105 |
+
'plural' => 'snippets',
|
106 |
+
'singular' => 'snippet',
|
107 |
+
)
|
108 |
+
);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Apply a more permissive version of wp_kses_post() to the snippet description.
|
113 |
+
*
|
114 |
+
* @param string $data Description content to filter.
|
115 |
+
*
|
116 |
+
* @return string Filtered description content with allowed HTML tags and attributes intact.
|
117 |
+
*/
|
118 |
+
public function wp_kses_desc( $data ) {
|
119 |
+
$safe_style_filter = function ( $styles ) {
|
120 |
+
$styles[] = 'display';
|
121 |
+
return $styles;
|
122 |
+
};
|
123 |
+
|
124 |
+
add_filter( 'safe_style_css', $safe_style_filter );
|
125 |
+
$data = wp_kses_post( $data );
|
126 |
+
remove_filter( 'safe_style_css', $safe_style_filter );
|
127 |
+
|
128 |
+
return $data;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Set the 'id' column as hidden by default.
|
133 |
+
*
|
134 |
+
* @param array $hidden List of hidden columns.
|
135 |
+
*
|
136 |
+
* @return array
|
137 |
+
*/
|
138 |
+
public function default_hidden_columns( $hidden ) {
|
139 |
+
$hidden[] = 'id';
|
140 |
+
return $hidden;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Set the 'name' column as the primary column.
|
145 |
+
*
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
protected function get_default_primary_column_name() {
|
149 |
+
return 'name';
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Define the output of all columns that have no callback function
|
154 |
+
*
|
155 |
+
* @param Snippet $item The snippet used for the current row.
|
156 |
+
* @param string $column_name The name of the column being printed.
|
157 |
+
*
|
158 |
+
* @return string The content of the column to output.
|
159 |
+
*/
|
160 |
+
protected function column_default( $item, $column_name ) {
|
161 |
+
|
162 |
+
switch ( $column_name ) {
|
163 |
+
case 'id':
|
164 |
+
return $item->id;
|
165 |
+
|
166 |
+
case 'description':
|
167 |
+
return apply_filters( 'code_snippets/list_table/column_description', $item->desc );
|
168 |
+
|
169 |
+
case 'type':
|
170 |
+
$type = $item->type;
|
171 |
+
return sprintf(
|
172 |
+
'<a class="snippet-type-badge" href="%s" data-type="%s">%s</a>',
|
173 |
+
esc_url( add_query_arg( 'type', $type ) ),
|
174 |
+
esc_attr( $type ),
|
175 |
+
esc_html( $type )
|
176 |
+
);
|
177 |
+
|
178 |
+
case 'date':
|
179 |
+
return $item->modified ? $item->format_modified() : '—';
|
180 |
+
|
181 |
+
default:
|
182 |
+
return apply_filters( "code_snippets/list_table/column_$column_name", '—', $item );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Retrieve a URL to perform an action on a snippet
|
188 |
+
*
|
189 |
+
* @param string $action Name of action to produce a link for.
|
190 |
+
* @param Snippet $snippet Snippet object to produce link for.
|
191 |
+
*
|
192 |
+
* @return string URL to perform action.
|
193 |
+
*/
|
194 |
+
public function get_action_link( $action, $snippet ) {
|
195 |
+
|
196 |
+
// Redirect actions to the network dashboard for shared network snippets.
|
197 |
+
$local_actions = array( 'activate', 'activate-shared', 'run-once', 'run-once-shared' );
|
198 |
+
$network_redirect = $snippet->shared_network && ! $this->is_network && ! in_array( $action, $local_actions, true );
|
199 |
+
|
200 |
+
// Edit links go to a different menu.
|
201 |
+
if ( 'edit' === $action ) {
|
202 |
+
return code_snippets()->get_snippet_edit_url( $snippet->id, $network_redirect ? 'network' : 'self' );
|
203 |
+
}
|
204 |
+
|
205 |
+
$query_args = array(
|
206 |
+
'action' => $action,
|
207 |
+
'id' => $snippet->id,
|
208 |
+
'scope' => $snippet->scope,
|
209 |
+
);
|
210 |
+
|
211 |
+
$url = $network_redirect ?
|
212 |
+
add_query_arg( $query_args, code_snippets()->get_menu_url( 'manage', 'network' ) ) :
|
213 |
+
add_query_arg( $query_args );
|
214 |
+
|
215 |
+
// Add a nonce to the URL for security purposes.
|
216 |
+
return wp_nonce_url( $url, 'code_snippets_manage_snippet_' . $snippet->id );
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Build a list of action links for individual snippets
|
221 |
+
*
|
222 |
+
* @param Snippet $snippet The current snippet.
|
223 |
+
*
|
224 |
+
* @return array The action links HTML.
|
225 |
+
*/
|
226 |
+
private function get_snippet_action_links( Snippet $snippet ) {
|
227 |
+
$actions = array();
|
228 |
+
|
229 |
+
if ( ! $this->is_network && $snippet->network && ! $snippet->shared_network ) {
|
230 |
+
// Display special links if on a subsite and dealing with a network-active snippet.
|
231 |
+
if ( $snippet->active ) {
|
232 |
+
$actions['network_active'] = esc_html__( 'Network Active', 'code-snippets' );
|
233 |
+
} else {
|
234 |
+
$actions['network_only'] = esc_html__( 'Network Only', 'code-snippets' );
|
235 |
+
}
|
236 |
+
} elseif ( ! $snippet->shared_network || current_user_can( code_snippets()->get_network_cap_name() ) ) {
|
237 |
+
|
238 |
+
// If the snippet is a shared network snippet, only display extra actions if the user has network permissions.
|
239 |
+
$simple_actions = array(
|
240 |
+
'edit' => esc_html__( 'Edit', 'code-snippets' ),
|
241 |
+
'clone' => esc_html__( 'Clone', 'code-snippets' ),
|
242 |
+
'export' => esc_html__( 'Export', 'code-snippets' ),
|
243 |
+
);
|
244 |
+
|
245 |
+
foreach ( $simple_actions as $action => $label ) {
|
246 |
+
$actions[ $action ] = sprintf( '<a href="%s">%s</a>', esc_url( $this->get_action_link( $action, $snippet ) ), $label );
|
247 |
+
}
|
248 |
+
|
249 |
+
$actions['delete'] = sprintf(
|
250 |
+
'<a href="%2$s" class="delete" onclick="%3$s">%1$s</a>',
|
251 |
+
esc_html__( 'Delete', 'code-snippets' ),
|
252 |
+
esc_url( $this->get_action_link( 'delete', $snippet ) ),
|
253 |
+
esc_js(
|
254 |
+
sprintf(
|
255 |
+
'return confirm("%s");',
|
256 |
+
esc_html__( 'You are about to permanently delete the selected item.', 'code-snippets' ) . "\n" .
|
257 |
+
esc_html__( "'Cancel' to stop, 'OK' to delete.", 'code-snippets' )
|
258 |
+
)
|
259 |
+
)
|
260 |
+
);
|
261 |
+
}
|
262 |
+
|
263 |
+
return apply_filters( 'code_snippets/list_table/row_actions', $actions, $snippet );
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Retrieve the code for a snippet activation switch
|
268 |
+
*
|
269 |
+
* @param Snippet $snippet Snippet object.
|
270 |
+
*
|
271 |
+
* @return string Output for activation switch.
|
272 |
+
*/
|
273 |
+
protected function column_activate( $snippet ) {
|
274 |
+
|
275 |
+
if ( $this->is_network && $snippet->shared_network || ( ! $this->is_network && $snippet->network && ! $snippet ) ) {
|
276 |
+
return '';
|
277 |
+
}
|
278 |
+
|
279 |
+
if ( 'single-use' === $snippet->scope ) {
|
280 |
+
$class = 'snippet-execution-button';
|
281 |
+
$action = 'run-once';
|
282 |
+
$label = esc_html__( 'Run Once', 'code-snippets' );
|
283 |
+
} else {
|
284 |
+
$class = 'snippet-activation-switch';
|
285 |
+
$action = $snippet->active ? 'deactivate' : 'activate';
|
286 |
+
$label = $snippet->network && ! $snippet->shared_network ?
|
287 |
+
( $snippet->active ? __( 'Network Deactivate', 'code-snippets' ) : __( 'Network Activate', 'code-snippets' ) ) :
|
288 |
+
( $snippet->active ? __( 'Deactivate', 'code-snippets' ) : __( 'Activate', 'code-snippets' ) );
|
289 |
+
}
|
290 |
+
|
291 |
+
if ( $snippet->shared_network ) {
|
292 |
+
$action .= '-shared';
|
293 |
+
}
|
294 |
+
|
295 |
+
return sprintf(
|
296 |
+
'<a class="%s" href="%s" title="%s"> </a> ',
|
297 |
+
esc_attr( $class ),
|
298 |
+
esc_url( $this->get_action_link( $action, $snippet ) ),
|
299 |
+
esc_attr( $label )
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Build the content of the snippet name column
|
305 |
+
*
|
306 |
+
* @param Snippet $snippet The snippet being used for the current row.
|
307 |
+
*
|
308 |
+
* @return string The content of the column to output.
|
309 |
+
*/
|
310 |
+
protected function column_name( $snippet ) {
|
311 |
+
$row_actions = $this->row_actions(
|
312 |
+
$this->get_snippet_action_links( $snippet ),
|
313 |
+
apply_filters( 'code_snippets/list_table/row_actions_always_visible', true )
|
314 |
+
);
|
315 |
+
|
316 |
+
$out = esc_html( $snippet->display_name );
|
317 |
+
|
318 |
+
if ( 'global' !== $snippet->scope ) {
|
319 |
+
$out .= ' <span class="dashicons dashicons-' . $snippet->scope_icon . '"></span>';
|
320 |
+
}
|
321 |
+
|
322 |
+
/* Add a link to the snippet if it isn't an unreadable network-only snippet */
|
323 |
+
if ( $this->is_network || ! $snippet->network || current_user_can( code_snippets()->get_network_cap_name() ) ) {
|
324 |
+
|
325 |
+
$out = sprintf(
|
326 |
+
'<a href="%s" class="snippet-name">%s</a>',
|
327 |
+
esc_attr( code_snippets()->get_snippet_edit_url( $snippet->id, $snippet->network ? 'network' : 'admin' ) ),
|
328 |
+
$out
|
329 |
+
);
|
330 |
+
}
|
331 |
+
|
332 |
+
if ( $snippet->shared_network ) {
|
333 |
+
$out .= ' <span class="badge">' . esc_html__( 'Shared on Network', 'code-snippets' ) . '</span>';
|
334 |
+
}
|
335 |
+
|
336 |
+
/* Return the name contents */
|
337 |
+
|
338 |
+
$out = apply_filters( 'code_snippets/list_table/column_name', $out, $snippet );
|
339 |
+
|
340 |
+
return $out . $row_actions;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Handles the checkbox column output.
|
345 |
+
*
|
346 |
+
* @param Snippet $item The snippet being used for the current row.
|
347 |
+
*
|
348 |
+
* @return string The column content to be printed.
|
349 |
+
*/
|
350 |
+
protected function column_cb( $item ) {
|
351 |
+
|
352 |
+
$out = sprintf(
|
353 |
+
'<input type="checkbox" name="%s[]" value="%s">',
|
354 |
+
$item->shared_network ? 'shared_ids' : 'ids',
|
355 |
+
intval( $item->id )
|
356 |
+
);
|
357 |
+
|
358 |
+
return apply_filters( 'code_snippets/list_table/column_cb', $out, $item );
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Handles the tags column output.
|
363 |
+
*
|
364 |
+
* @param Snippet $snippet The snippet being used for the current row.
|
365 |
+
*
|
366 |
+
* @return string The column output.
|
367 |
+
*/
|
368 |
+
protected function column_tags( $snippet ) {
|
369 |
+
|
370 |
+
/* Return now if there are no tags */
|
371 |
+
if ( empty( $snippet->tags ) ) {
|
372 |
+
return '';
|
373 |
+
}
|
374 |
+
|
375 |
+
$out = array();
|
376 |
+
|
377 |
+
/* Loop through the tags and create a link for each one */
|
378 |
+
foreach ( $snippet->tags as $tag ) {
|
379 |
+
$out[] = sprintf(
|
380 |
+
'<a href="%s">%s</a>',
|
381 |
+
esc_url( add_query_arg( 'tag', esc_attr( $tag ) ) ),
|
382 |
+
esc_html( $tag )
|
383 |
+
);
|
384 |
+
}
|
385 |
+
|
386 |
+
return join( ', ', $out );
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Handles the priority column output.
|
391 |
+
*
|
392 |
+
* @param Snippet $snippet The snippet being used for the current row.
|
393 |
+
*
|
394 |
+
* @return string The column output.
|
395 |
+
*/
|
396 |
+
protected function column_priority( $snippet ) {
|
397 |
+
return sprintf( '<input type="number" class="snippet-priority" value="%d" step="1" disabled>', $snippet->priority );
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Define the column headers for the table
|
402 |
+
*
|
403 |
+
* @return array The column headers, ID paired with label
|
404 |
+
*/
|
405 |
+
public function get_columns() {
|
406 |
+
$columns = array(
|
407 |
+
'cb' => '<input type="checkbox">',
|
408 |
+
'activate' => '',
|
409 |
+
'name' => __( 'Name', 'code-snippets' ),
|
410 |
+
'type' => __( 'Type', 'code-snippets' ),
|
411 |
+
'description' => __( 'Description', 'code-snippets' ),
|
412 |
+
'tags' => __( 'Tags', 'code-snippets' ),
|
413 |
+
'date' => __( 'Modified', 'code-snippets' ),
|
414 |
+
'priority' => __( 'Priority', 'code-snippets' ),
|
415 |
+
'id' => __( 'ID', 'code-snippets' ),
|
416 |
+
);
|
417 |
+
|
418 |
+
if ( isset( $_GET['type'] ) && 'all' !== $_GET['type'] ) {
|
419 |
+
unset( $columns['type'] );
|
420 |
+
}
|
421 |
+
|
422 |
+
if ( ! get_setting( 'general', 'enable_description' ) ) {
|
423 |
+
unset( $columns['description'] );
|
424 |
+
}
|
425 |
+
|
426 |
+
if ( ! get_setting( 'general', 'enable_tags' ) ) {
|
427 |
+
unset( $columns['tags'] );
|
428 |
+
}
|
429 |
+
|
430 |
+
return apply_filters( 'code_snippets/list_table/columns', $columns );
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Define the columns that can be sorted. The format is:
|
435 |
+
* 'internal-name' => 'orderby'
|
436 |
+
* or
|
437 |
+
* 'internal-name' => array( 'orderby', true )
|
438 |
+
*
|
439 |
+
* The second format will make the initial sorting order be descending.
|
440 |
+
*
|
441 |
+
* @return array The IDs of the columns that can be sorted
|
442 |
+
*/
|
443 |
+
public function get_sortable_columns() {
|
444 |
+
|
445 |
+
$sortable_columns = array(
|
446 |
+
'id' => array( 'id', true ),
|
447 |
+
'name' => 'name',
|
448 |
+
'type' => array( 'type', true ),
|
449 |
+
'date' => array( 'modified', true ),
|
450 |
+
'priority' => array( 'priority', true ),
|
451 |
+
);
|
452 |
+
|
453 |
+
return apply_filters( 'code_snippets/list_table/sortable_columns', $sortable_columns );
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Define the bulk actions to include in the drop-down menus
|
458 |
+
*
|
459 |
+
* @return array An array of menu items with the ID paired to the label
|
460 |
+
*/
|
461 |
+
public function get_bulk_actions() {
|
462 |
+
$actions = array(
|
463 |
+
'activate-selected' => $this->is_network ? __( 'Network Activate', 'code-snippets' ) : __( 'Activate', 'code-snippets' ),
|
464 |
+
'deactivate-selected' => $this->is_network ? __( 'Network Deactivate', 'code-snippets' ) : __( 'Deactivate', 'code-snippets' ),
|
465 |
+
'clone-selected' => __( 'Clone', 'code-snippets' ),
|
466 |
+
'download-selected' => __( 'Download', 'code-snippets' ),
|
467 |
+
'export-selected' => __( 'Export', 'code-snippets' ),
|
468 |
+
'delete-selected' => __( 'Delete', 'code-snippets' ),
|
469 |
+
);
|
470 |
+
|
471 |
+
return apply_filters( 'code_snippets/list_table/bulk_actions', $actions );
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Retrieve the classes for the table
|
476 |
+
*
|
477 |
+
* We override this in order to add 'snippets' as a class for custom styling
|
478 |
+
*
|
479 |
+
* @return array The classes to include on the table element
|
480 |
+
*/
|
481 |
+
public function get_table_classes() {
|
482 |
+
$classes = array( 'widefat', $this->_args['plural'] );
|
483 |
+
|
484 |
+
return apply_filters( 'code_snippets/list_table/table_classes', $classes );
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Retrieve the 'views' of the table
|
489 |
+
*
|
490 |
+
* Example: active, inactive, recently active
|
491 |
+
*
|
492 |
+
* @return array A list of the view labels linked to the view
|
493 |
+
*/
|
494 |
+
public function get_views() {
|
495 |
+
global $totals, $status;
|
496 |
+
$status_links = array();
|
497 |
+
|
498 |
+
/* Loop through the view counts */
|
499 |
+
foreach ( $totals as $type => $count ) {
|
500 |
+
|
501 |
+
/* Don't show the view if there is no count */
|
502 |
+
if ( ! $count ) {
|
503 |
+
continue;
|
504 |
+
}
|
505 |
+
|
506 |
+
/* Define the labels for each view */
|
507 |
+
$labels = array();
|
508 |
+
|
509 |
+
/* translators: %s: total number of snippets */
|
510 |
+
$labels['all'] = _n(
|
511 |
+
'All <span class="count">(%s)</span>',
|
512 |
+
'All <span class="count">(%s)</span>',
|
513 |
+
$count,
|
514 |
+
'code-snippets'
|
515 |
+
);
|
516 |
+
|
517 |
+
/* translators: %s: total number of active snippets */
|
518 |
+
$labels['active'] = _n(
|
519 |
+
'Active <span class="count">(%s)</span>',
|
520 |
+
'Active <span class="count">(%s)</span>',
|
521 |
+
$count,
|
522 |
+
'code-snippets'
|
523 |
+
);
|
524 |
+
|
525 |
+
/* translators: %s: total number of inactive snippets */
|
526 |
+
$labels['inactive'] = _n(
|
527 |
+
'Inactive <span class="count">(%s)</span>',
|
528 |
+
'Inactive <span class="count">(%s)</span>',
|
529 |
+
$count,
|
530 |
+
'code-snippets'
|
531 |
+
);
|
532 |
+
|
533 |
+
/* translators: %s: total number of recently activated snippets */
|
534 |
+
$labels['recently_activated'] = _n(
|
535 |
+
'Recently Active <span class="count">(%s)</span>',
|
536 |
+
'Recently Active <span class="count">(%s)</span>',
|
537 |
+
$count,
|
538 |
+
'code-snippets'
|
539 |
+
);
|
540 |
+
|
541 |
+
/* The page URL with the status parameter */
|
542 |
+
$url = esc_url( add_query_arg( 'status', $type ) );
|
543 |
+
|
544 |
+
/* Add a class if this view is currently being viewed */
|
545 |
+
$class = $type === $status ? ' class="current"' : '';
|
546 |
+
|
547 |
+
/* Add the view count to the label */
|
548 |
+
$text = sprintf( $labels[ $type ], number_format_i18n( $count ) );
|
549 |
+
|
550 |
+
/* Construct the link */
|
551 |
+
$status_links[ $type ] = sprintf( '<a href="%s"%s>%s</a>', $url, $class, $text );
|
552 |
+
}
|
553 |
+
|
554 |
+
/* Filter and return the list of views */
|
555 |
+
|
556 |
+
return apply_filters( 'code_snippets/list_table/views', $status_links );
|
557 |
+
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* Gets the tags of the snippets currently being viewed in the table
|
561 |
+
*
|
562 |
+
* @since 2.0
|
563 |
+
*/
|
564 |
+
public function get_current_tags() {
|
565 |
+
global $snippets, $status;
|
566 |
+
|
567 |
+
/* If we're not viewing a snippets table, get all used tags instead */
|
568 |
+
if ( ! isset( $snippets, $status ) ) {
|
569 |
+
$tags = get_all_snippet_tags();
|
570 |
+
} else {
|
571 |
+
$tags = array();
|
572 |
+
|
573 |
+
/* Merge all tags into a single array */
|
574 |
+
foreach ( $snippets[ $status ] as $snippet ) {
|
575 |
+
$tags = array_merge( $snippet->tags, $tags );
|
576 |
+
}
|
577 |
+
|
578 |
+
/* Remove duplicate tags */
|
579 |
+
$tags = array_unique( $tags );
|
580 |
+
}
|
581 |
+
|
582 |
+
sort( $tags );
|
583 |
+
|
584 |
+
return $tags;
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Add filters and extra actions above and below the table
|
589 |
+
*
|
590 |
+
* @param string $which Whether the actions are displayed on the before (true) or after (false) the table.
|
591 |
+
*/
|
592 |
+
public function extra_tablenav( $which ) {
|
593 |
+
global $status;
|
594 |
+
|
595 |
+
if ( 'top' === $which ) {
|
596 |
+
|
597 |
+
/* Tags dropdown filter */
|
598 |
+
$tags = $this->get_current_tags();
|
599 |
+
|
600 |
+
if ( count( $tags ) ) {
|
601 |
+
$query = isset( $_GET['tag'] ) ? sanitize_text_field( wp_unslash( $_GET['tag'] ) ) : '';
|
602 |
+
|
603 |
+
echo '<div class="alignleft actions">';
|
604 |
+
echo '<select name="tag">';
|
605 |
+
|
606 |
+
printf(
|
607 |
+
"<option %s value=''>%s</option>\n",
|
608 |
+
selected( $query, '', false ),
|
609 |
+
esc_html__( 'Show all tags', 'code-snippets' )
|
610 |
+
);
|
611 |
+
|
612 |
+
foreach ( $tags as $tag ) {
|
613 |
+
|
614 |
+
printf(
|
615 |
+
"<option %s value='%s'>%s</option>\n",
|
616 |
+
selected( $query, $tag, false ),
|
617 |
+
esc_attr( $tag ),
|
618 |
+
esc_html( $tag )
|
619 |
+
);
|
620 |
+
}
|
621 |
+
|
622 |
+
echo '</select>';
|
623 |
+
|
624 |
+
submit_button( __( 'Filter', 'code-snippets' ), 'button', 'filter_action', false );
|
625 |
+
echo '</div>';
|
626 |
+
}
|
627 |
+
}
|
628 |
+
|
629 |
+
echo '<div class="alignleft actions">';
|
630 |
+
|
631 |
+
if ( 'recently_activated' === $status ) {
|
632 |
+
submit_button( __( 'Clear List', 'code-snippets' ), 'secondary', 'clear-recent-list', false );
|
633 |
+
}
|
634 |
+
|
635 |
+
do_action( 'code_snippets/list_table/actions', $which );
|
636 |
+
|
637 |
+
echo '</div>';
|
638 |
+
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Output form fields needed to preserve important
|
642 |
+
* query vars over form submissions
|
643 |
+
*
|
644 |
+
* @param string $context The context in which the fields are being outputted.
|
645 |
+
*/
|
646 |
+
public function required_form_fields( $context = 'main' ) {
|
647 |
+
|
648 |
+
$vars = apply_filters(
|
649 |
+
'code_snippets/list_table/required_form_fields',
|
650 |
+
array( 'page', 's', 'status', 'paged', 'tag' ),
|
651 |
+
$context
|
652 |
+
);
|
653 |
+
|
654 |
+
if ( 'search_box' === $context ) {
|
655 |
+
/* Remove the 's' var if we're doing this for the search box */
|
656 |
+
$vars = array_diff( $vars, array( 's' ) );
|
657 |
+
}
|
658 |
+
|
659 |
+
foreach ( $vars as $var ) {
|
660 |
+
if ( ! empty( $_REQUEST[ $var ] ) ) {
|
661 |
+
$value = sanitize_text_field( wp_unslash( $_REQUEST[ $var ] ) );
|
662 |
+
printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $var ), esc_attr( $value ) );
|
663 |
+
print "\n";
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
do_action( 'code_snippets/list_table/print_required_form_fields', $context );
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Perform an action on a single snippet.
|
672 |
+
*
|
673 |
+
* @param int $id Snippet ID.
|
674 |
+
* @param string $action Action to perform.
|
675 |
+
* @param string $scope Snippet scope; used for cache busting CSS and JS snippets.
|
676 |
+
*
|
677 |
+
* @return bool|string Result of performing action
|
678 |
+
* @uses activate_snippet() to activate snippets
|
679 |
+
* @uses deactivate_snippet() to deactivate snippets
|
680 |
+
* @uses delete_snippet() to delete snippets
|
681 |
+
*/
|
682 |
+
private function perform_action( $id, $action, $scope = '' ) {
|
683 |
+
|
684 |
+
switch ( $action ) {
|
685 |
+
|
686 |
+
case 'activate':
|
687 |
+
activate_snippet( $id, $this->is_network );
|
688 |
+
return 'activated';
|
689 |
+
|
690 |
+
case 'deactivate':
|
691 |
+
deactivate_snippet( $id, $this->is_network );
|
692 |
+
return 'deactivated';
|
693 |
+
|
694 |
+
case 'run-once':
|
695 |
+
$this->perform_action( $id, 'activate' );
|
696 |
+
return 'executed';
|
697 |
+
|
698 |
+
case 'run-once-shared':
|
699 |
+
$this->perform_action( $id, 'activate-shared' );
|
700 |
+
return 'executed';
|
701 |
+
|
702 |
+
case 'activate-shared':
|
703 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
704 |
+
|
705 |
+
if ( ! in_array( $id, $active_shared_snippets, true ) ) {
|
706 |
+
$active_shared_snippets[] = $id;
|
707 |
+
update_option( 'active_shared_network_snippets', $active_shared_snippets );
|
708 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
709 |
+
}
|
710 |
+
|
711 |
+
return 'activated';
|
712 |
+
|
713 |
+
case 'deactivate-shared':
|
714 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
715 |
+
update_option( 'active_shared_network_snippets', array_diff( $active_shared_snippets, array( $id ) ) );
|
716 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
717 |
+
return 'deactivated';
|
718 |
+
|
719 |
+
case 'clone':
|
720 |
+
$this->clone_snippets( array( $id ) );
|
721 |
+
return 'cloned';
|
722 |
+
|
723 |
+
case 'delete':
|
724 |
+
delete_snippet( $id, $this->is_network );
|
725 |
+
return 'deleted';
|
726 |
+
|
727 |
+
case 'export':
|
728 |
+
$export = new Export_Attachment( $id );
|
729 |
+
$export->download_snippets_json();
|
730 |
+
break;
|
731 |
+
|
732 |
+
case 'download':
|
733 |
+
$export = new Export_Attachment( $id );
|
734 |
+
$export->download_snippets_code();
|
735 |
+
break;
|
736 |
+
}
|
737 |
+
|
738 |
+
return false;
|
739 |
+
}
|
740 |
+
|
741 |
+
/**
|
742 |
+
* Processes actions requested by the user.
|
743 |
+
*/
|
744 |
+
public function process_requested_actions() {
|
745 |
+
|
746 |
+
/* Clear the recent snippets list if requested to do so */
|
747 |
+
if ( isset( $_POST['clear-recent-list'] ) ) {
|
748 |
+
check_admin_referer( 'bulk-' . $this->_args['plural'] );
|
749 |
+
|
750 |
+
if ( $this->is_network ) {
|
751 |
+
update_site_option( 'recently_activated_snippets', array() );
|
752 |
+
} else {
|
753 |
+
update_option( 'recently_activated_snippets', array() );
|
754 |
+
}
|
755 |
+
}
|
756 |
+
|
757 |
+
/* Check if there are any single snippet actions to perform */
|
758 |
+
if ( isset( $_GET['action'], $_GET['id'] ) ) {
|
759 |
+
$id = absint( $_GET['id'] );
|
760 |
+
$scope = isset( $_GET['scope'] ) ? sanitize_key( wp_unslash( $_GET['scope'] ) ) : '';
|
761 |
+
|
762 |
+
/* Verify they were sent from a trusted source */
|
763 |
+
$nonce_action = 'code_snippets_manage_snippet_' . $id;
|
764 |
+
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), $nonce_action ) ) {
|
765 |
+
wp_nonce_ays( $nonce_action );
|
766 |
+
}
|
767 |
+
|
768 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'action', 'id', 'scope', '_wpnonce' ) );
|
769 |
+
|
770 |
+
/* If so, then perform the requested action and inform the user of the result */
|
771 |
+
$result = $this->perform_action( $id, sanitize_key( $_GET['action'] ), $scope );
|
772 |
+
|
773 |
+
if ( $result ) {
|
774 |
+
wp_safe_redirect( esc_url_raw( add_query_arg( 'result', $result ) ) );
|
775 |
+
exit;
|
776 |
+
}
|
777 |
+
}
|
778 |
+
|
779 |
+
/* Only continue from this point if there are bulk actions to process */
|
780 |
+
if ( ! isset( $_POST['ids'] ) && ! isset( $_POST['shared_ids'] ) ) {
|
781 |
+
return;
|
782 |
+
}
|
783 |
+
|
784 |
+
check_admin_referer( 'bulk-' . $this->_args['plural'] );
|
785 |
+
|
786 |
+
$ids = isset( $_POST['ids'] ) ? array_map( 'intval', $_POST['ids'] ) : array();
|
787 |
+
$_SERVER['REQUEST_URI'] = remove_query_arg( 'action' );
|
788 |
+
|
789 |
+
switch ( $this->current_action() ) {
|
790 |
+
|
791 |
+
case 'activate-selected':
|
792 |
+
activate_snippets( $ids );
|
793 |
+
|
794 |
+
/* Process the shared network snippets */
|
795 |
+
if ( isset( $_POST['shared_ids'] ) && is_multisite() && ! $this->is_network ) {
|
796 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
797 |
+
|
798 |
+
foreach ( array_map( 'intval', $_POST['shared_ids'] ) as $id ) {
|
799 |
+
if ( ! in_array( $id, $active_shared_snippets, true ) ) {
|
800 |
+
$active_shared_snippets[] = $id;
|
801 |
+
}
|
802 |
+
}
|
803 |
+
|
804 |
+
update_option( 'active_shared_network_snippets', $active_shared_snippets );
|
805 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
806 |
+
}
|
807 |
+
|
808 |
+
$result = 'activated-multi';
|
809 |
+
break;
|
810 |
+
|
811 |
+
case 'deactivate-selected':
|
812 |
+
foreach ( $ids as $id ) {
|
813 |
+
deactivate_snippet( $id, $this->is_network );
|
814 |
+
}
|
815 |
+
|
816 |
+
/* Process the shared network snippets */
|
817 |
+
if ( isset( $_POST['shared_ids'] ) && is_multisite() && ! $this->is_network ) {
|
818 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
819 |
+
$active_shared_snippets = ( '' === $active_shared_snippets ) ? array() : $active_shared_snippets;
|
820 |
+
$active_shared_snippets = array_diff( $active_shared_snippets, array_map( 'intval', $_POST['shared_ids'] ) );
|
821 |
+
update_option( 'active_shared_network_snippets', $active_shared_snippets );
|
822 |
+
clean_active_snippets_cache( code_snippets()->db->ms_table );
|
823 |
+
}
|
824 |
+
|
825 |
+
$result = 'deactivated-multi';
|
826 |
+
break;
|
827 |
+
|
828 |
+
case 'export-selected':
|
829 |
+
$export = new Export_Attachment( $ids );
|
830 |
+
$export->download_snippets_json();
|
831 |
+
break;
|
832 |
+
|
833 |
+
case 'download-selected':
|
834 |
+
$export = new Export_Attachment( $ids );
|
835 |
+
$export->download_snippets_code();
|
836 |
+
break;
|
837 |
+
|
838 |
+
case 'clone-selected':
|
839 |
+
$this->clone_snippets( $ids );
|
840 |
+
$result = 'cloned-multi';
|
841 |
+
break;
|
842 |
+
|
843 |
+
case 'delete-selected':
|
844 |
+
foreach ( $ids as $id ) {
|
845 |
+
delete_snippet( $id, $this->is_network );
|
846 |
+
}
|
847 |
+
$result = 'deleted-multi';
|
848 |
+
break;
|
849 |
+
}
|
850 |
+
|
851 |
+
if ( isset( $result ) ) {
|
852 |
+
wp_safe_redirect( esc_url_raw( add_query_arg( 'result', $result ) ) );
|
853 |
+
exit;
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
/**
|
858 |
+
* Message to display if no snippets are found
|
859 |
+
*/
|
860 |
+
public function no_items() {
|
861 |
+
|
862 |
+
if ( ! empty( $GLOBALS['s'] ) || ! empty( $_GET['tag'] ) ) {
|
863 |
+
esc_html_e( 'No snippets were found matching the current search query. Please enter a new query or use the "Clear Filters" button above.', 'code-snippets' );
|
864 |
+
|
865 |
+
} else {
|
866 |
+
$add_url = code_snippets()->get_menu_url( 'add' );
|
867 |
+
|
868 |
+
if ( empty( $_GET['type'] ) ) {
|
869 |
+
esc_html_e( "It looks like you don't have any snippets.", 'code-snippets' );
|
870 |
+
} else {
|
871 |
+
esc_html_e( "It looks like you don't have any snippets of this type.", 'code-snippets' );
|
872 |
+
$add_url = add_query_arg( 'type', sanitize_key( wp_unslash( $_GET['type'] ) ), $add_url );
|
873 |
+
}
|
874 |
+
|
875 |
+
printf(
|
876 |
+
' <a href="%s">%s</a>',
|
877 |
+
esc_url( $add_url ),
|
878 |
+
esc_html__( 'Perhaps you would like to add a new one?', 'code-snippets' )
|
879 |
+
);
|
880 |
+
}
|
881 |
+
}
|
882 |
+
|
883 |
+
/**
|
884 |
+
* Fetch all shared network snippets for the current site
|
885 |
+
*/
|
886 |
+
private function fetch_shared_network_snippets() {
|
887 |
+
global $snippets, $wpdb;
|
888 |
+
$db = code_snippets()->db;
|
889 |
+
$ids = get_site_option( 'shared_network_snippets', false );
|
890 |
+
|
891 |
+
if ( ! is_multisite() || ! $ids ) {
|
892 |
+
return;
|
893 |
+
}
|
894 |
+
|
895 |
+
if ( $this->is_network ) {
|
896 |
+
$limit = count( $snippets['all'] );
|
897 |
+
|
898 |
+
for ( $i = 0; $i < $limit; $i++ ) {
|
899 |
+
/** Snippet @var Snippet $snippet */
|
900 |
+
$snippet = &$snippets['all'][ $i ];
|
901 |
+
|
902 |
+
if ( in_array( $snippet->id, $ids, true ) ) {
|
903 |
+
$snippet->shared_network = true;
|
904 |
+
$snippet->tags = array_merge( $snippet->tags, array( 'shared on network' ) );
|
905 |
+
$snippet->active = false;
|
906 |
+
}
|
907 |
+
}
|
908 |
+
} else {
|
909 |
+
$active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
|
910 |
+
$shared_snippets = get_snippets( $ids, true );
|
911 |
+
|
912 |
+
foreach ( $shared_snippets as $snippet ) {
|
913 |
+
$snippet->shared_network = true;
|
914 |
+
$snippet->tags = array_merge( $snippet->tags, array( 'shared on network' ) );
|
915 |
+
$snippet->active = in_array( $snippet->id, $active_shared_snippets, true );
|
916 |
+
}
|
917 |
+
|
918 |
+
$snippets['all'] = array_merge( $snippets['all'], $shared_snippets );
|
919 |
+
}
|
920 |
+
}
|
921 |
+
|
922 |
+
/**
|
923 |
+
* Prepares the items to later display in the table.
|
924 |
+
* Should run before any headers are sent.
|
925 |
+
*
|
926 |
+
* @phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
927 |
+
*/
|
928 |
+
public function prepare_items() {
|
929 |
+
global $status, $snippets, $totals, $s;
|
930 |
+
|
931 |
+
wp_reset_vars( array( 'orderby', 'order', 's' ) );
|
932 |
+
|
933 |
+
/* Redirect tag filter from POST to GET */
|
934 |
+
if ( isset( $_POST['filter_action'] ) ) {
|
935 |
+
$location = empty( $_POST['tag'] ) ?
|
936 |
+
remove_query_arg( 'tag' ) :
|
937 |
+
add_query_arg( 'tag', sanitize_text_field( wp_unslash( $_POST['tag'] ) ) );
|
938 |
+
wp_safe_redirect( esc_url_raw( $location ) );
|
939 |
+
exit;
|
940 |
+
}
|
941 |
+
|
942 |
+
/* First, lets process the submitted actions */
|
943 |
+
$this->process_requested_actions();
|
944 |
+
|
945 |
+
/* Initialize the $snippets array */
|
946 |
+
$snippets = array_fill_keys( $this->statuses, array() );
|
947 |
+
|
948 |
+
/* Fetch all snippets */
|
949 |
+
$snippets['all'] = apply_filters( 'code_snippets/list_table/get_snippets', get_snippets( array() ) );
|
950 |
+
$this->fetch_shared_network_snippets();
|
951 |
+
|
952 |
+
/* Filter snippets by type */
|
953 |
+
if ( isset( $_GET['type'] ) && 'all' !== $_GET['type'] ) {
|
954 |
+
$snippets['all'] = array_filter(
|
955 |
+
$snippets['all'],
|
956 |
+
function ( Snippet $snippet ) {
|
957 |
+
return $_GET['type'] === $snippet->type;
|
958 |
+
}
|
959 |
+
);
|
960 |
+
}
|
961 |
+
|
962 |
+
/* Add scope tags */
|
963 |
+
/** Snippet @var Snippet $snippet */
|
964 |
+
foreach ( $snippets['all'] as $snippet ) {
|
965 |
+
if ( 'global' !== $snippet->scope ) {
|
966 |
+
$snippet->add_tag( $snippet->scope );
|
967 |
+
}
|
968 |
+
}
|
969 |
+
|
970 |
+
/* Filter snippets by tag */
|
971 |
+
if ( ! empty( $_GET['tag'] ) ) {
|
972 |
+
$snippets['all'] = array_filter( $snippets['all'], array( $this, 'tags_filter_callback' ) );
|
973 |
+
}
|
974 |
+
|
975 |
+
/* Filter snippets based on search query */
|
976 |
+
if ( $s ) {
|
977 |
+
$snippets['all'] = array_filter( $snippets['all'], array( $this, 'search_by_line_callback' ) );
|
978 |
+
}
|
979 |
+
|
980 |
+
/* Clear recently activated snippets older than a week */
|
981 |
+
$recently_activated = $this->is_network ?
|
982 |
+
get_site_option( 'recently_activated_snippets', array() ) :
|
983 |
+
get_option( 'recently_activated_snippets', array() );
|
984 |
+
|
985 |
+
foreach ( $recently_activated as $key => $time ) {
|
986 |
+
|
987 |
+
if ( $time + WEEK_IN_SECONDS < time() ) {
|
988 |
+
unset( $recently_activated[ $key ] );
|
989 |
+
}
|
990 |
+
}
|
991 |
+
|
992 |
+
$this->is_network ?
|
993 |
+
update_site_option( 'recently_activated_snippets', $recently_activated ) :
|
994 |
+
update_option( 'recently_activated_snippets', $recently_activated );
|
995 |
+
|
996 |
+
/**
|
997 |
+
* Filter snippets into individual sections
|
998 |
+
*
|
999 |
+
* @var Snippet $snippet
|
1000 |
+
*/
|
1001 |
+
foreach ( $snippets['all'] as $snippet ) {
|
1002 |
+
|
1003 |
+
if ( $snippet->active ) {
|
1004 |
+
$snippets['active'][] = $snippet;
|
1005 |
+
} else {
|
1006 |
+
$snippets['inactive'][] = $snippet;
|
1007 |
+
|
1008 |
+
/* Was the snippet recently deactivated? */
|
1009 |
+
if ( isset( $recently_activated[ $snippet->id ] ) ) {
|
1010 |
+
$snippets['recently_activated'][] = $snippet;
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
/* Count the totals for each section */
|
1016 |
+
$totals = array();
|
1017 |
+
foreach ( $snippets as $type => $list ) {
|
1018 |
+
$totals[ $type ] = count( $list );
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
/* If the current status is empty, default tp all */
|
1022 |
+
if ( empty( $snippets[ $status ] ) ) {
|
1023 |
+
$status = 'all';
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
/* Get the current data */
|
1027 |
+
$data = $snippets[ $status ];
|
1028 |
+
|
1029 |
+
/* Decide how many records per page to show by getting the user's setting in the Screen Options panel */
|
1030 |
+
$sort_by = $this->screen->get_option( 'per_page', 'option' );
|
1031 |
+
$per_page = get_user_meta( get_current_user_id(), $sort_by, true );
|
1032 |
+
|
1033 |
+
if ( empty( $per_page ) || $per_page < 1 ) {
|
1034 |
+
$per_page = $this->screen->get_option( 'per_page', 'default' );
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
$per_page = (int) $per_page;
|
1038 |
+
|
1039 |
+
$this->set_order_vars();
|
1040 |
+
usort( $data, array( $this, 'usort_reorder_callback' ) );
|
1041 |
+
|
1042 |
+
/* Determine what page the user is currently looking at */
|
1043 |
+
$current_page = $this->get_pagenum();
|
1044 |
+
|
1045 |
+
/* Check how many items are in the data array */
|
1046 |
+
$total_items = count( $data );
|
1047 |
+
|
1048 |
+
/* The WP_List_Table class does not handle pagination for us, so we need to ensure that the data is trimmed to only the current page. */
|
1049 |
+
$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
1050 |
+
|
1051 |
+
/* Now we can add our *sorted* data to the items property, where it can be used by the rest of the class. */
|
1052 |
+
$this->items = $data;
|
1053 |
+
|
1054 |
+
/* We register our pagination options and calculations */
|
1055 |
+
$this->set_pagination_args(
|
1056 |
+
array(
|
1057 |
+
'total_items' => $total_items, // Calculate the total number of items.
|
1058 |
+
'per_page' => $per_page, // Determine how many items to show on a page.
|
1059 |
+
'total_pages' => ceil( $total_items / $per_page ), // Calculate the total number of pages.
|
1060 |
+
)
|
1061 |
+
);
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
/**
|
1065 |
+
* Determine the sort ordering for two pieces of data.
|
1066 |
+
*
|
1067 |
+
* @param string $a_data First piece of data.
|
1068 |
+
* @param string $b_data Second piece of data.
|
1069 |
+
*
|
1070 |
+
* @return int Returns -1 if $a_data is less than $b_data; 0 if they are equal; 1 otherwise
|
1071 |
+
* @ignore
|
1072 |
+
*/
|
1073 |
+
private function get_sort_direction( $a_data, $b_data ) {
|
1074 |
+
|
1075 |
+
// If the data is numeric, then calculate the ordering directly.
|
1076 |
+
if ( is_numeric( $a_data ) ) {
|
1077 |
+
return $a_data - $b_data;
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
// If only one of the data points is empty, then place it before the one which is not.
|
1081 |
+
if ( '' === $a_data xor '' === $b_data ) {
|
1082 |
+
return '' === $a_data ? 1 : -1;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
// Sort using the default string sort order if possible.
|
1086 |
+
if ( is_string( $a_data ) ) {
|
1087 |
+
return strcasecmp( $a_data, $b_data );
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
// Otherwise, use basic comparison operators.
|
1091 |
+
return $a_data === $b_data ? 0 : ( $a_data < $b_data ? -1 : 1 );
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
/**
|
1095 |
+
* Set the $order_by and $order_dir class variables.
|
1096 |
+
*/
|
1097 |
+
private function set_order_vars() {
|
1098 |
+
$order = Settings\get_setting( 'general', 'list_order' );
|
1099 |
+
|
1100 |
+
// set the order by based on the query variable, if set.
|
1101 |
+
if ( ! empty( $_REQUEST['orderby'] ) ) {
|
1102 |
+
$this->order_by = sanitize_key( wp_unslash( $_REQUEST['orderby'] ) );
|
1103 |
+
} else {
|
1104 |
+
// otherwise, fetch the order from the setting, ensuring it is valid.
|
1105 |
+
$valid_fields = [ 'id', 'name', 'type', 'modified', 'priority' ];
|
1106 |
+
$order_parts = explode( '-', $order, 2 );
|
1107 |
+
|
1108 |
+
$this->order_by = in_array( $order_parts[0], $valid_fields, true ) ? $order_parts[0] :
|
1109 |
+
apply_filters( 'code_snippets/list_table/default_orderby', 'priority' );
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
// set the order dir based on the query variable, if set.
|
1113 |
+
if ( ! empty( $_REQUEST['order'] ) ) {
|
1114 |
+
$this->order_dir = sanitize_key( wp_unslash( $_REQUEST['order'] ) );
|
1115 |
+
} elseif ( '-desc' === substr( $order, -5 ) ) {
|
1116 |
+
$this->order_dir = 'desc';
|
1117 |
+
} elseif ( '-asc' === substr( $order, -4 ) ) {
|
1118 |
+
$this->order_dir = 'asc';
|
1119 |
+
} else {
|
1120 |
+
$this->order_dir = apply_filters( 'code_snippets/list_table/default_order', 'asc' );
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
/**
|
1125 |
+
* Callback for usort() used to sort snippets
|
1126 |
+
*
|
1127 |
+
* @param Snippet $a The first snippet to compare.
|
1128 |
+
* @param Snippet $b The second snippet to compare.
|
1129 |
+
*
|
1130 |
+
* @return int The sort order.
|
1131 |
+
* @ignore
|
1132 |
+
*/
|
1133 |
+
private function usort_reorder_callback( $a, $b ) {
|
1134 |
+
$orderby = $this->order_by;
|
1135 |
+
$result = $this->get_sort_direction( $a->$orderby, $b->$orderby );
|
1136 |
+
|
1137 |
+
if ( 0 === $result && 'id' !== $orderby ) {
|
1138 |
+
$result = $this->get_sort_direction( $a->id, $b->id );
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
// Apply the sort direction to the calculated order.
|
1142 |
+
return ( 'asc' === $this->order_dir ) ? $result : -$result;
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
/**
|
1146 |
+
* Callback for search function
|
1147 |
+
*
|
1148 |
+
* @param Snippet $snippet The snippet being filtered.
|
1149 |
+
*
|
1150 |
+
* @return bool The result of the filter
|
1151 |
+
* @ignore
|
1152 |
+
*/
|
1153 |
+
private function search_callback( $snippet ) {
|
1154 |
+
global $s;
|
1155 |
+
|
1156 |
+
$fields = array( 'name', 'desc', 'code', 'tags_list' );
|
1157 |
+
|
1158 |
+
foreach ( $fields as $field ) {
|
1159 |
+
if ( false !== stripos( $snippet->$field, $s ) ) {
|
1160 |
+
return true;
|
1161 |
+
}
|
1162 |
+
}
|
1163 |
+
return false;
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
/**
|
1167 |
+
* Callback for search function
|
1168 |
+
*
|
1169 |
+
* @param Snippet $snippet The snippet being filtered.
|
1170 |
+
*
|
1171 |
+
* @return bool The result of the filter
|
1172 |
+
* @ignore
|
1173 |
+
*/
|
1174 |
+
private function search_by_line_callback( $snippet ) {
|
1175 |
+
global $s;
|
1176 |
+
static $line_num;
|
1177 |
+
|
1178 |
+
if ( is_null( $line_num ) ) {
|
1179 |
+
|
1180 |
+
if ( preg_match( '/@line:(?P<line>\d+)/', $s, $matches ) ) {
|
1181 |
+
$s = trim( str_replace( $matches[0], '', $s ) );
|
1182 |
+
$line_num = (int) $matches['line'] - 1;
|
1183 |
+
} else {
|
1184 |
+
$line_num = -1;
|
1185 |
+
}
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
if ( $line_num < 0 ) {
|
1189 |
+
return $this->search_callback( $snippet );
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
$code_lines = explode( "\n", $snippet->code );
|
1193 |
+
|
1194 |
+
return isset( $code_lines[ $line_num ] ) && false !== stripos( $code_lines[ $line_num ], $s );
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
/**
|
1198 |
+
* Callback for filtering snippets by tag.
|
1199 |
+
*
|
1200 |
+
* @param Snippet $snippet The snippet being filtered.
|
1201 |
+
*
|
1202 |
+
* @return bool The result of the filter.
|
1203 |
+
* @ignore
|
1204 |
+
*/
|
1205 |
+
private function tags_filter_callback( $snippet ) {
|
1206 |
+
$tags = isset( $_GET['tag'] ) ?
|
1207 |
+
explode( ',', sanitize_text_field( wp_unslash( $_GET['tag'] ) ) ) :
|
1208 |
+
array();
|
1209 |
+
|
1210 |
+
foreach ( $tags as $tag ) {
|
1211 |
+
if ( in_array( $tag, $snippet->tags, true ) ) {
|
1212 |
+
return true;
|
1213 |
+
}
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
return false;
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
/**
|
1220 |
+
* Display a notice showing the current search terms
|
1221 |
+
*
|
1222 |
+
* @since 1.7
|
1223 |
+
*/
|
1224 |
+
public function search_notice() {
|
1225 |
+
if ( ! empty( $_REQUEST['s'] ) || ! empty( $_GET['tag'] ) ) {
|
1226 |
+
|
1227 |
+
echo '<span class="subtitle">' . esc_html__( 'Search results', 'code-snippets' );
|
1228 |
+
|
1229 |
+
if ( ! empty( $_REQUEST['s'] ) ) {
|
1230 |
+
$s = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
|
1231 |
+
|
1232 |
+
if ( preg_match( '/@line:(?P<line>\d+)/', $s, $matches ) ) {
|
1233 |
+
|
1234 |
+
/* translators: 1: search query, 2: line number */
|
1235 |
+
$text = __( ' for “%1$s” on line %2$d', 'code-snippets' );
|
1236 |
+
printf(
|
1237 |
+
esc_html( $text ),
|
1238 |
+
esc_html( trim( str_replace( $matches[0], '', $s ) ) ),
|
1239 |
+
intval( $matches['line'] )
|
1240 |
+
);
|
1241 |
+
|
1242 |
+
} else {
|
1243 |
+
/* translators: %s: search query */
|
1244 |
+
echo esc_html( sprintf( __( ' for “%s”', 'code-snippets' ), $s ) );
|
1245 |
+
}
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
if ( ! empty( $_GET['tag'] ) ) {
|
1249 |
+
$tag = sanitize_text_field( wp_unslash( $_GET['tag'] ) );
|
1250 |
+
/* translators: %s: tag name */
|
1251 |
+
echo esc_html( sprintf( __( ' in tag “%s”', 'code-snippets' ), $tag ) );
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
echo '</span>';
|
1255 |
+
|
1256 |
+
/* translators: 1: link URL, 2: link text */
|
1257 |
+
printf(
|
1258 |
+
' <a class="button clear-filters" href="%s">%s</a>',
|
1259 |
+
esc_url( remove_query_arg( array( 's', 'tag' ) ) ),
|
1260 |
+
esc_html__( 'Clear Filters', 'code-snippets' )
|
1261 |
+
);
|
1262 |
+
}
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
/**
|
1266 |
+
* Outputs content for a single row of the table
|
1267 |
+
*
|
1268 |
+
* @param Snippet $item The snippet being used for the current row.
|
1269 |
+
*/
|
1270 |
+
public function single_row( $item ) {
|
1271 |
+
$status = $item->active ? 'active' : 'inactive';
|
1272 |
+
|
1273 |
+
$row_class = "snippet $status-snippet $item->type-snippet $item->scope-scope";
|
1274 |
+
|
1275 |
+
if ( $item->shared_network ) {
|
1276 |
+
$row_class .= ' shared-network-snippet';
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
printf( '<tr class="%s" data-snippet-scope="%s">', esc_attr( $row_class ), esc_attr( $item->scope ) );
|
1280 |
+
$this->single_row_columns( $item );
|
1281 |
+
echo '</tr>';
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
/**
|
1285 |
+
* Clone a selection of snippets
|
1286 |
+
*
|
1287 |
+
* @param array $ids List of snippet IDs.
|
1288 |
+
*/
|
1289 |
+
private function clone_snippets( $ids ) {
|
1290 |
+
$snippets = get_snippets( $ids, $this->is_network );
|
1291 |
+
|
1292 |
+
/** Snippet @var Snippet $snippet */
|
1293 |
+
foreach ( $snippets as $snippet ) {
|
1294 |
+
// Copy all data from the previous snippet aside from the ID and active status.
|
1295 |
+
$snippet->id = 0;
|
1296 |
+
$snippet->active = false;
|
1297 |
+
|
1298 |
+
/* translators: %s: snippet title */
|
1299 |
+
$snippet->name = sprintf( __( '%s [CLONE]', 'code-snippets' ), $snippet->name );
|
1300 |
+
$snippet = apply_filters( 'code_snippets/list_table/clone_snippet', $snippet );
|
1301 |
+
|
1302 |
+
save_snippet( $snippet );
|
1303 |
+
}
|
1304 |
+
}
|
1305 |
+
}
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The main plugin class
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Plugin {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Current plugin version number
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
public $version;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Filesystem path to the main plugin file
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
public $file;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Database class
|
28 |
+
*
|
29 |
+
* @var DB
|
30 |
+
*/
|
31 |
+
public $db;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Administration area class
|
35 |
+
*
|
36 |
+
* @var Admin
|
37 |
+
*/
|
38 |
+
public $admin;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Front-end functionality class
|
42 |
+
*
|
43 |
+
* @var Frontend
|
44 |
+
*/
|
45 |
+
public $frontend;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Class for managing active snippets
|
49 |
+
*
|
50 |
+
* @var Active_Snippets
|
51 |
+
*/
|
52 |
+
public $active_snippets;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Class for providing REST API endpoints for snippet data.
|
56 |
+
*
|
57 |
+
* @var REST_API
|
58 |
+
*/
|
59 |
+
protected $rest_api;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Class constructor
|
63 |
+
*
|
64 |
+
* @param string $version Current plugin version.
|
65 |
+
* @param string $file Path to main plugin file.
|
66 |
+
*/
|
67 |
+
public function __construct( $version, $file ) {
|
68 |
+
$this->version = $version;
|
69 |
+
$this->file = $file;
|
70 |
+
|
71 |
+
wp_cache_add_global_groups( CACHE_GROUP );
|
72 |
+
|
73 |
+
add_filter( 'code_snippets/execute_snippets', array( $this, 'disable_snippet_execution' ), 5 );
|
74 |
+
|
75 |
+
if ( isset( $_REQUEST['snippets-safe-mode'] ) ) {
|
76 |
+
add_filter( 'home_url', array( $this, 'add_safe_mode_query_var' ) );
|
77 |
+
add_filter( 'admin_url', array( $this, 'add_safe_mode_query_var' ) );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Initialise classes and include files
|
83 |
+
*/
|
84 |
+
public function load_plugin() {
|
85 |
+
$includes_path = __DIR__;
|
86 |
+
|
87 |
+
/* Database operation functions */
|
88 |
+
$this->db = new DB();
|
89 |
+
|
90 |
+
/* Snippet operation functions */
|
91 |
+
require_once $includes_path . '/snippet-ops.php';
|
92 |
+
|
93 |
+
/* CodeMirror editor functions */
|
94 |
+
require_once $includes_path . '/editor.php';
|
95 |
+
|
96 |
+
/* General Administration functions */
|
97 |
+
if ( is_admin() ) {
|
98 |
+
$this->admin = new Admin();
|
99 |
+
}
|
100 |
+
|
101 |
+
/* Settings component */
|
102 |
+
require_once $includes_path . '/settings/settings-fields.php';
|
103 |
+
require_once $includes_path . '/settings/editor-preview.php';
|
104 |
+
require_once $includes_path . '/settings/settings.php';
|
105 |
+
|
106 |
+
$this->rest_api = new REST_API();
|
107 |
+
$this->active_snippets = new Active_Snippets();
|
108 |
+
$this->frontend = new Frontend();
|
109 |
+
|
110 |
+
$upgrade = new Upgrade( $this->version, $this->db );
|
111 |
+
add_action( 'plugins_loaded', array( $upgrade, 'run' ), 0 );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Disable snippet execution if the necessary query var is set
|
116 |
+
*
|
117 |
+
* @param bool $execute_snippets Current filter value.
|
118 |
+
*
|
119 |
+
* @return bool New filter value.
|
120 |
+
*/
|
121 |
+
public function disable_snippet_execution( $execute_snippets ) {
|
122 |
+
return ! empty( $_REQUEST['snippets-safe-mode'] ) && $this->current_user_can() ? false : $execute_snippets;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Determine whether the menu is full or compact
|
127 |
+
*
|
128 |
+
* @return bool
|
129 |
+
*/
|
130 |
+
public function is_compact_menu() {
|
131 |
+
return ! is_network_admin() && apply_filters( 'code_snippets_compact_menu', false );
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Fetch the admin menu slug for a snippets menu.
|
136 |
+
*
|
137 |
+
* @param string $menu Name of menu to retrieve the slug for.
|
138 |
+
*
|
139 |
+
* @return string The menu's slug.
|
140 |
+
*/
|
141 |
+
public function get_menu_slug( $menu = '' ) {
|
142 |
+
$add = array( 'single', 'add', 'add-new', 'add-snippet', 'new-snippet', 'add-new-snippet' );
|
143 |
+
$edit = array( 'edit', 'edit-snippet' );
|
144 |
+
$import = array( 'import', 'import-snippets', 'import-code-snippets' );
|
145 |
+
$settings = array( 'settings', 'snippets-settings' );
|
146 |
+
|
147 |
+
if ( in_array( $menu, $edit, true ) ) {
|
148 |
+
return 'edit-snippet';
|
149 |
+
} elseif ( in_array( $menu, $add, true ) ) {
|
150 |
+
return 'add-snippet';
|
151 |
+
} elseif ( in_array( $menu, $import, true ) ) {
|
152 |
+
return 'import-code-snippets';
|
153 |
+
} elseif ( in_array( $menu, $settings, true ) ) {
|
154 |
+
return 'snippets-settings';
|
155 |
+
} else {
|
156 |
+
return 'snippets';
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Fetch the URL to a snippets admin menu.
|
162 |
+
*
|
163 |
+
* @param string $menu Name of menu to retrieve the URL to.
|
164 |
+
* @param string $context URL scheme to use.
|
165 |
+
*
|
166 |
+
* @return string The menu's URL.
|
167 |
+
*/
|
168 |
+
public function get_menu_url( $menu = '', $context = 'self' ) {
|
169 |
+
$slug = $this->get_menu_slug( $menu );
|
170 |
+
|
171 |
+
if ( $this->is_compact_menu() && 'network' !== $context ) {
|
172 |
+
$base_slug = $this->get_menu_slug();
|
173 |
+
$url = 'tools.php?page=' . $base_slug;
|
174 |
+
|
175 |
+
if ( $slug !== $base_slug ) {
|
176 |
+
$url .= '&sub=' . $slug;
|
177 |
+
}
|
178 |
+
} else {
|
179 |
+
$url = 'admin.php?page=' . $slug;
|
180 |
+
}
|
181 |
+
|
182 |
+
if ( 'network' === $context || 'snippets-settings' === $slug ) {
|
183 |
+
return network_admin_url( $url );
|
184 |
+
} elseif ( 'admin' === $context ) {
|
185 |
+
return admin_url( $url );
|
186 |
+
} else {
|
187 |
+
return self_admin_url( $url );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Fetch the admin menu slug for a snippets menu
|
193 |
+
*
|
194 |
+
* @param int $snippet_id Snippet ID.
|
195 |
+
* @param string $context URL scheme to use.
|
196 |
+
*
|
197 |
+
* @return string The URL to the edit snippet page for that snippet.
|
198 |
+
*/
|
199 |
+
public function get_snippet_edit_url( $snippet_id, $context = 'self' ) {
|
200 |
+
return add_query_arg(
|
201 |
+
'id',
|
202 |
+
absint( $snippet_id ),
|
203 |
+
$this->get_menu_url( 'edit', $context )
|
204 |
+
);
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Determine whether the current user can perform actions on snippets.
|
209 |
+
*
|
210 |
+
* @return boolean Whether the current user has the required capability
|
211 |
+
* @since 2.8.6
|
212 |
+
*/
|
213 |
+
public function current_user_can() {
|
214 |
+
return current_user_can( $this->get_cap() );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Retrieve the name of the capability required to manage sub-site snippets
|
219 |
+
*
|
220 |
+
* @return string
|
221 |
+
*/
|
222 |
+
public function get_cap_name() {
|
223 |
+
return apply_filters( 'code_snippets_cap', 'manage_options' );
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Retrieve the name of the capability required to manage network snippets
|
228 |
+
*
|
229 |
+
* @return string
|
230 |
+
*/
|
231 |
+
public function get_network_cap_name() {
|
232 |
+
return apply_filters( 'code_snippets_network_cap', 'manage_network_options' );
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Get the required capability to perform a certain action on snippets.
|
237 |
+
* Does not check if the user has this capability or not.
|
238 |
+
*
|
239 |
+
* If multisite, checks if *Enable Administration Menus: Snippets* is active
|
240 |
+
* under the *Settings > Network Settings* network admin menu
|
241 |
+
*
|
242 |
+
* @return string The capability required to manage snippets
|
243 |
+
* @since 2.0
|
244 |
+
*/
|
245 |
+
public function get_cap() {
|
246 |
+
|
247 |
+
if ( is_multisite() ) {
|
248 |
+
$menu_perms = get_site_option( 'menu_items', array() );
|
249 |
+
|
250 |
+
/* If multisite is enabled and the snippet menu is not activated, restrict snippet operations to super admins only */
|
251 |
+
if ( empty( $menu_perms['snippets'] ) ) {
|
252 |
+
return $this->get_network_cap_name();
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
return $this->get_cap_name();
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Inject the safe mode query var into URLs
|
261 |
+
*
|
262 |
+
* @param string $url Original URL.
|
263 |
+
*
|
264 |
+
* @return string Modified URL.
|
265 |
+
*/
|
266 |
+
public function add_safe_mode_query_var( $url ) {
|
267 |
+
|
268 |
+
if ( isset( $_REQUEST['snippets-safe-mode'] ) ) {
|
269 |
+
return add_query_arg( 'snippets-safe-mode', (bool) $_REQUEST['snippets-safe-mode'], $url );
|
270 |
+
}
|
271 |
+
|
272 |
+
return $url;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Retrieve a list of available snippet types and their labels.
|
277 |
+
*
|
278 |
+
* @return array
|
279 |
+
*/
|
280 |
+
public static function get_types() {
|
281 |
+
return apply_filters(
|
282 |
+
'code_snippets_types',
|
283 |
+
array(
|
284 |
+
'php' => __( 'Functions', 'code-snippets' ),
|
285 |
+
'html' => __( 'Content', 'code-snippets' ),
|
286 |
+
'css' => __( 'Styles', 'code-snippets' ),
|
287 |
+
'js' => __( 'Scripts', 'code-snippets' ),
|
288 |
+
)
|
289 |
+
);
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Determine whether a snippet type is Pro-only.
|
294 |
+
*
|
295 |
+
* @param string $type Snippet type name.
|
296 |
+
*
|
297 |
+
* @return bool
|
298 |
+
*/
|
299 |
+
public static function is_pro_type( $type ) {
|
300 |
+
return 'css' === $type || 'js' === $type;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Retrieve the description for a particular snippet type.
|
305 |
+
*
|
306 |
+
* @param string $type Snippet type name.
|
307 |
+
*
|
308 |
+
* @return string
|
309 |
+
*/
|
310 |
+
public function get_type_description( $type ) {
|
311 |
+
$descriptions = array(
|
312 |
+
'php' => __( 'Function snippets are run on your site as if there were in a plugin or theme functions.php file.', 'code-snippets' ),
|
313 |
+
'html' => __( 'Content snippets are bits of reusable PHP and HTML content that can be inserted into posts and pages.', 'code-snippets' ),
|
314 |
+
'css' => __( 'Style snippets are written in CSS and loaded in the admin area or on the site front-end, just like the theme style.css.', 'code-snippets' ),
|
315 |
+
'js' => __( 'Script snippets are loaded on the site front-end in a JavaScript file, either in the head or body sections.', 'code-snippets' ),
|
316 |
+
);
|
317 |
+
|
318 |
+
$descriptions = apply_filters( 'code_snippets/plugins/type_descriptions', $descriptions );
|
319 |
+
|
320 |
+
return isset( $descriptions[ $type ] ) ? $descriptions[ $type ] : '';
|
321 |
+
}
|
322 |
+
}
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use WP_REST_Request;
|
6 |
+
use WP_REST_Response;
|
7 |
+
use WP_REST_Server;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Allows fetching snippet data through the WordPress REST API.
|
11 |
+
*
|
12 |
+
* @since 3.0.0
|
13 |
+
* @package Code_Snippets
|
14 |
+
*/
|
15 |
+
class REST_API {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Current API version.
|
19 |
+
*/
|
20 |
+
const VERSION = 1;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Namespace.
|
24 |
+
*/
|
25 |
+
const BASE = 'code-snippets/v' . self::VERSION;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class constructor.
|
29 |
+
*/
|
30 |
+
public function __construct() {
|
31 |
+
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Register REST routes.
|
36 |
+
*/
|
37 |
+
public function register_routes() {
|
38 |
+
register_rest_route(
|
39 |
+
self::BASE,
|
40 |
+
'/snippets-info',
|
41 |
+
array(
|
42 |
+
'methods' => WP_REST_Server::READABLE,
|
43 |
+
'callback' => [ $this, 'get_snippets_info' ],
|
44 |
+
'permission_callback' => function () {
|
45 |
+
return current_user_can( 'edit_posts' );
|
46 |
+
},
|
47 |
+
)
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Fetch snippet data in response to a request.
|
53 |
+
*
|
54 |
+
* @param WP_REST_Request $request Request object.
|
55 |
+
*
|
56 |
+
* @return WP_REST_Response
|
57 |
+
*/
|
58 |
+
public function get_snippets_info( WP_REST_Request $request ) {
|
59 |
+
$snippets = get_snippets();
|
60 |
+
$data = [];
|
61 |
+
|
62 |
+
/** Snippet @var Snippet $snippet */
|
63 |
+
foreach ( $snippets as $snippet ) {
|
64 |
+
$data[] = [
|
65 |
+
'id' => $snippet->id,
|
66 |
+
'name' => $snippet->name,
|
67 |
+
'type' => $snippet->type,
|
68 |
+
'active' => $snippet->active,
|
69 |
+
];
|
70 |
+
}
|
71 |
+
|
72 |
+
return new WP_REST_Response( $data, 200 );
|
73 |
+
}
|
74 |
+
}
|
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use DateTime;
|
6 |
+
use DateTimeZone;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* A snippet object.
|
10 |
+
*
|
11 |
+
* @since 2.4.0
|
12 |
+
* @package Code_Snippets
|
13 |
+
*
|
14 |
+
* @property int $id The database ID.
|
15 |
+
* @property string $name The snippet title.
|
16 |
+
* @property string $desc The formatted description.
|
17 |
+
* @property string $code The executable code.
|
18 |
+
* @property array $tags An array of the tags.
|
19 |
+
* @property string $scope The scope name.
|
20 |
+
* @property int $priority Execution priority.
|
21 |
+
* @property bool $active The active status.
|
22 |
+
* @property bool $network true if is multisite-wide snippet, false if site-wide.
|
23 |
+
* @property bool $shared_network Whether the snippet is a shared network snippet.
|
24 |
+
* @property string $modified The date and time when the snippet data was most recently saved to the database.
|
25 |
+
*
|
26 |
+
* @property-read string $display_name The snippet name if it exists or a placeholder if it does not.
|
27 |
+
* @property-read string $tags_list The tags in string list format.
|
28 |
+
* @property-read string $scope_icon The dashicon used to represent the current scope.
|
29 |
+
* @property-read string $scope_name Human-readable description of the snippet type.
|
30 |
+
* @property-read string $type The type of snippet.
|
31 |
+
* @property-read string $lang The language that the snippet code is written in.
|
32 |
+
* @property-read int $modified_timestamp The last modification date in Unix timestamp format.
|
33 |
+
* @property-read DateTime $modified_local The last modification date in the local timezone.
|
34 |
+
* @property-read string $type_desc Human-readable description of the snippet type.
|
35 |
+
*/
|
36 |
+
class Snippet {
|
37 |
+
|
38 |
+
/**
|
39 |
+
* MySQL datetime format (YYYY-MM-DD hh:mm:ss).
|
40 |
+
*/
|
41 |
+
const DATE_FORMAT = 'Y-m-d H:i:s';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Default value used for a datetime variable.
|
45 |
+
*/
|
46 |
+
const DEFAULT_DATE = '0000-00-00 00:00:00';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* The snippet metadata fields.
|
50 |
+
* Initialized with default values.
|
51 |
+
*
|
52 |
+
* @var array Two-dimensional array of field names keyed to current values.
|
53 |
+
*/
|
54 |
+
private $fields = array(
|
55 |
+
'id' => 0,
|
56 |
+
'name' => '',
|
57 |
+
'desc' => '',
|
58 |
+
'code' => '',
|
59 |
+
'tags' => array(),
|
60 |
+
'scope' => 'global',
|
61 |
+
'active' => false,
|
62 |
+
'priority' => 10,
|
63 |
+
'network' => null,
|
64 |
+
'shared_network' => null,
|
65 |
+
'modified' => null,
|
66 |
+
);
|
67 |
+
|
68 |
+
/**
|
69 |
+
* List of field aliases
|
70 |
+
*
|
71 |
+
* @var array Two-dimensional array of field alias names keyed to actual field names.
|
72 |
+
*/
|
73 |
+
private static $field_aliases = array(
|
74 |
+
'description' => 'desc',
|
75 |
+
'language' => 'lang',
|
76 |
+
);
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Constructor function
|
80 |
+
*
|
81 |
+
* @param array|object $fields Initial snippet fields.
|
82 |
+
*/
|
83 |
+
public function __construct( $fields = null ) {
|
84 |
+
|
85 |
+
// If we've accidentally passed a snippet object, then fetch its fields before constructing the new object.
|
86 |
+
if ( is_object( $fields ) && method_exists( $fields, 'get_fields' ) ) {
|
87 |
+
$fields = $fields->get_fields();
|
88 |
+
}
|
89 |
+
|
90 |
+
$this->set_fields( $fields );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Set all snippet fields from an array or object.
|
95 |
+
* Invalid fields will be ignored.
|
96 |
+
*
|
97 |
+
* @param array|object $fields List of fields.
|
98 |
+
*/
|
99 |
+
public function set_fields( $fields ) {
|
100 |
+
|
101 |
+
/* Only accept arrays or objects */
|
102 |
+
if ( ! $fields || is_string( $fields ) ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
/* Convert objects into arrays */
|
107 |
+
if ( is_object( $fields ) ) {
|
108 |
+
$fields = get_object_vars( $fields );
|
109 |
+
}
|
110 |
+
|
111 |
+
/* Loop through the passed fields and set them */
|
112 |
+
foreach ( $fields as $field => $value ) {
|
113 |
+
$this->set_field( $field, $value );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Retrieve all snippet fields
|
119 |
+
*
|
120 |
+
* @return array Two-dimensional array of field names keyed to current values
|
121 |
+
*/
|
122 |
+
public function get_fields() {
|
123 |
+
return $this->fields;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Internal function for validating the name of a field
|
128 |
+
*
|
129 |
+
* @param string $field A field name.
|
130 |
+
*
|
131 |
+
* @return string The validated field name.
|
132 |
+
*/
|
133 |
+
private function validate_field_name( $field ) {
|
134 |
+
|
135 |
+
/* If a field alias is set, remap it to the valid field name */
|
136 |
+
if ( isset( self::$field_aliases[ $field ] ) ) {
|
137 |
+
return self::$field_aliases[ $field ];
|
138 |
+
}
|
139 |
+
|
140 |
+
return $field;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Check if a field is set
|
145 |
+
*
|
146 |
+
* @param string $field The field name.
|
147 |
+
*
|
148 |
+
* @return bool Whether the field is set.
|
149 |
+
*/
|
150 |
+
public function __isset( $field ) {
|
151 |
+
$field = $this->validate_field_name( $field );
|
152 |
+
|
153 |
+
return isset( $this->fields[ $field ] ) || method_exists( $this, 'get_' . $field );
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Retrieve a field's value
|
158 |
+
*
|
159 |
+
* @param string $field The field name.
|
160 |
+
*
|
161 |
+
* @return mixed The field value
|
162 |
+
*/
|
163 |
+
public function __get( $field ) {
|
164 |
+
$field = $this->validate_field_name( $field );
|
165 |
+
|
166 |
+
if ( method_exists( $this, 'get_' . $field ) ) {
|
167 |
+
return call_user_func( array( $this, 'get_' . $field ) );
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( ! $this->is_allowed_field( $field ) ) {
|
171 |
+
if ( WP_DEBUG ) {
|
172 |
+
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
173 |
+
trigger_error( 'Trying to access invalid property on Snippets class: ' . esc_html( $field ), E_WARNING );
|
174 |
+
}
|
175 |
+
|
176 |
+
return null;
|
177 |
+
}
|
178 |
+
|
179 |
+
return $this->fields[ $field ];
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Set the value of a field
|
184 |
+
*
|
185 |
+
* @param string $field The field name.
|
186 |
+
* @param mixed $value The field value.
|
187 |
+
*/
|
188 |
+
public function __set( $field, $value ) {
|
189 |
+
$field = $this->validate_field_name( $field );
|
190 |
+
|
191 |
+
if ( ! $this->is_allowed_field( $field ) ) {
|
192 |
+
if ( WP_DEBUG ) {
|
193 |
+
// phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
194 |
+
trigger_error( 'Trying to set invalid property on Snippets class: ' . esc_html( $field ), E_WARNING );
|
195 |
+
}
|
196 |
+
|
197 |
+
return;
|
198 |
+
}
|
199 |
+
|
200 |
+
/* Check if the field value should be filtered */
|
201 |
+
if ( method_exists( $this, 'prepare_' . $field ) ) {
|
202 |
+
$value = call_user_func( array( $this, 'prepare_' . $field ), $value );
|
203 |
+
}
|
204 |
+
|
205 |
+
$this->fields[ $field ] = $value;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Retrieve the list of fields allowed to be written to
|
210 |
+
*
|
211 |
+
* @return array Single-dimensional array of field names.
|
212 |
+
*/
|
213 |
+
public function get_allowed_fields() {
|
214 |
+
return array_keys( $this->fields ) + array_keys( self::$field_aliases );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Determine whether a field is allowed to be written to
|
219 |
+
*
|
220 |
+
* @param string $field The field name.
|
221 |
+
*
|
222 |
+
* @return bool true if the is allowed, false if invalid.
|
223 |
+
*/
|
224 |
+
public function is_allowed_field( $field ) {
|
225 |
+
return array_key_exists( $field, $this->fields ) || array_key_exists( $field, self::$field_aliases );
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Safely set the value for a field
|
230 |
+
* If the field name is invalid, false will be returned instead of an error thrown.
|
231 |
+
*
|
232 |
+
* @param string $field The field name.
|
233 |
+
* @param mixed $value The field value.
|
234 |
+
*
|
235 |
+
* @return bool true if the field was set successfully, false if the field name is invalid.
|
236 |
+
*/
|
237 |
+
public function set_field( $field, $value ) {
|
238 |
+
if ( ! $this->is_allowed_field( $field ) ) {
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
$this->__set( $field, $value );
|
243 |
+
|
244 |
+
return true;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Add a new tag
|
249 |
+
*
|
250 |
+
* @param string $tag Tag content to add to list.
|
251 |
+
*/
|
252 |
+
public function add_tag( $tag ) {
|
253 |
+
$this->fields['tags'][] = $tag;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Prepare the ID by ensuring it is an absolute integer
|
258 |
+
*
|
259 |
+
* @param int $id The field as provided.
|
260 |
+
*
|
261 |
+
* @return int The field in the correct format.
|
262 |
+
*/
|
263 |
+
private function prepare_id( $id ) {
|
264 |
+
return absint( $id );
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Prepare the scope by ensuring that it is a valid choice
|
269 |
+
*
|
270 |
+
* @param int|string $scope The field as provided.
|
271 |
+
*
|
272 |
+
* @return string The field in the correct format.
|
273 |
+
*/
|
274 |
+
private function prepare_scope( $scope ) {
|
275 |
+
$scopes = self::get_all_scopes();
|
276 |
+
|
277 |
+
if ( in_array( $scope, $scopes, true ) ) {
|
278 |
+
return $scope;
|
279 |
+
}
|
280 |
+
|
281 |
+
if ( is_numeric( $scope ) && isset( $scopes[ $scope ] ) ) {
|
282 |
+
return $scopes[ $scope ];
|
283 |
+
}
|
284 |
+
|
285 |
+
return $this->fields['scope'];
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Prepare the snippet tags by ensuring they are in the correct format
|
290 |
+
*
|
291 |
+
* @param string|array $tags The field as provided.
|
292 |
+
*
|
293 |
+
* @return array The field in the correct format.
|
294 |
+
*/
|
295 |
+
private function prepare_tags( $tags ) {
|
296 |
+
return code_snippets_build_tags_array( $tags );
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Prepare the active field by ensuring it is the correct type
|
301 |
+
*
|
302 |
+
* @param bool|int $active The field as provided.
|
303 |
+
*
|
304 |
+
* @return bool The field in the correct format.
|
305 |
+
*/
|
306 |
+
private function prepare_active( $active ) {
|
307 |
+
|
308 |
+
if ( is_bool( $active ) ) {
|
309 |
+
return $active;
|
310 |
+
}
|
311 |
+
|
312 |
+
return (bool) $active;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Prepare the priority field by ensuring it is an integer
|
317 |
+
*
|
318 |
+
* @param int $priority The field as provided.
|
319 |
+
*
|
320 |
+
* @return int The field in the correct format.
|
321 |
+
*/
|
322 |
+
private function prepare_priority( $priority ) {
|
323 |
+
return intval( $priority );
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* If $network is anything other than true, set it to false
|
328 |
+
*
|
329 |
+
* @param bool $network The field as provided.
|
330 |
+
*
|
331 |
+
* @return bool The field in the correct format.
|
332 |
+
*/
|
333 |
+
private function prepare_network( $network ) {
|
334 |
+
|
335 |
+
if ( null === $network && function_exists( 'is_network_admin' ) ) {
|
336 |
+
return is_network_admin();
|
337 |
+
}
|
338 |
+
|
339 |
+
return true === $network;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Determine the type of code this snippet is, based on its scope
|
344 |
+
*
|
345 |
+
* @return string The snippet type – will be a filename extension.
|
346 |
+
*/
|
347 |
+
private function get_type() {
|
348 |
+
if ( '-css' === substr( $this->scope, -4 ) ) {
|
349 |
+
return 'css';
|
350 |
+
}
|
351 |
+
|
352 |
+
if ( '-js' === substr( $this->scope, -3 ) ) {
|
353 |
+
return 'js';
|
354 |
+
}
|
355 |
+
|
356 |
+
if ( 'content' === substr( $this->scope, -7 ) ) {
|
357 |
+
return 'html';
|
358 |
+
}
|
359 |
+
|
360 |
+
return 'php';
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Retrieve a list of all valid types.
|
365 |
+
*
|
366 |
+
* @return string[]
|
367 |
+
*/
|
368 |
+
public static function get_types() {
|
369 |
+
return [ 'php', 'html', 'css', 'js' ];
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Retrieve description of snippet type.
|
374 |
+
*
|
375 |
+
* @return string
|
376 |
+
*/
|
377 |
+
private function get_type_desc() {
|
378 |
+
$labels = [
|
379 |
+
'php' => __( 'Functions', 'code-snippets' ),
|
380 |
+
'html' => __( 'Content', 'code-snippets' ),
|
381 |
+
'css' => __( 'Styles', 'code-snippets' ),
|
382 |
+
'js' => __( 'Scripts', 'code-snippets' ),
|
383 |
+
];
|
384 |
+
|
385 |
+
return isset( $labels[ $this->type ] ) ? $labels[ $this->type ] : strtoupper( $this->type );
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Determine the language that the snippet code is written in, based on the scope
|
390 |
+
*
|
391 |
+
* @return string The name of a language filename extension.
|
392 |
+
*/
|
393 |
+
private function get_lang() {
|
394 |
+
return $this->type;
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Prepare the modification field by ensuring it is in the correct format.
|
399 |
+
*
|
400 |
+
* @param DateTime|string $modified Snippet modification date.
|
401 |
+
*
|
402 |
+
* @return string
|
403 |
+
*/
|
404 |
+
private function prepare_modified( $modified ) {
|
405 |
+
|
406 |
+
/* if the supplied value is a DateTime object, convert it to string representation */
|
407 |
+
if ( $modified instanceof DateTime ) {
|
408 |
+
return $modified->format( self::DATE_FORMAT );
|
409 |
+
}
|
410 |
+
|
411 |
+
/* if the supplied value is probably a timestamp, attempt to convert it to a string */
|
412 |
+
if ( is_numeric( $modified ) ) {
|
413 |
+
return gmdate( self::DATE_FORMAT, $modified );
|
414 |
+
}
|
415 |
+
|
416 |
+
/* if the supplied value is a string, check it is not just the default value */
|
417 |
+
if ( is_string( $modified ) && self::DEFAULT_DATE !== $modified ) {
|
418 |
+
return $modified;
|
419 |
+
}
|
420 |
+
|
421 |
+
/* otherwise, discard the supplied value */
|
422 |
+
|
423 |
+
return null;
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Update the last modification date to the current date and time.
|
428 |
+
*/
|
429 |
+
public function update_modified() {
|
430 |
+
$this->modified = gmdate( self::DATE_FORMAT );
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Retrieve the snippet title if set or a placeholder title if not.
|
435 |
+
*
|
436 |
+
* @return string
|
437 |
+
*/
|
438 |
+
private function get_display_name() {
|
439 |
+
/* translators: %d: snippet ID */
|
440 |
+
return empty( $this->name ) ? sprintf( esc_html__( 'Untitled #%d', 'code-snippets' ), $this->id ) : $this->name;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Retrieve the tags in list format
|
445 |
+
*
|
446 |
+
* @return string The tags separated by a comma and a space.
|
447 |
+
*/
|
448 |
+
private function get_tags_list() {
|
449 |
+
return implode( ', ', $this->tags );
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Retrieve a list of all available scopes
|
454 |
+
*
|
455 |
+
* @return array Single-dimensional array of scope names.
|
456 |
+
*
|
457 |
+
* @phpcs:disable WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
|
458 |
+
*/
|
459 |
+
public static function get_all_scopes() {
|
460 |
+
return array(
|
461 |
+
'global', 'admin', 'front-end', 'single-use',
|
462 |
+
'content', 'head-content', 'footer-content',
|
463 |
+
'admin-css', 'site-css',
|
464 |
+
'site-head-js', 'site-footer-js',
|
465 |
+
);
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Retrieve a list of all scope icons
|
470 |
+
*
|
471 |
+
* @return array Two-dimensional array with scope name keyed to the class name of a dashicon.
|
472 |
+
*/
|
473 |
+
public static function get_scope_icons() {
|
474 |
+
return array(
|
475 |
+
'global' => 'admin-site',
|
476 |
+
'admin' => 'admin-tools',
|
477 |
+
'front-end' => 'admin-appearance',
|
478 |
+
'single-use' => 'clock',
|
479 |
+
'content' => 'shortcode',
|
480 |
+
'head-content' => 'editor-code',
|
481 |
+
'footer-content' => 'editor-code',
|
482 |
+
'admin-css' => 'dashboard',
|
483 |
+
'site-css' => 'admin-customizer',
|
484 |
+
'site-head-js' => 'media-code',
|
485 |
+
'site-footer-js' => 'media-code',
|
486 |
+
);
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Retrieve the string representation of the scope
|
491 |
+
*
|
492 |
+
* @return string The name of the scope.
|
493 |
+
*/
|
494 |
+
private function get_scope_name() {
|
495 |
+
switch ( $this->scope ) {
|
496 |
+
case 'global':
|
497 |
+
return __( 'Global function', 'code-snippets' );
|
498 |
+
case 'admin':
|
499 |
+
return __( 'Admin function', 'code-snippets' );
|
500 |
+
case 'front-end':
|
501 |
+
return __( 'Front-end function', 'code-snippets' );
|
502 |
+
case 'single-use':
|
503 |
+
return __( 'Single-use function', 'code-snippets' );
|
504 |
+
case 'content':
|
505 |
+
return __( 'Content', 'code-snippets' );
|
506 |
+
case 'head-content':
|
507 |
+
return __( 'Head content', 'code-snippets' );
|
508 |
+
case 'footer-content':
|
509 |
+
return __( 'Footer content', 'code-snippets' );
|
510 |
+
case 'admin-css':
|
511 |
+
return __( 'Admin styles', 'code-snippets' );
|
512 |
+
case 'site-css':
|
513 |
+
return __( 'Front-end styles', 'code-snippets' );
|
514 |
+
case 'site-head-js':
|
515 |
+
return __( 'Head styles', 'code-snippets' );
|
516 |
+
case 'site-footer-js':
|
517 |
+
return __( 'Footer styles', 'code-snippets' );
|
518 |
+
}
|
519 |
+
|
520 |
+
return '';
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Retrieve the icon used for the current scope
|
525 |
+
*
|
526 |
+
* @return string A dashicon name.
|
527 |
+
*/
|
528 |
+
private function get_scope_icon() {
|
529 |
+
$icons = self::get_scope_icons();
|
530 |
+
|
531 |
+
return $icons[ $this->scope ];
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Determine if the snippet is a shared network snippet
|
536 |
+
*
|
537 |
+
* @return bool Whether the snippet is a shared network snippet.
|
538 |
+
*/
|
539 |
+
private function get_shared_network() {
|
540 |
+
|
541 |
+
if ( isset( $this->fields['shared_network'] ) ) {
|
542 |
+
return $this->fields['shared_network'];
|
543 |
+
}
|
544 |
+
|
545 |
+
if ( ! is_multisite() || ! $this->fields['network'] ) {
|
546 |
+
$this->fields['shared_network'] = false;
|
547 |
+
} else {
|
548 |
+
$shared_network_snippets = get_site_option( 'shared_network_snippets', array() );
|
549 |
+
$this->fields['shared_network'] = in_array( $this->fields['id'], $shared_network_snippets, true );
|
550 |
+
}
|
551 |
+
|
552 |
+
return $this->fields['shared_network'];
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Retrieve the snippet modification date as a timestamp.
|
557 |
+
*
|
558 |
+
* @return int Timestamp value.
|
559 |
+
*/
|
560 |
+
private function get_modified_timestamp() {
|
561 |
+
$datetime = DateTime::createFromFormat( self::DATE_FORMAT, $this->modified, new DateTimeZone( 'UTC' ) );
|
562 |
+
|
563 |
+
return $datetime ? $datetime->getTimestamp() : 0;
|
564 |
+
}
|
565 |
+
|
566 |
+
/**
|
567 |
+
* Retrieve the modification time in the local timezone.
|
568 |
+
*
|
569 |
+
* @return DateTime
|
570 |
+
*/
|
571 |
+
private function get_modified_local() {
|
572 |
+
|
573 |
+
if ( function_exists( 'wp_timezone' ) ) {
|
574 |
+
$timezone = wp_timezone();
|
575 |
+
} else {
|
576 |
+
$timezone = get_option( 'timezone_string' );
|
577 |
+
|
578 |
+
/* calculate the timezone manually if it is not available */
|
579 |
+
if ( ! $timezone ) {
|
580 |
+
$offset = (float) get_option( 'gmt_offset' );
|
581 |
+
$hours = (int) $offset;
|
582 |
+
$minutes = ( $offset - $hours ) * 60;
|
583 |
+
|
584 |
+
$sign = ( $offset < 0 ) ? '-' : '+';
|
585 |
+
$timezone = sprintf( '%s%02d:%02d', $sign, abs( $hours ), abs( $minutes ) );
|
586 |
+
}
|
587 |
+
|
588 |
+
$timezone = new DateTimeZone( $timezone );
|
589 |
+
}
|
590 |
+
|
591 |
+
$datetime = DateTime::createFromFormat( self::DATE_FORMAT, $this->modified, new DateTimeZone( 'UTC' ) );
|
592 |
+
$datetime->setTimezone( $timezone );
|
593 |
+
|
594 |
+
return $datetime;
|
595 |
+
}
|
596 |
+
|
597 |
+
/**
|
598 |
+
* Retrieve the last modified time, nicely formatted for readability.
|
599 |
+
*
|
600 |
+
* @param boolean $include_html Whether to include HTML in the output.
|
601 |
+
*
|
602 |
+
* @return string
|
603 |
+
*/
|
604 |
+
public function format_modified( $include_html = true ) {
|
605 |
+
if ( ! $this->modified ) {
|
606 |
+
return '';
|
607 |
+
}
|
608 |
+
|
609 |
+
$timestamp = $this->modified_timestamp;
|
610 |
+
$time_diff = time() - $timestamp;
|
611 |
+
$local_time = $this->modified_local;
|
612 |
+
|
613 |
+
if ( $time_diff >= 0 && $time_diff < YEAR_IN_SECONDS ) {
|
614 |
+
/* translators: %s: Human-readable time difference. */
|
615 |
+
$human_time = sprintf( __( '%s ago', 'code-snippets' ), human_time_diff( $timestamp ) );
|
616 |
+
} else {
|
617 |
+
$human_time = $local_time->format( __( 'Y/m/d', 'code-snippets' ) );
|
618 |
+
}
|
619 |
+
|
620 |
+
if ( ! $include_html ) {
|
621 |
+
return $human_time;
|
622 |
+
}
|
623 |
+
|
624 |
+
/* translators: 1: date format, 2: time format */
|
625 |
+
$date_format = _x( '%1$s \a\t %2$s', 'date and time format', 'code-snippets' );
|
626 |
+
$date_format = sprintf( $date_format, get_option( 'date_format' ), get_option( 'time_format' ) );
|
627 |
+
|
628 |
+
return sprintf( '<span title="%s">%s</span>', $local_time->format( $date_format ), $human_time );
|
629 |
+
}
|
630 |
+
}
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
use WP_User;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Manages upgrade tasks such as deleting and updating options
|
9 |
+
*/
|
10 |
+
class Upgrade {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Instance of database class
|
14 |
+
*
|
15 |
+
* @var DB
|
16 |
+
*/
|
17 |
+
private $db;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* The current plugin version number
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $current_version;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Class constructor
|
28 |
+
*
|
29 |
+
* @param string $version Current plugin version.
|
30 |
+
* @param DB $db Instance of database class.
|
31 |
+
*/
|
32 |
+
public function __construct( $version, DB $db ) {
|
33 |
+
$this->db = $db;
|
34 |
+
$this->current_version = $version;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Run the upgrade functions
|
39 |
+
*/
|
40 |
+
public function run() {
|
41 |
+
|
42 |
+
/* Always run multisite upgrades, even if not on the main site, as subsites depend on the network snippet table */
|
43 |
+
if ( is_multisite() ) {
|
44 |
+
$this->do_multisite_upgrades();
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->do_site_upgrades();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Perform upgrades for the current site
|
52 |
+
*/
|
53 |
+
private function do_site_upgrades() {
|
54 |
+
$table_name = $this->db->table;
|
55 |
+
$prev_version = get_option( 'code_snippets_version' );
|
56 |
+
|
57 |
+
/* Do nothing if the plugin has not just been updated or installed */
|
58 |
+
if ( ! version_compare( $prev_version, $this->current_version, '<' ) ) {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
|
62 |
+
/* Update the plugin version stored in the database */
|
63 |
+
$updated = update_option( 'code_snippets_version', $this->current_version );
|
64 |
+
|
65 |
+
if ( ! $updated ) {
|
66 |
+
return; // Bail if the data was not successfully saved to prevent this process from repeating.
|
67 |
+
}
|
68 |
+
|
69 |
+
$sample_snippets = $this->get_sample_content();
|
70 |
+
$this->db->create_table( $table_name );
|
71 |
+
|
72 |
+
/* Remove outdated user meta */
|
73 |
+
if ( version_compare( $prev_version, '2.14.1', '<' ) ) {
|
74 |
+
global $wpdb;
|
75 |
+
|
76 |
+
$prefix = $wpdb->get_blog_prefix();
|
77 |
+
$menu_slug = code_snippets()->get_menu_slug();
|
78 |
+
$option_name = "{$prefix}managetoplevel_page_{$menu_slug}columnshidden";
|
79 |
+
|
80 |
+
// Loop through each user ID and remove all matching user meta.
|
81 |
+
foreach ( get_users( array( 'fields' => 'ID' ) ) as $user_id ) {
|
82 |
+
delete_metadata( 'user', $user_id, $option_name, '', true );
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/* Update the scope column of the database */
|
87 |
+
if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
|
88 |
+
$this->migrate_scope_data( $table_name );
|
89 |
+
}
|
90 |
+
|
91 |
+
/* Custom capabilities were removed after version 2.9.5 */
|
92 |
+
if ( version_compare( $prev_version, '2.9.5', '<=' ) ) {
|
93 |
+
$role = get_role( apply_filters( 'code_snippets_role', 'administrator' ) );
|
94 |
+
$role->remove_cap( apply_filters( 'code_snippets_cap', 'manage_snippets' ) );
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( false === $prev_version ) {
|
98 |
+
if ( apply_filters( 'code_snippets/create_sample_content', true ) ) {
|
99 |
+
foreach ( $sample_snippets as $sample_snippet ) {
|
100 |
+
save_snippet( $sample_snippet );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
clean_snippets_cache( $table_name );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Perform multisite-only upgrades
|
110 |
+
*/
|
111 |
+
private function do_multisite_upgrades() {
|
112 |
+
$table_name = $this->db->ms_table;
|
113 |
+
$prev_version = get_site_option( 'code_snippets_version' );
|
114 |
+
|
115 |
+
/* Do nothing if the plugin has not been updated or installed */
|
116 |
+
if ( ! version_compare( $prev_version, $this->current_version, '<' ) ) {
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
/* Always attempt to create or upgrade the database tables */
|
121 |
+
$this->db->create_table( $table_name );
|
122 |
+
|
123 |
+
/* Update the plugin version stored in the database */
|
124 |
+
update_site_option( 'code_snippets_version', $this->current_version );
|
125 |
+
|
126 |
+
/* Update the scope column of the database */
|
127 |
+
if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
|
128 |
+
$this->migrate_scope_data( $table_name );
|
129 |
+
}
|
130 |
+
|
131 |
+
/* Custom capabilities were removed after version 2.9.5 */
|
132 |
+
if ( version_compare( $prev_version, '2.9.5', '<=' ) ) {
|
133 |
+
$network_cap = apply_filters( 'code_snippets_network_cap', 'manage_network_snippets' );
|
134 |
+
|
135 |
+
foreach ( get_super_admins() as $admin ) {
|
136 |
+
$user = new WP_User( 0, $admin );
|
137 |
+
$user->remove_cap( $network_cap );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
clean_snippets_cache( $table_name );
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Migrate data from the old integer method of storing scopes to the new string method
|
146 |
+
*
|
147 |
+
* @param string $table_name Name of database table.
|
148 |
+
*/
|
149 |
+
private function migrate_scope_data( $table_name ) {
|
150 |
+
global $wpdb;
|
151 |
+
|
152 |
+
$scopes = array(
|
153 |
+
0 => 'global',
|
154 |
+
1 => 'admin',
|
155 |
+
2 => 'front-end',
|
156 |
+
);
|
157 |
+
|
158 |
+
foreach ( $scopes as $scope_number => $scope_name ) {
|
159 |
+
$wpdb->query(
|
160 |
+
$wpdb->prepare(
|
161 |
+
"UPDATE $table_name SET scope = %s WHERE scope = %d",
|
162 |
+
$scope_name,
|
163 |
+
$scope_number
|
164 |
+
)
|
165 |
+
); // cache ok, will flush at end of process; db call ok.
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Build a collection of sample snippets for new users to try out.
|
171 |
+
*
|
172 |
+
* @return array List of Snippet objects.
|
173 |
+
*/
|
174 |
+
private function get_sample_content() {
|
175 |
+
$tag = "\n\n" . esc_html__( 'This is a sample snippet. Feel free to use it, edit it, or remove it.', 'code-snippets' );
|
176 |
+
|
177 |
+
$snippets_data = array(
|
178 |
+
array(
|
179 |
+
'name' => esc_html__( 'Make upload filenames lowercase', 'code-snippets' ),
|
180 |
+
'code' => "add_filter( 'sanitize_file_name', 'mb_strtolower' );",
|
181 |
+
'desc' => esc_html__( 'Makes sure that image and file uploads have lowercase filenames.', 'code-snippets' ) . $tag,
|
182 |
+
'tags' => array( 'sample', 'media' ),
|
183 |
+
),
|
184 |
+
array(
|
185 |
+
'name' => esc_html__( 'Disable admin bar', 'code-snippets' ),
|
186 |
+
'code' => "add_action( 'wp', function () {\n\tif ( ! current_user_can( 'manage_options' ) ) {\n\t\tshow_admin_bar( false );\n\t}\n} );",
|
187 |
+
'desc' => esc_html__( 'Turns off the WordPress admin bar for everyone except administrators.', 'code-snippets' ) . $tag,
|
188 |
+
'tags' => array( 'sample', 'admin-bar' ),
|
189 |
+
'scope' => 'front-end',
|
190 |
+
),
|
191 |
+
array(
|
192 |
+
'name' => esc_html__( 'Allow smilies', 'code-snippets' ),
|
193 |
+
'code' => "add_filter( 'widget_text', 'convert_smilies' );\nadd_filter( 'the_title', 'convert_smilies' );\nadd_filter( 'wp_title', 'convert_smilies' );\nadd_filter( 'get_bloginfo', 'convert_smilies' );",
|
194 |
+
'desc' => esc_html__( 'Allows smiley conversion in obscure places.', 'code-snippets' ) . $tag,
|
195 |
+
'tags' => array( 'sample' ),
|
196 |
+
),
|
197 |
+
array(
|
198 |
+
'name' => esc_html__( 'Current year', 'code-snippets' ),
|
199 |
+
'code' => "<?php echo date( 'Y' ); ?>",
|
200 |
+
'desc' => esc_html__( 'Shortcode for inserting the current year into a post or page..', 'code-snippets' ) . $tag,
|
201 |
+
'tags' => array( 'sample', 'dates' ),
|
202 |
+
'scope' => 'content',
|
203 |
+
),
|
204 |
+
);
|
205 |
+
|
206 |
+
$snippets = array();
|
207 |
+
|
208 |
+
foreach ( $snippets_data as $sample_name => $snippet_data ) {
|
209 |
+
$snippets[ $sample_name ] = new Snippet( $snippet_data );
|
210 |
+
}
|
211 |
+
|
212 |
+
return $snippets;
|
213 |
+
}
|
214 |
+
}
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Validates code prior to execution.
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Validator {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Code to validate.
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
private $code;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* List of tokens.
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $tokens;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The index of the token currently being examined.
|
28 |
+
*
|
29 |
+
* @var int
|
30 |
+
*/
|
31 |
+
private $current;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The total number of tokens.
|
35 |
+
*
|
36 |
+
* @var int
|
37 |
+
*/
|
38 |
+
private $length;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Array to keep track of the various function, class and interface identifiers which have been defined.
|
42 |
+
*
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
private $defined_identifiers = array();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Exclude certain tokens from being checked.
|
49 |
+
*
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
private $exceptions = array();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Class constructor.
|
56 |
+
*
|
57 |
+
* @param string $code Snippet code for parsing.
|
58 |
+
*/
|
59 |
+
public function __construct( $code ) {
|
60 |
+
$this->code = $code;
|
61 |
+
$this->tokens = token_get_all( "<?php\n" . $this->code );
|
62 |
+
$this->length = count( $this->tokens );
|
63 |
+
$this->current = 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Determine whether the parser has reached the end of the list of tokens.
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
private function end() {
|
72 |
+
return $this->current === $this->length;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Retrieve the next token without moving the pointer
|
77 |
+
*
|
78 |
+
* @return string|array|null The current token if the list has not been expended, null otherwise.
|
79 |
+
*/
|
80 |
+
private function peek() {
|
81 |
+
return $this->end() ? null : $this->tokens[ $this->current ];
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Move the pointer to the next token, if there is one.
|
86 |
+
*
|
87 |
+
* If the first argument is provided, only move the pointer if the tokens match.
|
88 |
+
*/
|
89 |
+
private function next() {
|
90 |
+
if ( ! $this->end() ) {
|
91 |
+
$this->current++;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Check whether a particular identifier has been used previously.
|
97 |
+
*
|
98 |
+
* @param string $type Which type of identifier this is. Supports T_FUNCTION, T_CLASS and T_INTERFACE.
|
99 |
+
* @param string $identifier The name of the identifier itself.
|
100 |
+
*
|
101 |
+
* @return bool true if the identifier is not unique.
|
102 |
+
*/
|
103 |
+
private function check_duplicate_identifier( $type, $identifier ) {
|
104 |
+
|
105 |
+
if ( ! isset( $this->defined_identifiers[ $type ] ) ) {
|
106 |
+
switch ( $type ) {
|
107 |
+
case T_FUNCTION:
|
108 |
+
$defined_functions = get_defined_functions();
|
109 |
+
$this->defined_identifiers[ T_FUNCTION ] = array_merge( $defined_functions['internal'], $defined_functions['user'] );
|
110 |
+
break;
|
111 |
+
|
112 |
+
case T_CLASS:
|
113 |
+
$this->defined_identifiers[ T_CLASS ] = get_declared_classes();
|
114 |
+
break;
|
115 |
+
|
116 |
+
case T_INTERFACE:
|
117 |
+
$this->defined_identifiers[ T_INTERFACE ] = get_declared_interfaces();
|
118 |
+
break;
|
119 |
+
|
120 |
+
default:
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
$duplicate = in_array( $identifier, $this->defined_identifiers[ $type ], true );
|
126 |
+
array_unshift( $this->defined_identifiers[ $type ], $identifier );
|
127 |
+
|
128 |
+
return $duplicate && ! ( isset( $this->exceptions[ $type ] ) && in_array( $identifier, $this->exceptions[ $type ], true ) );
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Validate the given PHP code and return the result.
|
133 |
+
*
|
134 |
+
* @return array|bool Array containing message if an error was encountered, false if validation was successful.
|
135 |
+
*/
|
136 |
+
public function validate() {
|
137 |
+
|
138 |
+
while ( ! $this->end() ) {
|
139 |
+
$token = $this->peek();
|
140 |
+
$this->next();
|
141 |
+
|
142 |
+
if ( ! is_array( $token ) ) {
|
143 |
+
continue;
|
144 |
+
}
|
145 |
+
|
146 |
+
// If this is a function or class exists check, then allow this function or class to be defined.
|
147 |
+
if ( T_STRING === $token[0] && 'function_exists' === $token[1] || 'class_exists' === $token[1] ) {
|
148 |
+
$type = 'function_exists' === $token[1] ? T_FUNCTION : T_CLASS;
|
149 |
+
|
150 |
+
// Eat tokens until we find the function or class name.
|
151 |
+
while ( ! $this->end() && T_CONSTANT_ENCAPSED_STRING !== $token[0] ) {
|
152 |
+
$token = $this->peek();
|
153 |
+
$this->next();
|
154 |
+
}
|
155 |
+
|
156 |
+
// Add the identifier to the list of exceptions.
|
157 |
+
$this->exceptions[ $type ] = isset( $this->exceptions[ $type ] ) ? $this->exceptions[ $type ] : array();
|
158 |
+
$this->exceptions[ $type ][] = trim( $token[1], '\'"' );
|
159 |
+
continue;
|
160 |
+
}
|
161 |
+
|
162 |
+
// If we have a double colon, followed by a class, then consume it before the next section.
|
163 |
+
if ( T_DOUBLE_COLON === $token[0] ) {
|
164 |
+
$token = $this->peek();
|
165 |
+
$this->next();
|
166 |
+
|
167 |
+
if ( T_CLASS === $token[0] ) {
|
168 |
+
$this->next();
|
169 |
+
$token = $this->peek();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
// Only look for class and function declaration tokens.
|
174 |
+
if ( T_CLASS !== $token[0] && T_FUNCTION !== $token[0] ) {
|
175 |
+
continue;
|
176 |
+
}
|
177 |
+
|
178 |
+
$structure_type = $token[0];
|
179 |
+
|
180 |
+
// Continue eating tokens until we find the name of the class or function.
|
181 |
+
while ( ! $this->end() && T_STRING !== $token[0] &&
|
182 |
+
( T_FUNCTION !== $structure_type || '(' !== $token ) && ( T_CLASS !== $structure_type || '{' !== $token ) ) {
|
183 |
+
$token = $this->peek();
|
184 |
+
$this->next();
|
185 |
+
}
|
186 |
+
|
187 |
+
// If we've eaten all the tokens without discovering a name, then there must be a syntax error, so return appropriately.
|
188 |
+
if ( $this->end() ) {
|
189 |
+
return array(
|
190 |
+
'message' => __( 'Parse error: syntax error, unexpected end of snippet.', 'code-snippets' ),
|
191 |
+
'line' => $token[2],
|
192 |
+
);
|
193 |
+
}
|
194 |
+
|
195 |
+
// If the function or class is anonymous, with no name, then no need to check.
|
196 |
+
if ( ! ( T_FUNCTION === $structure_type && '(' === $token ) && ! ( T_CLASS === $structure_type && '{' === $token ) ) {
|
197 |
+
|
198 |
+
// Check whether the name has already been defined.
|
199 |
+
if ( $this->check_duplicate_identifier( $structure_type, $token[1] ) ) {
|
200 |
+
switch ( $structure_type ) {
|
201 |
+
case T_FUNCTION:
|
202 |
+
/* translators: %s: PHP function name */
|
203 |
+
$message = __( 'Cannot redeclare function %s.', 'code-snippets' );
|
204 |
+
break;
|
205 |
+
case T_CLASS:
|
206 |
+
/* translators: %s: PHP class name */
|
207 |
+
$message = __( 'Cannot redeclare class %s.', 'code-snippets' );
|
208 |
+
break;
|
209 |
+
case T_INTERFACE:
|
210 |
+
/* translators: %s: PHP interface name */
|
211 |
+
$message = __( 'Cannot redeclare interface %s.', 'code-snippets' );
|
212 |
+
break;
|
213 |
+
default:
|
214 |
+
/* translators: %s: PHP identifier name*/
|
215 |
+
$message = __( 'Cannot redeclare %s.', 'code-snippets' );
|
216 |
+
}
|
217 |
+
|
218 |
+
return array(
|
219 |
+
'message' => sprintf( $message, $token[1] ),
|
220 |
+
'line' => $token[2],
|
221 |
+
);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
// If we have entered into a class, eat tokens until we find the closing brace.
|
226 |
+
if ( T_CLASS !== $structure_type ) {
|
227 |
+
continue;
|
228 |
+
}
|
229 |
+
|
230 |
+
// Find the opening brace for the class.
|
231 |
+
while ( ! $this->end() && '{' !== $token ) {
|
232 |
+
$token = $this->peek();
|
233 |
+
$this->next();
|
234 |
+
}
|
235 |
+
|
236 |
+
// Continue traversing the class tokens until we have found the class closing brace.
|
237 |
+
$depth = 1;
|
238 |
+
while ( ! $this->end() && $depth > 0 ) {
|
239 |
+
$token = $this->peek();
|
240 |
+
|
241 |
+
if ( '{' === $token ) {
|
242 |
+
$depth++;
|
243 |
+
} elseif ( '}' === $token ) {
|
244 |
+
$depth--;
|
245 |
+
}
|
246 |
+
|
247 |
+
$this->next();
|
248 |
+
}
|
249 |
+
|
250 |
+
// If we did not make it out of the class, then there's a problem.
|
251 |
+
if ( $depth > 0 ) {
|
252 |
+
return array(
|
253 |
+
'message' => __( 'Parse error: syntax error, unexpected end of snippet', 'code-snippets' ),
|
254 |
+
'line' => $token[2],
|
255 |
+
);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
}
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions for using the built-in code editor library
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Code_Snippets;
|
9 |
+
|
10 |
+
use function Code_Snippets\Settings\get_setting;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Register and load the CodeMirror library.
|
14 |
+
*
|
15 |
+
* @param string $type Type of code editor – either 'php', 'css', 'js', or 'html'.
|
16 |
+
* @param array $extra_atts Pass an array of attributes to override the saved ones.
|
17 |
+
*/
|
18 |
+
function enqueue_code_editor( $type, $extra_atts = [] ) {
|
19 |
+
$plugin = code_snippets();
|
20 |
+
|
21 |
+
$modes = [
|
22 |
+
'css' => 'text/css',
|
23 |
+
'php' => 'php-snippet',
|
24 |
+
'js' => 'javascript',
|
25 |
+
'html' => 'application/x-httpd-php',
|
26 |
+
];
|
27 |
+
|
28 |
+
if ( ! isset( $modes[ $type ] ) ) {
|
29 |
+
$type = 'php';
|
30 |
+
}
|
31 |
+
|
32 |
+
$default_atts = [
|
33 |
+
'mode' => $modes[ $type ],
|
34 |
+
'inputStyle' => 'textarea',
|
35 |
+
'matchBrackets' => true,
|
36 |
+
'extraKeys' => [
|
37 |
+
'Alt-F' => 'findPersistent',
|
38 |
+
'Ctrl-Space' => 'autocomplete',
|
39 |
+
'Ctrl-/' => 'toggleComment',
|
40 |
+
'Cmd-/' => 'toggleComment',
|
41 |
+
'Alt-Up' => 'swapLineUp',
|
42 |
+
'Alt-Down' => 'swapLineDown',
|
43 |
+
],
|
44 |
+
'gutters' => [ 'CodeMirror-lint-markers', 'CodeMirror-foldgutter' ],
|
45 |
+
'lint' => 'css' === $type || 'php' === $type,
|
46 |
+
'direction' => 'ltr',
|
47 |
+
'colorpicker' => [ 'mode' => 'edit' ],
|
48 |
+
'foldOptions' => [ 'widget' => '...' ],
|
49 |
+
];
|
50 |
+
|
51 |
+
// Add relevant saved setting values to the default attributes.
|
52 |
+
$plugin_settings = Settings\get_settings_values();
|
53 |
+
$setting_fields = Settings\get_settings_fields();
|
54 |
+
|
55 |
+
foreach ( $setting_fields['editor'] as $field_id => $field ) {
|
56 |
+
// The 'codemirror' setting field specifies the name of the attribute.
|
57 |
+
$default_atts[ $field['codemirror'] ] = $plugin_settings['editor'][ $field_id ];
|
58 |
+
}
|
59 |
+
|
60 |
+
// Merge the default attributes with the ones passed into the function.
|
61 |
+
$atts = wp_parse_args( $default_atts, $extra_atts );
|
62 |
+
$atts = apply_filters( 'code_snippets_codemirror_atts', $atts );
|
63 |
+
|
64 |
+
// Ensure number values are not formatted as strings.
|
65 |
+
foreach ( [ 'indentUnit', 'tabSize' ] as $number_att ) {
|
66 |
+
$atts[ $number_att ] = intval( $atts[ $number_att ] );
|
67 |
+
}
|
68 |
+
|
69 |
+
wp_enqueue_code_editor(
|
70 |
+
[
|
71 |
+
'type' => $modes[ $type ],
|
72 |
+
'codemirror' => $atts,
|
73 |
+
]
|
74 |
+
);
|
75 |
+
|
76 |
+
wp_enqueue_script(
|
77 |
+
'code-snippets-code-editor',
|
78 |
+
plugins_url( 'dist/editor.js', $plugin->file ),
|
79 |
+
[ 'code-editor' ],
|
80 |
+
$plugin->version,
|
81 |
+
true
|
82 |
+
);
|
83 |
+
|
84 |
+
// CodeMirror Theme.
|
85 |
+
$theme = get_setting( 'editor', 'theme' );
|
86 |
+
|
87 |
+
if ( 'default' !== $theme ) {
|
88 |
+
wp_enqueue_style(
|
89 |
+
'code-snippets-editor-theme-' . $theme,
|
90 |
+
plugins_url( "dist/editor-themes/$theme.css", $plugin->file ),
|
91 |
+
[ 'code-editor' ],
|
92 |
+
$plugin->version
|
93 |
+
);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retrieve a list of the available CodeMirror themes.
|
99 |
+
*
|
100 |
+
* @return array The available themes.
|
101 |
+
*/
|
102 |
+
function get_editor_themes() {
|
103 |
+
static $themes = null;
|
104 |
+
|
105 |
+
if ( ! is_null( $themes ) ) {
|
106 |
+
return $themes;
|
107 |
+
}
|
108 |
+
|
109 |
+
$themes = array();
|
110 |
+
$themes_dir = plugin_dir_path( PLUGIN_FILE ) . 'dist/editor-themes/';
|
111 |
+
|
112 |
+
$theme_files = glob( $themes_dir . '*.css' );
|
113 |
+
|
114 |
+
foreach ( $theme_files as $theme ) {
|
115 |
+
$theme = str_replace( $themes_dir, '', $theme );
|
116 |
+
$theme = str_replace( '.css', '', $theme );
|
117 |
+
$themes[] = $theme;
|
118 |
+
}
|
119 |
+
|
120 |
+
return $themes;
|
121 |
+
}
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Handles exporting snippets from the site to a downloadable file over HTTP.
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Export_Attachment extends Export {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Set up the current page to act like a downloadable file instead of being shown in the browser
|
14 |
+
*
|
15 |
+
* @param string $format File format. Used for file extension.
|
16 |
+
* @param string $mime_type File MIME type. Used for Content-Type header.
|
17 |
+
*/
|
18 |
+
private function do_headers( $format, $mime_type = 'text/plain' ) {
|
19 |
+
header( 'Content-Disposition: attachment; filename=' . sanitize_file_name( $this->build_filename( $format ) ) );
|
20 |
+
header( sprintf( 'Content-Type: %s; charset=%s', sanitize_mime_type( $mime_type ), get_bloginfo( 'charset' ) ) );
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Export snippets in JSON format as a downloadable file.
|
25 |
+
*/
|
26 |
+
public function download_snippets_json() {
|
27 |
+
$this->do_headers( 'json', 'application/json' );
|
28 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
29 |
+
echo $this->export_snippets_json();
|
30 |
+
exit;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Export snippets in their code file format.
|
35 |
+
*/
|
36 |
+
public function download_snippets_code() {
|
37 |
+
$mime_types = [
|
38 |
+
'php' => 'text/php',
|
39 |
+
'css' => 'text/css',
|
40 |
+
'js' => 'text/javascript',
|
41 |
+
];
|
42 |
+
|
43 |
+
$type = isset( $mime_types[ $this->snippets_list[0]->type ] ) ? $this->snippets_list[0]->type : 'php';
|
44 |
+
$this->do_headers( $type, $mime_types[ $type ] );
|
45 |
+
|
46 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
47 |
+
echo ( 'php' === $type || 'html' === $type ) ?
|
48 |
+
$this->export_snippets_php() :
|
49 |
+
$this->export_snippets_code( $type );
|
50 |
+
|
51 |
+
exit;
|
52 |
+
}
|
53 |
+
}
|
@@ -15,7 +15,7 @@ class Export {
|
|
15 |
*
|
16 |
* @var array
|
17 |
*/
|
18 |
-
|
19 |
|
20 |
/**
|
21 |
* Class constructor
|
@@ -34,7 +34,6 @@ class Export {
|
|
34 |
* @param string $table_name Name of database table to fetch snippets from.
|
35 |
*/
|
36 |
private function fetch_snippets( $ids, $table_name ) {
|
37 |
-
|
38 |
if ( '' === $table_name ) {
|
39 |
$table_name = code_snippets()->db->get_table_name();
|
40 |
}
|
@@ -43,18 +42,17 @@ class Export {
|
|
43 |
$ids = array( $ids );
|
44 |
}
|
45 |
|
46 |
-
$this->snippets_list =
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
*
|
|
|
|
|
51 |
*
|
52 |
-
* @
|
53 |
-
* @param string $mime_type File MIME type. Used for Content-Type header.
|
54 |
*/
|
55 |
-
|
56 |
-
|
57 |
-
/* Build the export filename */
|
58 |
if ( 1 === count( $this->snippets_list ) ) {
|
59 |
/* If there is only snippet to export, use its name instead of the site name */
|
60 |
$title = strtolower( $this->snippets_list[0]->name );
|
@@ -64,17 +62,15 @@ class Export {
|
|
64 |
}
|
65 |
|
66 |
$filename = "$title.code-snippets.$format";
|
67 |
-
|
68 |
-
|
69 |
-
/* Set HTTP headers */
|
70 |
-
header( 'Content-Disposition: attachment; filename=' . sanitize_file_name( $filename ) );
|
71 |
-
header( sprintf( "Content-Type: %s; charset=%s", sanitize_mime_type( $mime_type ), get_bloginfo( 'charset' ) ) );
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
-
*
|
|
|
|
|
76 |
*/
|
77 |
-
public function
|
78 |
$snippets = array();
|
79 |
|
80 |
foreach ( $this->snippets_list as $snippet ) {
|
@@ -92,38 +88,22 @@ class Export {
|
|
92 |
}
|
93 |
}
|
94 |
|
95 |
-
$this->do_headers( 'json', 'application/json' );
|
96 |
-
|
97 |
$data = array(
|
98 |
'generator' => 'Code Snippets v' . code_snippets()->version,
|
99 |
'date_created' => gmdate( 'Y-m-d H:i' ),
|
100 |
'snippets' => $snippets,
|
101 |
);
|
102 |
|
103 |
-
|
104 |
-
exit;
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
-
*
|
109 |
-
*
|
110 |
-
* The Pro version of this function can download snippets to .css and .js files.
|
111 |
*/
|
112 |
-
public function
|
113 |
-
$
|
114 |
-
}
|
115 |
|
116 |
-
|
117 |
-
* Generate a downloadable PHP file from a list of snippets
|
118 |
-
* @phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
119 |
-
*/
|
120 |
-
public function download_php_snippets() {
|
121 |
-
$this->do_headers( 'php', 'text/php' );
|
122 |
-
echo "<?php\n";
|
123 |
-
|
124 |
-
/** Loop through the snippets
|
125 |
-
* @var Snippet $snippet
|
126 |
-
*/
|
127 |
foreach ( $this->snippets_list as $snippet ) {
|
128 |
$code = trim( $snippet->code );
|
129 |
|
@@ -131,15 +111,15 @@ class Export {
|
|
131 |
continue;
|
132 |
}
|
133 |
|
134 |
-
|
135 |
|
136 |
if ( ! empty( $snippet->desc ) ) {
|
137 |
/* Convert description to PhpDoc */
|
138 |
-
$desc = str_replace( "\n", "\n * ", $snippet->desc );
|
139 |
-
|
140 |
}
|
141 |
|
142 |
-
|
143 |
|
144 |
if ( 'content' === $snippet->scope ) {
|
145 |
$shortcode_tag = apply_filters( 'code_snippets_export_shortcode_tag', "code_snippets_export_$snippet->id", $snippet );
|
@@ -151,9 +131,51 @@ class Export {
|
|
151 |
);
|
152 |
}
|
153 |
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
-
|
158 |
}
|
159 |
}
|
15 |
*
|
16 |
* @var array
|
17 |
*/
|
18 |
+
protected $snippets_list;
|
19 |
|
20 |
/**
|
21 |
* Class constructor
|
34 |
* @param string $table_name Name of database table to fetch snippets from.
|
35 |
*/
|
36 |
private function fetch_snippets( $ids, $table_name ) {
|
|
|
37 |
if ( '' === $table_name ) {
|
38 |
$table_name = code_snippets()->db->get_table_name();
|
39 |
}
|
42 |
$ids = array( $ids );
|
43 |
}
|
44 |
|
45 |
+
$this->snippets_list = get_snippets( $ids, $table_name );
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* Build the export filename.
|
50 |
+
*
|
51 |
+
* @param string $format File format. Used for file extension.
|
52 |
*
|
53 |
+
* @return string
|
|
|
54 |
*/
|
55 |
+
public function build_filename( $format ) {
|
|
|
|
|
56 |
if ( 1 === count( $this->snippets_list ) ) {
|
57 |
/* If there is only snippet to export, use its name instead of the site name */
|
58 |
$title = strtolower( $this->snippets_list[0]->name );
|
62 |
}
|
63 |
|
64 |
$filename = "$title.code-snippets.$format";
|
65 |
+
return apply_filters( 'code_snippets/export/filename', $filename, $title, $this->snippets_list );
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
+
* Bundle snippets together into JSON format.
|
70 |
+
*
|
71 |
+
* @return string Snippets as JSON object.
|
72 |
*/
|
73 |
+
public function export_snippets_json() {
|
74 |
$snippets = array();
|
75 |
|
76 |
foreach ( $this->snippets_list as $snippet ) {
|
88 |
}
|
89 |
}
|
90 |
|
|
|
|
|
91 |
$data = array(
|
92 |
'generator' => 'Code Snippets v' . code_snippets()->version,
|
93 |
'date_created' => gmdate( 'Y-m-d H:i' ),
|
94 |
'snippets' => $snippets,
|
95 |
);
|
96 |
|
97 |
+
return wp_json_encode( $data, apply_filters( 'code_snippets/export/json_encode_options', 0 ) );
|
|
|
98 |
}
|
99 |
|
100 |
/**
|
101 |
+
* Bundle a snippets into a PHP file.
|
|
|
|
|
102 |
*/
|
103 |
+
public function export_snippets_php() {
|
104 |
+
$result = "<?php\n";
|
|
|
105 |
|
106 |
+
/* @var Snippet $snippet */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
foreach ( $this->snippets_list as $snippet ) {
|
108 |
$code = trim( $snippet->code );
|
109 |
|
111 |
continue;
|
112 |
}
|
113 |
|
114 |
+
$result .= "\n/**\n * $snippet->display_name\n";
|
115 |
|
116 |
if ( ! empty( $snippet->desc ) ) {
|
117 |
/* Convert description to PhpDoc */
|
118 |
+
$desc = wp_strip_all_tags( str_replace( "\n", "\n * ", $snippet->desc ) );
|
119 |
+
$result .= " *\n * $desc\n";
|
120 |
}
|
121 |
|
122 |
+
$result .= " */\n";
|
123 |
|
124 |
if ( 'content' === $snippet->scope ) {
|
125 |
$shortcode_tag = apply_filters( 'code_snippets_export_shortcode_tag', "code_snippets_export_$snippet->id", $snippet );
|
131 |
);
|
132 |
}
|
133 |
|
134 |
+
$result .= "$code\n";
|
135 |
+
}
|
136 |
+
|
137 |
+
return $result;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Generate a downloadable CSS or JavaScript file from a list of snippets
|
142 |
+
*
|
143 |
+
* @phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
144 |
+
*
|
145 |
+
* @param string $type Snippet type. Supports 'css' or 'js'.
|
146 |
+
*/
|
147 |
+
public function export_snippets_code( $type = null ) {
|
148 |
+
$result = '';
|
149 |
+
|
150 |
+
if ( ! $type ) {
|
151 |
+
$type = $this->snippets_list[0]->type;
|
152 |
+
}
|
153 |
+
|
154 |
+
if ( 'php' === $type || 'html' === $type ) {
|
155 |
+
return $this->export_snippets_php();
|
156 |
+
}
|
157 |
+
|
158 |
+
/* Loop through the snippets */
|
159 |
+
foreach ( $this->snippets_list as $snippet ) {
|
160 |
+
$snippet = new Snippet( $snippet );
|
161 |
+
|
162 |
+
if ( $snippet->type !== $type ) {
|
163 |
+
continue;
|
164 |
+
}
|
165 |
+
|
166 |
+
$result .= "\n/*\n";
|
167 |
+
|
168 |
+
if ( $snippet->name ) {
|
169 |
+
$result .= wp_strip_all_tags( $snippet->name ) . "\n\n";
|
170 |
+
}
|
171 |
+
|
172 |
+
if ( ! empty( $snippet->desc ) ) {
|
173 |
+
$result .= wp_strip_all_tags( $snippet->desc ) . "\n";
|
174 |
+
}
|
175 |
+
|
176 |
+
$result .= "*/\n\n{$snippet->code}\n\n";
|
177 |
}
|
178 |
|
179 |
+
return $result;
|
180 |
}
|
181 |
}
|
@@ -98,11 +98,7 @@ class Import {
|
|
98 |
|
99 |
$snippets = array();
|
100 |
|
101 |
-
|
102 |
-
* Loop through all snippets
|
103 |
-
*
|
104 |
-
* @var DOMElement $snippet_xml
|
105 |
-
*/
|
106 |
foreach ( $snippets_xml as $snippet_xml ) {
|
107 |
$snippet = new Snippet();
|
108 |
$snippet->network = $this->multisite;
|
98 |
|
99 |
$snippets = array();
|
100 |
|
101 |
+
/* @var DOMElement $snippet_xml */
|
|
|
|
|
|
|
|
|
102 |
foreach ( $snippets_xml as $snippet_xml ) {
|
103 |
$snippet = new Snippet();
|
104 |
$snippet->network = $this->multisite;
|
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Code_Snippets;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class manages the shortcodes included with the plugin
|
7 |
+
*
|
8 |
+
* @package Code_Snippets
|
9 |
+
*/
|
10 |
+
class Frontend {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Name of the shortcode tag for rendering the code source
|
14 |
+
*/
|
15 |
+
const SOURCE_SHORTCODE = 'code_snippet_source';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Name of the shortcode tag for rendering content snippets
|
19 |
+
*/
|
20 |
+
const CONTENT_SHORTCODE = 'code_snippet';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Handle to use for front-end scripts and styles.
|
24 |
+
*/
|
25 |
+
const PRISM_HANDLE = 'code-snippets-prism';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class constructor
|
29 |
+
*/
|
30 |
+
public function __construct() {
|
31 |
+
add_action( 'the_posts', [ $this, 'enqueue_highlighting' ] );
|
32 |
+
add_action( 'init', [ $this, 'setup_mce_plugin' ] );
|
33 |
+
|
34 |
+
add_shortcode( self::CONTENT_SHORTCODE, [ $this, 'render_content_shortcode' ] );
|
35 |
+
add_shortcode( self::SOURCE_SHORTCODE, [ $this, 'render_source_shortcode' ] );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Perform the necessary actions to add a button to the TinyMCE editor
|
40 |
+
*/
|
41 |
+
public function setup_mce_plugin() {
|
42 |
+
if ( ! code_snippets()->current_user_can() ) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
/* Register the TinyMCE plugin */
|
47 |
+
add_filter(
|
48 |
+
'mce_external_plugins',
|
49 |
+
function ( $plugins ) {
|
50 |
+
$plugins['code_snippets'] = plugins_url( 'dist/mce.js', PLUGIN_FILE );
|
51 |
+
return $plugins;
|
52 |
+
}
|
53 |
+
);
|
54 |
+
|
55 |
+
/* Add the button to the editor toolbar */
|
56 |
+
add_filter(
|
57 |
+
'mce_buttons',
|
58 |
+
function ( $buttons ) {
|
59 |
+
$buttons[] = 'code_snippets';
|
60 |
+
return $buttons;
|
61 |
+
}
|
62 |
+
);
|
63 |
+
|
64 |
+
/* Add the translation strings to the TinyMCE editor */
|
65 |
+
add_filter(
|
66 |
+
'mce_external_languages',
|
67 |
+
function ( $languages ) {
|
68 |
+
$languages['code_snippets'] = __DIR__ . '/mce-strings.php';
|
69 |
+
return $languages;
|
70 |
+
}
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Enqueue the syntax highlighting assets if they are required for the current posts
|
76 |
+
*
|
77 |
+
* @param array $posts List of currently visible posts.
|
78 |
+
*
|
79 |
+
* @return array Unchanged list of posts.
|
80 |
+
*/
|
81 |
+
public function enqueue_highlighting( $posts ) {
|
82 |
+
|
83 |
+
// Exit early if there are no posts to check or if the highlighter has been disabled.
|
84 |
+
if ( empty( $posts ) || Settings\get_setting( 'general', 'disable_prism' ) ) {
|
85 |
+
return $posts;
|
86 |
+
}
|
87 |
+
|
88 |
+
// Concatenate all provided content together, so we can check it all in one go.
|
89 |
+
$content = implode( ' ', wp_list_pluck( $posts, 'post_content' ) );
|
90 |
+
|
91 |
+
// Bail now if the provided post don't contain the source shortcode or block editor block.
|
92 |
+
if ( false === stripos( $content, '[' . self::SOURCE_SHORTCODE ) &&
|
93 |
+
false === strpos( $content, '<!-- wp:code-snippets/source ' ) ) {
|
94 |
+
return $posts;
|
95 |
+
}
|
96 |
+
|
97 |
+
// Load Prism assets on the appropriate hook.
|
98 |
+
$this->register_prism_assets();
|
99 |
+
|
100 |
+
add_action(
|
101 |
+
'wp_enqueue_scripts',
|
102 |
+
function () {
|
103 |
+
wp_enqueue_style( self::PRISM_HANDLE );
|
104 |
+
wp_enqueue_script( self::PRISM_HANDLE );
|
105 |
+
},
|
106 |
+
100
|
107 |
+
);
|
108 |
+
|
109 |
+
return $posts;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Enqueue the styles and scripts for the Prism syntax highlighter.
|
114 |
+
*/
|
115 |
+
public static function register_prism_assets() {
|
116 |
+
$plugin = code_snippets();
|
117 |
+
|
118 |
+
wp_register_style(
|
119 |
+
self::PRISM_HANDLE,
|
120 |
+
plugins_url( 'dist/prism.css', $plugin->file ),
|
121 |
+
array(),
|
122 |
+
$plugin->version
|
123 |
+
);
|
124 |
+
|
125 |
+
wp_register_script(
|
126 |
+
self::PRISM_HANDLE,
|
127 |
+
plugins_url( 'dist/prism.js', $plugin->file ),
|
128 |
+
array(),
|
129 |
+
$plugin->version,
|
130 |
+
true
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Print a message to the user if the snippet ID attribute is invalid.
|
136 |
+
*
|
137 |
+
* @param int $id Snippet ID.
|
138 |
+
*
|
139 |
+
* @return string Warning message.
|
140 |
+
*/
|
141 |
+
private function invalid_id_warning( $id ) {
|
142 |
+
/* translators: %d: snippet ID */
|
143 |
+
$text = esc_html__( 'Could not load snippet with an invalid ID: %d.', 'code-snippets' );
|
144 |
+
return current_user_can( 'edit_posts' ) ? sprintf( $text, intval( $id ) ) : '';
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Render the value of a content shortcode
|
149 |
+
*
|
150 |
+
* @param array $atts Shortcode attributes.
|
151 |
+
*
|
152 |
+
* @return string Shortcode content.
|
153 |
+
*/
|
154 |
+
public function render_content_shortcode( $atts ) {
|
155 |
+
$atts = shortcode_atts(
|
156 |
+
array(
|
157 |
+
'id' => 0,
|
158 |
+
'snippet_id' => 0,
|
159 |
+
'network' => false,
|
160 |
+
'php' => false,
|
161 |
+
'format' => false,
|
162 |
+
'shortcodes' => false,
|
163 |
+
'debug' => false,
|
164 |
+
),
|
165 |
+
$atts,
|
166 |
+
self::CONTENT_SHORTCODE
|
167 |
+
);
|
168 |
+
|
169 |
+
$id = intval( $atts['snippet_id'] ) ?: intval( $atts['id'] );
|
170 |
+
if ( ! $id ) {
|
171 |
+
return $this->invalid_id_warning( $id );
|
172 |
+
}
|
173 |
+
|
174 |
+
$snippet = get_snippet( $id, (bool) $atts['network'] );
|
175 |
+
|
176 |
+
// Render the source code if this is not a shortcode snippet.
|
177 |
+
if ( 'content' !== $snippet->scope ) {
|
178 |
+
return $snippet->id ? $this->render_snippet_source( $snippet ) : '';
|
179 |
+
}
|
180 |
+
|
181 |
+
// If the snippet is inactive, either display a message or render nothing.
|
182 |
+
if ( ! $snippet->active ) {
|
183 |
+
if ( ! $atts['debug'] ) {
|
184 |
+
return '';
|
185 |
+
}
|
186 |
+
|
187 |
+
/* translators: 1: snippet name, 2: snippet edit link */
|
188 |
+
$text = __( '<strong>%1$s</strong> is currently inactive. You can <a href="%2$s">edit this snippet</a> to activate it and make it visible. This message will not appear in the published post.', 'code-snippets' );
|
189 |
+
|
190 |
+
$edit_url = add_query_arg( 'id', $snippet->id, code_snippets()->get_menu_url( 'edit' ) );
|
191 |
+
return wp_kses(
|
192 |
+
sprintf( $text, $snippet->name, $edit_url ),
|
193 |
+
[
|
194 |
+
'strong' => [],
|
195 |
+
'a' => [
|
196 |
+
'href' => [],
|
197 |
+
],
|
198 |
+
]
|
199 |
+
);
|
200 |
+
}
|
201 |
+
|
202 |
+
$content = $snippet->code;
|
203 |
+
|
204 |
+
if ( $atts['php'] ) {
|
205 |
+
ob_start();
|
206 |
+
eval( "?>\n\n" . $snippet->code . "\n\n<?php" );
|
207 |
+
$content = ob_get_clean();
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( $atts['format'] ) {
|
211 |
+
$functions = [ 'wptexturize', 'convert_smilies', 'convert_chars', 'wpautop', 'capital_P_dangit' ];
|
212 |
+
foreach ( $functions as $function ) {
|
213 |
+
$content = call_user_func( $function, $content );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( $atts['shortcodes'] ) {
|
218 |
+
// Remove this shortcode from the list to prevent recursion.
|
219 |
+
remove_shortcode( self::CONTENT_SHORTCODE );
|
220 |
+
|
221 |
+
// Evaluate shortcodes.
|
222 |
+
$content = do_shortcode( $atts['format'] ? shortcode_unautop( $content ) : $content );
|
223 |
+
|
224 |
+
// Add this shortcode back to the list.
|
225 |
+
add_shortcode( self::CONTENT_SHORTCODE, [ $this, 'render_content_shortcode' ] );
|
226 |
+
}
|
227 |
+
|
228 |
+
return $content;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Converts a value and key into an HTML attribute pair.
|
233 |
+
*
|
234 |
+
* @param string $value Attribute value.
|
235 |
+
* @param string $key Attribute name.
|
236 |
+
*
|
237 |
+
* @return void
|
238 |
+
*/
|
239 |
+
private static function create_attribute_pair( &$value, $key ) {
|
240 |
+
$value = sprintf( '%s="%s"', sanitize_key( $key ), esc_attr( $value ) );
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Render the source code of a given snippet
|
245 |
+
*
|
246 |
+
* @param Snippet $snippet Snippet object.
|
247 |
+
* @param array $atts Shortcode attributes.
|
248 |
+
*
|
249 |
+
* @return string Shortcode content.
|
250 |
+
*/
|
251 |
+
private function render_snippet_source( Snippet $snippet, $atts = [] ) {
|
252 |
+
$atts = array_merge(
|
253 |
+
array(
|
254 |
+
'line_numbers' => false,
|
255 |
+
'highlight_lines' => '',
|
256 |
+
),
|
257 |
+
$atts
|
258 |
+
);
|
259 |
+
|
260 |
+
$language = 'css' === $snippet->type ? 'css' : ( 'js' === $snippet->type ? 'js' : 'php' );
|
261 |
+
|
262 |
+
$pre_attributes = array(
|
263 |
+
'id' => "code-snippet-source-$snippet->id",
|
264 |
+
'class' => 'code-snippet-source',
|
265 |
+
);
|
266 |
+
|
267 |
+
$code_attributes = array(
|
268 |
+
'class' => "language-$language",
|
269 |
+
);
|
270 |
+
|
271 |
+
if ( $atts['line_numbers'] ) {
|
272 |
+
$code_attributes['class'] .= ' line-numbers';
|
273 |
+
$pre_attributes['class'] .= ' linkable-line-numbers';
|
274 |
+
}
|
275 |
+
|
276 |
+
if ( $atts['highlight_lines'] ) {
|
277 |
+
$pre_attributes['data-line'] = $atts['highlight_lines'];
|
278 |
+
}
|
279 |
+
|
280 |
+
$pre_attributes = apply_filters( 'code_snippets/prism_pre_attributes', $pre_attributes, $snippet, $atts );
|
281 |
+
$code_attributes = apply_filters( 'code_snippets/prism_code_attributes', $code_attributes, $snippet, $atts );
|
282 |
+
|
283 |
+
array_walk( $code_attributes, array( $this, 'create_attribute_pair' ) );
|
284 |
+
array_walk( $pre_attributes, array( $this, 'create_attribute_pair' ) );
|
285 |
+
|
286 |
+
$code = 'php' === $snippet->type ? "<?php\n\n$snippet->code" : $snippet->code;
|
287 |
+
|
288 |
+
return sprintf(
|
289 |
+
'<pre %s><code %s>%s</code></pre>',
|
290 |
+
implode( ' ', $pre_attributes ),
|
291 |
+
implode( ' ', $code_attributes ),
|
292 |
+
esc_html( $code )
|
293 |
+
);
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Render the value of a source shortcode
|
298 |
+
*
|
299 |
+
* @param array $atts Shortcode attributes.
|
300 |
+
*
|
301 |
+
* @return string Shortcode content.
|
302 |
+
*/
|
303 |
+
public function render_source_shortcode( $atts ) {
|
304 |
+
|
305 |
+
$atts = shortcode_atts(
|
306 |
+
array(
|
307 |
+
'id' => 0,
|
308 |
+
'snippet_id' => 0,
|
309 |
+
'network' => false,
|
310 |
+
'line_numbers' => false,
|
311 |
+
'highlight_lines' => '',
|
312 |
+
),
|
313 |
+
$atts,
|
314 |
+
self::SOURCE_SHORTCODE
|
315 |
+
);
|
316 |
+
|
317 |
+
$id = intval( $atts['snippet_id'] ) ?: intval( $atts['id'] );
|
318 |
+
if ( ! $id ) {
|
319 |
+
return $this->invalid_id_warning( $id );
|
320 |
+
}
|
321 |
+
|
322 |
+
$snippet = get_snippet( $id, (bool) $atts['network'] );
|
323 |
+
|
324 |
+
return $this->render_snippet_source( $snippet, $atts );
|
325 |
+
}
|
326 |
+
}
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* For some reason, WordPress requires that TinyMCE translations be hosted in an external file. So that's what this is.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Code_Snippets;
|
9 |
+
|
10 |
+
use _WP_Editors;
|
11 |
+
|
12 |
+
$strings = [
|
13 |
+
'insert_content_menu' => __( 'Content Snippet', 'code-snippets' ),
|
14 |
+
'insert_content_title' => __( 'Insert Content Snippet', 'code-snippets' ),
|
15 |
+
'snippet_label' => __( 'Snippet', 'code-snippets' ),
|
16 |
+
'php_att_label' => __( 'Run PHP code', 'code-snippets' ),
|
17 |
+
'format_att_label' => __( 'Apply formatting', 'code-snippets' ),
|
18 |
+
'shortcodes_att_label' => __( 'Enable shortcodes', 'code-snippets' ),
|
19 |
+
|
20 |
+
'insert_source_menu' => __( 'Snippet Source Code', 'code-snippets' ),
|
21 |
+
'insert_source_title' => __( 'Insert Snippet Source', 'code-snippets' ),
|
22 |
+
'show_line_numbers_label' => __( 'Show line numbers', 'code-snippets' ),
|
23 |
+
];
|
24 |
+
|
25 |
+
$strings = array_map( 'esc_js', $strings );
|
26 |
+
|
27 |
+
$snippets = get_snippets();
|
28 |
+
|
29 |
+
$strings['all_snippets'] = [];
|
30 |
+
$strings['content_snippets'] = [];
|
31 |
+
|
32 |
+
/** Snippet @var Snippet $snippet */
|
33 |
+
foreach ( $snippets as $snippet ) {
|
34 |
+
|
35 |
+
if ( 'content' === $snippet->scope ) {
|
36 |
+
$strings['content_snippets'][ $snippet->id ] = $snippet->display_name;
|
37 |
+
}
|
38 |
+
|
39 |
+
$strings['all_snippets'][ $snippet->id ] = sprintf(
|
40 |
+
'%s (%s)',
|
41 |
+
$snippet->display_name,
|
42 |
+
strtoupper( $snippet->type )
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
asort( $strings['all_snippets'], SORT_STRING | SORT_FLAG_CASE );
|
47 |
+
asort( $strings['content_snippets'], SORT_STRING | SORT_FLAG_CASE );
|
48 |
+
|
49 |
+
$strings = [ _WP_Editors::$mce_locale => [ 'code_snippets' => $strings ] ];
|
50 |
+
/** $strings is used by outer file. @noinspection PhpUnusedLocalVariableInspection */
|
51 |
+
$strings = 'tinyMCE.addI18n(' . wp_json_encode( $strings ) . ');';
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Initialise and load the plugin under the proper namespace
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Code_Snippets;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* The version number for this release of the plugin.
|
12 |
+
* This will later be used for upgrades and enqueuing files.
|
13 |
+
*
|
14 |
+
* This should be set to the 'Plugin Version' value defined
|
15 |
+
* in the plugin header.
|
16 |
+
*
|
17 |
+
* @var string A PHP-standardized version number string.
|
18 |
+
*/
|
19 |
+
const PLUGIN_VERSION = '3.2.1';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The full path to the main file of this plugin.
|
23 |
+
*
|
24 |
+
* This can later be used with functions such as
|
25 |
+
* plugin_dir_path(), plugins_url() and plugin_basename()
|
26 |
+
* to retrieve information about plugin paths.
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
const PLUGIN_FILE = CODE_SNIPPETS_FILE;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Name of the group used for caching data.
|
34 |
+
*
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
const CACHE_GROUP = 'code_snippets';
|
38 |
+
|
39 |
+
/* Load dependencies with Composer */
|
40 |
+
require_once dirname( __DIR__ ) . '/vendor/autoload.php';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retrieve the instance of the main plugin class.
|
44 |
+
*
|
45 |
+
* @since 2.6.0
|
46 |
+
* @return Plugin
|
47 |
+
*/
|
48 |
+
function code_snippets() {
|
49 |
+
static $plugin;
|
50 |
+
|
51 |
+
if ( is_null( $plugin ) ) {
|
52 |
+
$plugin = new Plugin( PLUGIN_VERSION, PLUGIN_FILE );
|
53 |
+
}
|
54 |
+
|
55 |
+
return $plugin;
|
56 |
+
}
|
57 |
+
|
58 |
+
code_snippets()->load_plugin();
|
59 |
+
|
60 |
+
/* Execute the snippets once the plugins are loaded */
|
61 |
+
add_action( 'plugins_loaded', __NAMESPACE__ . '\execute_active_snippets', 1 );
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file handles rendering the settings fields
|
4 |
+
*
|
5 |
+
* @since 2.0.0
|
6 |
+
* @package Code_Snippets
|
7 |
+
* @subpackage Settings
|
8 |
+
*/
|
9 |
+
|
10 |
+
namespace Code_Snippets\Settings;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Represents a single setting field
|
14 |
+
*
|
15 |
+
* @property-read string $desc Field description.
|
16 |
+
* @property-read string $label Field label.
|
17 |
+
* @property-read string $type Field type.
|
18 |
+
* @property-read string $name Setting name.
|
19 |
+
*
|
20 |
+
* @property-read int $min Minimum value (for numerical inputs).
|
21 |
+
* @property-read int $max Maximum value(for numerical inputs).
|
22 |
+
* @property-read array $options List of options for a select or checkboxes field.
|
23 |
+
* @property-read callable $render_callback Custom function to use when rendering a callback field.
|
24 |
+
* @property-read callable $sanitize_callback Custom function to use when sanitize the setting value.
|
25 |
+
* @property-read mixed $default Default setting value.
|
26 |
+
*
|
27 |
+
* @property-read string $input_name
|
28 |
+
*/
|
29 |
+
class Setting_Field {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Input field identifier.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
private $field_id;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Settings section identifier.
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $section;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* List of possible arguments.
|
47 |
+
*
|
48 |
+
* @var array
|
49 |
+
*/
|
50 |
+
private $args = array(
|
51 |
+
'desc' => '',
|
52 |
+
'label' => '',
|
53 |
+
'min' => null,
|
54 |
+
'max' => null,
|
55 |
+
'options' => [],
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Class constructor.
|
60 |
+
*
|
61 |
+
* @param string $section_id Settings section identifier.
|
62 |
+
* @param string $field_id Setting field identifier.
|
63 |
+
* @param array $args The setting field attributes.
|
64 |
+
*/
|
65 |
+
public function __construct( $section_id, $field_id, array $args ) {
|
66 |
+
$this->field_id = $field_id;
|
67 |
+
$this->section = $section_id;
|
68 |
+
$this->args = array_merge( $this->args, $args );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Retrieve a single setting attribute.
|
73 |
+
*
|
74 |
+
* @param string $argument Attribute name.
|
75 |
+
*
|
76 |
+
* @return mixed Attribute value.
|
77 |
+
*/
|
78 |
+
public function __get( $argument ) {
|
79 |
+
|
80 |
+
if ( 'input_name' === $argument ) {
|
81 |
+
return sprintf( 'code_snippets_settings[%s][%s]', $this->section, $this->field_id );
|
82 |
+
}
|
83 |
+
|
84 |
+
return $this->args[ $argument ];
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Retrieve the saved value for this setting.
|
89 |
+
*
|
90 |
+
* @return mixed
|
91 |
+
*/
|
92 |
+
private function get_saved_value() {
|
93 |
+
return get_setting( $this->section, $this->field_id );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Render the setting field
|
98 |
+
*/
|
99 |
+
public function render() {
|
100 |
+
$method_name = 'render_' . $this->type . '_field';
|
101 |
+
|
102 |
+
if ( method_exists( $this, $method_name ) ) {
|
103 |
+
call_user_func( array( $this, $method_name ) );
|
104 |
+
} else {
|
105 |
+
// Error message, not necessary to translate.
|
106 |
+
printf( 'Cannot render a %s field.', esc_html( $this->type ) );
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( $this->desc ) {
|
111 |
+
echo '<p class="description">', wp_kses_post( $this->desc ), '</p>';
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Render a callback field.
|
117 |
+
*/
|
118 |
+
public function render_callback_field() {
|
119 |
+
call_user_func( $this->render_callback );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Render a single checkbox field.
|
124 |
+
*
|
125 |
+
* @param string $input_name Input name.
|
126 |
+
* @param string $label Input label.
|
127 |
+
* @param boolean $checked Whether the checkbox should be checked.
|
128 |
+
*/
|
129 |
+
private static function render_checkbox( $input_name, $label, $checked ) {
|
130 |
+
|
131 |
+
$checkbox = sprintf(
|
132 |
+
'<input type="checkbox" name="%s"%s>',
|
133 |
+
esc_attr( $input_name ),
|
134 |
+
checked( $checked, true, false )
|
135 |
+
);
|
136 |
+
|
137 |
+
$kses = [
|
138 |
+
'input' => [
|
139 |
+
'type' => [],
|
140 |
+
'name' => [],
|
141 |
+
'checked' => [],
|
142 |
+
],
|
143 |
+
];
|
144 |
+
|
145 |
+
if ( $label ) {
|
146 |
+
printf(
|
147 |
+
'<label>%s %s</label>',
|
148 |
+
wp_kses( $checkbox, $kses ),
|
149 |
+
wp_kses_post( $label )
|
150 |
+
);
|
151 |
+
} else {
|
152 |
+
echo wp_kses( $checkbox, $kses );
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Render a checkbox field for a setting
|
158 |
+
*
|
159 |
+
* @since 2.0.0
|
160 |
+
*/
|
161 |
+
public function render_checkbox_field() {
|
162 |
+
$this->render_checkbox( $this->input_name, $this->label, $this->get_saved_value() );
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Render a checkbox field for a setting
|
167 |
+
*
|
168 |
+
* @since 2.0.0
|
169 |
+
*/
|
170 |
+
public function render_checkboxes_field() {
|
171 |
+
$saved_value = $this->get_saved_value();
|
172 |
+
$saved_value = is_array( $saved_value ) ? $saved_value : [];
|
173 |
+
|
174 |
+
echo '<fieldset>';
|
175 |
+
printf( '<legend class="screen-reader-text"><span>%s</span></legend>', esc_html( $this->name ) );
|
176 |
+
|
177 |
+
foreach ( $this->options as $option => $label ) {
|
178 |
+
$this->render_checkbox( $this->input_name . "[$option]", $label, in_array( $option, $saved_value, true ) );
|
179 |
+
echo '<br>';
|
180 |
+
}
|
181 |
+
|
182 |
+
echo '</fieldset>';
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Render a basic text field for an editor setting.
|
187 |
+
*/
|
188 |
+
private function render_text_field() {
|
189 |
+
|
190 |
+
printf(
|
191 |
+
'<input type="text" name="%s" value="%s" class="regular-text">',
|
192 |
+
esc_attr( $this->input_name ),
|
193 |
+
esc_attr( $this->get_saved_value() )
|
194 |
+
);
|
195 |
+
|
196 |
+
if ( $this->label ) {
|
197 |
+
echo ' ' . wp_kses_post( $this->label );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Render a number select field for an editor setting
|
203 |
+
*
|
204 |
+
* @since 2.0.0
|
205 |
+
*/
|
206 |
+
private function render_number_field() {
|
207 |
+
|
208 |
+
printf(
|
209 |
+
'<input type="number" name="%s" value="%s"',
|
210 |
+
esc_attr( $this->input_name ),
|
211 |
+
esc_attr( $this->get_saved_value() )
|
212 |
+
);
|
213 |
+
|
214 |
+
if ( is_numeric( $this->min ) ) {
|
215 |
+
printf( ' min="%d"', intval( $this->min ) );
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( is_numeric( $this->max ) ) {
|
219 |
+
printf( ' max="%d"', intval( $this->max ) );
|
220 |
+
}
|
221 |
+
|
222 |
+
echo '>';
|
223 |
+
|
224 |
+
if ( $this->label ) {
|
225 |
+
echo ' ' . wp_kses_post( $this->label );
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Render a number select field for an editor setting
|
231 |
+
*
|
232 |
+
* @since 3.0.0
|
233 |
+
*/
|
234 |
+
private function render_select_field() {
|
235 |
+
$saved_value = $this->get_saved_value();
|
236 |
+
printf( '<select name="%s">', esc_attr( $this->input_name ) );
|
237 |
+
|
238 |
+
foreach ( $this->options as $option => $option_label ) {
|
239 |
+
printf(
|
240 |
+
'<option value="%s"%s>%s</option>',
|
241 |
+
esc_attr( $option ),
|
242 |
+
selected( $option, $saved_value, false ),
|
243 |
+
esc_html( $option_label )
|
244 |
+
);
|
245 |
+
}
|
246 |
+
|
247 |
+
echo '</select>';
|
248 |
+
}
|
249 |
+
}
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file handles the editor preview setting
|
4 |
+
*
|
5 |
+
* @since 2.0.0
|
6 |
+
* @package Code_Snippets
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets\Settings;
|
10 |
+
|
11 |
+
use function Code_Snippets\code_snippets;
|
12 |
+
use function Code_Snippets\enqueue_code_editor;
|
13 |
+
use function Code_Snippets\get_editor_themes;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Load the CSS and JavaScript for the editor preview field
|
17 |
+
*/
|
18 |
+
function enqueue_editor_preview_assets() {
|
19 |
+
$plugin = code_snippets();
|
20 |
+
|
21 |
+
enqueue_code_editor( 'php' );
|
22 |
+
|
23 |
+
// Enqueue all editor themes.
|
24 |
+
$themes = get_editor_themes();
|
25 |
+
|
26 |
+
foreach ( $themes as $theme ) {
|
27 |
+
wp_enqueue_style(
|
28 |
+
'code-snippets-editor-theme-' . $theme,
|
29 |
+
plugins_url( "dist/editor-themes/$theme.css", $plugin->file ),
|
30 |
+
[ 'code-editor' ],
|
31 |
+
$plugin->version
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
// Enqueue the menu scripts.
|
36 |
+
wp_enqueue_script(
|
37 |
+
'code-snippets-settings-menu',
|
38 |
+
plugins_url( 'dist/settings.js', $plugin->file ),
|
39 |
+
[ 'code-snippets-code-editor' ],
|
40 |
+
$plugin->version,
|
41 |
+
true
|
42 |
+
);
|
43 |
+
|
44 |
+
// Extract the CodeMirror-specific editor settings.
|
45 |
+
$setting_fields = get_settings_fields();
|
46 |
+
$editor_fields = array();
|
47 |
+
|
48 |
+
foreach ( $setting_fields['editor'] as $name => $field ) {
|
49 |
+
if ( empty( $field['codemirror'] ) ) {
|
50 |
+
continue;
|
51 |
+
}
|
52 |
+
|
53 |
+
$editor_fields[] = array(
|
54 |
+
'name' => $name,
|
55 |
+
'type' => $field['type'],
|
56 |
+
'codemirror' => addslashes( $field['codemirror'] ),
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
// Pass the saved options to the external JavaScript file.
|
61 |
+
$inline_script = 'var code_snippets_editor_settings = ' . wp_json_encode( $editor_fields ) . ';';
|
62 |
+
|
63 |
+
wp_add_inline_script( 'code-snippets-settings-menu', $inline_script, 'before' );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Retrieve the list of code editor themes.
|
68 |
+
*
|
69 |
+
* @return array List of editor themes.
|
70 |
+
*/
|
71 |
+
function get_editor_theme_list() {
|
72 |
+
$themes = [
|
73 |
+
'default' => __( 'Default', 'code-snippets' ),
|
74 |
+
];
|
75 |
+
|
76 |
+
foreach ( get_editor_themes() as $theme ) {
|
77 |
+
|
78 |
+
// Skip mobile themes.
|
79 |
+
if ( '-mobile' === substr( $theme, -7 ) ) {
|
80 |
+
continue;
|
81 |
+
}
|
82 |
+
|
83 |
+
$themes[ $theme ] = ucwords( str_replace( '-', ' ', $theme ) );
|
84 |
+
}
|
85 |
+
|
86 |
+
return $themes;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Render the editor preview setting
|
91 |
+
*/
|
92 |
+
function render_editor_preview() {
|
93 |
+
$settings = get_settings_values();
|
94 |
+
$settings = $settings['editor'];
|
95 |
+
|
96 |
+
$indent_unit = absint( $settings['indent_unit'] );
|
97 |
+
$tab_size = absint( $settings['tab_size'] );
|
98 |
+
|
99 |
+
$n_tabs = $settings['indent_with_tabs'] ? floor( $indent_unit / $tab_size ) : 0;
|
100 |
+
$n_spaces = $settings['indent_with_tabs'] ? $indent_unit % $tab_size : $indent_unit;
|
101 |
+
|
102 |
+
$indent = str_repeat( "\t", $n_tabs ) . str_repeat( ' ', $n_spaces );
|
103 |
+
|
104 |
+
$code = "add_filter( 'admin_footer_text', function ( \$text ) {\n\n" .
|
105 |
+
$indent . "\$site_name = get_bloginfo( 'name' );\n\n" .
|
106 |
+
$indent . '$text = "Thank you for visiting $site_name.";' . "\n" .
|
107 |
+
$indent . 'return $text;' . "\n" .
|
108 |
+
"} );\n";
|
109 |
+
|
110 |
+
echo '<textarea id="code_snippets_editor_preview">', esc_textarea( $code ), '</textarea>';
|
111 |
+
}
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Manages the settings fields definitions
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Settings
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets\Settings;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Retrieve the default setting values
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
function get_default_settings() {
|
17 |
+
static $defaults;
|
18 |
+
|
19 |
+
if ( isset( $defaults ) ) {
|
20 |
+
return $defaults;
|
21 |
+
}
|
22 |
+
|
23 |
+
$defaults = array();
|
24 |
+
|
25 |
+
foreach ( get_settings_fields() as $section_id => $fields ) {
|
26 |
+
$defaults[ $section_id ] = array();
|
27 |
+
|
28 |
+
foreach ( $fields as $field_id => $field_atts ) {
|
29 |
+
$defaults[ $section_id ][ $field_id ] = $field_atts['default'];
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
return $defaults;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Retrieve the settings fields
|
38 |
+
*
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
function get_settings_fields() {
|
42 |
+
static $fields;
|
43 |
+
|
44 |
+
if ( isset( $fields ) ) {
|
45 |
+
return $fields;
|
46 |
+
}
|
47 |
+
|
48 |
+
$fields = [];
|
49 |
+
|
50 |
+
$fields['general'] = [
|
51 |
+
'activate_by_default' => [
|
52 |
+
'name' => __( 'Activate by Default', 'code-snippets' ),
|
53 |
+
'type' => 'checkbox',
|
54 |
+
'label' => __( "Make the 'Save and Activate' button the default action when saving a snippet.", 'code-snippets' ),
|
55 |
+
'default' => true,
|
56 |
+
],
|
57 |
+
|
58 |
+
'enable_tags' => [
|
59 |
+
'name' => __( 'Enable Snippet Tags', 'code-snippets' ),
|
60 |
+
'type' => 'checkbox',
|
61 |
+
'label' => __( 'Show snippet tags on admin pages.', 'code-snippets' ),
|
62 |
+
'default' => true,
|
63 |
+
],
|
64 |
+
|
65 |
+
'enable_description' => [
|
66 |
+
'name' => __( 'Enable Snippet Descriptions', 'code-snippets' ),
|
67 |
+
'type' => 'checkbox',
|
68 |
+
'label' => __( 'Show snippet descriptions on admin pages.', 'code-snippets' ),
|
69 |
+
'default' => true,
|
70 |
+
],
|
71 |
+
|
72 |
+
'list_order' => [
|
73 |
+
'name' => __( 'Snippets List Order', 'code-snippets' ),
|
74 |
+
'type' => 'select',
|
75 |
+
'desc' => __( 'Default way to order snippets on the All Snippets admin menu.', 'code-snippets' ),
|
76 |
+
'options' => [
|
77 |
+
'priority-asc' => __( 'Priority', 'code-snippets' ),
|
78 |
+
'name-asc' => __( 'Name (A-Z)', 'code-snippets' ),
|
79 |
+
'name-desc' => __( 'Name (Z-A)', 'code-snippets' ),
|
80 |
+
'modified-desc' => __( 'Modified (latest first)', 'code-snippets' ),
|
81 |
+
'modified-asc' => __( 'Modified (oldest first)', 'code-snippets' ),
|
82 |
+
],
|
83 |
+
'default' => 'priority-asc',
|
84 |
+
],
|
85 |
+
|
86 |
+
'disable_prism' => [
|
87 |
+
'name' => __( 'Disable Shortcode Syntax Highlighter', 'code-snippets' ),
|
88 |
+
'type' => 'checkbox',
|
89 |
+
'label' => __( 'Disable syntax highlighting when displaying snippet code on the front-end.', 'code-snippets' ),
|
90 |
+
'default' => false,
|
91 |
+
],
|
92 |
+
|
93 |
+
'complete_uninstall' => [
|
94 |
+
'name' => __( 'Complete Uninstall', 'code-snippets' ),
|
95 |
+
'type' => 'checkbox',
|
96 |
+
'label' => __( 'When the plugin is deleted from the Plugins menu, also delete all snippets and plugin settings.', 'code-snippets' ),
|
97 |
+
'default' => false,
|
98 |
+
],
|
99 |
+
];
|
100 |
+
|
101 |
+
if ( is_multisite() && ! is_main_site() ) {
|
102 |
+
unset( $fields['general']['complete_uninstall'] );
|
103 |
+
}
|
104 |
+
|
105 |
+
/* Description Editor settings section */
|
106 |
+
$fields['description_editor'] = [
|
107 |
+
|
108 |
+
'rows' => [
|
109 |
+
'name' => __( 'Row Height', 'code-snippets' ),
|
110 |
+
'type' => 'number',
|
111 |
+
'label' => __( 'rows', 'code-snippets' ),
|
112 |
+
'default' => 5,
|
113 |
+
'min' => 0,
|
114 |
+
],
|
115 |
+
|
116 |
+
'use_full_mce' => [
|
117 |
+
'name' => __( 'Use Full Editor', 'code-snippets' ),
|
118 |
+
'type' => 'checkbox',
|
119 |
+
'label' => __( 'Enable all features of the visual editor.', 'code-snippets' ),
|
120 |
+
'default' => false,
|
121 |
+
],
|
122 |
+
|
123 |
+
'media_buttons' => [
|
124 |
+
'name' => __( 'Media Buttons', 'code-snippets' ),
|
125 |
+
'type' => 'checkbox',
|
126 |
+
'label' => __( 'Enable the add media buttons.', 'code-snippets' ),
|
127 |
+
'default' => false,
|
128 |
+
],
|
129 |
+
];
|
130 |
+
|
131 |
+
/* Code Editor settings section */
|
132 |
+
|
133 |
+
$fields['editor'] = [
|
134 |
+
'theme' => [
|
135 |
+
'name' => __( 'Theme', 'code-snippets' ),
|
136 |
+
'type' => 'select',
|
137 |
+
'default' => 'default',
|
138 |
+
'options' => get_editor_theme_list(),
|
139 |
+
'codemirror' => 'theme',
|
140 |
+
],
|
141 |
+
|
142 |
+
'indent_with_tabs' => [
|
143 |
+
'name' => __( 'Indent With Tabs', 'code-snippets' ),
|
144 |
+
'type' => 'checkbox',
|
145 |
+
'label' => __( 'Use hard tabs (not spaces) for indentation.', 'code-snippets' ),
|
146 |
+
'default' => true,
|
147 |
+
'codemirror' => 'indentWithTabs',
|
148 |
+
],
|
149 |
+
|
150 |
+
'tab_size' => [
|
151 |
+
'name' => __( 'Tab Size', 'code-snippets' ),
|
152 |
+
'type' => 'number',
|
153 |
+
'desc' => __( 'The width of a tab character.', 'code-snippets' ),
|
154 |
+
'default' => 4,
|
155 |
+
'codemirror' => 'tabSize',
|
156 |
+
'min' => 0,
|
157 |
+
],
|
158 |
+
|
159 |
+
'indent_unit' => [
|
160 |
+
'name' => __( 'Indent Unit', 'code-snippets' ),
|
161 |
+
'type' => 'number',
|
162 |
+
'desc' => __( 'How many spaces a block should be indented.', 'code-snippets' ),
|
163 |
+
'default' => 4,
|
164 |
+
'codemirror' => 'indentUnit',
|
165 |
+
'min' => 0,
|
166 |
+
],
|
167 |
+
|
168 |
+
'wrap_lines' => [
|
169 |
+
'name' => __( 'Wrap Lines', 'code-snippets' ),
|
170 |
+
'type' => 'checkbox',
|
171 |
+
'label' => __( 'Whether the editor should scroll or wrap for long lines.', 'code-snippets' ),
|
172 |
+
'default' => true,
|
173 |
+
'codemirror' => 'lineWrapping',
|
174 |
+
],
|
175 |
+
|
176 |
+
'code_folding' => [
|
177 |
+
'name' => __( 'Code Folding', 'code-snippets' ),
|
178 |
+
'type' => 'checkbox',
|
179 |
+
'label' => __( 'Allow folding functions or other blocks into a single line.', 'code-snippets' ),
|
180 |
+
'default' => true,
|
181 |
+
'codemirror' => 'foldGutter',
|
182 |
+
],
|
183 |
+
|
184 |
+
'line_numbers' => [
|
185 |
+
'name' => __( 'Line Numbers', 'code-snippets' ),
|
186 |
+
'type' => 'checkbox',
|
187 |
+
'label' => __( 'Show line numbers to the left of the editor.', 'code-snippets' ),
|
188 |
+
'default' => true,
|
189 |
+
'codemirror' => 'lineNumbers',
|
190 |
+
],
|
191 |
+
|
192 |
+
'auto_close_brackets' => [
|
193 |
+
'name' => __( 'Auto Close Brackets', 'code-snippets' ),
|
194 |
+
'type' => 'checkbox',
|
195 |
+
'label' => __( 'Auto-close brackets and quotes when typed.', 'code-snippets' ),
|
196 |
+
'default' => true,
|
197 |
+
'codemirror' => 'autoCloseBrackets',
|
198 |
+
],
|
199 |
+
|
200 |
+
'highlight_selection_matches' => [
|
201 |
+
'name' => __( 'Highlight Selection Matches', 'code-snippets' ),
|
202 |
+
'label' => __( 'Highlight all instances of a currently selected word.', 'code-snippets' ),
|
203 |
+
'type' => 'checkbox',
|
204 |
+
'default' => true,
|
205 |
+
'codemirror' => 'highlightSelectionMatches',
|
206 |
+
],
|
207 |
+
|
208 |
+
'highlight_active_line' => [
|
209 |
+
'name' => __( 'Highlight Active Line', 'code-snippets' ),
|
210 |
+
'label' => __( 'Highlight the line that is currently being edited.', 'code-snippets' ),
|
211 |
+
'type' => 'checkbox',
|
212 |
+
'default' => true,
|
213 |
+
'codemirror' => 'styleActiveLine',
|
214 |
+
],
|
215 |
+
'keymap' => [
|
216 |
+
'name' => __( 'Keymap', 'code-snippets' ),
|
217 |
+
'type' => 'select',
|
218 |
+
'desc' => __( 'The keymap to use in the editor.', 'code-snippets' ),
|
219 |
+
'default' => 'default',
|
220 |
+
'options' => [
|
221 |
+
'default' => __( 'Default', 'code-snippets' ),
|
222 |
+
'vim' => __( 'Vim', 'code-snippets' ),
|
223 |
+
'emacs' => __( 'Emacs', 'code-snippets' ),
|
224 |
+
'sublime' => __( 'Sublime Text', 'code-snippets' ),
|
225 |
+
],
|
226 |
+
'codemirror' => 'keyMap',
|
227 |
+
],
|
228 |
+
|
229 |
+
];
|
230 |
+
|
231 |
+
$fields = apply_filters( 'code_snippets_settings_fields', $fields );
|
232 |
+
|
233 |
+
return $fields;
|
234 |
+
}
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file registers the settings
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Settings
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets\Settings;
|
10 |
+
|
11 |
+
const NS = __NAMESPACE__ . '\\';
|
12 |
+
|
13 |
+
const CACHE_KEY = 'code_snippets_settings';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Add a new option for either the current site or the current network
|
17 |
+
*
|
18 |
+
* @param bool $network Whether to add a network-wide option.
|
19 |
+
* @param string $option Name of option to add. Expected to not be SQL-escaped.
|
20 |
+
* @param mixed $value Option value, can be anything. Expected to not be SQL-escaped.
|
21 |
+
*
|
22 |
+
* @return bool False if the option was not added. True if the option was added.
|
23 |
+
*/
|
24 |
+
function add_self_option( $network, $option, $value ) {
|
25 |
+
return $network ? add_site_option( $option, $value ) : add_option( $option, $value );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Retrieves an option value based on an option name from either the current site or the current network
|
30 |
+
*
|
31 |
+
* @param bool $network Whether to get a network-wide option.
|
32 |
+
* @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
|
33 |
+
* @param mixed $default Optional value to return if option doesn't exist. Default false.
|
34 |
+
*
|
35 |
+
* @return mixed Value set for the option.
|
36 |
+
*/
|
37 |
+
function get_self_option( $network, $option, $default = false ) {
|
38 |
+
return $network ? get_site_option( $option, $default ) : get_option( $option, $default );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Update the value of an option that was already added on the current site or the current network
|
43 |
+
*
|
44 |
+
* @param bool $network Whether to update a network-wide option.
|
45 |
+
* @param string $option Name of option. Expected to not be SQL-escaped.
|
46 |
+
* @param mixed $value Option value. Expected to not be SQL-escaped.
|
47 |
+
*
|
48 |
+
* @return bool False if value was not updated. True if value was updated.
|
49 |
+
*/
|
50 |
+
function update_self_option( $network, $option, $value ) {
|
51 |
+
return $network ? update_site_option( $option, $value ) : update_option( $option, $value );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Returns 'true' if plugin settings are unified on a multisite installation
|
56 |
+
* under the Network Admin settings menu
|
57 |
+
*
|
58 |
+
* This option is controlled by the "Enable administration menus" setting on the Network Settings menu
|
59 |
+
*
|
60 |
+
* @return bool
|
61 |
+
*/
|
62 |
+
function are_settings_unified() {
|
63 |
+
if ( ! is_multisite() ) {
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
|
67 |
+
$menu_perms = get_site_option( 'menu_items', array() );
|
68 |
+
|
69 |
+
return empty( $menu_perms['snippets_settings'] );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Retrieve the setting values from the database.
|
74 |
+
* If a setting does not exist in the database, the default value will be returned.
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
function get_settings_values() {
|
79 |
+
|
80 |
+
// Check if the settings have been cached.
|
81 |
+
$settings = wp_cache_get( CACHE_KEY );
|
82 |
+
if ( $settings ) {
|
83 |
+
return $settings;
|
84 |
+
}
|
85 |
+
|
86 |
+
/* Begin with the default settings */
|
87 |
+
$settings = get_default_settings();
|
88 |
+
|
89 |
+
/* Retrieve saved settings from the database */
|
90 |
+
$saved = get_self_option( are_settings_unified(), 'code_snippets_settings', array() );
|
91 |
+
|
92 |
+
/* Replace the default field values with the ones saved in the database */
|
93 |
+
foreach ( $settings as $section => $fields ) {
|
94 |
+
if ( isset( $saved[ $section ] ) ) {
|
95 |
+
$settings[ $section ] = array_replace( $fields, $saved[ $section ] );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
wp_cache_set( CACHE_KEY, $settings );
|
100 |
+
|
101 |
+
return $settings;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Retrieve an individual setting field value
|
106 |
+
*
|
107 |
+
* @param string $section ID of the section the setting belongs to.
|
108 |
+
* @param string $field ID of the setting field.
|
109 |
+
*
|
110 |
+
* @return mixed
|
111 |
+
*/
|
112 |
+
function get_setting( $section, $field ) {
|
113 |
+
$settings = get_settings_values();
|
114 |
+
|
115 |
+
return $settings[ $section ][ $field ];
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Update a single setting to a new value.
|
120 |
+
*
|
121 |
+
* @param string $section ID of the section the setting belongs to.
|
122 |
+
* @param string $field ID of the setting field.
|
123 |
+
* @param mixed $new_value Setting value. Expected to not be SQL-escaped.
|
124 |
+
*
|
125 |
+
* @return bool False if value was not updated. True if value was updated.
|
126 |
+
*/
|
127 |
+
function update_setting( $section, $field, $new_value ) {
|
128 |
+
$settings = get_settings_values();
|
129 |
+
|
130 |
+
$settings[ $section ][ $field ] = $new_value;
|
131 |
+
|
132 |
+
wp_cache_set( CACHE_KEY, $settings );
|
133 |
+
return update_self_option( are_settings_unified(), 'code_snippets_settings', $settings );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Retrieve the settings sections
|
138 |
+
*
|
139 |
+
* @return array
|
140 |
+
*/
|
141 |
+
function get_settings_sections() {
|
142 |
+
$sections = array(
|
143 |
+
'general' => __( 'General', 'code-snippets' ),
|
144 |
+
'description_editor' => __( 'Description Editor', 'code-snippets' ),
|
145 |
+
'editor' => __( 'Code Editor', 'code-snippets' ),
|
146 |
+
);
|
147 |
+
|
148 |
+
return apply_filters( 'code_snippets_settings_sections', $sections );
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Register settings sections, fields, etc
|
153 |
+
*/
|
154 |
+
function register_plugin_settings() {
|
155 |
+
|
156 |
+
if ( are_settings_unified() ) {
|
157 |
+
|
158 |
+
if ( ! get_site_option( 'code_snippets_settings', false ) ) {
|
159 |
+
add_site_option( 'code_snippets_settings', get_default_settings() );
|
160 |
+
}
|
161 |
+
} else {
|
162 |
+
|
163 |
+
if ( ! get_option( 'code_snippets_settings', false ) ) {
|
164 |
+
add_option( 'code_snippets_settings', get_default_settings() );
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/* Register the setting */
|
169 |
+
register_setting(
|
170 |
+
'code-snippets',
|
171 |
+
'code_snippets_settings',
|
172 |
+
array( 'sanitize_callback' => NS . 'sanitize_settings' )
|
173 |
+
);
|
174 |
+
|
175 |
+
/* Register settings sections */
|
176 |
+
$sections = get_settings_sections();
|
177 |
+
|
178 |
+
if ( ! get_setting( 'general', 'enable_description' ) ) {
|
179 |
+
unset( $sections['description_editor'] );
|
180 |
+
}
|
181 |
+
|
182 |
+
foreach ( $sections as $section_id => $section_name ) {
|
183 |
+
add_settings_section( $section_id, $section_name, null, 'code-snippets' );
|
184 |
+
}
|
185 |
+
|
186 |
+
/* Register settings fields */
|
187 |
+
foreach ( get_settings_fields() as $section_id => $fields ) {
|
188 |
+
foreach ( $fields as $field_id => $field ) {
|
189 |
+
$field_object = new Setting_Field( $section_id, $field_id, $field );
|
190 |
+
add_settings_field( $field_id, $field['name'], [ $field_object, 'render' ], 'code-snippets', $section_id );
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/* Add editor preview as a field */
|
195 |
+
add_settings_field(
|
196 |
+
'editor_preview',
|
197 |
+
__( 'Editor Preview', 'code-snippets' ),
|
198 |
+
NS . 'render_editor_preview',
|
199 |
+
'code-snippets',
|
200 |
+
'editor'
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
+
add_action( 'admin_init', NS . 'register_plugin_settings' );
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Sanitize a single setting value.
|
208 |
+
*
|
209 |
+
* @param array $field Setting field information.
|
210 |
+
* @param mixed $input_value User input setting value, or null if missing.
|
211 |
+
*
|
212 |
+
* @return mixed Sanitized setting value, or null if unset.
|
213 |
+
*/
|
214 |
+
function sanitize_setting_value( $field, $input_value ) {
|
215 |
+
switch ( $field['type'] ) {
|
216 |
+
|
217 |
+
case 'checkbox':
|
218 |
+
return 'on' === $input_value;
|
219 |
+
|
220 |
+
case 'number':
|
221 |
+
return absint( $input_value );
|
222 |
+
|
223 |
+
case 'select':
|
224 |
+
// phpcs:ignore WordPress.PHP.StrictInArray.FoundNonStrictFalse
|
225 |
+
return in_array( $input_value, array_keys( $field['options'] ), false ) ? $input_value : null;
|
226 |
+
|
227 |
+
case 'checkboxes':
|
228 |
+
$results = [];
|
229 |
+
|
230 |
+
if ( ! empty( $input_value ) ) {
|
231 |
+
foreach ( $field['options'] as $option_id => $option_label ) {
|
232 |
+
if ( isset( $input_value[ $option_id ] ) && 'on' === $input_value[ $option_id ] ) {
|
233 |
+
$results[] = $option_id;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
return $results;
|
239 |
+
|
240 |
+
case 'text':
|
241 |
+
return trim( sanitize_text_field( $input_value ) );
|
242 |
+
|
243 |
+
case 'callback':
|
244 |
+
return array_key_exists( 'sanitize_callback', $field ) && is_callable( $field['sanitize_callback'] ) ?
|
245 |
+
call_user_func( $field['sanitize_callback'], $input_value ) :
|
246 |
+
null;
|
247 |
+
|
248 |
+
default:
|
249 |
+
return null;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Validate the settings
|
255 |
+
*
|
256 |
+
* @param array $input The received settings.
|
257 |
+
*
|
258 |
+
* @return array The validated settings.
|
259 |
+
*/
|
260 |
+
function sanitize_settings( array $input ) {
|
261 |
+
$settings = get_settings_values();
|
262 |
+
$updated = false;
|
263 |
+
|
264 |
+
// Don't directly loop through $input as it does not include as deselected checkboxes.
|
265 |
+
foreach ( get_settings_fields() as $section_id => $fields ) {
|
266 |
+
foreach ( $fields as $field_id => $field ) {
|
267 |
+
|
268 |
+
// Fetch the corresponding input value from the posted data.
|
269 |
+
$input_value = isset( $input[ $section_id ][ $field_id ] ) ? $input[ $section_id ][ $field_id ] : null;
|
270 |
+
|
271 |
+
// Attempt to sanitize the setting value.
|
272 |
+
$sanitized_value = sanitize_setting_value( $field, $input_value );
|
273 |
+
|
274 |
+
if ( ! is_null( $sanitized_value ) && $settings[ $section_id ][ $field_id ] !== $sanitized_value ) {
|
275 |
+
$settings[ $section_id ][ $field_id ] = $sanitized_value;
|
276 |
+
$updated = true;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
wp_cache_delete( CACHE_KEY );
|
282 |
+
|
283 |
+
// Add an updated message.
|
284 |
+
if ( $updated ) {
|
285 |
+
add_settings_error(
|
286 |
+
'code-snippets-settings-notices',
|
287 |
+
'settings-saved',
|
288 |
+
__( 'Settings saved.', 'code-snippets' ),
|
289 |
+
'updated'
|
290 |
+
);
|
291 |
+
}
|
292 |
+
|
293 |
+
return $settings;
|
294 |
+
}
|
@@ -0,0 +1,571 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions to perform snippet operations
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Code_Snippets;
|
9 |
+
|
10 |
+
use wpdb;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Clean the cache where active snippets are stored.
|
14 |
+
*
|
15 |
+
* @param string $table_name Snippets table name.
|
16 |
+
* @param array|false $scopes List of scopes. Optional. If not provided, will flush the cache for all scopes.
|
17 |
+
*
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
function clean_active_snippets_cache( $table_name, $scopes = false ) {
|
21 |
+
$scope_groups = $scopes ? [ $scopes ] : [
|
22 |
+
[ 'head-content', 'footer-content' ],
|
23 |
+
[ 'global', 'single-use', 'front-end' ],
|
24 |
+
[ 'global', 'single-use', 'admin' ],
|
25 |
+
];
|
26 |
+
|
27 |
+
foreach ( $scope_groups as $scopes ) {
|
28 |
+
wp_cache_delete( sprintf( 'active_snippets_%s_%s', sanitize_key( join( '_', $scopes ) ), $table_name ), CACHE_GROUP );
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Flush all snippets caches for a given database table.
|
34 |
+
*
|
35 |
+
* @param string $table_name Snippets table name.
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
function clean_snippets_cache( $table_name ) {
|
40 |
+
wp_cache_delete( "all_snippet_tags_$table_name", CACHE_GROUP );
|
41 |
+
wp_cache_delete( "all_snippets_$table_name", CACHE_GROUP );
|
42 |
+
clean_active_snippets_cache( $table_name );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Retrieve a list of snippets from the database.
|
47 |
+
* Read operation.
|
48 |
+
*
|
49 |
+
* @param array $ids The IDs of the snippets to fetch.
|
50 |
+
* @param bool|null|string $multisite Retrieve multisite-wide snippets (true) or site-wide snippets (false).
|
51 |
+
*
|
52 |
+
* @return array List of Snippet objects.
|
53 |
+
*
|
54 |
+
* @since 2.0
|
55 |
+
*/
|
56 |
+
function get_snippets( array $ids = array(), $multisite = null ) {
|
57 |
+
global $wpdb;
|
58 |
+
|
59 |
+
// If only one ID has been passed in, defer to the get_snippet() function.
|
60 |
+
$ids_count = count( $ids );
|
61 |
+
if ( 1 === $ids_count ) {
|
62 |
+
return array( get_snippet( $ids[0], $multisite ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
$db = code_snippets()->db;
|
66 |
+
$multisite = $db->validate_network_param( $multisite );
|
67 |
+
$table_name = $db->get_table_name( $multisite );
|
68 |
+
$snippets = wp_cache_get( "all_snippets_$table_name", CACHE_GROUP );
|
69 |
+
|
70 |
+
// Fetch all snippets from the database if none are cached.
|
71 |
+
if ( ! is_array( $snippets ) ) {
|
72 |
+
$results = $wpdb->get_results( "SELECT * FROM $table_name", ARRAY_A ); // db call ok.
|
73 |
+
|
74 |
+
$snippets = $results ?
|
75 |
+
array_map(
|
76 |
+
function ( $snippet_data ) use ( $multisite ) {
|
77 |
+
$snippet_data['network'] = $multisite;
|
78 |
+
return new Snippet( $snippet_data );
|
79 |
+
},
|
80 |
+
$results
|
81 |
+
) :
|
82 |
+
array();
|
83 |
+
|
84 |
+
$snippets = apply_filters( 'code_snippets/get_snippets', $snippets, $multisite );
|
85 |
+
|
86 |
+
if ( 0 === $ids_count ) {
|
87 |
+
wp_cache_set( "all_snippets_$table_name", $snippets, CACHE_GROUP );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
// If a list of IDs are provided, narrow down the snippets list.
|
92 |
+
if ( $ids_count > 0 ) {
|
93 |
+
$ids = array_map( 'intval', $ids );
|
94 |
+
return array_filter(
|
95 |
+
$snippets,
|
96 |
+
function ( Snippet $snippet ) use ( $ids ) {
|
97 |
+
return in_array( $snippet->id, $ids, true );
|
98 |
+
}
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
return $snippets;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Gets all used tags from the database.
|
107 |
+
* Read operation.
|
108 |
+
*
|
109 |
+
* @since 2.0
|
110 |
+
*/
|
111 |
+
function get_all_snippet_tags() {
|
112 |
+
global $wpdb;
|
113 |
+
$table_name = code_snippets()->db->get_table_name();
|
114 |
+
$cache_key = "all_snippet_tags_$table_name";
|
115 |
+
|
116 |
+
$tags = wp_cache_get( $cache_key, CACHE_GROUP );
|
117 |
+
if ( $tags ) {
|
118 |
+
return $tags;
|
119 |
+
}
|
120 |
+
|
121 |
+
// Grab all tags from the database.
|
122 |
+
$tags = array();
|
123 |
+
$all_tags = $wpdb->get_col( "SELECT tags FROM $table_name" ); // db call ok.
|
124 |
+
|
125 |
+
// Merge all tags into a single array.
|
126 |
+
foreach ( $all_tags as $snippet_tags ) {
|
127 |
+
$snippet_tags = code_snippets_build_tags_array( $snippet_tags );
|
128 |
+
$tags = array_merge( $snippet_tags, $tags );
|
129 |
+
}
|
130 |
+
|
131 |
+
// Remove duplicate tags.
|
132 |
+
$tags = array_values( array_unique( $tags, SORT_REGULAR ) );
|
133 |
+
wp_cache_set( $cache_key, $tags, CACHE_GROUP );
|
134 |
+
return $tags;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Make sure that the tags are a valid array.
|
139 |
+
*
|
140 |
+
* @param mixed $tags The tags to convert into an array.
|
141 |
+
*
|
142 |
+
* @return array The converted tags.
|
143 |
+
*
|
144 |
+
* @since 2.0.0
|
145 |
+
*/
|
146 |
+
function code_snippets_build_tags_array( $tags ) {
|
147 |
+
|
148 |
+
/* If there are no tags set, return an empty array. */
|
149 |
+
if ( empty( $tags ) ) {
|
150 |
+
return array();
|
151 |
+
}
|
152 |
+
|
153 |
+
/* If the tags are set as a string, convert them into an array. */
|
154 |
+
if ( is_string( $tags ) ) {
|
155 |
+
$tags = wp_strip_all_tags( $tags );
|
156 |
+
$tags = str_replace( ', ', ',', $tags );
|
157 |
+
$tags = explode( ',', $tags );
|
158 |
+
}
|
159 |
+
|
160 |
+
/* If we still don't have an array, just convert whatever we do have into one. */
|
161 |
+
return (array) $tags;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Retrieve a single snippets from the database.
|
166 |
+
* Will return empty snippet object if no snippet ID is specified.
|
167 |
+
* Read operation.
|
168 |
+
*
|
169 |
+
* @param int $id The ID of the snippet to retrieve. 0 to build a new snippet.
|
170 |
+
* @param boolean|null $multisite Retrieve a multisite-wide snippet (true) or site-wide snippet (false).
|
171 |
+
*
|
172 |
+
* @return Snippet A single snippet object.
|
173 |
+
* @since 2.0.0
|
174 |
+
*/
|
175 |
+
function get_snippet( $id = 0, $multisite = null ) {
|
176 |
+
global $wpdb;
|
177 |
+
|
178 |
+
$id = absint( $id );
|
179 |
+
$multisite = DB::validate_network_param( $multisite );
|
180 |
+
$table_name = code_snippets()->db->get_table_name( $multisite );
|
181 |
+
|
182 |
+
if ( 0 === $id ) {
|
183 |
+
// If an invalid ID is provided, then return an empty snippet object.
|
184 |
+
$snippet = new Snippet();
|
185 |
+
|
186 |
+
} else {
|
187 |
+
$cached_snippets = wp_cache_get( "all_snippets_$table_name", CACHE_GROUP );
|
188 |
+
|
189 |
+
// Attempt to fetch snippet from the cached list, if it exists.
|
190 |
+
if ( is_array( $cached_snippets ) ) {
|
191 |
+
foreach ( $cached_snippets as $snippet ) {
|
192 |
+
if ( $snippet->id === $id ) {
|
193 |
+
return apply_filters( 'code_snippets/get_snippet', $snippet, $id, $multisite );
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
// Otherwise, retrieve the snippet from the database.
|
199 |
+
$snippet_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d", $id ) ); // cache pass, db call ok.
|
200 |
+
$snippet = new Snippet( $snippet_data );
|
201 |
+
}
|
202 |
+
|
203 |
+
$snippet->network = $multisite;
|
204 |
+
return apply_filters( 'code_snippets/get_snippet', $snippet, $id, $multisite );
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Activates a snippet.
|
209 |
+
* Write operation.
|
210 |
+
*
|
211 |
+
* @param int $id ID of the snippet to activate.
|
212 |
+
* @param bool|null $multisite Whether the snippets are multisite-wide (true) or site-wide (false).
|
213 |
+
*
|
214 |
+
* @return Snippet|string Snippet object on success, error message on failure.
|
215 |
+
* @since 2.0.0
|
216 |
+
*/
|
217 |
+
function activate_snippet( $id, $multisite = null ) {
|
218 |
+
global $wpdb;
|
219 |
+
$db = code_snippets()->db;
|
220 |
+
$table_name = $db->get_table_name( $multisite );
|
221 |
+
|
222 |
+
// Retrieve the snippet code from the database for validation before activating.
|
223 |
+
$snippet = get_snippet( $id, $multisite );
|
224 |
+
if ( ! $snippet || 0 === $snippet->id ) {
|
225 |
+
/* translators: %d: snippet ID */
|
226 |
+
return sprintf( __( 'Could not locate snippet with ID %d.', 'code-snippets' ), $id );
|
227 |
+
}
|
228 |
+
|
229 |
+
$validator = new Validator( $snippet->code );
|
230 |
+
if ( $validator->validate() ) {
|
231 |
+
return __( 'Could not activate snippet: code did not pass validation.', 'code-snippets' );
|
232 |
+
}
|
233 |
+
|
234 |
+
$result = $wpdb->update(
|
235 |
+
$table_name,
|
236 |
+
array( 'active' => '1' ),
|
237 |
+
array( 'id' => $id ),
|
238 |
+
array( '%d' ),
|
239 |
+
array( '%d' )
|
240 |
+
); // db call ok.
|
241 |
+
|
242 |
+
if ( ! $result ) {
|
243 |
+
return __( 'Could not activate snippet.', 'code-snippets' );
|
244 |
+
}
|
245 |
+
|
246 |
+
/* Remove snippet from shared network snippet list if it was Network Activated */
|
247 |
+
if ( $table_name === $db->ms_table ) {
|
248 |
+
$shared_network_snippets = get_site_option( 'shared_network_snippets' );
|
249 |
+
if ( $shared_network_snippets ) {
|
250 |
+
$shared_network_snippets = array_diff( $shared_network_snippets, array( $id ) );
|
251 |
+
update_site_option( 'shared_network_snippets', $shared_network_snippets );
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
do_action( 'code_snippets/activate_snippet', $id, $multisite );
|
256 |
+
clean_snippets_cache( $table_name );
|
257 |
+
return $snippet;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Activates multiple snippets.
|
262 |
+
* Write operation.
|
263 |
+
*
|
264 |
+
* @param array $ids The IDs of the snippets to activate.
|
265 |
+
* @param bool|null $multisite Whether the snippets are multisite-wide (true) or site-wide (false).
|
266 |
+
*
|
267 |
+
* @return array The IDs of the snippets which were successfully activated.
|
268 |
+
*
|
269 |
+
* @since 2.0.0
|
270 |
+
*/
|
271 |
+
function activate_snippets( array $ids, $multisite = null ) {
|
272 |
+
global $wpdb;
|
273 |
+
$db = code_snippets()->db;
|
274 |
+
$multisite = DB::validate_network_param( $multisite );
|
275 |
+
$table_name = $db->get_table_name( $multisite );
|
276 |
+
$snippets = get_snippets( $ids, $multisite );
|
277 |
+
|
278 |
+
if ( ! $snippets ) {
|
279 |
+
return array();
|
280 |
+
}
|
281 |
+
|
282 |
+
// Loop through each snippet code and validate individually.
|
283 |
+
$valid_ids = array();
|
284 |
+
|
285 |
+
foreach ( $snippets as $snippet ) {
|
286 |
+
$validator = new Validator( $snippet->code );
|
287 |
+
$code_error = $validator->validate();
|
288 |
+
|
289 |
+
if ( ! $code_error ) {
|
290 |
+
$valid_ids[] = $snippet->id;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
// If there are no valid snippets, then we're done.
|
295 |
+
if ( ! $valid_ids ) {
|
296 |
+
return $valid_ids;
|
297 |
+
}
|
298 |
+
|
299 |
+
// Build a SQL query containing all IDs, as wpdb::update does not support OR conditionals.
|
300 |
+
$ids_format = implode( ',', array_fill( 0, count( $valid_ids ), '%d' ) );
|
301 |
+
// phpcs:disable WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
|
302 |
+
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET active = 1 WHERE id IN ($ids_format)", $valid_ids ) ); // db call ok.
|
303 |
+
|
304 |
+
// Remove any snippets from shared network snippet list if they were Network Activated.
|
305 |
+
if ( $table_name === $db->ms_table ) {
|
306 |
+
$shared_network_snippets = get_site_option( 'shared_network_snippets' );
|
307 |
+
|
308 |
+
if ( $shared_network_snippets ) {
|
309 |
+
$shared_network_snippets = array_diff( $shared_network_snippets, $valid_ids );
|
310 |
+
update_site_option( 'shared_network_snippets', $shared_network_snippets );
|
311 |
+
clean_active_snippets_cache( $db->ms_table );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
do_action( 'code_snippets/activate_snippets', $valid_ids, $multisite );
|
316 |
+
clean_snippets_cache( $table_name );
|
317 |
+
return $valid_ids;
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Deactivate a snippet.
|
322 |
+
* Write operation.
|
323 |
+
*
|
324 |
+
* @param int $id ID of the snippet to deactivate.
|
325 |
+
* @param bool|null $multisite Whether the snippets are multisite-wide (true) or site-wide (false).
|
326 |
+
*
|
327 |
+
* @return bool Whether the deactivation was successful.
|
328 |
+
*
|
329 |
+
* @uses $wpdb to set the snippets' active status.
|
330 |
+
* @since 2.0.0
|
331 |
+
*/
|
332 |
+
function deactivate_snippet( $id, $multisite = null ) {
|
333 |
+
global $wpdb;
|
334 |
+
$db = code_snippets()->db;
|
335 |
+
$table = $db->get_table_name( $multisite );
|
336 |
+
|
337 |
+
// Set the snippet to active.
|
338 |
+
$result = $wpdb->update(
|
339 |
+
$table,
|
340 |
+
array( 'active' => '0' ),
|
341 |
+
array( 'id' => $id ),
|
342 |
+
array( '%d' ),
|
343 |
+
array( '%d' )
|
344 |
+
); // db call ok.
|
345 |
+
|
346 |
+
if ( ! $result ) {
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
|
350 |
+
// Update the recently active list.
|
351 |
+
$recently_active = array( $id => time() );
|
352 |
+
|
353 |
+
if ( $table === $db->table ) {
|
354 |
+
|
355 |
+
update_option(
|
356 |
+
'recently_activated_snippets',
|
357 |
+
$recently_active + (array) get_option( 'recently_activated_snippets', array() )
|
358 |
+
);
|
359 |
+
} elseif ( $table === $db->ms_table ) {
|
360 |
+
|
361 |
+
update_site_option(
|
362 |
+
'recently_activated_snippets',
|
363 |
+
$recently_active + (array) get_site_option( 'recently_activated_snippets', array() )
|
364 |
+
);
|
365 |
+
}
|
366 |
+
|
367 |
+
do_action( 'code_snippets/deactivate_snippet', $id, $multisite );
|
368 |
+
clean_snippets_cache( $table );
|
369 |
+
return true;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Deletes a snippet from the database.
|
374 |
+
* Write operation.
|
375 |
+
*
|
376 |
+
* @param int $id ID of the snippet to delete.
|
377 |
+
* @param bool|null $multisite Delete from network-wide (true) or site-wide (false) table.
|
378 |
+
*
|
379 |
+
* @since 2.0.0
|
380 |
+
*/
|
381 |
+
function delete_snippet( $id, $multisite = null ) {
|
382 |
+
global $wpdb;
|
383 |
+
$table = code_snippets()->db->get_table_name( $multisite );
|
384 |
+
|
385 |
+
$wpdb->delete(
|
386 |
+
$table,
|
387 |
+
array( 'id' => $id ),
|
388 |
+
array( '%d' )
|
389 |
+
); // db call ok.
|
390 |
+
|
391 |
+
do_action( 'code_snippets/delete_snippet', $id, $multisite );
|
392 |
+
clean_snippets_cache( $table );
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Saves a snippet to the database.
|
397 |
+
* Write operation.
|
398 |
+
*
|
399 |
+
* @param Snippet $snippet The snippet to add/update to the database.
|
400 |
+
*
|
401 |
+
* @return int ID of the snippet
|
402 |
+
*
|
403 |
+
* @since 2.0.0
|
404 |
+
*/
|
405 |
+
function save_snippet( Snippet $snippet ) {
|
406 |
+
global $wpdb;
|
407 |
+
$table = code_snippets()->db->get_table_name( $snippet->network );
|
408 |
+
|
409 |
+
// Update the last modification date if necessary.
|
410 |
+
$snippet->update_modified();
|
411 |
+
|
412 |
+
// Build array of data to insert.
|
413 |
+
$data = array(
|
414 |
+
'name' => $snippet->name,
|
415 |
+
'description' => $snippet->desc,
|
416 |
+
'code' => $snippet->code,
|
417 |
+
'tags' => $snippet->tags_list,
|
418 |
+
'scope' => $snippet->scope,
|
419 |
+
'priority' => $snippet->priority,
|
420 |
+
'active' => intval( $snippet->active ),
|
421 |
+
'modified' => $snippet->modified,
|
422 |
+
);
|
423 |
+
|
424 |
+
// Create a new snippet if the ID is not set.
|
425 |
+
if ( 0 === $snippet->id ) {
|
426 |
+
$result = $wpdb->insert( $table, $data, '%s' ); // db call ok.
|
427 |
+
if ( false === $result ) {
|
428 |
+
return 0;
|
429 |
+
}
|
430 |
+
|
431 |
+
$snippet->id = $wpdb->insert_id;
|
432 |
+
do_action( 'code_snippets/create_snippet', $snippet, $table );
|
433 |
+
} else {
|
434 |
+
|
435 |
+
// Otherwise, update the snippet data.
|
436 |
+
$result = $wpdb->update( $table, $data, array( 'id' => $snippet->id ), null, array( '%d' ) ); // db call ok.
|
437 |
+
if ( false === $result ) {
|
438 |
+
return 0;
|
439 |
+
}
|
440 |
+
|
441 |
+
do_action( 'code_snippets/update_snippet', $snippet, $table );
|
442 |
+
}
|
443 |
+
|
444 |
+
clean_snippets_cache( $table );
|
445 |
+
return $snippet->id;
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Update a snippet entry given a list of fields.
|
450 |
+
* Write operation.
|
451 |
+
*
|
452 |
+
* @param int $snippet_id ID of the snippet to update.
|
453 |
+
* @param array $fields An array of fields mapped to their values.
|
454 |
+
* @param bool|null $network Update in network-wide (true) or site-wide (false) table.
|
455 |
+
*/
|
456 |
+
function update_snippet_fields( $snippet_id, $fields, $network = null ) {
|
457 |
+
global $wpdb;
|
458 |
+
|
459 |
+
$table = code_snippets()->db->get_table_name( $network );
|
460 |
+
|
461 |
+
// Build a new snippet object for the validation.
|
462 |
+
$snippet = new Snippet();
|
463 |
+
$snippet->id = $snippet_id;
|
464 |
+
|
465 |
+
// Validate fields through the snippet class and copy them into a clean array.
|
466 |
+
$clean_fields = array();
|
467 |
+
|
468 |
+
foreach ( $fields as $field => $value ) {
|
469 |
+
|
470 |
+
if ( $snippet->set_field( $field, $value ) ) {
|
471 |
+
$clean_fields[ $field ] = $snippet->$field;
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
// Update the snippet in the database.
|
476 |
+
$wpdb->update( $table, $clean_fields, array( 'id' => $snippet->id ), null, array( '%d' ) ); // db call ok.
|
477 |
+
|
478 |
+
do_action( 'code_snippets/update_snippet', $snippet->id, $table );
|
479 |
+
clean_snippets_cache( $table );
|
480 |
+
}
|
481 |
+
|
482 |
+
/**
|
483 |
+
* Execute a snippet.
|
484 |
+
* Execute operation.
|
485 |
+
*
|
486 |
+
* Code must NOT be escaped, as it will be executed directly.
|
487 |
+
*
|
488 |
+
* @param string $code Snippet code to execute.
|
489 |
+
* @param int $id Snippet ID.
|
490 |
+
* @param bool $catch_output Whether to attempt to suppress the output of execution using buffers.
|
491 |
+
*
|
492 |
+
* @return mixed Result of the code execution
|
493 |
+
* @since 2.0.0
|
494 |
+
*/
|
495 |
+
function execute_snippet( $code, $id = 0, $catch_output = true ) {
|
496 |
+
|
497 |
+
if ( empty( $code ) || defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE ) {
|
498 |
+
return false;
|
499 |
+
}
|
500 |
+
|
501 |
+
if ( $catch_output ) {
|
502 |
+
ob_start();
|
503 |
+
}
|
504 |
+
|
505 |
+
$result = eval( $code );
|
506 |
+
|
507 |
+
if ( $catch_output ) {
|
508 |
+
ob_end_clean();
|
509 |
+
}
|
510 |
+
|
511 |
+
do_action( 'code_snippets/after_execute_snippet', $id, $code, $result );
|
512 |
+
|
513 |
+
return $result;
|
514 |
+
}
|
515 |
+
|
516 |
+
/**
|
517 |
+
* Run the active snippets.
|
518 |
+
* Read-write-execute operation.
|
519 |
+
*
|
520 |
+
* @return bool true on success, false on failure.
|
521 |
+
*
|
522 |
+
* @since 2.0.0
|
523 |
+
*/
|
524 |
+
function execute_active_snippets() {
|
525 |
+
global $wpdb;
|
526 |
+
|
527 |
+
// Bail early if safe mode is active.
|
528 |
+
if ( defined( 'CODE_SNIPPETS_SAFE_MODE' ) && CODE_SNIPPETS_SAFE_MODE || ! apply_filters( 'code_snippets/execute_snippets', true ) ) {
|
529 |
+
return false;
|
530 |
+
}
|
531 |
+
|
532 |
+
$db = code_snippets()->db;
|
533 |
+
$scopes = array( 'global', 'single-use', is_admin() ? 'admin' : 'front-end' );
|
534 |
+
$data = $db->fetch_active_snippets( $scopes );
|
535 |
+
|
536 |
+
foreach ( $data as $table_name => $active_snippets ) {
|
537 |
+
|
538 |
+
// Loop through the returned snippets and execute the PHP code.
|
539 |
+
foreach ( $active_snippets as $snippet ) {
|
540 |
+
$snippet_id = intval( $snippet['id'] );
|
541 |
+
$code = $snippet['code'];
|
542 |
+
|
543 |
+
// If the snippet is a single-use snippet, deactivate it before execution to ensure that the process always happens.
|
544 |
+
if ( 'single-use' === $snippet['scope'] ) {
|
545 |
+
$active_shared_ids = get_option( 'active_shared_network_snippets', array() );
|
546 |
+
|
547 |
+
if ( $table_name === $db->ms_table && is_array( $active_shared_ids ) && in_array( $snippet_id, $active_shared_ids, true ) ) {
|
548 |
+
unset( $active_shared_ids[ array_search( $snippet_id, $active_shared_ids, true ) ] );
|
549 |
+
$active_shared_ids = array_values( $active_shared_ids );
|
550 |
+
update_option( 'active_shared_network_snippets', $active_shared_ids );
|
551 |
+
clean_active_snippets_cache( $table_name );
|
552 |
+
} else {
|
553 |
+
$wpdb->update(
|
554 |
+
$table_name,
|
555 |
+
array( 'active' => '0' ),
|
556 |
+
array( 'id' => $snippet_id ),
|
557 |
+
array( '%d' ),
|
558 |
+
array( '%d' )
|
559 |
+
); // db call ok.
|
560 |
+
clean_snippets_cache( $table_name );
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
if ( apply_filters( 'code_snippets/allow_execute_snippet', true, $snippet_id, $table_name ) ) {
|
565 |
+
execute_snippet( $code, $snippet_id );
|
566 |
+
}
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
return true;
|
571 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Additional strings needed for translation, but not currently present within code.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
__( 'You can now safely remove the free version of Code Snippets', 'code-snippets' );
|
9 |
+
|
10 |
+
__( 'Success', 'code-snippets' );
|
11 |
+
__( 'Notice', 'code-snippets' );
|
12 |
+
__( 'Thanks', 'code-snippets' );
|
13 |
+
__( 'Okay', 'code-snippets' );
|
14 |
+
|
15 |
+
// settings-fields.php.
|
16 |
+
__( 'Minify Snippet Output', 'code-snippets' );
|
17 |
+
__( 'Minify snippet output by removing whitespace and optimising code to reduce load times.', 'code-snippets' );
|
18 |
+
|
19 |
+
// edit.php.
|
20 |
+
__( 'View Full Stylesheet', 'code-snippets' );
|
21 |
+
__( 'View Full Script', 'code-snippets' );
|
22 |
+
|
23 |
+
array(
|
24 |
+
'site-css' => __( 'Site front-end stylesheet', 'code-snippets' ),
|
25 |
+
'admin-css' => __( 'Administration area stylesheet', 'code-snippets' ),
|
26 |
+
'site-head-js' => __( 'JavaScript loaded in the site &lt;head&gt; section', 'code-snippets' ),
|
27 |
+
'site-footer-js' => __( 'JavaScript loaded just before the closing &lt;/body&gt; tag', 'code-snippets' ),
|
28 |
+
);
|
29 |
+
|
30 |
+
// edit-scopes.php.
|
31 |
+
array(
|
32 |
+
'head-content' => __( 'Display in site <head> section.', 'code-snippets' ),
|
33 |
+
'footer-content' => __( 'Display at the end of the <body> section, in the footer.', 'code-snippets' ),
|
34 |
+
'site-css' => __( 'Site front-end styles', 'code-snippets' ),
|
35 |
+
'admin-css' => __( 'Administration area styles', 'code-snippets' ),
|
36 |
+
);
|
37 |
+
|
38 |
+
// class-content-widget.php.
|
39 |
+
__( 'Processing Options', 'code-snippets' );
|
40 |
+
__( 'Alignment', 'code-snippets' );
|
41 |
+
__( 'Left', 'code-snippets' );
|
42 |
+
__( 'Center', 'code-snippets' );
|
43 |
+
__( 'Right', 'code-snippets' );
|
44 |
+
__( 'Justified', 'code-snippets' );
|
45 |
+
__( 'Text Color', 'code-snippets' );
|
46 |
+
__( 'Select a snippet to show', 'code-snippets' );
|
47 |
+
|
48 |
+
// class-source-widget.php.
|
49 |
+
__( 'Code Snippet Source', 'code-snippets' );
|
50 |
+
__( 'Functions (PHP)', 'code-snippets' );
|
51 |
+
__( 'Content (Mixed)', 'code-snippets' );
|
52 |
+
__( 'Styles (CSS)', 'code-snippets' );
|
53 |
+
__( 'Scripts (JS)', 'code-snippets' );
|
54 |
+
__( 'Highlight Lines', 'code-snippets' );
|
55 |
+
__( 'Word Wrap', 'code-snippets' );
|
56 |
+
__( 'On', 'code-snippets' );
|
57 |
+
__( 'Off', 'code-snippets' );
|
58 |
+
__( 'Height', 'code-snippets' );
|
59 |
+
__( 'Font Size', 'code-snippets' );
|
60 |
+
__( 'Select a snippet to display', 'code-snippets' );
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions for cleaning data when the plugin is uninstalled.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Code_Snippets\Uninstall;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Determine whether the option for allowing a complete uninstallation is enabled.
|
12 |
+
*
|
13 |
+
* @return boolean
|
14 |
+
*/
|
15 |
+
function complete_uninstall_enabled() {
|
16 |
+
$unified = false;
|
17 |
+
|
18 |
+
if ( is_multisite() ) {
|
19 |
+
$menu_perms = get_site_option( 'menu_items', array() );
|
20 |
+
$unified = empty( $menu_perms['snippets_settings'] );
|
21 |
+
}
|
22 |
+
|
23 |
+
$settings = $unified ? get_site_option( 'code_snippets_settings' ) : get_option( 'code_snippets_settings' );
|
24 |
+
|
25 |
+
return isset( $settings['general']['complete_uninstall'] ) && $settings['general']['complete_uninstall'];
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Clean up data created by this plugin for a single site
|
30 |
+
*
|
31 |
+
* phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
|
32 |
+
*/
|
33 |
+
function uninstall_current_site() {
|
34 |
+
global $wpdb;
|
35 |
+
|
36 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}snippets" ); // cache ok, db call ok.
|
37 |
+
|
38 |
+
delete_option( 'code_snippets_version' );
|
39 |
+
delete_option( 'recently_activated_snippets' );
|
40 |
+
delete_option( 'code_snippets_settings' );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Clean up data created by this plugin on multisite.
|
45 |
+
*
|
46 |
+
* phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange
|
47 |
+
*/
|
48 |
+
function uninstall_multisite() {
|
49 |
+
global $wpdb;
|
50 |
+
|
51 |
+
// Loop through sites.
|
52 |
+
$blog_ids = get_sites( [ 'fields' => 'ids' ] );
|
53 |
+
|
54 |
+
foreach ( $blog_ids as $site_id ) {
|
55 |
+
switch_to_blog( $site_id );
|
56 |
+
uninstall_current_site();
|
57 |
+
}
|
58 |
+
|
59 |
+
restore_current_blog();
|
60 |
+
|
61 |
+
// Remove network snippets table.
|
62 |
+
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ms_snippets" ); // cache ok, db call ok.
|
63 |
+
|
64 |
+
// Remove saved options.
|
65 |
+
delete_site_option( 'code_snippets_version' );
|
66 |
+
delete_site_option( 'recently_activated_snippets' );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Uninstall the Code Snippets plugin.
|
71 |
+
*
|
72 |
+
* @return void
|
73 |
+
*/
|
74 |
+
function uninstall_plugin() {
|
75 |
+
if ( complete_uninstall_enabled() ) {
|
76 |
+
|
77 |
+
if ( is_multisite() ) {
|
78 |
+
uninstall_multisite();
|
79 |
+
} else {
|
80 |
+
uninstall_current_site();
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML for the Add New/Edit Snippet page.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Views
|
7 |
+
*
|
8 |
+
* @var Edit_Menu $this
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace Code_Snippets;
|
12 |
+
|
13 |
+
/* Bail if accessed directly */
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
$snippet = $this->snippet;
|
19 |
+
$classes = array();
|
20 |
+
|
21 |
+
if ( ! $snippet->id ) {
|
22 |
+
$classes[] = 'new-snippet';
|
23 |
+
} elseif ( 'single-use' === $snippet->scope ) {
|
24 |
+
$classes[] = 'single-use-snippet';
|
25 |
+
} elseif ( 'html' !== $snippet->type ) {
|
26 |
+
$classes[] = ( $snippet->active ? '' : 'in' ) . 'active-snippet';
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
30 |
+
<div class="wrap">
|
31 |
+
<h1>
|
32 |
+
<?php
|
33 |
+
|
34 |
+
if ( $snippet->id ) {
|
35 |
+
esc_html_e( 'Edit Snippet', 'code-snippets' );
|
36 |
+
printf(
|
37 |
+
' <a href="%1$s" class="page-title-action add-new-h2">%2$s</a>',
|
38 |
+
esc_url( add_query_arg( 'type', $snippet->type, code_snippets()->get_menu_url( 'add' ) ) ),
|
39 |
+
esc_html_x( 'Add New', 'snippet', 'code-snippets' )
|
40 |
+
);
|
41 |
+
} else {
|
42 |
+
esc_html_e( 'Add New Snippet', 'code-snippets' );
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( code_snippets()->is_compact_menu() ) {
|
46 |
+
$this->page_title_actions( [ 'manage', 'import', 'settings' ] );
|
47 |
+
}
|
48 |
+
|
49 |
+
?>
|
50 |
+
</h1>
|
51 |
+
|
52 |
+
<?php $this->print_messages(); ?>
|
53 |
+
|
54 |
+
<form method="post" id="snippet-form" action="" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"
|
55 |
+
data-snippet-type="<?php echo esc_attr( $snippet->type ); ?>">
|
56 |
+
<?php
|
57 |
+
/* Output the hidden fields */
|
58 |
+
|
59 |
+
if ( 0 !== $snippet->id ) {
|
60 |
+
printf( '<input type="hidden" name="snippet_id" value="%d">', esc_attr( $snippet->id ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
printf( '<input type="hidden" name="snippet_active" value="%d">', esc_attr( $snippet->active ) );
|
64 |
+
|
65 |
+
printf( '<input type="hidden" name="current_snippet_scope" value="%s">', esc_attr( $snippet->scope ) );
|
66 |
+
|
67 |
+
do_action( 'code_snippets/admin/before_title_input', $snippet );
|
68 |
+
?>
|
69 |
+
|
70 |
+
<div id="titlediv">
|
71 |
+
<div id="titlewrap">
|
72 |
+
<label for="title" style="display: none;"><?php esc_html_e( 'Name', 'code-snippets' ); ?></label>
|
73 |
+
<input id="title" type="text" autocomplete="off" name="snippet_name"
|
74 |
+
value="<?php echo esc_attr( $snippet->name ); ?>"
|
75 |
+
placeholder="<?php esc_attr_e( 'Enter title here', 'code-snippets' ); ?>">
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
|
79 |
+
<?php do_action( 'code_snippets/admin/after_title_input', $snippet ); ?>
|
80 |
+
|
81 |
+
<p class="submit-inline"><?php do_action( 'code_snippets/admin/code_editor_toolbar', $snippet ); ?></p>
|
82 |
+
|
83 |
+
<h2>
|
84 |
+
<label for="snippet_code">
|
85 |
+
<?php
|
86 |
+
esc_html_e( 'Code', 'code-snippets' );
|
87 |
+
|
88 |
+
if ( $snippet->id ) {
|
89 |
+
printf(
|
90 |
+
' <span class="snippet-type-badge" data-type="%s">%s</span>',
|
91 |
+
esc_attr( $snippet->type ),
|
92 |
+
esc_html( $snippet->type )
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
?>
|
97 |
+
</label>
|
98 |
+
</h2>
|
99 |
+
|
100 |
+
<?php
|
101 |
+
|
102 |
+
if ( ! $snippet->id && ! isset( $_REQUEST['preview'] ) ) {
|
103 |
+
echo '<h2 class="nav-tab-wrapper" id="snippet-type-tabs">';
|
104 |
+
|
105 |
+
foreach ( Plugin::get_types() as $type_name => $label ) {
|
106 |
+
Admin::render_snippet_type_tab( $type_name, $label, $snippet->type );
|
107 |
+
}
|
108 |
+
|
109 |
+
echo '</h2>';
|
110 |
+
}
|
111 |
+
|
112 |
+
?>
|
113 |
+
|
114 |
+
<div class="snippet-editor">
|
115 |
+
<textarea id="snippet_code" name="snippet_code" rows="200" spellcheck="false"
|
116 |
+
style="font-family: monospace; width: 100%;"><?php echo esc_textarea( $snippet->code ); ?></textarea>
|
117 |
+
|
118 |
+
<?php $this->render_view( 'partials/editor-shortcuts' ); ?>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<div class="below-editor">
|
122 |
+
<?php
|
123 |
+
$this->render_view( 'partials/edit-scopes' );
|
124 |
+
do_action( 'code_snippets_below_editor', $snippet );
|
125 |
+
?>
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<?php
|
129 |
+
|
130 |
+
/* Allow plugins to add fields and content to this page */
|
131 |
+
do_action( 'code_snippets_edit_snippet', $snippet );
|
132 |
+
|
133 |
+
/* Add a nonce for security */
|
134 |
+
wp_nonce_field( 'save_snippet' );
|
135 |
+
|
136 |
+
?>
|
137 |
+
|
138 |
+
<p class="submit"><?php $this->render_submit_buttons( $snippet ); ?></p>
|
139 |
+
</form>
|
140 |
+
</div>
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML for the Import Snippets page.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Views
|
7 |
+
*
|
8 |
+
* @var Import_Menu $this
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace Code_Snippets;
|
12 |
+
|
13 |
+
/* Bail if accessed directly */
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
$max_size_bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
|
19 |
+
|
20 |
+
?>
|
21 |
+
<div class="wrap">
|
22 |
+
<h1>
|
23 |
+
<?php
|
24 |
+
|
25 |
+
esc_html_e( 'Import Snippets', 'code-snippets' );
|
26 |
+
|
27 |
+
if ( code_snippets()->is_compact_menu() ) {
|
28 |
+
$this->page_title_actions( [ 'manage', 'add', 'settings' ] );
|
29 |
+
}
|
30 |
+
|
31 |
+
?>
|
32 |
+
</h1>
|
33 |
+
|
34 |
+
<?php $this->print_messages(); ?>
|
35 |
+
|
36 |
+
<div class="narrow">
|
37 |
+
|
38 |
+
<p><?php esc_html_e( 'Upload one or more Code Snippets export files and the snippets will be imported.', 'code-snippets' ); ?></p>
|
39 |
+
|
40 |
+
<p>
|
41 |
+
<?php
|
42 |
+
/* translators: %s: link to snippets admin menu */
|
43 |
+
$text = __( 'Afterwards, you will need to visit the <a href="%s">All Snippets</a> page to activate the imported snippets.', 'code-snippets' );
|
44 |
+
|
45 |
+
printf( wp_kses( $text, [ 'a' => [ 'href' ] ] ), esc_url( code_snippets()->get_menu_url( 'manage' ) ) );
|
46 |
+
|
47 |
+
?>
|
48 |
+
</p>
|
49 |
+
|
50 |
+
|
51 |
+
<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form"
|
52 |
+
name="code_snippets_import">
|
53 |
+
<?php wp_nonce_field( 'import_code_snippets_file' ); ?>
|
54 |
+
|
55 |
+
<h2><?php esc_html_e( 'Duplicate Snippets', 'code-snippets' ); ?></h2>
|
56 |
+
|
57 |
+
<p class="description">
|
58 |
+
<?php esc_html_e( 'What should happen if an existing snippet is found with an identical name to an imported snippet?', 'code-snippets' ); ?>
|
59 |
+
</p>
|
60 |
+
|
61 |
+
<fieldset>
|
62 |
+
<p>
|
63 |
+
<label>
|
64 |
+
<input type="radio" name="duplicate_action" value="ignore" checked="checked">
|
65 |
+
<?php esc_html_e( 'Ignore any duplicate snippets: import all snippets from the file regardless and leave all existing snippets unchanged.', 'code-snippets' ); ?>
|
66 |
+
</label>
|
67 |
+
</p>
|
68 |
+
|
69 |
+
<p>
|
70 |
+
<label>
|
71 |
+
<input type="radio" name="duplicate_action" value="replace">
|
72 |
+
<?php esc_html_e( 'Replace any existing snippets with a newly imported snippet of the same name.', 'code-snippets' ); ?>
|
73 |
+
</label>
|
74 |
+
</p>
|
75 |
+
|
76 |
+
<p>
|
77 |
+
<label>
|
78 |
+
<input type="radio" name="duplicate_action" value="skip">
|
79 |
+
<?php esc_html_e( 'Do not import any duplicate snippets; leave all existing snippets unchanged.', 'code-snippets' ); ?>
|
80 |
+
</label>
|
81 |
+
</p>
|
82 |
+
</fieldset>
|
83 |
+
|
84 |
+
<h2><?php esc_html_e( 'Upload Files', 'code-snippets' ); ?></h2>
|
85 |
+
|
86 |
+
<p class="description">
|
87 |
+
<?php esc_html_e( 'Choose one or more Code Snippets (.xml or .json) files to upload, then click "Upload files and import".', 'code-snippets' ); ?>
|
88 |
+
</p>
|
89 |
+
|
90 |
+
<fieldset>
|
91 |
+
<p>
|
92 |
+
<label for="upload"><?php esc_html_e( 'Choose files from your computer:', 'code-snippets' ); ?></label>
|
93 |
+
<?php
|
94 |
+
/* translators: %s: size in bytes */
|
95 |
+
printf( esc_html__( '(Maximum size: %s)', 'code-snippets' ), esc_html( size_format( $max_size_bytes ) ) ); ?>
|
96 |
+
<input type="file" id="upload" name="code_snippets_import_files[]" size="25"
|
97 |
+
accept="application/json,.json,text/xml" multiple="multiple">
|
98 |
+
<input type="hidden" name="action" value="save">
|
99 |
+
<input type="hidden" name="max_file_size" value="<?php echo esc_attr( $max_size_bytes ); ?>">
|
100 |
+
</p>
|
101 |
+
</fieldset>
|
102 |
+
|
103 |
+
<?php
|
104 |
+
|
105 |
+
do_action( 'code_snippets/admin/import_form' );
|
106 |
+
submit_button( __( 'Upload files and import', 'code-snippets' ) );
|
107 |
+
|
108 |
+
?>
|
109 |
+
</form>
|
110 |
+
</div>
|
111 |
+
</div>
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML for the Manage Snippets page.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Views
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets;
|
10 |
+
|
11 |
+
/* @var Manage_Menu $this */
|
12 |
+
|
13 |
+
/* Bail if accessed directly */
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
$types = array_merge( [ 'all' => __( 'All Snippets', 'code-snippets' ) ], Plugin::get_types() );
|
19 |
+
|
20 |
+
$current_type = isset( $_GET['type'] ) ? sanitize_text_field( wp_unslash( $_GET['type'] ) ) : 'all';
|
21 |
+
$current_type = isset( $types[ $current_type ] ) ? $current_type : 'all';
|
22 |
+
|
23 |
+
?>
|
24 |
+
|
25 |
+
<div class="wrap">
|
26 |
+
<h1>
|
27 |
+
<?php
|
28 |
+
esc_html_e( 'Snippets', 'code-snippets' );
|
29 |
+
|
30 |
+
$this->page_title_actions( code_snippets()->is_compact_menu() ? [ 'add', 'import', 'settings' ] : [ 'add', 'import' ] );
|
31 |
+
|
32 |
+
$this->list_table->search_notice();
|
33 |
+
?>
|
34 |
+
</h1>
|
35 |
+
|
36 |
+
<?php $this->print_messages(); ?>
|
37 |
+
|
38 |
+
<h2 class="nav-tab-wrapper" id="snippet-type-tabs">
|
39 |
+
<?php
|
40 |
+
|
41 |
+
foreach ( $types as $type_name => $label ) {
|
42 |
+
Admin::render_snippet_type_tab( $type_name, $label, $current_type );
|
43 |
+
}
|
44 |
+
|
45 |
+
?>
|
46 |
+
<a class="button button-large nav-tab-button go-pro-button" href="https://codesnippets.pro/pricing/" target="_blank"
|
47 |
+
title="Find more about Pro (opens in external tab)">
|
48 |
+
<?php echo wp_kses( __( 'Upgrade to <span class="badge">Pro</span>', 'code-snippets' ), [ 'span' => [ 'class' => 'badge' ] ] ); ?>
|
49 |
+
<span class="dashicons dashicons-external"></span>
|
50 |
+
</a>
|
51 |
+
</h2>
|
52 |
+
|
53 |
+
<?php
|
54 |
+
$desc = code_snippets()->get_type_description( $current_type );
|
55 |
+
if ( $desc ) {
|
56 |
+
echo '<p class="snippet-type-description">', esc_html( $desc );
|
57 |
+
|
58 |
+
$type_names = [
|
59 |
+
'php' => __( 'function snippets', 'code-snippets' ),
|
60 |
+
'html' => __( 'content snippets', 'code-snippets' ),
|
61 |
+
'css' => __( 'style snippets', 'code-snippets' ),
|
62 |
+
'js' => __( 'javascript snippets', 'code-snippets' ),
|
63 |
+
];
|
64 |
+
|
65 |
+
$type_names = apply_filters( 'code_snippets/admin/manage/type_names', $type_names );
|
66 |
+
|
67 |
+
/* translators: %s: snippet type name */
|
68 |
+
$learn_more_text = sprintf( __( 'Learn more about %s →', 'code-snippets' ), $type_names[ $current_type ] );
|
69 |
+
|
70 |
+
printf(
|
71 |
+
' <a href="%s" target="_blank">%s</a></p>',
|
72 |
+
esc_url( "https://codesnippets.pro/learn-$current_type/" ),
|
73 |
+
esc_html( $learn_more_text )
|
74 |
+
);
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
|
78 |
+
<?php
|
79 |
+
do_action( 'code_snippets/admin/manage/before_list_table' );
|
80 |
+
$this->list_table->views();
|
81 |
+
?>
|
82 |
+
|
83 |
+
<form method="get" action="">
|
84 |
+
<?php
|
85 |
+
$this->list_table->required_form_fields( 'search_box' );
|
86 |
+
$this->list_table->search_box( __( 'Search Snippets', 'code-snippets' ), 'search_id' );
|
87 |
+
?>
|
88 |
+
</form>
|
89 |
+
|
90 |
+
<form method="post" action="">
|
91 |
+
<input type="hidden" id="code_snippets_ajax_nonce"
|
92 |
+
value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage_ajax' ) ); ?>">
|
93 |
+
|
94 |
+
<?php
|
95 |
+
$this->list_table->required_form_fields();
|
96 |
+
$this->list_table->display();
|
97 |
+
?>
|
98 |
+
</form>
|
99 |
+
|
100 |
+
<?php do_action( 'code_snippets/admin/manage' ); ?>
|
101 |
+
</div>
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML for the snippet scope selector.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Views
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets;
|
10 |
+
|
11 |
+
/* @var Edit_Menu $this */
|
12 |
+
|
13 |
+
$snippet = $this->snippet;
|
14 |
+
|
15 |
+
echo '<h2 class="screen-reader-text">', esc_html__( 'Scope', 'code-snippets' ), '</h2>';
|
16 |
+
|
17 |
+
if ( ! $snippet->id || 'php' === $snippet->type ) {
|
18 |
+
echo '<p class="snippet-scope php-scopes-list">';
|
19 |
+
|
20 |
+
$this->print_scopes_list(
|
21 |
+
array(
|
22 |
+
'global' => __( 'Run snippet everywhere', 'code-snippets' ),
|
23 |
+
'admin' => __( 'Only run in administration area', 'code-snippets' ),
|
24 |
+
'front-end' => __( 'Only run on site front-end', 'code-snippets' ),
|
25 |
+
'single-use' => __( 'Only run once', 'code-snippets' ),
|
26 |
+
)
|
27 |
+
);
|
28 |
+
|
29 |
+
echo '</p>';
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( ! $snippet->id || 'css' === $snippet->type ) {
|
33 |
+
echo '<p class="snippet-scope css-scopes-list">';
|
34 |
+
|
35 |
+
$this->print_scopes_list(
|
36 |
+
array(
|
37 |
+
'site-css' => __( 'Site front-end styles', 'code-snippets' ),
|
38 |
+
'admin-css' => __( 'Administration area styles', 'code-snippets' ),
|
39 |
+
)
|
40 |
+
);
|
41 |
+
|
42 |
+
echo '</p>';
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( ! $snippet->id || 'js' === $snippet->type ) {
|
46 |
+
echo '<p class="snippet-scope js-scopes-list">';
|
47 |
+
|
48 |
+
$this->print_scopes_list(
|
49 |
+
array(
|
50 |
+
'site-footer-js' => __( 'Load JS at the end of the <body> section', 'code-snippets' ),
|
51 |
+
'site-head-js' => __( 'Load JS in the <head> section', 'code-snippets' ),
|
52 |
+
)
|
53 |
+
);
|
54 |
+
|
55 |
+
echo '</p>';
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( ! $snippet->id || 'html' === $snippet->type ) {
|
59 |
+
?>
|
60 |
+
<div class="snippet-scope html-scopes-list">
|
61 |
+
<p>
|
62 |
+
<?php
|
63 |
+
$this->print_scopes_list(
|
64 |
+
array(
|
65 |
+
'content' => __( 'Only display when inserted into a post or page.', 'code-snippets' ),
|
66 |
+
)
|
67 |
+
);
|
68 |
+
?>
|
69 |
+
</p>
|
70 |
+
|
71 |
+
<?php
|
72 |
+
if ( ! $snippet->id || 'content' === $snippet->scope ) {
|
73 |
+
|
74 |
+
echo '<p>';
|
75 |
+
esc_html_e( 'There are multiple options for inserting this snippet into a post, page or other content. You can copy the below shortcode, or use the Classic Editor button, Block Editor block (Pro) or Elementor widget (Pro).', 'code-snippets' );
|
76 |
+
echo '</p>';
|
77 |
+
|
78 |
+
$shortcode_atts =
|
79 |
+
( $snippet->id ? ' id=' . $snippet->id : '' ) .
|
80 |
+
( $snippet->network ? ' network=true' : '' ) .
|
81 |
+
( false !== stripos( $snippet->code, '<?' ) ? ' php=true' : '' );
|
82 |
+
|
83 |
+
$shortcode_tag = "[code_snippet$shortcode_atts]";
|
84 |
+
|
85 |
+
echo '<code class="shortcode-tag">', esc_html( $shortcode_tag ), '</code>';
|
86 |
+
|
87 |
+
printf(
|
88 |
+
'<a class="code-snippets-copy-text dashicons dashicons-clipboard" title="%s" data-text="%s" href="#"></a>',
|
89 |
+
esc_attr__( 'Copy shortcode to clipboard', 'code-snippets' ),
|
90 |
+
esc_attr( $shortcode_tag )
|
91 |
+
);
|
92 |
+
|
93 |
+
if ( $snippet->id ) { ?>
|
94 |
+
<p class="html-shortcode-options">
|
95 |
+
<strong><?php esc_html_e( 'Shortcode Options: ', 'code-snippets' ); ?></strong>
|
96 |
+
<label>
|
97 |
+
<input type="checkbox"
|
98 |
+
value="php"<?php checked( false !== stripos( $snippet->code, '<?' ) ); ?>>
|
99 |
+
<?php esc_html_e( 'Evaluate PHP code', 'code-snippets' ); ?>
|
100 |
+
</label>
|
101 |
+
<label>
|
102 |
+
<input type="checkbox" value="format" checked="checked">
|
103 |
+
<?php esc_html_e( 'Add paragraphs and formatting', 'code-snippets' ); ?>
|
104 |
+
</label>
|
105 |
+
<label>
|
106 |
+
<input type="checkbox" value="shortcodes">
|
107 |
+
<?php esc_html_e( 'Evaluate additional shortcode tags', 'code-snippets' ); ?>
|
108 |
+
</label>
|
109 |
+
</p>
|
110 |
+
<?php
|
111 |
+
}
|
112 |
+
}
|
113 |
+
?>
|
114 |
+
</div>
|
115 |
+
<?php
|
116 |
+
}
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTML for the editor shortcuts tooltip.
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @subpackage Views
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets;
|
10 |
+
|
11 |
+
/* @var Edit_Menu $this */
|
12 |
+
|
13 |
+
?>
|
14 |
+
|
15 |
+
<div class="snippet-editor-help">
|
16 |
+
|
17 |
+
<div class="editor-help-tooltip cm-s-<?php
|
18 |
+
echo esc_attr( Settings\get_setting( 'editor', 'theme' ) ); ?>"><?php
|
19 |
+
echo esc_html_x( '?', 'help tooltip', 'code-snippets' ); ?></div>
|
20 |
+
|
21 |
+
<div class="editor-help-text">
|
22 |
+
<table>
|
23 |
+
<tr>
|
24 |
+
<td><?php esc_html_e( 'Save changes', 'code-snippets' ); ?></td>
|
25 |
+
<td><?php $this->render_keyboard_shortcut( 'Cmd', 'S' ); ?></td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td><?php esc_html_e( 'Begin searching', 'code-snippets' ); ?></td>
|
29 |
+
<td><?php $this->render_keyboard_shortcut( 'Cmd', 'F' ); ?></td>
|
30 |
+
</tr>
|
31 |
+
<tr>
|
32 |
+
<td><?php esc_html_e( 'Find next', 'code-snippets' ); ?></td>
|
33 |
+
<td><?php $this->render_keyboard_shortcut( 'Cmd', 'G' ); ?></td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td><?php esc_html_e( 'Find previous', 'code-snippets' ); ?></td>
|
37 |
+
<td><?php $this->render_keyboard_shortcut( array( 'Shift', 'Cmd' ), 'G' ); ?></td>
|
38 |
+
</tr>
|
39 |
+
<tr>
|
40 |
+
<td><?php esc_html_e( 'Replace', 'code-snippets' ); ?></td>
|
41 |
+
<td><?php $this->render_keyboard_shortcut( array( 'Shift', 'Cmd' ), 'F' ); ?></td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<td><?php esc_html_e( 'Replace all', 'code-snippets' ); ?></td>
|
45 |
+
<td><?php $this->render_keyboard_shortcut( array( 'Shift', 'Cmd', 'Option' ), 'R' ); ?></td>
|
46 |
+
</tr>
|
47 |
+
<tr>
|
48 |
+
<td><?php esc_html_e( 'Persistent search', 'code-snippets' ); ?></td>
|
49 |
+
<td><?php $this->render_keyboard_shortcut( 'Alt', 'F' ); ?></td>
|
50 |
+
</tr>
|
51 |
+
<tr>
|
52 |
+
<td><?php esc_html_e( 'Toggle Comment', 'code-snippets' ); ?></td>
|
53 |
+
<td><?php $this->render_keyboard_shortcut( 'Cmd', '/' ); ?></td>
|
54 |
+
</tr>
|
55 |
+
<tr>
|
56 |
+
<td><?php esc_html_e( 'Swap Line Up', 'code-snippets' ); ?></td>
|
57 |
+
<td><?php $this->render_keyboard_shortcut( 'Option', 'Up' ); ?></td>
|
58 |
+
</tr>
|
59 |
+
<tr>
|
60 |
+
<td><?php esc_html_e( 'Swap Line Down', 'code-snippets' ); ?></td>
|
61 |
+
<td><?php $this->render_keyboard_shortcut( 'Option', 'Down' ); ?></td>
|
62 |
+
</tr>
|
63 |
+
</table>
|
64 |
+
</div>
|
65 |
+
</div>
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Code Snippets ===
|
2 |
+
Contributors: bungeshea, ver3
|
3 |
+
Donate link: https://codesnippets.pro
|
4 |
+
Tags: snippets, functions, multisite, code, php, html, css, javascript
|
5 |
+
License: MIT
|
6 |
+
License URI: license.txt
|
7 |
+
Stable tag: 3.2.1
|
8 |
+
Tested up to: 6.0.1
|
9 |
+
|
10 |
+
An easy, clean and simple way to run code snippets on your site.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Code Snippets is an easy, clean and simple way to run code snippets on your site. It removes the need to add custom snippets to your theme's `functions.php` file.
|
15 |
+
|
16 |
+
[**Code Snippets Pro** is now available, with full CSS, JavaScript, Gutenberg and Elementor integrations.](https://codesnippets.pro/pricing/)
|
17 |
+
|
18 |
+
A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress-powered website; essentially a mini-plugin with less load on your site.
|
19 |
+
|
20 |
+
Most snippet-hosting sites tell you to add snippet code to your active theme's `functions.php` file, which can get rather long and messy after a while.
|
21 |
+
|
22 |
+
Code Snippets changes that by providing a GUI interface for adding snippets and **actually running them on your site** just as if they were in your theme's `functions.php` file.
|
23 |
+
|
24 |
+
**Quick overview of Code Snippets by Imran Siddiq**
|
25 |
+
|
26 |
+
https://youtu.be/EMjIWjcYONk
|
27 |
+
|
28 |
+
Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can be activated and deactivated, just like plugins.
|
29 |
+
|
30 |
+
The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, and a full-featured code editor. Snippets can be exported for transfer to another site, either in JSON for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme.
|
31 |
+
|
32 |
+
**Comprehensive Code Snippets tutorial with practical examples by Ferdy Korpershoek**
|
33 |
+
|
34 |
+
https://youtu.be/29jD2BcBX5w
|
35 |
+
|
36 |
+
If you have any feedback, issues, or suggestions for improvements please leave a topic in the [Support Forum](https://wordpress.org/support/plugin/code-snippets), [join the community on Facebook](https://facebook.com/groups/codesnippetsplugin), or [check us out on GitHub](https://github.com/sheabunge/code-snippets).
|
37 |
+
|
38 |
+
If you like this plugin, or it is useful to you in some way, please consider reviewing it on [WordPress.org](https://wordpress.org/support/view/plugin-reviews/code-snippets).
|
39 |
+
|
40 |
+
== Translations ==
|
41 |
+
|
42 |
+
Code Snippets can be used in these different languages thanks to the following translators:
|
43 |
+
|
44 |
+
* Belarusian – [Hrank.com](https://www.hrank.com)
|
45 |
+
* Brazilian Portuguese – [Bruno Borges](http://brunoborges.info)
|
46 |
+
* Chinese – [Jincheng Shan](http://shanjincheng.com) and [诗语](https://profiles.wordpress.org/f2010525/)
|
47 |
+
* Chinese (Taiwan) – [Alex Lion](https://www.alexclassroom.com/) and [Chun-Chih Cheng](https://profiles.wordpress.org/alex1114/)
|
48 |
+
* Croatian – [Borisa Djuraskovic from Web Hosting Hub](https://www.webhostinghub.com/)
|
49 |
+
* Czech – [Lukáš Tesař](mailto:lukastesar03@gmail.com) and [Jakub Humpolec](https://profiles.wordpress.org/jumphy/)
|
50 |
+
* Danish – [Finn Sommer Jensen](https://profiles.wordpress.org/finnsommer/)
|
51 |
+
* Dutch – [Sander Spies](https://github.com/sander1), [Peter Smits](https://psmits.com) and [mother.of.code.a11n](https://profiles.wordpress.org/imazed/)
|
52 |
+
* English (New Zealand) and English (UK) – [webaware](https://profiles.wordpress.org/webaware/)
|
53 |
+
* English (South Africa) – [webaware](https://profiles.wordpress.org/webaware/) and [Ian Barnes](https://profiles.wordpress.org/ianbarnes/)
|
54 |
+
* French – [momo-fr](https://www.momofr.net/), [Didier Demory](https://www.wptrads.com/), [Cyrille Sanson](https://100son.net/) and [Shea Bunge](https://sheabunge.com)
|
55 |
+
* French (Canada) – [Dominic Desbiens](https://www.dominicdesbiens.com/)
|
56 |
+
* German – [Mario Siegmann](https://web-alltag.de/), [Joerg Knoerchen](https://www.sensorgrafie.de/), [David Decker](https://deckerweb.de) and [Andreas](https://profiles.wordpress.org/perryzelda/)
|
57 |
+
* Greek – [Konstantinos Megas](https://profiles.wordpress.org/nextdoorpanda/) and [Toni Bishop from Jrop](https://www.jrop.com/)
|
58 |
+
* Indonesian – [Jordan Silaen from ChameleonJohn.com](https://www.chameleonjohn.com/)
|
59 |
+
* Italian – [Usman Wagan](https://coupontoaster.com/), [Luisa Ravelli](https://profiles.wordpress.org/darkavenger/) and [ElectricFeet](https://profiles.wordpress.org/electricfeet/)
|
60 |
+
* Japanese – [mt8](https://mt8.biz/), [Takakazu Nagaya](https://profiles.wordpress.org/tanagaya/), [Naoko Takano](https://naoko.blog/) and [melvas](https://profiles.wordpress.org/melvas/)
|
61 |
+
* Persian – [Mohammad Novintanon](http://mnovintan.ir/)
|
62 |
+
* Russian – [Alexander Samsonov](http://www.wordpressplugins.ru/administration/code-snippets.html), [Yui](https://profiles.wordpress.org/fierevere/), [Denis Yanchevskiy](https://denisco.pro/) and [krioteh](https://profiles.wordpress.org/krioteh/)
|
63 |
+
* Slovak – [Ján Fajčák](https://wp.sk)
|
64 |
+
* Spanish (Colombia) and Spanish (Ecuador) – [Javier Esteban](https://javieresteban.org/)
|
65 |
+
* Spanish (Spain) – [Ibidem Group](https://www.ibidemgroup.com), [Javier Esteban](https://javieresteban.org/), [Fernando Tellado](https://ayudawp.com/) and [Juanma Aranda](https://juanmaaranda.com/)
|
66 |
+
* Spanish (Venezuela) – [Yordan Soares](https://yordansoar.es/)
|
67 |
+
* Swedish – [Argentum](https://profiles.wordpress.org/argentum/), [Fredrik](https://profiles.wordpress.org/elbogen/) and [Tor-Bjorn Fjellner](https://profiles.wordpress.org/tobifjellner/)
|
68 |
+
* Urdu – [Samuel Badree](https://mobilemall.pk/)
|
69 |
+
* Vietnamese – [Tuan Phan](https://profiles.wordpress.org/khunglong/)
|
70 |
+
|
71 |
+
== Installation ==
|
72 |
+
|
73 |
+
= Automatic installation =
|
74 |
+
|
75 |
+
1. Log into your WordPress admin
|
76 |
+
2. Click __Plugins__
|
77 |
+
3. Click __Add New__
|
78 |
+
4. Search for __Code Snippets__
|
79 |
+
5. Click __Install Now__ under "Code Snippets"
|
80 |
+
6. Activate the plugin
|
81 |
+
|
82 |
+
= Manual installation =
|
83 |
+
|
84 |
+
1. Download the plugin
|
85 |
+
2. Extract the contents of the zip file
|
86 |
+
3. Upload the contents of the zip file to the `wp-content/plugins/` folder of your WordPress installation
|
87 |
+
4. Activate the Code Snippets plugin from 'Plugins' page.
|
88 |
+
|
89 |
+
Network Activating Code Snippets through the Network Dashboard will enable a special interface for running snippets across the entire network.
|
90 |
+
|
91 |
+
== Frequently Asked Questions ==
|
92 |
+
|
93 |
+
A full list of our Frequently Asked Questions can be found at [help.codesnippets.pro](https://help.codesnippets.pro/collection/3-faq).
|
94 |
+
|
95 |
+
= How can I recover my site if it is crashed by a buggy snippet? =
|
96 |
+
You can recover your site by enabling the Code Snippets safe mode feature. Instructions for how to turn it on are available here: <https://help.codesnippets.pro/article/12-safe-mode>.
|
97 |
+
|
98 |
+
= Will I lose my snippets if I change the theme or upgrade WordPress? =
|
99 |
+
No, the snippets are stored in the WordPress database, independent of the theme and unaffected by WordPress upgrades.
|
100 |
+
|
101 |
+
= Can the plugin be completely uninstalled? =
|
102 |
+
If you enable the 'Complete Uninstall' option on the plugin settings page, Code Snippets will clean up all of its data when deleted through the WordPress 'Plugins' menu. This includes all stored snippets. If you would like to preserve the snippets, ensure they are exported first.
|
103 |
+
|
104 |
+
= Can I copy snippets that I have created to another WordPress site? =
|
105 |
+
Yes! You can individually export a single snippet using the link below the snippet name on the 'Manage Snippets' page or bulk export multiple snippets using the 'Bulk Actions' feature. Snippets can later be imported using the 'Import Snippets' page by uploading the export file.
|
106 |
+
|
107 |
+
= Can I export my snippets to PHP for a site where I'm not using the Code Snippets plugin? =
|
108 |
+
Yes. Click the checkboxes next to the snippets you want to export, and then choose **Export to PHP** from the Bulk Actions menu and click Apply. The generated PHP file will contain the exported snippets' code, as well as their name and description in comments.
|
109 |
+
|
110 |
+
= Can I run network-wide snippets on a multisite installation? =
|
111 |
+
You can run snippets across an entire multisite network by **Network Activating** Code Snippets through the Network Dashboard. You can also activate Code Snippets just on the main site, and then individually on other sites of your choice.
|
112 |
+
|
113 |
+
= Where are the snippets stored in my WordPress database? =
|
114 |
+
Snippets are stored in the `wp_snippets` table in the WordPress database. The table name may differ depending on what your table prefix is set to.
|
115 |
+
|
116 |
+
= Where can I go for help or suggest new features? =
|
117 |
+
You can get help with Code Snippets, report bugs or errors, and suggest new features and improvements either on the [WordPress Support Forums](https://wordpress.org/support/plugin/code-snippets) or on [GitHub](https://github.com/sheabunge/code-snippets)
|
118 |
+
|
119 |
+
= How can I help contribute to the development of the Code Snippets plugin? =
|
120 |
+
The best way to do this is to fork the [repository on GitHub](https://github.com/sheabunge/code-snippets) and send a pull request.
|
121 |
+
|
122 |
+
== Screenshots ==
|
123 |
+
|
124 |
+
1. Managing existing snippets
|
125 |
+
2. Adding a new snippet
|
126 |
+
3. Editing a snippet
|
127 |
+
4. Importing snippets from an export file
|
128 |
+
|
129 |
+
== Changelog ==
|
130 |
+
|
131 |
+
= 3.2.1 (05 Oct 2022) =
|
132 |
+
* Fixed: Issue making survey reminder notice not dismissible.
|
133 |
+
* Added: `Ctrl`+`/` or `Cmd`+`/` as shortcut for commenting out code in the snippet editor.
|
134 |
+
* Added: Additional hooks to various snippet actions, thanks to contributions made by [ancient-spirit](https://github.com/ancient-spirit).
|
135 |
+
* Added: Fold markers, additional keyboard shortcuts and keymap options to snippet editor,
|
136 |
+
thanks to contributions made by [Amaral Krichman](https://github.com/karmaral).
|
137 |
+
* Improved: Removed duplicate tables exist query. ([#](https://wordpress.org/support/topic/duplicate-queries-21)).
|
138 |
+
* Improved: Enabled 'add paragraphs and formatting' option by default for newly inserted content snippets.
|
139 |
+
* Added: WP-CLI commands for retrieving, activating, deactivating, deleting, creating, updating, exporting and importing snippets.
|
140 |
+
* Fixed: Path to iron visible when updating the pro plugin.
|
141 |
+
|
142 |
+
= 3.2.0 (22 July 2022) =
|
143 |
+
* Fixed: Remove default value from SQL columns to improve compatibility with certain versions of MySQL.
|
144 |
+
* Fixed: Delay loading snippets in Gutenberg editor blocks. (PRO)
|
145 |
+
* Added: Option to show and hide line numbers in Gutenberg source code editor block. (PRO)
|
146 |
+
* Added: Support for highlighting HTML, CSS, JS and embedded code in the front-end PrismJS code highlighter.
|
147 |
+
* Added: Additional features to front-end PrismJS code highlighter, including automatic links and a copy button.
|
148 |
+
* Added: Support for multiple code styles in the source code Gutenberg editor block. (PRO)
|
149 |
+
* Added: Admin notice announcing release of Code Snippets Pro.
|
150 |
+
* Fixed: Inconsistencies with translations between different plugin versions.
|
151 |
+
* Fixed: Issue with Content Snippet shortcode information not displaying.
|
152 |
+
* Added: Button for copying shortcode text to clipboard.
|
153 |
+
* Improved: Include Code Snippets CSS and JS source code in distributed package.
|
154 |
+
* Improved: Don't delete data from plugin if deleting Code Snippets Free while Code Snippets Pro is active.
|
155 |
+
* Improved: Streamlined user interface and experience in Gutenberg editor blocks. (PRO)
|
156 |
+
* Added: Option to choose from 44 different themes for the Prism code highlighter in the source editor block and Elementor widget. (PRO)
|
157 |
+
* Improved: Compatibility of Elementor widgets with the latest version of Elementor. (PRO)
|
158 |
+
* Improved: Replace icon font menu icon with embedded SVG icon.
|
159 |
+
|
160 |
+
= 3.1.2 (3 July 2022) =
|
161 |
+
* Updated external links and branding for Code Snippets Pro.
|
162 |
+
* Improved: Add link URLs to settings pages, as an alternative to in-page navigation.
|
163 |
+
* Fixed: Various fixes to block editor scripts. (PRO)
|
164 |
+
* Fixed: Improved visual style of Gutenberg editor blocks. (PRO)
|
165 |
+
|
166 |
+
= 3.1.1 (13 Jun 2022) =
|
167 |
+
* Fixed: Download snippets feature not including snippet content.
|
168 |
+
* Fixed: Alignment of 'opens externally' dashicon.
|
169 |
+
* Improved: Added additional parameters to `code_snippets/export/filename` filter.
|
170 |
+
|
171 |
+
= 3.1.0 (17 May 2022) =
|
172 |
+
* Fixed: Caching inconsistencies preventing snippets and settings from refreshing on sites with persistent object caching.
|
173 |
+
* Improved: Simplified database queries.
|
174 |
+
* Added: More comprehensive cache coverage, including for active snippets.
|
175 |
+
* Added: Icon to 'Go Pro' button indicating it opens an external tab.
|
176 |
+
* Improved: Allow display styles in snippet descriptions.
|
177 |
+
|
178 |
+
= 3.0.1 (14 May 2022) =
|
179 |
+
* Fixed: Incompatibility issue with earlier versions of PHP.
|
180 |
+
|
181 |
+
= 3.0.0 (14 May 2022) =
|
182 |
+
|
183 |
+
__Added__
|
184 |
+
|
185 |
+
* Added: HTML content snippets for displaying as shortcodes or including in the page head or footer area.
|
186 |
+
* Added: Notice reminding users to upgrade unsupported PHP versions.
|
187 |
+
* Added: Visual settings to add attributes to shortcodes.
|
188 |
+
* Added: Shortcode buttons to the post and page content editors.
|
189 |
+
* Added: Basic REST API endpoints.
|
190 |
+
* Added: Snippet type column to the snippets table.
|
191 |
+
* Added: Snippet type badges to Edit and Add New Snippet pages.
|
192 |
+
* Added: Setting to control whether the current line of the code editor is highlighted.
|
193 |
+
* Added: Display a warning when saving a snippet with missing title or code.
|
194 |
+
* Added: Add suffix to title of cloned snippets.
|
195 |
+
|
196 |
+
__Changed__
|
197 |
+
|
198 |
+
* Improved: Updated plugin code to use namespaces, preventing name collisions with other plugins.
|
199 |
+
* Improved: Added key for the 'active' and 'scope' database table columns to speed up queries.
|
200 |
+
* Improved: Redirect from edit menu if not editing a valid snippet.
|
201 |
+
* Improved: Moved activation switch into its own table column.
|
202 |
+
* Improved: Updated code documentation according to WordPress standards.
|
203 |
+
* Improved: Added snippet type labels to the tabs on the Snippets page.
|
204 |
+
* Improved: Split settings page into tabs.
|
205 |
+
* Improved: Use the version of CodeMirror included with WordPress where possible to inherit the additional built-in features.
|
206 |
+
* Improved: Added hover effect to priority settings in the snippets table to show that they are editable.
|
207 |
+
* Fixed: Snippets table layout on smaller screens.
|
208 |
+
|
209 |
+
__Deprecated__
|
210 |
+
|
211 |
+
* Removed: Deprecated functions and compatibility code for unsupported PHP versions.
|
212 |
+
* Removed: Option to disable snippet scopes.
|
213 |
+
|
214 |
+
__New in Pro__
|
215 |
+
|
216 |
+
* Added: CSS style snippets for the site front-end and admin area.
|
217 |
+
* Added: JavaScript snippets for the site head and body area on the front-end.
|
218 |
+
* Added: Browser cache versioning for CSS and JavaScript snippets.
|
219 |
+
* Added: Support for exporting and downloading CSS and JavaScript snippets.
|
220 |
+
* Added: Support for highlighting code on the front-end.
|
221 |
+
* Added: Editor syntax highlighting for CSS, JavaScript and HTML snippets.
|
222 |
+
* Added: Button to preview full file when editing CSS or JavaScript snippets.
|
223 |
+
* Added: Option to minify CSS and JavaScript snippets.
|
224 |
+
* Added: Gutenberg editor block for displaying content snippets.
|
225 |
+
* Added: Gutenberg editor block for displaying snippet source code.
|
226 |
+
* Added: Elementor widget for displaying content snippets.
|
227 |
+
* Added: Elementor widget for displaying snippet source code.
|
228 |
+
|
229 |
+
= 2.14.6 (13 May 2022) =
|
230 |
+
* Fixed: Issue with processing uploaded import files.
|
231 |
+
* Fixed: Issue with processing tag filters.
|
232 |
+
|
233 |
+
= 2.14.5 (10 May 2022) =
|
234 |
+
* Fixed: Incompatibility issue with older versions of PHP.
|
235 |
+
|
236 |
+
= 2.14.4 (5 May 2022) =
|
237 |
+
* Fixed: Prevent array key errors when loading the snippet table with unknown order values.
|
238 |
+
|
239 |
+
= 2.14.3 (10 Dec 2021) =
|
240 |
+
* Fixed: Potential security issue outputting snippets-safe-mode query variable value as-is. Thanks to Krzysztof Zając for reporting.
|
241 |
+
|
242 |
+
= 2.14.2 (9 Sep 2021) =
|
243 |
+
* Fixed: Prevent network snippets table from being created on single-site installs.
|
244 |
+
* Added translations:
|
245 |
+
- Spanish by [Ibidem Group](https://www.ibidemgroup.com)
|
246 |
+
- Urdu by [Samuel Badree](https://mobilemall.pk/)
|
247 |
+
- Greek by [Toni Bishop from Jrop](https://www.jrop.com/)
|
248 |
+
* Added: Support for `:class` syntax to the code validator.
|
249 |
+
* Added: PHP8 support to the code linter.
|
250 |
+
* Added: Color picker feature to the code editor.
|
251 |
+
* Added: Failsafe to prevent multiple versions of Code Snippets from running simultaneously.
|
252 |
+
|
253 |
+
= 2.14.1 (10 Mar 2021) =
|
254 |
+
* Added: Czech translation by [Lukáš Tesař](https://github.com/atomicf4ll).
|
255 |
+
* Fixed: Code validator now supports `function_exists` and `class_exists` checks.
|
256 |
+
* Fixed: Code validator now supports anonymous functions.
|
257 |
+
* Fixed: Issue with saving the hidden columns setting.
|
258 |
+
* Fixed: Replaced the outdated tag-it library with [tagger](https://github.com/jcubic/tagger) for powering the snippet tags editor.
|
259 |
+
* Added: Code direction setting for RTL users.
|
260 |
+
* Updated CodeMirror to version 5.59.4.
|
261 |
+
* Added: Additional action hooks and search API thanks to [@Spreeuw](https://github.com/Spreeuw).
|
262 |
+
|
263 |
+
= 2.14.0 (26 Jan 2020) =
|
264 |
+
* Updated CodeMirror to version 5.50.2.
|
265 |
+
* Added: Basic error checking for duplicate functions and classes.
|
266 |
+
* Updated Italian translations to fix display issues – thanks to [Francesco Marino](https://360fun.net).
|
267 |
+
* Fixed: Ordering snippets in the table by name will now be case-insensitive.
|
268 |
+
* Added: Additional API options for retrieving snippets.
|
269 |
+
* Fixed: Code editor will now properly highlight embedded HTML, CSS and JavaScript code.
|
270 |
+
* Changed the indicator color for inactive snippets from red to grey.
|
271 |
+
* Fixed a bug preventing the editor theme from being set to default.
|
272 |
+
* Added: Store the time and date when each snippet was last modified.
|
273 |
+
* Added: Basic error checking when activating snippets.
|
274 |
+
* Fixed: Ensure that imported snippets are always inactive.
|
275 |
+
* Fixed: Check the referer on the import menu to prevent CSRF attacks. Thanks to [Chloe with the Wordfence Threat Intelligence team](https://www.wordfence.com/blog/author/wfchloe/) for reporting.
|
276 |
+
* Fixed: Ensure that individual snippet action links use proper verification.
|
277 |
+
|
278 |
+
**[The full changelog is available on GitHub](https://github.com/sheabunge/code-snippets/blob/master/CHANGELOG.md)**
|
279 |
+
|
280 |
+
== Upgrade Notice ==
|
281 |
+
|
282 |
+
= 3.2.1 =
|
283 |
+
WP-CLI features in Code Snippets Pro: manage your snippets from the command line.
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cleans up data created by this plugin
|
4 |
+
*
|
5 |
+
* @package Code_Snippets
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Code_Snippets\Uninstall;
|
10 |
+
|
11 |
+
// Ensure this plugin is actually being uninstalled.
|
12 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) || defined( 'CODE_SNIPPETS_PRO' ) && CODE_SNIPPETS_PRO ) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
|
16 |
+
require_once __DIR__ . '/php/uninstall.php';
|
17 |
+
|
18 |
+
uninstall_plugin();
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit1ffd5c3c5ebc59c9193e93ae5336da2f::getLoader();
|
@@ -0,0 +1,481 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see https://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see https://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
private $vendorDir;
|
46 |
+
|
47 |
+
// PSR-4
|
48 |
+
private $prefixLengthsPsr4 = array();
|
49 |
+
private $prefixDirsPsr4 = array();
|
50 |
+
private $fallbackDirsPsr4 = array();
|
51 |
+
|
52 |
+
// PSR-0
|
53 |
+
private $prefixesPsr0 = array();
|
54 |
+
private $fallbackDirsPsr0 = array();
|
55 |
+
|
56 |
+
private $useIncludePath = false;
|
57 |
+
private $classMap = array();
|
58 |
+
private $classMapAuthoritative = false;
|
59 |
+
private $missingClasses = array();
|
60 |
+
private $apcuPrefix;
|
61 |
+
|
62 |
+
private static $registeredLoaders = array();
|
63 |
+
|
64 |
+
public function __construct($vendorDir = null)
|
65 |
+
{
|
66 |
+
$this->vendorDir = $vendorDir;
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixes()
|
70 |
+
{
|
71 |
+
if (!empty($this->prefixesPsr0)) {
|
72 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
73 |
+
}
|
74 |
+
|
75 |
+
return array();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getPrefixesPsr4()
|
79 |
+
{
|
80 |
+
return $this->prefixDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getFallbackDirs()
|
84 |
+
{
|
85 |
+
return $this->fallbackDirsPsr0;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getFallbackDirsPsr4()
|
89 |
+
{
|
90 |
+
return $this->fallbackDirsPsr4;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getClassMap()
|
94 |
+
{
|
95 |
+
return $this->classMap;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @param array $classMap Class to filename map
|
100 |
+
*/
|
101 |
+
public function addClassMap(array $classMap)
|
102 |
+
{
|
103 |
+
if ($this->classMap) {
|
104 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
105 |
+
} else {
|
106 |
+
$this->classMap = $classMap;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
112 |
+
* appending or prepending to the ones previously set for this prefix.
|
113 |
+
*
|
114 |
+
* @param string $prefix The prefix
|
115 |
+
* @param array|string $paths The PSR-0 root directories
|
116 |
+
* @param bool $prepend Whether to prepend the directories
|
117 |
+
*/
|
118 |
+
public function add($prefix, $paths, $prepend = false)
|
119 |
+
{
|
120 |
+
if (!$prefix) {
|
121 |
+
if ($prepend) {
|
122 |
+
$this->fallbackDirsPsr0 = array_merge(
|
123 |
+
(array) $paths,
|
124 |
+
$this->fallbackDirsPsr0
|
125 |
+
);
|
126 |
+
} else {
|
127 |
+
$this->fallbackDirsPsr0 = array_merge(
|
128 |
+
$this->fallbackDirsPsr0,
|
129 |
+
(array) $paths
|
130 |
+
);
|
131 |
+
}
|
132 |
+
|
133 |
+
return;
|
134 |
+
}
|
135 |
+
|
136 |
+
$first = $prefix[0];
|
137 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
139 |
+
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
if ($prepend) {
|
143 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
144 |
+
(array) $paths,
|
145 |
+
$this->prefixesPsr0[$first][$prefix]
|
146 |
+
);
|
147 |
+
} else {
|
148 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
149 |
+
$this->prefixesPsr0[$first][$prefix],
|
150 |
+
(array) $paths
|
151 |
+
);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
157 |
+
* appending or prepending to the ones previously set for this namespace.
|
158 |
+
*
|
159 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
160 |
+
* @param array|string $paths The PSR-4 base directories
|
161 |
+
* @param bool $prepend Whether to prepend the directories
|
162 |
+
*
|
163 |
+
* @throws \InvalidArgumentException
|
164 |
+
*/
|
165 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
166 |
+
{
|
167 |
+
if (!$prefix) {
|
168 |
+
// Register directories for the root namespace.
|
169 |
+
if ($prepend) {
|
170 |
+
$this->fallbackDirsPsr4 = array_merge(
|
171 |
+
(array) $paths,
|
172 |
+
$this->fallbackDirsPsr4
|
173 |
+
);
|
174 |
+
} else {
|
175 |
+
$this->fallbackDirsPsr4 = array_merge(
|
176 |
+
$this->fallbackDirsPsr4,
|
177 |
+
(array) $paths
|
178 |
+
);
|
179 |
+
}
|
180 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
181 |
+
// Register directories for a new namespace.
|
182 |
+
$length = strlen($prefix);
|
183 |
+
if ('\\' !== $prefix[$length - 1]) {
|
184 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
185 |
+
}
|
186 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
187 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
188 |
+
} elseif ($prepend) {
|
189 |
+
// Prepend directories for an already registered namespace.
|
190 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
191 |
+
(array) $paths,
|
192 |
+
$this->prefixDirsPsr4[$prefix]
|
193 |
+
);
|
194 |
+
} else {
|
195 |
+
// Append directories for an already registered namespace.
|
196 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
197 |
+
$this->prefixDirsPsr4[$prefix],
|
198 |
+
(array) $paths
|
199 |
+
);
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
205 |
+
* replacing any others previously set for this prefix.
|
206 |
+
*
|
207 |
+
* @param string $prefix The prefix
|
208 |
+
* @param array|string $paths The PSR-0 base directories
|
209 |
+
*/
|
210 |
+
public function set($prefix, $paths)
|
211 |
+
{
|
212 |
+
if (!$prefix) {
|
213 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
214 |
+
} else {
|
215 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
221 |
+
* replacing any others previously set for this namespace.
|
222 |
+
*
|
223 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
224 |
+
* @param array|string $paths The PSR-4 base directories
|
225 |
+
*
|
226 |
+
* @throws \InvalidArgumentException
|
227 |
+
*/
|
228 |
+
public function setPsr4($prefix, $paths)
|
229 |
+
{
|
230 |
+
if (!$prefix) {
|
231 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
232 |
+
} else {
|
233 |
+
$length = strlen($prefix);
|
234 |
+
if ('\\' !== $prefix[$length - 1]) {
|
235 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
236 |
+
}
|
237 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
238 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Turns on searching the include path for class files.
|
244 |
+
*
|
245 |
+
* @param bool $useIncludePath
|
246 |
+
*/
|
247 |
+
public function setUseIncludePath($useIncludePath)
|
248 |
+
{
|
249 |
+
$this->useIncludePath = $useIncludePath;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Can be used to check if the autoloader uses the include path to check
|
254 |
+
* for classes.
|
255 |
+
*
|
256 |
+
* @return bool
|
257 |
+
*/
|
258 |
+
public function getUseIncludePath()
|
259 |
+
{
|
260 |
+
return $this->useIncludePath;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Turns off searching the prefix and fallback directories for classes
|
265 |
+
* that have not been registered with the class map.
|
266 |
+
*
|
267 |
+
* @param bool $classMapAuthoritative
|
268 |
+
*/
|
269 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
270 |
+
{
|
271 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Should class lookup fail if not found in the current class map?
|
276 |
+
*
|
277 |
+
* @return bool
|
278 |
+
*/
|
279 |
+
public function isClassMapAuthoritative()
|
280 |
+
{
|
281 |
+
return $this->classMapAuthoritative;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
286 |
+
*
|
287 |
+
* @param string|null $apcuPrefix
|
288 |
+
*/
|
289 |
+
public function setApcuPrefix($apcuPrefix)
|
290 |
+
{
|
291 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
296 |
+
*
|
297 |
+
* @return string|null
|
298 |
+
*/
|
299 |
+
public function getApcuPrefix()
|
300 |
+
{
|
301 |
+
return $this->apcuPrefix;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Registers this instance as an autoloader.
|
306 |
+
*
|
307 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
308 |
+
*/
|
309 |
+
public function register($prepend = false)
|
310 |
+
{
|
311 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
312 |
+
|
313 |
+
if (null === $this->vendorDir) {
|
314 |
+
return;
|
315 |
+
}
|
316 |
+
|
317 |
+
if ($prepend) {
|
318 |
+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
319 |
+
} else {
|
320 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
321 |
+
self::$registeredLoaders[$this->vendorDir] = $this;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Unregisters this instance as an autoloader.
|
327 |
+
*/
|
328 |
+
public function unregister()
|
329 |
+
{
|
330 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
331 |
+
|
332 |
+
if (null !== $this->vendorDir) {
|
333 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Loads the given class or interface.
|
339 |
+
*
|
340 |
+
* @param string $class The name of the class
|
341 |
+
* @return true|null True if loaded, null otherwise
|
342 |
+
*/
|
343 |
+
public function loadClass($class)
|
344 |
+
{
|
345 |
+
if ($file = $this->findFile($class)) {
|
346 |
+
includeFile($file);
|
347 |
+
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
|
351 |
+
return null;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Finds the path to the file where the class is defined.
|
356 |
+
*
|
357 |
+
* @param string $class The name of the class
|
358 |
+
*
|
359 |
+
* @return string|false The path if found, false otherwise
|
360 |
+
*/
|
361 |
+
public function findFile($class)
|
362 |
+
{
|
363 |
+
// class map lookup
|
364 |
+
if (isset($this->classMap[$class])) {
|
365 |
+
return $this->classMap[$class];
|
366 |
+
}
|
367 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
368 |
+
return false;
|
369 |
+
}
|
370 |
+
if (null !== $this->apcuPrefix) {
|
371 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
372 |
+
if ($hit) {
|
373 |
+
return $file;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
$file = $this->findFileWithExtension($class, '.php');
|
378 |
+
|
379 |
+
// Search for Hack files if we are running on HHVM
|
380 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
381 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
382 |
+
}
|
383 |
+
|
384 |
+
if (null !== $this->apcuPrefix) {
|
385 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
386 |
+
}
|
387 |
+
|
388 |
+
if (false === $file) {
|
389 |
+
// Remember that this class does not exist.
|
390 |
+
$this->missingClasses[$class] = true;
|
391 |
+
}
|
392 |
+
|
393 |
+
return $file;
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
398 |
+
*
|
399 |
+
* @return self[]
|
400 |
+
*/
|
401 |
+
public static function getRegisteredLoaders()
|
402 |
+
{
|
403 |
+
return self::$registeredLoaders;
|
404 |
+
}
|
405 |
+
|
406 |
+
private function findFileWithExtension($class, $ext)
|
407 |
+
{
|
408 |
+
// PSR-4 lookup
|
409 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
410 |
+
|
411 |
+
$first = $class[0];
|
412 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
413 |
+
$subPath = $class;
|
414 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
415 |
+
$subPath = substr($subPath, 0, $lastPos);
|
416 |
+
$search = $subPath . '\\';
|
417 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
418 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
419 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
420 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
421 |
+
return $file;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-4 fallback dirs
|
429 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
430 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
431 |
+
return $file;
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
// PSR-0 lookup
|
436 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
437 |
+
// namespaced class name
|
438 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
439 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
440 |
+
} else {
|
441 |
+
// PEAR-like class name
|
442 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
443 |
+
}
|
444 |
+
|
445 |
+
if (isset($this->prefixesPsr0[$first])) {
|
446 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
447 |
+
if (0 === strpos($class, $prefix)) {
|
448 |
+
foreach ($dirs as $dir) {
|
449 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
450 |
+
return $file;
|
451 |
+
}
|
452 |
+
}
|
453 |
+
}
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
+
// PSR-0 fallback dirs
|
458 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
459 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
460 |
+
return $file;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
|
464 |
+
// PSR-0 include paths.
|
465 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
466 |
+
return $file;
|
467 |
+
}
|
468 |
+
|
469 |
+
return false;
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Scope isolated include.
|
475 |
+
*
|
476 |
+
* Prevents access to $this/self from included files.
|
477 |
+
*/
|
478 |
+
function includeFile($file)
|
479 |
+
{
|
480 |
+
include $file;
|
481 |
+
}
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer;
|
14 |
+
|
15 |
+
use Composer\Autoload\ClassLoader;
|
16 |
+
use Composer\Semver\VersionParser;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class is copied in every Composer installed project and available to all
|
20 |
+
*
|
21 |
+
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
+
*
|
23 |
+
* To require it's presence, you can require `composer-runtime-api ^2.0`
|
24 |
+
*/
|
25 |
+
class InstalledVersions
|
26 |
+
{
|
27 |
+
private static $installed;
|
28 |
+
private static $canGetVendors;
|
29 |
+
private static $installedByVendor = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
33 |
+
*
|
34 |
+
* @return string[]
|
35 |
+
* @psalm-return list<string>
|
36 |
+
*/
|
37 |
+
public static function getInstalledPackages()
|
38 |
+
{
|
39 |
+
$packages = array();
|
40 |
+
foreach (self::getInstalled() as $installed) {
|
41 |
+
$packages[] = array_keys($installed['versions']);
|
42 |
+
}
|
43 |
+
|
44 |
+
if (1 === \count($packages)) {
|
45 |
+
return $packages[0];
|
46 |
+
}
|
47 |
+
|
48 |
+
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns a list of all package names with a specific type e.g. 'library'
|
53 |
+
*
|
54 |
+
* @param string $type
|
55 |
+
* @return string[]
|
56 |
+
* @psalm-return list<string>
|
57 |
+
*/
|
58 |
+
public static function getInstalledPackagesByType($type)
|
59 |
+
{
|
60 |
+
$packagesByType = array();
|
61 |
+
|
62 |
+
foreach (self::getInstalled() as $installed) {
|
63 |
+
foreach ($installed['versions'] as $name => $package) {
|
64 |
+
if (isset($package['type']) && $package['type'] === $type) {
|
65 |
+
$packagesByType[] = $name;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $packagesByType;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Checks whether the given package is installed
|
75 |
+
*
|
76 |
+
* This also returns true if the package name is provided or replaced by another package
|
77 |
+
*
|
78 |
+
* @param string $packageName
|
79 |
+
* @param bool $includeDevRequirements
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
public static function isInstalled($packageName, $includeDevRequirements = true)
|
83 |
+
{
|
84 |
+
foreach (self::getInstalled() as $installed) {
|
85 |
+
if (isset($installed['versions'][$packageName])) {
|
86 |
+
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Checks whether the given package satisfies a version constraint
|
95 |
+
*
|
96 |
+
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
97 |
+
*
|
98 |
+
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
99 |
+
*
|
100 |
+
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
101 |
+
* @param string $packageName
|
102 |
+
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
106 |
+
{
|
107 |
+
$constraint = $parser->parseConstraints($constraint);
|
108 |
+
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
109 |
+
|
110 |
+
return $provided->matches($constraint);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns a version constraint representing all the range(s) which are installed for a given package
|
115 |
+
*
|
116 |
+
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
117 |
+
* whether a given version of a package is installed, and not just whether it exists
|
118 |
+
*
|
119 |
+
* @param string $packageName
|
120 |
+
* @return string Version constraint usable with composer/semver
|
121 |
+
*/
|
122 |
+
public static function getVersionRanges($packageName)
|
123 |
+
{
|
124 |
+
foreach (self::getInstalled() as $installed) {
|
125 |
+
if (!isset($installed['versions'][$packageName])) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
+
$ranges = array();
|
130 |
+
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
131 |
+
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
132 |
+
}
|
133 |
+
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
134 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
135 |
+
}
|
136 |
+
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
137 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
138 |
+
}
|
139 |
+
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
140 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
141 |
+
}
|
142 |
+
|
143 |
+
return implode(' || ', $ranges);
|
144 |
+
}
|
145 |
+
|
146 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param string $packageName
|
151 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
152 |
+
*/
|
153 |
+
public static function getVersion($packageName)
|
154 |
+
{
|
155 |
+
foreach (self::getInstalled() as $installed) {
|
156 |
+
if (!isset($installed['versions'][$packageName])) {
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!isset($installed['versions'][$packageName]['version'])) {
|
161 |
+
return null;
|
162 |
+
}
|
163 |
+
|
164 |
+
return $installed['versions'][$packageName]['version'];
|
165 |
+
}
|
166 |
+
|
167 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param string $packageName
|
172 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
173 |
+
*/
|
174 |
+
public static function getPrettyVersion($packageName)
|
175 |
+
{
|
176 |
+
foreach (self::getInstalled() as $installed) {
|
177 |
+
if (!isset($installed['versions'][$packageName])) {
|
178 |
+
continue;
|
179 |
+
}
|
180 |
+
|
181 |
+
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
182 |
+
return null;
|
183 |
+
}
|
184 |
+
|
185 |
+
return $installed['versions'][$packageName]['pretty_version'];
|
186 |
+
}
|
187 |
+
|
188 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param string $packageName
|
193 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
194 |
+
*/
|
195 |
+
public static function getReference($packageName)
|
196 |
+
{
|
197 |
+
foreach (self::getInstalled() as $installed) {
|
198 |
+
if (!isset($installed['versions'][$packageName])) {
|
199 |
+
continue;
|
200 |
+
}
|
201 |
+
|
202 |
+
if (!isset($installed['versions'][$packageName]['reference'])) {
|
203 |
+
return null;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $installed['versions'][$packageName]['reference'];
|
207 |
+
}
|
208 |
+
|
209 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @param string $packageName
|
214 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
215 |
+
*/
|
216 |
+
public static function getInstallPath($packageName)
|
217 |
+
{
|
218 |
+
foreach (self::getInstalled() as $installed) {
|
219 |
+
if (!isset($installed['versions'][$packageName])) {
|
220 |
+
continue;
|
221 |
+
}
|
222 |
+
|
223 |
+
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
224 |
+
}
|
225 |
+
|
226 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* @return array
|
231 |
+
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
|
232 |
+
*/
|
233 |
+
public static function getRootPackage()
|
234 |
+
{
|
235 |
+
$installed = self::getInstalled();
|
236 |
+
|
237 |
+
return $installed[0]['root'];
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Returns the raw installed.php data for custom implementations
|
242 |
+
*
|
243 |
+
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
244 |
+
* @return array[]
|
245 |
+
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
|
246 |
+
*/
|
247 |
+
public static function getRawData()
|
248 |
+
{
|
249 |
+
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
250 |
+
|
251 |
+
if (null === self::$installed) {
|
252 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
253 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
254 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
255 |
+
self::$installed = include __DIR__ . '/installed.php';
|
256 |
+
} else {
|
257 |
+
self::$installed = array();
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
return self::$installed;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
266 |
+
*
|
267 |
+
* @return array[]
|
268 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
|
269 |
+
*/
|
270 |
+
public static function getAllRawData()
|
271 |
+
{
|
272 |
+
return self::getInstalled();
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Lets you reload the static array from another file
|
277 |
+
*
|
278 |
+
* This is only useful for complex integrations in which a project needs to use
|
279 |
+
* this class but then also needs to execute another project's autoloader in process,
|
280 |
+
* and wants to ensure both projects have access to their version of installed.php.
|
281 |
+
*
|
282 |
+
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
283 |
+
* the data it needs from this class, then call reload() with
|
284 |
+
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
285 |
+
* the project in which it runs can then also use this class safely, without
|
286 |
+
* interference between PHPUnit's dependencies and the project's dependencies.
|
287 |
+
*
|
288 |
+
* @param array[] $data A vendor/composer/installed.php data set
|
289 |
+
* @return void
|
290 |
+
*
|
291 |
+
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
|
292 |
+
*/
|
293 |
+
public static function reload($data)
|
294 |
+
{
|
295 |
+
self::$installed = $data;
|
296 |
+
self::$installedByVendor = array();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* @return array[]
|
301 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
|
302 |
+
*/
|
303 |
+
private static function getInstalled()
|
304 |
+
{
|
305 |
+
if (null === self::$canGetVendors) {
|
306 |
+
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
307 |
+
}
|
308 |
+
|
309 |
+
$installed = array();
|
310 |
+
|
311 |
+
if (self::$canGetVendors) {
|
312 |
+
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
313 |
+
if (isset(self::$installedByVendor[$vendorDir])) {
|
314 |
+
$installed[] = self::$installedByVendor[$vendorDir];
|
315 |
+
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
316 |
+
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
317 |
+
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
318 |
+
self::$installed = $installed[count($installed) - 1];
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
if (null === self::$installed) {
|
325 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
326 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
327 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
328 |
+
self::$installed = require __DIR__ . '/installed.php';
|
329 |
+
} else {
|
330 |
+
self::$installed = array();
|
331 |
+
}
|
332 |
+
}
|
333 |
+
$installed[] = self::$installed;
|
334 |
+
|
335 |
+
return $installed;
|
336 |
+
}
|
337 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Code_Snippets\\Active_Snippets' => $baseDir . '/php/class-active-snippets.php',
|
10 |
+
'Code_Snippets\\Admin' => $baseDir . '/php/class-admin.php',
|
11 |
+
'Code_Snippets\\Admin_Menu' => $baseDir . '/php/admin-menus/class-admin-menu.php',
|
12 |
+
'Code_Snippets\\Contextual_Help' => $baseDir . '/php/class-contextual-help.php',
|
13 |
+
'Code_Snippets\\DB' => $baseDir . '/php/class-db.php',
|
14 |
+
'Code_Snippets\\Edit_Menu' => $baseDir . '/php/admin-menus/class-edit-menu.php',
|
15 |
+
'Code_Snippets\\Export' => $baseDir . '/php/export/class-export.php',
|
16 |
+
'Code_Snippets\\Export_Attachment' => $baseDir . '/php/export/class-export-attachment.php',
|
17 |
+
'Code_Snippets\\Frontend' => $baseDir . '/php/front-end/class-frontend.php',
|
18 |
+
'Code_Snippets\\Import' => $baseDir . '/php/export/class-import.php',
|
19 |
+
'Code_Snippets\\Import_Menu' => $baseDir . '/php/admin-menus/class-import-menu.php',
|
20 |
+
'Code_Snippets\\List_Table' => $baseDir . '/php/class-list-table.php',
|
21 |
+
'Code_Snippets\\Manage_Menu' => $baseDir . '/php/admin-menus/class-manage-menu.php',
|
22 |
+
'Code_Snippets\\Plugin' => $baseDir . '/php/class-plugin.php',
|
23 |
+
'Code_Snippets\\REST_API' => $baseDir . '/php/class-rest-api.php',
|
24 |
+
'Code_Snippets\\Settings\\Setting_Field' => $baseDir . '/php/settings/class-setting-field.php',
|
25 |
+
'Code_Snippets\\Settings_Menu' => $baseDir . '/php/admin-menus/class-settings-menu.php',
|
26 |
+
'Code_Snippets\\Snippet' => $baseDir . '/php/class-snippet.php',
|
27 |
+
'Code_Snippets\\Upgrade' => $baseDir . '/php/class-upgrade.php',
|
28 |
+
'Code_Snippets\\Validator' => $baseDir . '/php/class-validator.php',
|
29 |
+
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
30 |
+
);
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
|
10 |
+
);
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit1ffd5c3c5ebc59c9193e93ae5336da2f
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
+
public static function getLoader()
|
20 |
+
{
|
21 |
+
if (null !== self::$loader) {
|
22 |
+
return self::$loader;
|
23 |
+
}
|
24 |
+
|
25 |
+
require __DIR__ . '/platform_check.php';
|
26 |
+
|
27 |
+
spl_autoload_register(array('ComposerAutoloaderInit1ffd5c3c5ebc59c9193e93ae5336da2f', 'loadClassLoader'), true, true);
|
28 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
29 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit1ffd5c3c5ebc59c9193e93ae5336da2f', 'loadClassLoader'));
|
30 |
+
|
31 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
32 |
+
if ($useStaticLoader) {
|
33 |
+
require __DIR__ . '/autoload_static.php';
|
34 |
+
|
35 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit1ffd5c3c5ebc59c9193e93ae5336da2f::getInitializer($loader));
|
36 |
+
} else {
|
37 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->set($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
43 |
+
foreach ($map as $namespace => $path) {
|
44 |
+
$loader->setPsr4($namespace, $path);
|
45 |
+
}
|
46 |
+
|
47 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
48 |
+
if ($classMap) {
|
49 |
+
$loader->addClassMap($classMap);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
$loader->register(true);
|
54 |
+
|
55 |
+
return $loader;
|
56 |
+
}
|
57 |
+
}
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInit1ffd5c3c5ebc59c9193e93ae5336da2f
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'C' =>
|
11 |
+
array (
|
12 |
+
'Composer\\Installers\\' => 20,
|
13 |
+
),
|
14 |
+
);
|
15 |
+
|
16 |
+
public static $prefixDirsPsr4 = array (
|
17 |
+
'Composer\\Installers\\' =>
|
18 |
+
array (
|
19 |
+
0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
|
20 |
+
),
|
21 |
+
);
|
22 |
+
|
23 |
+
public static $classMap = array (
|
24 |
+
'Code_Snippets\\Active_Snippets' => __DIR__ . '/../..' . '/php/class-active-snippets.php',
|
25 |
+
'Code_Snippets\\Admin' => __DIR__ . '/../..' . '/php/class-admin.php',
|
26 |
+
'Code_Snippets\\Admin_Menu' => __DIR__ . '/../..' . '/php/admin-menus/class-admin-menu.php',
|
27 |
+
'Code_Snippets\\Contextual_Help' => __DIR__ . '/../..' . '/php/class-contextual-help.php',
|
28 |
+
'Code_Snippets\\DB' => __DIR__ . '/../..' . '/php/class-db.php',
|
29 |
+
'Code_Snippets\\Edit_Menu' => __DIR__ . '/../..' . '/php/admin-menus/class-edit-menu.php',
|
30 |
+
'Code_Snippets\\Export' => __DIR__ . '/../..' . '/php/export/class-export.php',
|
31 |
+
'Code_Snippets\\Export_Attachment' => __DIR__ . '/../..' . '/php/export/class-export-attachment.php',
|
32 |
+
'Code_Snippets\\Frontend' => __DIR__ . '/../..' . '/php/front-end/class-frontend.php',
|
33 |
+
'Code_Snippets\\Import' => __DIR__ . '/../..' . '/php/export/class-import.php',
|
34 |
+
'Code_Snippets\\Import_Menu' => __DIR__ . '/../..' . '/php/admin-menus/class-import-menu.php',
|
35 |
+
'Code_Snippets\\List_Table' => __DIR__ . '/../..' . '/php/class-list-table.php',
|
36 |
+
'Code_Snippets\\Manage_Menu' => __DIR__ . '/../..' . '/php/admin-menus/class-manage-menu.php',
|
37 |
+
'Code_Snippets\\Plugin' => __DIR__ . '/../..' . '/php/class-plugin.php',
|
38 |
+
'Code_Snippets\\REST_API' => __DIR__ . '/../..' . '/php/class-rest-api.php',
|
39 |
+
'Code_Snippets\\Settings\\Setting_Field' => __DIR__ . '/../..' . '/php/settings/class-setting-field.php',
|
40 |
+
'Code_Snippets\\Settings_Menu' => __DIR__ . '/../..' . '/php/admin-menus/class-settings-menu.php',
|
41 |
+
'Code_Snippets\\Snippet' => __DIR__ . '/../..' . '/php/class-snippet.php',
|
42 |
+
'Code_Snippets\\Upgrade' => __DIR__ . '/../..' . '/php/class-upgrade.php',
|
43 |
+
'Code_Snippets\\Validator' => __DIR__ . '/../..' . '/php/class-validator.php',
|
44 |
+
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
45 |
+
);
|
46 |
+
|
47 |
+
public static function getInitializer(ClassLoader $loader)
|
48 |
+
{
|
49 |
+
return \Closure::bind(function () use ($loader) {
|
50 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit1ffd5c3c5ebc59c9193e93ae5336da2f::$prefixLengthsPsr4;
|
51 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit1ffd5c3c5ebc59c9193e93ae5336da2f::$prefixDirsPsr4;
|
52 |
+
$loader->classMap = ComposerStaticInit1ffd5c3c5ebc59c9193e93ae5336da2f::$classMap;
|
53 |
+
|
54 |
+
}, null, ClassLoader::class);
|
55 |
+
}
|
56 |
+
}
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"packages": [
|
3 |
+
{
|
4 |
+
"name": "composer/installers",
|
5 |
+
"version": "v1.12.0",
|
6 |
+
"version_normalized": "1.12.0.0",
|
7 |
+
"source": {
|
8 |
+
"type": "git",
|
9 |
+
"url": "https://github.com/composer/installers.git",
|
10 |
+
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
|
11 |
+
},
|
12 |
+
"dist": {
|
13 |
+
"type": "zip",
|
14 |
+
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
|
15 |
+
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
|
16 |
+
"shasum": ""
|
17 |
+
},
|
18 |
+
"require": {
|
19 |
+
"composer-plugin-api": "^1.0 || ^2.0"
|
20 |
+
},
|
21 |
+
"replace": {
|
22 |
+
"roundcube/plugin-installer": "*",
|
23 |
+
"shama/baton": "*"
|
24 |
+
},
|
25 |
+
"require-dev": {
|
26 |
+
"composer/composer": "1.6.* || ^2.0",
|
27 |
+
"composer/semver": "^1 || ^3",
|
28 |
+
"phpstan/phpstan": "^0.12.55",
|
29 |
+
"phpstan/phpstan-phpunit": "^0.12.16",
|
30 |
+
"symfony/phpunit-bridge": "^4.2 || ^5",
|
31 |
+
"symfony/process": "^2.3"
|
32 |
+
},
|
33 |
+
"time": "2021-09-13T08:19:44+00:00",
|
34 |
+
"type": "composer-plugin",
|
35 |
+
"extra": {
|
36 |
+
"class": "Composer\\Installers\\Plugin",
|
37 |
+
"branch-alias": {
|
38 |
+
"dev-main": "1.x-dev"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"installation-source": "dist",
|
42 |
+
"autoload": {
|
43 |
+
"psr-4": {
|
44 |
+
"Composer\\Installers\\": "src/Composer/Installers"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"notification-url": "https://packagist.org/downloads/",
|
48 |
+
"license": [
|
49 |
+
"MIT"
|
50 |
+
],
|
51 |
+
"authors": [
|
52 |
+
{
|
53 |
+
"name": "Kyle Robinson Young",
|
54 |
+
"email": "kyle@dontkry.com",
|
55 |
+
"homepage": "https://github.com/shama"
|
56 |
+
}
|
57 |
+
],
|
58 |
+
"description": "A multi-framework Composer library installer",
|
59 |
+
"homepage": "https://composer.github.io/installers/",
|
60 |
+
"keywords": [
|
61 |
+
"Craft",
|
62 |
+
"Dolibarr",
|
63 |
+
"Eliasis",
|
64 |
+
"Hurad",
|
65 |
+
"ImageCMS",
|
66 |
+
"Kanboard",
|
67 |
+
"Lan Management System",
|
68 |
+
"MODX Evo",
|
69 |
+
"MantisBT",
|
70 |
+
"Mautic",
|
71 |
+
"Maya",
|
72 |
+
"OXID",
|
73 |
+
"Plentymarkets",
|
74 |
+
"Porto",
|
75 |
+
"RadPHP",
|
76 |
+
"SMF",
|
77 |
+
"Starbug",
|
78 |
+
"Thelia",
|
79 |
+
"Whmcs",
|
80 |
+
"WolfCMS",
|
81 |
+
"agl",
|
82 |
+
"aimeos",
|
83 |
+
"annotatecms",
|
84 |
+
"attogram",
|
85 |
+
"bitrix",
|
86 |
+
"cakephp",
|
87 |
+
"chef",
|
88 |
+
"cockpit",
|
89 |
+
"codeigniter",
|
90 |
+
"concrete5",
|
91 |
+
"croogo",
|
92 |
+
"dokuwiki",
|
93 |
+
"drupal",
|
94 |
+
"eZ Platform",
|
95 |
+
"elgg",
|
96 |
+
"expressionengine",
|
97 |
+
"fuelphp",
|
98 |
+
"grav",
|
99 |
+
"installer",
|
100 |
+
"itop",
|
101 |
+
"joomla",
|
102 |
+
"known",
|
103 |
+
"kohana",
|
104 |
+
"laravel",
|
105 |
+
"lavalite",
|
106 |
+
"lithium",
|
107 |
+
"magento",
|
108 |
+
"majima",
|
109 |
+
"mako",
|
110 |
+
"mediawiki",
|
111 |
+
"miaoxing",
|
112 |
+
"modulework",
|
113 |
+
"modx",
|
114 |
+
"moodle",
|
115 |
+
"osclass",
|
116 |
+
"pantheon",
|
117 |
+
"phpbb",
|
118 |
+
"piwik",
|
119 |
+
"ppi",
|
120 |
+
"processwire",
|
121 |
+
"puppet",
|
122 |
+
"pxcms",
|
123 |
+
"reindex",
|
124 |
+
"roundcube",
|
125 |
+
"shopware",
|
126 |
+
"silverstripe",
|
127 |
+
"sydes",
|
128 |
+
"sylius",
|
129 |
+
"symfony",
|
130 |
+
"tastyigniter",
|
131 |
+
"typo3",
|
132 |
+
"wordpress",
|
133 |
+
"yawik",
|
134 |
+
"zend",
|
135 |
+
"zikula"
|
136 |
+
],
|
137 |
+
"support": {
|
138 |
+
"issues": "https://github.com/composer/installers/issues",
|
139 |
+
"source": "https://github.com/composer/installers/tree/v1.12.0"
|
140 |
+
},
|
141 |
+
"funding": [
|
142 |
+
{
|
143 |
+
"url": "https://packagist.com",
|
144 |
+
"type": "custom"
|
145 |
+
},
|
146 |
+
{
|
147 |
+
"url": "https://github.com/composer",
|
148 |
+
"type": "github"
|
149 |
+
},
|
150 |
+
{
|
151 |
+
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
152 |
+
"type": "tidelift"
|
153 |
+
}
|
154 |
+
],
|
155 |
+
"install-path": "./installers"
|
156 |
+
}
|
157 |
+
],
|
158 |
+
"dev": false,
|
159 |
+
"dev-package-names": []
|
160 |
+
}
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php return array(
|
2 |
+
'root' => array(
|
3 |
+
'pretty_version' => 'dev-develop',
|
4 |
+
'version' => 'dev-develop',
|
5 |
+
'type' => 'wordpress-plugin',
|
6 |
+
'install_path' => __DIR__ . '/../../',
|
7 |
+
'aliases' => array(),
|
8 |
+
'reference' => 'b620ea7c81e9441b6f5c927bcb869435ea62832e',
|
9 |
+
'name' => 'sheabunge/code-snippets',
|
10 |
+
'dev' => false,
|
11 |
+
),
|
12 |
+
'versions' => array(
|
13 |
+
'composer/installers' => array(
|
14 |
+
'pretty_version' => 'v1.12.0',
|
15 |
+
'version' => '1.12.0.0',
|
16 |
+
'type' => 'composer-plugin',
|
17 |
+
'install_path' => __DIR__ . '/./installers',
|
18 |
+
'aliases' => array(),
|
19 |
+
'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
|
20 |
+
'dev_requirement' => false,
|
21 |
+
),
|
22 |
+
'roundcube/plugin-installer' => array(
|
23 |
+
'dev_requirement' => false,
|
24 |
+
'replaced' => array(
|
25 |
+
0 => '*',
|
26 |
+
),
|
27 |
+
),
|
28 |
+
'shama/baton' => array(
|
29 |
+
'dev_requirement' => false,
|
30 |
+
'replaced' => array(
|
31 |
+
0 => '*',
|
32 |
+
),
|
33 |
+
),
|
34 |
+
'sheabunge/code-snippets' => array(
|
35 |
+
'pretty_version' => 'dev-develop',
|
36 |
+
'version' => 'dev-develop',
|
37 |
+
'type' => 'wordpress-plugin',
|
38 |
+
'install_path' => __DIR__ . '/../../',
|
39 |
+
'aliases' => array(),
|
40 |
+
'reference' => 'b620ea7c81e9441b6f5c927bcb869435ea62832e',
|
41 |
+
'dev_requirement' => false,
|
42 |
+
),
|
43 |
+
),
|
44 |
+
);
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2012 Kyle Robinson Young
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "composer/installers",
|
3 |
+
"type": "composer-plugin",
|
4 |
+
"license": "MIT",
|
5 |
+
"description": "A multi-framework Composer library installer",
|
6 |
+
"keywords": [
|
7 |
+
"installer",
|
8 |
+
"Aimeos",
|
9 |
+
"AGL",
|
10 |
+
"AnnotateCms",
|
11 |
+
"Attogram",
|
12 |
+
"Bitrix",
|
13 |
+
"CakePHP",
|
14 |
+
"Chef",
|
15 |
+
"Cockpit",
|
16 |
+
"CodeIgniter",
|
17 |
+
"concrete5",
|
18 |
+
"Craft",
|
19 |
+
"Croogo",
|
20 |
+
"DokuWiki",
|
21 |
+
"Dolibarr",
|
22 |
+
"Drupal",
|
23 |
+
"Elgg",
|
24 |
+
"Eliasis",
|
25 |
+
"ExpressionEngine",
|
26 |
+
"eZ Platform",
|
27 |
+
"FuelPHP",
|
28 |
+
"Grav",
|
29 |
+
"Hurad",
|
30 |
+
"ImageCMS",
|
31 |
+
"iTop",
|
32 |
+
"Joomla",
|
33 |
+
"Kanboard",
|
34 |
+
"Known",
|
35 |
+
"Kohana",
|
36 |
+
"Lan Management System",
|
37 |
+
"Laravel",
|
38 |
+
"Lavalite",
|
39 |
+
"Lithium",
|
40 |
+
"Magento",
|
41 |
+
"majima",
|
42 |
+
"Mako",
|
43 |
+
"MantisBT",
|
44 |
+
"Mautic",
|
45 |
+
"Maya",
|
46 |
+
"MODX",
|
47 |
+
"MODX Evo",
|
48 |
+
"MediaWiki",
|
49 |
+
"Miaoxing",
|
50 |
+
"OXID",
|
51 |
+
"osclass",
|
52 |
+
"MODULEWork",
|
53 |
+
"Moodle",
|
54 |
+
"Pantheon",
|
55 |
+
"Piwik",
|
56 |
+
"pxcms",
|
57 |
+
"phpBB",
|
58 |
+
"Plentymarkets",
|
59 |
+
"PPI",
|
60 |
+
"Puppet",
|
61 |
+
"Porto",
|
62 |
+
"ProcessWire",
|
63 |
+
"RadPHP",
|
64 |
+
"ReIndex",
|
65 |
+
"Roundcube",
|
66 |
+
"shopware",
|
67 |
+
"SilverStripe",
|
68 |
+
"SMF",
|
69 |
+
"Starbug",
|
70 |
+
"SyDES",
|
71 |
+
"Sylius",
|
72 |
+
"symfony",
|
73 |
+
"TastyIgniter",
|
74 |
+
"Thelia",
|
75 |
+
"TYPO3",
|
76 |
+
"WHMCS",
|
77 |
+
"WolfCMS",
|
78 |
+
"WordPress",
|
79 |
+
"YAWIK",
|
80 |
+
"Zend",
|
81 |
+
"Zikula"
|
82 |
+
],
|
83 |
+
"homepage": "https://composer.github.io/installers/",
|
84 |
+
"authors": [
|
85 |
+
{
|
86 |
+
"name": "Kyle Robinson Young",
|
87 |
+
"email": "kyle@dontkry.com",
|
88 |
+
"homepage": "https://github.com/shama"
|
89 |
+
}
|
90 |
+
],
|
91 |
+
"autoload": {
|
92 |
+
"psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
|
93 |
+
},
|
94 |
+
"autoload-dev": {
|
95 |
+
"psr-4": { "Composer\\Installers\\Test\\": "tests/Composer/Installers/Test" }
|
96 |
+
},
|
97 |
+
"extra": {
|
98 |
+
"class": "Composer\\Installers\\Plugin",
|
99 |
+
"branch-alias": {
|
100 |
+
"dev-main": "1.x-dev"
|
101 |
+
}
|
102 |
+
},
|
103 |
+
"replace": {
|
104 |
+
"shama/baton": "*",
|
105 |
+
"roundcube/plugin-installer": "*"
|
106 |
+
},
|
107 |
+
"require": {
|
108 |
+
"composer-plugin-api": "^1.0 || ^2.0"
|
109 |
+
},
|
110 |
+
"require-dev": {
|
111 |
+
"composer/composer": "1.6.* || ^2.0",
|
112 |
+
"composer/semver": "^1 || ^3",
|
113 |
+
"symfony/phpunit-bridge": "^4.2 || ^5",
|
114 |
+
"phpstan/phpstan": "^0.12.55",
|
115 |
+
"symfony/process": "^2.3",
|
116 |
+
"phpstan/phpstan-phpunit": "^0.12.16"
|
117 |
+
},
|
118 |
+
"scripts": {
|
119 |
+
"test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
|
120 |
+
"phpstan": "vendor/bin/phpstan analyse"
|
121 |
+
}
|
122 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
parameters:
|
2 |
+
level: 5
|
3 |
+
paths:
|
4 |
+
- src
|
5 |
+
- tests
|
6 |
+
excludes_analyse:
|
7 |
+
- tests/Composer/Installers/Test/PolyfillTestCase.php
|
8 |
+
|
9 |
+
includes:
|
10 |
+
- vendor/phpstan/phpstan-phpunit/extension.neon
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class AglInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'More/{$name}/',
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Format package name to CamelCase
|
12 |
+
*/
|
13 |
+
public function inflectPackageVars($vars)
|
14 |
+
{
|
15 |
+
$vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
|
16 |
+
return strtoupper($matches[1]);
|
17 |
+
}, $vars['name']);
|
18 |
+
|
19 |
+
return $vars;
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class AimeosInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'extension' => 'ext/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class AnnotateCmsInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'addons/modules/{$name}/',
|
8 |
+
'component' => 'addons/components/{$name}/',
|
9 |
+
'service' => 'addons/services/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class AsgardInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'Modules/{$name}/',
|
8 |
+
'theme' => 'Themes/{$name}/'
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name.
|
13 |
+
*
|
14 |
+
* For package type asgard-module, cut off a trailing '-plugin' if present.
|
15 |
+
*
|
16 |
+
* For package type asgard-theme, cut off a trailing '-theme' if present.
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function inflectPackageVars($vars)
|
20 |
+
{
|
21 |
+
if ($vars['type'] === 'asgard-module') {
|
22 |
+
return $this->inflectPluginVars($vars);
|
23 |
+
}
|
24 |
+
|
25 |
+
if ($vars['type'] === 'asgard-theme') {
|
26 |
+
return $this->inflectThemeVars($vars);
|
27 |
+
}
|
28 |
+
|
29 |
+
return $vars;
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function inflectPluginVars($vars)
|
33 |
+
{
|
34 |
+
$vars['name'] = preg_replace('/-module$/', '', $vars['name']);
|
35 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
36 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
37 |
+
|
38 |
+
return $vars;
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function inflectThemeVars($vars)
|
42 |
+
{
|
43 |
+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
|
44 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
45 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
46 |
+
|
47 |
+
return $vars;
|
48 |
+
}
|
49 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class AttogramInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\IO\IOInterface;
|
5 |
+
use Composer\Composer;
|
6 |
+
use Composer\Package\PackageInterface;
|
7 |
+
|
8 |
+
abstract class BaseInstaller
|
9 |
+
{
|
10 |
+
protected $locations = array();
|
11 |
+
protected $composer;
|
12 |
+
protected $package;
|
13 |
+
protected $io;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Initializes base installer.
|
17 |
+
*
|
18 |
+
* @param PackageInterface $package
|
19 |
+
* @param Composer $composer
|
20 |
+
* @param IOInterface $io
|
21 |
+
*/
|
22 |
+
public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
|
23 |
+
{
|
24 |
+
$this->composer = $composer;
|
25 |
+
$this->package = $package;
|
26 |
+
$this->io = $io;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Return the install path based on package type.
|
31 |
+
*
|
32 |
+
* @param PackageInterface $package
|
33 |
+
* @param string $frameworkType
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getInstallPath(PackageInterface $package, $frameworkType = '')
|
37 |
+
{
|
38 |
+
$type = $this->package->getType();
|
39 |
+
|
40 |
+
$prettyName = $this->package->getPrettyName();
|
41 |
+
if (strpos($prettyName, '/') !== false) {
|
42 |
+
list($vendor, $name) = explode('/', $prettyName);
|
43 |
+
} else {
|
44 |
+
$vendor = '';
|
45 |
+
$name = $prettyName;
|
46 |
+
}
|
47 |
+
|
48 |
+
$availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
|
49 |
+
|
50 |
+
$extra = $package->getExtra();
|
51 |
+
if (!empty($extra['installer-name'])) {
|
52 |
+
$availableVars['name'] = $extra['installer-name'];
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($this->composer->getPackage()) {
|
56 |
+
$extra = $this->composer->getPackage()->getExtra();
|
57 |
+
if (!empty($extra['installer-paths'])) {
|
58 |
+
$customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
|
59 |
+
if ($customPath !== false) {
|
60 |
+
return $this->templatePath($customPath, $availableVars);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
$packageType = substr($type, strlen($frameworkType) + 1);
|
66 |
+
$locations = $this->getLocations();
|
67 |
+
if (!isset($locations[$packageType])) {
|
68 |
+
throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
|
69 |
+
}
|
70 |
+
|
71 |
+
return $this->templatePath($locations[$packageType], $availableVars);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* For an installer to override to modify the vars per installer.
|
76 |
+
*
|
77 |
+
* @param array<string, string> $vars This will normally receive array{name: string, vendor: string, type: string}
|
78 |
+
* @return array<string, string>
|
79 |
+
*/
|
80 |
+
public function inflectPackageVars($vars)
|
81 |
+
{
|
82 |
+
return $vars;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Gets the installer's locations
|
87 |
+
*
|
88 |
+
* @return array<string, string> map of package types => install path
|
89 |
+
*/
|
90 |
+
public function getLocations()
|
91 |
+
{
|
92 |
+
return $this->locations;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Replace vars in a path
|
97 |
+
*
|
98 |
+
* @param string $path
|
99 |
+
* @param array<string, string> $vars
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
protected function templatePath($path, array $vars = array())
|
103 |
+
{
|
104 |
+
if (strpos($path, '{') !== false) {
|
105 |
+
extract($vars);
|
106 |
+
preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
|
107 |
+
if (!empty($matches[1])) {
|
108 |
+
foreach ($matches[1] as $var) {
|
109 |
+
$path = str_replace('{$' . $var . '}', $$var, $path);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
return $path;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Search through a passed paths array for a custom install path.
|
119 |
+
*
|
120 |
+
* @param array $paths
|
121 |
+
* @param string $name
|
122 |
+
* @param string $type
|
123 |
+
* @param string $vendor = NULL
|
124 |
+
* @return string|false
|
125 |
+
*/
|
126 |
+
protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
|
127 |
+
{
|
128 |
+
foreach ($paths as $path => $names) {
|
129 |
+
$names = (array) $names;
|
130 |
+
if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
|
131 |
+
return $path;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
}
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
use Composer\Util\Filesystem;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Installer for Bitrix Framework. Supported types of extensions:
|
9 |
+
* - `bitrix-d7-module` — copy the module to directory `bitrix/modules/<vendor>.<name>`.
|
10 |
+
* - `bitrix-d7-component` — copy the component to directory `bitrix/components/<vendor>/<name>`.
|
11 |
+
* - `bitrix-d7-template` — copy the template to directory `bitrix/templates/<vendor>_<name>`.
|
12 |
+
*
|
13 |
+
* You can set custom path to directory with Bitrix kernel in `composer.json`:
|
14 |
+
*
|
15 |
+
* ```json
|
16 |
+
* {
|
17 |
+
* "extra": {
|
18 |
+
* "bitrix-dir": "s1/bitrix"
|
19 |
+
* }
|
20 |
+
* }
|
21 |
+
* ```
|
22 |
+
*
|
23 |
+
* @author Nik Samokhvalov <nik@samokhvalov.info>
|
24 |
+
* @author Denis Kulichkin <onexhovia@gmail.com>
|
25 |
+
*/
|
26 |
+
class BitrixInstaller extends BaseInstaller
|
27 |
+
{
|
28 |
+
protected $locations = array(
|
29 |
+
'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
|
30 |
+
'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
|
31 |
+
'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
|
32 |
+
'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
|
33 |
+
'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
|
34 |
+
'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
|
35 |
+
);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var array Storage for informations about duplicates at all the time of installation packages.
|
39 |
+
*/
|
40 |
+
private static $checkedDuplicates = array();
|
41 |
+
|
42 |
+
/**
|
43 |
+
* {@inheritdoc}
|
44 |
+
*/
|
45 |
+
public function inflectPackageVars($vars)
|
46 |
+
{
|
47 |
+
if ($this->composer->getPackage()) {
|
48 |
+
$extra = $this->composer->getPackage()->getExtra();
|
49 |
+
|
50 |
+
if (isset($extra['bitrix-dir'])) {
|
51 |
+
$vars['bitrix_dir'] = $extra['bitrix-dir'];
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
if (!isset($vars['bitrix_dir'])) {
|
56 |
+
$vars['bitrix_dir'] = 'bitrix';
|
57 |
+
}
|
58 |
+
|
59 |
+
return parent::inflectPackageVars($vars);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* {@inheritdoc}
|
64 |
+
*/
|
65 |
+
protected function templatePath($path, array $vars = array())
|
66 |
+
{
|
67 |
+
$templatePath = parent::templatePath($path, $vars);
|
68 |
+
$this->checkDuplicates($templatePath, $vars);
|
69 |
+
|
70 |
+
return $templatePath;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Duplicates search packages.
|
75 |
+
*
|
76 |
+
* @param string $path
|
77 |
+
* @param array $vars
|
78 |
+
*/
|
79 |
+
protected function checkDuplicates($path, array $vars = array())
|
80 |
+
{
|
81 |
+
$packageType = substr($vars['type'], strlen('bitrix') + 1);
|
82 |
+
$localDir = explode('/', $vars['bitrix_dir']);
|
83 |
+
array_pop($localDir);
|
84 |
+
$localDir[] = 'local';
|
85 |
+
$localDir = implode('/', $localDir);
|
86 |
+
|
87 |
+
$oldPath = str_replace(
|
88 |
+
array('{$bitrix_dir}', '{$name}'),
|
89 |
+
array($localDir, $vars['name']),
|
90 |
+
$this->locations[$packageType]
|
91 |
+
);
|
92 |
+
|
93 |
+
if (in_array($oldPath, static::$checkedDuplicates)) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
|
98 |
+
|
99 |
+
$this->io->writeError(' <error>Duplication of packages:</error>');
|
100 |
+
$this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
|
101 |
+
|
102 |
+
while (true) {
|
103 |
+
switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) {
|
104 |
+
case 'y':
|
105 |
+
$fs = new Filesystem();
|
106 |
+
$fs->removeDirectory($oldPath);
|
107 |
+
break 2;
|
108 |
+
|
109 |
+
case 'n':
|
110 |
+
break 2;
|
111 |
+
|
112 |
+
case '?':
|
113 |
+
default:
|
114 |
+
$this->io->writeError(array(
|
115 |
+
' y - delete package ' . $oldPath . ' and to continue with the installation',
|
116 |
+
' n - don\'t delete and to continue with the installation',
|
117 |
+
));
|
118 |
+
$this->io->writeError(' ? - print help');
|
119 |
+
break;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
static::$checkedDuplicates[] = $oldPath;
|
125 |
+
}
|
126 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class BonefishInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'package' => 'Packages/{$vendor}/{$name}/'
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\DependencyResolver\Pool;
|
5 |
+
use Composer\Semver\Constraint\Constraint;
|
6 |
+
|
7 |
+
class CakePHPInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'plugin' => 'Plugin/{$name}/',
|
11 |
+
);
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Format package name to CamelCase
|
15 |
+
*/
|
16 |
+
public function inflectPackageVars($vars)
|
17 |
+
{
|
18 |
+
if ($this->matchesCakeVersion('>=', '3.0.0')) {
|
19 |
+
return $vars;
|
20 |
+
}
|
21 |
+
|
22 |
+
$nameParts = explode('/', $vars['name']);
|
23 |
+
foreach ($nameParts as &$value) {
|
24 |
+
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
|
25 |
+
$value = str_replace(array('-', '_'), ' ', $value);
|
26 |
+
$value = str_replace(' ', '', ucwords($value));
|
27 |
+
}
|
28 |
+
$vars['name'] = implode('/', $nameParts);
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Change the default plugin location when cakephp >= 3.0
|
35 |
+
*/
|
36 |
+
public function getLocations()
|
37 |
+
{
|
38 |
+
if ($this->matchesCakeVersion('>=', '3.0.0')) {
|
39 |
+
$this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
|
40 |
+
}
|
41 |
+
return $this->locations;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Check if CakePHP version matches against a version
|
46 |
+
*
|
47 |
+
* @param string $matcher
|
48 |
+
* @param string $version
|
49 |
+
* @return bool
|
50 |
+
* @phpstan-param Constraint::STR_OP_* $matcher
|
51 |
+
*/
|
52 |
+
protected function matchesCakeVersion($matcher, $version)
|
53 |
+
{
|
54 |
+
$repositoryManager = $this->composer->getRepositoryManager();
|
55 |
+
if (! $repositoryManager) {
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
$repos = $repositoryManager->getLocalRepository();
|
60 |
+
if (!$repos) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null;
|
65 |
+
}
|
66 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ChefInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'cookbook' => 'Chef/{$vendor}/{$name}/',
|
8 |
+
'role' => 'Chef/roles/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class CiviCrmInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'ext' => 'ext/{$name}/'
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ClanCatsFrameworkInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'ship' => 'CCF/orbit/{$name}/',
|
8 |
+
'theme' => 'CCF/app/themes/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class CockpitInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'cockpit/modules/addons/{$name}/',
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Format module name.
|
12 |
+
*
|
13 |
+
* Strip `module-` prefix from package name.
|
14 |
+
*
|
15 |
+
* {@inheritDoc}
|
16 |
+
*/
|
17 |
+
public function inflectPackageVars($vars)
|
18 |
+
{
|
19 |
+
if ($vars['type'] == 'cockpit-module') {
|
20 |
+
return $this->inflectModuleVars($vars);
|
21 |
+
}
|
22 |
+
|
23 |
+
return $vars;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function inflectModuleVars($vars)
|
27 |
+
{
|
28 |
+
$vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class CodeIgniterInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'library' => 'application/libraries/{$name}/',
|
8 |
+
'third-party' => 'application/third_party/{$name}/',
|
9 |
+
'module' => 'application/modules/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class Concrete5Installer extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'core' => 'concrete/',
|
8 |
+
'block' => 'application/blocks/{$name}/',
|
9 |
+
'package' => 'packages/{$name}/',
|
10 |
+
'theme' => 'application/themes/{$name}/',
|
11 |
+
'update' => 'updates/{$name}/',
|
12 |
+
);
|
13 |
+
}
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Installer for Craft Plugins
|
6 |
+
*/
|
7 |
+
class CraftInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
const NAME_PREFIX = 'craft';
|
10 |
+
const NAME_SUFFIX = 'plugin';
|
11 |
+
|
12 |
+
protected $locations = array(
|
13 |
+
'plugin' => 'craft/plugins/{$name}/',
|
14 |
+
);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Strip `craft-` prefix and/or `-plugin` suffix from package names
|
18 |
+
*
|
19 |
+
* @param array $vars
|
20 |
+
*
|
21 |
+
* @return array
|
22 |
+
*/
|
23 |
+
final public function inflectPackageVars($vars)
|
24 |
+
{
|
25 |
+
return $this->inflectPluginVars($vars);
|
26 |
+
}
|
27 |
+
|
28 |
+
private function inflectPluginVars($vars)
|
29 |
+
{
|
30 |
+
$vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
|
31 |
+
$vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
|
32 |
+
|
33 |
+
return $vars;
|
34 |
+
}
|
35 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class CroogoInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'Plugin/{$name}/',
|
8 |
+
'theme' => 'View/Themed/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name to CamelCase
|
13 |
+
*/
|
14 |
+
public function inflectPackageVars($vars)
|
15 |
+
{
|
16 |
+
$vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
|
17 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
18 |
+
|
19 |
+
return $vars;
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class DecibelInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
/** @var array */
|
7 |
+
protected $locations = array(
|
8 |
+
'app' => 'app/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class DframeInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'module' => 'modules/{$vendor}/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class DokuWikiInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'lib/plugins/{$name}/',
|
8 |
+
'template' => 'lib/tpl/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name.
|
13 |
+
*
|
14 |
+
* For package type dokuwiki-plugin, cut off a trailing '-plugin',
|
15 |
+
* or leading dokuwiki_ if present.
|
16 |
+
*
|
17 |
+
* For package type dokuwiki-template, cut off a trailing '-template' if present.
|
18 |
+
*
|
19 |
+
*/
|
20 |
+
public function inflectPackageVars($vars)
|
21 |
+
{
|
22 |
+
|
23 |
+
if ($vars['type'] === 'dokuwiki-plugin') {
|
24 |
+
return $this->inflectPluginVars($vars);
|
25 |
+
}
|
26 |
+
|
27 |
+
if ($vars['type'] === 'dokuwiki-template') {
|
28 |
+
return $this->inflectTemplateVars($vars);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $vars;
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function inflectPluginVars($vars)
|
35 |
+
{
|
36 |
+
$vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
|
37 |
+
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
|
38 |
+
|
39 |
+
return $vars;
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function inflectTemplateVars($vars)
|
43 |
+
{
|
44 |
+
$vars['name'] = preg_replace('/-template$/', '', $vars['name']);
|
45 |
+
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
|
46 |
+
|
47 |
+
return $vars;
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class DolibarrInstaller
|
6 |
+
*
|
7 |
+
* @package Composer\Installers
|
8 |
+
* @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
9 |
+
*/
|
10 |
+
class DolibarrInstaller extends BaseInstaller
|
11 |
+
{
|
12 |
+
//TODO: Add support for scripts and themes
|
13 |
+
protected $locations = array(
|
14 |
+
'module' => 'htdocs/custom/{$name}/',
|
15 |
+
);
|
16 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class DrupalInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'core' => 'core/',
|
8 |
+
'module' => 'modules/{$name}/',
|
9 |
+
'theme' => 'themes/{$name}/',
|
10 |
+
'library' => 'libraries/{$name}/',
|
11 |
+
'profile' => 'profiles/{$name}/',
|
12 |
+
'database-driver' => 'drivers/lib/Drupal/Driver/Database/{$name}/',
|
13 |
+
'drush' => 'drush/{$name}/',
|
14 |
+
'custom-theme' => 'themes/custom/{$name}/',
|
15 |
+
'custom-module' => 'modules/custom/{$name}/',
|
16 |
+
'custom-profile' => 'profiles/custom/{$name}/',
|
17 |
+
'drupal-multisite' => 'sites/{$name}/',
|
18 |
+
'console' => 'console/{$name}/',
|
19 |
+
'console-language' => 'console/language/{$name}/',
|
20 |
+
'config' => 'config/sync/',
|
21 |
+
);
|
22 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ElggInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'mod/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class EliasisInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'component' => 'components/{$name}/',
|
8 |
+
'module' => 'modules/{$name}/',
|
9 |
+
'plugin' => 'plugins/{$name}/',
|
10 |
+
'template' => 'templates/{$name}/',
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\Package\PackageInterface;
|
5 |
+
|
6 |
+
class ExpressionEngineInstaller extends BaseInstaller
|
7 |
+
{
|
8 |
+
|
9 |
+
protected $locations = array();
|
10 |
+
|
11 |
+
private $ee2Locations = array(
|
12 |
+
'addon' => 'system/expressionengine/third_party/{$name}/',
|
13 |
+
'theme' => 'themes/third_party/{$name}/',
|
14 |
+
);
|
15 |
+
|
16 |
+
private $ee3Locations = array(
|
17 |
+
'addon' => 'system/user/addons/{$name}/',
|
18 |
+
'theme' => 'themes/user/{$name}/',
|
19 |
+
);
|
20 |
+
|
21 |
+
public function getInstallPath(PackageInterface $package, $frameworkType = '')
|
22 |
+
{
|
23 |
+
|
24 |
+
$version = "{$frameworkType}Locations";
|
25 |
+
$this->locations = $this->$version;
|
26 |
+
|
27 |
+
return parent::getInstallPath($package, $frameworkType);
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class EzPlatformInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'meta-assets' => 'web/assets/ezplatform/',
|
8 |
+
'assets' => 'web/assets/ezplatform/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class FuelInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'fuel/app/modules/{$name}/',
|
8 |
+
'package' => 'fuel/packages/{$name}/',
|
9 |
+
'theme' => 'fuel/app/themes/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class FuelphpInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'component' => 'components/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class GravInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'user/plugins/{$name}/',
|
8 |
+
'theme' => 'user/themes/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name
|
13 |
+
*
|
14 |
+
* @param array $vars
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
$restrictedWords = implode('|', array_keys($this->locations));
|
21 |
+
|
22 |
+
$vars['name'] = strtolower($vars['name']);
|
23 |
+
$vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
|
24 |
+
'$1',
|
25 |
+
$vars['name']
|
26 |
+
);
|
27 |
+
|
28 |
+
return $vars;
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class HuradInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'plugins/{$name}/',
|
8 |
+
'theme' => 'plugins/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name to CamelCase
|
13 |
+
*/
|
14 |
+
public function inflectPackageVars($vars)
|
15 |
+
{
|
16 |
+
$nameParts = explode('/', $vars['name']);
|
17 |
+
foreach ($nameParts as &$value) {
|
18 |
+
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
|
19 |
+
$value = str_replace(array('-', '_'), ' ', $value);
|
20 |
+
$value = str_replace(' ', '', ucwords($value));
|
21 |
+
}
|
22 |
+
$vars['name'] = implode('/', $nameParts);
|
23 |
+
return $vars;
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ImageCMSInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'template' => 'templates/{$name}/',
|
8 |
+
'module' => 'application/modules/{$name}/',
|
9 |
+
'library' => 'application/libraries/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
use Composer\Composer;
|
6 |
+
use Composer\Installer\BinaryInstaller;
|
7 |
+
use Composer\Installer\LibraryInstaller;
|
8 |
+
use Composer\IO\IOInterface;
|
9 |
+
use Composer\Package\PackageInterface;
|
10 |
+
use Composer\Repository\InstalledRepositoryInterface;
|
11 |
+
use Composer\Util\Filesystem;
|
12 |
+
use React\Promise\PromiseInterface;
|
13 |
+
|
14 |
+
class Installer extends LibraryInstaller
|
15 |
+
{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Package types to installer class map
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
private $supportedTypes = array(
|
23 |
+
'aimeos' => 'AimeosInstaller',
|
24 |
+
'asgard' => 'AsgardInstaller',
|
25 |
+
'attogram' => 'AttogramInstaller',
|
26 |
+
'agl' => 'AglInstaller',
|
27 |
+
'annotatecms' => 'AnnotateCmsInstaller',
|
28 |
+
'bitrix' => 'BitrixInstaller',
|
29 |
+
'bonefish' => 'BonefishInstaller',
|
30 |
+
'cakephp' => 'CakePHPInstaller',
|
31 |
+
'chef' => 'ChefInstaller',
|
32 |
+
'civicrm' => 'CiviCrmInstaller',
|
33 |
+
'ccframework' => 'ClanCatsFrameworkInstaller',
|
34 |
+
'cockpit' => 'CockpitInstaller',
|
35 |
+
'codeigniter' => 'CodeIgniterInstaller',
|
36 |
+
'concrete5' => 'Concrete5Installer',
|
37 |
+
'craft' => 'CraftInstaller',
|
38 |
+
'croogo' => 'CroogoInstaller',
|
39 |
+
'dframe' => 'DframeInstaller',
|
40 |
+
'dokuwiki' => 'DokuWikiInstaller',
|
41 |
+
'dolibarr' => 'DolibarrInstaller',
|
42 |
+
'decibel' => 'DecibelInstaller',
|
43 |
+
'drupal' => 'DrupalInstaller',
|
44 |
+
'elgg' => 'ElggInstaller',
|
45 |
+
'eliasis' => 'EliasisInstaller',
|
46 |
+
'ee3' => 'ExpressionEngineInstaller',
|
47 |
+
'ee2' => 'ExpressionEngineInstaller',
|
48 |
+
'ezplatform' => 'EzPlatformInstaller',
|
49 |
+
'fuel' => 'FuelInstaller',
|
50 |
+
'fuelphp' => 'FuelphpInstaller',
|
51 |
+
'grav' => 'GravInstaller',
|
52 |
+
'hurad' => 'HuradInstaller',
|
53 |
+
'tastyigniter' => 'TastyIgniterInstaller',
|
54 |
+
'imagecms' => 'ImageCMSInstaller',
|
55 |
+
'itop' => 'ItopInstaller',
|
56 |
+
'joomla' => 'JoomlaInstaller',
|
57 |
+
'kanboard' => 'KanboardInstaller',
|
58 |
+
'kirby' => 'KirbyInstaller',
|
59 |
+
'known' => 'KnownInstaller',
|
60 |
+
'kodicms' => 'KodiCMSInstaller',
|
61 |
+
'kohana' => 'KohanaInstaller',
|
62 |
+
'lms' => 'LanManagementSystemInstaller',
|
63 |
+
'laravel' => 'LaravelInstaller',
|
64 |
+
'lavalite' => 'LavaLiteInstaller',
|
65 |
+
'lithium' => 'LithiumInstaller',
|
66 |
+
'magento' => 'MagentoInstaller',
|
67 |
+
'majima' => 'MajimaInstaller',
|
68 |
+
'mantisbt' => 'MantisBTInstaller',
|
69 |
+
'mako' => 'MakoInstaller',
|
70 |
+
'maya' => 'MayaInstaller',
|
71 |
+
'mautic' => 'MauticInstaller',
|
72 |
+
'mediawiki' => 'MediaWikiInstaller',
|
73 |
+
'miaoxing' => 'MiaoxingInstaller',
|
74 |
+
'microweber' => 'MicroweberInstaller',
|
75 |
+
'modulework' => 'MODULEWorkInstaller',
|
76 |
+
'modx' => 'ModxInstaller',
|
77 |
+
'modxevo' => 'MODXEvoInstaller',
|
78 |
+
'moodle' => 'MoodleInstaller',
|
79 |
+
'october' => 'OctoberInstaller',
|
80 |
+
'ontowiki' => 'OntoWikiInstaller',
|
81 |
+
'oxid' => 'OxidInstaller',
|
82 |
+
'osclass' => 'OsclassInstaller',
|
83 |
+
'pxcms' => 'PxcmsInstaller',
|
84 |
+
'phpbb' => 'PhpBBInstaller',
|
85 |
+
'pimcore' => 'PimcoreInstaller',
|
86 |
+
'piwik' => 'PiwikInstaller',
|
87 |
+
'plentymarkets'=> 'PlentymarketsInstaller',
|
88 |
+
'ppi' => 'PPIInstaller',
|
89 |
+
'puppet' => 'PuppetInstaller',
|
90 |
+
'radphp' => 'RadPHPInstaller',
|
91 |
+
'phifty' => 'PhiftyInstaller',
|
92 |
+
'porto' => 'PortoInstaller',
|
93 |
+
'processwire' => 'ProcessWireInstaller',
|
94 |
+
'quicksilver' => 'PantheonInstaller',
|
95 |
+
'redaxo' => 'RedaxoInstaller',
|
96 |
+
'redaxo5' => 'Redaxo5Installer',
|
97 |
+
'reindex' => 'ReIndexInstaller',
|
98 |
+
'roundcube' => 'RoundcubeInstaller',
|
99 |
+
'shopware' => 'ShopwareInstaller',
|
100 |
+
'sitedirect' => 'SiteDirectInstaller',
|
101 |
+
'silverstripe' => 'SilverStripeInstaller',
|
102 |
+
'smf' => 'SMFInstaller',
|
103 |
+
'starbug' => 'StarbugInstaller',
|
104 |
+
'sydes' => 'SyDESInstaller',
|
105 |
+
'sylius' => 'SyliusInstaller',
|
106 |
+
'symfony1' => 'Symfony1Installer',
|
107 |
+
'tao' => 'TaoInstaller',
|
108 |
+
'thelia' => 'TheliaInstaller',
|
109 |
+
'tusk' => 'TuskInstaller',
|
110 |
+
'typo3-cms' => 'TYPO3CmsInstaller',
|
111 |
+
'typo3-flow' => 'TYPO3FlowInstaller',
|
112 |
+
'userfrosting' => 'UserFrostingInstaller',
|
113 |
+
'vanilla' => 'VanillaInstaller',
|
114 |
+
'whmcs' => 'WHMCSInstaller',
|
115 |
+
'winter' => 'WinterInstaller',
|
116 |
+
'wolfcms' => 'WolfCMSInstaller',
|
117 |
+
'wordpress' => 'WordPressInstaller',
|
118 |
+
'yawik' => 'YawikInstaller',
|
119 |
+
'zend' => 'ZendInstaller',
|
120 |
+
'zikula' => 'ZikulaInstaller',
|
121 |
+
'prestashop' => 'PrestashopInstaller'
|
122 |
+
);
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Installer constructor.
|
126 |
+
*
|
127 |
+
* Disables installers specified in main composer extra installer-disable
|
128 |
+
* list
|
129 |
+
*
|
130 |
+
* @param IOInterface $io
|
131 |
+
* @param Composer $composer
|
132 |
+
* @param string $type
|
133 |
+
* @param Filesystem|null $filesystem
|
134 |
+
* @param BinaryInstaller|null $binaryInstaller
|
135 |
+
*/
|
136 |
+
public function __construct(
|
137 |
+
IOInterface $io,
|
138 |
+
Composer $composer,
|
139 |
+
$type = 'library',
|
140 |
+
Filesystem $filesystem = null,
|
141 |
+
BinaryInstaller $binaryInstaller = null
|
142 |
+
) {
|
143 |
+
parent::__construct($io, $composer, $type, $filesystem,
|
144 |
+
$binaryInstaller);
|
145 |
+
$this->removeDisabledInstallers();
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* {@inheritDoc}
|
150 |
+
*/
|
151 |
+
public function getInstallPath(PackageInterface $package)
|
152 |
+
{
|
153 |
+
$type = $package->getType();
|
154 |
+
$frameworkType = $this->findFrameworkType($type);
|
155 |
+
|
156 |
+
if ($frameworkType === false) {
|
157 |
+
throw new \InvalidArgumentException(
|
158 |
+
'Sorry the package type of this package is not yet supported.'
|
159 |
+
);
|
160 |
+
}
|
161 |
+
|
162 |
+
$class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
|
163 |
+
$installer = new $class($package, $this->composer, $this->getIO());
|
164 |
+
|
165 |
+
return $installer->getInstallPath($package, $frameworkType);
|
166 |
+
}
|
167 |
+
|
168 |
+
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
|
169 |
+
{
|
170 |
+
$installPath = $this->getPackageBasePath($package);
|
171 |
+
$io = $this->io;
|
172 |
+
$outputStatus = function () use ($io, $installPath) {
|
173 |
+
$io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
|
174 |
+
};
|
175 |
+
|
176 |
+
$promise = parent::uninstall($repo, $package);
|
177 |
+
|
178 |
+
// Composer v2 might return a promise here
|
179 |
+
if ($promise instanceof PromiseInterface) {
|
180 |
+
return $promise->then($outputStatus);
|
181 |
+
}
|
182 |
+
|
183 |
+
// If not, execute the code right away as parent::uninstall executed synchronously (composer v1, or v2 without async)
|
184 |
+
$outputStatus();
|
185 |
+
|
186 |
+
return null;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* {@inheritDoc}
|
191 |
+
*/
|
192 |
+
public function supports($packageType)
|
193 |
+
{
|
194 |
+
$frameworkType = $this->findFrameworkType($packageType);
|
195 |
+
|
196 |
+
if ($frameworkType === false) {
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
|
200 |
+
$locationPattern = $this->getLocationPattern($frameworkType);
|
201 |
+
|
202 |
+
return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Finds a supported framework type if it exists and returns it
|
207 |
+
*
|
208 |
+
* @param string $type
|
209 |
+
* @return string|false
|
210 |
+
*/
|
211 |
+
protected function findFrameworkType($type)
|
212 |
+
{
|
213 |
+
krsort($this->supportedTypes);
|
214 |
+
|
215 |
+
foreach ($this->supportedTypes as $key => $val) {
|
216 |
+
if ($key === substr($type, 0, strlen($key))) {
|
217 |
+
return substr($type, 0, strlen($key));
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Get the second part of the regular expression to check for support of a
|
226 |
+
* package type
|
227 |
+
*
|
228 |
+
* @param string $frameworkType
|
229 |
+
* @return string
|
230 |
+
*/
|
231 |
+
protected function getLocationPattern($frameworkType)
|
232 |
+
{
|
233 |
+
$pattern = false;
|
234 |
+
if (!empty($this->supportedTypes[$frameworkType])) {
|
235 |
+
$frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
|
236 |
+
/** @var BaseInstaller $framework */
|
237 |
+
$framework = new $frameworkClass(null, $this->composer, $this->getIO());
|
238 |
+
$locations = array_keys($framework->getLocations());
|
239 |
+
$pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
|
240 |
+
}
|
241 |
+
|
242 |
+
return $pattern ? : '(\w+)';
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get I/O object
|
247 |
+
*
|
248 |
+
* @return IOInterface
|
249 |
+
*/
|
250 |
+
private function getIO()
|
251 |
+
{
|
252 |
+
return $this->io;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Look for installers set to be disabled in composer's extra config and
|
257 |
+
* remove them from the list of supported installers.
|
258 |
+
*
|
259 |
+
* Globals:
|
260 |
+
* - true, "all", and "*" - disable all installers.
|
261 |
+
* - false - enable all installers (useful with
|
262 |
+
* wikimedia/composer-merge-plugin or similar)
|
263 |
+
*
|
264 |
+
* @return void
|
265 |
+
*/
|
266 |
+
protected function removeDisabledInstallers()
|
267 |
+
{
|
268 |
+
$extra = $this->composer->getPackage()->getExtra();
|
269 |
+
|
270 |
+
if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
|
271 |
+
// No installers are disabled
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
|
275 |
+
// Get installers to disable
|
276 |
+
$disable = $extra['installer-disable'];
|
277 |
+
|
278 |
+
// Ensure $disabled is an array
|
279 |
+
if (!is_array($disable)) {
|
280 |
+
$disable = array($disable);
|
281 |
+
}
|
282 |
+
|
283 |
+
// Check which installers should be disabled
|
284 |
+
$all = array(true, "all", "*");
|
285 |
+
$intersect = array_intersect($all, $disable);
|
286 |
+
if (!empty($intersect)) {
|
287 |
+
// Disable all installers
|
288 |
+
$this->supportedTypes = array();
|
289 |
+
} else {
|
290 |
+
// Disable specified installers
|
291 |
+
foreach ($disable as $key => $installer) {
|
292 |
+
if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
|
293 |
+
unset($this->supportedTypes[$installer]);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ItopInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'extension' => 'extensions/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class JoomlaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'component' => 'components/{$name}/',
|
8 |
+
'module' => 'modules/{$name}/',
|
9 |
+
'template' => 'templates/{$name}/',
|
10 |
+
'plugin' => 'plugins/{$name}/',
|
11 |
+
'library' => 'libraries/{$name}/',
|
12 |
+
);
|
13 |
+
|
14 |
+
// TODO: Add inflector for mod_ and com_ names
|
15 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
* Installer for kanboard plugins
|
7 |
+
*
|
8 |
+
* kanboard.net
|
9 |
+
*
|
10 |
+
* Class KanboardInstaller
|
11 |
+
* @package Composer\Installers
|
12 |
+
*/
|
13 |
+
class KanboardInstaller extends BaseInstaller
|
14 |
+
{
|
15 |
+
protected $locations = array(
|
16 |
+
'plugin' => 'plugins/{$name}/',
|
17 |
+
);
|
18 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class KirbyInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'site/plugins/{$name}/',
|
8 |
+
'field' => 'site/fields/{$name}/',
|
9 |
+
'tag' => 'site/tags/{$name}/'
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class KnownInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'IdnoPlugins/{$name}/',
|
8 |
+
'theme' => 'Themes/{$name}/',
|
9 |
+
'console' => 'ConsolePlugins/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class KodiCMSInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'cms/plugins/{$name}/',
|
8 |
+
'media' => 'cms/media/vendor/{$name}/'
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class KohanaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class LanManagementSystemInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
|
8 |
+
protected $locations = array(
|
9 |
+
'plugin' => 'plugins/{$name}/',
|
10 |
+
'template' => 'templates/{$name}/',
|
11 |
+
'document-template' => 'documents/templates/{$name}/',
|
12 |
+
'userpanel-module' => 'userpanel/modules/{$name}/',
|
13 |
+
);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Format package name to CamelCase
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
21 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
22 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
23 |
+
|
24 |
+
return $vars;
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class LaravelInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'library' => 'libraries/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class LavaLiteInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'package' => 'packages/{$vendor}/{$name}/',
|
8 |
+
'theme' => 'public/themes/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class LithiumInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'library' => 'libraries/{$name}/',
|
8 |
+
'source' => 'libraries/_source/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MODULEWorkInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An installer to handle MODX Evolution specifics when installing packages.
|
6 |
+
*/
|
7 |
+
class MODXEvoInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'snippet' => 'assets/snippets/{$name}/',
|
11 |
+
'plugin' => 'assets/plugins/{$name}/',
|
12 |
+
'module' => 'assets/modules/{$name}/',
|
13 |
+
'template' => 'assets/templates/{$name}/',
|
14 |
+
'lib' => 'assets/lib/{$name}/'
|
15 |
+
);
|
16 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MagentoInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'theme' => 'app/design/frontend/{$name}/',
|
8 |
+
'skin' => 'skin/frontend/default/{$name}/',
|
9 |
+
'library' => 'lib/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Plugin/theme installer for majima
|
6 |
+
* @author David Neustadt
|
7 |
+
*/
|
8 |
+
class MajimaInstaller extends BaseInstaller
|
9 |
+
{
|
10 |
+
protected $locations = array(
|
11 |
+
'plugin' => 'plugins/{$name}/',
|
12 |
+
);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Transforms the names
|
16 |
+
* @param array $vars
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function inflectPackageVars($vars)
|
20 |
+
{
|
21 |
+
return $this->correctPluginName($vars);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Change hyphenated names to camelcase
|
26 |
+
* @param array $vars
|
27 |
+
* @return array
|
28 |
+
*/
|
29 |
+
private function correctPluginName($vars)
|
30 |
+
{
|
31 |
+
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
|
32 |
+
return strtoupper($matches[0][1]);
|
33 |
+
}, $vars['name']);
|
34 |
+
$vars['name'] = ucfirst($camelCasedName);
|
35 |
+
return $vars;
|
36 |
+
}
|
37 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MakoInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'package' => 'app/packages/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\DependencyResolver\Pool;
|
5 |
+
|
6 |
+
class MantisBTInstaller extends BaseInstaller
|
7 |
+
{
|
8 |
+
protected $locations = array(
|
9 |
+
'plugin' => 'plugins/{$name}/',
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name to CamelCase
|
14 |
+
*/
|
15 |
+
public function inflectPackageVars($vars)
|
16 |
+
{
|
17 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
18 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
19 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
20 |
+
|
21 |
+
return $vars;
|
22 |
+
}
|
23 |
+
}
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\Package\PackageInterface;
|
5 |
+
|
6 |
+
class MauticInstaller extends BaseInstaller
|
7 |
+
{
|
8 |
+
protected $locations = array(
|
9 |
+
'plugin' => 'plugins/{$name}/',
|
10 |
+
'theme' => 'themes/{$name}/',
|
11 |
+
'core' => 'app/',
|
12 |
+
);
|
13 |
+
|
14 |
+
private function getDirectoryName()
|
15 |
+
{
|
16 |
+
$extra = $this->package->getExtra();
|
17 |
+
if (!empty($extra['install-directory-name'])) {
|
18 |
+
return $extra['install-directory-name'];
|
19 |
+
}
|
20 |
+
|
21 |
+
return $this->toCamelCase($this->package->getPrettyName());
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param string $packageName
|
26 |
+
*
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
private function toCamelCase($packageName)
|
30 |
+
{
|
31 |
+
return str_replace(' ', '', ucwords(str_replace('-', ' ', basename($packageName))));
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Format package name of mautic-plugins to CamelCase
|
36 |
+
*/
|
37 |
+
public function inflectPackageVars($vars)
|
38 |
+
{
|
39 |
+
|
40 |
+
if ($vars['type'] == 'mautic-plugin' || $vars['type'] == 'mautic-theme') {
|
41 |
+
$directoryName = $this->getDirectoryName();
|
42 |
+
$vars['name'] = $directoryName;
|
43 |
+
}
|
44 |
+
|
45 |
+
return $vars;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MayaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Format package name.
|
12 |
+
*
|
13 |
+
* For package type maya-module, cut off a trailing '-module' if present.
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
public function inflectPackageVars($vars)
|
17 |
+
{
|
18 |
+
if ($vars['type'] === 'maya-module') {
|
19 |
+
return $this->inflectModuleVars($vars);
|
20 |
+
}
|
21 |
+
|
22 |
+
return $vars;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function inflectModuleVars($vars)
|
26 |
+
{
|
27 |
+
$vars['name'] = preg_replace('/-module$/', '', $vars['name']);
|
28 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
29 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
30 |
+
|
31 |
+
return $vars;
|
32 |
+
}
|
33 |
+
}
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MediaWikiInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'core' => 'core/',
|
8 |
+
'extension' => 'extensions/{$name}/',
|
9 |
+
'skin' => 'skins/{$name}/',
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name.
|
14 |
+
*
|
15 |
+
* For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
|
16 |
+
* to CamelCase keeping existing uppercase chars.
|
17 |
+
*
|
18 |
+
* For package type mediawiki-skin, cut off a trailing '-skin' if present.
|
19 |
+
*
|
20 |
+
*/
|
21 |
+
public function inflectPackageVars($vars)
|
22 |
+
{
|
23 |
+
|
24 |
+
if ($vars['type'] === 'mediawiki-extension') {
|
25 |
+
return $this->inflectExtensionVars($vars);
|
26 |
+
}
|
27 |
+
|
28 |
+
if ($vars['type'] === 'mediawiki-skin') {
|
29 |
+
return $this->inflectSkinVars($vars);
|
30 |
+
}
|
31 |
+
|
32 |
+
return $vars;
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function inflectExtensionVars($vars)
|
36 |
+
{
|
37 |
+
$vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
|
38 |
+
$vars['name'] = str_replace('-', ' ', $vars['name']);
|
39 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
40 |
+
|
41 |
+
return $vars;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function inflectSkinVars($vars)
|
45 |
+
{
|
46 |
+
$vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
|
47 |
+
|
48 |
+
return $vars;
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class MiaoxingInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'plugin' => 'plugins/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MicroweberInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'userfiles/modules/{$install_item_dir}/',
|
8 |
+
'module-skin' => 'userfiles/modules/{$install_item_dir}/templates/',
|
9 |
+
'template' => 'userfiles/templates/{$install_item_dir}/',
|
10 |
+
'element' => 'userfiles/elements/{$install_item_dir}/',
|
11 |
+
'vendor' => 'vendor/{$install_item_dir}/',
|
12 |
+
'components' => 'components/{$install_item_dir}/'
|
13 |
+
);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Format package name.
|
17 |
+
*
|
18 |
+
* For package type microweber-module, cut off a trailing '-module' if present
|
19 |
+
*
|
20 |
+
* For package type microweber-template, cut off a trailing '-template' if present.
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
public function inflectPackageVars($vars)
|
24 |
+
{
|
25 |
+
|
26 |
+
|
27 |
+
if ($this->package->getTargetDir()) {
|
28 |
+
$vars['install_item_dir'] = $this->package->getTargetDir();
|
29 |
+
} else {
|
30 |
+
$vars['install_item_dir'] = $vars['name'];
|
31 |
+
if ($vars['type'] === 'microweber-template') {
|
32 |
+
return $this->inflectTemplateVars($vars);
|
33 |
+
}
|
34 |
+
if ($vars['type'] === 'microweber-templates') {
|
35 |
+
return $this->inflectTemplatesVars($vars);
|
36 |
+
}
|
37 |
+
if ($vars['type'] === 'microweber-core') {
|
38 |
+
return $this->inflectCoreVars($vars);
|
39 |
+
}
|
40 |
+
if ($vars['type'] === 'microweber-adapter') {
|
41 |
+
return $this->inflectCoreVars($vars);
|
42 |
+
}
|
43 |
+
if ($vars['type'] === 'microweber-module') {
|
44 |
+
return $this->inflectModuleVars($vars);
|
45 |
+
}
|
46 |
+
if ($vars['type'] === 'microweber-modules') {
|
47 |
+
return $this->inflectModulesVars($vars);
|
48 |
+
}
|
49 |
+
if ($vars['type'] === 'microweber-skin') {
|
50 |
+
return $this->inflectSkinVars($vars);
|
51 |
+
}
|
52 |
+
if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
|
53 |
+
return $this->inflectElementVars($vars);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
return $vars;
|
59 |
+
}
|
60 |
+
|
61 |
+
protected function inflectTemplateVars($vars)
|
62 |
+
{
|
63 |
+
$vars['install_item_dir'] = preg_replace('/-template$/', '', $vars['install_item_dir']);
|
64 |
+
$vars['install_item_dir'] = preg_replace('/template-$/', '', $vars['install_item_dir']);
|
65 |
+
|
66 |
+
return $vars;
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function inflectTemplatesVars($vars)
|
70 |
+
{
|
71 |
+
$vars['install_item_dir'] = preg_replace('/-templates$/', '', $vars['install_item_dir']);
|
72 |
+
$vars['install_item_dir'] = preg_replace('/templates-$/', '', $vars['install_item_dir']);
|
73 |
+
|
74 |
+
return $vars;
|
75 |
+
}
|
76 |
+
|
77 |
+
protected function inflectCoreVars($vars)
|
78 |
+
{
|
79 |
+
$vars['install_item_dir'] = preg_replace('/-providers$/', '', $vars['install_item_dir']);
|
80 |
+
$vars['install_item_dir'] = preg_replace('/-provider$/', '', $vars['install_item_dir']);
|
81 |
+
$vars['install_item_dir'] = preg_replace('/-adapter$/', '', $vars['install_item_dir']);
|
82 |
+
|
83 |
+
return $vars;
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function inflectModuleVars($vars)
|
87 |
+
{
|
88 |
+
$vars['install_item_dir'] = preg_replace('/-module$/', '', $vars['install_item_dir']);
|
89 |
+
$vars['install_item_dir'] = preg_replace('/module-$/', '', $vars['install_item_dir']);
|
90 |
+
|
91 |
+
return $vars;
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function inflectModulesVars($vars)
|
95 |
+
{
|
96 |
+
$vars['install_item_dir'] = preg_replace('/-modules$/', '', $vars['install_item_dir']);
|
97 |
+
$vars['install_item_dir'] = preg_replace('/modules-$/', '', $vars['install_item_dir']);
|
98 |
+
|
99 |
+
return $vars;
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function inflectSkinVars($vars)
|
103 |
+
{
|
104 |
+
$vars['install_item_dir'] = preg_replace('/-skin$/', '', $vars['install_item_dir']);
|
105 |
+
$vars['install_item_dir'] = preg_replace('/skin-$/', '', $vars['install_item_dir']);
|
106 |
+
|
107 |
+
return $vars;
|
108 |
+
}
|
109 |
+
|
110 |
+
protected function inflectElementVars($vars)
|
111 |
+
{
|
112 |
+
$vars['install_item_dir'] = preg_replace('/-elements$/', '', $vars['install_item_dir']);
|
113 |
+
$vars['install_item_dir'] = preg_replace('/elements-$/', '', $vars['install_item_dir']);
|
114 |
+
$vars['install_item_dir'] = preg_replace('/-element$/', '', $vars['install_item_dir']);
|
115 |
+
$vars['install_item_dir'] = preg_replace('/element-$/', '', $vars['install_item_dir']);
|
116 |
+
|
117 |
+
return $vars;
|
118 |
+
}
|
119 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An installer to handle MODX specifics when installing packages.
|
6 |
+
*/
|
7 |
+
class ModxInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'extra' => 'core/packages/{$name}/'
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class MoodleInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'mod' => 'mod/{$name}/',
|
8 |
+
'admin_report' => 'admin/report/{$name}/',
|
9 |
+
'atto' => 'lib/editor/atto/plugins/{$name}/',
|
10 |
+
'tool' => 'admin/tool/{$name}/',
|
11 |
+
'assignment' => 'mod/assignment/type/{$name}/',
|
12 |
+
'assignsubmission' => 'mod/assign/submission/{$name}/',
|
13 |
+
'assignfeedback' => 'mod/assign/feedback/{$name}/',
|
14 |
+
'auth' => 'auth/{$name}/',
|
15 |
+
'availability' => 'availability/condition/{$name}/',
|
16 |
+
'block' => 'blocks/{$name}/',
|
17 |
+
'booktool' => 'mod/book/tool/{$name}/',
|
18 |
+
'cachestore' => 'cache/stores/{$name}/',
|
19 |
+
'cachelock' => 'cache/locks/{$name}/',
|
20 |
+
'calendartype' => 'calendar/type/{$name}/',
|
21 |
+
'fileconverter' => 'files/converter/{$name}/',
|
22 |
+
'format' => 'course/format/{$name}/',
|
23 |
+
'coursereport' => 'course/report/{$name}/',
|
24 |
+
'customcertelement' => 'mod/customcert/element/{$name}/',
|
25 |
+
'datafield' => 'mod/data/field/{$name}/',
|
26 |
+
'datapreset' => 'mod/data/preset/{$name}/',
|
27 |
+
'editor' => 'lib/editor/{$name}/',
|
28 |
+
'enrol' => 'enrol/{$name}/',
|
29 |
+
'filter' => 'filter/{$name}/',
|
30 |
+
'gradeexport' => 'grade/export/{$name}/',
|
31 |
+
'gradeimport' => 'grade/import/{$name}/',
|
32 |
+
'gradereport' => 'grade/report/{$name}/',
|
33 |
+
'gradingform' => 'grade/grading/form/{$name}/',
|
34 |
+
'local' => 'local/{$name}/',
|
35 |
+
'logstore' => 'admin/tool/log/store/{$name}/',
|
36 |
+
'ltisource' => 'mod/lti/source/{$name}/',
|
37 |
+
'ltiservice' => 'mod/lti/service/{$name}/',
|
38 |
+
'message' => 'message/output/{$name}/',
|
39 |
+
'mnetservice' => 'mnet/service/{$name}/',
|
40 |
+
'plagiarism' => 'plagiarism/{$name}/',
|
41 |
+
'portfolio' => 'portfolio/{$name}/',
|
42 |
+
'qbehaviour' => 'question/behaviour/{$name}/',
|
43 |
+
'qformat' => 'question/format/{$name}/',
|
44 |
+
'qtype' => 'question/type/{$name}/',
|
45 |
+
'quizaccess' => 'mod/quiz/accessrule/{$name}/',
|
46 |
+
'quiz' => 'mod/quiz/report/{$name}/',
|
47 |
+
'report' => 'report/{$name}/',
|
48 |
+
'repository' => 'repository/{$name}/',
|
49 |
+
'scormreport' => 'mod/scorm/report/{$name}/',
|
50 |
+
'search' => 'search/engine/{$name}/',
|
51 |
+
'theme' => 'theme/{$name}/',
|
52 |
+
'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
|
53 |
+
'profilefield' => 'user/profile/field/{$name}/',
|
54 |
+
'webservice' => 'webservice/{$name}/',
|
55 |
+
'workshopallocation' => 'mod/workshop/allocation/{$name}/',
|
56 |
+
'workshopeval' => 'mod/workshop/eval/{$name}/',
|
57 |
+
'workshopform' => 'mod/workshop/form/{$name}/'
|
58 |
+
);
|
59 |
+
}
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class OctoberInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
'plugin' => 'plugins/{$vendor}/{$name}/',
|
9 |
+
'theme' => 'themes/{$vendor}-{$name}/'
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name.
|
14 |
+
*
|
15 |
+
* For package type october-plugin, cut off a trailing '-plugin' if present.
|
16 |
+
*
|
17 |
+
* For package type october-theme, cut off a trailing '-theme' if present.
|
18 |
+
*
|
19 |
+
*/
|
20 |
+
public function inflectPackageVars($vars)
|
21 |
+
{
|
22 |
+
if ($vars['type'] === 'october-plugin') {
|
23 |
+
return $this->inflectPluginVars($vars);
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($vars['type'] === 'october-theme') {
|
27 |
+
return $this->inflectThemeVars($vars);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function inflectPluginVars($vars)
|
34 |
+
{
|
35 |
+
$vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
|
36 |
+
$vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
|
37 |
+
|
38 |
+
return $vars;
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function inflectThemeVars($vars)
|
42 |
+
{
|
43 |
+
$vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
|
44 |
+
$vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
|
45 |
+
|
46 |
+
return $vars;
|
47 |
+
}
|
48 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class OntoWikiInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'extension' => 'extensions/{$name}/',
|
8 |
+
'theme' => 'extensions/themes/{$name}/',
|
9 |
+
'translation' => 'extensions/translations/{$name}/',
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name to lower case and remove ".ontowiki" suffix
|
14 |
+
*/
|
15 |
+
public function inflectPackageVars($vars)
|
16 |
+
{
|
17 |
+
$vars['name'] = strtolower($vars['name']);
|
18 |
+
$vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
|
19 |
+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
|
20 |
+
$vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
|
21 |
+
|
22 |
+
return $vars;
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
|
5 |
+
class OsclassInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
|
8 |
+
protected $locations = array(
|
9 |
+
'plugin' => 'oc-content/plugins/{$name}/',
|
10 |
+
'theme' => 'oc-content/themes/{$name}/',
|
11 |
+
'language' => 'oc-content/languages/{$name}/',
|
12 |
+
);
|
13 |
+
|
14 |
+
}
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\Package\PackageInterface;
|
5 |
+
|
6 |
+
class OxidInstaller extends BaseInstaller
|
7 |
+
{
|
8 |
+
const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
|
9 |
+
|
10 |
+
protected $locations = array(
|
11 |
+
'module' => 'modules/{$name}/',
|
12 |
+
'theme' => 'application/views/{$name}/',
|
13 |
+
'out' => 'out/{$name}/',
|
14 |
+
);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* getInstallPath
|
18 |
+
*
|
19 |
+
* @param PackageInterface $package
|
20 |
+
* @param string $frameworkType
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getInstallPath(PackageInterface $package, $frameworkType = '')
|
24 |
+
{
|
25 |
+
$installPath = parent::getInstallPath($package, $frameworkType);
|
26 |
+
$type = $this->package->getType();
|
27 |
+
if ($type === 'oxid-module') {
|
28 |
+
$this->prepareVendorDirectory($installPath);
|
29 |
+
}
|
30 |
+
return $installPath;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* prepareVendorDirectory
|
35 |
+
*
|
36 |
+
* Makes sure there is a vendormetadata.php file inside
|
37 |
+
* the vendor folder if there is a vendor folder.
|
38 |
+
*
|
39 |
+
* @param string $installPath
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
protected function prepareVendorDirectory($installPath)
|
43 |
+
{
|
44 |
+
$matches = '';
|
45 |
+
$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
|
46 |
+
if (!$hasVendorDirectory) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
$vendorDirectory = $matches['vendor'];
|
51 |
+
$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
|
52 |
+
if (!file_exists($vendorPath)) {
|
53 |
+
mkdir($vendorPath, 0755, true);
|
54 |
+
}
|
55 |
+
|
56 |
+
$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
|
57 |
+
touch($vendorMetaDataPath);
|
58 |
+
}
|
59 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PPIInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class PantheonInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
/** @var array<string, string> */
|
8 |
+
protected $locations = array(
|
9 |
+
'script' => 'web/private/scripts/quicksilver/{$name}',
|
10 |
+
'module' => 'web/private/scripts/quicksilver/{$name}',
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PhiftyInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'bundle' => 'bundles/{$name}/',
|
8 |
+
'library' => 'libraries/{$name}/',
|
9 |
+
'framework' => 'frameworks/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PhpBBInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'extension' => 'ext/{$vendor}/{$name}/',
|
8 |
+
'language' => 'language/{$name}/',
|
9 |
+
'style' => 'styles/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PimcoreInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'plugins/{$name}/',
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Format package name to CamelCase
|
12 |
+
*/
|
13 |
+
public function inflectPackageVars($vars)
|
14 |
+
{
|
15 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
16 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
17 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
18 |
+
|
19 |
+
return $vars;
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class PiwikInstaller
|
6 |
+
*
|
7 |
+
* @package Composer\Installers
|
8 |
+
*/
|
9 |
+
class PiwikInstaller extends BaseInstaller
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
protected $locations = array(
|
15 |
+
'plugin' => 'plugins/{$name}/',
|
16 |
+
);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Format package name to CamelCase
|
20 |
+
* @param array $vars
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function inflectPackageVars($vars)
|
25 |
+
{
|
26 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
27 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
28 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PlentymarketsInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => '{$name}/'
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Remove hyphen, "plugin" and format to camelcase
|
12 |
+
* @param array $vars
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function inflectPackageVars($vars)
|
17 |
+
{
|
18 |
+
$vars['name'] = explode("-", $vars['name']);
|
19 |
+
foreach ($vars['name'] as $key => $name) {
|
20 |
+
$vars['name'][$key] = ucfirst($vars['name'][$key]);
|
21 |
+
if (strcasecmp($name, "Plugin") == 0) {
|
22 |
+
unset($vars['name'][$key]);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
$vars['name'] = implode("",$vars['name']);
|
26 |
+
|
27 |
+
return $vars;
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
use Composer\Composer;
|
6 |
+
use Composer\IO\IOInterface;
|
7 |
+
use Composer\Plugin\PluginInterface;
|
8 |
+
|
9 |
+
class Plugin implements PluginInterface
|
10 |
+
{
|
11 |
+
private $installer;
|
12 |
+
|
13 |
+
public function activate(Composer $composer, IOInterface $io)
|
14 |
+
{
|
15 |
+
$this->installer = new Installer($io, $composer);
|
16 |
+
$composer->getInstallationManager()->addInstaller($this->installer);
|
17 |
+
}
|
18 |
+
|
19 |
+
public function deactivate(Composer $composer, IOInterface $io)
|
20 |
+
{
|
21 |
+
$composer->getInstallationManager()->removeInstaller($this->installer);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function uninstall(Composer $composer, IOInterface $io)
|
25 |
+
{
|
26 |
+
}
|
27 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PortoInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'container' => 'app/Containers/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PrestashopInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class ProcessWireInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'module' => 'site/modules/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name to CamelCase
|
13 |
+
*/
|
14 |
+
public function inflectPackageVars($vars)
|
15 |
+
{
|
16 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
17 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
18 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
19 |
+
|
20 |
+
return $vars;
|
21 |
+
}
|
22 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class PuppetInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
|
8 |
+
protected $locations = array(
|
9 |
+
'module' => 'modules/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class PxcmsInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'app/Modules/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name.
|
13 |
+
*
|
14 |
+
* @param array $vars
|
15 |
+
*
|
16 |
+
* @return array
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
if ($vars['type'] === 'pxcms-module') {
|
21 |
+
return $this->inflectModuleVars($vars);
|
22 |
+
}
|
23 |
+
|
24 |
+
if ($vars['type'] === 'pxcms-theme') {
|
25 |
+
return $this->inflectThemeVars($vars);
|
26 |
+
}
|
27 |
+
|
28 |
+
return $vars;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
|
33 |
+
*
|
34 |
+
* return string
|
35 |
+
*/
|
36 |
+
protected function inflectModuleVars($vars)
|
37 |
+
{
|
38 |
+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
|
39 |
+
$vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
|
40 |
+
$vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
|
41 |
+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
|
42 |
+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
|
43 |
+
|
44 |
+
return $vars;
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* For package type pxcms-module, cut off a trailing '-plugin' if present.
|
50 |
+
*
|
51 |
+
* return string
|
52 |
+
*/
|
53 |
+
protected function inflectThemeVars($vars)
|
54 |
+
{
|
55 |
+
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
|
56 |
+
$vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
|
57 |
+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
|
58 |
+
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
|
59 |
+
$vars['name'] = ucwords($vars['name']); // make module name camelcased
|
60 |
+
|
61 |
+
return $vars;
|
62 |
+
}
|
63 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class RadPHPInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'bundle' => 'src/{$name}/'
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Format package name to CamelCase
|
12 |
+
*/
|
13 |
+
public function inflectPackageVars($vars)
|
14 |
+
{
|
15 |
+
$nameParts = explode('/', $vars['name']);
|
16 |
+
foreach ($nameParts as &$value) {
|
17 |
+
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
|
18 |
+
$value = str_replace(array('-', '_'), ' ', $value);
|
19 |
+
$value = str_replace(' ', '', ucwords($value));
|
20 |
+
}
|
21 |
+
$vars['name'] = implode('/', $nameParts);
|
22 |
+
return $vars;
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ReIndexInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'theme' => 'themes/{$name}/',
|
8 |
+
'plugin' => 'plugins/{$name}/'
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class Redaxo5Installer extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'addon' => 'redaxo/src/addons/{$name}/',
|
8 |
+
'bestyle-plugin' => 'redaxo/src/addons/be_style/plugins/{$name}/'
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class RedaxoInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'addon' => 'redaxo/include/addons/{$name}/',
|
8 |
+
'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/'
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class RoundcubeInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'plugins/{$name}/',
|
8 |
+
);
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Lowercase name and changes the name to a underscores
|
12 |
+
*
|
13 |
+
* @param array $vars
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function inflectPackageVars($vars)
|
17 |
+
{
|
18 |
+
$vars['name'] = strtolower(str_replace('-', '_', $vars['name']));
|
19 |
+
|
20 |
+
return $vars;
|
21 |
+
}
|
22 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class SMFInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'Sources/{$name}/',
|
8 |
+
'theme' => 'Themes/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Plugin/theme installer for shopware
|
6 |
+
* @author Benjamin Boit
|
7 |
+
*/
|
8 |
+
class ShopwareInstaller extends BaseInstaller
|
9 |
+
{
|
10 |
+
protected $locations = array(
|
11 |
+
'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/',
|
12 |
+
'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
|
13 |
+
'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
|
14 |
+
'theme' => 'templates/{$name}/',
|
15 |
+
'plugin' => 'custom/plugins/{$name}/',
|
16 |
+
'frontend-theme' => 'themes/Frontend/{$name}/',
|
17 |
+
);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Transforms the names
|
21 |
+
* @param array $vars
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function inflectPackageVars($vars)
|
25 |
+
{
|
26 |
+
if ($vars['type'] === 'shopware-theme') {
|
27 |
+
return $this->correctThemeName($vars);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $this->correctPluginName($vars);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Changes the name to a camelcased combination of vendor and name
|
35 |
+
* @param array $vars
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
private function correctPluginName($vars)
|
39 |
+
{
|
40 |
+
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
|
41 |
+
return strtoupper($matches[0][1]);
|
42 |
+
}, $vars['name']);
|
43 |
+
|
44 |
+
$vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
|
45 |
+
|
46 |
+
return $vars;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Changes the name to a underscore separated name
|
51 |
+
* @param array $vars
|
52 |
+
* @return array
|
53 |
+
*/
|
54 |
+
private function correctThemeName($vars)
|
55 |
+
{
|
56 |
+
$vars['name'] = str_replace('-', '_', $vars['name']);
|
57 |
+
|
58 |
+
return $vars;
|
59 |
+
}
|
60 |
+
}
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
use Composer\Package\PackageInterface;
|
5 |
+
|
6 |
+
class SilverStripeInstaller extends BaseInstaller
|
7 |
+
{
|
8 |
+
protected $locations = array(
|
9 |
+
'module' => '{$name}/',
|
10 |
+
'theme' => 'themes/{$name}/',
|
11 |
+
);
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return the install path based on package type.
|
15 |
+
*
|
16 |
+
* Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
|
17 |
+
* must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
|
18 |
+
*
|
19 |
+
* @param PackageInterface $package
|
20 |
+
* @param string $frameworkType
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getInstallPath(PackageInterface $package, $frameworkType = '')
|
24 |
+
{
|
25 |
+
if (
|
26 |
+
$package->getName() == 'silverstripe/framework'
|
27 |
+
&& preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
|
28 |
+
&& version_compare($package->getVersion(), '2.999.999') < 0
|
29 |
+
) {
|
30 |
+
return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
|
31 |
+
}
|
32 |
+
|
33 |
+
return parent::getInstallPath($package, $frameworkType);
|
34 |
+
}
|
35 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class SiteDirectInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'module' => 'modules/{$vendor}/{$name}/',
|
9 |
+
'plugin' => 'plugins/{$vendor}/{$name}/'
|
10 |
+
);
|
11 |
+
|
12 |
+
public function inflectPackageVars($vars)
|
13 |
+
{
|
14 |
+
return $this->parseVars($vars);
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function parseVars($vars)
|
18 |
+
{
|
19 |
+
$vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
|
20 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
21 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
22 |
+
|
23 |
+
return $vars;
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class StarbugInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
'custom-module' => 'app/modules/{$name}/',
|
10 |
+
'custom-theme' => 'app/themes/{$name}/'
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class SyDESInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'app/modules/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format module name.
|
13 |
+
*
|
14 |
+
* Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
|
15 |
+
*
|
16 |
+
* {@inerhitDoc}
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
if ($vars['type'] == 'sydes-module') {
|
21 |
+
return $this->inflectModuleVars($vars);
|
22 |
+
}
|
23 |
+
|
24 |
+
if ($vars['type'] === 'sydes-theme') {
|
25 |
+
return $this->inflectThemeVars($vars);
|
26 |
+
}
|
27 |
+
|
28 |
+
return $vars;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function inflectModuleVars($vars)
|
32 |
+
{
|
33 |
+
$vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
|
34 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
35 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
36 |
+
|
37 |
+
return $vars;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function inflectThemeVars($vars)
|
41 |
+
{
|
42 |
+
$vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
|
43 |
+
$vars['name'] = strtolower($vars['name']);
|
44 |
+
|
45 |
+
return $vars;
|
46 |
+
}
|
47 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class SyliusInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'theme' => 'themes/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Plugin installer for symfony 1.x
|
6 |
+
*
|
7 |
+
* @author Jérôme Tamarelle <jerome@tamarelle.net>
|
8 |
+
*/
|
9 |
+
class Symfony1Installer extends BaseInstaller
|
10 |
+
{
|
11 |
+
protected $locations = array(
|
12 |
+
'plugin' => 'plugins/{$name}/',
|
13 |
+
);
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Format package name to CamelCase
|
17 |
+
*/
|
18 |
+
public function inflectPackageVars($vars)
|
19 |
+
{
|
20 |
+
$vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
|
21 |
+
return strtoupper($matches[0][1]);
|
22 |
+
}, $vars['name']);
|
23 |
+
|
24 |
+
return $vars;
|
25 |
+
}
|
26 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Extension installer for TYPO3 CMS
|
6 |
+
*
|
7 |
+
* @deprecated since 1.0.25, use https://packagist.org/packages/typo3/cms-composer-installers instead
|
8 |
+
*
|
9 |
+
* @author Sascha Egerer <sascha.egerer@dkd.de>
|
10 |
+
*/
|
11 |
+
class TYPO3CmsInstaller extends BaseInstaller
|
12 |
+
{
|
13 |
+
protected $locations = array(
|
14 |
+
'extension' => 'typo3conf/ext/{$name}/',
|
15 |
+
);
|
16 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An installer to handle TYPO3 Flow specifics when installing packages.
|
6 |
+
*/
|
7 |
+
class TYPO3FlowInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'package' => 'Packages/Application/{$name}/',
|
11 |
+
'framework' => 'Packages/Framework/{$name}/',
|
12 |
+
'plugin' => 'Packages/Plugins/{$name}/',
|
13 |
+
'site' => 'Packages/Sites/{$name}/',
|
14 |
+
'boilerplate' => 'Packages/Boilerplates/{$name}/',
|
15 |
+
'build' => 'Build/{$name}/',
|
16 |
+
);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Modify the package name to be a TYPO3 Flow style key.
|
20 |
+
*
|
21 |
+
* @param array $vars
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function inflectPackageVars($vars)
|
25 |
+
{
|
26 |
+
$autoload = $this->package->getAutoload();
|
27 |
+
if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
|
28 |
+
$namespace = key($autoload['psr-0']);
|
29 |
+
$vars['name'] = str_replace('\\', '.', $namespace);
|
30 |
+
}
|
31 |
+
if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) {
|
32 |
+
$namespace = key($autoload['psr-4']);
|
33 |
+
$vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.');
|
34 |
+
}
|
35 |
+
|
36 |
+
return $vars;
|
37 |
+
}
|
38 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An installer to handle TAO extensions.
|
6 |
+
*/
|
7 |
+
class TaoInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
const EXTRA_TAO_EXTENSION_NAME = 'tao-extension-name';
|
10 |
+
|
11 |
+
protected $locations = array(
|
12 |
+
'extension' => '{$name}'
|
13 |
+
);
|
14 |
+
|
15 |
+
public function inflectPackageVars($vars)
|
16 |
+
{
|
17 |
+
$extra = $this->package->getExtra();
|
18 |
+
|
19 |
+
if (array_key_exists(self::EXTRA_TAO_EXTENSION_NAME, $extra)) {
|
20 |
+
$vars['name'] = $extra[self::EXTRA_TAO_EXTENSION_NAME];
|
21 |
+
return $vars;
|
22 |
+
}
|
23 |
+
|
24 |
+
$vars['name'] = str_replace('extension-', '', $vars['name']);
|
25 |
+
$vars['name'] = str_replace('-', ' ', $vars['name']);
|
26 |
+
$vars['name'] = lcfirst(str_replace(' ', '', ucwords($vars['name'])));
|
27 |
+
|
28 |
+
return $vars;
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class TastyIgniterInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'extension' => 'extensions/{$vendor}/{$name}/',
|
9 |
+
'theme' => 'themes/{$name}/',
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name.
|
14 |
+
*
|
15 |
+
* Cut off leading 'ti-ext-' or 'ti-theme-' if present.
|
16 |
+
* Strip vendor name of characters that is not alphanumeric or an underscore
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function inflectPackageVars($vars)
|
20 |
+
{
|
21 |
+
if ($vars['type'] === 'tastyigniter-extension') {
|
22 |
+
$vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
|
23 |
+
$vars['name'] = preg_replace('/^ti-ext-/', '', $vars['name']);
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($vars['type'] === 'tastyigniter-theme') {
|
27 |
+
$vars['name'] = preg_replace('/^ti-theme-/', '', $vars['name']);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class TheliaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'local/modules/{$name}/',
|
8 |
+
'frontoffice-template' => 'templates/frontOffice/{$name}/',
|
9 |
+
'backoffice-template' => 'templates/backOffice/{$name}/',
|
10 |
+
'email-template' => 'templates/email/{$name}/',
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
/**
|
4 |
+
* Composer installer for 3rd party Tusk utilities
|
5 |
+
* @author Drew Ewing <drew@phenocode.com>
|
6 |
+
*/
|
7 |
+
class TuskInstaller extends BaseInstaller
|
8 |
+
{
|
9 |
+
protected $locations = array(
|
10 |
+
'task' => '.tusk/tasks/{$name}/',
|
11 |
+
'command' => '.tusk/commands/{$name}/',
|
12 |
+
'asset' => 'assets/tusk/{$name}/',
|
13 |
+
);
|
14 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class UserFrostingInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'sprinkle' => 'app/sprinkles/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class VanillaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'plugins/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/',
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class VgmcpInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'bundle' => 'src/{$vendor}/{$name}/',
|
8 |
+
'theme' => 'themes/{$name}/'
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Format package name.
|
13 |
+
*
|
14 |
+
* For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
|
15 |
+
*
|
16 |
+
* For package type vgmcp-theme, cut off a trailing '-theme' if present.
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function inflectPackageVars($vars)
|
20 |
+
{
|
21 |
+
if ($vars['type'] === 'vgmcp-bundle') {
|
22 |
+
return $this->inflectPluginVars($vars);
|
23 |
+
}
|
24 |
+
|
25 |
+
if ($vars['type'] === 'vgmcp-theme') {
|
26 |
+
return $this->inflectThemeVars($vars);
|
27 |
+
}
|
28 |
+
|
29 |
+
return $vars;
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function inflectPluginVars($vars)
|
33 |
+
{
|
34 |
+
$vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
|
35 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
36 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
37 |
+
|
38 |
+
return $vars;
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function inflectThemeVars($vars)
|
42 |
+
{
|
43 |
+
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
|
44 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
45 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
46 |
+
|
47 |
+
return $vars;
|
48 |
+
}
|
49 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Composer\Installers;
|
4 |
+
|
5 |
+
class WHMCSInstaller extends BaseInstaller
|
6 |
+
{
|
7 |
+
protected $locations = array(
|
8 |
+
'addons' => 'modules/addons/{$vendor}_{$name}/',
|
9 |
+
'fraud' => 'modules/fraud/{$vendor}_{$name}/',
|
10 |
+
'gateways' => 'modules/gateways/{$vendor}_{$name}/',
|
11 |
+
'notifications' => 'modules/notifications/{$vendor}_{$name}/',
|
12 |
+
'registrars' => 'modules/registrars/{$vendor}_{$name}/',
|
13 |
+
'reports' => 'modules/reports/{$vendor}_{$name}/',
|
14 |
+
'security' => 'modules/security/{$vendor}_{$name}/',
|
15 |
+
'servers' => 'modules/servers/{$vendor}_{$name}/',
|
16 |
+
'social' => 'modules/social/{$vendor}_{$name}/',
|
17 |
+
'support' => 'modules/support/{$vendor}_{$name}/',
|
18 |
+
'templates' => 'templates/{$vendor}_{$name}/',
|
19 |
+
'includes' => 'includes/{$vendor}_{$name}/'
|
20 |
+
);
|
21 |
+
}
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class WinterInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$name}/',
|
8 |
+
'plugin' => 'plugins/{$vendor}/{$name}/',
|
9 |
+
'theme' => 'themes/{$name}/'
|
10 |
+
);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Format package name.
|
14 |
+
*
|
15 |
+
* For package type winter-plugin, cut off a trailing '-plugin' if present.
|
16 |
+
*
|
17 |
+
* For package type winter-theme, cut off a trailing '-theme' if present.
|
18 |
+
*
|
19 |
+
*/
|
20 |
+
public function inflectPackageVars($vars)
|
21 |
+
{
|
22 |
+
if ($vars['type'] === 'winter-module') {
|
23 |
+
return $this->inflectModuleVars($vars);
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($vars['type'] === 'winter-plugin') {
|
27 |
+
return $this->inflectPluginVars($vars);
|
28 |
+
}
|
29 |
+
|
30 |
+
if ($vars['type'] === 'winter-theme') {
|
31 |
+
return $this->inflectThemeVars($vars);
|
32 |
+
}
|
33 |
+
|
34 |
+
return $vars;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function inflectModuleVars($vars)
|
38 |
+
{
|
39 |
+
$vars['name'] = preg_replace('/^wn-|-module$/', '', $vars['name']);
|
40 |
+
|
41 |
+
return $vars;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function inflectPluginVars($vars)
|
45 |
+
{
|
46 |
+
$vars['name'] = preg_replace('/^wn-|-plugin$/', '', $vars['name']);
|
47 |
+
$vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
|
48 |
+
|
49 |
+
return $vars;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function inflectThemeVars($vars)
|
53 |
+
{
|
54 |
+
$vars['name'] = preg_replace('/^wn-|-theme$/', '', $vars['name']);
|
55 |
+
|
56 |
+
return $vars;
|
57 |
+
}
|
58 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class WolfCMSInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'wolf/plugins/{$name}/',
|
8 |
+
);
|
9 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class WordPressInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'plugin' => 'wp-content/plugins/{$name}/',
|
8 |
+
'theme' => 'wp-content/themes/{$name}/',
|
9 |
+
'muplugin' => 'wp-content/mu-plugins/{$name}/',
|
10 |
+
'dropin' => 'wp-content/{$name}/',
|
11 |
+
);
|
12 |
+
}
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: cbleek
|
5 |
+
* Date: 25.03.16
|
6 |
+
* Time: 20:55
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Composer\Installers;
|
10 |
+
|
11 |
+
|
12 |
+
class YawikInstaller extends BaseInstaller
|
13 |
+
{
|
14 |
+
protected $locations = array(
|
15 |
+
'module' => 'module/{$name}/',
|
16 |
+
);
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Format package name to CamelCase
|
20 |
+
* @param array $vars
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function inflectPackageVars($vars)
|
25 |
+
{
|
26 |
+
$vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
|
27 |
+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
|
28 |
+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
|
29 |
+
|
30 |
+
return $vars;
|
31 |
+
}
|
32 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ZendInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'library' => 'library/{$name}/',
|
8 |
+
'extra' => 'extras/library/{$name}/',
|
9 |
+
'module' => 'module/{$name}/',
|
10 |
+
);
|
11 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Composer\Installers;
|
3 |
+
|
4 |
+
class ZikulaInstaller extends BaseInstaller
|
5 |
+
{
|
6 |
+
protected $locations = array(
|
7 |
+
'module' => 'modules/{$vendor}-{$name}/',
|
8 |
+
'theme' => 'themes/{$vendor}-{$name}/'
|
9 |
+
);
|
10 |
+
}
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function includeIfExists($file)
|
3 |
+
{
|
4 |
+
if (file_exists($file)) {
|
5 |
+
return include $file;
|
6 |
+
}
|
7 |
+
}
|
8 |
+
if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
|
9 |
+
die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
|
10 |
+
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
|
11 |
+
'php composer.phar install'.PHP_EOL);
|
12 |
+
}
|
13 |
+
return $loader;
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// platform_check.php @generated by Composer
|
4 |
+
|
5 |
+
$issues = array();
|
6 |
+
|
7 |
+
if (!(PHP_VERSION_ID >= 50600)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
|
9 |
+
}
|
10 |
+
|
11 |
+
if ($issues) {
|
12 |
+
if (!headers_sent()) {
|
13 |
+
header('HTTP/1.1 500 Internal Server Error');
|
14 |
+
}
|
15 |
+
if (!ini_get('display_errors')) {
|
16 |
+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
17 |
+
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
18 |
+
} elseif (!headers_sent()) {
|
19 |
+
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
trigger_error(
|
23 |
+
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
24 |
+
E_USER_ERROR
|
25 |
+
);
|
26 |
+
}
|
@@ -9,7 +9,7 @@
|
|
9 |
* @author Shea Bunge <shea@codesnippets.pro>
|
10 |
* @copyright 2012-2022 Shea Bunge
|
11 |
* @license GPL-2.0-or-later https://spdx.org/licenses/GPL-2.0-or-later.html
|
12 |
-
* @version 3.
|
13 |
* @link https://github.com/sheabunge/code-snippets
|
14 |
*/
|
15 |
|
@@ -19,11 +19,10 @@ Plugin URI: https://codesnippets.pro
|
|
19 |
Description: An easy, clean and simple way to run code snippets on your site. No need to edit to your theme's functions.php file again!
|
20 |
Author: Code Snippets Pro
|
21 |
Author URI: https://codesnippets.pro
|
22 |
-
Version: 3.
|
23 |
License: GPL-2.0-or-later
|
24 |
License URI: license.txt
|
25 |
Text Domain: code-snippets
|
26 |
-
Domain Path: /languages
|
27 |
Requires PHP: 5.6
|
28 |
Requires at least: 3.6
|
29 |
*/
|
9 |
* @author Shea Bunge <shea@codesnippets.pro>
|
10 |
* @copyright 2012-2022 Shea Bunge
|
11 |
* @license GPL-2.0-or-later https://spdx.org/licenses/GPL-2.0-or-later.html
|
12 |
+
* @version 3.2.1
|
13 |
* @link https://github.com/sheabunge/code-snippets
|
14 |
*/
|
15 |
|
19 |
Description: An easy, clean and simple way to run code snippets on your site. No need to edit to your theme's functions.php file again!
|
20 |
Author: Code Snippets Pro
|
21 |
Author URI: https://codesnippets.pro
|
22 |
+
Version: 3.2.1
|
23 |
License: GPL-2.0-or-later
|
24 |
License URI: license.txt
|
25 |
Text Domain: code-snippets
|
|
|
26 |
Requires PHP: 5.6
|
27 |
Requires at least: 3.6
|
28 |
*/
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
$php-active: #0073aa;
|
3 |
+
$php-inactive: #579;
|
4 |
+
$php-background: #78c8e6;
|
5 |
+
|
6 |
+
$css-inactive: #b452cd;
|
7 |
+
$css-active: #7d26cd;
|
8 |
+
$css-background: #551a8b;
|
9 |
+
$css-highlight: #8000ff;
|
10 |
+
|
11 |
+
$html-active: #548b54;
|
12 |
+
$html-background: #548b54;
|
13 |
+
$html-highlight: $html-active;
|
14 |
+
|
15 |
+
$js-inactive: #cd6600;
|
16 |
+
$js-active: #d44500;
|
17 |
+
$js-background: #cd6600;
|
18 |
+
$js-highlight: #cd6600;
|
19 |
+
|
20 |
+
|
21 |
+
@mixin link-colors($color, $lightness: 15%) {
|
22 |
+
a {
|
23 |
+
color: $color;
|
24 |
+
|
25 |
+
&:hover, &:active, &:focus {
|
26 |
+
color: lighten($color, $lightness);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/codemirror-colorpicker/dist/codemirror-colorpicker.css';
|
2 |
+
|
3 |
+
.CodeMirror {
|
4 |
+
border: 1px solid #dfdfdf;
|
5 |
+
border-radius: 3px;
|
6 |
+
background-color: #fff;
|
7 |
+
height: auto !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.CodeMirror-code {
|
11 |
+
outline: none;
|
12 |
+
}
|
13 |
+
|
14 |
+
.CodeMirror-focused .cm-matchhighlight {
|
15 |
+
color: white !important;
|
16 |
+
outline: 1px solid green;
|
17 |
+
}
|
18 |
+
|
19 |
+
/* Add a bit of extra space above the editor */
|
20 |
+
.CodeMirror-sizer {
|
21 |
+
|
22 |
+
&::before, &::after {
|
23 |
+
display: block;
|
24 |
+
color: #bbb;
|
25 |
+
}
|
26 |
+
|
27 |
+
&::before {
|
28 |
+
content: '';
|
29 |
+
padding-bottom: 5px;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Fix cursor color with rubyblue theme (see https://goo.gl/3HDgRm */
|
34 |
+
.cm-s-rubyblue .CodeMirror-cursor {
|
35 |
+
border-left: 1px solid white !important;
|
36 |
+
}
|
37 |
+
|
38 |
+
[class*="CodeMirror-lint-marker"], [class*="CodeMirror-lint-message"], .CodeMirror-lint-marker-multiple {
|
39 |
+
background-image: none;
|
40 |
+
}
|
41 |
+
|
42 |
+
.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
|
43 |
+
cursor: help;
|
44 |
+
}
|
45 |
+
|
46 |
+
.CodeMirror-lint-marker-multiple {
|
47 |
+
position: absolute;
|
48 |
+
top: 0;
|
49 |
+
}
|
50 |
+
|
51 |
+
[class*="CodeMirror-lint-marker"]:before {
|
52 |
+
font: normal 18px/1 dashicons;
|
53 |
+
position: relative;
|
54 |
+
top: -2px;
|
55 |
+
}
|
56 |
+
|
57 |
+
[class*="CodeMirror-lint-message"]:before {
|
58 |
+
font: normal 16px/1 dashicons;
|
59 |
+
left: 16px;
|
60 |
+
position: absolute;
|
61 |
+
}
|
62 |
+
|
63 |
+
.CodeMirror-lint-message-error,
|
64 |
+
.CodeMirror-lint-message-warning {
|
65 |
+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
66 |
+
margin: 5px 0 2px;
|
67 |
+
padding: 3px 12px 3px 28px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.CodeMirror-lint-message-warning {
|
71 |
+
background-color: #fff8e5;
|
72 |
+
border-left: 4px solid #ffb900;
|
73 |
+
}
|
74 |
+
|
75 |
+
.CodeMirror-lint-marker-warning::before, .CodeMirror-lint-message-warning::before {
|
76 |
+
content: "\f534";
|
77 |
+
color: #f6a306;
|
78 |
+
}
|
79 |
+
|
80 |
+
.CodeMirror-lint-message-error {
|
81 |
+
background-color: #fbeaea;
|
82 |
+
border-left: 4px solid #dc3232;
|
83 |
+
}
|
84 |
+
|
85 |
+
.CodeMirror-lint-marker-error::before, .CodeMirror-lint-message-error::before {
|
86 |
+
content: "\f153";
|
87 |
+
color: #dc3232;
|
88 |
+
}
|
89 |
+
|
90 |
+
.CodeMirror-lint-tooltip {
|
91 |
+
background: none;
|
92 |
+
border: none;
|
93 |
+
border-radius: 0;
|
94 |
+
direction: ltr;
|
95 |
+
}
|
96 |
+
|
97 |
+
.CodeMirror .CodeMirror-matchingbracket {
|
98 |
+
background: rgba(255, 150, 0, .3);
|
99 |
+
color: inherit;
|
100 |
+
}
|
101 |
+
|
102 |
+
.CodeMirror .CodeMirror-linenumber {
|
103 |
+
color: #666;
|
104 |
+
}
|
105 |
+
|
106 |
+
.CodeMirror-foldmarker {
|
107 |
+
color: inherit;
|
108 |
+
margin-left: 0.25em;
|
109 |
+
margin-right: 0.25em;
|
110 |
+
font-weight: bold;
|
111 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import 'base';
|
2 |
+
|
3 |
+
.nav-tab .badge, .snippet-type-badge, .go-pro-button .badge {
|
4 |
+
font-size: 10px;
|
5 |
+
text-transform: uppercase;
|
6 |
+
border: 1px solid;
|
7 |
+
padding: 1px 2px;
|
8 |
+
border-radius: 5px;
|
9 |
+
}
|
10 |
+
|
11 |
+
.nav-tab .badge, .button .snippet-type-badge, .go-pro-button .badge,
|
12 |
+
h1 .snippet-type-badge, h2 .snippet-type-badge, h3 .snippet-type-badge {
|
13 |
+
/* rtl:ignore */
|
14 |
+
margin-left: 3px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.nav-tab span,
|
18 |
+
.nav-tab .badge {
|
19 |
+
vertical-align: middle;
|
20 |
+
}
|
21 |
+
|
22 |
+
$badges: (php: $php-active, css: $css-highlight, js: $js-highlight, html: $html-active);
|
23 |
+
|
24 |
+
@each $type, $color in $badges {
|
25 |
+
.nav-tab[data-type=#{$type}] .badge, .snippet-type-badge[data-type=#{$type}] {
|
26 |
+
color: $color;
|
27 |
+
border-color: currentColor;
|
28 |
+
}
|
29 |
+
|
30 |
+
.nav-tab-inactive[data-type=#{$type}]:hover .badge {
|
31 |
+
color: $color;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
.nav-tab-button .dashicons-external {
|
36 |
+
font-size: 15px;
|
37 |
+
color: #666;
|
38 |
+
vertical-align: middle;
|
39 |
+
}
|
40 |
+
|
41 |
+
.nav-tab.nav-tab-inactive {
|
42 |
+
background: #f6f7f7;
|
43 |
+
border-color: #f6f7f7;
|
44 |
+
text-shadow: 0 1px 0 #fff;
|
45 |
+
float: right;
|
46 |
+
|
47 |
+
&, .badge {
|
48 |
+
color: #a7aaad;
|
49 |
+
}
|
50 |
+
|
51 |
+
&:hover {
|
52 |
+
color: #50575e;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
.go-pro-button .badge {
|
57 |
+
color: #ce0000;
|
58 |
+
border-color: #ce0000;
|
59 |
+
margin-left: 1px;
|
60 |
+
}
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/@jcubic/tagger/tagger.css';
|
2 |
+
@import 'editor';
|
3 |
+
|
4 |
+
@import 'type-badges';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Custom styling for the single snippet admin page
|
8 |
+
*/
|
9 |
+
|
10 |
+
.form-table th {
|
11 |
+
width: auto;
|
12 |
+
}
|
13 |
+
|
14 |
+
h2 {
|
15 |
+
/* Provide some decent space between the fields and titles */
|
16 |
+
margin: 25px 0 15px 0;
|
17 |
+
|
18 |
+
&:first-of-type {
|
19 |
+
margin-top: 20px;
|
20 |
+
}
|
21 |
+
|
22 |
+
label {
|
23 |
+
cursor: auto;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
.inactive-snippet, .active-snippet {
|
28 |
+
#title {
|
29 |
+
border-left-width: 4px;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
.active-snippet #title {
|
34 |
+
border-left-color: #46b450;
|
35 |
+
}
|
36 |
+
|
37 |
+
.inactive-snippet #title {
|
38 |
+
border-left-color: #bbb;
|
39 |
+
}
|
40 |
+
|
41 |
+
.erroneous-snippet #title {
|
42 |
+
border-left-color: #dc3232;
|
43 |
+
}
|
44 |
+
|
45 |
+
#snippet-form {
|
46 |
+
margin-top: 10px
|
47 |
+
}
|
48 |
+
|
49 |
+
/* Position the description heading on the same level as the editor buttons */
|
50 |
+
label[for='snippet_description'] h3 div {
|
51 |
+
position: absolute;
|
52 |
+
}
|
53 |
+
|
54 |
+
/* Add spacing in between the action buttons */
|
55 |
+
.button + .button {
|
56 |
+
margin-left: .5em;
|
57 |
+
}
|
58 |
+
|
59 |
+
.submit-inline {
|
60 |
+
float: right;
|
61 |
+
}
|
62 |
+
|
63 |
+
p.snippet-scope, .snippet-scope p {
|
64 |
+
margin-top: 15px;
|
65 |
+
}
|
66 |
+
|
67 |
+
.snippet-scope label,
|
68 |
+
.html-shortcode-options strong {
|
69 |
+
display: inline-block;
|
70 |
+
margin-right: 1.5em;
|
71 |
+
}
|
72 |
+
|
73 |
+
.below-editor {
|
74 |
+
display: flex;
|
75 |
+
justify-content: space-between;
|
76 |
+
}
|
77 |
+
|
78 |
+
.snippet-priority {
|
79 |
+
|
80 |
+
label {
|
81 |
+
font-weight: bold;
|
82 |
+
cursor: help;
|
83 |
+
font-size: 1.1em;
|
84 |
+
padding-right: 0.5em;
|
85 |
+
}
|
86 |
+
|
87 |
+
input {
|
88 |
+
width: 4em;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
.snippet-editor {
|
93 |
+
position: relative;
|
94 |
+
}
|
95 |
+
|
96 |
+
.CodeMirror {
|
97 |
+
width: 100%;
|
98 |
+
}
|
99 |
+
|
100 |
+
.wrap h2.nav-tab-wrapper {
|
101 |
+
border-bottom: none;
|
102 |
+
}
|
103 |
+
|
104 |
+
.code-snippets-copy-text {
|
105 |
+
color: inherit;
|
106 |
+
}
|
107 |
+
|
108 |
+
@import 'edit/tooltips';
|
109 |
+
@import 'edit/types';
|
110 |
+
@import 'edit/tags';
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.tagger {
|
3 |
+
border: 0;
|
4 |
+
|
5 |
+
ul {
|
6 |
+
border: 1px solid #dfdfdf;
|
7 |
+
border-radius: 3px;
|
8 |
+
background-color: #fff;
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
.tagger-new ul,
|
13 |
+
.tagger > ul > li:not(.tagger-new) > a,
|
14 |
+
.tagger li:not(.tagger-new) > span {
|
15 |
+
border-radius: 6px;
|
16 |
+
border: 1px solid #cad8f3;
|
17 |
+
background-color: #dee7f8;
|
18 |
+
|
19 |
+
&:hover {
|
20 |
+
background-color: #bbcef1;
|
21 |
+
border-color: #6d95e0;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
.tagger-new ul,
|
26 |
+
.tagger > ul > li:not(.tagger-new) {
|
27 |
+
a, a:visited {
|
28 |
+
color: #555;
|
29 |
+
font-size: 1.1em;
|
30 |
+
}
|
31 |
+
}
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.editor-help-tooltip {
|
3 |
+
cursor: help;
|
4 |
+
padding: 0.3em 0.3em 0;
|
5 |
+
display: inline-block;
|
6 |
+
font-size: 10px;
|
7 |
+
background: transparent !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.snippet-editor-help {
|
11 |
+
position: absolute;
|
12 |
+
right: 5px;
|
13 |
+
top: 5px;
|
14 |
+
|
15 |
+
&:hover .editor-help-text {
|
16 |
+
visibility: visible;
|
17 |
+
opacity: 1;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
.editor-help-text {
|
22 |
+
visibility: hidden;
|
23 |
+
background-color: #555;
|
24 |
+
color: #fff;
|
25 |
+
padding: 5px;
|
26 |
+
border-radius: 6px;
|
27 |
+
position: absolute;
|
28 |
+
z-index: 99;
|
29 |
+
top: 125%;
|
30 |
+
right: 0;
|
31 |
+
margin-right: -10px;
|
32 |
+
opacity: 0;
|
33 |
+
transition: opacity 0.3s;
|
34 |
+
white-space: nowrap;
|
35 |
+
font-size: small;
|
36 |
+
|
37 |
+
&::after {
|
38 |
+
content: "";
|
39 |
+
position: absolute;
|
40 |
+
bottom: 100%;
|
41 |
+
right: 0;
|
42 |
+
margin-right: 10px;
|
43 |
+
border: 5px solid transparent;
|
44 |
+
border-bottom-color: #555;
|
45 |
+
}
|
46 |
+
|
47 |
+
td:first-child {
|
48 |
+
padding-right: 0.5em;
|
49 |
+
}
|
50 |
+
|
51 |
+
.mac-key {
|
52 |
+
display: none;
|
53 |
+
}
|
54 |
+
|
55 |
+
&.platform-mac {
|
56 |
+
.mac-key {
|
57 |
+
display: inline;
|
58 |
+
}
|
59 |
+
|
60 |
+
.pc-key {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.CodeMirror-sizer {
|
3 |
+
min-height: 300px !important;
|
4 |
+
box-sizing: border-box;
|
5 |
+
padding-bottom: 1.5em !important;
|
6 |
+
|
7 |
+
&::after {
|
8 |
+
position: absolute;
|
9 |
+
bottom: 0;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
.snippet-scope {
|
14 |
+
display: none;
|
15 |
+
|
16 |
+
.description {
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
[data-snippet-type=php] {
|
22 |
+
|
23 |
+
.php-scopes-list {
|
24 |
+
display: block;
|
25 |
+
}
|
26 |
+
|
27 |
+
.CodeMirror-sizer {
|
28 |
+
padding-bottom: 0 !important;
|
29 |
+
}
|
30 |
+
|
31 |
+
.CodeMirror-sizer::before {
|
32 |
+
content: '<?php';
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
[data-snippet-type=css] {
|
37 |
+
|
38 |
+
.css-scopes-list {
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
|
42 |
+
.CodeMirror-sizer::before {
|
43 |
+
content: '<style>';
|
44 |
+
}
|
45 |
+
|
46 |
+
.CodeMirror-sizer::after {
|
47 |
+
content: '</style>';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
[data-snippet-type=js] {
|
52 |
+
|
53 |
+
.js-scopes-list {
|
54 |
+
display: block;
|
55 |
+
}
|
56 |
+
|
57 |
+
.CodeMirror-sizer::before {
|
58 |
+
content: '<script>';
|
59 |
+
}
|
60 |
+
|
61 |
+
.CodeMirror-sizer::after {
|
62 |
+
content: '</script>';
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
[data-snippet-type=html] {
|
67 |
+
|
68 |
+
.html-scopes-list {
|
69 |
+
display: block;
|
70 |
+
}
|
71 |
+
|
72 |
+
.CodeMirror-sizer::before {
|
73 |
+
content: '<!-- begin content -->';
|
74 |
+
}
|
75 |
+
|
76 |
+
.CodeMirror-sizer::after {
|
77 |
+
content: '<!-- end content -->';
|
78 |
+
}
|
79 |
+
}
|
Binary file
|
@@ -1,11 +0,0 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
-
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
-
<metadata>Generated by IcoMoon</metadata>
|
5 |
-
<defs>
|
6 |
-
<font id="code-snippets" horiz-adv-x="1024">
|
7 |
-
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
-
<missing-glyph horiz-adv-x="1024" />
|
9 |
-
<glyph unicode=" " d="" horiz-adv-x="512" />
|
10 |
-
<glyph unicode="" d="M191.968 495.776h158.912c23.68 0 42.656-19.2 42.656-42.656 0-11.488-4.48-21.984-11.968-29.632l0.192-0.448-108.768-108.736c-75.104-75.136-75.104-196.512 0-271.584 74.88-74.848 196.448-74.848 271.552 0 74.88 75.104 74.88 196.48 0 271.584-21.76 21.504-47.36 37.12-74.464 46.272l28.608 28.576h365.248c87.040 0 157.856 74.016 159.968 166.4 0 1.472 0.224 2.752 0 4.256-2.112 23.904-22.368 42.656-46.912 42.656h-264.96l191.328 191.328c17.504 17.504 18.56 45.024 3.2 63.36-1.024 1.28-2.080 2.144-3.2 3.2-66.528 63.552-169.152 65.92-230.56 4.48l-262.368-262.368h-46.528c12.8 25.6 20.032 54.624 20.032 85.344 0 106.016-85.952 192-192 192-106.016 0-191.968-85.984-191.968-192 0.032-106.080 85.984-192.032 192-192.032zM277.312 687.744c0-47.136-38.176-85.344-85.344-85.344-47.136 0-85.312 38.176-85.312 85.344s38.176 85.344 85.312 85.344c47.168 0 85.344-38.208 85.344-85.344zM469.088 238.688c33.28-33.248 33.28-87.264 0-120.512-33.28-33.472-87.264-33.472-120.736 0-33.28 33.248-33.28 87.264 0 120.512 33.472 33.504 87.456 33.504 120.736 0z" />
|
11 |
-
</font></defs></svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Binary file
|
Binary file
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Custom styling for the snippets table
|
3 |
+
*/
|
4 |
+
|
5 |
+
$active-color: #2196f3;
|
6 |
+
$inactive-color: #ccc;
|
7 |
+
|
8 |
+
@import 'type-badges';
|
9 |
+
|
10 |
+
.wp-core-ui .button.nav-tab-button {
|
11 |
+
margin-left: 0.5em;
|
12 |
+
color: #50575e;
|
13 |
+
float: left;
|
14 |
+
border: 1px solid #c3c4c7;
|
15 |
+
background: #dcdcde;
|
16 |
+
|
17 |
+
&:hover {
|
18 |
+
background-color: #fff;
|
19 |
+
color: #3c434a;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
.column-name {
|
24 |
+
|
25 |
+
.dashicons {
|
26 |
+
font-size: 16px;
|
27 |
+
width: 16px;
|
28 |
+
height: 16px;
|
29 |
+
vertical-align: middle;
|
30 |
+
}
|
31 |
+
|
32 |
+
.dashicons-clock {
|
33 |
+
vertical-align: middle;
|
34 |
+
}
|
35 |
+
|
36 |
+
.active-snippet & > a {
|
37 |
+
font-weight: 600;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
.column-priority input {
|
42 |
+
appearance: none;
|
43 |
+
background: none;
|
44 |
+
border: none;
|
45 |
+
box-shadow: none;
|
46 |
+
width: 4em;
|
47 |
+
color: #666;
|
48 |
+
text-align: center;
|
49 |
+
|
50 |
+
&:hover, &:focus, &:active {
|
51 |
+
color: #000;
|
52 |
+
background-color: #f5f5f5;
|
53 |
+
background-color: rgba(0, 0, 0, 0.1);
|
54 |
+
border-radius: 6px;
|
55 |
+
}
|
56 |
+
|
57 |
+
&:disabled {
|
58 |
+
color: inherit;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
.snippet-execution-button,
|
63 |
+
.snippet-activation-switch {
|
64 |
+
display: block;
|
65 |
+
position: relative;
|
66 |
+
}
|
67 |
+
|
68 |
+
.snippet-activation-switch {
|
69 |
+
margin-top: 5px;
|
70 |
+
width: 30px;
|
71 |
+
height: 17px;
|
72 |
+
border-radius: 34px;
|
73 |
+
background-color: #ccc;
|
74 |
+
|
75 |
+
&::before {
|
76 |
+
transition: all .4s;
|
77 |
+
content: "";
|
78 |
+
height: 13px;
|
79 |
+
width: 13px;
|
80 |
+
display: inline-block;
|
81 |
+
margin: 2px;
|
82 |
+
background-color: white;
|
83 |
+
border-radius: 50%;
|
84 |
+
}
|
85 |
+
|
86 |
+
&:hover::before {
|
87 |
+
transform: translateX(40%);
|
88 |
+
}
|
89 |
+
|
90 |
+
.snippets .active-snippet & {
|
91 |
+
background-color: $active-color;
|
92 |
+
|
93 |
+
&::before {
|
94 |
+
transform: translateX(100%);
|
95 |
+
}
|
96 |
+
|
97 |
+
&:hover::before {
|
98 |
+
transform: translateX(60%);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
.snippets .erroneous-snippet &::before {
|
103 |
+
content: '!';
|
104 |
+
transform: translateX(50%);
|
105 |
+
text-align: center;
|
106 |
+
font-weight: bold;
|
107 |
+
line-height: 1;
|
108 |
+
color: #bbb;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
.snippet-execution-button {
|
113 |
+
margin-left: 10px;
|
114 |
+
margin-top: 9px;
|
115 |
+
width: 0;
|
116 |
+
height: 0;
|
117 |
+
border-top: 9px solid transparent;
|
118 |
+
border-bottom: 9px solid transparent;
|
119 |
+
border-left: 10px solid $inactive-color;
|
120 |
+
transition: all 0.3s;
|
121 |
+
|
122 |
+
&::before {
|
123 |
+
content: '';
|
124 |
+
position: absolute;
|
125 |
+
top: -14px;
|
126 |
+
left: -21px;
|
127 |
+
bottom: -14px;
|
128 |
+
right: -8px;
|
129 |
+
border-radius: 50%;
|
130 |
+
border: 1.8px solid $inactive-color;
|
131 |
+
z-index: 2;
|
132 |
+
transition: all .3s;
|
133 |
+
}
|
134 |
+
|
135 |
+
&:hover, &:focus {
|
136 |
+
border-left-color: #579;
|
137 |
+
|
138 |
+
&::before {
|
139 |
+
transform: scale(1.1);
|
140 |
+
border-color: #579;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
.clear-filters {
|
146 |
+
vertical-align: baseline !important;
|
147 |
+
}
|
148 |
+
|
149 |
+
.snippets {
|
150 |
+
|
151 |
+
tr {
|
152 |
+
background: #fff;
|
153 |
+
}
|
154 |
+
|
155 |
+
ol, ul {
|
156 |
+
margin: 0 0 1.5em 1.5em;
|
157 |
+
}
|
158 |
+
|
159 |
+
ul {
|
160 |
+
list-style: disc;
|
161 |
+
}
|
162 |
+
|
163 |
+
th.sortable a, th.sorted a {
|
164 |
+
display: flex;
|
165 |
+
flex-direction: row;
|
166 |
+
}
|
167 |
+
|
168 |
+
.row-actions {
|
169 |
+
color: #ddd;
|
170 |
+
position: relative;
|
171 |
+
left: 0;
|
172 |
+
}
|
173 |
+
|
174 |
+
.column-activate {
|
175 |
+
padding-right: 0 !important;
|
176 |
+
}
|
177 |
+
|
178 |
+
.clear-filters {
|
179 |
+
vertical-align: middle;
|
180 |
+
}
|
181 |
+
|
182 |
+
tfoot th.check-column {
|
183 |
+
padding: 13px 0 0 3px;
|
184 |
+
}
|
185 |
+
|
186 |
+
thead th.check-column,
|
187 |
+
tfoot th.check-column,
|
188 |
+
.inactive-snippet th.check-column {
|
189 |
+
padding-left: 5px;
|
190 |
+
}
|
191 |
+
|
192 |
+
td.column-description {
|
193 |
+
max-width: 700px;
|
194 |
+
}
|
195 |
+
|
196 |
+
.active-snippet, .inactive-snippet {
|
197 |
+
td, th {
|
198 |
+
padding: 10px 9px;
|
199 |
+
border: none;
|
200 |
+
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
.badge {
|
205 |
+
margin-left: 4px;
|
206 |
+
padding: 3px 6px;
|
207 |
+
text-decoration: none;
|
208 |
+
border: medium none;
|
209 |
+
border-radius: 2px;
|
210 |
+
background-color: #e0e0e0;
|
211 |
+
background-color: rgba(0, 0, 0, 0.08);
|
212 |
+
font-size: smaller;
|
213 |
+
line-height: 1.2;
|
214 |
+
|
215 |
+
/* rtl:ignore */
|
216 |
+
.rtl & {
|
217 |
+
float: left;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
tr.active-snippet + tr.inactive-snippet th,
|
222 |
+
tr.active-snippet + tr.inactive-snippet td {
|
223 |
+
border-top: 1px solid rgba(0, 0, 0, 0.03);
|
224 |
+
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02), inset 0 -1px 0 #e1e1e1;
|
225 |
+
}
|
226 |
+
|
227 |
+
&, #all-snippets-table, #search-snippets-table {
|
228 |
+
a.delete:hover {
|
229 |
+
border-bottom: 1px solid #f00;
|
230 |
+
color: #f00;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
#wpbody-content & .column-name {
|
235 |
+
white-space: nowrap; /* prevents wrapping of snippet title */
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
.inactive-snippet {
|
240 |
+
@include link-colors($php-inactive);
|
241 |
+
}
|
242 |
+
|
243 |
+
.active-snippet {
|
244 |
+
|
245 |
+
td, th {
|
246 |
+
background-color: rgba($php-background, 0.06);
|
247 |
+
}
|
248 |
+
|
249 |
+
th.check-column {
|
250 |
+
border-left: 2px solid #2ea2cc;
|
251 |
+
}
|
252 |
+
|
253 |
+
.snippet-activation-switch {
|
254 |
+
background-color: $active-color;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
@mixin snippet-type-colors($type, $active, $inactive, $background, $highlight) {
|
259 |
+
.#{$type}-snippet {
|
260 |
+
@include link-colors($inactive);
|
261 |
+
}
|
262 |
+
|
263 |
+
.#{$type}-snippet.active-snippet {
|
264 |
+
@include link-colors($active);
|
265 |
+
|
266 |
+
td, th {
|
267 |
+
background-color: rgba($background, 0.06);
|
268 |
+
}
|
269 |
+
|
270 |
+
.snippet-activation-switch {
|
271 |
+
background-color: $highlight;
|
272 |
+
}
|
273 |
+
|
274 |
+
th.check-column {
|
275 |
+
border-left-color: $highlight;
|
276 |
+
}
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
@include snippet-type-colors(css, $css-active, $css-inactive, $css-background, $css-highlight);
|
281 |
+
@include snippet-type-colors(html, $html-active, $html-active, $html-background, $html-highlight);
|
282 |
+
@include snippet-type-colors(js, $js-active, $js-inactive, $js-background, $js-highlight);
|
283 |
+
|
284 |
+
@media screen and (max-width: 782px) {
|
285 |
+
p.search-box {
|
286 |
+
float: left;
|
287 |
+
position: initial;
|
288 |
+
margin: 1em 0 0 0;
|
289 |
+
height: auto;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
.wp-list-table .is-expanded td.column-activate.activate {
|
294 |
+
/* fix for mobile layout */
|
295 |
+
display: table-cell !important;
|
296 |
+
}
|
297 |
+
|
298 |
+
.nav-tab-wrapper + .subsubsub, p.search-box {
|
299 |
+
margin: 10px 0 0 0;
|
300 |
+
}
|
301 |
+
|
302 |
+
.snippet-type-description {
|
303 |
+
border-bottom: 1px solid #ccc;
|
304 |
+
margin: 0;
|
305 |
+
padding: 1em 0;
|
306 |
+
}
|
307 |
+
|
308 |
+
.code-snippets-notice a.notice-dismiss {
|
309 |
+
text-decoration: none;
|
310 |
+
}
|
@@ -1,2 +0,0 @@
|
|
1 |
-
.tagger{border:1px solid #909497}.tagger input[type=hidden]{display:none}.tagger>ul{align-items:center;box-sizing:border-box;display:flex;height:auto;justify-content:space-between;padding:4px 0;width:100%}.tagger ul{list-style:none;margin:0}.tagger>ul>li{margin:.4rem 0;padding-right:10px}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#000}.tagger .tagger-new ul,.tagger li:not(.tagger-new)>span,.tagger>ul>li:not(.tagger-new)>a{background:#b1c3d7;border:1px solid #4181ed;border-radius:3px;padding:4px 8px 4px 4px}.tagger li a.close{filter:alpha(opacity=100);float:none;font-size:16px;line-height:16px;margin-right:4px;opacity:1;padding:4px}.tagger li a.close:hover{color:#fff}.tagger li:not(.tagger-new) a{text-decoration:none}.tagger .tagger-new input{background:transparent;border:none;box-shadow:none;outline:none;padding-right:0;width:100%}.tagger .tagger-new{flex-grow:1;position:relative}.tagger .tagger-new ul{padding:5px}.tagger .tagger-completion{position:absolute;z-index:100}.tagger.wrap>ul{flex-wrap:wrap;justify-content:start}.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";right:0;position:absolute;left:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-right:10px solid transparent;border-left:10px solid transparent;display:none;height:0;right:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-right:9px solid transparent;border-left:9px solid transparent;content:"";height:0;right:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-right:3px solid transparent;border-left:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;right:0;margin:2px;pointer-events:none;position:absolute;left:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(-90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{right:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(-90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;right:0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:-2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 2px 0 0;position:absolute;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-left:40px;padding:0 9px 0 5px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-right:1px;padding-left:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;left:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;left:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:left;padding:10px 5px 10px 15px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-left:30px;padding:12px 12px 0 0}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-left:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-left:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;right:0;opacity:0;pointer-events:none;position:absolute;left:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;right:0;position:absolute;left:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;right:0;padding:3px 0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 14px 5px 5px;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-left:10px;text-align:left}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;right:0;overflow:auto;position:absolute;left:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 14px 5px 5px;pointer-events:none;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-left:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;right:auto;position:absolute;left:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;right:0;top:50%;transform:translateX(50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{right:0;transform:translateX(-50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-right:5px;padding-left:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-left:0;padding-left:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-left:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-left:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;right:-1px;left:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-right-radius:3px;border-top-left-radius:3px;bottom:auto;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;right:auto;overflow:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{right:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{right:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid #000;content:"";height:0;right:2px;position:absolute;top:0;transform:translateX(50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;bottom:0;content:"";height:0;right:2px;position:absolute;transform:translateX(50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;right:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;left:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;right:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-right:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 8px 0 0;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;right:50%;overflow:hidden;transform:none;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:left;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 4px 0 0;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-right:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 10px 10px 20px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;right:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-right:0!important;padding-right:0!important;padding-left:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-left:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-left:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;left:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{right:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-right:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;right:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 28px 3px 12px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-right:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-right:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:rtl}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-right:3px}.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.go-pro-button .badge{border-color:#ce0000;color:#ce0000}.form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-right-width:4px}.active-snippet #title{border-right-color:#46b450}.inactive-snippet #title{border-right-color:#bbb}.erroneous-snippet #title{border-right-color:#dc3232}#snippet-form{margin-top:10px}label[for=snippet_description] h3 div{position:absolute}.button+.button{margin-right:.5em}.submit-inline{float:left}.snippet-scope p,p.snippet-scope{margin-top:15px}.html-shortcode-options strong,.snippet-scope label{display:inline-block;margin-left:1.5em}.below-editor{display:flex;justify-content:space-between}.snippet-priority label{cursor:help;font-size:1.1em;font-weight:700;padding-left:.5em}.snippet-priority input{width:4em}.snippet-editor{position:relative}.editor-help-tooltip{background:transparent!important;cursor:help;display:inline-block;font-size:10px;padding:.3em .3em 0}.snippet-editor-help{position:absolute;left:5px;top:5px}.snippet-editor-help:hover .editor-help-text{opacity:1;visibility:visible}.editor-help-text{background-color:#555;border-radius:6px;color:#fff;font-size:small;margin-left:-10px;opacity:0;padding:5px;position:absolute;left:0;top:125%;transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:99}.editor-help-text:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";margin-left:10px;position:absolute;left:0}.editor-help-text td:first-child{padding-left:.5em}.editor-help-text .mac-key{display:none}.editor-help-text.platform-mac .mac-key{display:inline}.editor-help-text.platform-mac .pc-key{display:none}.CodeMirror{width:100%}.wrap h2.nav-tab-wrapper{border-bottom:none}.snippet-scope{display:none}.snippet-scope .description{display:block}.CodeMirror-sizer{box-sizing:border-box;min-height:300px!important;padding-bottom:1.5em!important}.CodeMirror-sizer:after{bottom:0;position:absolute}[data-snippet-type=php] .php-scopes-list{display:block}[data-snippet-type=php] .CodeMirror-sizer{padding-bottom:0!important}[data-snippet-type=php] .CodeMirror-sizer:before{content:"<?php"}[data-snippet-type=css] .css-scopes-list{display:block}[data-snippet-type=css] .CodeMirror-sizer:before{content:"<style>"}[data-snippet-type=css] .CodeMirror-sizer:after{content:"</style>"}[data-snippet-type=js] .js-scopes-list{display:block}[data-snippet-type=js] .CodeMirror-sizer:before{content:"<script>"}[data-snippet-type=js] .CodeMirror-sizer:after{content:"</script>"}[data-snippet-type=html] .html-scopes-list{display:block}[data-snippet-type=html] .CodeMirror-sizer:before{content:"<!-- begin content -->"}[data-snippet-type=html] .CodeMirror-sizer:after{content:"<!-- end content -->"}.tagger{border:0}.tagger ul{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px}.tagger li:not(.tagger-new)>span,.tagger-new ul,.tagger>ul>li:not(.tagger-new)>a{background-color:#dee7f8;border:1px solid #cad8f3;border-radius:6px}.tagger li:not(.tagger-new)>span:hover,.tagger-new ul:hover,.tagger>ul>li:not(.tagger-new)>a:hover{background-color:#bbcef1;border-color:#6d95e0}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#555;font-size:1.1em}
|
2 |
-
|
|
|
|
@@ -1 +0,0 @@
|
|
1 |
-
.tagger{border:1px solid #909497}.tagger input[type=hidden]{display:none}.tagger>ul{align-items:center;box-sizing:border-box;display:flex;height:auto;justify-content:space-between;padding:4px 0;width:100%}.tagger ul{list-style:none;margin:0}.tagger>ul>li{margin:.4rem 0;padding-left:10px}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#000}.tagger .tagger-new ul,.tagger li:not(.tagger-new)>span,.tagger>ul>li:not(.tagger-new)>a{background:#b1c3d7;border:1px solid #4181ed;border-radius:3px;padding:4px 4px 4px 8px}.tagger li a.close{filter:alpha(opacity=100);float:none;font-size:16px;line-height:16px;margin-left:4px;opacity:1;padding:4px}.tagger li a.close:hover{color:#fff}.tagger li:not(.tagger-new) a{text-decoration:none}.tagger .tagger-new input{background:transparent;border:none;box-shadow:none;outline:none;padding-left:0;width:100%}.tagger .tagger-new{flex-grow:1;position:relative}.tagger .tagger-new ul{padding:5px}.tagger .tagger-completion{position:absolute;z-index:100}.tagger.wrap>ul{flex-wrap:wrap;justify-content:start}.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";left:0;position:absolute;right:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-left:10px solid transparent;border-right:10px solid transparent;display:none;height:0;left:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-left:9px solid transparent;border-right:9px solid transparent;content:"";height:0;left:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-left:3px solid transparent;border-right:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;left:0;margin:2px;pointer-events:none;position:absolute;right:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{left:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 0 0 2px;position:absolute;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-right:40px;padding:0 5px 0 9px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-left:1px;padding-right:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;right:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;right:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:right;padding:10px 15px 10px 5px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-right:30px;padding:12px 0 0 12px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-right:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-right:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;left:0;position:absolute;right:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;left:0;padding:3px 0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 5px 5px 14px;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-right:10px;text-align:right}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;left:0;overflow:auto;position:absolute;right:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 5px 5px 14px;pointer-events:none;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-right:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;left:auto;position:absolute;right:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;left:0;top:50%;transform:translateX(-50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{left:0;transform:translateX(50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(-150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-left:5px;padding-right:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-right:0;padding-right:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-right:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-right:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;left:-1px;right:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-left-radius:3px;border-top-right-radius:3px;bottom:auto;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;left:auto;overflow:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{left:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{left:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;content:"";height:0;left:2px;position:absolute;top:0;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";height:0;left:2px;position:absolute;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;left:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;right:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;left:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-left:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 0 0 8px;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;left:50%;overflow:hidden;transform:none;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:right;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 0 0 4px;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-left:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(-2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 20px 10px 10px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;left:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-left:0!important;padding-left:0!important;padding-right:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-right:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-right:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;right:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{left:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:ltr}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-left:3px}.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.go-pro-button .badge{border-color:#ce0000;color:#ce0000}.form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-left-width:4px}.active-snippet #title{border-left-color:#46b450}.inactive-snippet #title{border-left-color:#bbb}.erroneous-snippet #title{border-left-color:#dc3232}#snippet-form{margin-top:10px}label[for=snippet_description] h3 div{position:absolute}.button+.button{margin-left:.5em}.submit-inline{float:right}.snippet-scope p,p.snippet-scope{margin-top:15px}.html-shortcode-options strong,.snippet-scope label{display:inline-block;margin-right:1.5em}.below-editor{display:flex;justify-content:space-between}.snippet-priority label{cursor:help;font-size:1.1em;font-weight:700;padding-right:.5em}.snippet-priority input{width:4em}.snippet-editor{position:relative}.editor-help-tooltip{background:transparent!important;cursor:help;display:inline-block;font-size:10px;padding:.3em .3em 0}.snippet-editor-help{position:absolute;right:5px;top:5px}.snippet-editor-help:hover .editor-help-text{opacity:1;visibility:visible}.editor-help-text{background-color:#555;border-radius:6px;color:#fff;font-size:small;margin-right:-10px;opacity:0;padding:5px;position:absolute;right:0;top:125%;transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:99}.editor-help-text:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";margin-right:10px;position:absolute;right:0}.editor-help-text td:first-child{padding-right:.5em}.editor-help-text .mac-key{display:none}.editor-help-text.platform-mac .mac-key{display:inline}.editor-help-text.platform-mac .pc-key{display:none}.CodeMirror{width:100%}.wrap h2.nav-tab-wrapper{border-bottom:none}.snippet-scope{display:none}.snippet-scope .description{display:block}.CodeMirror-sizer{box-sizing:border-box;min-height:300px!important;padding-bottom:1.5em!important}.CodeMirror-sizer:after{bottom:0;position:absolute}[data-snippet-type=php] .php-scopes-list{display:block}[data-snippet-type=php] .CodeMirror-sizer{padding-bottom:0!important}[data-snippet-type=php] .CodeMirror-sizer:before{content:"<?php"}[data-snippet-type=css] .css-scopes-list{display:block}[data-snippet-type=css] .CodeMirror-sizer:before{content:"<style>"}[data-snippet-type=css] .CodeMirror-sizer:after{content:"</style>"}[data-snippet-type=js] .js-scopes-list{display:block}[data-snippet-type=js] .CodeMirror-sizer:before{content:"<script>"}[data-snippet-type=js] .CodeMirror-sizer:after{content:"</script>"}[data-snippet-type=html] .html-scopes-list{display:block}[data-snippet-type=html] .CodeMirror-sizer:before{content:"<!-- begin content -->"}[data-snippet-type=html] .CodeMirror-sizer:after{content:"<!-- end content -->"}.tagger{border:0}.tagger ul{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px}.tagger li:not(.tagger-new)>span,.tagger-new ul,.tagger>ul>li:not(.tagger-new)>a{background-color:#dee7f8;border:1px solid #cad8f3;border-radius:6px}.tagger li:not(.tagger-new)>span:hover,.tagger-new ul:hover,.tagger>ul>li:not(.tagger-new)>a:hover{background-color:#bbcef1;border-color:#6d95e0}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#555;font-size:1.1em}
|
|
@@ -1,2 +0,0 @@
|
|
1 |
-
.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-right:3px}.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.go-pro-button .badge{border-color:#ce0000;color:#ce0000}.wp-core-ui .button.nav-tab-button{background:#dcdcde;border:1px solid #c3c4c7;color:#50575e;float:right;margin-right:.5em}.wp-core-ui .button.nav-tab-button:hover{background-color:#fff;color:#3c434a}.column-name .dashicons{font-size:16px;height:16px;vertical-align:middle;width:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;box-shadow:none;color:#666;text-align:center;width:4em}.column-priority input:active,.column-priority input:focus,.column-priority input:hover{background-color:#f5f5f5;background-color:rgba(0,0,0,.1);border-radius:6px;color:#000}.column-priority input:disabled{color:inherit}.snippet-activation-switch,.snippet-execution-button{display:block;position:relative}.snippet-activation-switch{background-color:#ccc;border-radius:34px;height:17px;margin-top:5px;width:30px}.snippet-activation-switch:before{background-color:#fff;border-radius:50%;content:"";display:inline-block;height:13px;margin:2px;transition:all .4s;width:13px}.snippet-activation-switch:hover:before{transform:translateX(-40%)}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch:before{transform:translateX(-100%)}.snippets .active-snippet .snippet-activation-switch:hover:before{transform:translateX(-60%)}.snippets .erroneous-snippet .snippet-activation-switch:before{color:#bbb;content:"!";font-weight:700;line-height:1;text-align:center;transform:translateX(-50%)}.snippet-execution-button{border-bottom:9px solid transparent;border-right:10px solid #ccc;border-top:9px solid transparent;height:0;margin-right:10px;margin-top:9px;transition:all .3s;width:0}.snippet-execution-button:before{border:1.8px solid #ccc;border-radius:50%;bottom:-14px;content:"";right:-21px;position:absolute;left:-8px;top:-14px;transition:all .3s;z-index:2}.snippet-execution-button:focus,.snippet-execution-button:hover{border-right-color:#579}.snippet-execution-button:focus:before,.snippet-execution-button:hover:before{border-color:#579;transform:scale(1.1)}.clear-filters{vertical-align:baseline!important}.snippets tr{background:#fff}.snippets ol,.snippets ul{margin:0 1.5em 1.5em 0}.snippets ul{list-style:disc}.snippets th.sortable a,.snippets th.sorted a{display:flex;flex-direction:row}.snippets .row-actions{color:#ddd;right:0;position:relative}.snippets .column-activate{padding-left:0!important}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th.check-column{padding:13px 3px 0 0}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-right:5px}.snippets td.column-description{max-width:700px}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{border:none;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);padding:10px 9px}.snippets .badge{background-color:#e0e0e0;background-color:rgba(0,0,0,.08);border:none;border-radius:2px;font-size:smaller;line-height:1.2;margin-right:4px;padding:3px 6px;text-decoration:none}.rtl .snippets .badge{float:right}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}.inactive-snippet a{color:#579}.inactive-snippet a:active,.inactive-snippet a:focus,.inactive-snippet a:hover{color:#819db9}.active-snippet td,.active-snippet th{background-color:rgba(120,200,230,.06)}.active-snippet th.check-column{border-right:2px solid #2ea2cc}.active-snippet .snippet-activation-switch{background-color:#2196f3}.css-snippet a{color:#b452cd}.css-snippet a:active,.css-snippet a:focus,.css-snippet a:hover{color:#ce8dde}.css-snippet.active-snippet a{color:#7d26cd}.css-snippet.active-snippet a:active,.css-snippet.active-snippet a:focus,.css-snippet.active-snippet a:hover{color:#a25ee1}.css-snippet.active-snippet td,.css-snippet.active-snippet th{background-color:rgba(85,26,139,.06)}.css-snippet.active-snippet .snippet-activation-switch{background-color:#8000ff}.css-snippet.active-snippet th.check-column{border-right-color:#8000ff}.html-snippet a{color:#548b54}.html-snippet a:active,.html-snippet a:focus,.html-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet a{color:#548b54}.html-snippet.active-snippet a:active,.html-snippet.active-snippet a:focus,.html-snippet.active-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet td,.html-snippet.active-snippet th{background-color:rgba(84,139,84,.06)}.html-snippet.active-snippet .snippet-activation-switch{background-color:#548b54}.html-snippet.active-snippet th.check-column{border-right-color:#548b54}.js-snippet a{color:#cd6600}.js-snippet a:active,.js-snippet a:focus,.js-snippet a:hover{color:#ff8c1b}.js-snippet.active-snippet a{color:#d44500}.js-snippet.active-snippet a:active,.js-snippet.active-snippet a:focus,.js-snippet.active-snippet a:hover{color:#ff6a22}.js-snippet.active-snippet td,.js-snippet.active-snippet th{background-color:rgba(205,102,0,.06)}.js-snippet.active-snippet .snippet-activation-switch{background-color:#cd6600}.js-snippet.active-snippet th.check-column{border-right-color:#cd6600}@media screen and (max-width:782px){p.search-box{float:right;height:auto;margin:1em 0 0;position:static}}.wp-list-table .is-expanded td.column-activate.activate{display:table-cell!important}.nav-tab-wrapper+.subsubsub,p.search-box{margin:10px 0 0}.snippet-type-description{border-bottom:1px solid #ccc;margin:0;padding:1em 0}
|
2 |
-
|
|
|
|
@@ -1 +0,0 @@
|
|
1 |
-
.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-left:3px}.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.go-pro-button .badge{border-color:#ce0000;color:#ce0000}.wp-core-ui .button.nav-tab-button{background:#dcdcde;border:1px solid #c3c4c7;color:#50575e;float:left;margin-left:.5em}.wp-core-ui .button.nav-tab-button:hover{background-color:#fff;color:#3c434a}.column-name .dashicons{font-size:16px;height:16px;vertical-align:middle;width:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;box-shadow:none;color:#666;text-align:center;width:4em}.column-priority input:active,.column-priority input:focus,.column-priority input:hover{background-color:#f5f5f5;background-color:rgba(0,0,0,.1);border-radius:6px;color:#000}.column-priority input:disabled{color:inherit}.snippet-activation-switch,.snippet-execution-button{display:block;position:relative}.snippet-activation-switch{background-color:#ccc;border-radius:34px;height:17px;margin-top:5px;width:30px}.snippet-activation-switch:before{background-color:#fff;border-radius:50%;content:"";display:inline-block;height:13px;margin:2px;transition:all .4s;width:13px}.snippet-activation-switch:hover:before{transform:translateX(40%)}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch:before{transform:translateX(100%)}.snippets .active-snippet .snippet-activation-switch:hover:before{transform:translateX(60%)}.snippets .erroneous-snippet .snippet-activation-switch:before{color:#bbb;content:"!";font-weight:700;line-height:1;text-align:center;transform:translateX(50%)}.snippet-execution-button{border-bottom:9px solid transparent;border-left:10px solid #ccc;border-top:9px solid transparent;height:0;margin-left:10px;margin-top:9px;transition:all .3s;width:0}.snippet-execution-button:before{border:1.8px solid #ccc;border-radius:50%;bottom:-14px;content:"";left:-21px;position:absolute;right:-8px;top:-14px;transition:all .3s;z-index:2}.snippet-execution-button:focus,.snippet-execution-button:hover{border-left-color:#579}.snippet-execution-button:focus:before,.snippet-execution-button:hover:before{border-color:#579;transform:scale(1.1)}.clear-filters{vertical-align:baseline!important}.snippets tr{background:#fff}.snippets ol,.snippets ul{margin:0 0 1.5em 1.5em}.snippets ul{list-style:disc}.snippets th.sortable a,.snippets th.sorted a{display:flex;flex-direction:row}.snippets .row-actions{color:#ddd;left:0;position:relative}.snippets .column-activate{padding-right:0!important}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets td.column-description{max-width:700px}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{border:none;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);padding:10px 9px}.snippets .badge{background-color:#e0e0e0;background-color:rgba(0,0,0,.08);border:none;border-radius:2px;font-size:smaller;line-height:1.2;margin-left:4px;padding:3px 6px;text-decoration:none}.rtl .snippets .badge{float:left}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}.inactive-snippet a{color:#579}.inactive-snippet a:active,.inactive-snippet a:focus,.inactive-snippet a:hover{color:#819db9}.active-snippet td,.active-snippet th{background-color:rgba(120,200,230,.06)}.active-snippet th.check-column{border-left:2px solid #2ea2cc}.active-snippet .snippet-activation-switch{background-color:#2196f3}.css-snippet a{color:#b452cd}.css-snippet a:active,.css-snippet a:focus,.css-snippet a:hover{color:#ce8dde}.css-snippet.active-snippet a{color:#7d26cd}.css-snippet.active-snippet a:active,.css-snippet.active-snippet a:focus,.css-snippet.active-snippet a:hover{color:#a25ee1}.css-snippet.active-snippet td,.css-snippet.active-snippet th{background-color:rgba(85,26,139,.06)}.css-snippet.active-snippet .snippet-activation-switch{background-color:#8000ff}.css-snippet.active-snippet th.check-column{border-left-color:#8000ff}.html-snippet a{color:#548b54}.html-snippet a:active,.html-snippet a:focus,.html-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet a{color:#548b54}.html-snippet.active-snippet a:active,.html-snippet.active-snippet a:focus,.html-snippet.active-snippet a:hover{color:#7cb07c}.html-snippet.active-snippet td,.html-snippet.active-snippet th{background-color:rgba(84,139,84,.06)}.html-snippet.active-snippet .snippet-activation-switch{background-color:#548b54}.html-snippet.active-snippet th.check-column{border-left-color:#548b54}.js-snippet a{color:#cd6600}.js-snippet a:active,.js-snippet a:focus,.js-snippet a:hover{color:#ff8c1b}.js-snippet.active-snippet a{color:#d44500}.js-snippet.active-snippet a:active,.js-snippet.active-snippet a:focus,.js-snippet.active-snippet a:hover{color:#ff6a22}.js-snippet.active-snippet td,.js-snippet.active-snippet th{background-color:rgba(205,102,0,.06)}.js-snippet.active-snippet .snippet-activation-switch{background-color:#cd6600}.js-snippet.active-snippet th.check-column{border-left-color:#cd6600}@media screen and (max-width:782px){p.search-box{float:left;height:auto;margin:1em 0 0;position:static}}.wp-list-table .is-expanded td.column-activate.activate{display:table-cell!important}.nav-tab-wrapper+.subsubsub,p.search-box{margin:10px 0 0}.snippet-type-description{border-bottom:1px solid #ccc;margin:0;padding:1em 0}
|
|
@@ -1 +0,0 @@
|
|
1 |
-
@font-face{font-family:code-snippets;font-style:normal;font-weight:400;src:url(../font/code-snippets.eot);src:url(../font/code-snippets.eot?#iefix) format("embedded-opentype"),url(../font/code-snippets.ttf) format("truetype"),url(../font/code-snippets.woff) format("woff"),url(../font/code-snippets.svg#code-snippets) format("svg")}#toplevel_page_snippets div.wp-menu-image:before{content:"\e600";font-family:code-snippets!important}
|
|
@@ -1 +0,0 @@
|
|
1 |
-
code[class*=language-],pre[class*=language-]{word-wrap:normal;background:none;color:#000;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px #fff;white-space:pre;word-break:normal;word-spacing:normal}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{background:#b3d4fc;text-shadow:none}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{background:#b3d4fc;text-shadow:none}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{margin:.5em 0;overflow:auto;padding:1em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{border-radius:.3em;padding:.1em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{background:hsla(0,0%,100%,.5);color:#9a6e3a}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}pre[class*=language-].line-numbers{counter-reset:linenumber;padding-left:3.8em;position:relative}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{border-right:1px solid #999;font-size:100%;left:-3.8em;letter-spacing:-1px;pointer-events:none;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:3em}.line-numbers-rows>span{counter-increment:linenumber;display:block}.line-numbers-rows>span:before{color:#999;content:counter(linenumber);display:block;padding-right:.8em;text-align:right}div.code-toolbar{position:relative}div.code-toolbar>.toolbar{opacity:0;position:absolute;right:.2em;top:.3em;transition:opacity .3s ease-in-out;z-index:10}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:none;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{background:#f5f2f0;background:hsla(0,0%,88%,.2);border-radius:.5em;box-shadow:0 2px 0 0 rgba(0,0,0,.2);color:#bbb;font-size:.8em;padding:0 .5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}
|
|
@@ -1 +0,0 @@
|
|
1 |
-
.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";left:0;position:absolute;right:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-left:10px solid transparent;border-right:10px solid transparent;display:none;height:0;left:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-left:9px solid transparent;border-right:9px solid transparent;content:"";height:0;left:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-left:3px solid transparent;border-right:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;left:0;margin:2px;pointer-events:none;position:absolute;right:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{left:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;left:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 0 0 2px;position:absolute;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-right:40px;padding:0 5px 0 9px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-left:1px;padding-right:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;right:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;right:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:right;padding:10px 15px 10px 5px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-right:30px;padding:12px 0 0 12px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-right:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;left:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-right:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;left:0;position:absolute;right:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;left:0;padding:3px 0;position:absolute;right:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 5px 5px 14px;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-right:10px;text-align:right}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;left:0;overflow:auto;position:absolute;right:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 5px 5px 14px;pointer-events:none;text-align:left;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-right:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;left:auto;position:absolute;right:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 38px 0 0;padding:2px 2px 2px 10px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;left:0;top:50%;transform:translateX(-50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{left:0;transform:translateX(50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(-150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-left:5px;padding-right:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-left:0;padding-right:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-right:0;padding-right:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-right:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-right:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;left:-1px;right:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-left-radius:3px;border-top-right-radius:3px;bottom:auto;left:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;left:auto;overflow:auto;position:relative;right:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 0 0 42px;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{left:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{left:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;content:"";height:0;left:2px;position:absolute;top:0;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";height:0;left:2px;position:absolute;transform:translateX(-50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;left:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;right:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;left:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;left:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-left:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 0 0 8px;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;left:50%;overflow:hidden;transform:none;transform:translateX(-50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:right;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 0 0 4px;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-left:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(-2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 20px 10px 10px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-left:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;left:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-left:0!important;padding-left:0!important;padding-right:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;left:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-right:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-right:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;right:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{left:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:ltr}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}p.submit{max-width:1020px}p.submit .button-secondary{float:right}.nav-tab-wrapper{margin-bottom:1em}input[type=number]{width:4em}.CodeMirror{max-width:800px;padding-right:1em;width:100%}.CodeMirror-sizer:before{content:"<?php"}body.no-js .nav-tab-wrapper{display:none}body.no-js .settings-section{display:block!important}body.js .settings-section-title{clip:rect(1px,1px,1px,1px);word-wrap:normal!important;border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}body.js .nav-tab:not(.nav-tab-active){cursor:pointer}body.js .settings-section{display:none}body.js .wrap[data-active-tab=description_editor] .description_editor-settings,body.js .wrap[data-active-tab=editor] .editor-settings,body.js .wrap[data-active-tab=general] .general-settings,body.js .wrap[data-active-tab=license] .license-settings{display:block}
|
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../node_modules/prismjs/themes/prism.css';
|
2 |
+
@import '../node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css';
|
3 |
+
@import '../node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css';
|
4 |
+
@import '../node_modules/prismjs/plugins/toolbar/prism-toolbar.css';
|
5 |
+
@import '../node_modules/prismjs/plugins/inline-color/prism-inline-color.css';
|
6 |
+
@import '../node_modules/prismjs/plugins/previewers/prism-previewers.css';
|
7 |
+
@import '../node_modules/prismjs/plugins/autolinker/prism-autolinker.css';
|
8 |
+
|
9 |
+
:not(.is-style-prism-shades-of-purple) pre[class*=language-].line-numbers .line-highlight {
|
10 |
+
box-sizing: border-box;
|
11 |
+
padding: 0;
|
12 |
+
margin: 1em 0 0;
|
13 |
+
}
|
14 |
+
|
15 |
+
.is-style-prism-coy-without-shadows pre[class*=language-] .line-highlight {
|
16 |
+
margin-top: 0;
|
17 |
+
}
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import 'editor';
|
2 |
+
|
3 |
+
$sections: general, description_editor, editor, license;
|
4 |
+
|
5 |
+
p.submit {
|
6 |
+
max-width: 1020px;
|
7 |
+
|
8 |
+
.button-secondary {
|
9 |
+
float: right;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
.nav-tab-wrapper {
|
14 |
+
margin-bottom: 1em;
|
15 |
+
}
|
16 |
+
|
17 |
+
input[type=number] {
|
18 |
+
width: 4em;
|
19 |
+
}
|
20 |
+
|
21 |
+
.CodeMirror {
|
22 |
+
max-width: 800px;
|
23 |
+
width: 100%;
|
24 |
+
padding-right: 1em;
|
25 |
+
}
|
26 |
+
|
27 |
+
.CodeMirror-sizer::before {
|
28 |
+
content: '<?php';
|
29 |
+
}
|
30 |
+
|
31 |
+
body.no-js {
|
32 |
+
.nav-tab-wrapper {
|
33 |
+
display: none;
|
34 |
+
}
|
35 |
+
|
36 |
+
.settings-section {
|
37 |
+
display: block !important;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
body.js {
|
42 |
+
|
43 |
+
.settings-section-title {
|
44 |
+
border: 0;
|
45 |
+
clip: rect(1px, 1px, 1px, 1px);
|
46 |
+
clip-path: inset(50%);
|
47 |
+
height: 1px;
|
48 |
+
margin: -1px;
|
49 |
+
overflow: hidden;
|
50 |
+
padding: 0;
|
51 |
+
position: absolute;
|
52 |
+
width: 1px;
|
53 |
+
word-wrap: normal !important;
|
54 |
+
}
|
55 |
+
|
56 |
+
.nav-tab:not(.nav-tab-active) {
|
57 |
+
cursor: pointer;
|
58 |
+
}
|
59 |
+
|
60 |
+
.settings-section {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
|
64 |
+
@each $section in $sections {
|
65 |
+
.wrap[data-active-tab=#{$section}] .#{$section}-settings {
|
66 |
+
display: block;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
@@ -0,0 +1,3 @@
|
|
|
1 |
+
.tagger{border:1px solid #909497}.tagger input[type=hidden]{display:none}.tagger>ul{align-items:center;box-sizing:border-box;display:flex;height:auto;justify-content:space-between;padding:4px 0;width:100%}.tagger ul{list-style:none;margin:0}.tagger>ul>li{margin:.4rem 0;padding-right:10px}.tagger-new ul a,.tagger-new ul a:visited,.tagger>ul>li:not(.tagger-new) a,.tagger>ul>li:not(.tagger-new) a:visited{color:#000}.tagger .tagger-new ul,.tagger li:not(.tagger-new)>span,.tagger>ul>li:not(.tagger-new)>a{background:#b1c3d7;border:1px solid #4181ed;border-radius:3px;padding:4px 8px 4px 4px}.tagger li a.close{filter:alpha(opacity=100);float:none;font-size:16px;line-height:16px;margin-right:4px;opacity:1;padding:4px}.tagger li a.close:hover{color:#fff}.tagger li:not(.tagger-new) a{text-decoration:none}.tagger .tagger-new input{background:transparent;border:none;box-shadow:none;outline:none;padding-right:0;width:100%}.tagger .tagger-new{flex-grow:1;position:relative}.tagger .tagger-new ul{padding:5px}.tagger .tagger-completion{position:absolute;z-index:100}.tagger.wrap>ul{flex-wrap:wrap;justify-content:start}.codemirror-colorview{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;border:1px solid #cecece;box-sizing:border-box;cursor:pointer;display:inline-block;height:10px;margin:0 2px;position:relative;vertical-align:middle;width:10px}.codemirror-colorview .codemirror-colorview-background{bottom:0;content:"";right:0;position:absolute;left:0;top:0}.codemirror-colorview:hover{border-color:#494949}.codemirror-colorpicker{background-color:#fff;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:inline-block;position:relative;width:224px;z-index:1000}.codemirror-colorpicker>.arrow{border-bottom:10px solid rgba(0,0,0,.2);border-right:10px solid transparent;border-left:10px solid transparent;display:none;height:0;right:7px;pointer-events:none;position:absolute;top:-10px;width:0}.codemirror-colorpicker>.arrow:after{border-bottom:9px solid #fff;border-right:9px solid transparent;border-left:9px solid transparent;content:"";height:0;right:-9px;position:absolute;top:1px;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button{background-color:transparent;height:12px;padding:0;position:relative;width:10px}.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-bottom:3px solid #000;height:50%;top:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after,.codemirror-colorpicker .colorpicker-body .arrow-button:before{border-right:3px solid transparent;border-left:3px solid transparent;box-sizing:border-box;content:"";display:inline-block;height:0;right:0;margin:2px;pointer-events:none;position:absolute;left:0;width:0}.codemirror-colorpicker .colorpicker-body .arrow-button:after{border-top:3px solid #000;bottom:0;top:50%}.codemirror-colorpicker .colorpicker-body .color{cursor:pointer;height:120px;overflow:hidden;position:relative}.codemirror-colorpicker .colorpicker-body .color>.saturation,.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{height:100%;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border-radius:50%;height:10px;position:absolute;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker .colorpicker-body .color>.saturation{background-color:hsla(20,42%,65%,0);background-image:linear-gradient(-90deg,#fff,hsla(20,42%,65%,0));background-repeat:repeat-x}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0))}.codemirror-colorpicker .colorpicker-body .color>.saturation>.value>.drag-pointer{border:1px solid #fff;box-shadow:0 0 2px 0 rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .control{padding:10px 0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper .el-cp-color-control__left{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:20px;width:30px}.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.color,.codemirror-colorpicker .colorpicker-body .control.has-eyedropper>.empty{right:45px}.codemirror-colorpicker .colorpicker-body .control>.color,.codemirror-colorpicker .colorpicker-body .control>.empty{border-radius:50%;box-sizing:border-box;height:30px;right:12px;position:absolute;top:14px;width:30px}.codemirror-colorpicker .colorpicker-body .control>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker .colorpicker-body .control>.hue{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control>.opacity{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:3px 16px;position:relative}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{border-radius:3px;height:10px;position:relative;width:100%}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker .colorpicker-body .control>.hue>.hue-container{background:linear-gradient(-90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control>.opacity>.opacity-container>.color-bar{bottom:0;content:"";display:block;right:0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .control>.empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat}.codemirror-colorpicker .colorpicker-body .control .drag-bar,.codemirror-colorpicker .colorpicker-body .control .drag-bar2{background-color:#fefefe;border:1px solid rgba(0,0,0,.05);box-shadow:-2px 2px 2px 0 rgba(0,0,0,.2)}.codemirror-colorpicker .colorpicker-body .information{box-sizing:padding-box;position:relative}.codemirror-colorpicker .colorpicker-body .information>input{bottom:20px;box-sizing:border-box;font-size:10px;height:20px;padding:0 2px 0 0;position:absolute;-webkit-user-select:text;-moz-user-select:text;user-select:text}.codemirror-colorpicker .colorpicker-body .information>input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information.hex>.information-item.hex,.codemirror-colorpicker .colorpicker-body .information.hsl>.information-item.hsl,.codemirror-colorpicker .colorpicker-body .information.rgb>.information-item.rgb{display:flex}.codemirror-colorpicker .colorpicker-body .information>.information-item{box-sizing:border-box;display:none;margin-left:40px;padding:0 9px 0 5px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field{box-sizing:border-box;display:block;flex:1;padding:3px;position:relative}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field>.title{color:#a9a9a9;cursor:pointer;font-size:12px;padding-top:2px;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input{border:1px solid #cbcbcb;border-radius:2px;box-sizing:border-box;color:#333;font-size:11px;height:21px;padding:3px;text-align:center;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-inner-spin-button,.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-l input[type=number],.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field.hsl-s input[type=number]{padding-right:1px;padding-left:10px}.codemirror-colorpicker .colorpicker-body .information>.information-item>.input-field .postfix{box-sizing:border-box;display:inline-block;font-size:11px;height:21px;line-height:2;padding:2px;position:absolute;left:3px;text-align:center;top:2px}.codemirror-colorpicker .colorpicker-body .information>.information-change{bottom:0;box-sizing:border-box;display:block;padding-top:5px;position:absolute;left:0;text-align:center;top:0;width:40px}.codemirror-colorpicker .colorpicker-body .information>.information-change>.format-change-button{background:transparent;border:0;box-sizing:border-box;cursor:pointer;outline:none}.codemirror-colorpicker .colorpicker-body .information>.title{color:#a3a3a3}.codemirror-colorpicker .colorpicker-body .information>.input{color:#333}.codemirror-colorpicker .colorpicker-body .colorsets{border-top:1px solid #e2e2e2}.codemirror-colorpicker .colorpicker-body .colorsets>.menu{float:left;padding:10px 5px 10px 15px}.codemirror-colorpicker .colorpicker-body .colorsets>.menu button{border:0;cursor:pointer;font-family:serif,sans-serif;font-size:14px;font-weight:300;outline:none}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list{box-sizing:border-box;display:block;line-height:0;margin-left:30px;padding:12px 12px 0 0}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item{background-size:contain;border-radius:2px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-bottom:12px;margin-left:12px;overflow:hidden;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item:hover{transform:scale(1.2)}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .empty{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .color-item .color-view{border:1px solid rgba(0,0,0,.1);box-sizing:border-box;height:100%;right:0;margin:0;padding:0;pointer-events:none;position:absolute;top:0;width:100%}.codemirror-colorpicker .colorpicker-body .colorsets>.color-list .add-color-item{color:#8e8e8e;cursor:pointer;display:inline-block;font-family:serif,sans-serif;font-size:16px;font-weight:400;height:13px;line-height:1;margin-bottom:12px;margin-left:12px;text-align:center;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser{background-color:rgba(0,0,0,.5);bottom:0;right:0;opacity:0;pointer-events:none;position:absolute;left:0;top:0;transition:opacity .05s ease-out}.codemirror-colorpicker .colorpicker-body .color-chooser.open{opacity:1;pointer-events:all}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container{background-color:#fff;bottom:0;right:0;position:absolute;left:0;top:120px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header{border-bottom:1px solid rgba(0,0,0,.2);box-sizing:border-box;display:flex;height:34px;right:0;padding:3px 0;position:absolute;left:0;top:0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .title{box-sizing:border-box;color:#000;flex:2;font-size:15px;font-weight:700;margin:0;overflow:hidden;padding:5px 14px 5px 5px;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-item-header .items{cursor:pointer;display:block;flex:1;height:100%;line-height:2;padding-left:10px;text-align:left}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list{bottom:0;right:0;overflow:auto;position:absolute;left:0;top:34px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item{border-bottom:1px solid rgba(0,0,0,.1);cursor:pointer;display:flex;padding:3px 0}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item:hover{background-color:rgba(0,0,0,.05)}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .title{box-sizing:border-box;color:#000;flex:2;font-size:14px;font-size:13px;font-weight:400;margin:0;overflow:hidden;padding:5px 14px 5px 5px;pointer-events:none;text-align:right;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items{cursor:pointer;display:block;flex:3;height:100%;line-height:1.6;pointer-events:none}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;background-size:contain;border:1px solid #ddd;border-radius:3px;box-sizing:border-box;cursor:pointer;display:inline-block;height:13px;margin-left:10px;overflow:hidden;vertical-align:middle;width:13px}.codemirror-colorpicker .colorpicker-body .color-chooser .color-chooser-container .colorsets-list .colorsets-item .items .color-item .color-view{height:100%;margin:0;padding:0;pointer-events:none;width:100%}.codemirror-colorpicker.sketch{border-radius:5px}.codemirror-colorpicker.sketch>.colorpicker-body>.color{box-sizing:border-box;height:150px;margin:10px 10px 2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control{padding:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.sketch>.colorpicker-body>.control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color,.codemirror-colorpicker.sketch>.colorpicker-body>.control>.empty{border-radius:2px;box-sizing:border-box;height:26px;right:auto;position:absolute;left:10px;top:1px;width:26px}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.color{box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.hue>.hue-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity{margin:0 0 0 38px;padding:2px 10px 2px 2px;position:relative}.codemirror-colorpicker.sketch>.colorpicker-body>.control>.opacity>.opacity-container{border-radius:0}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2{border-radius:0;border-radius:1px;bottom:1px!important;height:50%;right:0;top:50%;transform:translateX(50%) translateY(-50%);width:2px}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.first,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.first{right:0;transform:translateX(-50%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar.last,.codemirror-colorpicker.sketch>.colorpicker-body>.control .drag-bar2.last{transform:translateX(150%) translateY(-50%)!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-change{display:none}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.rgb{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.rgb .information-item.hsl{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hex{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hex .information-item.hsl,.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.rgb{display:none!important}.codemirror-colorpicker.sketch>.colorpicker-body>.information.hsl .information-item.hsl{display:inherit}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item{display:inline-flex!important;margin-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field{padding-right:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child{padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field>.title{color:#000;cursor:pointer;font-size:11px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item>.input-field:last-child:not(:first-child){padding-left:0}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hex{padding-right:5px;padding-left:0;width:74px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.rgb{padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.information .information-item.hsl{display:none;padding-right:0;padding-left:0;width:140px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list{margin-left:0;padding-left:12px}.codemirror-colorpicker.sketch>.colorpicker-body>.colorsets>.color-list .color-item{border-radius:3px;height:16px;margin-bottom:10px;margin-left:9px;width:16px}.codemirror-colorpicker.palette{border-radius:3px;box-shadow:none}.codemirror-colorpicker.palette>.colorpicker-body>.color,.codemirror-colorpicker.palette>.colorpicker-body>.control,.codemirror-colorpicker.palette>.colorpicker-body>.information{display:none}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets{border-top:0;box-sizing:border-box}.codemirror-colorpicker.palette>.colorpicker-body>.colorsets>.color-list .color-item{height:15px;margin-bottom:10px;margin-left:10px;width:15px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser{box-sizing:border-box;display:none}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open{border:1px solid #d8d8d8;border-radius:3px;bottom:auto;box-shadow:0 0 10px 2px rgba(0,0,0,.12);display:block;right:-1px;left:-1px;top:-1px}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container{background-color:#fff;border-radius:2px;bottom:auto;box-sizing:border-box;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-item-header{border-top-right-radius:3px;border-top-left-radius:3px;bottom:auto;right:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list{bottom:auto;right:auto;overflow:auto;position:relative;left:auto;top:auto}.codemirror-colorpicker.palette>.colorpicker-body>.color-chooser.open .color-chooser-container .colorsets-list .colorsets-item:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.codemirror-colorpicker.macos .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.macos .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.macos .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.macos .control{padding-top:0}.codemirror-colorpicker.macos .control>.color,.codemirror-colorpicker.macos .control>.empty{top:4px}.codemirror-colorpicker.macos .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.macos .control.has-eyedropper .el-cp-color-control__left{top:9px}.codemirror-colorpicker.macos .value{box-sizing:border-box;cursor:pointer;margin:0 42px 0 0;padding:6px 16px;position:relative}.codemirror-colorpicker.macos .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.macos .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.mini{display:inline-block;width:180px}.codemirror-colorpicker.mini .control{padding:0}.codemirror-colorpicker.mini .control .hue,.codemirror-colorpicker.mini .control .opacity{margin:0;padding:0}.codemirror-colorpicker.mini .control .hue>.hue-container,.codemirror-colorpicker.mini .control .opacity>.opacity-container{border-radius:0;height:20px;overflow:hidden}.codemirror-colorpicker.mini .control .drag-bar,.codemirror-colorpicker.mini .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:100%;width:5px}.codemirror-colorpicker.mini .control .drag-bar.last:before,.codemirror-colorpicker.mini .control .drag-bar.lastafter,.codemirror-colorpicker.mini .control .drag-bar2.last:before,.codemirror-colorpicker.mini .control .drag-bar2.lastafter{right:1px}.codemirror-colorpicker.mini .control .drag-bar.first:after,.codemirror-colorpicker.mini .control .drag-bar.first:before,.codemirror-colorpicker.mini .control .drag-bar2.first:after,.codemirror-colorpicker.mini .control .drag-bar2.first:before{right:3px}.codemirror-colorpicker.mini .control .drag-bar2:before,.codemirror-colorpicker.mini .control .drag-bar:before{border-right:4px solid transparent;border-left:4px solid transparent;border-top:4px solid #000;content:"";height:0;right:2px;position:absolute;top:0;transform:translateX(50%);width:0}.codemirror-colorpicker.mini .control .drag-bar2:after,.codemirror-colorpicker.mini .control .drag-bar:after{border-bottom:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;bottom:0;content:"";height:0;right:2px;position:absolute;transform:translateX(50%);width:0}.codemirror-colorpicker.mini-vertical{display:inline-block;width:180px}.codemirror-colorpicker.mini-vertical .color{display:inline-block;height:160px;vertical-align:middle;width:140px}.codemirror-colorpicker.mini-vertical .control{display:inline-block;height:160px;padding:0;vertical-align:middle}.codemirror-colorpicker.mini-vertical .control .hue,.codemirror-colorpicker.mini-vertical .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:20px}.codemirror-colorpicker.mini-vertical .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.mini-vertical .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden;width:20px}.codemirror-colorpicker.mini-vertical .control .drag-bar,.codemirror-colorpicker.mini-vertical .control .drag-bar2{background-color:transparent;border:0;box-shadow:none;box-sizing:border-box;height:2px;transform:none;width:100%}.codemirror-colorpicker.mini-vertical .control .drag-bar.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.last:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.last:before{top:2px}.codemirror-colorpicker.mini-vertical .control .drag-bar.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar.first:before,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:after,.codemirror-colorpicker.mini-vertical .control .drag-bar2.first:before{top:-1px}.codemirror-colorpicker.mini-vertical .control .drag-bar2:before,.codemirror-colorpicker.mini-vertical .control .drag-bar:before{border-bottom:4px solid transparent;border-right:4px solid #000;border-top:4px solid transparent;content:"";height:0;right:0;position:absolute;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.mini-vertical .control .drag-bar2:after,.codemirror-colorpicker.mini-vertical .control .drag-bar:after{border-bottom:4px solid transparent;border-left:4px solid #000;border-top:4px solid transparent;content:"";height:0;position:absolute;left:0;top:2px;transform:translateY(-50%);width:0}.codemirror-colorpicker.ring .colorpicker-body>.color{height:120px;right:52px;position:absolute;top:52px;width:120px}.codemirror-colorpicker.ring .colorpicker-body .wheel{box-sizing:border-box;height:224px;position:relative;width:224px}.codemirror-colorpicker.ring .colorpicker-body .wheel .wheel-canvas{border-radius:50%;height:214px;right:5px;position:absolute;top:5px;width:214px}.codemirror-colorpicker.ring .colorpicker-body .wheel .drag-pointer{border:1px solid #fff;border-radius:50%;display:inline-block;height:10px;right:50%;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:10px;z-index:2}.codemirror-colorpicker.ring .control{padding-top:0}.codemirror-colorpicker.ring .control .value{display:none}.codemirror-colorpicker.ring .control>.color,.codemirror-colorpicker.ring .control>.empty{border-radius:2px;height:30px;top:-17px;width:30px}.codemirror-colorpicker.ring .control.has-eyedropper{padding-right:30px;padding-top:10px}.codemirror-colorpicker.ring .control.has-eyedropper>.color,.codemirror-colorpicker.ring .control.has-eyedropper>.empty{top:-2px}.codemirror-colorpicker.ring .control.has-eyedropper .el-cp-color-control__left{top:4px}.codemirror-colorpicker.xd{display:inline-block;padding-top:12px;width:245px}.codemirror-colorpicker.xd .color{border:1px solid #cecece;border-radius:3px;box-sizing:border-box;display:inline-block;height:170px;margin-bottom:12px;margin-right:12px;overflow:hidden;vertical-align:middle;width:170px}.codemirror-colorpicker.xd .color>.saturation>.value>.drag-pointer{border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;height:7px;width:7px}.codemirror-colorpicker.xd .control{display:inline-block;height:170px;margin-bottom:12px;margin-left:12px;padding:0;vertical-align:middle}.codemirror-colorpicker.xd .control .hue,.codemirror-colorpicker.xd .control .opacity{border-radius:3px;display:inline-block;height:100%;margin:0 8px 0 0;overflow:hidden;padding:0;position:relative;vertical-align:middle;width:13px}.codemirror-colorpicker.xd .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .opacity>.opacity-container{border-radius:0;height:100%;overflow:hidden}.codemirror-colorpicker.xd .control .drag-bar,.codemirror-colorpicker.xd .control .drag-bar2{background-color:transparent;border:2px solid #fff;box-shadow:0 0 1px 0 #000,inset 0 0 1px 0 #000;box-sizing:border-box;height:10px;right:50%;overflow:hidden;transform:none;transform:translateX(50%) translateY(-50%);width:10px}.codemirror-colorpicker.xd .information{margin-top:5px}.codemirror-colorpicker.vscode{background-color:#333;border:1px solid #ececec;box-sizing:border-box;width:336px}.codemirror-colorpicker.vscode,.codemirror-colorpicker.vscode .colorpicker-body{border-radius:0;display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view{height:34px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper{display:flex}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .color-view-container{display:inline-block;width:254px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left{float:left;padding:6px 0;text-align:center;width:80px}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button{display:inline-block}.codemirror-colorpicker.vscode .colorpicker-body .color-view.has-eyedropper .el-cp-color-control__left button svg path{fill:#fff}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;cursor:pointer;font-size:14px;height:100%;line-height:34px;text-align:center;text-shadow:0 0 3px #535353;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-view .color-view-container .preview{display:block;height:100%}.codemirror-colorpicker.vscode .colorpicker-body .color-tool{padding:8px}.codemirror-colorpicker.vscode .color{display:inline-block;height:160px;vertical-align:middle;width:240px}.codemirror-colorpicker.vscode .control{display:inline-block;height:160px;padding:0 4px 0 0;vertical-align:middle}.codemirror-colorpicker.vscode .control .hue,.codemirror-colorpicker.vscode .control .opacity{display:inline-block;height:100%;margin:0;padding:0;position:relative;vertical-align:middle;width:30px}.codemirror-colorpicker.vscode .control .hue{padding-right:5px;width:35px}.codemirror-colorpicker.vscode .control .hue>.hue-container{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);border-radius:0;height:100%}.codemirror-colorpicker.vscode .control .opacity>.opacity-container{border-radius:0;height:100%;width:30px}.codemirror-colorpicker.vscode .control .drag-bar,.codemirror-colorpicker.vscode .control .drag-bar2{background-color:transparent;border:1px solid #fff;border-radius:0;box-shadow:none;box-shadow:0 0 2px 0 #000,inset 0 0 0 0 #000;box-sizing:border-box;height:5px;transform:translateY(-50%) translateX(2px);width:33px}.codemirror-colorpicker.box{border-radius:10px;width:420px}.codemirror-colorpicker.box .colorpicker-body{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:200px 1fr;grid-template-rows:auto;padding:10px 10px 10px 20px}.codemirror-colorpicker.box .colorpicker-body>.color{border-radius:8px;height:100%;overflow:hidden}.codemirror-colorpicker.box .control{padding:0!important}.codemirror-colorpicker.box .control>*{vertical-align:middle}.codemirror-colorpicker.box .control .color-info{display:inline-block;height:30px;position:relative;width:30px}.codemirror-colorpicker.box .control .color-info>.color,.codemirror-colorpicker.box .control .color-info>.empty{border-radius:50%;box-sizing:border-box;height:100%;position:absolute;width:100%}.codemirror-colorpicker.box .control .color-info>.color{border:1px solid rgba(0,0,0,.1)}.codemirror-colorpicker.box .control>.color,.codemirror-colorpicker.box .control>.empty{top:4px}.codemirror-colorpicker.box .control.has-eyedropper{padding-right:30px}.codemirror-colorpicker.box .control.has-eyedropper .el-cp-color-control__left{display:inline-block;height:30px;right:auto;position:relative;top:auto;width:30px}.codemirror-colorpicker.box .control .hue,.codemirror-colorpicker.box .control .opacity{margin-right:0!important;padding-right:0!important;padding-left:0!important}.codemirror-colorpicker.box .value{box-sizing:border-box;cursor:pointer;position:relative}.codemirror-colorpicker.box .value>.value-container{background-image:linear-gradient(-90deg,#000 0,hsla(0,0%,100%,0));border-radius:3px;box-sizing:border-box;height:10px;position:relative;width:100%}.codemirror-colorpicker.box .value>.value-container .drag-bar{border-radius:50%;cursor:pointer;height:12px;right:0;position:absolute;top:50%;transform:translateX(50%) translateY(-50%);width:12px}.codemirror-colorpicker.box .information{margin-top:6px}.codemirror-colorpicker.box .information .information-change{display:none}.codemirror-colorpicker.box .information>.information-item{margin:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets{border:0;position:relative}.codemirror-colorpicker.box .colorsets .color-list{margin-left:0!important;padding:0!important}.codemirror-colorpicker.box .colorsets .color-list .current-color-sets .color-item{height:20px;margin-bottom:4px!important;margin-left:4px!important;width:20px}.codemirror-colorpicker.box .colorsets .menu{float:none;position:absolute;left:-20px;top:-15px}.codemirror-colorpicker.box .color-chooser .color-chooser-container{right:200px;top:0}.colorsets-contextmenu{background-color:#ececec;border:1px solid #ccc;border-radius:6px;display:none;font-size:13px;list-style:none;padding:4px 0;position:fixed}.colorsets-contextmenu.show{display:inline-block}.colorsets-contextmenu .menu-item{cursor:default;padding:2px 20px}.colorsets-contextmenu .menu-item:hover{background-color:#5ea3fb;color:#fff}.colorsets-contextmenu.small .menu-item.small-hide{display:none}.el-cp-color-eyedropper button{background:none;border:none;border-radius:var(--size-radius);box-sizing:border-box;cursor:pointer;display:block;font-size:0;height:30px;margin:-4px;outline:none;padding:0;transition:box-shadow var(--speed-focus) ease-out,opacity var(--speed-focus) ease-out;width:30px}.el-cp-color-eyedropper button:focus-visible{box-shadow:0 0 0 2px var(--color-key)}.el-cp-color-eyedropper button:active{opacity:.5}.el-cp-color-eyedropper svg{color:var(--color-fill);display:block;margin:0 auto}.CodeMirror{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:auto!important}.CodeMirror-code{outline:none}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.CodeMirror-sizer:after,.CodeMirror-sizer:before{color:#bbb;display:block}.CodeMirror-sizer:before{content:"";padding-bottom:5px}.cm-s-rubyblue .CodeMirror-cursor{border-right:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;right:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 28px 3px 12px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-right:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{color:#f6a306;content:"\f534"}.CodeMirror-lint-message-error{background-color:#fbeaea;border-right:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{color:#dc3232;content:"\f153"}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:rtl}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}.CodeMirror-foldmarker{color:inherit;font-weight:700;margin-right:.25em;margin-left:.25em}.go-pro-button .badge,.nav-tab .badge,.snippet-type-badge{border:1px solid;border-radius:5px;font-size:10px;padding:1px 2px;text-transform:uppercase}.button .snippet-type-badge,.go-pro-button .badge,.nav-tab .badge,h1 .snippet-type-badge,h2 .snippet-type-badge,h3 .snippet-type-badge{margin-right:3px}.nav-tab .badge,.nav-tab span{vertical-align:middle}.nav-tab[data-type=php] .badge,.snippet-type-badge[data-type=php]{border-color:currentColor;color:#0073aa}.nav-tab-inactive[data-type=php]:hover .badge{color:#0073aa}.nav-tab[data-type=css] .badge,.snippet-type-badge[data-type=css]{border-color:currentColor;color:#8000ff}.nav-tab-inactive[data-type=css]:hover .badge{color:#8000ff}.nav-tab[data-type=js] .badge,.snippet-type-badge[data-type=js]{border-color:currentColor;color:#cd6600}.nav-tab-inactive[data-type=js]:hover .badge{color:#cd6600}.nav-tab[data-type=html] .badge,.snippet-type-badge[data-type=html]{border-color:currentColor;color:#548b54}.nav-tab-inactive[data-type=html]:hover .badge{color:#548b54}.nav-tab-button .dashicons-external{color:#666;font-size:15px;vertical-align:middle}.nav-tab.nav-tab-inactive{background:#f6f7f7;border-color:#f6f7f7;float:left;text-shadow:0 1px 0 #fff}.nav-tab.nav-tab-inactive,.nav-tab.nav-tab-inactive .badge{color:#a7aaad}.nav-tab.nav-tab-inactive:hover{color:#50575e}.go-pro-button .badge{border-color:#ce0000;color:#ce0000;margin-right:1px}.form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-right-width:4px}.active-snippet #title{border-right-color:#46b450}.inactive-snippet #title{border-right-color:#bbb}.erroneous-snippet #title{border-right-color:#dc3232}#snippet-form{margin-top:10px}label[for=snippet_description] h3 div{position:absolute}.button+.button{margin-right:.5em}.submit-inline{float:left}.snippet-scope p,p.snippet-scope{margin-top:15px}.html-shortcode-options strong,.snippet-scope label{display:inline-block;margin-left:1.5em}.below-editor{display:flex;justify-content:space-between}.snippet-priority label{cursor:help;font-size:1.1em;font-weight:700;padding-left:.5em}.snippet-priority input{width:4em}.snippet-editor{position:relative}.CodeMirror{width:100%}.wrap h2.nav-tab-wrapper{border-bottom:none}.code-snippets-copy-text{color:inherit}.editor-help-tooltip{background:transparent!important;cursor:help;display:inline-block;font-size:10px;padding:.3em .3em 0}.snippet-editor-help{position:absolute;left:5px;top:5px}.snippet-editor-help:hover .editor-help-text{opacity:1;visibility:visible}.editor-help-text{background-color:#555;border-radius:6px;color:#fff;font-size:small;margin-left:-10px;opacity:0;padding:5px;position:absolute;left:0;top:125%;transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:99}.editor-help-text:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";margin-left:10px;position:absolute;left:0}.editor-help-text td:first-child{padding-left:.5em}.editor-help-text .mac-key{display:none}.editor-help-text.platform-mac .mac-key{display:inline}.editor-help-text.platform-mac .pc-key{display:none}.CodeMirror-sizer{box-sizing:border-box;min-height:300px!important;padding-bottom:1.5em!important}.CodeMirror-sizer:after{bottom:0;position:absolute}.snippet-scope{display:none}.snippet-scope .description,[data-snippet-type=php] .php-scopes-list{display:block}[data-snippet-type=php] .CodeMirror-sizer{padding-bottom:0!important}[data-snippet-type=php] .CodeMirror-sizer:before{content:"<?php"}[data-snippet-type=css] .css-scopes-list{display:block}[data-snippet-type=css] .CodeMirror-sizer:before{content:"<style>"}[data-snippet-type=css] .CodeMirror-sizer:after{content:"</style>"}[data-snippet-type=js] .js-scopes-list{display:block}[data-snippet-type=js] .CodeMirror-sizer:before{content:"<script>"}[data-snippet-type=js] .CodeMirror-sizer:after{content:"</script>"}[data-snippet-type=html] .html-scopes-list{display:block}[data-snippet-type=html] .CodeMirror-sizer:before{content:"<!-- begin content -->"}[data-snippet-type=html] .CodeMirror-sizer:after{content:"<!-- end content -->"}.tagger{border:0}.tagger ul{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px}.tagger li:not(.tagger-new)>span,.tagger-new ul,.tagger>ul>li:not(.tagger-new)>a{background-color:#dee7f8;border:1px solid #cad8f3;border-radius:6px}.tagger li:not(.tagger-new)>span:hover,.tagger-new ul:hov
|