-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin-starter.php
executable file
·49 lines (40 loc) · 1.39 KB
/
plugin-starter.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
<?php
/**
* Plugin Name: Plugin starter
* Plugin URI: http://www.plateformewpdigital.fr
* Description: Plugin starter
* Author: Nicolas Kulka
* Author URI: http://nicolaskulka.fr/
*
* Version: 1.1
* Domain Path: languages
* Text Domain: plugin-starter
* Depends:
*/
// don't load directly
if ( !defined( 'ABSPATH' ) ) {
die( '-1' );
}
// Plugin constants
define( 'PLUGIN_STARTER_VERSION', '1.1' );
define( 'PLUGIN_STARTER_FOLDER', 'plugin-starter' );
define( 'PLUGIN_STARTER_URL', plugin_dir_url( __FILE__ ) );
define( 'PLUGIN_STARTER_DIR', plugin_dir_path( __FILE__ ) );
// Function for easy load files
function _plugin_starter_load_files( $dir, $files, $prefix = '' ) {
foreach ( $files as $file ) {
if ( is_file( $dir . $prefix . $file . ".php" ) ) {
require_once($dir . $prefix . $file . ".php");
}
}
}
// Plugin client classes
_plugin_starter_load_files( PLUGIN_STARTER_DIR . 'include/', array( 'lang' ) );
_plugin_starter_load_files( PLUGIN_STARTER_DIR . 'classes/', array( 'plugin' ) );
add_action( 'plugins_loaded', 'init_plugin_starter_plugin' );
function init_plugin_starter_plugin() {
// Load textdomain
load_plugin_textdomain( 'plugin-starter', NULL, PLUGIN_STARTER_DIR . '/languages' );
// Load client
new PluginStarter();
}