composer.lock + vendor

This commit is contained in:
abuyoyo 2023-06-09 19:17:23 +03:00
parent 4229406ec8
commit 9d574615e8
31 changed files with 739 additions and 255 deletions

30
composer.lock generated
View File

@ -4,24 +4,24 @@
"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": "c7eb351b97392f663e147702dbc845b9", "content-hash": "d8561fb20f4729b2675b8aeef402b4aa",
"packages": [ "packages": [
{ {
"name": "abuyoyo/adminmenupage", "name": "abuyoyo/adminmenupage",
"version": "0.21", "version": "0.25",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/AdminMenuPage.git", "url": "https://github.com/abuyoyo/AdminMenuPage.git",
"reference": "d05a9e9977d7e7c4ba3c913993493fefba4359d6" "reference": "487d262aec77a9a3ce04fa762e9048f30d22f123"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/d05a9e9977d7e7c4ba3c913993493fefba4359d6", "url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/487d262aec77a9a3ce04fa762e9048f30d22f123",
"reference": "d05a9e9977d7e7c4ba3c913993493fefba4359d6", "reference": "487d262aec77a9a3ce04fa762e9048f30d22f123",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.18", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"
}, },
"type": "library", "type": "library",
@ -40,26 +40,26 @@
"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.21" "source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.25"
}, },
"time": "2022-08-06T13:42:37+00:00" "time": "2023-06-09T00:00:00+00:00"
}, },
{ {
"name": "abuyoyo/plugincore", "name": "abuyoyo/plugincore",
"version": "0.23", "version": "0.26",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git", "url": "https://github.com/abuyoyo/PluginCore.git",
"reference": "0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4" "reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4", "url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/77f7d5451bdff4bda6c9766847b215bdeaca96d6",
"reference": "0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4", "reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/adminmenupage": "~0.20", "abuyoyo/adminmenupage": "~0.25",
"yahnis-elsts/plugin-update-checker": "~4.12" "yahnis-elsts/plugin-update-checker": "~4.12"
}, },
"type": "library", "type": "library",
@ -75,9 +75,9 @@
"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.23" "source": "https://github.com/abuyoyo/PluginCore/tree/0.26"
}, },
"time": "2022-08-06T00:00:00+00:00" "time": "2022-06-09T00:00:00+00:00"
}, },
{ {
"name": "abuyoyo/screen-meta-links", "name": "abuyoyo/screen-meta-links",

View File

@ -1,6 +1,54 @@
# Changelog # Changelog
WPHelper\AdminMenuPage WPHelper\AdminMenuPage
## 0.25
Release date: Jun 9 2023
### Added
- Non-CMB2 pages can be added to CMB2 tab groups. New options `tab_group` and `tab_title`
### Changed
- New method `render_plugin_info_meta_box`. Deprecate `render_plugin_info_box`.
- Plugin info meta box rendered using `WPHelper\MetaBox`.
### Fixed
- Fix several PHP undefined variable warnings.
### Internal
- Setting pages/wrap temlate uses WordPress Core `do_meta_boxes` to render `side` meta boxes div.
- Add variables to `AdminPage::options()` array.
- Multiple code refactoring and template restructuring.
## 0.24
Release date: Jan 28 2023
### Fixed
- Fix plugin info meta box when no PluginCore is available.
- Fix PHP deprecated notice.
## 0.23
Release date: Jan 15 2023
### Added
- Add action hook `wphelper/plugin_info_meta_box/{$slug}` to modify and render plugin info meta box.
- Add support for `textarea` input field in SettingsPage.
- Add `sanitize_callback` option - allow plugins to supply their own sanitize function.
- Add `render` to fields - allow plugins to supply their own render callback for fields.
- Add `placeholder` to fields - allow plugins to supply placeholder values for fields.
### Fixed
- Fix default value handling for fields.
### Internal
- Rename `tpl/` template parts.
- Minor changes and fixes.
## 0.22
Release date: Jan 1 2023
### Fixed
- Fix error when `plugin_info = true` but `plugin_core` is not set.
## 0.21 ## 0.21
### Fixed ### Fixed
@ -9,7 +57,7 @@ WPHelper\AdminMenuPage
## 0.20 ## 0.20
### Added ### Added
- Add SettingsPage section option `desciption-container`. Accepts `card` div, `notice`, `notice-info` and `none`. - Add SettingsPage section option `description-container`. Accepts `card` div, `notice`, `notice-info` and `none`.
- Sanitize SettingsPage text, url and email fields. - Sanitize SettingsPage text, url and email fields.
## 0.19 ## 0.19
@ -19,7 +67,7 @@ WPHelper\AdminMenuPage
- CMB2_OptionsPage supports all admin menu top-level slugs. - CMB2_OptionsPage supports all admin menu top-level slugs.
### Fixed ### Fixed
- Fixed PHP fatal error: cannot redeclare function `wph_extra_plugin_headers()`. - Fix PHP fatal error: cannot redeclare function `wph_extra_plugin_headers()`.
### Changed ### Changed
- If CMB2 plugin is not activated - show missing plugin card on `cmb2` and `cmb2-tabs` pages. - If CMB2 plugin is not activated - show missing plugin card on `cmb2` and `cmb2-tabs` pages.

View File

@ -19,7 +19,7 @@ require __DIR__ . '/vendor/autoload.php';
WPHelper\AdminMenuPage uses [PSR-4](https://www.php-fig.org/psr/psr-4/) to autoload. WPHelper\AdminMenuPage uses [PSR-4](https://www.php-fig.org/psr/psr-4/) to autoload.
OR OR
Install as WordPress plugin and activate. Install as WordPress plugin and activate.
@ -40,14 +40,13 @@ $args = [
'icon_url' => $icon_url; // optional - icon url passed to add_menu_page/add_submenu_page 'icon_url' => $icon_url; // optional - icon url passed to add_menu_page/add_submenu_page
'position' => 4; // optional - passed to add_menu_page 'position' => 4; // optional - passed to add_menu_page
'scripts' => [ // optional - script parameters passed to enqueue_scripts. Will only enqueue scripts on admin page 'scripts' => [ // optional - script parameters passed to enqueue_scripts. Will only enqueue scripts on admin page
[ 'script_handle', 'js/myscript.js', ['jquery'], false, true ], [ 'script_handle', 'js/my_script.js', ['jquery'], false, true ],
[ 'another_script', 'js/my_other_script.js', ['jquery', 'script_handle'], false, true ] [ 'another_script', 'js/my_other_script.js', ['jquery', 'script_handle'], false, true ]
]; ];
]; ];
// Register the admin menu page. // Register the admin menu page.
$admin_menu_page = new AdminPage( $args ); $admin_menu_page = new AdminPage( $args );
$admin_menu_page->setup();
// That's it. We're done. // That's it. We're done.
// This function can be called from anywhere. No need to wrap in any hook. // This function can be called from anywhere. No need to wrap in any hook.

View File

@ -2,10 +2,11 @@
"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.21", "version": "0.25",
"time": "2023-06-09",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.18", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"
}, },
"autoload": { "autoload": {

View File

@ -3,7 +3,7 @@ namespace WPHelper;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
if ( ! class_exists( 'WPHelper\AdminMenuPage' ) ): if ( ! class_exists( AdminMenuPage::class ) ):
/** /**
* AdminMenuPage * AdminMenuPage
* *

View File

@ -1,13 +1,15 @@
<?php <?php
namespace WPHelper; namespace WPHelper;
use CMB2_Options_Hookup;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
use function add_menu_page; use function add_menu_page;
use function add_options_page; use function add_options_page;
use function add_submenu_page; use function add_submenu_page;
if ( ! class_exists( 'WPHelper\AdminPage' ) ): if ( ! class_exists( AdminPage::class ) ):
/** /**
* AdminPage * AdminPage
* *
@ -106,6 +108,20 @@ class AdminPage
*/ */
protected $wrap; protected $wrap;
/**
* Tab Group
*
* @var string CMB2 tab group
*/
protected $tab_group;
/**
* Tab Title
*
* @var string CMB2 tab title
*/
protected $tab_title;
/** /**
* Render callback function. * Render callback function.
* *
@ -120,6 +136,13 @@ class AdminPage
*/ */
protected $scripts; protected $scripts;
/**
* Settings
*
* @var array[] arrays of settings sections and fields
*/
protected $settings;
/** /**
* Styles * Styles
* *
@ -156,11 +179,18 @@ class AdminPage
protected $settings_page; protected $settings_page;
/** /**
* Delegate admin_menu hookup to CMB2 implementation * CMB2 custom settings page
* *
* @var boolean * @var CMB2_OptionsPage|CMB2_OptionsPage_Multi
*/ */
protected $delegate_hookup = false; protected $cmb2_page;
/**
* Plugin Info Meta Box render object
*
* @var PluginInfoMetaBox
*/
protected $plugin_info_meta_box;
/** /**
* Constructor. * Constructor.
@ -178,14 +208,13 @@ class AdminPage
if ( isset( $options->plugin_core ) ) if ( isset( $options->plugin_core ) )
$this->plugin_core( $options->plugin_core ); $this->plugin_core( $options->plugin_core );
if ( isset( $options->title ) ) $this->title( $options->title ?? null );
$this->title( $options->title );
/** /**
* @todo move this to bootstrap() * @todo move this to bootstrap()
*/ */
if ( ! isset( $options->menu_title ) ) if ( ! isset( $options->menu_title ) )
$options->menu_title = $options->title; $options->menu_title = $this->title;
if ( isset( $options->menu_title ) ) if ( isset( $options->menu_title ) )
$this->menu_title( $options->menu_title ); $this->menu_title( $options->menu_title );
@ -193,8 +222,7 @@ class AdminPage
if ( isset( $options->capability ) ) if ( isset( $options->capability ) )
$this->capability( $options->capability ); $this->capability( $options->capability );
if ( isset( $options->slug ) ) $this->slug( $options->slug ?? null );
$this->slug( $options->slug );
if ( isset( $options->plugin_info ) ){ // before render() if ( isset( $options->plugin_info ) ){ // before render()
$this->plugin_info( $options->plugin_info ); $this->plugin_info( $options->plugin_info );
@ -204,21 +232,24 @@ class AdminPage
$this->wrap( $options->wrap ); $this->wrap( $options->wrap );
} }
if ( isset( $options->render ) ) // dev if ( isset( $options->render_cb ) )
$this->render( $options->render );
if ( isset( $options->render_cb ) ) // dev - deprecate?
$this->render_cb( $options->render_cb ); $this->render_cb( $options->render_cb );
if ( isset( $options->render_tpl ) ) // dev - deprecate? if ( isset( $options->render_tpl ) ) // before render()
$this->render_tpl( $options->render_tpl ); $this->render_tpl( $options->render_tpl );
// This runs last so we can have 'settings-page' with custom render_tpl
if ( isset( $options->render ) )
$this->render( $options->render );
if (true) if (true)
$this->render(); // render anyway - will use default tpl if render is empty $this->render(); // render anyway - will use default tpl if render is empty
if (true) if (true)
$this->wrap(); // set wrap anyway - will set to 'none' if empty $this->wrap(); // set wrap anyway - will set to 'none' if empty
if ( isset( $options->parent ) ) if ( isset( $options->parent ) )
$this->parent( $options->parent ); $this->parent( $options->parent );
@ -228,6 +259,11 @@ class AdminPage
if ( isset( $options->position ) ) if ( isset( $options->position ) )
$this->position( $options->position ); $this->position( $options->position );
if ( isset( $options->tab_group ) ){
$this->tab_group( $options->tab_group );
$this->tab_title( $options->tab_title ?? $options->submenu_title ?? $options->menu_title );
}
if ( isset( $options->scripts ) ) if ( isset( $options->scripts ) )
$this->scripts( $options->scripts ); $this->scripts( $options->scripts );
@ -253,8 +289,8 @@ class AdminPage
* *
* @access private * @access private
*/ */
private function title( $title ) { private function title( $title=null ) {
$this->title = $title; $this->title = $title ?? ( isset( $this->plugin_core ) ? $this->plugin_core->title() : __METHOD__ );
} }
/** /**
@ -284,7 +320,19 @@ class AdminPage
* @access private * @access private
*/ */
private function slug( $slug ) { private function slug( $slug ) {
$this->slug = $slug;
$this->slug = $slug // if not empty
?: $this->settings['option_key'] // if isset option_key
?? (
isset( $this->plugin_core )
? (
method_exists( PluginCore::class, 'token' )
? $this->plugin_core->token() // PluginCore ~0.25
: str_replace('-','_', strtolower( $this->plugin_core->slug() ) ) // PluginCore <= 0.24
)
: 'slug' . time() // unique slug
);
} }
/** /**
@ -316,7 +364,6 @@ class AdminPage
$this->icon_url = $icon_url; $this->icon_url = $icon_url;
} }
/** /**
* Setter - position * Setter - position
* WordPress admin menu param * WordPress admin menu param
@ -327,6 +374,44 @@ class AdminPage
$this->position = $position; $this->position = $position;
} }
/**
* Setter - tab_group
* CMB2 Tab Group - used by regular 'wrap' pages as well.
*
* @access private
*/
private function tab_group( $tab_group ) {
$this->tab_group = $tab_group;
add_filter( 'cmb2_tab_group_tabs', [ $this, 'add_to_tab_group' ], 10, 2 );
add_action( 'cmb2_admin_init', function(){
/**
* When deactivating CMB2 and reactivating - got this fatal error:
*
* Fatal error: Uncaught Error: Argument 1 passed to CMB2_Options_Hookup::__construct()
* must be an instance of CMB2, bool given,
* called in \wp-content\plugins\cgv\inc\CGV.php on line 56
* in \wp-content\plugins\cmb2\includes\CMB2_Options_Hookup.php on line 39
*
* Validate cmb2_get_metabox did not return false.
*/
if ( $cmb = cmb2_get_metabox( $this->parent ) ){
$hookup = new CMB2_Options_Hookup( $cmb, $this->slug );
add_action ( 'wphelper/adminpage/tab_nav', [ $hookup, 'options_page_tab_nav_output' ] );
}
});
}
/**
* Setter - tab_title
* CMB2 Tab Title - only set if tab_group.
*
* @access private
*/
private function tab_title( $tab_title ) {
$this->tab_title = $tab_title;
}
/** /**
* Setter - render * Setter - render
* Sets render cb or tpl * Sets render cb or tpl
@ -340,34 +425,30 @@ class AdminPage
*/ */
private function render( $render=null ) { private function render( $render=null ) {
if ( 'settings-page' == $render ) { if ( 'settings-page' == $render ) {
$this->render_tpl( __DIR__ . '/tpl/settings-form.php' ); $this->render_tpl( __DIR__ . '/tpl/form-basic.php' );
$this->render = $this->render ?? $render; // 'settings-page' $this->render = $this->render ?? $render; // 'settings-page'
} else if ( 'cmb2' == $render || 'cmb2-tabs' == $render ) { } else if ( 'cmb2' == $render || 'cmb2-tabs' == $render ) {
// validate // validate
if ( ! defined( 'CMB2_LOADED' ) ){ if ( ! defined( 'CMB2_LOADED' ) ){
$this->render_tpl( __DIR__ . '/tpl/cmb2-unavailable.php' ); $this->render_tpl( __DIR__ . '/tpl/wrap-cmb2-unavailable.php' );
$this->render = $this->render ?? 'render_tpl'; $this->render = $this->render ?? 'render_tpl';
} else { } else {
$this->delegate_hookup = true; /**
* Render templates managed and included by CMB2_OptionsPage
if ( ! empty( $this->plugin_core ) || ! empty( $this->plugin_info ) ){ * @see CMB2_OptionsPage::options_page_output()
$this->render_tpl( __DIR__ . '/tpl/cmb2_options_page-plugin_info.php' ); */
} else {
$this->render_tpl( __DIR__ . '/tpl/cmb2_options_page.php' );
}
$this->render = $this->render ?? $render; // 'cmb2' || 'cmb2-tabs' $this->render = $this->render ?? $render; // 'cmb2' || 'cmb2-tabs'
} }
} else if( is_callable( $render ) ) { } else if( is_callable( $render ) ) {
$this->render_cb( $render ); $this->render_cb( $render );
$this->render = $this->render ?? 'render_cb'; $this->render = $this->render ?? 'render_cb';
} else if ( is_readable( $render ) ) { } else if ( is_readable( $render ?? '' ) ) {
$this->render_tpl( $render ); $this->render_tpl( $render );
$this->render = $this->render ?? 'render_tpl'; $this->render = $this->render ?? 'render_tpl';
} else { } else {
$this->render_tpl( __DIR__ . '/tpl/default.php' ); $this->render_tpl( __DIR__ . '/tpl/wrap-default.php' );
$this->render = $this->render ?? 'render_tpl'; $this->render = $this->render ?? 'render_tpl';
} }
} }
@ -465,11 +546,23 @@ class AdminPage
if( is_callable( $plugin_info ) ) if( is_callable( $plugin_info ) )
$this->plugin_info = $plugin_info; $this->plugin_info = $plugin_info;
// if true-y value passed and PluginCore class exists - set to true // if true-y value passed and plugin_core isset
else if (!empty($plugin_info) && class_exists('WPHelper\PluginCore')) else if ( ! empty( $plugin_info ) && ! empty( $this->plugin_core ) )
$this->plugin_info = true; $this->plugin_info = true;
} }
/**
* Add to tab group
*
* @hook cmb2_tab_group_tabs
*/
public function add_to_tab_group( $tabs, $tab_group ){
if ( $tab_group == $this->tab_group ){
$tabs[ $this->slug ] = $this->tab_title;
}
return $tabs;
}
/** /**
* Setter - scripts * Setter - scripts
* Scripts to enqueue on admin page * Scripts to enqueue on admin page
@ -501,7 +594,7 @@ class AdminPage
} }
function plugin_core($plugin_core){ function plugin_core($plugin_core){
if ( is_a( $plugin_core, 'WPHelper\PluginCore') ){ if ( $plugin_core instanceof PluginCore ){
$this->plugin_core = $plugin_core; $this->plugin_core = $plugin_core;
} }
} }
@ -525,13 +618,18 @@ class AdminPage
'capability' => $this->capability, 'capability' => $this->capability,
'slug' => $this->slug, 'slug' => $this->slug,
'parent' => $this->parent, 'parent' => $this->parent,
'hook_suffix' => $this->hook_suffix,
'icon_url' => $this->icon_url, 'icon_url' => $this->icon_url,
'position' => $this->position, 'position' => $this->position,
'render' => $this->render, // render_cb | render_tpl | settings-page | cmb2 | cmb2-tabs 'render' => $this->render, // render_cb | render_tpl | settings-page | cmb2 | cmb2-tabs
'render_cb' => $this->render_cb, 'render_cb' => $this->render_cb,
'render_tpl' => $this->render_tpl, 'render_tpl' => $this->render_tpl,
'settings' => $this->settings, 'settings' => $this->settings,
'wrap' => $this->wrap,
'tab_group' => $this->tab_group,
'tab_title' => $this->tab_title,
'plugin_core' => $this->plugin_core, 'plugin_core' => $this->plugin_core,
'plugin_info' => $this->plugin_info,
]; ];
return $options; return $options;
@ -570,37 +668,30 @@ class AdminPage
if ( ! $this->capability ) if ( ! $this->capability )
$this->capability = 'manage_options'; $this->capability = 'manage_options';
if ( $this->render == 'settings-page' ){ add_action( "wphelper/adminpage/plugin_info_box/{$this->slug}" , [ $this , 'render_plugin_info_meta_box' ] );
$this->settings_page = new SettingsPage($this); /**
$this->settings_page->setup(); * @todo Perhaps this can hook on admin_init - right after admin_menu has finished
* @todo CMB2 options-page does not return page_hook/hook_suffix - MUST validate
*/
add_action ( 'admin_init' , [ $this , '_bootstrap_admin_page' ] );
} if ( in_array( $this->render, [ 'cmb2', 'cmb2-tabs' ] ) ){
add_action( "wphelper/adminpage/plugin_info_box/{$this->slug}" , [ $this , 'render_plugin_info_box' ] ); $this->cmb2_page = $this->settings['options_type'] ?? '' == 'multi'
? new CMB2_OptionsPage_Multi( $this )
// if ( $this->delegate_hookup ){ : new CMB2_OptionsPage( $this );
if ( 'cmb2' == $this->render || 'cmb2-tabs' == $this->render ){
if ( isset( $this->settings['options_type'] ) && $this->settings['options_type'] == 'multi' ) {
$this->cmb2_page = new CMB2_OptionsPage_Multi( $this );
} else {
$this->cmb2_page = new CMB2_OptionsPage( $this );
}
/**
* @todo Perhaps this can hook on admin_init - right after admin_menu has finished
* @todo CMB2 options-page does not return page_hook/hook_suffix - MUST validate
*/
add_action ( 'admin_menu' , [ $this , '_bootstrap_admin_page' ], 12 );
// skip add_menu_page // skip add_menu_page
return; return;
} }
// if ( ! $this->delegate_hookup ){ if ( $this->render == 'settings-page' ){
$this->settings_page = new SettingsPage($this);
}
add_action ( 'admin_menu' , [ $this , 'add_menu_page' ], 11 ); add_action ( 'admin_menu' , [ $this , 'add_menu_page' ], 11 );
add_action ( 'admin_menu' , [ $this , '_bootstrap_admin_page' ], 12 ); add_action ( 'admin_menu' , [ $this , 'add_plugin_info_meta_box' ], 11 );
} }
@ -644,6 +735,21 @@ class AdminPage
); );
break; break;
} }
}
/**
*
*/
public function add_plugin_info_meta_box() {
$metabox_args = [
'id' => $this->slug . '_plugin_info_meta_box', // id is unique (in case a plugin uses $this->slug)
'title' => 'Plugin Info',
'context' => 'side',
'screens' => [ $this->get_hook_suffix() ],
// 'template',
'render' => [ $this , 'render_plugin_info_meta_box_inside' ],
];
( new MetaBox($metabox_args) )->add();
} }
@ -653,14 +759,6 @@ class AdminPage
*/ */
public function validate_page_hook(){ public function validate_page_hook(){
/**
* hack!
* This is ad hoc validation - should do this earlier
*/
if ( empty( $this->slug ) ){
$this->slug = $this->settings['option_key'];
}
if ( empty( $this->hook_suffix ) ){ if ( empty( $this->hook_suffix ) ){
$this->hook_suffix = get_plugin_page_hookname( $this->slug, $this->parent ); $this->hook_suffix = get_plugin_page_hookname( $this->slug, $this->parent );
} }
@ -678,14 +776,9 @@ class AdminPage
* *
* @hook admin_menu priority 12 * @hook admin_menu priority 12
* @access private * @access private
*
* @todo move this function to admin_init - after admin_menu has finished
*/ */
public function _bootstrap_admin_page(){ public function _bootstrap_admin_page(){
/**
* @todo perhaps run this on 'admin_init'
*/
$this->validate_page_hook(); $this->validate_page_hook();
add_action ( 'load-' . $this->hook_suffix , [ $this , '_admin_page_setup' ] ); add_action ( 'load-' . $this->hook_suffix , [ $this , '_admin_page_setup' ] );
@ -854,19 +947,21 @@ class AdminPage
*/ */
public function render_admin_page() public function render_admin_page()
{ {
// @todo if render callback supplied - add shortcircuit hook here
// execute render callback and return early
// if wrap - 1. We collect output buffer
if ( 'none' != $this->wrap ){ if ( 'none' != $this->wrap ){
ob_start(); ob_start();
} }
//---------------------------[The McGuffin]---------------------------------//
if ( isset( $this->render_cb ) && is_callable( $this->render_cb ) ) { if ( isset( $this->render_cb ) && is_callable( $this->render_cb ) ) {
call_user_func( $this->render_cb ); call_user_func( $this->render_cb );
} else if ( isset( $this->render_tpl ) && is_readable( $this->render_tpl ) ) { } else if ( isset( $this->render_tpl ) && is_readable( $this->render_tpl ) ) {
include $this->render_tpl; include $this->render_tpl;
} }
//---------------------------[The McGuffin]---------------------------------//
// if wrap - 2. include chosen wrap template
if ( 'none' != $this->wrap ){ if ( 'none' != $this->wrap ){
$ob_content = ob_get_clean(); $ob_content = ob_get_clean();
@ -885,7 +980,21 @@ class AdminPage
} }
/** /**
* Render plugin info metabox *
* @see render_plugin_info_meta_box()
* @deprecated
*/
public function render_plugin_info_box(){
_doing_it_wrong( __METHOD__, 'Deprecated. Use render_plugin_info_meta_box() instead.', '0.26' );
$this->render_plugin_info_meta_box();
}
/**
* Render plugin info meta-box
* *
* Call user-provided callable. * Call user-provided callable.
* Or else attempt to create PluginInfoMetaBox class from $this->plugin_core and call its render function. * Or else attempt to create PluginInfoMetaBox class from $this->plugin_core and call its render function.
@ -895,17 +1004,55 @@ class AdminPage
* @todo See if this function should be public API or only run on action hook * @todo See if this function should be public API or only run on action hook
* @todo deprecate public use - use wphelper/adminpage/plugin_info_box/{$this->slug} instead * @todo deprecate public use - use wphelper/adminpage/plugin_info_box/{$this->slug} instead
*/ */
public function render_plugin_info_box(){ public function render_plugin_info_meta_box(){
if ( isset( $this->plugin_info ) && is_callable( $this->plugin_info ) ) { if ( isset( $this->plugin_info ) && is_callable( $this->plugin_info ) ) {
call_user_func( $this->plugin_info ); call_user_func( $this->plugin_info );
} else { } else {
if ( ! empty( $this->plugin_core ) && empty( $this->plugin_info_meta_box ) ){
$this->plugin_info_meta_box = new PluginInfoMetaBox( $this->plugin_core ); if (!$this->bootstrap_plugin_info_meta_box()){
return;
} }
$this->plugin_info_meta_box->plugin_info_box();
/**
* Allow plugins to modify plugin info meta box
*
* @since 0.23
*/
do_action( "wphelper/plugin_info_meta_box/{$this->plugin_core->slug()}" );
}
}
/**
*
*/
public function render_plugin_info_meta_box_inside(){
if ( isset( $this->plugin_info ) && is_callable( $this->plugin_info ) ) {
call_user_func( $this->plugin_info );
} else {
if (!$this->bootstrap_plugin_info_meta_box()){
return;
}
do_action( "wphelper/plugin_info_meta_box/inside/{$this->plugin_core->slug()}" );
}
}
/**
* Bootstrap PluginInfoMetaBox
*/
private function bootstrap_plugin_info_meta_box() {
if ( empty( $this->plugin_info_meta_box ) && ! empty( $this->plugin_core ) ){
$this->plugin_info_meta_box = new PluginInfoMetaBox( $this->plugin_core );
} }
// If no plugin_info_meta_box - return false
if ( empty( $this->plugin_info_meta_box ) ) {
return false;
}
return true;
} }
} }
endif; endif;

View File

@ -4,9 +4,9 @@ namespace WPHelper;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
use CMB2; use CMB2;
use CMB2_Options_Hook; use CMB2_Options_Hookup;
if ( ! class_exists( 'WPHelper\CMB2_OptionsPage' ) ): if ( ! class_exists( CMB2_OptionsPage::class ) ):
/** /**
* CMB2_OptionsPage * CMB2_OptionsPage
* *
@ -26,11 +26,21 @@ class CMB2_OptionsPage{
*/ */
public $admin_page; public $admin_page;
/**
* @var array $fields
*/
protected $fields;
/** /**
* @var CMB2 $cmb * @var CMB2 $cmb
*/ */
private $cmb; private $cmb;
/**
* @var array $cmb2_options
*/
protected $cmb2_options;
/** /**
* @param AdminPage $admin_page * @param AdminPage $admin_page
*/ */
@ -48,6 +58,8 @@ class CMB2_OptionsPage{
$settings['option_key'] ??= ( $settings['option_name'] ?? ( $settings['id'] ?? $admin_options['slug'] ) ); $settings['option_key'] ??= ( $settings['option_name'] ?? ( $settings['id'] ?? $admin_options['slug'] ) );
$settings['title'] ??= $admin_options['title']; $settings['title'] ??= $admin_options['title'];
$settings['menu_title'] ??= $admin_options['menu_title']; $settings['menu_title'] ??= $admin_options['menu_title'];
// @todo Only if cmb2-tabs
$settings['tab_title'] ??= $admin_options['tab_title'] ?? $settings['submenu_title'] ?? $settings['menu_title'];
$settings['parent_slug'] ??= $admin_options['parent']; $settings['parent_slug'] ??= $admin_options['parent'];
$settings['position'] ??= $admin_options['position']; $settings['position'] ??= $admin_options['position'];
$settings['icon_url'] ??= $admin_options['icon_url']; $settings['icon_url'] ??= $admin_options['icon_url'];
@ -63,7 +75,8 @@ class CMB2_OptionsPage{
/** /**
* CMB2 only accepts url slug * CMB2 only accepts url slug
* *
* @todo export parent_slug convertion to dedicated method * @todo export parent_slug conversion to dedicated method
* @todo perhaps move this to AdminPage::parent() method
*/ */
switch ( $settings['parent_slug'] ) { switch ( $settings['parent_slug'] ) {
case 'dashboard': case 'dashboard':
@ -116,11 +129,11 @@ class CMB2_OptionsPage{
$settings['tab_title'] ??= $settings['menu_title']; $settings['tab_title'] ??= $settings['menu_title'];
} }
$this->fields = $settings['fields'] ?? [];
/**
* @todo revisit this - might not need to unset fields
*/
if ( isset( $settings['fields'] ) ){ if ( isset( $settings['fields'] ) ){
$this->fields = $settings['fields'];
/**
* @todo revisit this - might not need to unset fields
*/
unset( $settings['fields'] ); unset( $settings['fields'] );
} }
@ -198,12 +211,20 @@ class CMB2_OptionsPage{
/** /**
* Display options-page output. To override, set 'display_cb' box property. * Display options-page output. To override, set 'display_cb' box property.
* *
* @param CMB2_Options_Hook $hookup - instance of Options Page Hookup class (caller of this function) * @param CMB2_Options_Hookup $hookup - instance of Options Page Hookup class (caller of this function)
* *
* @see CMB2_Options_Hook * @see CMB2_Options_Hookup
*/ */
public function options_page_output( $hookup ) { public function options_page_output( $hookup ) {
include $this->admin_page->get_render_tpl();
$options = $this->admin_page->options();
if ( ! empty( $options['plugin_core'] ) || ! empty( $options['plugin_info'] ) ){
include __DIR__ . '/tpl/wrap-cmb2-sidebar.php';
} else {
include __DIR__ . '/tpl/wrap-cmb2-simple.php';
}
} }

View File

@ -3,9 +3,13 @@ namespace WPHelper;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
include_once __DIR__ . '/CMB2_Override_Meta.php'; if ( ! class_exists( CMB2_OptionsPage_Multi::class ) ):
// Require dependency CMB2_Override_Meta
if ( ! trait_exists( CMB2_Override_Meta::class ) ) {
require_once __DIR__ . '/CMB2_Override_Meta.php';
}
if ( ! class_exists( 'WPHelper\CMB2_OptionsPage_Multi' ) ):
/** /**
* CMB2_OptionsPage - MULTI * CMB2_OptionsPage - MULTI
* *

View File

@ -3,7 +3,7 @@ namespace WPHelper;
defined( 'ABSPATH' ) || die( 'No soup for you!' ); defined( 'ABSPATH' ) || die( 'No soup for you!' );
if ( ! trait_exists('CMB2_Override_Meta') ): if ( ! trait_exists( CMB2_Override_Meta::class ) ):
/** /**
* CMB2 Options page override meta * CMB2 Options page override meta
* *

View File

@ -2,27 +2,72 @@
namespace WPHelper; namespace WPHelper;
use DateTime; use DateTime;
use function get_plugin_data;
if ( ! class_exists( 'WPHelper\PluginInfoMetaBox' ) ): if ( ! class_exists( PluginInfoMetaBox::class ) ):
/** /**
* Plugin Info Metabox * Plugin Info Metabox
* *
* Get instance of PluginCore * Get instance of PluginCore
* Render default plugin info box template. * Render default plugin info box template.
*
* @since 0.14
*/ */
class PluginInfoMetaBox{ class PluginInfoMetaBox{
private $tpl = '/tpl/plugin_info_meta_box.php'; private $tpl = '/tpl/plugin_info_meta_box.php';
private $tpl_inside = '/tpl/plugin_info_meta_box-inside.php';
/** /**
* @var PluginCore * @var PluginCore
*/ */
private $plugin_core; public $plugin_core;
function __construct( PluginCore $plugin_core ) function __construct( PluginCore $plugin_core )
{ {
$this->plugin_core = $plugin_core; $this->plugin_core = $plugin_core;
/**
* Allow plugins to render or modify plugin info box
*
* Call: do_action('wphelper/plugin_info_meta_box/{$slug}')
* action used in AdminPage::render_plugin_info_meta_box()
*
* @since 0.23
*/
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' ] );
}
/**
* Setup args used in template.
*
* @todo move 'repo' setup to method from template
*/
function setup_template_args() {
$plugin_data = $this->plugin_core->plugin_data();
$last_update = $plugin_data['Last Update'] ?: $plugin_data['Release Date'];
$last_update = DateTime::createFromFormat('Y_m_d', $last_update);
if ($last_update) {
$diff = (int) abs( time() - $last_update->format('U') );
if ( $diff < (DAY_IN_SECONDS) ){
$update_message = 'Today';
}elseif ($diff < (2 * DAY_IN_SECONDS)){
$update_message = 'Yesterday';
}else{
$update_message = human_time_diff($last_update->format('U')) . ' ago';
}
} else {
$update_message = '';
}
return compact('plugin_data','update_message');
} }
/** /**
@ -33,33 +78,25 @@ class PluginInfoMetaBox{
* @since iac_engine 1.1.0 * @since iac_engine 1.1.0
* @since iac_engine 1.2.0 plugin_info_box now a function * @since iac_engine 1.2.0 plugin_info_box now a function
* @since iac_engine 1.3.0 use 'Last Update' header * @since iac_engine 1.3.0 use 'Last Update' header
* @since 0.14 PluginInfoMetaBox::plugin_info_box()
*
* @todo rename method render()
*/ */
function plugin_info_box(){ function plugin_info_box(){
$args = $this->setup_template_args();
$plugin_data = get_plugin_data( $this->plugin_core->file() , false ); // false = no markup (i think) extract($args);
$last_update = $plugin_data['Last Update'] ?: $plugin_data['Release Date'];
$last_update = DateTime::createFromFormat('Y_m_d', $last_update);
// $last_update = new DateTime('now');
// $last_update->add(new DateInterval('P1D'));
// $last_update->add(new DateInterval('P2D'));
if ($last_update):
$diff = (int) abs( time() - $last_update->format('U') );
if ( $diff < (DAY_IN_SECONDS) ){
$update_message = 'Today';
}elseif ($diff < (2 * DAY_IN_SECONDS)){
$update_message = 'Yesterday';
}else{
$update_message = human_time_diff($last_update->format('U')) . ' ago';
}
else:
$update_message = '';
endif;
include __DIR__ . $this->tpl; include __DIR__ . $this->tpl;
} }
/**
* Only print meta-box .inside
* No header.
*/
function inside(){
$args = $this->setup_template_args();
extract($args);
include __DIR__ . $this->tpl_inside;
}
} }
endif; endif;

View File

@ -9,7 +9,7 @@ use function add_settings_field;
use function checked; use function checked;
use function get_option; use function get_option;
if ( ! class_exists( 'WPHelper\SettingsPage' ) ): if ( ! class_exists( SettingsPage::class ) ):
/** /**
* SettingsPage * SettingsPage
* *
@ -64,6 +64,13 @@ class SettingsPage{
*/ */
public $fields = []; public $fields = [];
/**
* Sanitize Callback
*
* @var Callable $sanitize_callback
*/
public $sanitize_callback;
/** /**
* Constructor. * Constructor.
* *
@ -89,18 +96,20 @@ class SettingsPage{
$this->option_group = $settings['option_group'] ?? $this->page . '_option_group'; $this->option_group = $settings['option_group'] ?? $this->page . '_option_group';
foreach ( $settings['sections'] as $section ) { $this->sanitize_callback = $settings['sanitize_callback'] ?? null;
// PHP Warning: foreach() argument must be of type array|object
foreach ( $settings['sections'] ?? [] as $section ) {
// extract fields // extract fields
foreach ( $section['fields'] as $field ){ foreach ( $section['fields'] as $field ){
$field['section_id'] = $section['id']; // create back-reference in field to section. ( @see add_settings_field() ) $field['section_id'] = $section['id']; // create back-reference in field to section. ( @see add_settings_field() )
$field['name'] = $this->option_name . '[' . $field['id'] . ']';
$this->fields[] = $field; $this->fields[] = $field;
} }
unset( $section['fields'] ); unset( $section['fields'] );
$this->sections[] = $section; // save without fields $this->sections[] = $section; // save without fields
} }
}
function setup() {
add_action( 'admin_init', [ $this, 'register_settings' ] ); add_action( 'admin_init', [ $this, 'register_settings' ] );
} }
@ -108,7 +117,7 @@ class SettingsPage{
register_setting( register_setting(
$this->option_group, // $option_group - A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields() $this->option_group, // $option_group - A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()
$this->option_name, // $option_name - The name of an option to sanitize and save. $this->option_name, // $option_name - The name of an option to sanitize and save.
[ $this,'sanitize_settings' ] // $sanitize_callback - A callback function that sanitizes the option's value. (see also: built-in php callbacks) $this->sanitize_callback ?? [ $this,'sanitize_settings' ] // callback ?? fallback // $sanitize_callback - A callback function that sanitizes the option's value. (see also: built-in php callbacks)
); );
foreach ( $this->sections as $section ){ foreach ( $this->sections as $section ){
@ -125,7 +134,7 @@ class SettingsPage{
add_settings_field( add_settings_field(
$field['id'], $field['id'],
$field['title'], $field['title'],
[ $this, "print_{$field['type']}" ], $field['render'] ?? [ $this, "print_{$field['type']}" ],
$this->page, // can built-in pages: (general, reading, writing, ...) $this->page, // can built-in pages: (general, reading, writing, ...)
$field['section_id'], $field['section_id'],
$field //send setting array as $args for print function $field //send setting array as $args for print function
@ -135,8 +144,8 @@ class SettingsPage{
} }
/** /**
* Print text input field * Print checkbox input field
* Support field type 'text' * Support field type 'checkbox'
* *
* @since 0.11 * @since 0.11
*/ */
@ -147,10 +156,11 @@ class SettingsPage{
$input_tag = sprintf( $input_tag = sprintf(
'<label for="%1$s"> '<label for="%1$s">
<input name="%2$s[%1$s]" type="checkbox" id="%1$s" value="1" %4$s /> <input name="%2$s" type="checkbox" id="%1$s" aria-describedby="%1$s-description" value="1" %4$s />
%3$s</label>', %3$s
</label>',
$id, $id,
$this->option_name, $name,
$description, $description,
checked( ( $options[$id] ?? false ), '1', false) checked( ( $options[$id] ?? false ), '1', false)
); );
@ -176,10 +186,11 @@ class SettingsPage{
$options = get_option( $this->option_name ); $options = get_option( $this->option_name );
$input_tag = sprintf( $input_tag = sprintf(
'<input name="%2$s[%1$s]" type="text" id="%1$s" value="%3$s" class="regular-text">', '<input name="%2$s" type="text" id="%1$s" aria-describedby="%1$s-description" value="%3$s" placeholder="%4$s" class="regular-text">',
$id, $id,
$this->option_name, $name,
$default $options[$id] ?: $default ?? '',
$placeholder ?? ''
); );
if ( ! empty( $description ) ) { if ( ! empty( $description ) ) {
@ -211,10 +222,11 @@ class SettingsPage{
$options = get_option( $this->option_name ); $options = get_option( $this->option_name );
$input_tag = sprintf( $input_tag = sprintf(
'<input name="%2$s[%1$s]" type="url" id="%1$s" value="%3$s" class="regular-text code ">', '<input name="%2$s" type="url" id="%1$s" aria-describedby="%1$s-description" placeholder="%4$s" value="%3$s" class="regular-text code ">',
$id, $id,
$this->option_name, $name,
$default $options[$id] ?: $default ?? '',
$placeholder ?? ''
); );
if ( ! empty( $description ) ) { if ( ! empty( $description ) ) {
@ -246,10 +258,11 @@ class SettingsPage{
$options = get_option( $this->option_name ); $options = get_option( $this->option_name );
$input_tag = sprintf( $input_tag = sprintf(
'<input name="%2$s[%1$s]" type="email" id="%1$s" aria-describedby="%1$s-description" value="%3$s" class="regular-text ltr">', '<input name="%2$s" type="email" id="%1$s" aria-describedby="%1$s-description" placeholder="%4$s" value="%3$s" class="regular-text ltr">',
$id, $id,
$this->option_name, $name,
$default $options[$id] ?: $default ?? '',
$placeholder ?? ''
); );
if ( ! empty( $description ) ) { if ( ! empty( $description ) ) {
@ -269,6 +282,42 @@ class SettingsPage{
} }
/**
* Print email input field
* Support field type 'email'
*
* @since 0.23
*/
function print_textarea( $field ){
extract($field);
$options = get_option( $this->option_name );
$textarea = sprintf(
'<textarea class="regular-text" rows="5" id="%1$s-description" name="%2$s" placeholder="%4$s">%3$s</textarea>',
$id,
$name,
$options[$id] ?: $default ?? '',
$placeholder ?? ''
);
if ( ! empty( $description ) ) {
$textarea .= sprintf(
'<p class="description" id="%1$s-description">%2$s</p>',
$id,
$description
);
}
/**
* Allow plugins to directly manipulate field HTML
*/
$textarea = apply_filters( 'wphelper/settings_page/textarea', $textarea, $field, $this->option_name, $options );
echo $textarea;
}
/** /**
* Sanitizes entire $options array. * Sanitizes entire $options array.
*/ */
@ -276,17 +325,18 @@ class SettingsPage{
$new_options = []; $new_options = [];
foreach( $options as $id => $option ) { foreach( $options as $id => $option ) {
$field = reset( $field = current(
array_filter( array_filter(
$this->fields, $this->fields,
fn($item) => $item['id'] == $id fn($item) => $item['id'] == $id
) )
); );
switch ( $field['type'] ){ switch ( $field['type'] ) {
case 'checkbox': case 'checkbox':
$new_options[$id] = $option == 1 ? 1 : 0; $new_options[$id] = $option == 1 ? 1 : 0;
break; break;
case 'text': case 'text':
case 'textarea':
$new_options[$id] = sanitize_text_field( $option ); $new_options[$id] = sanitize_text_field( $option );
break; break;
case 'email': case 'email':

View File

@ -1,13 +0,0 @@
<?php
/**
* Template for CMB2 Options Page
*
* @var WPHelper\CMB2_Options_Page $this
* @var CMB2_Options_Hook $hookup
*/
?>
<div class="wrap cmb2-options-page option-<?php echo esc_attr( sanitize_html_class( $hookup->option_key ) ); ?>">
<?php include 'cmb-title.php' ?>
<?php include 'tab-nav.php' ?>
<?php include 'cmb-form.php' ?>
</div>

View File

@ -0,0 +1,27 @@
<?php
/**
* Plugin Info Metabox - .inside
*/
?>
<h3 style="font-weight: 100; font-size: 1.5em;"><?php echo $plugin_data['Name']; ?></h3>
<p>
<?php if ( ! empty( $plugin_data['Version'] ) ): ?>
Version: <?php echo $plugin_data['Version']; ?><br/>
<?php endif; ?>
<?php if ( ! empty( $plugin_data['Author'] ) ): ?>
Author:
<?php if ( ! empty( $plugin_data['AuthorURI'] ) ): ?>
<a href="<?php echo $plugin_data['AuthorURI'] ?>"><?php echo $plugin_data['Author']; ?></a><br/>
<?php else: ?>
<?php echo $plugin_data['Author']; ?><br/>
<?php endif; ?>
<?php endif; ?>
<?php if ( ! empty( $plugin_data['UpdateURI'] ) || ! empty( $plugin_data['PluginURI'] ) ): ?>
Repo: <a href="<?php echo $plugin_data['UpdateURI'] ?: $plugin_data['PluginURI']; ?>">
<?php echo $plugin_data['TextDomain'] ?? $this->$plugin_core->slug(); ?>
</a><br/>
<?php endif; ?>
<?php if ( ! empty( $update_message ) ): ?>
Last Updated: <?php echo $update_message; ?>
<?php endif; ?>
</p>

View File

@ -3,25 +3,10 @@
* Plugin Info Metabox * Plugin Info Metabox
*/ */
?> ?>
<style>
#plugin_info h2 {
border-bottom: 1px solid #eee;
}
#plugin_info h3{
font-weight: 100;
font-size: 1.5em;
}
</style>
<div id="plugin_info" class="postbox"> <div id="plugin_info" class="postbox">
<h2><span>Plugin Info</span></h2> <h2 style="border-bottom: 1px solid #eee;"><span>Plugin Info</span></h2>
<div class="inside"> <div class="inside">
<h3><?=$plugin_data['Name'] ?></h3> <?php include __DIR__ . '/plugin_info_meta_box-inside.php'; ?>
<p>
Version: <?= $plugin_data['Version'] ?><br/>
Author: <a href="<?= $plugin_data['AuthorURI'] ?>"><?= $plugin_data['Author'] ?></a><br/>
GitHub: <a href="<?= $plugin_data['PluginURI'] ?>"><?= $plugin_data['TextDomain'] ?></a><br/>
<?php if ( ! empty( $update_message ) ): ?>Last Updated: <?= $update_message ?><?php endif; ?>
</p>
</div><!-- .inside --> </div><!-- .inside -->
</div><!-- .postbox --> </div><!-- .postbox -->

View File

@ -0,0 +1,41 @@
<?php
/**
* Bootstrap WordPress core meta-boxes to generate metaboxes
*
* @var WPHelper\AdminPage $this
*/
?>
<style>
/*
we don't actually have draggable/movable metaboxes
.hide-if-no-js / hidden classes would help
*/
.handle-actions {
display: none;
}
.postbox .postbox-header .hndle {
cursor: unset;
}
</style>
<?php
/**
* Allow meta-boxes to hook to this page ('side' context).
*
*
*/
do_action('add_meta_boxes', $this->get_hook_suffix(), 'side' );
/**
* Remove 'Featured Image' meta-box added by core.
*
* @see register_and_do_post_meta_boxes() (wp-admin/includes/meta-boxes.php)
* @todo Investigate why $thumbnail_support returns true for our pages.
*/
remove_meta_box( 'postimagediv', $this->get_hook_suffix(), 'side' );
/**
* Render meta-boxes
*
* Renders div.meta-box-sortables
*/
do_meta_boxes( $this->get_hook_suffix(), 'side', null );

View File

@ -4,7 +4,7 @@
* *
* Print tabs navigation row. * Print tabs navigation row.
* *
* @var CMB2_Options_Hook $hookup * @var CMB2_Options_Hookup $hookup
*/ */
if ( ! isset( $hookup ) ){ if ( ! isset( $hookup ) ){
return; return;

View File

@ -0,0 +1,5 @@
<?php
/**
*
*/
do_action ( 'wphelper/adminpage/tab_nav' );

View File

@ -2,7 +2,7 @@
/** /**
* Template for CMB2 page title * Template for CMB2 page title
* *
* @var WPHelper\CMB2_Options_Page $this * @var WPHelper\CMB2_OptionsPage $this
*/ */
if ( $this->cmb->prop( 'title' ) ) { if ( $this->cmb->prop( 'title' ) ) {
echo '<h2>' . wp_kses_post( $this->cmb->prop( 'title' ) ) . '</h2>'; echo '<h2>' . wp_kses_post( $this->cmb->prop( 'title' ) ) . '</h2>';

View File

@ -2,8 +2,8 @@
/** /**
* Template for CMB2 Options Page * Template for CMB2 Options Page
* *
* @var WPHelper\CMB2_Options_Page $this * @var WPHelper\CMB2_OptionsPage $this
* @var CMB2_Options_Hook $hookup * @var CMB2_Options_Hookup $hookup
*/ */
?> ?>
<style> <style>
@ -17,8 +17,8 @@
</style> </style>
<div class="wrap cmb2-options-page option-<?php echo esc_attr( sanitize_html_class( $hookup->option_key ) ); ?>"> <div class="wrap cmb2-options-page option-<?php echo esc_attr( sanitize_html_class( $hookup->option_key ) ); ?>">
<?php include 'cmb-title.php' ?> <?php include 'title-cmb2.php' ?>
<?php include 'tab-nav.php' ?> <?php include 'tab-nav-cmb2.php' ?>
<div id="poststuff"> <div id="poststuff">
<div id="post-body" class="metabox-holder columns-2"> <div id="post-body" class="metabox-holder columns-2">
@ -26,7 +26,7 @@
<!-- main content --> <!-- main content -->
<div id="post-body-content"> <div id="post-body-content">
<div class="meta-box-sortables ui-sortable tabs-content"> <div class="meta-box-sortables ui-sortable tabs-content">
<?php include 'cmb-form.php' ?> <?php include 'form-cmb2.php' ?>
</div><!-- .meta-box-sortables --> </div><!-- .meta-box-sortables -->
</div><!-- #post-body-content --> </div><!-- #post-body-content -->

View File

@ -0,0 +1,13 @@
<?php
/**
* Template for CMB2 Options Page
*
* @var WPHelper\CMB2_OptionsPage $this
* @var CMB2_Options_Hookup $hookup
*/
?>
<div class="wrap cmb2-options-page option-<?php echo esc_attr( sanitize_html_class( $hookup->option_key ) ); ?>">
<?php include 'title-cmb2.php' ?>
<?php include 'tab-nav-cmb2.php' ?>
<?php include 'form-cmb2.php' ?>
</div>

View File

@ -1,3 +1,10 @@
<?php
/**
* WordPress admin 'wrap' div
*
* @var WPHelper\AdminPage $this
*/
?>
<div class="wrap"> <div class="wrap">
<h1><?= get_admin_page_title() ?></h1> <h1><?= get_admin_page_title() ?></h1>

View File

@ -3,12 +3,12 @@
* Template for CMB2 Options Page * Template for CMB2 Options Page
* *
* @var string $ob_content - Render template or callback * @var string $ob_content - Render template or callback
* @var AdminPage $this * @var WPHelper\AdminPage $this
*/ */
?> ?>
<div class="wrap"> <div class="wrap">
<h1><?= get_admin_page_title() ?></h1> <h1><?= get_admin_page_title() ?></h1>
<?php include 'tab-nav.php' ?> <?php include 'tab-nav-simple.php' ?>
<div id="poststuff"> <div id="poststuff">
<div id="post-body" class="metabox-holder columns-2"> <div id="post-body" class="metabox-holder columns-2">
@ -21,9 +21,7 @@
<!-- sidebar --> <!-- sidebar -->
<div id="postbox-container-1" class="postbox-container"> <div id="postbox-container-1" class="postbox-container">
<div class="meta-box-sortables"> <?php include 'sidebar-add-meta-boxes.php'; ?>
<?php do_action("wphelper/adminpage/plugin_info_box/{$this->get_slug()}"); ?>
</div><!-- .meta-box-sortables -->
</div><!-- #postbox-container-1 .postbox-container --> </div><!-- #postbox-container-1 .postbox-container -->
</div><!-- #post-body --> </div><!-- #post-body -->
<div class="clear"></div> <div class="clear"></div>

View File

@ -1,10 +1,12 @@
<?php <?php
/** /**
* Simple wrap * Simple wrap
*
* @var string $ob_content - Render template or callback
*/ */
?> ?>
<div class="wrap"> <div class="wrap">
<h1><?= get_admin_page_title() ?></h1> <h1><?= get_admin_page_title() ?></h1>
<?php include 'tab-nav.php' ?> <?php include 'tab-nav-simple.php' ?>
<?php echo $ob_content; ?> <?php echo $ob_content; ?>
</div> </div>

View File

@ -1,5 +1,23 @@
# WPHelper\PluginCore Changelog # WPHelper\PluginCore Changelog
## 0.26
Release Date: Jun 9, 2023
### Fixed
- Fix passing PluginCore instance to AdminPage constructor in `admin_page()` method.
## 0.25
Release Date: Feb 3, 2023
### Added
- Property `token` and method `token`. Lowercase underscore token to be used as variable name.
## 0.24
Release Date: Jan 13, 2023
### Added
- Static `get_by_file` method. Get PluginCore instance by plugin filename.
## 0.23 ## 0.23
Release Date: Aug 8, 2022 Release Date: Aug 8, 2022

View File

@ -1,24 +1,25 @@
<?php <?php
namespace WPHelper; namespace WPHelper;
use Puc_v4_Factory; 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' ) ):
// require dependency get_plugin_data()
if( ! function_exists('get_plugin_data') ) { if( ! function_exists('get_plugin_data') ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
} }
if ( ! class_exists( 'WPHelper/PluginCore' ) ):
/** /**
* PluginCore * PluginCore
* *
* Helper Class for creating WordPress Plugins * Helper Class for creating WordPress Plugins
* *
* Defines PLUGIN_PATH, PLUGIN_URL (etc.) constants
* (@see README.md) * (@see README.md)
* *
* @version 0.23 * @version 0.26
*/ */
class PluginCore { class PluginCore {
@ -42,6 +43,11 @@ class PluginCore {
*/ */
private $const; private $const;
/**
* @var string
*/
private $token;
/** /**
* @var string * @var string
*/ */
@ -57,6 +63,11 @@ class PluginCore {
*/ */
private $plugin_basename; private $plugin_basename;
/**
* @var array plugin header metadata
*/
private $plugin_data;
/** /**
* @var callable * @var callable
*/ */
@ -107,19 +118,20 @@ class PluginCore {
*/ */
private $update_branch; private $update_branch;
/** /**
* Static array of all PluginCore instances * Static array of all PluginCore instances
* Used in PluginCore::get($slug) * Used in PluginCore::get($slug)
* *
* @var array[PluginCore] Instances of PluginCore * @var array[PluginCore] Instances of PluginCore
*/ */
static $cores = []; private static $cores = [];
/** /**
* Retrieve instance of PluginCore by plugin slug. * Retrieve instance of PluginCore by plugin slug.
* *
* @since 0.5
*
* @param string $slug - Plugin slug * @param string $slug - Plugin slug
* @return PluginCore - Instance of specific plugin. * @return PluginCore - Instance of specific plugin.
*/ */
@ -127,6 +139,29 @@ class PluginCore {
return self::$cores[ $slug ] ?? null; return self::$cores[ $slug ] ?? null;
} }
/**
* Retrieve instance of PluginCore by plugin __FILE__.
*
* @since 0.24
*
* @param string $filename - Plugin filename
* @return PluginCore - Instance of specific plugin.
*/
static public function get_by_file( $filename ) {
return current(
array_filter(
self::$cores,
fn($core) => $core->file() == $filename
)
) ?: null;
}
/**
* Constructor
*
* @since 0.1
* @since 0.2 Accept filename as first param and options array as optional param
*/
function __construct( $plugin_file, $options = null ) { function __construct( $plugin_file, $options = null ) {
$this->plugin_file( $plugin_file ); $this->plugin_file( $plugin_file );
@ -141,6 +176,8 @@ class PluginCore {
$this->const( $options->const ?? null ); // fallback: generate const from slug $this->const( $options->const ?? null ); // fallback: generate const from slug
$this->token( $options->token ?? null ); // fallback: generate token from slug
if ( isset( $options->activate_cb ) ) if ( isset( $options->activate_cb ) )
$this->activate_cb( $options->activate_cb ); $this->activate_cb( $options->activate_cb );
@ -177,6 +214,9 @@ class PluginCore {
* Register activation, deactivation, uninstall, upgrade hooks. * Register activation, deactivation, uninstall, upgrade hooks.
* Init PUC update checker. * Init PUC update checker.
* *
* @since 0.1 setup()
* @since 0.21 bootstrap()
*
* @todo set plugin_dir_path, plugin_basename as accessible public variables (available thru methods atm) * @todo set plugin_dir_path, plugin_basename as accessible public variables (available thru methods atm)
*/ */
private function bootstrap() { private function bootstrap() {
@ -216,6 +256,11 @@ class PluginCore {
} }
} }
/**
* Register activation/deactivation/uninstall/upgrade hooks
*
* @since 0.5
*/
private function register_hooks() { private function register_hooks() {
if ( ! empty( $this->activate_cb ) ) // && is_callable() ? if ( ! empty( $this->activate_cb ) ) // && is_callable() ?
@ -236,6 +281,8 @@ class PluginCore {
* Plugin title. * Plugin title.
* If none provided - plugin header Title will be used. * If none provided - plugin header Title will be used.
* *
* @since 0.1
*
* @param string|null $title * @param string|null $title
* @return string $this->title * @return string $this->title
*/ */
@ -246,6 +293,8 @@ class PluginCore {
/** /**
* Wrapper function for $this->title() * Wrapper function for $this->title()
* *
* @since 0.6
*
* @deprecated * @deprecated
*/ */
public function name( $title = null ) { public function name( $title = null ) {
@ -258,6 +307,8 @@ class PluginCore {
* Plugin slug. * Plugin slug.
* If none provided - plugin file basename will be used * If none provided - plugin file basename will be used
* *
* @since 0.1
*
* @param string|null $slug * @param string|null $slug
* @return string $this->slug * @return string $this->slug
*/ */
@ -269,6 +320,8 @@ class PluginCore {
* Setter - plugin_file (also Getter - kinda) * Setter - plugin_file (also Getter - kinda)
* Plugin file fully qualified path. * Plugin file fully qualified path.
* *
* @since 0.1
*
* @param string $plugin_file - Path to plugin file * @param string $plugin_file - Path to plugin file
* @return string $this->plugin_file * @return string $this->plugin_file
*/ */
@ -281,6 +334,8 @@ class PluginCore {
* Might have to rethink this * Might have to rethink this
* used by test-plugin update_checker * used by test-plugin update_checker
* *
* @since 0.7
*
* @todo revisit this * @todo revisit this
*/ */
public function file() { public function file() {
@ -290,9 +345,11 @@ class PluginCore {
/** /**
* Getter/Setter - plugin data array * Getter/Setter - plugin data array
*
* @since 0.14
*/ */
public function plugin_data() { public function plugin_data() {
return $this->plugin_data ??= get_plugin_data( $this->plugin_file, false); return $this->plugin_data ??= get_plugin_data( $this->plugin_file, false ); // false = no markup (i think)
} }
/** /**
@ -300,6 +357,8 @@ class PluginCore {
* Prefix of plugin specific defines (PLUGIN_NAME_PATH etc.) * Prefix of plugin specific defines (PLUGIN_NAME_PATH etc.)
* If not provided - plugin slug will be uppercase. * If not provided - plugin slug will be uppercase.
* *
* @since 0.4
*
* @param string|null $const (string should be uppercase) * @param string|null $const (string should be uppercase)
* @return string $this->const * @return string $this->const
*/ */
@ -307,8 +366,23 @@ class PluginCore {
return $this->const ??= $const ?: str_replace( '-', '_' , strtoupper( $this->slug() ) ); return $this->const ??= $const ?: str_replace( '-', '_' , strtoupper( $this->slug() ) );
} }
/**
* Getter/Setter - token
* Create a single-token slug (convert to underscore + lowercase).
*
* @since 0.25
*
* @param string|null $token (string will be normalized)
* @return string $this->token
*/
public function token( $token = null ) {
return $this->token ??= str_replace( '-', '_' , strtolower( $token ?: $this->slug() ) );
}
/** /**
* Getter/setter * Getter/setter
*
* @since 0.6
*/ */
public function path() { public function path() {
return $this->path ??= plugin_dir_path( $this->plugin_file ); return $this->path ??= plugin_dir_path( $this->plugin_file );
@ -316,6 +390,8 @@ class PluginCore {
/** /**
* Getter/Setter * Getter/Setter
*
* @since 0.6
*/ */
public function url() { public function url() {
return $this->url ??= plugin_dir_url( $this->plugin_file ); return $this->url ??= plugin_dir_url( $this->plugin_file );
@ -323,6 +399,8 @@ class PluginCore {
/** /**
* Getter/Setter * Getter/Setter
*
* @since 0.12
*/ */
public function plugin_basename() { public function plugin_basename() {
return $this->plugin_basename ??= plugin_basename( $this->plugin_file ); return $this->plugin_basename ??= plugin_basename( $this->plugin_file );
@ -333,6 +411,8 @@ class PluginCore {
* Callback runs on 'register_activation_hook' * Callback runs on 'register_activation_hook'
* PluginCore does not validate. Authors must ensure valid callback. * PluginCore does not validate. Authors must ensure valid callback.
* *
* @since 0.4
*
* @param callable $activate_cb - Activation callback * @param callable $activate_cb - Activation callback
* *
* @access private * @access private
@ -346,6 +426,8 @@ class PluginCore {
* Callback runs on 'register_deactivation_hook' * Callback runs on 'register_deactivation_hook'
* PluginCore does not validate. Authors must ensure valid callback. * PluginCore does not validate. Authors must ensure valid callback.
* *
* @since 0.4
*
* @param callable $deactivate_cb - Deactivation callback. * @param callable $deactivate_cb - Deactivation callback.
* *
* @access private * @access private
@ -359,6 +441,8 @@ class PluginCore {
* Callback runs on 'register_uninstall_hook' * Callback runs on 'register_uninstall_hook'
* PluginCore does not validate. Authors must ensure valid callback. * PluginCore does not validate. Authors must ensure valid callback.
* *
* @since 0.4
*
* @param callable $uninstall_cb - Uninstall callback. * @param callable $uninstall_cb - Uninstall callback.
* *
* @access private * @access private
@ -375,6 +459,8 @@ class PluginCore {
* *
* PluginCore does not validate. Authors must ensure valid callback. * PluginCore does not validate. Authors must ensure valid callback.
* *
* @since 0.11
*
* @param callable $upgrade_cb - Upgrade callback. * @param callable $upgrade_cb - Upgrade callback.
* *
* @access private * @access private
@ -407,26 +493,27 @@ class PluginCore {
/** /**
* Getter/Setter - AdminPage * Getter/Setter - AdminPage
* *
* Construct AdminPage instance for plugin. * Construct AdminPage instance for plugin.
*
* @since 0.14
* @since 0.17 - Pass instance of PluginCore to AdminPage (~0.14)
* *
* @param array $admin_page - AdminPage settings array * @param array $admin_page - AdminPage settings array
*
* @return AdminPage * @return AdminPage
*/ */
public function admin_page( $admin_page ) { public function admin_page( $admin_page ) {
if ( ! class_exists( 'WPHelper\AdminPage' ) ) if ( ! class_exists( AdminPage::class ) )
return; return;
// validate if ( ! isset( $this->admin_page ) ){
$admin_page['slug'] ??= $this->slug();
$admin_page['title'] ??= $this->title(); // validate
$admin_page['slug'] ??= $this->slug();
$this->admin_page = new AdminPage( $admin_page ); $admin_page['title'] ??= $this->title();
$admin_page['plugin_core'] ??= $this;
// validate for older versions of AdminPage
if ( method_exists( $this->admin_page, 'plugin_core' ) ) { $this->admin_page = new AdminPage( $admin_page );
$this->admin_page->plugin_core( $this ); // back-reference
} }
return $this->admin_page; return $this->admin_page;
@ -435,13 +522,15 @@ class PluginCore {
/** /**
* Setter * Setter
* *
* Setup info used by Puc_v4_Factory * Setup info used by PucFactory
* *
* set $update_checker (bool) * set $update_checker (bool)
* set $update_repo_uri (string) * set $update_repo_uri (string)
* set $update_auth (optional) * set $update_auth (optional)
* set $update_branch (optional) * set $update_branch (optional)
* *
* @since 0.9
*
* @param bool|string|array $update_checker * @param bool|string|array $update_checker
*/ */
private function update_checker( $update_checker ) { private function update_checker( $update_checker ) {
@ -490,14 +579,17 @@ class PluginCore {
/** /**
* Init Puc update checker instance * Init Puc update checker instance
* *
* @uses Puc_v4_Factory::buildUpdateChecker * @since 0.9 init_update_checker()
* @since 0.21 build_update_checker()
*
* @uses PucFactory::buildUpdateChecker
*/ */
private function build_update_checker() { private function build_update_checker() {
if ( ! class_exists('Puc_v4_Factory') ) if ( ! class_exists( PucFactory::class ) )
return; return;
$update_checker = Puc_v4_Factory::buildUpdateChecker( $update_checker = PucFactory::buildUpdateChecker(
$this->update_repo_uri, $this->update_repo_uri,
$this->plugin_file, $this->plugin_file,
$this->slug() // using slug() $this->slug() // using slug()
@ -520,6 +612,8 @@ class PluginCore {
* This function called on upgrader_process_complete * This function called on upgrader_process_complete
* sanity-checks if our plugin was upgraded * sanity-checks if our plugin was upgraded
* if so - calls upgrade_cb provided by our plugin * if so - calls upgrade_cb provided by our plugin
*
* @since 0.12
*/ */
public function upgrade_cb_wrapper( $upgrader_object, $options ) { public function upgrade_cb_wrapper( $upgrader_object, $options ) {
if( if(

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.23", "version": "0.26",
"time": "2022-08-06", "time": "2022-06-09",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"suggest": { "suggest": {
"yahnis-elsts/plugin-update-checker": "~4.12", "yahnis-elsts/plugin-update-checker": "~4.12",
"abuyoyo/adminmenupage": "~0.20" "abuyoyo/adminmenupage": "~0.25"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -2,26 +2,26 @@
"packages": [ "packages": [
{ {
"name": "abuyoyo/adminmenupage", "name": "abuyoyo/adminmenupage",
"version": "0.21", "version": "0.25",
"version_normalized": "0.21.0.0", "version_normalized": "0.25.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/AdminMenuPage.git", "url": "https://github.com/abuyoyo/AdminMenuPage.git",
"reference": "d05a9e9977d7e7c4ba3c913993493fefba4359d6" "reference": "487d262aec77a9a3ce04fa762e9048f30d22f123"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/d05a9e9977d7e7c4ba3c913993493fefba4359d6", "url": "https://api.github.com/repos/abuyoyo/AdminMenuPage/zipball/487d262aec77a9a3ce04fa762e9048f30d22f123",
"reference": "d05a9e9977d7e7c4ba3c913993493fefba4359d6", "reference": "487d262aec77a9a3ce04fa762e9048f30d22f123",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/plugincore": "~0.18", "abuyoyo/plugincore": "~0.26",
"cmb2/cmb2": "~2.9" "cmb2/cmb2": "~2.9"
}, },
"time": "2022-08-06T13:42:37+00:00", "time": "2023-06-09T00:00:00+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"files": [ "files": [
"wph_admin_page.php" "wph_admin_page.php"
@ -37,30 +37,30 @@
"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.21" "source": "https://github.com/abuyoyo/AdminMenuPage/tree/0.25"
}, },
"install-path": "../abuyoyo/adminmenupage" "install-path": "../abuyoyo/adminmenupage"
}, },
{ {
"name": "abuyoyo/plugincore", "name": "abuyoyo/plugincore",
"version": "0.23", "version": "0.26",
"version_normalized": "0.23.0.0", "version_normalized": "0.26.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/abuyoyo/PluginCore.git", "url": "https://github.com/abuyoyo/PluginCore.git",
"reference": "0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4" "reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4", "url": "https://api.github.com/repos/abuyoyo/PluginCore/zipball/77f7d5451bdff4bda6c9766847b215bdeaca96d6",
"reference": "0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4", "reference": "77f7d5451bdff4bda6c9766847b215bdeaca96d6",
"shasum": "" "shasum": ""
}, },
"suggest": { "suggest": {
"abuyoyo/adminmenupage": "~0.20", "abuyoyo/adminmenupage": "~0.25",
"yahnis-elsts/plugin-update-checker": "~4.12" "yahnis-elsts/plugin-update-checker": "~4.12"
}, },
"time": "2022-08-06T00:00:00+00:00", "time": "2022-06-09T00:00:00+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -75,7 +75,7 @@
"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.23" "source": "https://github.com/abuyoyo/PluginCore/tree/0.26"
}, },
"install-path": "../abuyoyo/plugincore" "install-path": "../abuyoyo/plugincore"
}, },

View File

@ -11,12 +11,12 @@
), ),
'versions' => array( 'versions' => array(
'abuyoyo/adminmenupage' => array( 'abuyoyo/adminmenupage' => array(
'pretty_version' => '0.21', 'pretty_version' => '0.25',
'version' => '0.21.0.0', 'version' => '0.25.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/adminmenupage', 'install_path' => __DIR__ . '/../abuyoyo/adminmenupage',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd05a9e9977d7e7c4ba3c913993493fefba4359d6', 'reference' => '487d262aec77a9a3ce04fa762e9048f30d22f123',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/notice-manager' => array( 'abuyoyo/notice-manager' => array(
@ -29,12 +29,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/plugincore' => array( 'abuyoyo/plugincore' => array(
'pretty_version' => '0.23', 'pretty_version' => '0.26',
'version' => '0.23.0.0', 'version' => '0.26.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abuyoyo/plugincore', 'install_path' => __DIR__ . '/../abuyoyo/plugincore',
'aliases' => array(), 'aliases' => array(),
'reference' => '0a5809d6722a2abf0bdaf23f73bd3875b00fd2a4', 'reference' => '77f7d5451bdff4bda6c9766847b215bdeaca96d6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'abuyoyo/screen-meta-links' => array( 'abuyoyo/screen-meta-links' => array(