Compare commits

..

34 Commits
0.19 ... master

Author SHA1 Message Date
abuyoyo
00ab82a35d 0.27
Some checks failed
Create Release / Create Release (push) Has been cancelled
2024-09-07 08:05:22 +03:00
abuyoyo
51cfce0071 0.27 - version bump + changelog 2024-09-07 08:04:22 +03:00
abuyoyo
416039449f composer.json - prepend-autoloader: false
Local vendor/autoload should not prepend if required locally.
Give precedence to main composer installation if available.
2024-09-07 00:44:37 +03:00
abuyoyo
e548158c15 0.26
Some checks failed
Create Release / Create Release (push) Has been cancelled
2024-09-01 08:04:08 +03:00
abuyoyo
41a42d3a2a 0.26 - version bump + changelog 2024-09-01 08:03:34 +03:00
abuyoyo
b6aca366b2 Mutation Observer replaces DOMNodeRemoved event 2024-09-01 07:48:58 +03:00
abuyoyo
7cc5b6de5a NoticeManager.bootstrap - refactor + modernize 2024-09-01 07:48:58 +03:00
abuyoyo
ca68f59a28 0.25
Some checks failed
Create Release / Create Release (push) Has been cancelled
2024-02-18 03:43:24 +02:00
abuyoyo
a3040b6c47 0.25 - version bump + changelog 2024-02-18 03:41:05 +02:00
abuyoyo
b99be56795 composer.lock + vendor/
- abuyoyo/metabox 0.8
- abuyoyo/adminmenupage 0.29
2024-02-18 03:34:30 +02:00
abuyoyo
3458b724be composer.json - update abuyoyo/adminmenupage ~0.29 2024-02-18 03:22:21 +02:00
abuyoyo
57fb24aa22 0.24
Some checks failed
Create Release / Create Release (push) Has been cancelled
2023-10-04 03:50:31 +03:00
abuyoyo
42db8f67df 0.24 - version bump + changelog 2023-10-04 02:40:21 +03:00
abuyoyo
1cd273bded composer.lock + vendor/ 2023-10-04 02:40:20 +03:00
abuyoyo
2c166a33a8 composer.json - update dependencies (PluginCore 0.27 supports plugin-update-checker v5|v4) 2023-10-04 02:40:20 +03:00
abuyoyo
1321d35bdf De-prioritize vendor/autoload.php 2023-10-04 02:40:20 +03:00
abuyoyo
7cf7b477bc PluginCore - set update_checker to true.
If Plugin-Update-Checker library (v4|v5) is available - enables updates from repo.
2023-10-04 01:29:04 +03:00
abuyoyo
42e26c9a4f 0.23
Some checks failed
Create Release / Create Release (push) Has been cancelled
2023-09-27 23:56:57 +03:00
abuyoyo
920dd0b683 0.23 - version bump + changelog 2023-09-27 23:21:52 +03:00
abuyoyo
fa4099a6dd composer.lock + vendor update 2023-09-27 23:21:50 +03:00
abuyoyo
2efc23c123 Update Description plugin header 2023-09-27 22:49:43 +03:00
abuyoyo
03473b957c Fix notices-panel removing all screen-meta-links panels when removing self 2023-09-27 22:32:57 +03:00
abuyoyo
ff4a8f542b Filter .hidden notices
Fix 0-count notices panel.
Fix wrong priority color plugin-count bullet on auto-collapsed panel.
2023-09-27 22:31:13 +03:00
abuyoyo
93afbe9b5b Fix plugin-count styling issue
.notice class was adding border to .plugin-count bullet
2023-09-27 22:24:20 +03:00
abuyoyo
bbec303755 0.22
Some checks failed
Create Release / Create Release (push) Has been cancelled
2023-08-11 22:37:46 +03:00
abuyoyo
24d4e54ca8 0.22 - version bump + changelog 2023-08-11 22:33:58 +03:00
abuyoyo
c0ca10a9c0 Fix - do not collect .theme-info notice 2023-08-11 22:33:58 +03:00
abuyoyo
0f13626dab Fix vendor/autoload.php include path 2023-08-11 22:33:56 +03:00
abuyoyo
320496722d 0.21
Some checks failed
Create Release / Create Release (push) Has been cancelled
2023-08-10 03:44:35 +03:00
abuyoyo
a856f85cb8 0.21 - version bump + changelog 2023-08-10 03:40:54 +03:00
abuyoyo
fcee298dab composer.lock + vendor update 2023-08-10 03:40:01 +03:00
abuyoyo
abedf94f24 composer.json - update abuyoyo/screen-meta-links ~0.13 2023-08-10 03:34:31 +03:00
abuyoyo
873b9abdd0 0.20
Some checks failed
Create Release / Create Release (push) Has been cancelled
2023-06-09 22:12:50 +03:00
abuyoyo
20eda54314 0.20 - version bump 2023-06-09 22:11:21 +03:00
37 changed files with 1112 additions and 349 deletions

View File

@ -1,5 +1,69 @@
# Notice Manager Changelog # Notice Manager Changelog
## 0.27
Release date: Sep 7 2024
### Dependencies
- Composer config: `prepend-autoloader: false` - Give precedence to other composer installations if present.
## 0.26
Release date: Sep 1 2024
### Changed
- Use Mutation Observer instead of deprecated `DOMNodeRemoved` event.
### Added
- Add method `NoticeManager.bootstrap()` to initialize Notice manager.
## 0.25
Release date: Feb 18 2024
### Fixed
- Fix fatal error `Class "WPHelper\MetaBox" not found` due to dependency `abuyoyo/adminmenupage` < 0.29 not requiring dependency `abuyoyo/metabox`.
### Dependencies
- Library WPHelper\AdminPage (`abuyoyo/adminmenupage`) updated to 0.29. Requires `abuyoyo/metabox`.
## 0.24
Release date: Oct 4 2023
### Fixed
- Set `WPHelper\PluginCore` option `update_checker` to true. If library Plugin-Update-Checker is installed, allows updates from repo.
### Dependencies
- Library WPHelper\PluginCore (`abuyoyo/plugincore`) updated to 0.27. Supports both Plugin-Update-Checker v5 and v4.
## 0.23
### Fixed
- Fix `.plugin-count` bullet styling issue.
- Fix 0-count panel caused by collecting `.hidden` notices.
- Fix wrong priority color `.plugin-count` bullet caused by collecting `.hidden` notices.
- Fix empty notices-panel removing all screen-meta-link panels.
## 0.22
### Fixed
- Do not collect `.theme-info` notices.
- Fix `vendor/autoload` include path.
## 0.21
### Fixed
- Fix PHP 8.2 deprecated optional parameter before required parameter. Fixed upstream in `abuyoyo/screen-meta-links ~0.13`.
### Dependencies
- Update library `abuyoyo/screen-meta-links` to version 0.13.
## 0.20
### Minor
- Just another version bump (composer.json as well).
## 0.19 ## 0.19
### Added ### Added

View File

@ -2,7 +2,7 @@
"name": "abuyoyo/notice-manager", "name": "abuyoyo/notice-manager",
"description": "Manage notices on WordPress admin pages. Adds 'Notices' screen-meta-link.", "description": "Manage notices on WordPress admin pages. Adds 'Notices' screen-meta-link.",
"type": "wordpress-plugin", "type": "wordpress-plugin",
"version": "0.18", "version": "0.27",
"repositories": [ "repositories": [
{ {
"type": "vcs", "type": "vcs",
@ -10,8 +10,11 @@
} }
], ],
"require":{ "require":{
"abuyoyo/screen-meta-links": "~0.11", "abuyoyo/screen-meta-links": "~0.13",
"abuyoyo/plugincore": "~0.26", "abuyoyo/plugincore": "~0.27",
"abuyoyo/adminmenupage": "~0.25" "abuyoyo/adminmenupage": "~0.29"
},
"config": {
"prepend-autoloader": false
} }
} }

84
composer.lock generated
View File

