PluginProbe
Admin and Site Enhancements (ASE) / 1.3.0
Admin and Site Enhancements (ASE) v1.3.0
9.1.1 9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 All 273 releases
admin-site-enhancements / admin-site-enhancements.php
admin-site-enhancements.php
105 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Admin and Site Enhancements
5 * Plugin URI: https://wordpress.org/plugins/admin-site-enhancements/
6 * Description: Easily enable enhancements and features that you usually do with multiple plugins.
7 * Version: 1.3.0
8 * Author: Bowo
9 * Author URI: https://bowo.io
10 * License: GPL-2.0+
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 * Text Domain: admin-site-enhancements
13 * Domain Path: /languages
14 */
15
16 // If this file is called directly, abort.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 define( 'ASENHA_VERSION', '1.3.0' );
22 define( 'ASENHA_ID', 'asenha' );
23 define( 'ASENHA_SLUG', 'admin-site-enhancements' );
24 define( 'ASENHA_SLUG_U', 'admin_site_enhancements' );
25 define( 'ASENHA_URL', plugins_url( '/', __FILE__ ) ); // e.g. https://www.example.com/wp-content/plugins/this-plugin/
26 define( 'ASENHA_PATH', plugin_dir_path( __FILE__ ) ); // e.g. /home/user/apps/wp-root/wp-content/plugins/this-plugin/
27 // define( 'ASENHA_BASE', plugin_basename( __FILE__ ) ); // e.g. plugin-slug/this-file.php
28 // define( 'ASENHA_FILE', __FILE__ ); // /home/user/apps/wp-root/wp-content/plugins/this-plugin/this-file.php
29
30 // Register autoloading classes
31 spl_autoload_register( 'asenha_autoloader' );
32
33 /**
34 * Autoload classes defined by this plugin
35 *
36 * @param string $class_name e.g. \ASENHA\Classes\The_Name
37 * @since 1.0.0
38 */
39 function asenha_autoloader( $class_name ) {
40
41 $namespace = 'ASENHA';
42
43 // Only process classes within this plugin's namespace
44
45 if ( false !== strpos( $class_name, $namespace ) ) {
46
47 // Assemble file path where class is defined
48
49 // \ASENHA\Classes\The_Name => \Classes\The_Name
50 $path = str_replace( $namespace, "", $class_name );
51
52 // \Classes\The_Name => /classes/the_name
53 $path = str_replace( "\\", DIRECTORY_SEPARATOR, strtolower( $path ) );
54
55 // /classes/the_name => /classes/the-name.php
56 $path = str_replace( "_", "-", $path ) . '.php';
57
58 // /classes/the-name.php => /classes/class-the-name.php
59 $path = str_replace( "classes" . DIRECTORY_SEPARATOR, "classes" . DIRECTORY_SEPARATOR . "class-", $path );
60
61 // Remove first '/'
62 $path = substr( $path, 1 );
63
64 // Get /plugin-path/classes/class-the-name.php
65 $path = ASENHA_PATH . $path;
66
67 if ( file_exists( $path ) ) {
68 require_once( $path );
69 }
70
71 }
72
73 }
74
75 /**
76 * Code that runs on plugin activation
77 *
78 * @since 1.0.0
79 */
80 function asenha_on_activation() {
81 $activation = new ASENHA\Classes\Activation;
82 $activation->activate();
83 }
84
85 /**
86 * Code that runs on plugin deactivation
87 *
88 * @since 1.0.0
89 */
90 function asenha_on_deactivation() {
91 $deactivation = new ASENHA\Classes\Deactivation;
92 $deactivation->deactivate();
93 }
94
95 // Register code that runs on plugin activation
96 register_activation_hook( __FILE__, 'asenha_on_activation');
97
98 // Register code that runs on plugin deactivation
99 register_deactivation_hook( __FILE__, 'asenha_on_deactivation' );
100
101 // Set up admin menu and page
102 require_once ASENHA_PATH . 'includes/setup-admin-menu-page.php';
103
104 // Bootstrap all the functionalities of this plugin
105 require_once ASENHA_PATH . 'bootstrap.php';