-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-meta-data-manager.php
130 lines (114 loc) · 3.64 KB
/
post-meta-data-manager.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/**
* Plugin Name: Post Meta Data Manager
* Plugin URI: http://www.wpexpertplugins.com/
* Description: Post Meta management Posts, Pages, Custom Post Types, Users, Taxonomoies.
* Version: 1.4.2
* Author: WpExpertPlugins
* Text Domain: pmdm_wp
* Author URI: http://www.wpexpertplugins.com/contact-us/
* Requires at least: 6.0.1
* WC tested up to: 6.1
* Domain Path: /languages
*/
/**
* Basic plugin definitions
*
* @package Post Meta Data Manager
* @since 1.0
*/
if (! defined('PMDM_WP_DIR') ) {
define('PMDM_WP_DIR', __DIR__); // Plugin dir
}
if (! defined('PMDM_WP_VERSION') ) {
define('PMDM_WP_VERSION', '1.4.2');
}
if (! defined('PMDM_WP_PLUGIN_MAIN_FILE_PATH') ) {
define('PMDM_WP_PLUGIN_MAIN_FILE_PATH', __FILE__); // mail file path
}
if (! defined('PMDM_WP_URL') ) {
define('PMDM_WP_URL', plugin_dir_url(__FILE__)); // Plugin url
}
if (! defined('PMDM_WP_INC_DIR') ) {
define('PMDM_WP_INC_DIR', PMDM_WP_DIR . '/includes'); // Plugin include dir
}
if (! defined('PMDM_WP_INC_URL') ) {
define('PMDM_WP_INC_URL', PMDM_WP_URL . 'includes'); // Plugin include url
}
if (! defined('PMDM_WP_ADMIN_DIR') ) {
define('PMDM_WP_ADMIN_DIR', PMDM_WP_INC_DIR . '/admin'); // Plugin admin dir
}
if (! defined('PMDM_WP_BASE_NAME') ) {
define('PMDM_WP_BASE_NAME', 'pmdm_wp'); // Plugin folder name
}
if (! defined('PMDM_WP_PREFIX') ) {
define('PMDM_WP_PREFIX', 'pmdm_wp'); // Plugin Prefix
}
if (! defined('PMDM_WP_VAR_PREFIX') ) {
define('PMDM_WP_VAR_PREFIX', '_pmdm_wp_'); // Variable Prefix
}
if (! defined('PMDM_HELP_LINK') ) {
define('PMDM_HELP_LINK', 'http://www.wpexpertplugins.com/contact-us/'); // Variable Prefix
}
/**
* Load Text Domain
*
* This gets the plugin ready for translation.
*
* @package Post Meta Data Manager
* @since 1.0
*/
add_action('plugins_loaded', 'pmdm_wp_init_textdomain');
function pmdm_wp_init_textdomain()
{
// Filter for Language directory
$pmdm_wp_lang_dir = dirname(plugin_basename(__FILE__)) . '/languages/';
$pmdm_wp_lang_dir = apply_filters('pmdm_wp_languages_directory', $pmdm_wp_lang_dir);
// WordPress Locale file
$locale = apply_filters('plugin_locale', get_locale(), 'pmdm_wp');
$mofile = sprintf('%1$s-%2$s.mo', 'pmdm_wp', $locale);
// Setup path to current locale
$mofile_locale = $pmdm_wp_lang_dir . $mofile;
$mofile_global = WP_LANG_DIR . '/' . PMDM_WP_BASE_NAME . '/' . $mofile;
if (file_exists($mofile_global) ) { // look in global Languages folder
load_textdomain('pmdm_wp', $mofile_global);
} elseif (file_exists($mofile_locale) ) { // look in local plugin Languages folder
load_textdomain('pmdm_wp', $mofile_locale);
} else { // Load the default Languages file
load_plugin_textdomain('pmdm_wp', false, $pmdm_wp_lang_dir);
}
}
/**
* Activation Hook
*
* Register plugin activation hook.
*
* @package Post Meta Data Manager
* @since 1.0
*/
register_activation_hook(__FILE__, 'pmdm_wp_install');
function pmdm_wp_install()
{
}
/**
* Deactivation Hook
*
* Register plugin deactivation hook.
*
* @package Post Meta Data Manager
* @since 1.0
*/
register_deactivation_hook(__FILE__, 'pmdm_wp_uninstall');
function pmdm_wp_uninstall()
{
}
// Global variables
global $pmdm_wp_scripts, $pmdm_wp_admin;
// Script class handles most of script functionalities of plugin
require_once PMDM_WP_INC_DIR . '/class-pmdm-wp-scripts.php';
$pmdm_wp_scripts = new Pmdm_Wp_Scripts();
$pmdm_wp_scripts->add_hooks();
// Admin class handles most of admin panel functionalities of plugin
require_once PMDM_WP_ADMIN_DIR . '/class-pmdm-wp-admin.php';
$pmdm_wp_admin = new Pmdm_Wp_Admin();
$pmdm_wp_admin->add_hooks();