-
Notifications
You must be signed in to change notification settings - Fork 0
/
stand-with-ukraine.php
87 lines (68 loc) · 2.31 KB
/
stand-with-ukraine.php
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
declare(strict_types = 1);
/**
* Stand with Ukraine Banner Plugin for WordPress.org
*
* @package Stand with Ukraine
* @author Q Studio <[email protected]>
* @license GPL-2.0+
* @copyright 2022 Q Studio
*
* @wordpress-plugin
* Plugin Name: Stand with Ukraine Banner
* Plugin URI: https://github.com/qstudio/wordpress-plugin-stand-with-ukraine
* Description: Stand with Ukraine Banner Plugin for WordPress.org
* Version: 1.0.8
* Author: Q Studio
* Author URI: https://qstudio.us
* License: GPL-2.0+
* Requires PHP: 7.0
* Copyright: Q Studio
* Class: q_stand_with_ukraine
* Text Domain: q-stand-with-ukraine
* Domain Path: /languages
* GitHub Plugin URI: qstudio/wordpress-plugin-stand-with-ukraine
*/
// namespace plugin ##
namespace q\stand_with_ukraine;
// If this file is called directly, Bulk!
if ( ! defined( 'ABSPATH' ) ) {
return;
}
// plugin activation hook to store current application and plugin state ##
\register_activation_hook( __FILE__, [ '\\q\\stand_with_ukraine\\plugin', 'activation_hook' ] );
// plugin deactivation hook - clear stored data ##
\register_deactivation_hook( __FILE__, [ '\\q\\stand_with_ukraine\\plugin', 'deactivation_hook' ] );
// required bits to get set-up ##
require_once __DIR__ . '/library/api/function.php';
require_once __DIR__ . '/autoload.php';
require_once __DIR__ . '/plugin.php';
require_once __DIR__ . '/hooks.php';
// get plugin instance ##
$plugin = plugin::get_instance();
// validate instance ##
if( ! ( $plugin instanceof \q\stand_with_ukraine\plugin ) ) {
error_log( 'Error in q\stand_with_ukraine plugin instance' );
// nothing else to do here ##
return;
}
// set text domain on init hook ##
\add_action( 'init', [ $plugin, 'load_plugin_textdomain' ], 1 );
$hooks = new \q\stand_with_ukraine\hooks();
// fire hooks - build factory objects and translations ##
\add_action( 'after_setup_theme', function() use( $hooks ){
// admin hooks ##
$hooks->admin(
new \q\stand_with_ukraine\admin\read,
new \q\stand_with_ukraine\admin\update,
new \q\stand_with_ukraine\admin\option,
);
// asset hooks ##
$hooks->asset(
new \q\stand_with_ukraine\asset\enqueue()
);
// theme hooks ##
$hooks->theme(
new \q\stand_with_ukraine\theme\render()
);
}, 3 );