Repository navigation
Expand file tree
/
Copy pathload.php
More file actions
143 lines (120 loc) · 3.75 KB
/
Copy pathload.php
File metadata and controls
143 lines (120 loc) · 3.75 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/**
* @package The_SEO_Framework
*/
use The_SEO_Framework\Load as Load;
defined( 'ABSPATH' ) or die;
/**
* The SEO Framework plugin
* Copyright (C) 2015 - 2016 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
add_action( 'admin_init', 'the_seo_framework_upgrade', 5 );
/**
* Determines whether the plugin needs an option upgrade.
*
* @since 2.7.0
* @action admin_init
* @priority 5
*/
function the_seo_framework_upgrade() {
if ( false === the_seo_framework_active() )
return;
if ( get_option( 'the_seo_framework_upgraded_db_version' ) >= THE_SEO_FRAMEWORK_DB_VERSION )
return;
require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'upgrade.php' );
}
add_action( 'plugins_loaded', 'the_seo_framework_init', 5 );
/**
* Load The_SEO_Framework_Load class
*
* @action plugins_loaded
* @priority 5 Use anything above 5, or any action later than plugins_loaded and
* you can access the class and functions.
*
* @since 2.2.5
* @staticvar object $tsf
*
* @return object|null The SEO Framework Facade class object. Null on failure.
*/
function the_seo_framework_init() {
//* Cache the class. Do not run everything more than once.
static $tsf = null;
if ( the_seo_framework_active() ) {
if ( null === $tsf ) {
//* Register autoloader.
spl_autoload_register( '_autoload_the_seo_framework_classes' );
/**
* @package The_SEO_Framework
*/
$tsf = new Load();
}
}
return $tsf;
}
/**
* Determines whether this plugin should load.
*
* @since 2.3.7
* @staticvar bool $loaded
* Applies filters 'the_seo_framework_load' : bool
*
* @action plugins_loaded
* @return bool Whether to allow loading of plugin.
*/
function the_seo_framework_load() {
static $loaded = null;
if ( isset( $loaded ) )
return $loaded;
return $loaded = (bool) apply_filters( 'the_seo_framework_load', true );
}
/**
* Load compat and API files.
* @since 2.1.6
* @uses THE_SEO_FRAMEWORK_DIR_PATH_FUNCT
*/
require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'compat.php' );
require_once( THE_SEO_FRAMEWORK_DIR_PATH_FUNCT . 'optionsapi.php' );
/**
* Autoloads all class files. To be used when requiring access to all or any of
* the plugin classes.
*
* @since 2.8.0
* @uses THE_SEO_FRAMEWORK_DIR_PATH_CLASS
* @access private
* @staticvar array $loaded Whether $class has been loaded.
*
* @NOTE 'The_SEO_Framework' is a reserved namespace. Using it outside of this plugin's scope will result in an error.
*
* @param string $class The class name.
* @return bool False if file couldn't be included, otherwise true.
*/
function _autoload_the_seo_framework_classes( $class ) {
if ( 0 !== strpos( $class, 'The_SEO_Framework\\', 0 ) )
return;
static $loaded = array();
if ( isset( $loaded[ $class ] ) )
return $loaded[ $class ];
if ( false !== strpos( $class, '_Interface' ) ) {
$path = THE_SEO_FRAMEWORK_DIR_PATH_INTERFACE;
$extension = '.interface.php';
} else {
$path = THE_SEO_FRAMEWORK_DIR_PATH_CLASS;
$extension = '.class.php';
}
$_class = strtolower( str_replace( 'The_SEO_Framework\\', '', $class ) );
$_class = str_replace( '_interface', '', $_class );
$_class = str_replace( '_', '-', $_class );
return $loaded[ $class ] = (bool) require_once( $path . $_class . $extension );
}