forked from studiopress/pattern-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern-manager.php
More file actions
59 lines (52 loc) · 1.46 KB
/
pattern-manager.php
File metadata and controls
59 lines (52 loc) · 1.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
<?php
/**
* Plugin Name: Pattern Manager
* Description: Create and maintain patterns.
* Version: 0.4.0
* Author: WP Engine
* Author URI: wpengine.com
* Text Domain: pattern-manager
* Domain Path: languages
* License: GPLv2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Requires at least: 6.4
* Requires PHP: 8.0
* Namespace: PatternManager
*
* @package pattern-manager
*/
namespace PatternManager;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Automatically include wp modules, which are in the "wp-modules" directory.
*
* @return void
*/
function include_custom_modules() {
$wp_modules = glob( plugin_dir_path( __FILE__ ) . 'wp-modules*/*' );
foreach ( $wp_modules as $wp_module ) {
$module_name = basename( $wp_module );
$filename = $module_name . '.php';
$filepath = $wp_module . '/' . $filename;
if ( is_readable( $filepath ) ) {
// If the module data exists, load it.
require $filepath;
}
}
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\include_custom_modules' );
/**
* Initialize checking of plugin updates from WP Engine.
*/
function pattern_manager_check_for_upgrades() {
$properties = array(
'plugin_slug' => 'pattern-manager',
'plugin_basename' => plugin_basename( __FILE__ ),
);
require_once __DIR__ . '/lib/class-plugin-updater.php';
new \PatternManager\PluginUpdater( $properties );
}
add_action( 'admin_init', __NAMESPACE__ . '\pattern_manager_check_for_upgrades' );