-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlzb-CONTROL-NAME.php
91 lines (77 loc) · 1.97 KB
/
lzb-CONTROL-NAME.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
<?php
/**
* Plugin Name: Lazy Blocks: CONTROL_LABEL Control
* Description: SHORT_DESCRIPTION
* Plugin URI: PLUGIN_URL
* Version: 1.0.0
* Author: AUTHOR_NAME
* Author URI: AUTHOR_URL
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: TEXTDOMAIN
*
* @package lzb-CONTROL-NAME
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* NAMESPACE_Lzb_Plugin_CONTROL_NAME Class
*/
class NAMESPACE_Lzb_Plugin_CONTROL_NAME {
/**
* Plugin Path.
*
* @var string
*/
public static $plugin_path;
/**
* Plugin URL.
*
* @var string
*/
public static $plugin_url;
/**
* NAMESPACE_Lzb_Plugin_CONTROL_NAME constructor.
*/
public function __construct() {}
/**
* Init.
*/
public static function init() {
add_action( 'init', array( 'NAMESPACE_Lzb_Plugin_CONTROL_NAME', 'plugins_loaded' ), 11 );
}
/**
* Init of LazyBlocks available.
*/
public static function plugins_loaded() {
if ( ! class_exists( 'LazyBlocks' ) ) {
return;
}
self::$plugin_path = plugin_dir_path( __FILE__ );
self::$plugin_url = plugin_dir_url( __FILE__ );
// Translations.
load_plugin_textdomain( 'TEXTDOMAIN', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
// Include control.
include_once self::$plugin_path . '/controls/CONTROL-NAME.php';
}
/**
* Get .asset.php file data.
*
* @param string $filepath asset file path.
*
* @return array
*/
public static function get_asset_file( $filepath ) {
$asset_path = self::$plugin_path . $filepath . '.asset.php';
if ( file_exists( $asset_path ) ) {
// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
return include $asset_path;
}
return array(
'dependencies' => array(),
'version' => '1.0.0',
);
}
}
NAMESPACE_Lzb_Plugin_CONTROL_NAME::init();