forked from Yoast/wordpress-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-seo.php
147 lines (119 loc) · 5.07 KB
/
wp-seo.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/*
Plugin Name: WordPress SEO
Version: 1.4.14
Plugin URI: http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin
Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.
Author: Joost de Valk
Author URI: http://yoast.com/
License: GPL v3
WordPress SEO Plugin
Copyright (C) 2008-2013, Joost de Valk - [email protected]
This program 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 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/>.
*/
/**
* @package Main
*/
if ( !defined( 'DB_NAME' ) ) {
header( 'HTTP/1.0 403 Forbidden' );
die;
}
if ( !defined( 'WPSEO_URL' ) )
define( 'WPSEO_URL', plugin_dir_url( __FILE__ ) );
if ( !defined( 'WPSEO_PATH' ) )
define( 'WPSEO_PATH', plugin_dir_path( __FILE__ ) );
if ( !defined( 'WPSEO_BASENAME' ) )
define( 'WPSEO_BASENAME', plugin_basename( __FILE__ ) );
define( 'WPSEO_FILE', __FILE__ );
function wpseo_load_textdomain() {
load_plugin_textdomain( 'wordpress-seo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
add_filter( 'wp_loaded', 'wpseo_load_textdomain' );
if ( version_compare( PHP_VERSION, '5.2', '<' ) ) {
if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
deactivate_plugins( __FILE__ );
wp_die( sprintf( __( 'WordPress SEO requires PHP 5.2 or higher, as does WordPress 3.2 and higher. The plugin has now disabled itself. For more info, %s$1see this post%s$2.', 'wordpress-seo' ), '<a href="http://yoast.com/requires-php-52/">', '</a>' ) );
} else {
return;
}
}
define( 'WPSEO_VERSION', '1.4.14' );
$pluginurl = plugin_dir_url( __FILE__ );
if ( strpos( $pluginurl, 'https' ) === 0 && strpos( get_bloginfo( 'url' ), 'https' ) !== 0 )
$pluginurl = substr_replace( $pluginurl, 'http', 0, 5 );
define( 'WPSEO_FRONT_URL', $pluginurl );
unset( $pluginurl );
function wpseo_init() {
require WPSEO_PATH . 'inc/wpseo-functions.php';
$options = get_wpseo_options();
if ( isset( $options['stripcategorybase'] ) && $options['stripcategorybase'] )
require WPSEO_PATH . 'inc/class-rewrite.php';
if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] )
require WPSEO_PATH . 'inc/class-sitemaps.php';
}
/**
* Used to load the required files on the plugins_loaded hook, instead of immediately.
*/
function wpseo_frontend_init() {
$options = get_wpseo_options();
require WPSEO_PATH . 'frontend/class-frontend.php';
if ( isset( $options['breadcrumbs-enable'] ) && $options['breadcrumbs-enable'] )
require WPSEO_PATH . 'frontend/class-breadcrumbs.php';
if ( isset( $options['twitter'] ) && $options['twitter'] )
require WPSEO_PATH . 'frontend/class-twitter.php';
if ( isset( $options['opengraph'] ) && $options['opengraph'] )
require WPSEO_PATH . 'frontend/class-opengraph.php';
}
/**
* Used to load the required files on the plugins_loaded hook, instead of immediately.
*/
function wpseo_admin_init() {
$options = get_wpseo_options();
if ( isset( $_GET['wpseo_restart_tour'] ) ) {
unset( $options['ignore_tour'] );
update_option( 'wpseo', $options );
}
if ( isset( $options['yoast_tracking'] ) && $options['yoast_tracking'] ) {
require WPSEO_PATH . 'admin/class-tracking.php';
}
require WPSEO_PATH . 'admin/class-admin.php';
global $pagenow;
if ( in_array( $pagenow, array( 'edit.php', 'post.php', 'post-new.php' ) ) ) {
require WPSEO_PATH . 'admin/class-metabox.php';
if ( isset( $options['opengraph'] ) && $options['opengraph'] )
require WPSEO_PATH . 'admin/class-opengraph-admin.php';
}
if ( in_array( $pagenow, array( 'edit-tags.php' ) ) )
require WPSEO_PATH . 'admin/class-taxonomy.php';
if ( in_array( $pagenow, array( 'admin.php' ) ) )
require WPSEO_PATH . 'admin/class-config.php';
if ( !isset( $options['yoast_tracking'] ) || ( !isset( $options['ignore_tour'] ) || !$options['ignore_tour'] ) )
require WPSEO_PATH . 'admin/class-pointers.php';
if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] )
require WPSEO_PATH . 'admin/class-sitemaps-admin.php';
}
add_action( 'plugins_loaded', 'wpseo_init', 14 );
if ( !defined( 'DOING_AJAX' ) || !DOING_AJAX )
require WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
if ( is_admin() ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
require WPSEO_PATH . 'admin/ajax.php';
} else {
add_action( 'plugins_loaded', 'wpseo_admin_init', 15 );
}
register_activation_hook( __FILE__, 'wpseo_activate' );
register_deactivation_hook( __FILE__, 'wpseo_deactivate' );
} else {
add_action( 'plugins_loaded', 'wpseo_frontend_init', 15 );
}
unset( $options );