-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblocksmg.php
More file actions
87 lines (71 loc) · 2.46 KB
/
blocksmg.php
File metadata and controls
87 lines (71 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Plugin Name: Base Blocksmg
* Description: A plugin of custom blocks by mager19.
* Requires at least: 6.1
* Requires PHP: 7.0
* Version: 0.1.2
* Author: Mager19
* Author URI: https://twitter.com/mager19
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: blocksmg
*
* @category Blocks
* @package CreateBlock
* @author Mager19 <mager19@gmail.com>
* @license GPL-2.0-or-later https://www.gnu.org/licenses/gpl-2.0.html
* @link https://twitter.com/mager19
*/
namespace Blocksmg;
if (! defined('ABSPATH') ) {
die('Silence is golden.');
}
/**
* Constructor Class
*
* @category Blocks
* @package CreateBlock
* @author Mager19 <mager19@gmail.com>
* @license GPL-2.0-or-later https://www.gnu.org/licenses/gpl-2.0.html
* @link https://twitter.com/mager19
*/
require 'plugin-update-checker/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
final class Blocksmg
{
static function init()
{
add_action(
'init', function () {
add_filter(
'block_categories_all', function ($categories) {
array_unshift(
$categories, [
'slug' => 'blocksmg',
'title' => __('Blocksmg', 'blocksmg'),
]
);
return $categories;
}
);
$blocks = glob(__DIR__ . '/build/blocks/*/block.json');
foreach ($blocks as $block) {
register_block_type($block);
}
$asset_file = include plugin_dir_path(__FILE__) . 'build/index.asset.php';
wp_enqueue_script('index-settings', plugin_dir_url(__FILE__) . '/build/index.js', $asset_file['dependencies'], $asset_file['version'], true);
}
);
$myUpdateChecker = PucFactory::buildUpdateChecker(
'https://github.com/mager19/blocks-plugin-base/',
__FILE__,
'Blocksmg'
);
//Set the branch that contains the stable release.
$myUpdateChecker->setBranch('releases');
//Optional: If you're using a private repository, specify the access token like this:
// $myUpdateChecker->setAuthentication('your-token-here');
}
}
Blocksmg::init();