@ -4,22 +4,25 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "d8561fb20f4729b2675b8aeef402b4aa", "content-hash": "b1a74cf1316f5dd317f70efeb60d9f4d",
"packages": [ "packages": [
{ {
"name": "abuyoyo/adminmenupage", "name": "abuyoyo/adminmenupage",
"version": "0.25", "version": "0.29",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/AdminMenuPage.git", "url": "https://github.com/abuyoyo/AdminMenuPage.git",
"reference": "487d262aec77a9a3ce04fa762e9048f30d22f123" "reference": "4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/487d262aec77a9a3ce04fa762e9048f30d22f123", "url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8",
"reference": "487d262aec77a9a3ce04fa762e9048f30d22f123", "reference": "4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8",
"shasum": "" "shasum": ""
}, },
"require": {
"abuyoyo/metabox": "~0.8"
},
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.26", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"
@ -40,27 +43,58 @@
"description": "WordPress admin menu page helper class", "description": "WordPress admin menu page helper class",
"support": { "support": {
"issues": "https://github.com/abuyoyo/AdminMenuPage/issues", "issues": "https://github.com/abuyoyo/AdminMenuPage/issues",
"source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.25" "source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.29"
}, },
"time": "2023-06-09T00:00:00+00:00" "time": "2023-10-05T00:00:00+00:00"
}, },
{ {
"name": "abuyoyo/plugincore", "name": "abuyoyo/metabox",
"version": "0.26", "version": "0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git", "url": "https://github.com/abuyoyo/MetaBox.git",
"reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6" "reference": "98cb4c30db4c366c0d273985eb9c31ffa1cd78f9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/77f7d5451bdff4bda6c9766847b215bdeaca96d6", "url": "https://api.github.com/repos/abuyoyo/MetaBox/zipball/98cb4c30db4c366c0d273985eb9c31ffa1cd78f9",
"reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6", "reference": "98cb4c30db4c366c0d273985eb9c31ffa1cd78f9",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"WPHelper\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "WordPress metabox helper class",
"support": {
"issues": "https://github.com/abuyoyo/MetaBox/issues",
"source": "https://github.com/abuyoyo/MetaBox/tree/0.8"
},
"time": "2023-07-18T19:14:03+00:00"
},
{
"name": "abuyoyo/plugincore",
"version": "0.27",
"source": {
"type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git",
"reference": "d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6",
"reference": "d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/adminmenupage": "~0.25", "abuyoyo/adminmenupage": "~0.27",
"yahnis-elsts/plugin-update-checker": "~4.12" "yahnis-elsts/plugin-update-checker": "~5.2"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -75,22 +109,22 @@
"description": "WordPress plugin core helper class", "description": "WordPress plugin core helper class",
"support": { "support": {
"issues": "https://github.com/abuyoyo/PluginCore/issues", "issues": "https://github.com/abuyoyo/PluginCore/issues",
"source": "https://github.com/abuyoyo/PluginCore/tree/0.26" "source": "https://github.com/abuyoyo/PluginCore/tree/0.27"
}, },
"time": "2022-06-09T00:00:00+00:00" "time": "2022-10-03T00:00:00+00:00"
}, },
{ {
"name": "abuyoyo/screen-meta-links", "name": "abuyoyo/screen-meta-links",
"version": "0.11", "version": "0.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/screen-meta-links.git", "url": "https://github.com/abuyoyo/screen-meta-links.git",
"reference": "04e3c892f0c6095b4c31a489e06336f0917128d3" "reference": "b324cef9eb5825d04ffa17f771237b7deca5cd01"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/screen-meta-links/zipball/04e3c892f0c6095b4c31a489e06336f0917128d3", "url": "https://api.github.com/repos/abuyoyo/screen-meta-links/zipball/b324cef9eb5825d04ffa17f771237b7deca5cd01",
"reference": "04e3c892f0c6095b4c31a489e06336f0917128d3", "reference": "b324cef9eb5825d04ffa17f771237b7deca5cd01",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -101,10 +135,10 @@
}, },
"description": "API for adding custom screen-meta-links alongside the 'Screen Options' and 'Help' links.", "description": "API for adding custom screen-meta-links alongside the 'Screen Options' and 'Help' links.",
"support": { "support": {
"source": "https://github.com/abuyoyo/screen-meta-links/tree/0.11", "source": "https://github.com/abuyoyo/screen-meta-links/tree/0.13",
"issues": "https://github.com/abuyoyo/screen-meta-links/issues" "issues": "https://github.com/abuyoyo/screen-meta-links/issues"
}, },
"time": "2022-05-18T01:18:24+00:00" "time": "2023-08-08T22:37:03+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -112,8 +146,8 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": true,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.1.0" "plugin-api-version": "2.3.0"
} }

View File

