From 009384421ebfa85e111a6767e43d446c6ca034d0 Mon Sep 17 00:00:00 2001 From: CodeyGuyDylan Date: Thu, 19 Dec 2024 17:49:23 +0000 Subject: [PATCH] Fix/connection status inconsistencies (#40632) * Update connection status card to align with connection banner * unify the way we connect sites on My Jetpack * Unify user connection flows in My Jetpack * changelog * Fix tests * Add comment * Scroll to top all the time when connecting site * Add slight delay to scroll to top Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12417815414 Upstream-Ref: Automattic/jetpack@bfbeaacccae0cc79ff0350f8440e0421f396cce7 --- composer.lock | 60 +- .../jetpack-classic-theme-helper/CHANGELOG.md | 8 + .../custom-post-types/js/many-items.asset.php | 1 + .../dist/custom-post-types/js/many-items.js | 1 + .../js/menu-checkboxes.asset.php | 1 + .../custom-post-types/js/menu-checkboxes.js | 1 + .../js/nova-drag-drop.asset.php | 1 + .../custom-post-types/js/nova-drag-drop.js | 1 + .../src/class-main.php | 2 +- .../class-nova-restaurant.php | 1760 +++++++++++++++++ .../src/custom-post-types/css/edit-items.css | 24 + .../src/custom-post-types/css/many-items.css | 14 + .../src/custom-post-types/css/nova-font.css | 30 + .../src/custom-post-types/css/nova.css | 110 ++ .../src/custom-post-types/js/many-items.js | 139 ++ .../custom-post-types/js/menu-checkboxes.js | 75 + .../custom-post-types/js/nova-drag-drop.js | 85 + .../automattic/jetpack-mu-wpcom/composer.json | 2 +- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + vendor/composer/installed.json | 58 +- vendor/composer/installed.php | 56 +- 22 files changed, 2342 insertions(+), 89 deletions(-) create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.asset.php create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.js create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.asset.php create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.js create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.asset.php create mode 100644 vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.js create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/edit-items.css create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/many-items.css create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova-font.css create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova.css create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/many-items.js create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/menu-checkboxes.js create mode 100644 vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/nova-drag-drop.js diff --git a/composer.lock b/composer.lock index e3e3dbc6..f36d8172 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "80300e62c6d42108c5feb41d6a4336df", + "content-hash": "844ed2afe3ba37886d0a7d03e746fffa", "packages": [ { "name": "automattic/jetpack-a8c-mc-stats", @@ -12,7 +12,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats", - "reference": "0b9b3c42583a2cd7c8b24f156b3ec893161cf2a1" + "reference": "d2909f3daba553dde0d4b5b8b7585d81028f56d2" }, "require": { "php": ">=7.2" @@ -65,7 +65,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui", - "reference": "e662b3f394bad813c154e1a53ff54fb5189766a9" + "reference": "99679b05ab1a16f3c83a37795d9494fa047e325f" }, "require": { "php": ">=7.2" @@ -130,7 +130,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-assets", - "reference": "8414b83d2174e979a7fb61083b54b4a9c35614f8" + "reference": "390f36b06cee6b95f8568e2eb73eb57c63156c55" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -199,7 +199,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-blaze", - "reference": "fb09c56085f6c71351ff8d6faf7a21ad33952bde" + "reference": "d5c31b8b249d3c10d31983929046bc1c84faf1e8" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -280,7 +280,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-blocks", - "reference": "26d31d604b8d602588a13d8d7a18e7b7648ddded" + "reference": "0f55ae9072e5df3a8ac8e58428efd3aaeba01291" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -342,7 +342,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-calypsoify", - "reference": "2300551ab505e546466bee02768982b1f284193f" + "reference": "574ac9e072ca569fd69610db848b64fc4604bf85" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -403,11 +403,11 @@ }, { "name": "automattic/jetpack-classic-theme-helper", - "version": "0.8.0", + "version": "0.8.1-alpha.1734626295", "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-classic-theme-helper", - "reference": "c6ebc2de60f88e064c63899a3aa4f893e8164ae2" + "reference": "4e219c56d8b3024282905a9017fc3e1fa6efa552" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -478,7 +478,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-compat", - "reference": "d384e89dfd86e344721270a79690dc24873bb095" + "reference": "86836128ca9ce40c20dc9d58f38197fc5a0eb47c" }, "require": { "php": ">=7.2" @@ -515,7 +515,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-connection", - "reference": "6437cb6a923b4419da21c34f5c74d4108841cf44" + "reference": "1aeb629fef96dd9659780d9627049bcdabab3fb1" }, "require": { "automattic/jetpack-a8c-mc-stats": "^3.0.0", @@ -605,7 +605,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-constants", - "reference": "5284a93904f7c6981a9922ec2eb4fb86813328fe" + "reference": "2f1de35dfc66f7525be1485939bfb35ca9050fa7" }, "require": { "php": ">=7.2" @@ -659,7 +659,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-device-detection", - "reference": "496e4baacb796453a9ea55789ac9136042ed4d85" + "reference": "bf38046bfb96c11759e044b490b6a4608a3bf954" }, "require": { "php": ">=7.2" @@ -712,7 +712,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-google-analytics", - "reference": "70c2bfc86de3828956337753b38b46a524ef36e1" + "reference": "14a1bf14da70f071e003471024bc26466082c22f" }, "require": { "automattic/jetpack-status": "^5.0.1", @@ -783,7 +783,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-ip", - "reference": "01567f688a4edb6944d01766dc3987b53d44d156" + "reference": "58b9a9ea5b082ba9a484fd7dcbc37a844d6fb287" }, "require": { "php": ">=7.2" @@ -841,7 +841,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-jitm", - "reference": "7cc90e3cd62aecc49b54c724ad1b128ee055d705" + "reference": "71426c47965160a326d8436dfc677bb3b0e0ec8b" }, "require": { "automattic/jetpack-a8c-mc-stats": "^3.0.0", @@ -916,7 +916,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-logo", - "reference": "863e3a405a0dbc6876ce0dceffcdd8308fa34ece" + "reference": "2fda435a5366aeb05740591d5c40c52e37e90d88" }, "require": { "php": ">=7.2" @@ -969,7 +969,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-masterbar", - "reference": "ab5d045e25f1c6f4c6e73e2e3654f0f75c151a06" + "reference": "a7cda6b8b34640973791ad06f870e770abf727c4" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -1057,13 +1057,13 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-mu-wpcom", - "reference": "b5730e674bb42e204aec71b3317d7ddda4195593" + "reference": "03ee081e943ddf96c6dd25659f3fa2fb90f80071" }, "require": { "automattic/jetpack-assets": "^4.0.2", "automattic/jetpack-blocks": "^3.0.1", "automattic/jetpack-calypsoify": "^0.2.1-alpha", - "automattic/jetpack-classic-theme-helper": "^0.8.0", + "automattic/jetpack-classic-theme-helper": "^0.8.1-alpha", "automattic/jetpack-compat": "^4.0.0", "automattic/jetpack-connection": "^6.2.1", "automattic/jetpack-google-analytics": "^0.3.0", @@ -1140,7 +1140,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-password-checker", - "reference": "b148b62886428a846109d3714796bfe579359d87" + "reference": "f749df078237bcc4fbf89aa118a87e7d2b813b94" }, "require": { "php": ">=7.2" @@ -1201,7 +1201,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-plans", - "reference": "b5cb3b02dbe8333093402873cb29b4308940f3be" + "reference": "a3818015a1d5719adc29c9fd1219dfea608819be" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1269,7 +1269,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-redirect", - "reference": "7d9bb8e53d6eb1b8f58986769cac411cbf11d12f" + "reference": "210a9dc7bf9c3baa75dd65ba714fbd9ed4e7f051" }, "require": { "automattic/jetpack-status": "^5.0.1", @@ -1324,7 +1324,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-roles", - "reference": "3af06cbbf6bf12afd54c10df2a1805c7abc630be" + "reference": "51c2663ae8582fb8af91855e4488890ba9574b37" }, "require": { "php": ">=7.2" @@ -1378,7 +1378,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-stats", - "reference": "7e11f03b8c350d3c0146e2e3f1edb781c37afba6" + "reference": "d261415972cce2fbbdc741029e08a4c0dfc7edae" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1445,7 +1445,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-stats-admin", - "reference": "2e0efc019bc26ff18c1d3d71e69606f90c92692b" + "reference": "83d1d26051ea7bd16de12cfa628e2d1a9bc37288" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1518,7 +1518,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-status", - "reference": "786d0322a5172d8af377060c1afa663b42bca26d" + "reference": "689b9632e14bbda943993d14adb651d28ff5e7ad" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -1582,7 +1582,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-sync", - "reference": "45c6d6c0ae6ee84bbfdabf1ae68bea3de6e9015b" + "reference": "d5cd6a18da93efbcca66189790dfed58d770e6a6" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1660,7 +1660,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/scheduled-updates", - "reference": "34558e11ba46fcca7e0afb05cd7a221817885b99" + "reference": "e72b39aae24612019af21d6ea7b5637d9d0d7e23" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1812,7 +1812,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-changelogger", - "reference": "5489536a42ba08cc7a7e989052517c2d2c2cbf05" + "reference": "0d7f386ef7b7223a9838c136dc175bd8f8c93e89" }, "require": { "php": ">=7.2.5", diff --git a/vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md b/vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md index 702edf2a..a4a7450e 100644 --- a/vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md +++ b/vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.1-alpha] - unreleased + +This is an alpha version! The changes listed here are not final. + +### Added +- Custom Post Types: Added Restaurant Menu CPT files. + ## [0.8.0] - 2024-12-16 ### Added - Jetpack Testimonials: Ensuring functionality runs via the Classic Theme Helper package. [#40388] @@ -177,6 +184,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Add wordpress folder on gitignore. [#37177] +[0.8.1-alpha]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.8.0...v0.8.1-alpha [0.8.0]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.7.4...v0.8.0 [0.7.4]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.7.3...v0.7.4 [0.7.3]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.7.2...v0.7.3 diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.asset.php b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.asset.php new file mode 100644 index 00000000..9de13bc3 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.asset.php @@ -0,0 +1 @@ + array('wp-polyfill'), 'version' => 'cedc18600a224800f153'); diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.js b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.js new file mode 100644 index 00000000..3d0a19f2 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/many-items.js @@ -0,0 +1 @@ +!function(){let e,t;const n=new Set,a={init:function(o){let r=o.lastElementChild;for(;r&&"TBODY"!==r.tagName;)r=r.previousElementSibling;const c=r.querySelector("tr:first-child").cloneNode(!0);return o.dataset.form=o.closest("form"),o.dataset.tbody=r,o.dataset.row=c,o.dataset.currentRow=c,e=document.getElementById("nova-menu-tax"),t=document.getElementById("_wpnonce"),o.addEventListener("keypress",(function(e){13===e.which&&(e.preventDefault(),"function"==typeof FormData&&a.submitRow.call(o),a.addRow.call(o))})),o.addEventListener("focusin",(function(e){"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||(o.dataset.currentRow=e.target.closest("tr"))})),n.add(o),o},destroy:function(e){return e.removeEventListener("keypress",a.keypressHandler),e.removeEventListener("focusin",a.focusinHandler),n.delete(e),e},submitRow:function(n){const a=n.dataset.currentRow,o=a.querySelectorAll("input, textarea, select"),r=document.querySelector(n.dataset.form),c=Array.from(r.querySelectorAll("input, textarea, select"));o.forEach((e=>e.disabled=!0)),c.filter((e=>!o.includes(e))).forEach((e=>e.disabled=!0));const s=new FormData(r);return s.append("ajax","1"),s.append("nova_menu_tax",e.value),s.append("_wpnonce",t.value),fetch("",{method:"POST",body:s}).then((e=>e.text())).then((e=>{a.innerHTML=e})),c.forEach((e=>e.disabled=!1)),n},addRow:function(e){const t=e.dataset.row.cloneNode(!0);e.dataset.tbody.appendChild(t);const n=t.querySelector("input, textarea, select");return n&&n.focus(),e},clickAddRow:function(e){let t=e.lastElementChild;for(;t&&"TBODY"!==t.tagName;)t=t.previousElementSibling;const n=t.querySelector("tr:first-child").cloneNode(!0);n.querySelectorAll("input, textarea").forEach((e=>{e.value=""})),t.appendChild(n)}};document.addEventListener("focusin",(e=>{const t=e.target.closest(".many-items-table");t&&!n.has(t)&&a.init(t)})),document.addEventListener("click",(e=>{if(e.target.matches("a.nova-new-row")){const t=e.target.closest(".many-items-table");t&&(e.preventDefault(),a.clickAddRow(t))}})),new MutationObserver((e=>{e.forEach((e=>{e.removedNodes.forEach((e=>{e.matches&&e.matches(".many-items-table")&&a.destroy(e)}))}))})).observe(document.body,{childList:!0,subtree:!0})}(); \ No newline at end of file diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.asset.php b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.asset.php new file mode 100644 index 00000000..11ae4888 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.asset.php @@ -0,0 +1 @@ + array('wp-polyfill'), 'version' => '5fadb54ea9d5485c71c6'); diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.js b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.js new file mode 100644 index 00000000..34a0eea4 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/menu-checkboxes.js @@ -0,0 +1 @@ +!function(){const e={inputs:null,popInputs:null,initialize:function(){e.popInputs=document.querySelectorAll('#nova_menuchecklist-pop input[type="checkbox"]'),e.inputs=document.querySelectorAll('#nova_menuchecklist input[type="checkbox"]'),e.inputs.forEach((c=>{c.addEventListener("change",e.checkOne),c.addEventListener("change",e.syncPop)})),e.isChecked()||e.checkFirst(),e.syncPop()},syncPop:function(){e.popInputs.forEach((e=>{const c=document.querySelector(`#in-nova_menu-${e.value}`);e.checked=!!c&&c.checked}))},isChecked:function(){return Array.from(e.inputs).some((e=>e.checked))},checkFirst:function(){const c=e.inputs[0];c&&(c.checked=!0)},checkOne:function(){const c=this;c.checked?e.inputs.forEach((e=>{e!==c&&(e.checked=!1)})):document.querySelector("#nova_menuchecklist").querySelectorAll('input[type="checkbox"]:checked').length>0?c.checked=!1:e.checkFirst()}};document.addEventListener("DOMContentLoaded",e.initialize)}(); \ No newline at end of file diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.asset.php b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.asset.php new file mode 100644 index 00000000..8557fb67 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.asset.php @@ -0,0 +1 @@ + array('wp-polyfill'), 'version' => '84ecc699f8dd905dc552'); diff --git a/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.js b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.js new file mode 100644 index 00000000..8340a1ba --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/dist/custom-post-types/js/nova-drag-drop.js @@ -0,0 +1 @@ +!function(e){let n;e(document).ready((function(){n=e("#the-list"),n.sortable({cancel:".no-items, .inline-edit-row",stop:function(t,r){if(r.item.is(":first-child"))return n.sortable("cancel");n.find(".menu-label-row").each((function(){const n=e(this).data("term_id");e(this).nextUntil(".menu-label-row").each((function(t){const r=e(this);r.find(".menu-order-value").val(t),r.find(".nova-menu-term").val(n)}))}))}}),e("#posts-filter").append(''),e(".tablenav").prepend(''),e("#posts-filter").attr("method","post")}))}(jQuery); \ No newline at end of file diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/class-main.php b/vendor/automattic/jetpack-classic-theme-helper/src/class-main.php index 3c934378..1f3b3870 100644 --- a/vendor/automattic/jetpack-classic-theme-helper/src/class-main.php +++ b/vendor/automattic/jetpack-classic-theme-helper/src/class-main.php @@ -14,7 +14,7 @@ */ class Main { - const PACKAGE_VERSION = '0.8.0'; + const PACKAGE_VERSION = '0.8.1-alpha'; /** * Modules to include. diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php new file mode 100644 index 00000000..924209b5 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php @@ -0,0 +1,1760 @@ + 'section', + * 'menu_class' => 'menu-items', + * 'menu_header_tag' => 'header', + * 'menu_header_class' => 'menu-group-header', + * 'menu_title_tag' => 'h1', + * 'menu_title_class' => 'menu-group-title', + * 'menu_description_tag' => 'div', + * 'menu_description_class' => 'menu-group-description', + * ) ); + * } + * + * @todo + * - Bulk/Quick edit response of Menu Item rows is broken. + * - Drag and Drop reordering. + * + * @package automattic/jetpack-classic-theme-helper + */ + +namespace Automattic\Jetpack\Classic_Theme_Helper; + +use Automattic\Jetpack\Assets; +use Automattic\Jetpack\Roles; +use WP_Post; +use WP_Query; + +if ( ! class_exists( __NAMESPACE__ . '\Nova_Restaurant' ) ) { + + /** + * Create the new Nova CPT. + */ + class Nova_Restaurant { + const MENU_ITEM_POST_TYPE = 'nova_menu_item'; + const MENU_ITEM_LABEL_TAX = 'nova_menu_item_label'; + const MENU_TAX = 'nova_menu'; + + /** + * Version number used when enqueuing all resources (css and js). + * + * @var string + */ + public $version = '20210303'; + + /** + * Default markup for the menu items. + * + * @var array + */ + protected $default_menu_item_loop_markup = array( + 'menu_tag' => 'section', + 'menu_class' => 'menu-items', + 'menu_header_tag' => 'header', + 'menu_header_class' => 'menu-group-header', + 'menu_title_tag' => 'h1', + 'menu_title_class' => 'menu-group-title', + 'menu_description_tag' => 'div', + 'menu_description_class' => 'menu-group-description', + ); + + /** + * Array of markup for the menu items. + * + * @var array + */ + protected $menu_item_loop_markup = array(); + + /** + * Last term ID of a loop of menu items. + * + * @var bool|int + */ + protected $menu_item_loop_last_term_id = false; + + /** + * Current term ID of a loop of menu items. + * + * @var bool|int|\WP_Term + */ + protected $menu_item_loop_current_term = false; + + /** + * Initialize class. + * + * @param array $menu_item_loop_markup Array of markup for the menu items. + * + * @return self + */ + public static function init( $menu_item_loop_markup = array() ) { + static $instance = false; + + if ( ! $instance ) { + $instance = new Nova_Restaurant(); + } + + if ( $menu_item_loop_markup ) { + $instance->menu_item_loop_markup = wp_parse_args( $menu_item_loop_markup, $instance->default_menu_item_loop_markup ); + } + + return $instance; + } + + /** + * Constructor. + * Hook into WordPress to create CPT and utilities if needed. + */ + public function __construct() { + if ( ! $this->site_supports_nova() ) { + return; + } + + $this->register_taxonomies(); + $this->register_post_types(); + add_action( 'admin_menu', array( $this, 'add_admin_menus' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_nova_styles' ) ); + add_action( 'admin_head', array( $this, 'set_custom_font_icon' ) ); + + // Always sort menu items correctly + add_action( 'parse_query', array( $this, 'sort_menu_item_queries_by_menu_order' ) ); + add_filter( 'posts_results', array( $this, 'sort_menu_item_queries_by_menu_taxonomy' ), 10, 2 ); + + add_action( 'wp_insert_post', array( $this, 'add_post_meta' ) ); + + $this->menu_item_loop_markup = $this->default_menu_item_loop_markup; + + // Only output our Menu Item Loop Markup on a real blog view. Not feeds, XML-RPC, admin, etc. + add_filter( 'template_include', array( $this, 'setup_menu_item_loop_markup__in_filter' ) ); + + add_filter( 'enter_title_here', array( $this, 'change_default_title' ) ); + add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) ); + add_filter( 'dashboard_glance_items', array( $this, 'add_to_dashboard' ) ); + } + + /** + * Should this Custom Post Type be made available? + * + * @return bool + */ + public function site_supports_nova() { + // If we're on WordPress.com, and it has the menu site vertical. + if ( function_exists( 'site_vertical' ) && 'nova_menu' === site_vertical() ) { // @phan-suppress-current-line PhanUndeclaredFunction -- only calling if it exists. + return true; + } + + // Else, if the current theme requests it. + if ( current_theme_supports( self::MENU_ITEM_POST_TYPE ) ) { + return true; + } + + // Otherwise, say no unless something wants to filter us to say yes. + /** + * Allow something else to hook in and enable this CPT. + * + * @module custom-content-types + * + * @since 2.6.0 + * + * @param bool false Whether or not to enable this CPT. + * @param string $var The slug for this CPT. + */ + return (bool) apply_filters( 'jetpack_enable_cpt', false, self::MENU_ITEM_POST_TYPE ); + } + + /* Setup */ + + /** + * Register Taxonomies and Post Type + */ + public function register_taxonomies() { + if ( ! taxonomy_exists( self::MENU_ITEM_LABEL_TAX ) ) { + register_taxonomy( + self::MENU_ITEM_LABEL_TAX, + self::MENU_ITEM_POST_TYPE, + array( + 'labels' => array( + /* translators: this is about a food menu */ + 'name' => __( 'Menu Item Labels', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'singular_name' => __( 'Menu Item Label', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'search_items' => __( 'Search Menu Item Labels', 'jetpack-classic-theme-helper' ), + 'popular_items' => __( 'Popular Labels', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'all_items' => __( 'All Menu Item Labels', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'edit_item' => __( 'Edit Menu Item Label', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'view_item' => __( 'View Menu Item Label', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'update_item' => __( 'Update Menu Item Label', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'add_new_item' => __( 'Add New Menu Item Label', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'new_item_name' => __( 'New Menu Item Label Name', 'jetpack-classic-theme-helper' ), + 'separate_items_with_commas' => __( 'For example, spicy, favorite, etc.
Separate Labels with commas', 'jetpack-classic-theme-helper' ), + 'add_or_remove_items' => __( 'Add or remove Labels', 'jetpack-classic-theme-helper' ), + 'choose_from_most_used' => __( 'Choose from the most used Labels', 'jetpack-classic-theme-helper' ), + 'items_list_navigation' => __( 'Menu item label list navigation', 'jetpack-classic-theme-helper' ), + 'items_list' => __( 'Menu item labels list', 'jetpack-classic-theme-helper' ), + ), + 'no_tagcloud' => __( 'No Labels found', 'jetpack-classic-theme-helper' ), + 'hierarchical' => false, + ) + ); + } + + if ( ! taxonomy_exists( self::MENU_TAX ) ) { + register_taxonomy( + self::MENU_TAX, + self::MENU_ITEM_POST_TYPE, + array( + 'labels' => array( + /* translators: this is about a food menu */ + 'name' => __( 'Menu Sections', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'singular_name' => __( 'Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'search_items' => __( 'Search Menu Sections', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'all_items' => __( 'All Menu Sections', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'parent_item' => __( 'Parent Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'parent_item_colon' => __( 'Parent Menu Section:', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'edit_item' => __( 'Edit Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'view_item' => __( 'View Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'update_item' => __( 'Update Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'add_new_item' => __( 'Add New Menu Section', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'new_item_name' => __( 'New Menu Sections Name', 'jetpack-classic-theme-helper' ), + 'items_list_navigation' => __( 'Menu section list navigation', 'jetpack-classic-theme-helper' ), + 'items_list' => __( 'Menu section list', 'jetpack-classic-theme-helper' ), + ), + 'rewrite' => array( + 'slug' => 'menu', + 'with_front' => false, + 'hierarchical' => true, + ), + 'hierarchical' => true, + 'show_tagcloud' => false, + 'query_var' => 'menu', + ) + ); + } + } + + /** + * Register our Post Type. + */ + public function register_post_types() { + if ( post_type_exists( self::MENU_ITEM_POST_TYPE ) ) { + return; + } + + register_post_type( + self::MENU_ITEM_POST_TYPE, + array( + 'description' => __( "Items on your restaurant's menu", 'jetpack-classic-theme-helper' ), + + 'labels' => array( + /* translators: this is about a food menu */ + 'name' => __( 'Menu Items', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'singular_name' => __( 'Menu Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'menu_name' => __( 'Food Menus', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'all_items' => __( 'Menu Items', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'add_new' => __( 'Add One Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'add_new_item' => __( 'Add Menu Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'edit_item' => __( 'Edit Menu Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'new_item' => __( 'New Menu Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'view_item' => __( 'View Menu Item', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'search_items' => __( 'Search Menu Items', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'not_found' => __( 'No Menu Items found', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 'not_found_in_trash' => __( 'No Menu Items found in Trash', 'jetpack-classic-theme-helper' ), + 'filter_items_list' => __( 'Filter menu items list', 'jetpack-classic-theme-helper' ), + 'items_list_navigation' => __( 'Menu item list navigation', 'jetpack-classic-theme-helper' ), + 'items_list' => __( 'Menu items list', 'jetpack-classic-theme-helper' ), + ), + 'supports' => array( + 'title', + 'editor', + 'thumbnail', + 'excerpt', + ), + 'rewrite' => array( + 'slug' => 'item', + 'with_front' => false, + 'feeds' => false, + 'pages' => false, + ), + 'register_meta_box_cb' => array( $this, 'register_menu_item_meta_boxes' ), + + 'public' => true, + 'show_ui' => true, // set to false to replace with custom UI + 'menu_position' => 20, // below Pages + 'capability_type' => 'page', + 'map_meta_cap' => true, + 'has_archive' => false, + 'query_var' => 'item', + ) + ); + } + + /** + * Update messages for the Menu Item admin. + * + * @param array $messages Existing post update messages. + * + * @return array $messages Updated post update messages. + */ + public function updated_messages( $messages ) { + global $post; + + $messages[ self::MENU_ITEM_POST_TYPE ] = array( + 0 => '', // Unused. Messages start at index 1. + 1 => sprintf( + /* translators: this is about a food menu. Placeholder is a link to the food menu. */ + __( 'Menu item updated. View item', 'jetpack-classic-theme-helper' ), + esc_url( get_permalink( $post->ID ) ) + ), + 2 => esc_html__( 'Custom field updated.', 'jetpack-classic-theme-helper' ), + 3 => esc_html__( 'Custom field deleted.', 'jetpack-classic-theme-helper' ), + /* translators: this is about a food menu */ + 4 => esc_html__( 'Menu item updated.', 'jetpack-classic-theme-helper' ), + 5 => isset( $_GET['revision'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Copying core message handling. + ? sprintf( + /* translators: %s: date and time of the revision */ + esc_html__( 'Menu item restored to revision from %s', 'jetpack-classic-theme-helper' ), + wp_post_revision_title( (int) $_GET['revision'], false ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Copying core message handling. + ) + : false, + 6 => sprintf( + /* translators: this is about a food menu. Placeholder is a link to the food menu. */ + __( 'Menu item published. View item', 'jetpack-classic-theme-helper' ), + esc_url( get_permalink( $post->ID ) ) + ), + /* translators: this is about a food menu */ + 7 => esc_html__( 'Menu item saved.', 'jetpack-classic-theme-helper' ), + 8 => sprintf( + /* translators: this is about a food menu */ + __( 'Menu item submitted. Preview item', 'jetpack-classic-theme-helper' ), + esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) + ), + 9 => sprintf( + /* translators: this is about a food menu. 1. Publish box date format, see https://php.net/date 2. link to the food menu. */ + __( 'Menu item scheduled for: %1$s. Preview item', 'jetpack-classic-theme-helper' ), + /* translators: Publish box date format, see https://php.net/date */ + date_i18n( __( 'M j, Y @ G:i', 'jetpack-classic-theme-helper' ), strtotime( $post->post_date ) ), + esc_url( get_permalink( $post->ID ) ) + ), + 10 => sprintf( + /* translators: this is about a food menu. Placeholder is a link to the food menu. */ + __( 'Menu item draft updated. Preview item', 'jetpack-classic-theme-helper' ), + esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) + ), + ); + + return $messages; + } + + /** + * Nova styles and scripts. + * + * @param string $hook Page hook. + * + * @return void + */ + public function enqueue_nova_styles( $hook ) { + global $post_type; + $pages = array( 'edit.php', 'post.php', 'post-new.php' ); + + if ( in_array( $hook, $pages, true ) && $post_type === self::MENU_ITEM_POST_TYPE ) { + wp_enqueue_style( 'nova-style', plugins_url( 'css/nova.css', __FILE__ ), array(), $this->version ); + } + + wp_enqueue_style( 'nova-font', plugins_url( 'css/nova-font.css', __FILE__ ), array(), $this->version ); + } + + /** + * Change ‘Enter Title Here’ text for the Menu Item. + * + * @param string $title Default title placeholder text. + * + * @return string + */ + public function change_default_title( $title ) { + if ( self::MENU_ITEM_POST_TYPE === get_post_type() ) { + /* translators: this is about a food menu */ + $title = esc_html__( "Enter the menu item's name here", 'jetpack-classic-theme-helper' ); + } + + return $title; + } + + /** + * Add to Dashboard At A Glance + * + * @return void + */ + public function add_to_dashboard() { + $number_menu_items = wp_count_posts( self::MENU_ITEM_POST_TYPE ); + + $roles = new Roles(); // @phan-suppress-current-line PhanUndeclaredClassMethod -- declared at top of file. + if ( current_user_can( $roles->translate_role_to_cap( 'administrator' ) ) ) { // @phan-suppress-current-line PhanUndeclaredClassMethod + $number_menu_items_published = sprintf( + '%2$s', + esc_url( + get_admin_url( + get_current_blog_id(), + 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE + ) + ), + sprintf( + /* translators: Placehoder is a number of items. */ + _n( + '%1$d Food Menu Item', + '%1$d Food Menu Items', + (int) $number_menu_items->publish, + 'jetpack-classic-theme-helper' + ), + number_format_i18n( $number_menu_items->publish ) + ) + ); + } else { + $number_menu_items_published = sprintf( + '%1$s', + sprintf( + /* translators: Placehoder is a number of items. */ + _n( + '%1$d Food Menu Item', + '%1$d Food Menu Items', + (int) $number_menu_items->publish, + 'jetpack-classic-theme-helper' + ), + number_format_i18n( $number_menu_items->publish ) + ) + ); + } + + echo '
  • ' . $number_menu_items_published . '
  • '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- we escape things above. + } + + /** + * If the WP query for our menu items. + * + * @param WP_Query $query WP Query. + * + * @return bool + */ + public function is_menu_item_query( $query ) { + if ( + ( isset( $query->query_vars['taxonomy'] ) && self::MENU_TAX === $query->query_vars['taxonomy'] ) + || + ( isset( $query->query_vars['post_type'] ) && self::MENU_ITEM_POST_TYPE === $query->query_vars['post_type'] ) + ) { + return true; + } + + return false; + } + + /** + * Custom sort the menu item queries by menu order. + * + * @param WP_Query $query WP Query. + * + * @return void + */ + public function sort_menu_item_queries_by_menu_order( $query ) { + if ( ! $this->is_menu_item_query( $query ) ) { + return; + } + + $query->query_vars['orderby'] = 'menu_order'; + $query->query_vars['order'] = 'ASC'; + + // For now, just turn off paging so we can sort by taxonmy later + // If we want paging in the future, we'll need to add the taxonomy sort here (or at least before the DB query is made) + $query->query_vars['posts_per_page'] = -1; + } + + /** + * Custom sort the menu item queries by menu taxonomies. + * + * @param WP_Post[] $posts Array of post objects. + * @param WP_Query $query The WP_Query instance. + * + * @return WP_Post[] + */ + public function sort_menu_item_queries_by_menu_taxonomy( $posts, $query ) { + if ( ! $posts ) { + return $posts; + } + + if ( ! $this->is_menu_item_query( $query ) ) { + return $posts; + } + + $grouped_by_term = array(); + + foreach ( $posts as $post ) { + $term = $this->get_menu_item_menu_leaf( $post->ID ); + if ( ! $term || is_wp_error( $term ) ) { + $term_id = 0; + } else { + $term_id = $term->term_id; + } + + if ( ! isset( $grouped_by_term[ "$term_id" ] ) ) { + $grouped_by_term[ "$term_id" ] = array(); + } + + $grouped_by_term[ "$term_id" ][] = $post; + } + + $term_order = get_option( 'nova_menu_order', array() ); + + $return = array(); + foreach ( $term_order as $term_id ) { + if ( isset( $grouped_by_term[ "$term_id" ] ) ) { + $return = array_merge( $return, $grouped_by_term[ "$term_id" ] ); + unset( $grouped_by_term[ "$term_id" ] ); + } + } + + foreach ( $grouped_by_term as $term_id => $posts ) { + $return = array_merge( $return, $posts ); + } + + return $return; + } + + /** + * Add new "Add many items" submenu, custom colunmns, and custom bulk actions. + * + * @return void + */ + public function add_admin_menus() { + $hook = add_submenu_page( + 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE, + __( 'Add Many Items', 'jetpack-classic-theme-helper' ), + __( 'Add Many Items', 'jetpack-classic-theme-helper' ), + 'edit_pages', + 'add_many_nova_items', + array( $this, 'add_many_new_items_page' ) + ); + + add_action( "load-$hook", array( $this, 'add_many_new_items_page_load' ) ); + + add_action( 'current_screen', array( $this, 'current_screen_load' ) ); + + /* + * Adjust 'Add Many Items' submenu position + * We're making changes to the menu global, but no other choice unfortunately. + * phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited + */ + if ( isset( $GLOBALS['submenu'][ 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE ] ) ) { + $submenu_item = array_pop( $GLOBALS['submenu'][ 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE ] ); + $GLOBALS['submenu'][ 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE ][11] = $submenu_item; + ksort( $GLOBALS['submenu'][ 'edit.php?post_type=' . self::MENU_ITEM_POST_TYPE ] ); + } + // phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited + + $this->setup_menu_item_columns(); + + Assets::register_script( + 'nova-menu-checkboxes', + '../../dist/custom-post-types/js/menu-checkboxes.js', + __FILE__, + array( + 'in_footer' => true, + 'enqueue' => false, + 'textdomain' => 'jetpack-classic-theme-helper', + ) + ); + } + + /** + * Custom Nova Icon CSS + * + * @return void + */ + public function set_custom_font_icon() { + ?> + + id ) { + return; + } + + $this->edit_menu_items_page_load(); + add_filter( 'admin_notices', array( $this, 'admin_notices' ) ); + } + + /* Edit Items List */ + + /** + * Display a notice in wp-admin after items have been changed. + * + * @return void + */ + public function admin_notices() { + if ( isset( $_GET['nova_reordered'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- this is only displaying a message with no dynamic values. + printf( + '

    %s

    ', + /* translators: this is about a food menu */ + esc_html__( 'Menu Items re-ordered.', 'jetpack-classic-theme-helper' ) + ); + } + } + + /** + * Do not allow sorting by title. + * + * @param array $columns An array of sortable columns. + * + * @return array $columns. + */ + public function no_title_sorting( $columns ) { + if ( isset( $columns['title'] ) ) { + unset( $columns['title'] ); + } + return $columns; + } + + /** + * Set up custom columns for our Nova menu. + * + * @return void + */ + public function setup_menu_item_columns() { + add_filter( sprintf( 'manage_edit-%s_sortable_columns', self::MENU_ITEM_POST_TYPE ), array( $this, 'no_title_sorting' ) ); + add_filter( sprintf( 'manage_%s_posts_columns', self::MENU_ITEM_POST_TYPE ), array( $this, 'menu_item_columns' ) ); + + add_action( sprintf( 'manage_%s_posts_custom_column', self::MENU_ITEM_POST_TYPE ), array( $this, 'menu_item_column_callback' ), 10, 2 ); + } + + /** + * Add custom columns to the Nova menu item list. + * + * @param array $columns An array of columns. + * + * @return array $columns. + */ + public function menu_item_columns( $columns ) { + unset( $columns['date'], $columns['likes'] ); + + $columns['thumbnail'] = __( 'Thumbnail', 'jetpack-classic-theme-helper' ); + $columns['labels'] = __( 'Labels', 'jetpack-classic-theme-helper' ); + $columns['price'] = __( 'Price', 'jetpack-classic-theme-helper' ); + $columns['order'] = __( 'Order', 'jetpack-classic-theme-helper' ); + + return $columns; + } + + /** + * Display custom data in each new custom column we created. + * + * @param string $column The name of the column to display. + * @param int $post_id The current post ID. + * + * @return void + */ + public function menu_item_column_callback( $column, $post_id ) { + $screen = get_current_screen(); + + switch ( $column ) { + case 'thumbnail': + echo get_the_post_thumbnail( $post_id, array( 50, 50 ) ); + break; + case 'labels': + $this->list_admin_labels( $post_id ); + break; + case 'price': + $this->display_price( $post_id ); + break; + case 'order': + $url = admin_url( $screen->parent_file ); + + $up_url = add_query_arg( + array( + 'action' => 'move-item-up', + 'post_id' => (int) $post_id, + ), + wp_nonce_url( $url, 'nova_move_item_up_' . $post_id ) + ); + + $down_url = add_query_arg( + array( + 'action' => 'move-item-down', + 'post_id' => (int) $post_id, + ), + wp_nonce_url( $url, 'nova_move_item_down_' . $post_id ) + ); + $menu_item = get_post( $post_id ); + $menu = $this->get_menu_by_post_id( $post_id ); + $term_id = is_object( $menu ) ? $menu->term_id : ''; + ?> + + + + +     — up +
    +     — down +
    + $menu_order ) { + $id = absint( $id ); + unset( $order_pairs[ $id ] ); + if ( $id < 0 ) { + continue; + } + + $post = get_post( $id ); + if ( ! $post ) { + continue; + } + + // save a write if the order hasn't changed + if ( (int) $menu_order !== $post->menu_order ) { + $args = array( + 'ID' => $id, + 'menu_order' => $menu_order, + ); + wp_update_post( $args ); + } + + // save a write if the term hasn't changed + if ( + is_object( $this->get_menu_by_post_id( $id ) ) && + (int) $term_pairs[ $id ] !== $this->get_menu_by_post_id( $id )->term_id + ) { + wp_set_object_terms( $id, $term_pairs[ $id ], self::MENU_TAX ); + } + } + + $redirect = add_query_arg( + array( + 'post_type' => self::MENU_ITEM_POST_TYPE, + 'nova_reordered' => '1', + ), + admin_url( 'edit.php' ) + ); + wp_safe_redirect( $redirect ); + exit; + } + + /** + * Handle changes to menu items. + * (process actions, update data, enqueue necessary scripts). + * + * @return void + */ + public function edit_menu_items_page_load() { + if ( isset( $_GET['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- we process the form and check nonces in handle_menu_item_actions. + $this->handle_menu_item_actions(); + } + + $this->maybe_reorder_menu_items(); + + Assets::register_script( + 'nova-drag-drop', + '../../dist/custom-post-types/js/nova-drag-drop.js', + __FILE__, + array( + 'dependencies' => array( + 'jquery', + 'jquery-ui-sortable', + ), + 'in_footer' => true, + 'enqueue' => true, + 'textdomain' => 'jetpack-classic-theme-helper', + ) + ); + + wp_localize_script( + 'nova-drag-drop', + '_novaDragDrop', + array( + 'nonce' => wp_create_nonce( 'drag-drop-reorder' ), + 'nonceName' => 'drag-drop-reorder', + 'reorder' => __( 'Save New Order', 'jetpack-classic-theme-helper' ), + 'reorderName' => 'menu_reorder_submit', + ) + ); + add_action( 'the_post', array( $this, 'show_menu_titles_in_menu_item_list' ) ); + } + + /** + * Process actions to move menu items around. + * + * @return void + */ + public function handle_menu_item_actions() { + if ( isset( $_GET['action'] ) ) { + $action = (string) wp_unslash( $_GET['action'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we check for nonces below, and check against specific strings in switch statement. + } else { + return; + } + + switch ( $action ) { + case 'move-item-up': + case 'move-item-down': + $reorder = false; + + if ( empty( $_GET['post_id'] ) ) { + break; + } + + $post_id = (int) $_GET['post_id']; + + $term = $this->get_menu_item_menu_leaf( $post_id ); + + // Get all posts in that term. + $query = new WP_Query( + array( + 'taxonomy' => self::MENU_TAX, + 'term' => $term->slug, + ) + ); + + $order = array(); + foreach ( $query->posts as $post ) { + $order[] = $post->ID; + } + + if ( 'move-item-up' === $action ) { + check_admin_referer( 'nova_move_item_up_' . $post_id ); + + $first_post_id = $order[0]; + if ( $post_id === $first_post_id ) { + break; + } + + foreach ( $order as $menu_order => $order_post_id ) { + if ( $post_id !== $order_post_id ) { + continue; + } + + $swap_post_id = $order[ $menu_order - 1 ]; + $order[ $menu_order - 1 ] = $post_id; + $order[ $menu_order ] = $swap_post_id; + + $reorder = true; + break; + } + } else { + check_admin_referer( 'nova_move_item_down_' . $post_id ); + + $last_post_id = end( $order ); + if ( $post_id === $last_post_id ) { + break; + } + + foreach ( $order as $menu_order => $order_post_id ) { + if ( $post_id !== $order_post_id ) { + continue; + } + + $swap_post_id = $order[ $menu_order + 1 ]; + $order[ $menu_order + 1 ] = $post_id; + $order[ $menu_order ] = $swap_post_id; + + $reorder = true; + } + } + + if ( $reorder ) { + foreach ( $order as $menu_order => $id ) { + wp_update_post( compact( 'id', 'menu_order' ) ); + } + } + + break; + case 'move-menu-up': + case 'move-menu-down': + $reorder = false; + + if ( empty( $_GET['term_id'] ) ) { + break; + } + + $term_id = (int) $_GET['term_id']; + + $terms = $this->get_menus(); + + $order = array(); + foreach ( $terms as $term ) { + $order[] = $term->term_id; + } + + if ( 'move-menu-up' === $action ) { + check_admin_referer( 'nova_move_menu_up_' . $term_id ); + + $first_term_id = $order[0]; + if ( $term_id === $first_term_id ) { + break; + } + + foreach ( $order as $menu_order => $order_term_id ) { + if ( $term_id !== $order_term_id ) { + continue; + } + + $swap_term_id = $order[ $menu_order - 1 ]; + $order[ $menu_order - 1 ] = $term_id; + $order[ $menu_order ] = $swap_term_id; + + $reorder = true; + break; + } + } else { + check_admin_referer( 'nova_move_menu_down_' . $term_id ); + + $last_term_id = end( $order ); + if ( $term_id === $last_term_id ) { + break; + } + + foreach ( $order as $menu_order => $order_term_id ) { + if ( $term_id !== $order_term_id ) { + continue; + } + + $swap_term_id = $order[ $menu_order + 1 ]; + $order[ $menu_order + 1 ] = $term_id; + $order[ $menu_order ] = $swap_term_id; + + $reorder = true; + } + } + + if ( $reorder ) { + update_option( 'nova_menu_order', $order ); + } + + break; + default: + return; + } + + $redirect = add_query_arg( + array( + 'post_type' => self::MENU_ITEM_POST_TYPE, + 'nova_reordered' => '1', + ), + admin_url( 'edit.php' ) + ); + wp_safe_redirect( $redirect ); + exit; + } + + /** + * Add menu title rows to the list table + * + * @param \WP_Post $post The Post object. + * + * @return void + */ + public function show_menu_titles_in_menu_item_list( $post ) { + global $wp_list_table; + + static $last_term_id = false; + + $term = $this->get_menu_item_menu_leaf( $post->ID ); + + $term_id = $term instanceof \WP_Term ? $term->term_id : null; + + if ( false !== $last_term_id && $last_term_id === $term_id ) { + return; + } + + if ( $term_id === null ) { + $last_term_id = null; + $term_name = ''; + $parent_count = 0; + } else { + $last_term_id = $term->term_id; + $term_name = $term->name; + $parent_count = 0; + $current_term = $term; + while ( $current_term->parent ) { + ++$parent_count; + $current_term = get_term( $current_term->parent, self::MENU_TAX ); + } + } + + $non_order_column_count = $wp_list_table->get_column_count() - 1; + + $screen = get_current_screen(); + + $url = admin_url( $screen->parent_file ); + + $up_url = add_query_arg( + array( + 'action' => 'move-menu-up', + 'term_id' => (int) $term_id, + ), + wp_nonce_url( $url, 'nova_move_menu_up_' . $term_id ) + ); + + $down_url = add_query_arg( + array( + 'action' => 'move-menu-down', + 'term_id' => (int) $term_id, + ), + wp_nonce_url( $url, 'nova_move_menu_down_' . $term_id ) + ); + + ?> + + +

    + ', '', $term ); + + } else { + esc_html_e( 'Uncategorized', 'jetpack-classic-theme-helper' ); + } + ?> +

    + + + + +
    + + + + + process_form_request(); + exit; + } + + $this->enqueue_many_items_scripts(); + } + + /** + * Enqueue script to create many items at once. + * + * @return void + */ + public function enqueue_many_items_scripts() { + + Assets::register_script( + 'nova-many-items', + '../../dist/custom-post-types/js/many-items.js', + __FILE__, + array( + 'in_footer' => true, + 'enqueue' => true, + 'textdomain' => 'jetpack-classic-theme-helper', + ) + ); + } + + /** + * Process form request to create many items at once. + * + * @return void + */ + public function process_form_request() { + if ( ! isset( $_POST['nova_title'] ) || ! is_array( $_POST['nova_title'] ) ) { + return; + } + + $is_ajax = ! empty( $_POST['ajax'] ); + + if ( $is_ajax ) { + check_ajax_referer( 'nova_many_items' ); + } else { + check_admin_referer( 'nova_many_items' ); + } + + /* + * $_POST is already slashed + * phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash + */ + foreach ( array_keys( $_POST['nova_title'] ) as $key ) : // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize below. + $post_details = array( + 'post_status' => 'publish', + 'post_type' => self::MENU_ITEM_POST_TYPE, + 'post_content' => ! empty( $_POST['nova_content'] ) && ! empty( $_POST['nova_content'][ $key ] ) + ? sanitize_text_field( $_POST['nova_content'][ $key ] ) + : '', + 'post_title' => isset( $_POST['nova_title'][ $key ] ) + ? sanitize_title( $_POST['nova_title'][ $key ] ) + : '', + 'tax_input' => array( + self::MENU_ITEM_LABEL_TAX => isset( $_POST['nova_labels'][ $key ] ) + ? sanitize_meta( self::MENU_ITEM_LABEL_TAX, $_POST['nova_labels'][ $key ], 'term' ) + : null, + self::MENU_TAX => isset( $_POST['nova_menu_tax'] ) + ? sanitize_meta( self::MENU_TAX, $_POST['nova_menu_tax'], 'term' ) + : null, + ), + ); + + $post_id = wp_insert_post( $post_details ); + if ( ! $post_id || is_wp_error( $post_id ) ) { + continue; + } + + $this->set_price( + $post_id, + isset( $_POST['nova_price'][ $key ] ) + ? sanitize_meta( 'nova_price', $_POST['nova_price'][ $key ], 'post' ) + : '' + ); + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash + + if ( $is_ajax ) : + $post = get_post( $post_id ); + $GLOBALS['post'] = $post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + setup_postdata( $post ); + + ?> + + display_price(); ?> + list_labels( $post_id ); ?> + + +
    +

    + +

    + TAB key on your keyboard to move between colums and the ENTER or RETURN key to save each row and move on to the next.', 'jetpack-classic-theme-helper' ), + array( + 'kbd' => array(), + ) + ); + ?> +

    + +
    +

    +

    + 'nova-menu-tax', + 'name' => 'nova_menu_tax', + 'taxonomy' => self::MENU_TAX, + 'hide_empty' => false, + 'hierarchical' => true, + ) + ); + ?> +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + spicy, favorite, etc. Separate Labels with commas', 'jetpack-classic-theme-helper' ), + array( + 'small' => array(), + 'em' => array(), + ) + ); + ?> +
    +
    +
    + +

    + + +

    +
    +
    + %2$s', + (int) $post->ID, + esc_html__( 'Price', 'jetpack-classic-theme-helper' ), + esc_attr( $this->get_price( (int) $post->ID ) ) + ); + } + + /** + * Save the price of a menu item. + * + * @param int $post_id Post ID. + */ + public function add_post_meta( $post_id ) { + if ( ! isset( $_POST['nova_price'][ $post_id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce handling happens via core, since we hook into wp_insert_post. + return; + } + + $this->set_price( + $post_id, + sanitize_meta( 'nova_price', wp_unslash( $_POST['nova_price'][ $post_id ] ), 'post' ) // phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce handling happens via core, since we hook into wp_insert_post. + ); + } + + /* Data */ + + /** + * Get ordered array of menu items. + * + * @param array $args Optional argumments. + * + * @return array + */ + public function get_menus( $args = array() ) { + $args = wp_parse_args( + $args, + array( + 'hide_empty' => false, + ) + ); + $args['taxonomy'] = self::MENU_TAX; + + $terms = get_terms( $args ); // @phan-suppress-current-line PhanAccessMethodInternal + if ( ! $terms || is_wp_error( $terms ) ) { + return array(); + } + + $terms_by_id = array(); + foreach ( $terms as $term ) { + $terms_by_id[ "{$term->term_id}" ] = $term; + } + + $term_order = get_option( 'nova_menu_order', array() ); + + $return = array(); + foreach ( $term_order as $term_id ) { + if ( isset( $terms_by_id[ "$term_id" ] ) ) { + $return[] = $terms_by_id[ "$term_id" ]; + unset( $terms_by_id[ "$term_id" ] ); + } + } + + foreach ( $terms_by_id as $term_id => $term ) { + $return[] = $term; + } + + return $return; + } + + /** + * Get first menu taxonomy "leaf". + * + * @param int $post_id Post ID. + * + * @return bool|\WP_Term|\WP_Error|null + */ + public function get_menu_item_menu_leaf( $post_id ) { + // Get first menu taxonomy "leaf". + $term_ids = wp_get_object_terms( $post_id, self::MENU_TAX, array( 'fields' => 'ids' ) ); + + foreach ( $term_ids as $term_id ) { // possibly ignore PhanTypeSuspiciousNonTraversableForeach + $children = get_term_children( $term_id, self::MENU_TAX ); + if ( ! $children ) { + break; + } + } + + if ( ! isset( $term_id ) ) { + return false; + } + + return get_term( $term_id, self::MENU_TAX ); + } + + /** + * Get a list of the labels linked to a menu item. + * + * @param int $post_id Post ID. + * + * @return void + */ + public function list_labels( $post_id = 0 ) { + $post = get_post( $post_id ); + echo get_the_term_list( $post->ID, self::MENU_ITEM_LABEL_TAX, '', _x( ', ', 'Nova label separator', 'jetpack-classic-theme-helper' ), '' ); + } + + /** + * Get a list of the labels linked to a menu item, with links to manage them. + * + * @param int $post_id Post ID. + * + * @return void + */ + public function list_admin_labels( $post_id = 0 ) { + $post = get_post( $post_id ); + $labels = get_the_terms( $post->ID, self::MENU_ITEM_LABEL_TAX ); + if ( ! empty( $labels ) ) { + $out = array(); + foreach ( $labels as $label ) { // possibly ignore PhanTypeSuspiciousNonTraversableForeach + $out[] = sprintf( + '%s', + esc_url( + add_query_arg( + array( + 'post_type' => self::MENU_ITEM_POST_TYPE, + 'taxonomy' => self::MENU_ITEM_LABEL_TAX, + 'term' => $label->slug, + ), + 'edit.php' + ) + ), + esc_html( + sanitize_term_field( 'name', $label->name, $label->term_id, self::MENU_ITEM_LABEL_TAX, 'display' ) + ) + ); + } + + echo implode( _x( ', ', 'Nova label separator', 'jetpack-classic-theme-helper' ), $out ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- we build $out ourselves and escape things there. + } else { + esc_html_e( 'No Labels', 'jetpack-classic-theme-helper' ); + } + } + + /** + * Update post meta with the price defined in meta box. + * + * @param int $post_id Post ID. + * @param string $price Price. + * + * @return int|bool + */ + public function set_price( $post_id = 0, $price = '' ) { + return update_post_meta( $post_id, 'nova_price', $price ); + } + + /** + * Get the price of a menu item. + * + * @param int $post_id Post ID. + * + * @return bool|string + */ + public function get_price( $post_id = 0 ) { + return get_post_meta( $post_id, 'nova_price', true ); + } + + /** + * Echo the price of a menu item. + * + * @param int $post_id Post ID. + * + * @return void + */ + public function display_price( $post_id = 0 ) { + echo esc_html( $this->get_price( $post_id ) ); + } + + /* Menu Item Loop Markup */ + + /** + * Get markup for a menu item. + * Note: Does not support nested loops. + * + * @param null|string $field The field to get the value for. + * + * @return array + */ + public function get_menu_item_loop_markup( $field = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + return $this->menu_item_loop_markup; + } + + /** + * Sets up the loop markup. + * Attached to the 'template_include' *filter*, + * which fires only during a real blog view (not in admin, feeds, etc.) + * + * @param string $template Template File. + * + * @return string Template File. VERY Important. + */ + public function setup_menu_item_loop_markup__in_filter( $template ) { + add_action( 'loop_start', array( $this, 'start_menu_item_loop' ) ); + + return $template; + } + + /** + * If the Query is a Menu Item Query, start outputing the Menu Item Loop Marku + * Attached to the 'loop_start' action. + * + * @param WP_Query $query Post query. + * + * @return void + */ + public function start_menu_item_loop( $query ) { + if ( ! $this->is_menu_item_query( $query ) ) { + return; + } + + $this->menu_item_loop_last_term_id = false; + $this->menu_item_loop_current_term = false; + + add_action( 'the_post', array( $this, 'menu_item_loop_each_post' ) ); + add_action( 'loop_end', array( $this, 'stop_menu_item_loop' ) ); + } + + /** + * Outputs the Menu Item Loop Markup + * Attached to the 'the_post' action. + * + * @param WP_Post $post Post object. + * + * @return void + */ + public function menu_item_loop_each_post( $post ) { + $this->menu_item_loop_current_term = $this->get_menu_item_menu_leaf( $post->ID ); + + if ( + false === $this->menu_item_loop_current_term + || null === $this->menu_item_loop_current_term + || is_wp_error( $this->menu_item_loop_current_term ) + ) { + return; + } + + if ( false === $this->menu_item_loop_last_term_id ) { + // We're at the very beginning of the loop + + $this->menu_item_loop_open_element( 'menu' ); // Start a new menu section + $this->menu_item_loop_header(); // Output the menu's header + } elseif ( + is_object( $this->menu_item_loop_current_term ) && + $this->menu_item_loop_last_term_id !== $this->menu_item_loop_current_term->term_id + ) { + // We're not at the very beginning but still need to start a new menu section. End the previous menu section first. + + $this->menu_item_loop_close_element( 'menu' ); // End the previous menu section + $this->menu_item_loop_open_element( 'menu' ); // Start a new menu section + $this->menu_item_loop_header(); // Output the menu's header + } + if ( is_object( $this->menu_item_loop_current_term ) ) { + + $this->menu_item_loop_last_term_id = $this->menu_item_loop_current_term->term_id; + } + } + + /** + * If the Query is a Menu Item Query, stop outputing the Menu Item Loop Marku + * Attached to the 'loop_end' action. + * + * @param WP_Query $query Post query. + * + * @return void + */ + public function stop_menu_item_loop( $query ) { + if ( ! $this->is_menu_item_query( $query ) ) { + return; + } + + remove_action( 'the_post', array( $this, 'menu_item_loop_each_post' ) ); + remove_action( 'loop_start', array( $this, 'start_menu_item_loop' ) ); + remove_action( 'loop_end', array( $this, 'stop_menu_item_loop' ) ); + + $this->menu_item_loop_close_element( 'menu' ); // End the last menu section + } + + /** + * Outputs the Menu Group Header + * + * @return void + */ + public function menu_item_loop_header() { + $this->menu_item_loop_open_element( 'menu_header' ); + $this->menu_item_loop_open_element( 'menu_title' ); + echo esc_html( $this->menu_item_loop_current_term->name ); // @todo tax filter + $this->menu_item_loop_close_element( 'menu_title' ); + if ( $this->menu_item_loop_current_term->description ) : + $this->menu_item_loop_open_element( 'menu_description' ); + echo esc_html( $this->menu_item_loop_current_term->description ); // @todo kses, tax filter + $this->menu_item_loop_close_element( 'menu_description' ); + endif; + $this->menu_item_loop_close_element( 'menu_header' ); + } + + /** + * Outputs a Menu Item Markup element opening tag + * + * @param string $field - Menu Item Markup settings field. + * + * @return void + */ + public function menu_item_loop_open_element( $field ) { + $markup = $this->get_menu_item_loop_markup(); + /** + * Filter a menu item's element opening tag. + * + * @module custom-content-types + * + * @since 4.4.0 + * + * @param string $tag Menu item's element opening tag. + * @param string $field Menu Item Markup settings field. + * @param array $markup Array of markup elements for the menu item. + * @param false|object $term Taxonomy term for current menu item. + */ + echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- it's escaped in menu_item_loop_class. + 'jetpack_nova_menu_item_loop_open_element', + '<' . tag_escape( $markup[ "{$field}_tag" ] ) . $this->menu_item_loop_class( $markup[ "{$field}_class" ] ) . ">\n", + $field, + $markup, + $this->menu_item_loop_current_term + ); + } + + /** + * Outputs a Menu Item Markup element closing tag + * + * @param string $field - Menu Item Markup settings field. + * + * @return void + */ + public function menu_item_loop_close_element( $field ) { + $markup = $this->get_menu_item_loop_markup(); + /** + * Filter a menu item's element closing tag. + * + * @module custom-content-types + * + * @since 4.4.0 + * + * @param string $tag Menu item's element closing tag. + * @param string $field Menu Item Markup settings field. + * @param array $markup Array of markup elements for the menu item. + * @param false|object $term Taxonomy term for current menu item. + */ + echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- tag_escape is used. + 'jetpack_nova_menu_item_loop_close_element', + '\n", + $field, + $markup, + $this->menu_item_loop_current_term + ); + } + + /** + * Returns a Menu Item Markup element's class attribute. + * + * @param string $class Class name. + * + * @return string HTML class attribute with leading whitespace. + */ + public function menu_item_loop_class( $class ) { + if ( ! $class ) { + return ''; + } + + /** + * Filter a menu Item Markup element's class attribute. + * + * @module custom-content-types + * + * @since 4.4.0 + * + * @param string $tag Menu Item Markup element's class attribute. + * @param string $class Menu Item Class name. + * @param false|object $term Taxonomy term for current menu item. + */ + return apply_filters( + 'jetpack_nova_menu_item_loop_class', + ' class="' . esc_attr( $class ) . '"', + $class, + $this->menu_item_loop_current_term + ); + } + } + +} diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/edit-items.css b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/edit-items.css new file mode 100644 index 00000000..85fbbe96 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/edit-items.css @@ -0,0 +1,24 @@ +.widefat .menu-label-row td { + border-bottom-width: 1px; +} +.widefat .menu-label-row td h3 { + padding-left: 30px; +} +.widefat .menu-order-value { + width: 2.5em; + text-align: center; +} +.widefat .menu-label-row, .widefat .menu-label-row td { + background-color: #d6d6d6; + color: #111; + border: 0 none; +} +.ui-sortable .type-nova_menu_item { + cursor: move; +} +.tablenav .button-reorder { + margin-top: 4px; +} +.tablenav .view-switch a, .tablenav div.tablenav-pages { + display: none; +} \ No newline at end of file diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/many-items.css b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/many-items.css new file mode 100644 index 00000000..c9932430 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/many-items.css @@ -0,0 +1,14 @@ +.many-items-table th, .many-items-table td { + width: 25%; +} + +.many-items-table input, .many-items-table textarea { + width: 100%; +} + +.many-items-table input[type=file] { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova-font.css b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova-font.css new file mode 100644 index 00000000..ac1b9067 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova-font.css @@ -0,0 +1,30 @@ +@font-face { + font-family: 'nova-font'; + src: url('../fonts/nova.eot'); +} +@font-face { + font-family: 'nova-font'; + src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg5lAuAAAAC8AAAAYGNtYXDL9xqaAAABHAAAADxnYXNwAAAAEAAAAVgAAAAIZ2x5Zrlfj0YAAAFgAAABrGhlYWQAW+atAAADDAAAADZoaGVhB2ED4AAAA0QAAAAkaG10eAXcAGQAAANoAAAADGxvY2EACgDWAAADdAAAAAhtYXhwAAgAkQAAA3wAAAAgbmFtZXvEneAAAAOcAAABHnBvc3QAAwAAAAAEvAAAACAAAwPoAZAABQAAAooCvAAAAIwCigK8AAAB4AAxAQIAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAACDmAwOp/8L/wgOpAD4AAAAAAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEACgAAAAGAAQAAQACACDmA///AAAAIOYD////4Rn/AAEAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAQAZAAyA7YDhAAoAEUAfQCOAAABMhY6ATMyPgI/ASMHJz8BDwEnNycHDgMHFgYWBhcHMgYWIjMXNwUHDgMHHgMXHgMzMj4CPwEnKgMjFyc3Ni4CJy4DIyIOAgcOAxceAxceAz8BAR4DMzI+Ajc+Ayc2LgIvAQEmPgI3PgEeARceAxcnApQCBAQEAg4XFxQKtzGXH2oaM3UhlwHUCg0KBAEBAQIBAhQBAQEBAXIN/t3oCwwLAwEBAwsMCwgVFhkMDhgXEwuxcgICAwEC94wFBQMUIRkRLS0xFQsVFxULCQ8GAgQDDxMaDxUuNDIaDgEwBhAQFQkMExIQCAcMBgUBAQUGDAfm/i8CAwIHAhApLy0VCRMMCwLrAfUBBAoNCtWWIHYyGWsglDS5CRQWGQ0CBAQEAw8BAWkOKsIJFBYZDQ0YFxQJCg0KBAQKDQrWngp+DxczNTUXEx4VDAMHDAoKGh4iExMnJSMPFB4SBQQD/l8HCgYEBAcLCAcQEhQKCxMSEAjPAV8BBgcHBA4KCRgTCxgWFQlaAAAAAAEAAAABAAAD2anvXw889QALA+gAAAAAzsPRIgAAAADOw9EiAAAAAAO2A4QAAAAIAAIAAAAAAAAAAQAAA6n/wgAAA+gAAAAyA7YAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAfQAAAPoAGQAAAAAAAoA1gABAAAAAwCPAAQAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEACAAAAAEAAAAAAAIADgAyAAEAAAAAAAMACAAeAAEAAAAAAAQACABAAAEAAAAAAAUAFgAIAAEAAAAAAAYABAAmAAEAAAAAAAoAKABIAAMAAQQJAAEACAAAAAMAAQQJAAIADgAyAAMAAQQJAAMACAAeAAMAAQQJAAQACABAAAMAAQQJAAUAFgAIAAMAAQQJAAYACAAqAAMAAQQJAAoAKABIAG4AbwB2AGEAVgBlAHIAcwBpAG8AbgAgADAALgAwAG4AbwB2AGFub3ZhAG4AbwB2AGEAUgBlAGcAdQBsAGEAcgBuAG8AdgBhAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('truetype'), + url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUoAAsAAAAABNwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDmUC4GNtYXAAAAFoAAAAPAAAADzL9xqaZ2FzcAAAAaQAAAAIAAAACAAAABBnbHlmAAABrAAAAawAAAGsuV+PRmhlYWQAAANYAAAANgAAADYAW+ataGhlYQAAA5AAAAAkAAAAJAdhA+BobXR4AAADtAAAAAwAAAAMBdwAZGxvY2EAAAPAAAAACAAAAAgACgDWbWF4cAAAA8gAAAAgAAAAIAAIAJFuYW1lAAAD6AAAAR4AAAEee8Sd4HBvc3QAAAUIAAAAIAAAACAAAwAAAAMD6AGQAAUAAAKKArwAAACMAooCvAAAAeAAMQECAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg5gMDqf/C/8IDqQA+AAAAAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAMAAAAUAAMAAQAAABQABAAoAAAABgAEAAEAAgAg5gP//wAAACDmA////+EZ/wABAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAAEAGQAMgO2A4QAKABFAH0AjgAAATIWOgEzMj4CPwEjByc/AQ8BJzcnBw4DBxYGFgYXBzIGFiIzFzcFBw4DBx4DFx4DMzI+Aj8BJyoDIxcnNzYuAicuAyMiDgIHDgMXHgMXHgM/AQEeAzMyPgI3PgMnNi4CLwEBJj4CNz4BHgEXHgMXJwKUAgQEBAIOFxcUCrcxlx9qGjN1IZcB1AoNCgQBAQECAQIUAQEBAQFyDf7d6AsMCwMBAQMLDAsIFRYZDA4YFxMLsXICAgMBAveMBQUDFCEZES0tMRULFRcVCwkPBgIEAw8TGg8VLjQyGg4BMAYQEBUJDBMSEAgHDAYFAQEFBgwH5v4vAgMCBwIQKS8tFQkTDAsC6wH1AQQKDQrVliB2MhlrIJQ0uQkUFhkNAgQEBAMPAQFpDirCCRQWGQ0NGBcUCQoNCgQECg0K1p4Kfg8XMzU1FxMeFQwDBwwKChoeIhMTJyUjDxQeEgUEA/5fBwoGBAQHCwgHEBIUCgsTEhAIzwFfAQYHBwQOCgkYEwsYFhUJWgAAAAABAAAAAQAAA9mp718PPPUACwPoAAAAAM7D0SIAAAAAzsPRIgAAAAADtgOEAAAACAACAAAAAAAAAAEAAAOp/8IAAAPoAAAAMgO2AAEAAAAAAAAAAAAAAAAAAAADAAAAAAH0AAAD6ABkAAAAAAAKANYAAQAAAAMAjwAEAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAgAAAABAAAAAAACAA4AMgABAAAAAAADAAgAHgABAAAAAAAEAAgAQAABAAAAAAAFABYACAABAAAAAAAGAAQAJgABAAAAAAAKACgASAADAAEECQABAAgAAAADAAEECQACAA4AMgADAAEECQADAAgAHgADAAEECQAEAAgAQAADAAEECQAFABYACAADAAEECQAGAAgAKgADAAEECQAKACgASABuAG8AdgBhAFYAZQByAHMAaQBvAG4AIAAwAC4AMABuAG8AdgBhbm92YQBuAG8AdgBhAFIAZQBnAHUAbABhAHIAbgBvAHYAYQBHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4AAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format('woff'); + font-weight: normal; + font-style: normal; +} + +#menu-posts-nova_menu_item:before, +#dashboard_right_now .nova-menu-count a:before, +#dashboard_right_now .nova-menu-count span:before { + font-family: 'nova-font'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +#dashboard_right_now .nova-menu-count a:before, #dashboard_right_now .nova-menu-count span:before { + content: '\e603'; +} \ No newline at end of file diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova.css b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova.css new file mode 100644 index 00000000..616433a3 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/css/nova.css @@ -0,0 +1,110 @@ +/* edit-items.css +-------------------------------------------------------------- */ + +.widefat .menu-label-row td { + border-bottom-width: 1px; +} +.widefat .menu-label-row td h3 { + padding-left: 30px; +} +.widefat .menu-label-row td h3 .edit-nova-section { + font-size: .8em; + font-weight: normal; + margin-left: 5px; +} +.widefat .menu-order-value { + width: 2.5em; + text-align: center; +} +.widefat .menu-label-row, .widefat .menu-label-row td { + background-color: #f0f0f1; + color: #111; + border: 0 none; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05); +} +.ui-sortable .type-nova_menu_item { + cursor: move; + background-color: #fff; +} +.ui-sortable .type-nova_menu_item:nth-child(even) { + background-color: #f6f7f7; +} +.ui-sortable .type-nova_menu_item.ui-sortable-helper { + -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); +} +.tablenav .button-reorder { + margin-top: 4px; +} +.tablenav .view-switch a, .tablenav div.tablenav-pages { + display: none; +} + + +/* many-items.css +-------------------------------------------------------------- */ + +.many-items-table th, .many-items-table td { + width: 30%; +} + +.many-items-table th.nova-price, .many-items-table td.nova-price { + width: 10%; +} + +.many-items-table input, .many-items-table textarea { + width: 100%; +} + +.many-items-table input[type=file] { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} + + +/* new +-------------------------------------------------------------- */ + +#the-list tr td:nth-of-type(2) { + padding-top: 15px; +} + +.nova-move-menu-up:before, +.nova-move-menu-down:before { + margin-right: 5px; + font: normal 10px/1 'dashicons' !important; + speak: none; +} + +.nova-move-menu-up:before { + content: "\f342"; +} + +.nova-move-menu-down:before { + content: "\f346"; +} + +.dashicon:before { + font: normal 20px/1 'dashicons'; + speak: none; + top: 5px; + display: inline-block; + position: relative; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-decoration: none !important; + vertical-align: top; +} + +.dashicon-plus:before { + content: "\f132"; +} + +.dashicon-edit:before { + margin: 2px 5px 0 10px; + content: "\f327"; + font-size: 10px; +} diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/many-items.js b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/many-items.js new file mode 100644 index 00000000..3cbc1746 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/many-items.js @@ -0,0 +1,139 @@ +( function () { + let menuSelector, nonceInput; + const initializedTables = new Set(); + + const methods = { + init: function ( table ) { + let tbody = table.lastElementChild; + while ( tbody && tbody.tagName !== 'TBODY' ) { + tbody = tbody.previousElementSibling; + } + const row = tbody.querySelector( 'tr:first-child' ).cloneNode( true ); + + table.dataset.form = table.closest( 'form' ); + table.dataset.tbody = tbody; + table.dataset.row = row; + table.dataset.currentRow = row; + + menuSelector = document.getElementById( 'nova-menu-tax' ); + nonceInput = document.getElementById( '_wpnonce' ); + + table.addEventListener( 'keypress', function ( event ) { + if ( event.which !== 13 ) return; + + event.preventDefault(); + if ( typeof FormData === 'function' ) { + methods.submitRow.call( table ); + } + methods.addRow.call( table ); + } ); + + table.addEventListener( 'focusin', function ( event ) { + if ( event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA' ) { + table.dataset.currentRow = event.target.closest( 'tr' ); + } + } ); + + initializedTables.add( table ); + return table; + }, + + destroy: function ( table ) { + table.removeEventListener( 'keypress', methods.keypressHandler ); + table.removeEventListener( 'focusin', methods.focusinHandler ); + initializedTables.delete( table ); + return table; + }, + + submitRow: function ( table ) { + const submittedRow = table.dataset.currentRow; + const currentInputs = submittedRow.querySelectorAll( 'input, textarea, select' ); + const form = document.querySelector( table.dataset.form ); + const allInputs = Array.from( form.querySelectorAll( 'input, textarea, select' ) ); + + currentInputs.forEach( input => ( input.disabled = true ) ); + allInputs + .filter( input => ! currentInputs.includes( input ) ) + .forEach( input => ( input.disabled = true ) ); + + const partialFormData = new FormData( form ); + partialFormData.append( 'ajax', '1' ); + partialFormData.append( 'nova_menu_tax', menuSelector.value ); + partialFormData.append( '_wpnonce', nonceInput.value ); + + fetch( '', { + method: 'POST', + body: partialFormData, + } ) + .then( response => response.text() ) + .then( responseText => { + submittedRow.innerHTML = responseText; + } ); + + allInputs.forEach( input => ( input.disabled = false ) ); + + return table; + }, + + addRow: function ( table ) { + const row = table.dataset.row.cloneNode( true ); + + const tbody = table.dataset.tbody; + tbody.appendChild( row ); + + const firstInput = row.querySelector( 'input, textarea, select' ); + if ( firstInput ) firstInput.focus(); + + return table; + }, + + clickAddRow: function ( table ) { + let tbody = table.lastElementChild; + + while ( tbody && tbody.tagName !== 'TBODY' ) { + tbody = tbody.previousElementSibling; + } + const row = tbody.querySelector( 'tr:first-child' ).cloneNode( true ); + + row.querySelectorAll( 'input, textarea' ).forEach( input => { + input.value = ''; + } ); + + tbody.appendChild( row ); + }, + }; + + const observeTableRemoval = function () { + const observer = new MutationObserver( mutations => { + mutations.forEach( mutation => { + mutation.removedNodes.forEach( node => { + if ( node.matches && node.matches( '.many-items-table' ) ) { + methods.destroy( node ); + } + } ); + } ); + } ); + + observer.observe( document.body, { childList: true, subtree: true } ); + }; + + // Initialization for many-items-table + document.addEventListener( 'focusin', event => { + const table = event.target.closest( '.many-items-table' ); + if ( table && ! initializedTables.has( table ) ) { + methods.init( table ); + } + } ); + + document.addEventListener( 'click', event => { + if ( event.target.matches( 'a.nova-new-row' ) ) { + const table = event.target.closest( '.many-items-table' ); + if ( table ) { + event.preventDefault(); + methods.clickAddRow( table ); + } + } + } ); + + observeTableRemoval(); +} )(); diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/menu-checkboxes.js b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/menu-checkboxes.js new file mode 100644 index 00000000..ed3418d7 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/menu-checkboxes.js @@ -0,0 +1,75 @@ +( function () { + const NovaCheckBoxes = { + inputs: null, + popInputs: null, + + initialize: function () { + // Get all checkboxes in the "nova_menuchecklist-pop" + NovaCheckBoxes.popInputs = document.querySelectorAll( + '#nova_menuchecklist-pop input[type="checkbox"]' + ); + + // Get all checkboxes in the "nova_menuchecklist" and add event listeners + NovaCheckBoxes.inputs = document.querySelectorAll( + '#nova_menuchecklist input[type="checkbox"]' + ); + NovaCheckBoxes.inputs.forEach( input => { + input.addEventListener( 'change', NovaCheckBoxes.checkOne ); + input.addEventListener( 'change', NovaCheckBoxes.syncPop ); + } ); + + // If no checkboxes are checked, check the first one + if ( ! NovaCheckBoxes.isChecked() ) { + NovaCheckBoxes.checkFirst(); + } + + // Sync the state of the "pop" inputs + NovaCheckBoxes.syncPop(); + }, + + syncPop: function () { + NovaCheckBoxes.popInputs.forEach( popInput => { + const linkedInput = document.querySelector( `#in-nova_menu-${ popInput.value }` ); + popInput.checked = linkedInput ? linkedInput.checked : false; + } ); + }, + + isChecked: function () { + return Array.from( NovaCheckBoxes.inputs ).some( input => input.checked ); + }, + + checkFirst: function () { + const firstInput = NovaCheckBoxes.inputs[ 0 ]; + if ( firstInput ) { + firstInput.checked = true; + } + }, + + checkOne: function () { + const currentInput = this; + + // If the current checkbox is checked, uncheck all other checkboxes + if ( currentInput.checked ) { + NovaCheckBoxes.inputs.forEach( input => { + if ( input !== currentInput ) { + input.checked = false; + } + } ); + return; + } + const checklist = document.querySelector( '#nova_menuchecklist' ); + + // If at least one checkbox is still checked, uncheck the current one + if ( checklist.querySelectorAll( 'input[type="checkbox"]:checked' ).length > 0 ) { + currentInput.checked = false; + return; + } + + // Otherwise, check the first checkbox + NovaCheckBoxes.checkFirst(); + }, + }; + + // Initialize when the DOM is fully loaded + document.addEventListener( 'DOMContentLoaded', NovaCheckBoxes.initialize ); +} )(); diff --git a/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/nova-drag-drop.js b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/nova-drag-drop.js new file mode 100644 index 00000000..8629bbe0 --- /dev/null +++ b/vendor/automattic/jetpack-classic-theme-helper/src/custom-post-types/js/nova-drag-drop.js @@ -0,0 +1,85 @@ +/* eslint-disable no-undef */ +/* global _novaDragDrop */ + +( function ( $ ) { + let list; + + /** + * Initialize the drag and drop functionality. + */ + function init() { + list = $( '#the-list' ); + dragMenus(); + addNonce(); + addSubmitButton(); + changeToPost(); + } + + /** + * Allow the menu items to be dragged. + */ + function dragMenus() { + list.sortable( { + cancel: '.no-items, .inline-edit-row', + stop: function ( event, ui ) { + if ( ui.item.is( ':first-child' ) ) { + return list.sortable( 'cancel' ); + } + // + reOrder(); + }, + } ); + } + + /** + * Allow the menu items to be reordered. + */ + function reOrder() { + list.find( '.menu-label-row' ).each( function () { + const term_id = $( this ).data( 'term_id' ); + $( this ) + .nextUntil( '.menu-label-row' ) + .each( function ( i ) { + const row = $( this ); + row.find( '.menu-order-value' ).val( i ); + row.find( '.nova-menu-term' ).val( term_id ); + } ); + } ); + } + + /** + * Ensure the submit button is added to the page. + */ + function addSubmitButton() { + $( '.tablenav' ).prepend( + '' + ); + } + + /** + * Add the nonce to the form. + */ + function addNonce() { + $( '#posts-filter' ).append( + '' + ); + } + + /** + * Change the form method to POST. + */ + function changeToPost() { + $( '#posts-filter' ).attr( 'method', 'post' ); + } + + // do it + $( document ).ready( init ); +} )( jQuery ); diff --git a/vendor/automattic/jetpack-mu-wpcom/composer.json b/vendor/automattic/jetpack-mu-wpcom/composer.json index 5f97c297..24daa402 100644 --- a/vendor/automattic/jetpack-mu-wpcom/composer.json +++ b/vendor/automattic/jetpack-mu-wpcom/composer.json @@ -8,7 +8,7 @@ "automattic/jetpack-assets": "^4.0.2", "automattic/jetpack-blocks": "^3.0.1", "automattic/jetpack-calypsoify": "^0.2.1-alpha", - "automattic/jetpack-classic-theme-helper": "^0.8.0", + "automattic/jetpack-classic-theme-helper": "^0.8.1-alpha", "automattic/jetpack-connection": "^6.2.1", "automattic/jetpack-masterbar": "^0.10.4-alpha", "automattic/jetpack-redirect": "^3.0.1", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index ffa2c0e1..1f56e163 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -40,6 +40,7 @@ 'Automattic\\Jetpack\\Classic_Theme_Helper\\Jetpack_Testimonial_Textarea_Control' => $vendorDir . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-textarea-control.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Jetpack_Testimonial_Title_Control' => $vendorDir . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-title-control.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Main' => $vendorDir . '/automattic/jetpack-classic-theme-helper/src/class-main.php', + 'Automattic\\Jetpack\\Classic_Theme_Helper\\Nova_Restaurant' => $vendorDir . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links' => $vendorDir . '/automattic/jetpack-classic-theme-helper/src/class-social-links.php', 'Automattic\\Jetpack\\Connection\\Authorize_Json_Api' => $vendorDir . '/automattic/jetpack-connection/src/class-authorize-json-api.php', 'Automattic\\Jetpack\\Connection\\Client' => $vendorDir . '/automattic/jetpack-connection/src/class-client.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3e6347fa..6fb7c5b4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -60,6 +60,7 @@ class ComposerStaticInitd9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_plugin 'Automattic\\Jetpack\\Classic_Theme_Helper\\Jetpack_Testimonial_Textarea_Control' => __DIR__ . '/..' . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-textarea-control.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Jetpack_Testimonial_Title_Control' => __DIR__ . '/..' . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-jetpack-testimonial-title-control.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Main' => __DIR__ . '/..' . '/automattic/jetpack-classic-theme-helper/src/class-main.php', + 'Automattic\\Jetpack\\Classic_Theme_Helper\\Nova_Restaurant' => __DIR__ . '/..' . '/automattic/jetpack-classic-theme-helper/src/custom-post-types/class-nova-restaurant.php', 'Automattic\\Jetpack\\Classic_Theme_Helper\\Social_Links' => __DIR__ . '/..' . '/automattic/jetpack-classic-theme-helper/src/class-social-links.php', 'Automattic\\Jetpack\\Connection\\Authorize_Json_Api' => __DIR__ . '/..' . '/automattic/jetpack-connection/src/class-authorize-json-api.php', 'Automattic\\Jetpack\\Connection\\Client' => __DIR__ . '/..' . '/automattic/jetpack-connection/src/class-client.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 9c9869cb..acaf5555 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -7,7 +7,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats", - "reference": "0b9b3c42583a2cd7c8b24f156b3ec893161cf2a1" + "reference": "d2909f3daba553dde0d4b5b8b7585d81028f56d2" }, "require": { "php": ">=7.2" @@ -63,7 +63,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui", - "reference": "e662b3f394bad813c154e1a53ff54fb5189766a9" + "reference": "99679b05ab1a16f3c83a37795d9494fa047e325f" }, "require": { "php": ">=7.2" @@ -131,7 +131,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-assets", - "reference": "8414b83d2174e979a7fb61083b54b4a9c35614f8" + "reference": "390f36b06cee6b95f8568e2eb73eb57c63156c55" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -203,7 +203,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-blaze", - "reference": "fb09c56085f6c71351ff8d6faf7a21ad33952bde" + "reference": "d5c31b8b249d3c10d31983929046bc1c84faf1e8" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -287,7 +287,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-blocks", - "reference": "26d31d604b8d602588a13d8d7a18e7b7648ddded" + "reference": "0f55ae9072e5df3a8ac8e58428efd3aaeba01291" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -352,7 +352,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-calypsoify", - "reference": "2300551ab505e546466bee02768982b1f284193f" + "reference": "574ac9e072ca569fd69610db848b64fc4604bf85" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -415,12 +415,12 @@ }, { "name": "automattic/jetpack-classic-theme-helper", - "version": "0.8.0", - "version_normalized": "0.8.0.0", + "version": "0.8.1-alpha.1734626295", + "version_normalized": "0.8.1.0-alpha1734626295", "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-classic-theme-helper", - "reference": "c6ebc2de60f88e064c63899a3aa4f893e8164ae2" + "reference": "4e219c56d8b3024282905a9017fc3e1fa6efa552" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -494,7 +494,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-compat", - "reference": "d384e89dfd86e344721270a79690dc24873bb095" + "reference": "86836128ca9ce40c20dc9d58f38197fc5a0eb47c" }, "require": { "php": ">=7.2" @@ -534,7 +534,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-connection", - "reference": "6437cb6a923b4419da21c34f5c74d4108841cf44" + "reference": "1aeb629fef96dd9659780d9627049bcdabab3fb1" }, "require": { "automattic/jetpack-a8c-mc-stats": "^3.0.0", @@ -627,7 +627,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-constants", - "reference": "5284a93904f7c6981a9922ec2eb4fb86813328fe" + "reference": "2f1de35dfc66f7525be1485939bfb35ca9050fa7" }, "require": { "php": ">=7.2" @@ -684,7 +684,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-device-detection", - "reference": "496e4baacb796453a9ea55789ac9136042ed4d85" + "reference": "bf38046bfb96c11759e044b490b6a4608a3bf954" }, "require": { "php": ">=7.2" @@ -740,7 +740,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-google-analytics", - "reference": "70c2bfc86de3828956337753b38b46a524ef36e1" + "reference": "14a1bf14da70f071e003471024bc26466082c22f" }, "require": { "automattic/jetpack-status": "^5.0.1", @@ -814,7 +814,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-ip", - "reference": "01567f688a4edb6944d01766dc3987b53d44d156" + "reference": "58b9a9ea5b082ba9a484fd7dcbc37a844d6fb287" }, "require": { "php": ">=7.2" @@ -875,7 +875,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-jitm", - "reference": "7cc90e3cd62aecc49b54c724ad1b128ee055d705" + "reference": "71426c47965160a326d8436dfc677bb3b0e0ec8b" }, "require": { "automattic/jetpack-a8c-mc-stats": "^3.0.0", @@ -953,7 +953,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-logo", - "reference": "863e3a405a0dbc6876ce0dceffcdd8308fa34ece" + "reference": "2fda435a5366aeb05740591d5c40c52e37e90d88" }, "require": { "php": ">=7.2" @@ -1009,7 +1009,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-masterbar", - "reference": "ab5d045e25f1c6f4c6e73e2e3654f0f75c151a06" + "reference": "a7cda6b8b34640973791ad06f870e770abf727c4" }, "require": { "automattic/jetpack-assets": "^4.0.2", @@ -1100,13 +1100,13 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-mu-wpcom", - "reference": "b5730e674bb42e204aec71b3317d7ddda4195593" + "reference": "03ee081e943ddf96c6dd25659f3fa2fb90f80071" }, "require": { "automattic/jetpack-assets": "^4.0.2", "automattic/jetpack-blocks": "^3.0.1", "automattic/jetpack-calypsoify": "^0.2.1-alpha", - "automattic/jetpack-classic-theme-helper": "^0.8.0", + "automattic/jetpack-classic-theme-helper": "^0.8.1-alpha", "automattic/jetpack-compat": "^4.0.0", "automattic/jetpack-connection": "^6.2.1", "automattic/jetpack-google-analytics": "^0.3.0", @@ -1186,7 +1186,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-password-checker", - "reference": "b148b62886428a846109d3714796bfe579359d87" + "reference": "f749df078237bcc4fbf89aa118a87e7d2b813b94" }, "require": { "php": ">=7.2" @@ -1250,7 +1250,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-plans", - "reference": "b5cb3b02dbe8333093402873cb29b4308940f3be" + "reference": "a3818015a1d5719adc29c9fd1219dfea608819be" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1321,7 +1321,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-redirect", - "reference": "7d9bb8e53d6eb1b8f58986769cac411cbf11d12f" + "reference": "210a9dc7bf9c3baa75dd65ba714fbd9ed4e7f051" }, "require": { "automattic/jetpack-status": "^5.0.1", @@ -1379,7 +1379,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-roles", - "reference": "3af06cbbf6bf12afd54c10df2a1805c7abc630be" + "reference": "51c2663ae8582fb8af91855e4488890ba9574b37" }, "require": { "php": ">=7.2" @@ -1436,7 +1436,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-stats", - "reference": "7e11f03b8c350d3c0146e2e3f1edb781c37afba6" + "reference": "d261415972cce2fbbdc741029e08a4c0dfc7edae" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1506,7 +1506,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-stats-admin", - "reference": "2e0efc019bc26ff18c1d3d71e69606f90c92692b" + "reference": "83d1d26051ea7bd16de12cfa628e2d1a9bc37288" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1582,7 +1582,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-status", - "reference": "786d0322a5172d8af377060c1afa663b42bca26d" + "reference": "689b9632e14bbda943993d14adb651d28ff5e7ad" }, "require": { "automattic/jetpack-constants": "^3.0.1", @@ -1649,7 +1649,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/jetpack-sync", - "reference": "45c6d6c0ae6ee84bbfdabf1ae68bea3de6e9015b" + "reference": "d5cd6a18da93efbcca66189790dfed58d770e6a6" }, "require": { "automattic/jetpack-connection": "^6.2.1", @@ -1730,7 +1730,7 @@ "dist": { "type": "path", "url": "/tmp/jetpack-build/Automattic/scheduled-updates", - "reference": "34558e11ba46fcca7e0afb05cd7a221817885b99" + "reference": "e72b39aae24612019af21d6ea7b5637d9d0d7e23" }, "require": { "automattic/jetpack-connection": "^6.2.1", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 1c1e4b58..961ab85d 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -13,7 +13,7 @@ 'automattic/jetpack-a8c-mc-stats' => array( 'pretty_version' => '3.0.0', 'version' => '3.0.0.0', - 'reference' => '0b9b3c42583a2cd7c8b24f156b3ec893161cf2a1', + 'reference' => 'd2909f3daba553dde0d4b5b8b7585d81028f56d2', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-a8c-mc-stats', 'aliases' => array(), @@ -22,7 +22,7 @@ 'automattic/jetpack-admin-ui' => array( 'pretty_version' => '0.5.1', 'version' => '0.5.1.0', - 'reference' => 'e662b3f394bad813c154e1a53ff54fb5189766a9', + 'reference' => '99679b05ab1a16f3c83a37795d9494fa047e325f', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-admin-ui', 'aliases' => array(), @@ -31,7 +31,7 @@ 'automattic/jetpack-assets' => array( 'pretty_version' => '4.0.2', 'version' => '4.0.2.0', - 'reference' => '8414b83d2174e979a7fb61083b54b4a9c35614f8', + 'reference' => '390f36b06cee6b95f8568e2eb73eb57c63156c55', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-assets', 'aliases' => array(), @@ -40,7 +40,7 @@ 'automattic/jetpack-blaze' => array( 'pretty_version' => '0.25.4', 'version' => '0.25.4.0', - 'reference' => 'fb09c56085f6c71351ff8d6faf7a21ad33952bde', + 'reference' => 'd5c31b8b249d3c10d31983929046bc1c84faf1e8', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-blaze', 'aliases' => array(), @@ -49,7 +49,7 @@ 'automattic/jetpack-blocks' => array( 'pretty_version' => '3.0.1', 'version' => '3.0.1.0', - 'reference' => '26d31d604b8d602588a13d8d7a18e7b7648ddded', + 'reference' => '0f55ae9072e5df3a8ac8e58428efd3aaeba01291', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-blocks', 'aliases' => array(), @@ -58,16 +58,16 @@ 'automattic/jetpack-calypsoify' => array( 'pretty_version' => '0.2.1-alpha.1733980392', 'version' => '0.2.1.0-alpha1733980392', - 'reference' => '2300551ab505e546466bee02768982b1f284193f', + 'reference' => '574ac9e072ca569fd69610db848b64fc4604bf85', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-calypsoify', 'aliases' => array(), 'dev_requirement' => false, ), 'automattic/jetpack-classic-theme-helper' => array( - 'pretty_version' => '0.8.0', - 'version' => '0.8.0.0', - 'reference' => 'c6ebc2de60f88e064c63899a3aa4f893e8164ae2', + 'pretty_version' => '0.8.1-alpha.1734626295', + 'version' => '0.8.1.0-alpha1734626295', + 'reference' => '4e219c56d8b3024282905a9017fc3e1fa6efa552', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-classic-theme-helper', 'aliases' => array(), @@ -76,7 +76,7 @@ 'automattic/jetpack-compat' => array( 'pretty_version' => '4.0.0', 'version' => '4.0.0.0', - 'reference' => 'd384e89dfd86e344721270a79690dc24873bb095', + 'reference' => '86836128ca9ce40c20dc9d58f38197fc5a0eb47c', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-compat', 'aliases' => array(), @@ -85,7 +85,7 @@ 'automattic/jetpack-connection' => array( 'pretty_version' => '6.2.1', 'version' => '6.2.1.0', - 'reference' => '6437cb6a923b4419da21c34f5c74d4108841cf44', + 'reference' => '1aeb629fef96dd9659780d9627049bcdabab3fb1', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-connection', 'aliases' => array(), @@ -94,7 +94,7 @@ 'automattic/jetpack-constants' => array( 'pretty_version' => '3.0.1', 'version' => '3.0.1.0', - 'reference' => '5284a93904f7c6981a9922ec2eb4fb86813328fe', + 'reference' => '2f1de35dfc66f7525be1485939bfb35ca9050fa7', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-constants', 'aliases' => array(), @@ -103,7 +103,7 @@ 'automattic/jetpack-device-detection' => array( 'pretty_version' => '3.0.0', 'version' => '3.0.0.0', - 'reference' => '496e4baacb796453a9ea55789ac9136042ed4d85', + 'reference' => 'bf38046bfb96c11759e044b490b6a4608a3bf954', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-device-detection', 'aliases' => array(), @@ -112,7 +112,7 @@ 'automattic/jetpack-google-analytics' => array( 'pretty_version' => '0.3.0', 'version' => '0.3.0.0', - 'reference' => '70c2bfc86de3828956337753b38b46a524ef36e1', + 'reference' => '14a1bf14da70f071e003471024bc26466082c22f', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-google-analytics', 'aliases' => array(), @@ -121,7 +121,7 @@ 'automattic/jetpack-ip' => array( 'pretty_version' => '0.4.1', 'version' => '0.4.1.0', - 'reference' => '01567f688a4edb6944d01766dc3987b53d44d156', + 'reference' => '58b9a9ea5b082ba9a484fd7dcbc37a844d6fb287', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-ip', 'aliases' => array(), @@ -130,7 +130,7 @@ 'automattic/jetpack-jitm' => array( 'pretty_version' => '4.0.3', 'version' => '4.0.3.0', - 'reference' => '7cc90e3cd62aecc49b54c724ad1b128ee055d705', + 'reference' => '71426c47965160a326d8436dfc677bb3b0e0ec8b', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-jitm', 'aliases' => array(), @@ -139,7 +139,7 @@ 'automattic/jetpack-logo' => array( 'pretty_version' => '3.0.0', 'version' => '3.0.0.0', - 'reference' => '863e3a405a0dbc6876ce0dceffcdd8308fa34ece', + 'reference' => '2fda435a5366aeb05740591d5c40c52e37e90d88', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-logo', 'aliases' => array(), @@ -148,7 +148,7 @@ 'automattic/jetpack-masterbar' => array( 'pretty_version' => '0.10.4-alpha.1734614753', 'version' => '0.10.4.0-alpha1734614753', - 'reference' => 'ab5d045e25f1c6f4c6e73e2e3654f0f75c151a06', + 'reference' => 'a7cda6b8b34640973791ad06f870e770abf727c4', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-masterbar', 'aliases' => array(), @@ -157,7 +157,7 @@ 'automattic/jetpack-mu-wpcom' => array( 'pretty_version' => '6.1.0-alpha.1734619823', 'version' => '6.1.0.0-alpha1734619823', - 'reference' => 'b5730e674bb42e204aec71b3317d7ddda4195593', + 'reference' => '03ee081e943ddf96c6dd25659f3fa2fb90f80071', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-mu-wpcom', 'aliases' => array(), @@ -175,7 +175,7 @@ 'automattic/jetpack-password-checker' => array( 'pretty_version' => '0.4.1', 'version' => '0.4.1.0', - 'reference' => 'b148b62886428a846109d3714796bfe579359d87', + 'reference' => 'f749df078237bcc4fbf89aa118a87e7d2b813b94', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-password-checker', 'aliases' => array(), @@ -184,7 +184,7 @@ 'automattic/jetpack-plans' => array( 'pretty_version' => '0.5.1', 'version' => '0.5.1.0', - 'reference' => 'b5cb3b02dbe8333093402873cb29b4308940f3be', + 'reference' => 'a3818015a1d5719adc29c9fd1219dfea608819be', 'type' => 'library', 'install_path' => __DIR__ . '/../automattic/jetpack-plans', 'aliases' => array(), @@ -193,7 +193,7 @@ 'automattic/jetpack-redirect' => array( 'pretty_version' => '3.0.1', 'version' => '3.0.1.0', - 'reference' => '7d9bb8e53d6eb1b8f58986769cac411cbf11d12f', + 'reference' => '210a9dc7bf9c3baa75dd65ba714fbd9ed4e7f051', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-redirect', 'aliases' => array(), @@ -202,7 +202,7 @@ 'automattic/jetpack-roles' => array( 'pretty_version' => '3.0.1', 'version' => '3.0.1.0', - 'reference' => '3af06cbbf6bf12afd54c10df2a1805c7abc630be', + 'reference' => '51c2663ae8582fb8af91855e4488890ba9574b37', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-roles', 'aliases' => array(), @@ -211,7 +211,7 @@ 'automattic/jetpack-stats' => array( 'pretty_version' => '0.14.1', 'version' => '0.14.1.0', - 'reference' => '7e11f03b8c350d3c0146e2e3f1edb781c37afba6', + 'reference' => 'd261415972cce2fbbdc741029e08a4c0dfc7edae', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-stats', 'aliases' => array(), @@ -220,7 +220,7 @@ 'automattic/jetpack-stats-admin' => array( 'pretty_version' => '0.23.1', 'version' => '0.23.1.0', - 'reference' => '2e0efc019bc26ff18c1d3d71e69606f90c92692b', + 'reference' => '83d1d26051ea7bd16de12cfa628e2d1a9bc37288', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-stats-admin', 'aliases' => array(), @@ -229,7 +229,7 @@ 'automattic/jetpack-status' => array( 'pretty_version' => '5.0.1', 'version' => '5.0.1.0', - 'reference' => '786d0322a5172d8af377060c1afa663b42bca26d', + 'reference' => '689b9632e14bbda943993d14adb651d28ff5e7ad', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-status', 'aliases' => array(), @@ -238,7 +238,7 @@ 'automattic/jetpack-sync' => array( 'pretty_version' => '4.2.0-alpha.1734427685', 'version' => '4.2.0.0-alpha1734427685', - 'reference' => '45c6d6c0ae6ee84bbfdabf1ae68bea3de6e9015b', + 'reference' => 'd5cd6a18da93efbcca66189790dfed58d770e6a6', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/jetpack-sync', 'aliases' => array(), @@ -247,7 +247,7 @@ 'automattic/scheduled-updates' => array( 'pretty_version' => '0.14.0', 'version' => '0.14.0.0', - 'reference' => '34558e11ba46fcca7e0afb05cd7a221817885b99', + 'reference' => 'e72b39aae24612019af21d6ea7b5637d9d0d7e23', 'type' => 'jetpack-library', 'install_path' => __DIR__ . '/../automattic/scheduled-updates', 'aliases' => array(),