-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmy-custom-functions.php
106 lines (100 loc) · 5.33 KB
/
my-custom-functions.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
102
103
104
105
106
<?php
/**
* Plugin Name: My Custom Functions
* Plugin URI: https://github.com/ArthurGareginyan/my-custom-functions
* Description: Easily and safely add your custom PHP code to your WordPress website, directly out of the WordPress Admin Area, without the need to have an external editor.
* Author: Space X-Chimp
* Author URI: https://www.spacexchimp.com
* Version: 4.51
* License: GPL3
* Text Domain: my-custom-functions
* Domain Path: /languages/
*
* Copyright 2014-2021 Space X-Chimp ( website : https://www.spacexchimp.com )
*
* This plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this plugin. If not, see <http://www.gnu.org/licenses/>.
*
* ███████╗██████╗ █████╗ ██████╗███████╗ ██╗ ██╗ ██████╗██╗ ██╗██╗███╗ ███╗██████╗
* ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝ ╚██╗██╔╝ ██╔════╝██║ ██║██║████╗ ████║██╔══██╗
* ███████╗██████╔╝███████║██║ █████╗ ╚███╔╝█████╗██║ ███████║██║██╔████╔██║██████╔╝
* ╚════██║██╔═══╝ ██╔══██║██║ ██╔══╝ ██╔██╗╚════╝██║ ██╔══██║██║██║╚██╔╝██║██╔═══╝
* ███████║██║ ██║ ██║╚██████╗███████╗ ██╔╝ ██╗ ╚██████╗██║ ██║██║██║ ╚═╝ ██║██║
* ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝
*
*/
/**
* Prevent Direct Access
*/
defined( 'ABSPATH' ) or die( "Restricted access!" );
/**
* Define global constants
*/
$plugin_data = get_file_data( __FILE__,
array(
'name' => 'Plugin Name',
'version' => 'Version',
'text' => 'Text Domain'
)
);
function spacexchimp_p001_define_constants( $constant_name, $value ) {
$constant_name = 'SPACEXCHIMP_P001_' . $constant_name;
if ( ! defined( $constant_name ) )
define( $constant_name, $value );
}
spacexchimp_p001_define_constants( 'FILE', __FILE__ );
spacexchimp_p001_define_constants( 'DIR', dirname( plugin_basename( __FILE__ ) ) );
spacexchimp_p001_define_constants( 'BASE', plugin_basename( __FILE__ ) );
spacexchimp_p001_define_constants( 'URL', plugin_dir_url( __FILE__ ) );
spacexchimp_p001_define_constants( 'PATH', plugin_dir_path( __FILE__ ) );
spacexchimp_p001_define_constants( 'SLUG', dirname( plugin_basename( __FILE__ ) ) );
spacexchimp_p001_define_constants( 'NAME', $plugin_data['name'] );
spacexchimp_p001_define_constants( 'VERSION', $plugin_data['version'] );
spacexchimp_p001_define_constants( 'TEXT', $plugin_data['text'] );
spacexchimp_p001_define_constants( 'PREFIX', 'spacexchimp_p001' );
spacexchimp_p001_define_constants( 'SETTINGS', 'spacexchimp_p001' );
/**
* A useful function that returns an array with the contents of the plugin constants
*/
function spacexchimp_p001_plugin() {
$array = array(
'file' => SPACEXCHIMP_P001_FILE,
'dir' => SPACEXCHIMP_P001_DIR,
'base' => SPACEXCHIMP_P001_BASE,
'url' => SPACEXCHIMP_P001_URL,
'path' => SPACEXCHIMP_P001_PATH,
'slug' => SPACEXCHIMP_P001_SLUG,
'name' => SPACEXCHIMP_P001_NAME,
'version' => SPACEXCHIMP_P001_VERSION,
'text' => SPACEXCHIMP_P001_TEXT,
'prefix' => SPACEXCHIMP_P001_PREFIX,
'settings' => SPACEXCHIMP_P001_SETTINGS
);
return $array;
}
/**
* Put value of plugin constants into an array for easier access
*/
$plugin = spacexchimp_p001_plugin();
/**
* Load the plugin modules
*/
require_once( $plugin['path'] . 'inc/php/core.php' );
require_once( $plugin['path'] . 'inc/php/options.php' );
require_once( $plugin['path'] . 'inc/php/upgrade.php' );
require_once( $plugin['path'] . 'inc/php/versioning.php' );
require_once( $plugin['path'] . 'inc/php/enqueue.php' );
require_once( $plugin['path'] . 'inc/php/functional.php' );
require_once( $plugin['path'] . 'inc/php/controls.php' );
require_once( $plugin['path'] . 'inc/php/page.php' );
require_once( $plugin['path'] . 'inc/php/messages.php' );