This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.php
101 lines (84 loc) · 1.96 KB
/
plugin.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
<?php
/**
* common functions
*
* - textdomain
*
* @since 1.0.0
*/
class Plugin_Conflicts {
/**
*
* @var Plugin_Conflicts
*/
protected static $instance;
/**
* plugin options
*
* @since 1.0.0
* @var array (if loaded)
*/
protected $options;
private function __construct() {
$this->load_plugin_textdomain();
add_action( 'plugins_loaded', array( $this, 'wp_plugins_loaded' ) );
}
/**
*
* @return Plugin_Conflicts
*/
public static function get_instance() {
// If the single instance hasn't been set, set it now.
if ( null === self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
public function wp_plugins_loaded() {
}
/**
* Load the plugin text domain for translation.
*
* @since 1.0.0
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( 'plugin-conflicts', false, PC_BASE_DIR . '/languages' );
}
/**
* return plugin options
*
* @since 1.0.0
* @return array $options
* @todo parse default options
*/
public function options() {
if ( ! isset( $this->options ) ) {
$this->options = get_option( PC_SLUG, array() );
}
return $this->options;
}
/**
* on activation
*
* @since 1.0.0
*/
public function activation(){
/* // rather check if could be created and add a warning in admin if not
* if ( !file_exists( WPMU_PLUGIN_DIR ) ) {
@mkdir( WPMU_PLUGIN_DIR );
}*/
if ( file_exists( WPMU_PLUGIN_DIR . "/plugin-conflicts-mu.php" ) ) {
unlink(WPMU_PLUGIN_DIR . "/plugin-conflicts-mu.php");
}
if ( file_exists( PC_BASE_PATH . "/mu/plugin-conflicts-mu.php" ) ) {
copy( PC_BASE_PATH . "/mu/plugin-conflicts-mu.php", WPMU_PLUGIN_DIR . "/plugin-conflicts-mu.php");
}
}
/**
* on deactivation
*
* @since 1.0.0
*/
public function deactivation(){
}
}