mirror of
https://github.com/WPMultisite/wp-multisite-subscriptions.git
synced 2025-08-07 01:33:44 +08:00
重命名:分叉 WP Ultimo
This commit is contained in:
parent
675cc66211
commit
afc807397f
5350 changed files with 1354268 additions and 604 deletions
64
inc/managers/class-block-manager.php
Normal file
64
inc/managers/class-block-manager.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Block Manager
|
||||
*
|
||||
* Manages the registering of gutenberg blocks.
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage Managers/Block
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\Managers;
|
||||
|
||||
use WP_Ultimo\Managers\Base_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Handles the ajax form registering, rendering, and permissions checking.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Block_Manager extends Base_Manager {
|
||||
|
||||
use \WP_Ultimo\Traits\Singleton;
|
||||
|
||||
/**
|
||||
* Instantiate the necessary hooks.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
global $wp_version;
|
||||
|
||||
$hook = version_compare($wp_version, '5.8', '<') ? 'block_categories' : 'block_categories_all';
|
||||
|
||||
add_filter($hook, array($this, 'add_wp_ultimo_block_category'), 1, 2);
|
||||
|
||||
} // end init;
|
||||
|
||||
/**
|
||||
* Adds wp-ultimo as a Block category on Gutenberg.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param array $categories List of categories.
|
||||
* @param \WP_Post $post Post being edited.
|
||||
* @return array
|
||||
*/
|
||||
public function add_wp_ultimo_block_category($categories, $post) {
|
||||
|
||||
return array_merge($categories, array(
|
||||
array(
|
||||
'slug' => 'wp-ultimo',
|
||||
'title' => __('Multisite WaaS', 'wp-ultimo'),
|
||||
),
|
||||
));
|
||||
|
||||
} // end add_wp_ultimo_block_category;
|
||||
|
||||
} // end class Block_Manager;
|
Loading…
Add table
Add a link
Reference in a new issue