@ -2,157 +2,160 @@
* NoticeManager class/module * NoticeManager class/module
* *
*/ */
var NoticeManager = (function ($, document) { const NoticeManager = function ($) {
let options = window.notice_manager_options
let selectors_notice = [ const selectors_notice = [
"div.notice", "div.notice",
"div.updated", "div.updated",
] ]
let selectors_warning = [ const selectors_warning = [
"div.notice-warning", "div.notice-warning",
"div.update-nag", "div.update-nag",
] ]
let selectors_error = [ const selectors_error = [
"div.error", "div.error",
"div.notice-error", "div.notice-error",
] ]
let selectors_all = selectors_notice.concat(selectors_warning, selectors_error) const selectors_all = selectors_notice.concat(selectors_warning, selectors_error)
const selectors_skip = [
".inline",
".below-h2",
".theme-info .notice",
".hidden",
]
// wait function used with autoCollapse // wait function used with autoCollapse
let wait = function (ms) { const wait = function (ms) {
var dfd = $.Deferred() var dfd = $.Deferred()
setTimeout(dfd.resolve, ms) //callback, timeout till callback setTimeout(dfd.resolve, ms) //callback, timeout till callback
return dfd.promise() return dfd.promise()
} }
const options = window.notice_manager_options
let notices let notices
let button let button
let panel let panel
let haveClosed // set to true on first close/collect
let dismissNoticesButton let dismissNoticesButton
// bootstrap let haveClosed // set to true on first close/collect
// some of these need to run BEFORE document.ready - don't know why really let panelObserver
button = $("#meta-link-notices")
panel = $("#meta-link-notices-wrap")
haveClosed = false
dismissNoticesButton = $("#meta-link-notices-wrap button.notice-dismiss")
dismissNoticesButton.on("click", () => {
screenMeta.close(panel, button)
if (! haveClosed){
NoticeManager.collectNotices()
}
NoticeManager.addCounter()
})
//original wp focus on click function
button.on("focus.scroll-into-view", (e) => {
if (e.target.scrollIntoView) e.target.scrollIntoView(false)
})
// scroll page to top when closing notice panel
// function used to work with $(this)
// using e.target instead
// not sure if this should perhaps be e.currentTarget
button.on("click", (e) => {
if ($(e.target).hasClass("screen-meta-active")) {
if (haveClosed) {
NoticeManager.addCounter()
}
// $(window).scrollTop(true)
} else {
NoticeManager.removeCounter()
// wait (500).then(function(){ //still jumpy sometimes - but scrolls to correct position 400 ~ 600
// $(window).scrollTop(true)
// })
}
})
/**
* document.on.ready
*/
$(() => {
console.log("NoticeManager.on.ready")
console.log("options")
console.log(options)
// bootstrap notices
// get all notices that are not explicitly marked as `.inline` or `.below-h2`
// we add .update-nag.inline for WordPress Update notice
notices = $( selectors_all.join(', ') )
.not(".inline, .below-h2")
.add("div.update-nag")
/**
* Remove panel if there are no notices on this page
*/
if (options.screen_panel) {
NoticeManager.maybeRemoveNoticesPanel()
}
if (options.screen_panel && options.auto_collect) {
NoticeManager.collectNotices()
} else {
if (options.above_title) {
NoticeManager.moveAboveTitle()
}
}
/**
* auto-open notices panel
*/
if (button.length && ! options.distraction_free) {
panel.toggle()
button.addClass("screen-meta-active")
screenMeta.open(panel, button)
}
/**
* auto-close notices panel after short delay
* only auto-close if we have collected notices previously
* only auto-close if no error messages
*/
if (options.auto_collapse && ! options.distraction_free) {
wait(4000).then(() => {
if (haveClosed && NoticeManager.getNoticesTopPriority() != 'error') {
screenMeta.close(panel, button)
NoticeManager.addCounter()
}
})
}
if (options.distraction_free) {
NoticeManager.addCounterWhenClosed()
}
}) // end document.on.ready
// prevent jumpy scrollRestoration on reload page
// fixed below on 'beforeunload'
// if (history.scrollRestoration) {
// history.scrollRestoration = 'manual'
//}
/**
* Set history.scrollTop to prevent jump on page refresh when scrollRestoration = auto
*/
$(window).on("beforeunload", () => {
history.pushState(
{ scrollTop: document.body.scrollTop },
document.title,
document.location.pathname
)
})
return { return {
bootstrap: () => {
// Init selectors
button = $("#meta-link-notices")
panel = $("#meta-link-notices-wrap")
dismissNoticesButton = $("#meta-link-notices-wrap button.notice-dismiss")
// bootstrap notices
// get all notices that are not explicitly marked as `.inline` or `.below-h2`
// we add .update-nag.inline for WordPress Update notice
notices = $(selectors_all.join(', '))
.not(selectors_skip.join(', '))
.add("div.update-nag")
// Set state
haveClosed = false
dismissNoticesButton.on("click", () => {
screenMeta.close(panel, button)
if (!haveClosed) {
NoticeManager.collectNotices()
}
NoticeManager.addCounter()
})
//original wp focus on click function
button.on("focus.scroll-into-view", (e) => {
if (e.target.scrollIntoView) e.target.scrollIntoView(false)
})
// scroll page to top when closing notice panel
// function used to work with $(this)
// using e.target instead
// not sure if this should perhaps be e.currentTarget
button.on("click", (e) => {
if ($(e.target).hasClass("screen-meta-active")) {
if (haveClosed) {
NoticeManager.addCounter()
}
// $(window).scrollTop(true)
} else {
NoticeManager.removeCounter()
// wait (500).then(function(){ //still jumpy sometimes - but scrolls to correct position 400 ~ 600
// $(window).scrollTop(true)
// })
}
})
// prevent jumpy scrollRestoration on reload page
// fixed below on 'beforeunload'
// if (history.scrollRestoration) {
// history.scrollRestoration = 'manual'
//}
/**
* Set history.scrollTop to prevent jump on page refresh when scrollRestoration = auto
*/
$(window).on('beforeunload', () => history.pushState(
{ scrollTop: document.body.scrollTop },
document.title,
document.location.pathname
)
)
/**
* Remove panel if there are no notices on this page
*/
if (options.screen_panel) {
NoticeManager.maybeRemoveNoticesPanel()
}
if (options.screen_panel && options.auto_collect) {
NoticeManager.collectNotices()
} else {
if (options.above_title) {
NoticeManager.moveAboveTitle()
}
}
/**
* auto-open notices panel
*/
if (button.length && !options.distraction_free) {
panel.toggle()
button.addClass("screen-meta-active")
screenMeta.open(panel, button)
}
/**
* auto-close notices panel after short delay
* only auto-close if we have collected notices previously
* only auto-close if no error messages
*/
if (options.auto_collapse && !options.distraction_free) {
wait(4000).then(() => {
if (haveClosed && NoticeManager.getNoticesTopPriority() != 'error') {
screenMeta.close(panel, button)
NoticeManager.addCounter()
}
})
}
if (options.distraction_free) {
NoticeManager.addCounterWhenClosed()
}
},
getNotices: () => notices, getNotices: () => notices,
getNoticesTopPriority: () => { getNoticesTopPriority: () => {
@ -160,7 +163,7 @@ var NoticeManager = (function ($, document) {
return 'error' return 'error'
if (notices.filter(":visible").filter(selectors_warning.join(", ")).length) if (notices.filter(":visible").filter(selectors_warning.join(", ")).length)
return 'warning' return 'warning'
return 'notice' return 'info'
}, },
/** /**
@ -173,7 +176,7 @@ var NoticeManager = (function ($, document) {
return 'error' return 'error'
if (notices.filter(selectors_warning.join(", ")).length) if (notices.filter(selectors_warning.join(", ")).length)
return 'warning' return 'warning'
return 'notice' return 'info'
}, },
/** /**
@ -190,20 +193,18 @@ var NoticeManager = (function ($, document) {
* When dismissible notices are dismissed, check if any notices are left on page. * When dismissible notices are dismissed, check if any notices are left on page.
* If no notices are left - remove Notice Panel entirely * If no notices are left - remove Notice Panel entirely
*/ */
$(document).on( panelObserver = new MutationObserver(() => {
"DOMNodeRemoved", notices = panel
"#meta-link-notices-wrap div.notice", .find(selectors_all.join(", "))
() => { .filter(":visible")
notices = panel NoticeManager.maybeRemoveNoticesPanel()
.find(selectors_all.join(", ")) });
.filter(":visible") panelObserver.observe(panel.get(0), { childList: true, subtree: true }); // only run once
NoticeManager.maybeRemoveNoticesPanel()
}
)
}, },
addCounter: () => { addCounter: () => {
if (!button.children('.plugin-count').length){ if (!button.children('.plugin-count').length) {
button.append( button.append(
$("<span/>").text(notices.filter(":visible").length).attr({ $("<span/>").text(notices.filter(":visible").length).attr({
class: "plugin-count", class: "plugin-count",
@ -216,7 +217,7 @@ var NoticeManager = (function ($, document) {
* cannot rely on filter(:visible) * cannot rely on filter(:visible)
*/ */
addCounterWhenClosed: () => { addCounterWhenClosed: () => {
if (!button.children('.plugin-count').length){ if (!button.children('.plugin-count').length) {
button.append( button.append(
$("<span/>").text(notices.length).attr({ $("<span/>").text(notices.length).attr({
class: "plugin-count", class: "plugin-count",
@ -240,8 +241,9 @@ var NoticeManager = (function ($, document) {
$("#meta-link-notices-link-wrap").detach() $("#meta-link-notices-link-wrap").detach()
$("#meta-link-notices-wrap").detach() $("#meta-link-notices-wrap").detach()
if (!$("#screen-meta-links").children().length) if ($("#screen-meta-links").children().length == 0) {
$("#screen-meta-links").detach() $("#screen-meta-links").detach()
}
} }
}, },
@ -254,4 +256,6 @@ var NoticeManager = (function ($, document) {
notices.insertBefore(".wrap:first") notices.insertBefore(".wrap:first")
}, },
} }
}(jQuery,document) ) }(jQuery);
jQuery(NoticeManager.bootstrap);

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* Plugin Name: Notice Manager * Plugin Name: Notice Manager
* Description: Manage notices on WordPress admin pages. Adds 'Notices' screen-meta-link. * Description: Manage notices on WordPress admin pages. Adds 'Notices' screen-meta-link panel to collect notices from page.
* Version: 0.19 * Version: 0.27
* Author: abuyoyo * Author: abuyoyo
* Author URI: https://github.com/abuyoyo/ * Author URI: https://github.com/abuyoyo/
* Plugin URI: https://github.com/abuyoyo/notice-manager * Plugin URI: https://github.com/abuyoyo/notice-manager
@ -10,10 +10,24 @@
*/ */
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
use WPHelper\PluginCore; /**
* Dependencies
* Allow all other auto-loaders to fail before including our own.
*/
if (
! class_exists( 'WPHelper\PluginCore' )
||
! class_exists( 'WPHelper\AdminPage' )
||
! function_exists( 'wph_add_screen_meta_panel' )
)
{
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ){
require_once __DIR__ . '/vendor/autoload.php';
}
}
if ( file_exists( 'vendor/autoload.php' ) ) use WPHelper\PluginCore;
require_once 'vendor/autoload.php';
/** /**
* Bootstrap plugin and admin page (Tools > Notice Manager) * Bootstrap plugin and admin page (Tools > Notice Manager)
@ -69,12 +83,13 @@ new PluginCore(
'type' => 'checkbox', 'type' => 'checkbox',
'description' => 'Notice Panel is closed on page load. Requires auto_collect.' 'description' => 'Notice Panel is closed on page load. Requires auto_collect.'
], ],
] ],
] ],
] ],
] ],
] ],
] 'update_checker' => true, // If Plugin Update Checker library is available - allow updates/auto-updates.
],
); );
require_once 'src/NoticeManager.php'; require_once 'src/NoticeManager.php';

View File

@ -1,6 +1,35 @@
# Changelog # Changelog
WPHelper\AdminMenuPage WPHelper\AdminMenuPage
## 0.29
Release date: Oct 5 2023
### Fixed
- `composer.json` - Require `abuyoyo/metabox`. WPHelper\Metabox has been a required library since 0.25.
### Dependencies
- lib: WPHelper\Metabox (`abuyoyo/metabox`) ~0.8.
## 0.28
Release date: Oct 4 2023
### Added
- Option `parent` accepts `tools` as shorthand for `tools.php`.
- Add link to Install Plugin page in "CMB2 plugin missing" template.
## 0.27
Release date: Sep 10 2023
### Fixed
- Fix nav-tabs appearing on pages without `tab_group`.
## 0.26
Release date: Jun 20 2023
### Added
- Add `allow_on_front` setting to CMB2 pages. Hooks metabox on `cmb2_init` instead of `cmb2_admin_init`.
- If defined `WPH_DEBUG` add WPHelper classes debug information to plugin info meta box.
## 0.25 ## 0.25
Release date: Jun 9 2023 Release date: Jun 9 2023
@ -15,7 +44,7 @@ Release date: Jun 9 2023
- Fix several PHP undefined variable warnings. - Fix several PHP undefined variable warnings.
### Internal ### Internal
- Setting pages/wrap temlate uses WordPress Core `do_meta_boxes` to render `side` meta boxes div. - Setting pages/wrap template uses WordPress Core `do_meta_boxes` to render `side` meta boxes div.
- Add variables to `AdminPage::options()` array. - Add variables to `AdminPage::options()` array.
- Multiple code refactoring and template restructuring. - Multiple code refactoring and template restructuring.

View File

@ -2,9 +2,12 @@
"name": "abuyoyo/adminmenupage", "name": "abuyoyo/adminmenupage",
"description": "WordPress admin menu page helper class", "description": "WordPress admin menu page helper class",
"type": "library", "type": "library",
"version": "0.25", "version": "0.29",
"time": "2023-06-09", "time": "2023-10-05",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"require": {
"abuyoyo/metabox": "~0.8"
},
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.26", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"

View File

@ -348,6 +348,10 @@ class AdminPage
case 'options-general.php': case 'options-general.php':
$this->parent = 'options-general.php'; $this->parent = 'options-general.php';
break; break;
case 'tools':
case 'tools.php':
$this->parent = 'tools.php';
break;
default: default:
$this->parent = $parent; $this->parent = $parent;
break; break;
@ -397,7 +401,7 @@ class AdminPage
*/ */
if ( $cmb = cmb2_get_metabox( $this->parent ) ){ if ( $cmb = cmb2_get_metabox( $this->parent ) ){
$hookup = new CMB2_Options_Hookup( $cmb, $this->slug ); $hookup = new CMB2_Options_Hookup( $cmb, $this->slug );
add_action ( 'wphelper/adminpage/tab_nav', [ $hookup, 'options_page_tab_nav_output' ] ); add_action ( "wphelper/adminpage/tab_nav/{$this->tab_group}", [ $hookup, 'options_page_tab_nav_output' ] );
} }
}); });
} }

View File

@ -192,7 +192,11 @@ class CMB2_OptionsPage{
// register parent pages before sub-menu pages // register parent pages before sub-menu pages
$priority = empty( $settings['parent_slug'] ) ? 9 : 10; $priority = empty( $settings['parent_slug'] ) ? 9 : 10;
add_action( 'cmb2_admin_init', [ $this, 'register_metabox' ], $priority ); if ( $settings['allow_on_front'] ?? false ){
add_action( 'cmb2_init', [ $this, 'register_metabox' ], $priority );
} else {
add_action( 'cmb2_admin_init', [ $this, 'register_metabox' ], $priority );
}
/** /**
* @todo add 'submenu' field and functionality to WPHelper\AdminPage * @todo add 'submenu' field and functionality to WPHelper\AdminPage

View File

@ -18,6 +18,8 @@ class PluginInfoMetaBox{
private $tpl_inside = '/tpl/plugin_info_meta_box-inside.php'; private $tpl_inside = '/tpl/plugin_info_meta_box-inside.php';
private $tpl_debug = '/tpl/plugin_info_meta_box-wph_debug.php';
/** /**
* @var PluginCore * @var PluginCore
*/ */
@ -38,6 +40,7 @@ class PluginInfoMetaBox{
add_action( "wphelper/plugin_info_meta_box/{$this->plugin_core->slug()}", [ $this, 'plugin_info_box' ] ); add_action( "wphelper/plugin_info_meta_box/{$this->plugin_core->slug()}", [ $this, 'plugin_info_box' ] );
add_action( "wphelper/plugin_info_meta_box/inside/{$this->plugin_core->slug()}", [ $this, 'inside' ] ); add_action( "wphelper/plugin_info_meta_box/inside/{$this->plugin_core->slug()}", [ $this, 'inside' ] );
} }
/** /**
@ -98,5 +101,16 @@ class PluginInfoMetaBox{
extract($args); extract($args);
include __DIR__ . $this->tpl_inside; include __DIR__ . $this->tpl_inside;
} }
/**
* WPHelper classes debug info
*
* Prints inside Plugin Info Meta Box
*
* @since 0.26
*/
function wph_debug() {
include __DIR__ . $this->tpl_debug;
}
} }
endif; endif;

View File

@ -32,35 +32,35 @@ class SettingsPage{
/** /**
* Page slug to display sections * Page slug to display sections
* *
* @var String $page * @var string $page
*/ */
protected $page; public $page;
/** /**
* option_name key used in wp_options table * option_name key used in wp_options table
* *
* @var String $option_name * @var string $option_name
*/ */
protected $option_name; protected $option_name;
/** /**
* option_group used by register_setting() and settings_fields() * option_group used by register_setting() and settings_fields()
* *
* @var String $option_group * @var string $option_group
*/ */
public $option_group; public $option_group;
/** /**
* Sections * Sections
* *
* @var Array[] $sections * @var array[] $sections
*/ */
public $sections = []; public $sections = [];
/** /**
* Fields * Fields
* *
* @var Array[] $fields * @var array[] $fields
*/ */
public $fields = []; public $fields = [];
@ -343,7 +343,7 @@ class SettingsPage{
$new_options[$id] = sanitize_email( $option ); $new_options[$id] = sanitize_email( $option );
break; break;
case 'url': case 'url':
$new_options[$id] = sanitize_url( $option ); $new_options[$id] = esc_url_raw( $option );
break; break;
default: default:
break; break;

View File

@ -7,8 +7,9 @@
?> ?>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php <?php
/** @var WPHelper\AdminPage $this */
settings_fields( $this->settings_page->option_group );// Print hidden setting fields settings_fields( $this->settings_page->option_group );// Print hidden setting fields
do_settings_sections( $this->get_slug() );// Print title, info callback and form-table do_settings_sections( $this->settings_page->page );// Print title, info callback and form-table
submit_button(); submit_button();
?> ?>
</form> </form>

View File

@ -25,3 +25,13 @@
Last Updated: <?php echo $update_message; ?> Last Updated: <?php echo $update_message; ?>
<?php endif; ?> <?php endif; ?>
</p> </p>
<?php
/**
* Print WPHelper debug info in plugin info meta box
*
* @since 0.26
*/
if ( defined('WPH_DEBUG') && WPH_DEBUG ) {
/** @var WPHelper\PluginInfoMetaBox $this */
$this->wph_debug();
}

View File

@ -0,0 +1,84 @@
<?php
/**
* Plugin Info Metabox - .wph-debug
*
* @since 0.26
*/
use WPHelper\AdminPage;
use WPHelper\MetaBox;
use WPHelper\PluginCore;
use WPHelper\Utility\Singleton;
use WPHelper\DatabaseTable;
if (class_exists(AdminPage::class)){
$wph_admin_ref = new ReflectionClass(AdminPage::class);
$wph_admin_file = $wph_admin_ref->getFileName();
$wph_admin_composer = json_decode(file_get_contents( dirname( dirname( $wph_admin_file ) ) . '/composer.json' )) ;
}
if (class_exists(PluginCore::class)){
$wph_pc_ref = new ReflectionClass(PluginCore::class);
$wph_pc_file = $wph_pc_ref->getFileName();
$wph_pc_composer = json_decode(file_get_contents( dirname( $wph_pc_file ) . '/composer.json' )) ;
}
if (class_exists(MetaBox::class)){
$wph_mb_ref = new ReflectionClass(MetaBox::class);
$wph_mb_file = $wph_mb_ref->getFileName();
$wph_mb_composer = json_decode(file_get_contents( dirname( $wph_mb_file ) . '/composer.json' )) ;
}
if (trait_exists(Singleton::class)){
$wph_util_ref = new ReflectionClass(Singleton::class);
$wph_util_file = $wph_util_ref->getFileName();
$wph_util_composer = json_decode(file_get_contents( dirname( dirname( $wph_util_file ) ) . '/composer.json' )) ;
}
if (class_exists(DatabaseTable::class)){
$wph_db_ref = new ReflectionClass(DatabaseTable::class);
$wph_db_file = $wph_db_ref->getFileName();
$wph_db_composer = json_decode(file_get_contents( dirname( $wph_db_file ) . '/composer.json' )) ;
}
?>
<style>
.inside {
word-wrap: break-word;
}
</style>
<?php if ( ! empty( $wph_admin_composer ) ): ?>
<hr>
<p>
AdminPage: <?php echo $wph_admin_composer->version; ?><br/>
Location: <?php echo $wph_admin_file; ?><br/>
<?php endif; ?>
<?php if ( ! empty( $wph_pc_composer ) ): ?>
<hr>
<p>
PluginCore: <?php echo $wph_pc_composer->version; ?><br/>
Location: <?php echo $wph_pc_file; ?><br/>
<?php endif; ?>
<?php if ( ! empty( $wph_mb_composer ) ): ?>
<hr>
<p>
MetaBox: <?php echo $wph_mb_composer->version; ?><br/>
Location: <?php echo $wph_mb_file; ?><br/>
<?php endif; ?>
<?php if ( ! empty( $wph_util_composer ) ): ?>
<hr>
<p>
Utility: <?php echo $wph_util_composer->version; ?><br/>
Location: <?php echo $wph_util_file; ?><br/>
<?php endif; ?>
<?php if ( ! empty( $wph_db_composer ) ): ?>
<hr>
<p>
DatabaseTable: <?php echo $wph_db_composer->version; ?><br/>
Location: <?php echo $wph_db_file; ?><br/>
<?php endif; ?>
</p>

View File

@ -1,5 +1,9 @@
<?php <?php
/** /**
* Template - Tabs navigation row
* *
* Print tabs navigation row.
*
* @var WPHelper\AdminPage $this
*/ */
do_action ( 'wphelper/adminpage/tab_nav' ); do_action( "wphelper/adminpage/tab_nav/{$this->tab_group}" );

View File

@ -4,6 +4,6 @@
<div class="card"> <div class="card">
<h3>CMB2 Plugin Missing</h3> <h3>CMB2 Plugin Missing</h3>
<p>CMB2 plugin is required to display this page. <p>CMB2 plugin is required to display this page.
<br>Download and activate CMB2 plugin. <br>Please install and activate <a href="<?php echo admin_url('plugin-install.php?s=cmb2&tab=search') ?>">CMB2 plugin</a>.
</div> </div>
</div> </div>

View File

@ -0,0 +1,38 @@
# Create Github Release
# v1.0
# Create Github release on tag push
# - Use tag name as release title
# - Use CHANGELOG.md log entry as body
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Match any tag
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v1.1.0
with:
version: ${{ github.ref }}
path: ./CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.changelog_reader.outputs.log_entry }} # This pulls from the GET CHANGELOG ENTRY step above, referencing it's ID to get its outputs object, which include a `log_entry`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
draft: false
prerelease: false

26
vendor/abuyoyo/metabox/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,26 @@
# Changelog
WPHelper\MetaBox
## 0.8
### Fixed
- Fix `Metabox::render()` callback arguments. Callback is passed `$data_object` and `$box`.
## 0.7
### Fixed
- Validate `is_callable(render_cb)` before `call_user_func` call.
## 0.6
### Added
- Accept callable `render_cb` as well as readable `render_tpl` as render template.
## 0.5
### Added
- Basic Metabox API.

220
vendor/abuyoyo/metabox/MetaBox.php vendored Normal file
View File

@ -0,0 +1,220 @@
<?php
namespace WPHelper;
use function wp_parse_args;
use function add_action;
use function add_meta_box;
/**
* MetaBox
*
* Object-Oriented WordPress meta box creator.
*
* @author abuyoyo
* @version 0.8
*/
class MetaBox
{
/**
* Screen context where the meta box should display.
*
* @var string
*/
private $context;
/**
* The ID of the meta box.
*
* @var string
*/
private $id;
/**
* The display priority of the meta box.
*
* @var string
*/
private $priority;
/**
* Screens where this meta box will appear.
*
* @var string[]
*/
private $screens;
/**
* Path to the template used to display the content of the meta box.
*
* @var string filename
*/
private $render_tpl;
/**
* Path to the template used to display the content of the meta box.
*
* @var callable
*/
private $render_cb;
/**
* The title of the meta box.
*
* @var string
*/
private $title;
/**
* Hook where this meta box will be added.
*
* @var string
*/
private $hook;
/**
* Array of $args to be sent to callback function's second parameter
*
* @var array
*/
private $args;
/**
* Constructor.
*
* @param string $id
* @param string $template
* @param string $title
* @param string $context
* @param string $priority
* @param string[] $screens
*/
public function __construct($options)
{
// should throw error if required fields (id, title) not given
// template is actually optional
$defaults = [
'context' => 'advanced',
'priority' => 'default',
'screens' => [],
'args' => null,
'hook' => 'add_meta_boxes',
];
$options = wp_parse_args( $options, $defaults );
extract($options);
$this->context = $context;
$this->id = $id;
$this->priority = $priority;
$this->screens = $screens;
$this->render_tpl = isset( $template ) ? rtrim( $template, '/' ) : '';
$this->render_cb = $render ?? '';
$this->title = $title;
$this->hook = $hook;
$this->args = $args;
}
/**
* Add metabox at given hook.
*
* @return void
*/
public function add()
{
add_action( $this->hook, [ $this, 'wp_add_metabox' ] );
}
public function wp_add_metabox(){
add_meta_box(
$this->id,
$this->title,
[ $this, 'render' ], // $this->render_tpl | $this->render_cb
$this->screens,
$this->context,
$this->priority,
$this->args
);
}
/**
* Get the callable that will render the content of the meta box.
*
* @return callable
*/
public function get_callback()
{
return [ $this, 'render' ];
}
/**
* Get the screen context where the meta box should display.
*
* @return string
*/
public function get_context()
{
return $this->context;
}
/**
* Get the ID of the meta box.
*
* @return string
*/
public function get_id()
{
return $this->id;
}
/**
* Get the display priority of the meta box.
*
* @return string
*/
public function get_priority()
{
return $this->priority;
}
/**
* Get the screen(s) where the meta box will appear.
*
* @return array|string|WP_Screen
*/
public function get_screens()
{
return $this->screens;
}
/**
* Get the title of the meta box.
*
* @return string
*/
public function get_title()
{
return $this->title;
}
/**
* Render the content of the meta box using a PHP template.
* Callback passed to to add_meta_box()
*
* @see do_meta_boxes()
*
* @param mixed $data_object Object that's the focus of the current screen. eg. WP_Post|WP_Comment
* @param array $box Meta-box data [id, title, callback, args] (@see global $wp_meta_boxes)
*/
public function render( $data_object, $box )
{
if ( ! is_readable( $this->render_tpl ) && ! is_callable( $this->render_cb ) ){
return;
}
if ( is_callable( $this->render_cb ) ){
call_user_func( $this->render_cb, $data_object, $box );
} else if ( isset( $this->render_tpl ) ){
include $this->render_tpl;
}
}
}

1
vendor/abuyoyo/metabox/README.md vendored Normal file
View File

@ -0,0 +1 @@
# WPHelper\MetaBox

12
vendor/abuyoyo/metabox/composer.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"name": "abuyoyo/metabox",
"description": "WordPress metabox helper class",
"type": "library",
"version": "0.8",
"license": "BSD-3-Clause",
"autoload": {
"psr-4": {
"WPHelper\\" : ""
}
}
}

View File

@ -1,5 +1,11 @@
# WPHelper\PluginCore Changelog # WPHelper\PluginCore Changelog
## 0.27
Release Date: Oct 3, 2023
### Added
- Support Plugin Update Checker v5 as well as v4. Create class alias `WPHelper\PucFactory` for `YahnisElsts\PluginUpdateChecker\v5\PucFactory` if available. Fallback to `Puc_v4_Factory`.
## 0.26 ## 0.26
Release Date: Jun 9, 2023 Release Date: Jun 9, 2023

View File

@ -1,14 +1,12 @@
<?php <?php
namespace WPHelper; namespace WPHelper;
use Puc_v4_Factory as PucFactory;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
if ( ! class_exists( 'WPHelper/PluginCore' ) ): if ( ! class_exists( 'WPHelper/PluginCore' ) ):
// require dependency get_plugin_data() // require dependency get_plugin_data()
if( ! function_exists('get_plugin_data') ) { if( ! function_exists( 'get_plugin_data' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
} }
@ -19,7 +17,7 @@ if( ! function_exists('get_plugin_data') ) {
* *
* (@see README.md) * (@see README.md)
* *
* @version 0.26 * @version 0.27
*/ */
class PluginCore { class PluginCore {
@ -581,12 +579,30 @@ class PluginCore {
* *
* @since 0.9 init_update_checker() * @since 0.9 init_update_checker()
* @since 0.21 build_update_checker() * @since 0.21 build_update_checker()
* @since 0.27 Create class alias WPHelper\PucFactory - support plugin-update-checker v4 & v5
* *
* @uses PucFactory::buildUpdateChecker * @uses PucFactory::buildUpdateChecker
*/ */
private function build_update_checker() { private function build_update_checker() {
if ( ! class_exists( PucFactory::class ) ) /**
* Create class alias WPHelper\PucFactory
* Support YahnisElsts\PluginUpdateChecker v4 | v5
*
* @since 0.27
*/
if ( ! class_exists( 'WPHelper\PucFactory' ) ) {
if ( class_exists( 'YahnisElsts\PluginUpdateChecker\v5\PucFactory' ) ) {
$actual_puc = 'YahnisElsts\PluginUpdateChecker\v5\PucFactory';
} else if ( class_exists( 'Puc_v4_Factory' ) ) {
$actual_puc = 'Puc_v4_Factory';
}
if ( ! empty( $actual_puc ) ) {
class_alias( $actual_puc, 'WPHelper\PucFactory' );
}
}
if ( ! class_exists( 'WPHelper\PucFactory' ) )
return; return;
$update_checker = PucFactory::buildUpdateChecker( $update_checker = PucFactory::buildUpdateChecker(

View File

@ -2,12 +2,12 @@
"name": "abuyoyo/plugincore", "name": "abuyoyo/plugincore",
"description": "WordPress plugin core helper class", "description": "WordPress plugin core helper class",
"type": "library", "type": "library",
"version": "0.26", "version": "0.27",
"time": "2022-06-09", "time": "2022-10-03",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"suggest": { "suggest": {
"yahnis-elsts/plugin-update-checker": "~4.12", "yahnis-elsts/plugin-update-checker": "~5.2",
"abuyoyo/adminmenupage": "~0.25" "abuyoyo/adminmenupage": "~0.27"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -2,6 +2,16 @@
API for adding custom `screen-meta-links` links and panels alongside the 'Screen Options' and 'Help' links on the WordPress admin page. API for adding custom `screen-meta-links` links and panels alongside the 'Screen Options' and 'Help' links on the WordPress admin page.
## [0.13](https://github.com/abuyoyo/screen-meta-links/releases/tag/0.13)
### Fixed
- Fix PHP 8.2 depreacted: Optional parameter declared before required parameter.
## [0.12](https://github.com/abuyoyo/screen-meta-links/releases/tag/0.12)
### Fixed
- Fix PHP notice: Constant already defined.
## [0.11](https://github.com/abuyoyo/screen-meta-links/releases/tag/0.11) ## [0.11](https://github.com/abuyoyo/screen-meta-links/releases/tag/0.11)
### Removed ### Removed

View File

@ -2,7 +2,7 @@
/** /**
* Plugin Name: abuyoyo / Screen Meta Links * Plugin Name: abuyoyo / Screen Meta Links
* Description: API for adding custom screen-meta-links alongside the "Screen Options" and "Help" links. * Description: API for adding custom screen-meta-links alongside the "Screen Options" and "Help" links.
* Version: 0.11 * Version: 0.13
* Author: abuyoyo * Author: abuyoyo
* Author URI: https://github.com/abuyoyo * Author URI: https://github.com/abuyoyo
* Plugin URI: https://github.com/abuyoyo/screen-meta-links * Plugin URI: https://github.com/abuyoyo/screen-meta-links
@ -16,9 +16,9 @@
* *
*/ */
if ( ! defined( 'SML_FILE' ) ) define ( 'SML_FILE', __FILE__ ); ! defined( 'SML_FILE' ) && define ( 'SML_FILE', __FILE__ );
if ( ! defined( 'SML_URL' ) ) define ( 'SML_URL', plugin_dir_url( __FILE__ ) ); ! defined( 'SML_URL' ) && define ( 'SML_URL' , plugin_dir_url( __FILE__ ) );
if ( ! defined( 'SML_PATH' ) ) define ( 'SML_PATH', plugin_dir_path( __FILE__ ) ); ! defined( 'SML_PATH' ) && define ( 'SML_PATH', plugin_dir_path( __FILE__ ) );
if ( ! class_exists('Screen_Meta_Links') ): if ( ! class_exists('Screen_Meta_Links') ):
@ -352,14 +352,15 @@ if ( ! function_exists( 'wph_add_screen_meta_panel' ) ):
* @param string $id - Link ID. Should be unique and a valid value for a HTML ID attribute. * @param string $id - Link ID. Should be unique and a valid value for a HTML ID attribute.
* @param string $text - Link text. * @param string $text - Link text.
* @param string $href - Optional. Link URL to be used if no panel is provided * @param string $href - Optional. Link URL to be used if no panel is provided
* @param string|array $page - The page(s) where you want to add the link. * @param string|array $page - Optional. The page(s) where you want to add the link. Accepts wildcard '*'. If left empty will not add to any page.
* @param array $attributes - Optional. Additional attributes for the link tag. Add 'aria-controls' => "{$id}-wrap" to toggle panel * @param array $attributes - Optional. Additional attributes for the link tag. Add 'aria-controls' => "{$id}-wrap" to toggle panel
* @param callback $panel - Optional. Callback should print out screen-meta panel contents * @param callback $panel - Optional. Callback should print out screen-meta panel contents
* @return void * @return void
* *
* @todo Remove $href parameter and functionailty * @todo Remove $href parameter and functionailty
* @todo $page should not be optional. We need to remove $href first.
*/ */
function wph_add_screen_meta_panel($id, $text, $href = '', $page, $attributes = null, $panel=''){ function wph_add_screen_meta_panel( $id, $text, $href = '', $page = '', $attributes = null, $panel = '' ){
static $sml_instance = null; static $sml_instance = null;
if ( null === $sml_instance){ if ( null === $sml_instance){

20
vendor/autoload.php vendored
View File

@ -2,6 +2,24 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit99e41faf4c8cd1b54927a50ca0e7ee5c::getLoader(); return ComposerAutoloaderInita13a895834453aad32a897cc456c73ff::getLoader();

View File

@ -42,30 +42,76 @@ namespace Composer\Autoload;
*/ */
class ClassLoader class ClassLoader
{ {
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir; private $vendorDir;
// PSR-4 // PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array(); private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array(); private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array(); private $fallbackDirsPsr4 = array();
// PSR-0 // PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array(); private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array(); private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false; private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array(); private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false; private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array(); private $missingClasses = array();
/** @var string|null */
private $apcuPrefix; private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array(); private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null) public function __construct($vendorDir = null)
{ {
$this->vendorDir = $vendorDir; $this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
} }
/**
* @return array<string, list<string>>
*/
public function getPrefixes() public function getPrefixes()
{ {
if (!empty($this->prefixesPsr0)) { if (!empty($this->prefixesPsr0)) {
@ -75,28 +121,42 @@ class ClassLoader
return array(); return array();
} }
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4() public function getPrefixesPsr4()
{ {
return $this->prefixDirsPsr4; return $this->prefixDirsPsr4;
} }
/**
* @return list<string>
*/
public function getFallbackDirs() public function getFallbackDirs()
{ {
return $this->fallbackDirsPsr0; return $this->fallbackDirsPsr0;
} }
/**
* @return list<string>
*/
public function getFallbackDirsPsr4() public function getFallbackDirsPsr4()
{ {
return $this->fallbackDirsPsr4; return $this->fallbackDirsPsr4;
} }
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap() public function getClassMap()
{ {
return $this->classMap; return $this->classMap;
} }
/** /**
* @param array $classMap Class to filename map * @param array<string, string> $classMap Class to filename map
*
* @return void
*/ */
public function addClassMap(array $classMap) public function addClassMap(array $classMap)
{ {
@ -111,22 +171,25 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either * Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix. * appending or prepending to the ones previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories * @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
*
* @return void
*/ */
public function add($prefix, $paths, $prepend = false) public function add($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
(array) $paths, $paths,
$this->fallbackDirsPsr0 $this->fallbackDirsPsr0
); );
} else { } else {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0, $this->fallbackDirsPsr0,
(array) $paths $paths
); );
} }
@ -135,19 +198,19 @@ class ClassLoader
$first = $prefix[0]; $first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) { if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths; $this->prefixesPsr0[$first][$prefix] = $paths;
return; return;
} }
if ($prepend) { if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths, $paths,
$this->prefixesPsr0[$first][$prefix] $this->prefixesPsr0[$first][$prefix]
); );
} else { } else {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix], $this->prefixesPsr0[$first][$prefix],
(array) $paths $paths
); );
} }
} }
@ -156,25 +219,28 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either * Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace. * appending or prepending to the ones previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories * @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*
* @return void
*/ */
public function addPsr4($prefix, $paths, $prepend = false) public function addPsr4($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
// Register directories for the root namespace. // Register directories for the root namespace.
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
(array) $paths, $paths,
$this->fallbackDirsPsr4 $this->fallbackDirsPsr4
); );
} else { } else {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4, $this->fallbackDirsPsr4,
(array) $paths $paths
); );
} }
} elseif (!isset($this->prefixDirsPsr4[$prefix])) { } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -184,18 +250,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
} }
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths; $this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) { } elseif ($prepend) {
// Prepend directories for an already registered namespace. // Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths, $paths,
$this->prefixDirsPsr4[$prefix] $this->prefixDirsPsr4[$prefix]
); );
} else { } else {
// Append directories for an already registered namespace. // Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix], $this->prefixDirsPsr4[$prefix],
(array) $paths $paths
); );
} }
} }
@ -204,8 +270,10 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, * Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix. * replacing any others previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories * @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/ */
public function set($prefix, $paths) public function set($prefix, $paths)
{ {
@ -220,10 +288,12 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, * Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace. * replacing any others previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories * @param list<string>|string $paths The PSR-4 base directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*
* @return void
*/ */
public function setPsr4($prefix, $paths) public function setPsr4($prefix, $paths)
{ {
@ -243,6 +313,8 @@ class ClassLoader
* Turns on searching the include path for class files. * Turns on searching the include path for class files.
* *
* @param bool $useIncludePath * @param bool $useIncludePath
*
* @return void
*/ */
public function setUseIncludePath($useIncludePath) public function setUseIncludePath($useIncludePath)
{ {
@ -265,6 +337,8 @@ class ClassLoader
* that have not been registered with the class map. * that have not been registered with the class map.
* *
* @param bool $classMapAuthoritative * @param bool $classMapAuthoritative
*
* @return void
*/ */
public function setClassMapAuthoritative($classMapAuthoritative) public function setClassMapAuthoritative($classMapAuthoritative)
{ {
@ -285,6 +359,8 @@ class ClassLoader
* APCu prefix to use to cache found/not-found classes, if the extension is enabled. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
* *
* @param string|null $apcuPrefix * @param string|null $apcuPrefix
*
* @return void
*/ */
public function setApcuPrefix($apcuPrefix) public function setApcuPrefix($apcuPrefix)
{ {
@ -305,6 +381,8 @@ class ClassLoader
* Registers this instance as an autoloader. * Registers this instance as an autoloader.
* *
* @param bool $prepend Whether to prepend the autoloader or not * @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/ */
public function register($prepend = false) public function register($prepend = false)
{ {
@ -324,6 +402,8 @@ class ClassLoader
/** /**
* Unregisters this instance as an autoloader. * Unregisters this instance as an autoloader.
*
* @return void
*/ */
public function unregister() public function unregister()
{ {
@ -343,7 +423,8 @@ class ClassLoader
public function loadClass($class) public function loadClass($class)
{ {
if ($file = $this->findFile($class)) { if ($file = $this->findFile($class)) {
includeFile($file); $includeFile = self::$includeFile;
$includeFile($file);
return true; return true;
} }
@ -394,15 +475,20 @@ class ClassLoader
} }
/** /**
* Returns the currently registered loaders indexed by their corresponding vendor directories. * Returns the currently registered loaders keyed by their corresponding vendor directories.
* *
* @return self[] * @return array<string, self>
*/ */
public static function getRegisteredLoaders() public static function getRegisteredLoaders()
{ {
return self::$registeredLoaders; return self::$registeredLoaders;
} }
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext) private function findFileWithExtension($class, $ext)
{ {
// PSR-4 lookup // PSR-4 lookup
@ -468,14 +554,26 @@ class ClassLoader
return false; return false;
} }
}
/** /**
* Scope isolated include. * @return void
* */
* Prevents access to $this/self from included files. private static function initializeIncludeClosure()
*/ {
function includeFile($file) if (self::$includeFile !== null) {
{ return;
include $file; }
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
} }

View File

@ -20,12 +20,27 @@ use Composer\Semver\VersionParser;
* *
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
* *
* To require it's presence, you can require `composer-runtime-api ^2.0` * To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/ */
class InstalledVersions class InstalledVersions
{ {
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed; private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors; private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array(); private static $installedByVendor = array();
/** /**
@ -83,7 +98,7 @@ class InstalledVersions
{ {
foreach (self::getInstalled() as $installed) { foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) { if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
} }
} }
@ -104,7 +119,7 @@ class InstalledVersions
*/ */
public static function satisfies(VersionParser $parser, $packageName, $constraint) public static function satisfies(VersionParser $parser, $packageName, $constraint)
{ {
$constraint = $parser->parseConstraints($constraint); $constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint); return $provided->matches($constraint);
@ -228,7 +243,7 @@ class InstalledVersions
/** /**
* @return array * @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string} * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/ */
public static function getRootPackage() public static function getRootPackage()
{ {
@ -242,7 +257,7 @@ class InstalledVersions
* *
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[] * @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/ */
public static function getRawData() public static function getRawData()
{ {
@ -265,7 +280,7 @@ class InstalledVersions
* Returns the raw data of all installed.php which are currently loaded for custom implementations * Returns the raw data of all installed.php which are currently loaded for custom implementations
* *
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}> * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/ */
public static function getAllRawData() public static function getAllRawData()
{ {
@ -288,7 +303,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set * @param array[] $data A vendor/composer/installed.php data set
* @return void * @return void
* *
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/ */
public static function reload($data) public static function reload($data)
{ {
@ -298,7 +313,7 @@ class InstalledVersions
/** /**
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}> * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/ */
private static function getInstalled() private static function getInstalled()
{ {
@ -313,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) { if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir]; $installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) { } elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1]; self::$installed = $installed[count($installed) - 1];
} }
@ -325,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location, // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') { if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else { } else {
self::$installed = array(); self::$installed = array();
} }
} }
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed; return $installed;
} }

View File

@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer // autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_files.php @generated by Composer // autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer // autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,9 +2,9 @@
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'WPHelper\\' => array($vendorDir . '/abuyoyo/adminmenupage/src', $vendorDir . '/abuyoyo/plugincore'), 'WPHelper\\' => array($vendorDir . '/abuyoyo/adminmenupage/src', $vendorDir . '/abuyoyo/metabox', $vendorDir . '/abuyoyo/plugincore'),
); );

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit99e41faf4c8cd1b54927a50ca0e7ee5c class ComposerAutoloaderInita13a895834453aad32a897cc456c73ff
{ {
private static $loader; private static $loader;
@ -22,52 +22,27 @@ class ComposerAutoloaderInit99e41faf4c8cd1b54927a50ca0e7ee5c
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit99e41faf4c8cd1b54927a50ca0e7ee5c', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInita13a895834453aad32a897cc456c73ff', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit99e41faf4c8cd1b54927a50ca0e7ee5c', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInita13a895834453aad32a897cc456c73ff', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); require __DIR__ . '/autoload_static.php';
if ($useStaticLoader) { call_user_func(\Composer\Autoload\ComposerStaticInita13a895834453aad32a897cc456c73ff::getInitializer($loader));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { $filesToLoad = \Composer\Autoload\ComposerStaticInita13a895834453aad32a897cc456c73ff::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
} else { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$includeFiles = require __DIR__ . '/autoload_files.php'; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
foreach ($includeFiles as $fileIdentifier => $file) { require $file;
composerRequire99e41faf4c8cd1b54927a50ca0e7ee5c($fileIdentifier, $file); }
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire99e41faf4c8cd1b54927a50ca0e7ee5c($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c class ComposerStaticInita13a895834453aad32a897cc456c73ff
{ {
public static $files = array ( public static $files = array (
'8653524d908cf23a56335c6d210d6627' => __DIR__ . '/..' . '/abuyoyo/adminmenupage/wph_admin_page.php', '8653524d908cf23a56335c6d210d6627' => __DIR__ . '/..' . '/abuyoyo/adminmenupage/wph_admin_page.php',
@ -22,7 +22,8 @@ class ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c
'WPHelper\\' => 'WPHelper\\' =>
array ( array (
0 => __DIR__ . '/..' . '/abuyoyo/adminmenupage/src', 0 => __DIR__ . '/..' . '/abuyoyo/adminmenupage/src',
1 => __DIR__ . '/..' . '/abuyoyo/plugincore', 1 => __DIR__ . '/..' . '/abuyoyo/metabox',
2 => __DIR__ . '/..' . '/abuyoyo/plugincore',
), ),
); );
@ -33,9 +34,9 @@ class ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInita13a895834453aad32a897cc456c73ff::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInita13a895834453aad32a897cc456c73ff::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit99e41faf4c8cd1b54927a50ca0e7ee5c::$classMap; $loader->classMap = ComposerStaticInita13a895834453aad32a897cc456c73ff::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -2,26 +2,29 @@
"packages": [ "packages": [
{ {
"name": "abuyoyo/adminmenupage", "name": "abuyoyo/adminmenupage",
"version": "0.25", "version": "0.29",
"version_normalized": "0.25.0.0", "version_normalized": "0.29.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/AdminMenuPage.git", "url": "https://github.com/abuyoyo/AdminMenuPage.git",
"reference": "487d262aec77a9a3ce04fa762e9048f30d22f123" "reference": "4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/487d262aec77a9a3ce04fa762e9048f30d22f123", "url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8",
"reference": "487d262aec77a9a3ce04fa762e9048f30d22f123", "reference": "4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8",
"shasum": "" "shasum": ""
}, },
"require": {
"abuyoyo/metabox": "~0.8"
},
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.26", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"
}, },
"time": "2023-06-09T00:00:00+00:00", "time": "2023-10-05T00:00:00+00:00",
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "dist",
"autoload": { "autoload": {
"files": [ "files": [
"wph_admin_page.php" "wph_admin_page.php"
@ -37,30 +40,64 @@
"description": "WordPress admin menu page helper class", "description": "WordPress admin menu page helper class",
"support": { "support": {
"issues": "https://github.com/abuyoyo/AdminMenuPage/issues", "issues": "https://github.com/abuyoyo/AdminMenuPage/issues",
"source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.25" "source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.29"
}, },
"install-path": "../abuyoyo/adminmenupage" "install-path": "../abuyoyo/adminmenupage"
}, },
{ {
"name": "abuyoyo/plugincore", "name": "abuyoyo/metabox",
"version": "0.26", "version": "0.8",
"version_normalized": "0.26.0.0", "version_normalized": "0.8.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git", "url": "https://github.com/abuyoyo/MetaBox.git",
"reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6" "reference": "98cb4c30db4c366c0d273985eb9c31ffa1cd78f9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/77f7d5451bdff4bda6c9766847b215bdeaca96d6", "url": "https://api.github.com/repos/abuyoyo/MetaBox/zipball/98cb4c30db4c366c0d273985eb9c31ffa1cd78f9",
"reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6", "reference": "98cb4c30db4c366c0d273985eb9c31ffa1cd78f9",
"shasum": ""
},
"time": "2023-07-18T19:14:03+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"WPHelper\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "WordPress metabox helper class",
"support": {
"issues": "https://github.com/abuyoyo/MetaBox/issues",
"source": "https://github.com/abuyoyo/MetaBox/tree/0.8"
},
"install-path": "../abuyoyo/metabox"
},
{
"name": "abuyoyo/plugincore",
"version": "0.27",
"version_normalized": "0.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git",
"reference": "d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6",
"reference": "d730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/adminmenupage": "~0.25", "abuyoyo/adminmenupage": "~0.27",
"yahnis-elsts/plugin-update-checker": "~4.12" "yahnis-elsts/plugin-update-checker": "~5.2"
}, },
"time": "2022-06-09T00:00:00+00:00", "time": "2022-10-03T00:00:00+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -75,26 +112,26 @@
"description": "WordPress plugin core helper class", "description": "WordPress plugin core helper class",
"support": { "support": {
"issues": "https://github.com/abuyoyo/PluginCore/issues", "issues": "https://github.com/abuyoyo/PluginCore/issues",
"source": "https://github.com/abuyoyo/PluginCore/tree/0.26" "source": "https://github.com/abuyoyo/PluginCore/tree/0.27"
}, },
"install-path": "../abuyoyo/plugincore" "install-path": "../abuyoyo/plugincore"
}, },
{ {
"name": "abuyoyo/screen-meta-links", "name": "abuyoyo/screen-meta-links",
"version": "0.11", "version": "0.13",
"version_normalized": "0.11.0.0", "version_normalized": "0.13.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/screen-meta-links.git", "url": "https://github.com/abuyoyo/screen-meta-links.git",
"reference": "04e3c892f0c6095b4c31a489e06336f0917128d3" "reference": "b324cef9eb5825d04ffa17f771237b7deca5cd01"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/screen-meta-links/zipball/04e3c892f0c6095b4c31a489e06336f0917128d3", "url": "https://api.github.com/repos/abuyoyo/screen-meta-links/zipball/b324cef9eb5825d04ffa17f771237b7deca5cd01",
"reference": "04e3c892f0c6095b4c31a489e06336f0917128d3", "reference": "b324cef9eb5825d04ffa17f771237b7deca5cd01",
"shasum": "" "shasum": ""
}, },
"time": "2022-05-18T01:18:24+00:00", "time": "2023-08-08T22:37:03+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -104,7 +141,7 @@
}, },
"description": "API for adding custom screen-meta-links alongside the 'Screen Options' and 'Help' links.", "description": "API for adding custom screen-meta-links alongside the 'Screen Options' and 'Help' links.",
"support": { "support": {
"source": "https://github.com/abuyoyo/screen-meta-links/tree/0.11", "source": "https://github.com/abuyoyo/screen-meta-links/tree/0.13",
"issues": "https://github.com/abuyoyo/screen-meta-links/issues" "issues": "https://github.com/abuyoyo/screen-meta-links/issues"
}, },
"install-path": "../abuyoyo/screen-meta-links" "install-path": "../abuyoyo/screen-meta-links"

View File

@ -1,49 +1,58 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'pretty_version' => '0.18', 'name' => 'abuyoyo/notice-manager',
'version' => '0.18.0.0', 'pretty_version' => '0.25',
'version' => '0.25.0.0',
'reference' => NULL,
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => NULL,
'name' => 'abuyoyo/notice-manager',
'dev' => true, 'dev' => true,
), ),
'versions' => array( 'versions' => array(
'abuyoyo/adminmenupage' => array( 'abuyoyo/adminmenupage' => array(
'pretty_version' => '0.25', 'pretty_version' => '0.29',
'version' => '0.25.0.0', 'version' => '0.29.0.0',
'reference' => '4cd47d5217ca25ed17af76f5fdbab3cab3b37ef8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/adminmenupage', 'install_path' => __DIR__ . '/../abuyoyo/adminmenupage',
'aliases' => array(), 'aliases' => array(),
'reference' => '487d262aec77a9a3ce04fa762e9048f30d22f123', 'dev_requirement' => false,
),
'abuyoyo/metabox' => array(
'pretty_version' => '0.8',
'version' => '0.8.0.0',
'reference' => '98cb4c30db4c366c0d273985eb9c31ffa1cd78f9',
'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/metabox',
'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/notice-manager' => array( 'abuyoyo/notice-manager' => array(
'pretty_version' => '0.18', 'pretty_version' => '0.25',
'version' => '0.18.0.0', 'version' => '0.25.0.0',
'reference' => NULL,
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => NULL,
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/plugincore' => array( 'abuyoyo/plugincore' => array(
'pretty_version' => '0.26', 'pretty_version' => '0.27',
'version' => '0.26.0.0', 'version' => '0.27.0.0',
'reference' => 'd730a674cbe2dc92e60ace8e25a2e0e3fdeee3e6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/plugincore', 'install_path' => __DIR__ . '/../abuyoyo/plugincore',
'aliases' => array(), 'aliases' => array(),
'reference' => '77f7d5451bdff4bda6c9766847b215bdeaca96d6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/screen-meta-links' => array( 'abuyoyo/screen-meta-links' => array(
'pretty_version' => '0.11', 'pretty_version' => '0.13',
'version' => '0.11.0.0', 'version' => '0.13.0.0',
'reference' => 'b324cef9eb5825d04ffa17f771237b7deca5cd01',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/screen-meta-links', 'install_path' => __DIR__ . '/../abuyoyo/screen-meta-links',
'aliases' => array(), 'aliases' => array(),
'reference' => '04e3c892f0c6095b4c31a489e06336f0917128d3',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),