forked from hrsetyono/edje-wp-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixel-wp-library.php
101 lines (79 loc) · 2.66 KB
/
pixel-wp-library.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Plugin Name: Pixel WP Library
* Description: Collection of WordPress modules to be used together with pixel-wp-theme
* Plugin URI: http://github.com/pixelstudio-id/pixel-wp-library
* Requires at least: 6.2
* Requires PHP: 7.4
* License: MIT
* Author: Pixel Studio
* Author URI: https://pixelstudio.id
* Version: 6.5.5
*/
if (!defined('WPINC')) { die; } // exit if accessed directly
// Constant
define('PX_VERSION', '6.5.5');
define('PX_BASE', basename(dirname(__FILE__)).'/'.basename(__FILE__));
// define('PX_DIR', __DIR__); // for require
define('PX_DIST', plugin_dir_url(__FILE__) . 'dist');
if (!class_exists('Pixel_WP_Library')):
require_once 'helper/_index.php';
require_once 'module-modify/_index.php';
require_once 'module-vendor/_index.php';
require_once 'module-post-type/_index.php';
require_once 'module-post-type-new/_index.php';
require_once 'module-admin-sidenav/_index.php';
require_once 'module-comment/_index.php';
require_once 'module-widgets/_index.php';
require_once 'module-widgets-dark-mode/_index.php';
require_once 'module-menu/_index.php';
require_once 'module-gutenberg/_index.php';
require_once 'module-block-faq/_index.php';
require_once 'module-block-icon/_index.php';
require_once 'module-block-icon/_index.php';
require_once 'module-classic-quote/index.php';
require_once 'module-classic-list/index.php';
class Pixel_WP_Library {
function __construct() {
require_once 'activation-hook.php';
register_activation_hook(PX_BASE, [$this, 'register_activation_hook']);
add_filter('plugin_row_meta', [$this, 'add_doc_links'], 10, 2);
}
/**
* Register activation and deactivation hook
*/
function register_activation_hook() {
$hook = new Px_ActivationHook();
$hook->on_activation();
}
/**
* Add "Documentation" link in the plugin listing (besides the Deactivate link)
*
* @action plugin_row_meta 10
*/
function add_doc_links($links, $file) {
if ($file === plugin_basename(__FILE__)) {
$links[] = '<a target="_blank" rel="noopener noreferrer" href="https://github.com/pixelstudio-id/pixel-wp-library/wiki/"> View Documentation » </a>';
}
return $links;
}
}
new Pixel_WP_Library();
endif;
/////
if (!class_exists('H')):
/**
* Alternate way to call Edje functions from each module's `_load.php`
* Example: to call `h_register_post_type()`, we can use `H::register_post_type()`
*/
class H {
static function __callStatic($name, $args) {
$func_name = "h_$name";
if (is_callable($func_name)) {
return call_user_func_array($func_name, $args);
} else {
trigger_error("The function H::$name does not exist.", E_USER_ERROR);
}
}
}
endif; // class_exists