-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-filename-correction.php
111 lines (94 loc) · 2.1 KB
/
wp-filename-correction.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
<?php
/**
* Plugin Name: WordPress Filename Correction
* Plugin URI: https://buddydev.com/plugins/wp-filename-correction
* Description: This is an plugin that enable to correct filenames on the site.
* Version: 1.0.0
* Author: BuddyDev Team
* Author URI: https://buddydev.com/
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-filename-correction
* Domain Path: /languages
*
* @package wp-filename-correction
* @contributor: Ravi Sharma
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WP_Filename_Correction
*/
class WP_Filename_Correction {
/**
* Class instance
*
* @var WP_Filename_Correction
*/
private static $instance = null;
/**
* Plugin absolute path
*
* @var string
*/
private $path = '';
/**
* WP_Filename_Correction constructor.
*/
private function __construct() {
$this->path = plugin_dir_path( __FILE__ );
$this->setup();
}
/**
* Return class instance
*
* @return WP_Filename_Correction
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Setup callbacks
*/
private function setup() {
add_action( 'plugins_loaded', array( $this, 'plugin_init' ) );
add_action( 'plugins_loaded', array( $this, 'load_admin' ), 9998 ); // pt settings 1.0.2.
}
/**
* Initialize plugin functionality
*/
public function plugin_init() {
$files = array(
'core/wpfnc-functions.php',
'core/class-wpfnc-action-handler.php',
);
foreach ( $files as $file ) {
require_once $this->path . $file;
}
WPFNC_Action_Handler::boot();
}
/**
* Load pt-settings framework
*/
public function load_admin() {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
require_once $this->path . 'admin/pt-settings/pt-settings-loader.php';
require_once $this->path . 'admin/class-admin-settings.php';
Admin_Settings::boot();
}
}
/**
* Get plugin path
*
* @return string
*/
public function get_path() {
return $this->path;
}
}
WP_Filename_Correction::get_instance();