Version Description
Download this release
Release Info
Developer | hallsofmontezuma |
Plugin | All in One SEO Pack |
Version | 2.3.8 |
Comparing to | |
See all releases |
Code changes from version 2.3.5 to 2.3.8
- admin/aioseop_module_class.php +9 -0
- admin/aioseop_module_manager.php +71 -35
- admin/display/general-metaboxes.php +6 -3
- admin/display/index.php +4 -1
- admin/index.php +4 -1
- admin/meta_import.php +72 -63
- aioseop-init.php +7 -0
- aioseop_class.php +979 -618
- aioseop_init.php +0 -2
- all_in_one_seo_pack.php +34 -15
- css/modules/aioseop_module-rtl.css +14 -0
- css/modules/aioseop_module.css +46 -0
- i18n/all-in-one-seo-pack-ar.mo +0 -0
- i18n/all-in-one-seo-pack-ary.mo +0 -0
- i18n/all-in-one-seo-pack-bg_BG.mo +0 -0
- i18n/all-in-one-seo-pack-ca.mo +0 -0
- i18n/all-in-one-seo-pack-de_DE.mo +0 -0
- i18n/all-in-one-seo-pack-en_AU.mo +0 -0
- i18n/all-in-one-seo-pack-en_CA.mo +0 -0
- i18n/all-in-one-seo-pack-en_GB.mo +0 -0
- i18n/all-in-one-seo-pack-en_NZ.mo +0 -0
- i18n/all-in-one-seo-pack-es_CL.mo +0 -0
- i18n/all-in-one-seo-pack-es_MX.mo +0 -0
- i18n/all-in-one-seo-pack-fa_IR.mo +0 -0
- i18n/all-in-one-seo-pack-fi.mo +0 -0
- i18n/all-in-one-seo-pack-hi_IN.mo +0 -0
- i18n/all-in-one-seo-pack-hr.mo +0 -0
- i18n/all-in-one-seo-pack-hu_HU.mo +0 -0
- i18n/all-in-one-seo-pack-it_IT.mo +0 -0
- i18n/all-in-one-seo-pack-ko_KR.mo +0 -0
- i18n/all-in-one-seo-pack-nb_NO.mo +0 -0
- i18n/all-in-one-seo-pack-nl_NL.mo +0 -0
- i18n/all-in-one-seo-pack-nn_NO.mo +0 -0
- i18n/all-in-one-seo-pack-pl_PL.mo +0 -0
- i18n/all-in-one-seo-pack-pt_BR.mo +0 -0
- i18n/all-in-one-seo-pack-pt_PT.mo +0 -0
- i18n/all-in-one-seo-pack-ro_RO.mo +0 -0
- i18n/all-in-one-seo-pack-ru_RU.mo +0 -0
- i18n/all-in-one-seo-pack-sl_SL.mo +0 -0
- i18n/all-in-one-seo-pack-sq.mo +0 -0
- i18n/all-in-one-seo-pack-sr_RS.mo +0 -0
- i18n/all-in-one-seo-pack-tr_TR.mo +0 -0
- i18n/all-in-one-seo-pack-vi.mo +0 -0
- i18n/all-in-one-seo-pack-zh_CN.mo +0 -0
- inc/aioseop_functions.php +251 -88
- inc/aioseop_updates_class.php +33 -34
- inc/commonstrings.php +6 -5
- inc/compatability/compat-init.php +113 -0
- inc/index.php +4 -1
- inc/sitemap-xsl.php +190 -0
- inc/translations.php +10 -0
- index.php +3 -1
- modules/aioseop_bad_robots.php +66 -32
- modules/aioseop_feature_manager.php +76 -53
- modules/aioseop_file_editor.php +39 -39
- modules/aioseop_importer_exporter.php +21 -60
- modules/aioseop_opengraph.php +1 -1
- modules/aioseop_performance.php +72 -79
- modules/aioseop_robots.php +60 -32
- modules/aioseop_sitemap.php +1066 -487
- modules/aioseop_video_sitemap.php +6 -0
- modules/index.php +4 -1
- public/front.php +42 -0
- public/index.php +4 -1
- public/opengraph.php +7 -1
- readme.txt +8 -8
- sitemap.xsl +0 -146
admin/aioseop_module_class.php
CHANGED
@@ -424,6 +424,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
424 |
);
|
425 |
$botlist = apply_filters( $this->prefix . 'botlist', $botlist );
|
426 |
if ( ! empty( $botlist ) ) {
|
|
|
|
|
|
|
427 |
$ua = $_SERVER['HTTP_USER_AGENT'];
|
428 |
$uas = $this->quote_list_for_regex( $botlist );
|
429 |
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
@@ -596,6 +599,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
596 |
$botlist = $this->default_bad_bots();
|
597 |
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
598 |
if ( ! empty( $botlist ) ) {
|
|
|
|
|
|
|
599 |
$ua = $_SERVER['HTTP_USER_AGENT'];
|
600 |
$uas = $this->quote_list_for_regex( $botlist );
|
601 |
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
@@ -1890,6 +1896,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1890 |
case 'html':
|
1891 |
$buf .= $value;
|
1892 |
break;
|
|
|
|
|
|
|
1893 |
default:
|
1894 |
$buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
|
1895 |
}
|
424 |
);
|
425 |
$botlist = apply_filters( $this->prefix . 'botlist', $botlist );
|
426 |
if ( ! empty( $botlist ) ) {
|
427 |
+
if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
428 |
+
return false;
|
429 |
+
}
|
430 |
$ua = $_SERVER['HTTP_USER_AGENT'];
|
431 |
$uas = $this->quote_list_for_regex( $botlist );
|
432 |
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
599 |
$botlist = $this->default_bad_bots();
|
600 |
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
601 |
if ( ! empty( $botlist ) ) {
|
602 |
+
if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
603 |
+
return false;
|
604 |
+
}
|
605 |
$ua = $_SERVER['HTTP_USER_AGENT'];
|
606 |
$uas = $this->quote_list_for_regex( $botlist );
|
607 |
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
1896 |
case 'html':
|
1897 |
$buf .= $value;
|
1898 |
break;
|
1899 |
+
case 'esc_html':
|
1900 |
+
$buf .= "<pre>" . esc_html( $value ) . "</pre>\n";
|
1901 |
+
break;
|
1902 |
default:
|
1903 |
$buf .= "<input name='$name' type='{$options['type']}' $attr value='$value'>\n";
|
1904 |
}
|
admin/aioseop_module_manager.php
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Module Manager.
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
|
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
|
|
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Module_Manager {
|
10 |
protected $modules = array();
|
11 |
protected $settings_update = false;
|
@@ -13,17 +20,24 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
13 |
protected $settings_reset_all = false;
|
14 |
protected $module_settings_update = false;
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
function __construct( $mod ) {
|
|
|
18 |
$this->modules['feature_manager'] = null;
|
19 |
foreach ( $mod as $m ) {
|
20 |
$this->modules[ $m ] = null;
|
21 |
}
|
22 |
$reset = false;
|
23 |
-
$reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default']
|
24 |
-
$reset = ( ( isset( $_POST['Submit_Default'] ) && $_POST['Submit_Default']
|
25 |
$update = ( isset( $_POST['action'] ) && $_POST['action']
|
26 |
-
&& ( ( isset( $_POST['Submit'] ) && $_POST['Submit']
|
27 |
);
|
28 |
if ( $update ) {
|
29 |
if ( $reset ) {
|
@@ -32,26 +46,33 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
32 |
if ( $reset_all ) {
|
33 |
$this->settings_reset_all = true;
|
34 |
}
|
35 |
-
if ( $_POST['action']
|
36 |
$this->settings_update = true;
|
37 |
}
|
38 |
-
if ( $_POST['action']
|
39 |
$this->module_settings_update = true;
|
40 |
}
|
41 |
}
|
42 |
$this->do_load_module( 'feature_manager', $mod );
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
function return_module( $class ) {
|
46 |
global $aiosp;
|
47 |
-
if (
|
48 |
return $aiosp;
|
49 |
}
|
50 |
-
if (
|
51 |
return $this;
|
52 |
}
|
53 |
foreach ( $this->modules as $m ) {
|
54 |
-
if ( is_object( $m ) && (
|
55 |
return $m;
|
56 |
}
|
57 |
}
|
@@ -59,8 +80,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
59 |
return false;
|
60 |
}
|
61 |
|
|
|
|
|
|
|
62 |
function get_loaded_module_list() {
|
63 |
-
$module_list =
|
64 |
if ( ! empty( $this->modules ) ) {
|
65 |
foreach ( $this->modules as $k => $v ) {
|
66 |
if ( ! empty( $v ) ) {
|
@@ -72,13 +96,20 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
72 |
return $module_list;
|
73 |
}
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
function do_load_module( $mod, $args = null ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
$mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
|
83 |
if ( ! empty( $mod_path ) ) {
|
84 |
require_once( $mod_path );
|
@@ -92,21 +123,26 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
92 |
if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
|
93 |
add_action( 'admin_bar_menu', array(
|
94 |
$module_class,
|
95 |
-
'add_admin_bar_submenu'
|
96 |
), 1001 + $module_class->menu_order() );
|
97 |
}
|
98 |
if ( is_admin() ) {
|
99 |
-
add_action( 'aioseop_modules_add_menus',
|
100 |
$module_class,
|
101 |
-
'add_menu'
|
102 |
), $module_class->menu_order() );
|
103 |
-
add_action( 'aiosoep_options_reset',
|
104 |
-
add_filter( 'aioseop_export_settings',
|
105 |
}
|
106 |
|
107 |
return true;
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
110 |
function load_module( $mod ) {
|
111 |
static $feature_options = null;
|
112 |
static $feature_prefix = null;
|
@@ -114,22 +150,22 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
114 |
return false;
|
115 |
}
|
116 |
$v = $this->modules[ $mod ];
|
117 |
-
if (
|
118 |
return false;
|
119 |
-
} //
|
120 |
-
if (
|
121 |
return false;
|
122 |
}
|
123 |
-
if ( (
|
124 |
-
&& ( (
|
125 |
-
|
126 |
-
|
127 |
) {
|
128 |
return false;
|
129 |
}
|
130 |
$mod_enable = false;
|
131 |
$fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
|
132 |
-
isset( $_REQUEST['page'] ) &&
|
133 |
if ( $fm_page && ! $this->settings_reset ) {
|
134 |
if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) {
|
135 |
$mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
|
@@ -137,14 +173,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
|
137 |
$mod_enable = false;
|
138 |
}
|
139 |
} else {
|
140 |
-
if ( $feature_prefix
|
141 |
$feature_prefix = $this->modules['feature_manager']->get_prefix();
|
142 |
}
|
143 |
if ( $fm_page && $this->settings_reset ) {
|
144 |
$feature_options = $this->modules['feature_manager']->default_options();
|
145 |
}
|
146 |
-
if ( $feature_options
|
147 |
-
if ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' )
|
148 |
$feature_options = $this->modules['feature_manager']->default_options();
|
149 |
} else {
|
150 |
$feature_options = $this->modules['feature_manager']->get_current_options();
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Module Manager.
|
4 |
+
*
|
5 |
+
* Mostly we're activating and deactivating modules/features.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
* @since 2.0
|
9 |
*/
|
10 |
+
|
11 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class All_in_One_SEO_Pack_Module_Manager
|
15 |
+
*/
|
16 |
class All_in_One_SEO_Pack_Module_Manager {
|
17 |
protected $modules = array();
|
18 |
protected $settings_update = false;
|
20 |
protected $settings_reset_all = false;
|
21 |
protected $module_settings_update = false;
|
22 |
|
23 |
+
/**
|
24 |
+
* All_in_One_SEO_Pack_Module_Manager constructor.
|
25 |
+
*
|
26 |
+
* Initialize module list.
|
27 |
+
*
|
28 |
+
* @param $mod Modules.
|
29 |
+
*/
|
30 |
function __construct( $mod ) {
|
31 |
+
|
32 |
$this->modules['feature_manager'] = null;
|
33 |
foreach ( $mod as $m ) {
|
34 |
$this->modules[ $m ] = null;
|
35 |
}
|
36 |
$reset = false;
|
37 |
+
$reset_all = ( isset( $_POST['Submit_All_Default'] ) && '' !== $_POST['Submit_All_Default'] );
|
38 |
+
$reset = ( ( isset( $_POST['Submit_Default'] ) && '' !== $_POST['Submit_Default'] ) || $reset_all );
|
39 |
$update = ( isset( $_POST['action'] ) && $_POST['action']
|
40 |
+
&& ( ( isset( $_POST['Submit'] ) && '' !== $_POST['Submit'] ) || $reset )
|
41 |
);
|
42 |
if ( $update ) {
|
43 |
if ( $reset ) {
|
46 |
if ( $reset_all ) {
|
47 |
$this->settings_reset_all = true;
|
48 |
}
|
49 |
+
if ( 'aiosp_update' === $_POST['action'] ) {
|
50 |
$this->settings_update = true;
|
51 |
}
|
52 |
+
if ( 'aiosp_update_module' === $_POST['action'] ) {
|
53 |
$this->module_settings_update = true;
|
54 |
}
|
55 |
}
|
56 |
$this->do_load_module( 'feature_manager', $mod );
|
57 |
}
|
58 |
|
59 |
+
/**
|
60 |
+
* Return module.
|
61 |
+
*
|
62 |
+
* @param $class
|
63 |
+
*
|
64 |
+
* @return $this|bool|mixed
|
65 |
+
*/
|
66 |
function return_module( $class ) {
|
67 |
global $aiosp;
|
68 |
+
if ( get_class( $aiosp ) === $class ) {
|
69 |
return $aiosp;
|
70 |
}
|
71 |
+
if ( get_class( $aiosp ) === $class ) {
|
72 |
return $this;
|
73 |
}
|
74 |
foreach ( $this->modules as $m ) {
|
75 |
+
if ( is_object( $m ) && ( get_class( $m ) === $class ) ) {
|
76 |
return $m;
|
77 |
}
|
78 |
}
|
80 |
return false;
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* @return array
|
85 |
+
*/
|
86 |
function get_loaded_module_list() {
|
87 |
+
$module_list = array();
|
88 |
if ( ! empty( $this->modules ) ) {
|
89 |
foreach ( $this->modules as $k => $v ) {
|
90 |
if ( ! empty( $v ) ) {
|
96 |
return $module_list;
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* @param $mod Module.
|
101 |
+
* @param null $args
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
function do_load_module( $mod, $args = null ) {
|
106 |
+
// Module name is used for these automatic settings:
|
107 |
+
// The aiosp_enable_$module settings - whether each plugin is active or not.
|
108 |
+
// The name of the .php file containing the module - aioseop_$module.php.
|
109 |
+
// The name of the class - All_in_One_SEO_Pack_$Module.
|
110 |
+
// The global $aioseop_$module.
|
111 |
+
// $this->modules[$module].
|
112 |
+
|
113 |
$mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "modules/aioseop_$mod.php" );
|
114 |
if ( ! empty( $mod_path ) ) {
|
115 |
require_once( $mod_path );
|
123 |
if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'aiosp_manage_seo' ) ) {
|
124 |
add_action( 'admin_bar_menu', array(
|
125 |
$module_class,
|
126 |
+
'add_admin_bar_submenu',
|
127 |
), 1001 + $module_class->menu_order() );
|
128 |
}
|
129 |
if ( is_admin() ) {
|
130 |
+
add_action( 'aioseop_modules_add_menus', array(
|
131 |
$module_class,
|
132 |
+
'add_menu',
|
133 |
), $module_class->menu_order() );
|
134 |
+
add_action( 'aiosoep_options_reset', array( $module_class, 'reset_options' ) );
|
135 |
+
add_filter( 'aioseop_export_settings', array( $module_class, 'settings_export' ) );
|
136 |
}
|
137 |
|
138 |
return true;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @param $mod
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
function load_module( $mod ) {
|
147 |
static $feature_options = null;
|
148 |
static $feature_prefix = null;
|
150 |
return false;
|
151 |
}
|
152 |
$v = $this->modules[ $mod ];
|
153 |
+
if ( null !== $v ) {
|
154 |
return false;
|
155 |
+
} // Already loaded.
|
156 |
+
if ( 'performance' === $mod && ! is_super_admin() ) {
|
157 |
return false;
|
158 |
}
|
159 |
+
if ( ( 'file_editor' === $mod || 'robots' === $mod )
|
160 |
+
&& ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
|
161 |
+
|| ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
|
162 |
+
|| ! is_super_admin() )
|
163 |
) {
|
164 |
return false;
|
165 |
}
|
166 |
$mod_enable = false;
|
167 |
$fm_page = ( $this->module_settings_update && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) &&
|
168 |
+
isset( $_REQUEST['page'] ) && trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . 'modules/aioseop_feature_manager.php' === $_REQUEST['page'] );
|
169 |
if ( $fm_page && ! $this->settings_reset ) {
|
170 |
if ( isset( $_POST["aiosp_feature_manager_enable_$mod"] ) ) {
|
171 |
$mod_enable = $_POST["aiosp_feature_manager_enable_$mod"];
|
173 |
$mod_enable = false;
|
174 |
}
|
175 |
} else {
|
176 |
+
if ( null === $feature_prefix ) {
|
177 |
$feature_prefix = $this->modules['feature_manager']->get_prefix();
|
178 |
}
|
179 |
if ( $fm_page && $this->settings_reset ) {
|
180 |
$feature_options = $this->modules['feature_manager']->default_options();
|
181 |
}
|
182 |
+
if ( null === $feature_options ) {
|
183 |
+
if ( $this->module_settings_update && $this->settings_reset_all && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
184 |
$feature_options = $this->modules['feature_manager']->default_options();
|
185 |
} else {
|
186 |
$feature_options = $this->modules['feature_manager']->get_current_options();
|
admin/display/general-metaboxes.php
CHANGED
@@ -83,12 +83,15 @@ class aiosp_metaboxes {
|
|
83 |
<a target="_blank" title="<?php _e( 'Follow us on Twitter', 'all-in-one-seo-pack' ); ?>"
|
84 |
href="https://twitter.com/aioseopack"><span
|
85 |
class="aioseop_follow_button aioseop_twitter_follow"></span></a>
|
86 |
-
</div><?php
|
|
|
|
|
|
|
|
|
|
|
87 |
<div><strong>
|
88 |
<?php
|
89 |
|
90 |
-
$aiosp_trans = new AIOSEOP_Translations();
|
91 |
-
|
92 |
if ( $aiosp_trans->percent_translated < 100 ) {
|
93 |
|
94 |
/* translators: %1$s expands to the number of languages All in One SEO Pack has been translated into. $2%s to the percentage translated of the current language, $3%s to the language name, %4$s and %5$s to anchor tags with link to translation page at translate.wordpress.org */
|
83 |
<a target="_blank" title="<?php _e( 'Follow us on Twitter', 'all-in-one-seo-pack' ); ?>"
|
84 |
href="https://twitter.com/aioseopack"><span
|
85 |
class="aioseop_follow_button aioseop_twitter_follow"></span></a>
|
86 |
+
</div><?php
|
87 |
+
|
88 |
+
$aiosp_trans = new AIOSEOP_Translations();
|
89 |
+
// Eventually if nothing is returned we should just remove this section.
|
90 |
+
|
91 |
+
if ( get_locale() != 'en_US' ) { ?>
|
92 |
<div><strong>
|
93 |
<?php
|
94 |
|
|
|
|
|
95 |
if ( $aiosp_trans->percent_translated < 100 ) {
|
96 |
|
97 |
/* translators: %1$s expands to the number of languages All in One SEO Pack has been translated into. $2%s to the percentage translated of the current language, $3%s to the language name, %4$s and %5$s to anchor tags with link to translation page at translate.wordpress.org */
|
admin/display/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
admin/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
admin/meta_import.php
CHANGED
@@ -1,21 +1,26 @@
|
|
1 |
<?php
|
2 |
|
3 |
if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
|
5 |
|
6 |
protected $plugin_file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
|
7 |
|
8 |
protected $deactivation_listener = 'deactivate_aioseo';
|
9 |
|
|
|
|
|
|
|
10 |
public function show_import_settings_notice() {
|
11 |
-
// $url = admin_url( 'tools.php?page=seodt' ) );
|
12 |
-
//make these save to the database and dismissible
|
13 |
-
|
14 |
|
15 |
$yoasturl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'wpseo-import' ) ), admin_url( 'admin.php?page=wpseo_tools&tool=import-export&import=1&importaioseo=1#top#import-seo' ) );
|
16 |
$aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) );
|
17 |
|
18 |
-
|
19 |
$aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
20 |
|
21 |
if ( empty( $aioseop_yst_detected_notice_dismissed ) ) {
|
@@ -24,10 +29,8 @@ if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
|
|
24 |
|
25 |
}
|
26 |
|
27 |
-
|
28 |
echo '<div class="error"><p>', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '<a href="%s">', esc_url( $yoasturl ) ), '</a>' ), '</p></div>';
|
29 |
|
30 |
-
|
31 |
}
|
32 |
|
33 |
public function show_deactivate_notice() {
|
@@ -38,29 +41,36 @@ if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
|
|
38 |
add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
function mi_aioseop_yst_detected_notice_dismissed() {
|
42 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
-
*
|
|
|
|
|
47 |
*/
|
48 |
-
add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
|
49 |
function aiosp_seometa_settings_init() {
|
50 |
global $_aiosp_seometa_admin_pagehook;
|
51 |
|
52 |
-
//
|
53 |
$_aiosp_seometa_admin_pagehook = add_submenu_page( 'tools.php', __( 'Import SEO Data', 'all-in-one-seo-pack' ), __( 'SEO Data Import', 'all-in-one-seo-pack' ), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin' );
|
54 |
}
|
|
|
|
|
55 |
|
56 |
/**
|
57 |
-
*
|
58 |
-
*
|
|
|
59 |
*/
|
60 |
function aiosp_seometa_action() {
|
61 |
|
62 |
-
//print_r($_REQUEST);
|
63 |
-
|
64 |
if ( empty( $_REQUEST['_wpnonce'] ) ) {
|
65 |
return;
|
66 |
}
|
@@ -71,13 +81,13 @@ function aiosp_seometa_action() {
|
|
71 |
return;
|
72 |
}
|
73 |
|
74 |
-
if (
|
75 |
printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
|
76 |
|
77 |
return;
|
78 |
}
|
79 |
|
80 |
-
check_admin_referer( 'aiosp_nonce' ); // Verify nonce
|
81 |
|
82 |
if ( ! empty( $_REQUEST['analyze'] ) ) {
|
83 |
|
@@ -92,7 +102,7 @@ function aiosp_seometa_action() {
|
|
92 |
|
93 |
printf( __( '<p>Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' );
|
94 |
printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
|
95 |
-
//
|
96 |
|
97 |
printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) );
|
98 |
echo '<ol>';
|
@@ -116,8 +126,6 @@ function aiosp_seometa_action() {
|
|
116 |
printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
|
117 |
printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
|
118 |
|
119 |
-
return;
|
120 |
-
|
121 |
}
|
122 |
|
123 |
/**
|
@@ -170,7 +178,7 @@ function aiosp_seometa_admin() {
|
|
170 |
|
171 |
printf( '<optgroup label="%s">', __( 'Plugins', 'all-in-one-seo-pack' ) );
|
172 |
foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
|
173 |
-
if (
|
174 |
printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
|
175 |
}
|
176 |
}
|
@@ -182,7 +190,6 @@ function aiosp_seometa_admin() {
|
|
182 |
}
|
183 |
printf( '</optgroup>' );
|
184 |
|
185 |
-
|
186 |
echo '</select>' . "\n\n";
|
187 |
|
188 |
?>
|
@@ -200,21 +207,18 @@ function aiosp_seometa_admin() {
|
|
200 |
<?php
|
201 |
}
|
202 |
|
203 |
-
|
204 |
-
//////////////////FUNCTIONS//////////////////
|
205 |
-
|
206 |
/**
|
207 |
-
*
|
208 |
*
|
209 |
-
*
|
210 |
-
*
|
211 |
-
* happens, rows that contain a post_id in that array will be ignored, to
|
212 |
-
* avoid duplicate $new meta_key entries.
|
213 |
*
|
214 |
-
* The $old entries will be left as-is if $delete_old is left false. If set
|
215 |
-
* to true, the $old entries will be deleted, rather than retained.
|
216 |
*
|
217 |
-
*
|
|
|
|
|
|
|
|
|
218 |
*/
|
219 |
function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
|
220 |
|
@@ -230,17 +234,17 @@ function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = fal
|
|
230 |
return $output;
|
231 |
}
|
232 |
|
233 |
-
// See which records we need to ignore, if any
|
234 |
$exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
|
235 |
|
236 |
-
// If no records to ignore, we'll do a basic UPDATE and DELETE
|
237 |
if ( ! $exclude ) {
|
238 |
|
239 |
$output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
|
240 |
$output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
|
241 |
$output->ignored = 0;
|
242 |
|
243 |
-
} //
|
244 |
else {
|
245 |
|
246 |
foreach ( (array) $exclude as $key => $value ) {
|
@@ -261,13 +265,15 @@ function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = fal
|
|
261 |
}
|
262 |
|
263 |
/**
|
264 |
-
*
|
265 |
-
*
|
266 |
-
*
|
267 |
*
|
268 |
-
*
|
269 |
-
*
|
270 |
-
*
|
|
|
|
|
271 |
*/
|
272 |
function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
|
273 |
|
@@ -289,24 +295,24 @@ function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'A
|
|
289 |
|
290 |
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
291 |
|
292 |
-
//
|
293 |
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
294 |
continue;
|
295 |
}
|
296 |
|
297 |
-
//
|
298 |
$old = $_aiosp_seometa_platforms[ $old_platform ][ $label ];
|
299 |
$new = $_aiosp_seometa_platforms[ $new_platform ][ $label ];
|
300 |
|
301 |
-
//
|
302 |
$result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
|
303 |
|
304 |
-
//
|
305 |
if ( is_wp_error( $result ) ) {
|
306 |
continue;
|
307 |
}
|
308 |
|
309 |
-
//
|
310 |
$output->updated += (int) $result->updated;
|
311 |
$output->ignored += (int) $result->ignored;
|
312 |
|
@@ -319,11 +325,17 @@ function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'A
|
|
319 |
}
|
320 |
|
321 |
/**
|
322 |
-
*
|
323 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
*/
|
325 |
function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
|
326 |
-
|
327 |
do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
|
328 |
|
329 |
global $wpdb, $_aiosp_seometa_platforms;
|
@@ -342,32 +354,32 @@ function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'A
|
|
342 |
|
343 |
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
344 |
|
345 |
-
//
|
346 |
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
347 |
continue;
|
348 |
}
|
349 |
|
350 |
$elements[] = $label;
|
351 |
|
352 |
-
//
|
353 |
$ignore = 0;
|
354 |
-
//
|
355 |
|
356 |
-
//
|
357 |
$update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
358 |
|
359 |
-
//
|
360 |
-
//
|
361 |
$update = count( (array) $update );
|
362 |
|
363 |
-
//
|
364 |
-
//
|
365 |
|
366 |
// update output numbers
|
367 |
$output->update += (int) $update;
|
368 |
$output->ignore += (int) $ignore;
|
369 |
|
370 |
-
}
|
371 |
|
372 |
$output->elements = $elements;
|
373 |
|
@@ -378,9 +390,6 @@ function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'A
|
|
378 |
}
|
379 |
|
380 |
|
381 |
-
////////////PLUGIN/////////
|
382 |
-
|
383 |
-
|
384 |
// define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
|
385 |
|
386 |
//add_action( 'plugins_loaded', 'aiosp_seometa_import' );
|
@@ -458,7 +467,7 @@ function aiosp_seometa_import() {
|
|
458 |
'Custom Doctitle' => 'seo_title',
|
459 |
'META Description' => 'seo_description',
|
460 |
'META Keywords' => 'seo_keywords',
|
461 |
-
)
|
462 |
);
|
463 |
|
464 |
/**
|
@@ -523,7 +532,7 @@ function aiosp_seometa_import() {
|
|
523 |
'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
|
524 |
'Canonical URI' => '_yoast_wpseo_canonical',
|
525 |
'Redirect URI' => '_yoast_wpseo_redirect',
|
526 |
-
)
|
527 |
);
|
528 |
|
529 |
/**
|
@@ -535,7 +544,7 @@ function aiosp_seometa_import() {
|
|
535 |
* Include the other elements of the plugin.
|
536 |
*/
|
537 |
// require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
|
538 |
-
//
|
539 |
|
540 |
/**
|
541 |
* Init hook.
|
1 |
<?php
|
2 |
|
3 |
if ( class_exists( 'WPSEO_Import_Hooks' ) ) {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WPSEO_Import_AIOSEO_Hooks
|
7 |
+
*
|
8 |
+
* @TODO Move this elsewhere.
|
9 |
+
*/
|
10 |
class WPSEO_Import_AIOSEO_Hooks extends WPSEO_Import_Hooks {
|
11 |
|
12 |
protected $plugin_file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
|
13 |
|
14 |
protected $deactivation_listener = 'deactivate_aioseo';
|
15 |
|
16 |
+
/**
|
17 |
+
* Show notice the old plugin is installed and offer to import its data.
|
18 |
+
*/
|
19 |
public function show_import_settings_notice() {
|
|
|
|
|
|
|
20 |
|
21 |
$yoasturl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'wpseo-import' ) ), admin_url( 'admin.php?page=wpseo_tools&tool=import-export&import=1&importaioseo=1#top#import-seo' ) );
|
22 |
$aiourl = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'aiosp-import' ) ), admin_url( 'tools.php?page=aiosp_import' ) );
|
23 |
|
|
|
24 |
$aioseop_yst_detected_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
25 |
|
26 |
if ( empty( $aioseop_yst_detected_notice_dismissed ) ) {
|
29 |
|
30 |
}
|
31 |
|
|
|
32 |
echo '<div class="error"><p>', sprintf( esc_html__( 'The plugin All-In-One-SEO has been detected. Do you want to %simport its settings%s?', 'wordpress-seo' ), sprintf( '<a href="%s">', esc_url( $yoasturl ) ), '</a>' ), '</p></div>';
|
33 |
|
|
|
34 |
}
|
35 |
|
36 |
public function show_deactivate_notice() {
|
41 |
add_action( 'init', 'mi_aioseop_yst_detected_notice_dismissed' );
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Deletes the stored dismissal of the notice.
|
46 |
+
*
|
47 |
+
* This should only happen after reactivating after being deactivated.
|
48 |
+
*/
|
49 |
function mi_aioseop_yst_detected_notice_dismissed() {
|
50 |
delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
+
* Init for settings import class.
|
55 |
+
*
|
56 |
+
* At the moment we just register the admin menu page.
|
57 |
*/
|
|
|
58 |
function aiosp_seometa_settings_init() {
|
59 |
global $_aiosp_seometa_admin_pagehook;
|
60 |
|
61 |
+
// TODO Put this in with the rest of the import/export stuff.
|
62 |
$_aiosp_seometa_admin_pagehook = add_submenu_page( 'tools.php', __( 'Import SEO Data', 'all-in-one-seo-pack' ), __( 'SEO Data Import', 'all-in-one-seo-pack' ), 'manage_options', 'aiosp_import', 'aiosp_seometa_admin' );
|
63 |
}
|
64 |
+
add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
|
65 |
+
|
66 |
|
67 |
/**
|
68 |
+
* Intercept POST data from the form submission.
|
69 |
+
*
|
70 |
+
* Use the intercepted data to convert values in the postmeta table from one platform to another.
|
71 |
*/
|
72 |
function aiosp_seometa_action() {
|
73 |
|
|
|
|
|
74 |
if ( empty( $_REQUEST['_wpnonce'] ) ) {
|
75 |
return;
|
76 |
}
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
+
if ( 'All in One SEO Pack' === $_REQUEST['platform_old'] ) {
|
85 |
printf( '<div class="error"><p>%s</p></div>', __( 'Sorry, you can\'t do that. Please choose a platform and then click Analyze or Convert.' ) );
|
86 |
|
87 |
return;
|
88 |
}
|
89 |
|
90 |
+
check_admin_referer( 'aiosp_nonce' ); // Verify nonce. TODO We should make this better.
|
91 |
|
92 |
if ( ! empty( $_REQUEST['analyze'] ) ) {
|
93 |
|
102 |
|
103 |
printf( __( '<p>Analyzing records in a %s to %s conversion…', 'all-in-one-seo-pack' ), esc_html( $_POST['platform_old'] ), 'All in One SEO Pack' );
|
104 |
printf( '<p><b>%d</b> Compatible Records were identified</p>', $response->update );
|
105 |
+
// printf( '<p>%d Compatible Records will be ignored</p>', $response->ignore );
|
106 |
|
107 |
printf( '<p><b>%s</b></p>', __( 'Compatible data:', 'all-in-one-seo-pack' ) );
|
108 |
echo '<ol>';
|
126 |
printf( '<p><b>%d</b> Records were updated</p>', isset( $result->updated ) ? $result->updated : 0 );
|
127 |
printf( '<p><b>%d</b> Records were ignored</p>', isset( $result->ignored ) ? $result->ignored : 0 );
|
128 |
|
|
|
|
|
129 |
}
|
130 |
|
131 |
/**
|
178 |
|
179 |
printf( '<optgroup label="%s">', __( 'Plugins', 'all-in-one-seo-pack' ) );
|
180 |
foreach ( $_aiosp_seometa_plugins as $platform => $data ) {
|
181 |
+
if ( 'All in One SEO Pack' !== $platform ) {
|
182 |
printf( '<option value="%s" %s>%s</option>', $platform, selected( $platform, $platform_old, 0 ), $platform );
|
183 |
}
|
184 |
}
|
190 |
}
|
191 |
printf( '</optgroup>' );
|
192 |
|
|
|
193 |
echo '</select>' . "\n\n";
|
194 |
|
195 |
?>
|
207 |
<?php
|
208 |
}
|
209 |
|
|
|
|
|
|
|
210 |
/**
|
211 |
+
* Convert old meta_key entries in the post meta table into new entries.
|
212 |
*
|
213 |
+
* First check to see what records for $new already exist, storing the corresponding post_id values in an array.
|
214 |
+
* When the conversion happens, ignore rows that contain a post_id, to avoid duplicate entries.
|
|
|
|
|
215 |
*
|
|
|
|
|
216 |
*
|
217 |
+
* @param string $old Old meta_key entries.
|
218 |
+
* @param string $new New meta_key entries.
|
219 |
+
* @param bool $delete_old Whether to delete the old entries.
|
220 |
+
*
|
221 |
+
* @return stdClass Object for error detection, and the number of affected rows.
|
222 |
*/
|
223 |
function aiosp_seometa_meta_key_convert( $old = '', $new = '', $delete_old = false ) {
|
224 |
|
234 |
return $output;
|
235 |
}
|
236 |
|
237 |
+
// See which records we need to ignore, if any.
|
238 |
$exclude = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $new ) );
|
239 |
|
240 |
+
// If no records to ignore, we'll do a basic UPDATE and DELETE.
|
241 |
if ( ! $exclude ) {
|
242 |
|
243 |
$output->updated = $wpdb->update( $wpdb->postmeta, array( 'meta_key' => $new ), array( 'meta_key' => $old ) );
|
244 |
$output->deleted = $delete_old ? $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $old ) ) : 0;
|
245 |
$output->ignored = 0;
|
246 |
|
247 |
+
} // Else, do a more complex UPDATE and DELETE.
|
248 |
else {
|
249 |
|
250 |
foreach ( (array) $exclude as $key => $value ) {
|
265 |
}
|
266 |
|
267 |
/**
|
268 |
+
* Convert old to new postmeta.
|
269 |
+
*
|
270 |
+
* Cycle through all compatible SEO entries of two platforms and aiosp_seometa_meta_key_convert conversion for each key.
|
271 |
*
|
272 |
+
* @param string $old_platform
|
273 |
+
* @param string $new_platform
|
274 |
+
* @param bool $delete_old
|
275 |
+
*
|
276 |
+
* @return stdClass Results object.
|
277 |
*/
|
278 |
function aiosp_seometa_post_meta_convert( $old_platform = '', $new_platform = 'All in One SEO Pack', $delete_old = false ) {
|
279 |
|
295 |
|
296 |
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
297 |
|
298 |
+
// Skip iterations where no $new analog exists.
|
299 |
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
300 |
continue;
|
301 |
}
|
302 |
|
303 |
+
// Set $old and $new meta_key values.
|
304 |
$old = $_aiosp_seometa_platforms[ $old_platform ][ $label ];
|
305 |
$new = $_aiosp_seometa_platforms[ $new_platform ][ $label ];
|
306 |
|
307 |
+
// Convert.
|
308 |
$result = aiosp_seometa_meta_key_convert( $old, $new, $delete_old );
|
309 |
|
310 |
+
// Error check.
|
311 |
if ( is_wp_error( $result ) ) {
|
312 |
continue;
|
313 |
}
|
314 |
|
315 |
+
// Update total updated/ignored count.
|
316 |
$output->updated += (int) $result->updated;
|
317 |
$output->ignored += (int) $result->ignored;
|
318 |
|
325 |
}
|
326 |
|
327 |
/**
|
328 |
+
* Analyze two platforms to find shared and compatible elements.
|
329 |
+
*
|
330 |
+
* See what data can be converted from one to the other.
|
331 |
+
*
|
332 |
+
* @param string $old_platform
|
333 |
+
* @param string $new_platform
|
334 |
+
*
|
335 |
+
* @return stdClass
|
336 |
*/
|
337 |
function aiosp_seometa_post_meta_analyze( $old_platform = '', $new_platform = 'All in One SEO Pack' ) {
|
338 |
+
// TODO Figure out which elements to ignore.
|
339 |
do_action( 'pre_aiosp_seometa_post_meta_analyze', $old_platform, $new_platform );
|
340 |
|
341 |
global $wpdb, $_aiosp_seometa_platforms;
|
354 |
|
355 |
foreach ( (array) $_aiosp_seometa_platforms[ $old_platform ] as $label => $meta_key ) {
|
356 |
|
357 |
+
// Skip iterations where no $new analog exists.
|
358 |
if ( empty( $_aiosp_seometa_platforms[ $new_platform ][ $label ] ) ) {
|
359 |
continue;
|
360 |
}
|
361 |
|
362 |
$elements[] = $label;
|
363 |
|
364 |
+
// See which records to ignore, if any.
|
365 |
$ignore = 0;
|
366 |
+
// $ignore = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
367 |
|
368 |
+
// See which records to update, if any.
|
369 |
$update = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) );
|
370 |
|
371 |
+
// Count items in returned arrays.
|
372 |
+
// $ignore = count( (array)$ignore );
|
373 |
$update = count( (array) $update );
|
374 |
|
375 |
+
// Calculate update/ignore by comparison.
|
376 |
+
// $update = ( (int)$update > (int)$ignore ) ? ( (int)$update - (int)$ignore ) : 0;
|
377 |
|
378 |
// update output numbers
|
379 |
$output->update += (int) $update;
|
380 |
$output->ignore += (int) $ignore;
|
381 |
|
382 |
+
}
|
383 |
|
384 |
$output->elements = $elements;
|
385 |
|
390 |
}
|
391 |
|
392 |
|
|
|
|
|
|
|
393 |
// define('aiosp_seometa_PLUGIN_DIR', dirname(__FILE__));
|
394 |
|
395 |
//add_action( 'plugins_loaded', 'aiosp_seometa_import' );
|
467 |
'Custom Doctitle' => 'seo_title',
|
468 |
'META Description' => 'seo_description',
|
469 |
'META Keywords' => 'seo_keywords',
|
470 |
+
),
|
471 |
);
|
472 |
|
473 |
/**
|
532 |
'nofollow' => '_yoast_wpseo_meta-robots-nofollow',
|
533 |
'Canonical URI' => '_yoast_wpseo_canonical',
|
534 |
'Redirect URI' => '_yoast_wpseo_redirect',
|
535 |
+
),
|
536 |
);
|
537 |
|
538 |
/**
|
544 |
* Include the other elements of the plugin.
|
545 |
*/
|
546 |
// require_once( aiosp_seometa_PLUGIN_DIR . '/admin.php' );
|
547 |
+
// require_once( aiosp_seometa_PLUGIN_DIR . '/functions.php' );
|
548 |
|
549 |
/**
|
550 |
* Init hook.
|
aioseop-init.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* We'll eventually put stuff in here from the main plugin file.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
+
*
|
7 |
+
*/
|
aioseop_class.php
CHANGED
@@ -1,40 +1,46 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
|
6 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); // Include the module base class.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
9 |
-
//The main class.
|
10 |
|
11 |
-
|
12 |
var $version = AIOSEOP_VERSION;
|
13 |
|
14 |
-
|
15 |
var $maximum_description_length = 160;
|
16 |
|
17 |
-
|
18 |
-
* as description. Touch only if you know what you're doing
|
19 |
-
*/
|
20 |
var $minimum_description_length = 1;
|
21 |
|
22 |
-
|
23 |
var $ob_start_detected = false;
|
24 |
|
25 |
-
|
26 |
var $title_start = - 1;
|
27 |
|
28 |
-
|
29 |
var $title_end = - 1;
|
30 |
|
31 |
-
|
32 |
var $orig_title = '';
|
33 |
|
34 |
-
|
35 |
var $log_file;
|
36 |
|
37 |
-
|
38 |
var $do_log;
|
39 |
|
40 |
var $token;
|
@@ -46,9 +52,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
46 |
var $meta_opts = false;
|
47 |
var $is_front_page = null;
|
48 |
|
|
|
|
|
|
|
49 |
function __construct() {
|
50 |
global $aioseop_options;
|
51 |
-
$this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___
|
52 |
|
53 |
if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) {
|
54 |
$this->do_log = true;
|
@@ -59,14 +68,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
59 |
$this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
|
60 |
$this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
|
61 |
|
62 |
-
$this->prefix = 'aiosp_'; //
|
63 |
$this->option_name = 'aioseop_options';
|
64 |
$this->store_option = true;
|
65 |
-
$this->file = __FILE__; //
|
66 |
$blog_name = esc_attr( get_bloginfo( 'name' ) );
|
67 |
parent::__construct();
|
68 |
|
69 |
-
$this->help_text =
|
70 |
'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ),
|
71 |
'license_key' => __( 'This will be the license key received when the product was purchased. This is used for automatic upgrades.', 'all-in-one-seo-pack' ),
|
72 |
'can' => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href=\'http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html\' target=\'_blank\'>Google</a>.", 'all-in-one-seo-pack' ),
|
@@ -94,8 +103,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
94 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
95 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
96 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
97 |
-
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
98 |
-
'</ul>',
|
99 |
'page_title_format' =>
|
100 |
__( 'This controls the format of the title tag for Pages.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
101 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -104,8 +112,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
104 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
105 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
106 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
107 |
-
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
108 |
-
'</ul>',
|
109 |
'post_title_format' =>
|
110 |
__( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
111 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -116,8 +123,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
116 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
117 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
118 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
119 |
-
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>'
|
120 |
-
'</ul>',
|
121 |
'category_title_format' =>
|
122 |
__( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
123 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -181,9 +187,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
181 |
'google_publisher' => __( 'Enter your Google+ Profile URL here to add the rel=“author” tag to your site for Google authorship. It is recommended that the URL you enter here should be your personal Google+ profile. Use the Advanced Authorship Options below if you want greater control over the use of authorship.', 'all-in-one-seo-pack' ),
|
182 |
'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ),
|
183 |
'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ),
|
184 |
-
'google_author_location' => __(
|
185 |
-
'google_enable_publisher' => __(
|
186 |
-
'google_specify_publisher' => __(
|
187 |
'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ),
|
188 |
'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ),
|
189 |
'google_connect' => __( 'Press the connect button to connect with Google Analytics; or if already connected, press the disconnect button to disable and remove any stored analytics credentials.', 'all-in-one-seo-pack' ),
|
@@ -201,6 +207,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
201 |
'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ),
|
202 |
'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ),
|
203 |
'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ),
|
|
|
204 |
'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
205 |
'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
206 |
'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
@@ -221,30 +228,33 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
221 |
'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
|
222 |
'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ),
|
223 |
'unprotect_meta' => __( "Check this to unprotect internal postmeta fields for use with XMLRPC. If you don't know what that is, leave it unchecked.", 'all-in-one-seo-pack' ),
|
224 |
-
'ex_pages' => __(
|
225 |
'post_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Posts. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
226 |
'page_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
227 |
'front_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the front page if you have set a static page in Settings, Reading, Front Page Displays. You can enter whatever additional headers you want here, even references to stylesheets. This will fall back to using Additional Page Headers if you have them set and nothing is entered here.', 'all-in-one-seo-pack' ),
|
228 |
'home_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the home page if you have Front page displays your latest posts selected in Settings, Reading. It will also be copied verbatim to the header on the Posts page if you have one set in Settings, Reading. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
229 |
);
|
230 |
|
231 |
-
$this->help_anchors =
|
232 |
'license_key' => '#license-key',
|
233 |
'can' => '#canonical-urls',
|
234 |
'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
|
235 |
'customize_canonical_links' => '#enable-custom-canonical-urls',
|
|
|
236 |
'use_original_title' => '#use-original-title',
|
237 |
'schema_markup' => '#use-schema-markup',
|
238 |
'do_log' => '#log-important-events',
|
239 |
'home_title' => '#home-title',
|
240 |
'home_description' => '#home-description',
|
241 |
'home_keywords' => '#home-keywords',
|
|
|
242 |
'togglekeywords' => '#use-keywords',
|
243 |
'use_categories' => '#use-categories-for-meta-keywords',
|
244 |
'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
|
245 |
'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
|
246 |
'rewrite_titles' => '#rewrite-titles',
|
247 |
'cap_titles' => '#capitalize-titles',
|
|
|
248 |
'home_page_title_format' => '#title-format-fields',
|
249 |
'page_title_format' => '#title-format-fields',
|
250 |
'post_title_format' => '#title-format-fields',
|
@@ -254,7 +264,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
254 |
'author_title_format' => '#title-format-fields',
|
255 |
'tag_title_format' => '#title-format-fields',
|
256 |
'search_title_format' => '#title-format-fields',
|
|
|
257 |
'404_title_format' => '#title-format-fields',
|
|
|
258 |
'enablecpost' => '#seo-for-custom-post-types',
|
259 |
'cpostadvanced' => '#enable-advanced-options',
|
260 |
'cpostactive' => '#seo-on-only-these-post-types',
|
@@ -268,6 +280,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
268 |
'pinterest_verify' => '',
|
269 |
'google_publisher' => '#google-plus-default-profile',
|
270 |
'google_disable_profile' => '#disable-google-plus-profile',
|
|
|
|
|
271 |
'google_author_advanced' => '#advanced-authorship-options',
|
272 |
'google_author_location' => '#display-google-authorship',
|
273 |
'google_enable_publisher' => '#display-publisher-meta-on-front-page',
|
@@ -283,10 +297,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
283 |
'ga_track_outbound_links' => '#track-outbound-links',
|
284 |
'ga_link_attribution' => '#enhanced-link-attribution',
|
285 |
'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
|
286 |
-
'cpostnoindex' => '#
|
287 |
-
'cpostnofollow' => '#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
'noodp' => '#exclude-site-from-the-open-directory-project',
|
289 |
'noydir' => '#exclude-site-from-yahoo-directory',
|
|
|
290 |
'generate_descriptions' => '#autogenerate-descriptions',
|
291 |
'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
|
292 |
'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
|
@@ -296,10 +322,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
296 |
'post_meta_tags' => '#additional-post-headers',
|
297 |
'page_meta_tags' => '#additional-page-headers',
|
298 |
'front_meta_tags' => '#additional-front-page-headers',
|
299 |
-
'home_meta_tags' => '#additional-blog-page-headers'
|
300 |
);
|
301 |
|
302 |
-
$meta_help_text =
|
303 |
'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
|
304 |
'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
|
305 |
'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
|
@@ -313,18 +339,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
313 |
'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
|
314 |
'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
|
315 |
'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
|
316 |
-
'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' )
|
317 |
);
|
318 |
|
319 |
$this->default_options = array(
|
320 |
-
'license_key' =>
|
321 |
'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
|
322 |
-
'type' => 'text'
|
323 |
),
|
324 |
-
'donate' =>
|
325 |
-
'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' )
|
326 |
),
|
327 |
-
'home_title' =>
|
328 |
'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
|
329 |
'default' => null,
|
330 |
'type' => 'textarea',
|
@@ -332,9 +358,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
332 |
'count' => true,
|
333 |
'rows' => 1,
|
334 |
'cols' => 60,
|
335 |
-
'condshow' =>
|
336 |
),
|
337 |
-
'home_description' =>
|
338 |
'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
|
339 |
'default' => '',
|
340 |
'type' => 'textarea',
|
@@ -342,576 +368,576 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
342 |
'count' => true,
|
343 |
'cols' => 80,
|
344 |
'rows' => 2,
|
345 |
-
'condshow' =>
|
346 |
),
|
347 |
-
'togglekeywords' =>
|
348 |
'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
|
349 |
'default' => 1,
|
350 |
'type' => 'radio',
|
351 |
-
'initial_options' =>
|
352 |
0 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
353 |
-
1 => __( 'Disabled', 'all-in-one-seo-pack' )
|
354 |
-
)
|
355 |
),
|
356 |
-
'home_keywords' =>
|
357 |
'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
|
358 |
'default' => null,
|
359 |
'type' => 'textarea',
|
360 |
'sanitize' => 'text',
|
361 |
-
'condshow' =>
|
362 |
),
|
363 |
-
'use_static_home_info' =>
|
364 |
'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ),
|
365 |
'default' => 0,
|
366 |
'type' => 'radio',
|
367 |
-
'initial_options' =>
|
368 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
369 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
370 |
-
)
|
371 |
),
|
372 |
-
'can' =>
|
373 |
'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
|
374 |
-
'default' => 1
|
375 |
),
|
376 |
-
'no_paged_canonical_links' =>
|
377 |
'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
|
378 |
'default' => 0,
|
379 |
-
'condshow' =>
|
380 |
),
|
381 |
-
'customize_canonical_links' =>
|
382 |
'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
|
383 |
'default' => 0,
|
384 |
-
'condshow' =>
|
385 |
),
|
386 |
-
'can_set_protocol' =>
|
387 |
'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
|
388 |
'type' => 'radio',
|
389 |
'default' => 'auto',
|
390 |
-
'initial_options' =>
|
391 |
'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
|
392 |
'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
|
393 |
-
'https' => __( 'HTTPS', 'all-in-one-seo-pack' )
|
394 |
),
|
395 |
-
'condshow' =>
|
396 |
),
|
397 |
-
'rewrite_titles' =>
|
398 |
'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
|
399 |
'default' => 1,
|
400 |
'type' => 'radio',
|
401 |
-
'initial_options' =>
|
402 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
403 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
404 |
-
)
|
405 |
),
|
406 |
-
'force_rewrites' =>
|
407 |
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
408 |
'default' => 1,
|
409 |
'type' => 'hidden',
|
410 |
'prefix' => $this->prefix,
|
411 |
-
'initial_options' =>
|
412 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
413 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
414 |
-
)
|
415 |
),
|
416 |
-
'use_original_title' =>
|
417 |
'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
|
418 |
'type' => 'radio',
|
419 |
'default' => 0,
|
420 |
-
'initial_options' =>
|
421 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
422 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
423 |
-
)
|
424 |
),
|
425 |
-
'cap_titles' =>
|
426 |
'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
|
427 |
-
'default' => 1
|
428 |
),
|
429 |
-
'cap_cats' =>
|
430 |
'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ),
|
431 |
-
'default' => 1
|
432 |
),
|
433 |
-
'home_page_title_format' =>
|
434 |
'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
|
435 |
'type' => 'text',
|
436 |
'default' => '%page_title%',
|
437 |
-
'condshow' =>
|
438 |
),
|
439 |
-
'page_title_format' =>
|
440 |
'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
|
441 |
'type' => 'text',
|
442 |
'default' => '%page_title% | %blog_title%',
|
443 |
-
'condshow' =>
|
444 |
),
|
445 |
-
'post_title_format' =>
|
446 |
'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
|
447 |
'type' => 'text',
|
448 |
'default' => '%post_title% | %blog_title%',
|
449 |
-
'condshow' =>
|
450 |
),
|
451 |
-
'category_title_format' =>
|
452 |
'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
|
453 |
'type' => 'text',
|
454 |
'default' => '%category_title% | %blog_title%',
|
455 |
-
'condshow' =>
|
456 |
),
|
457 |
-
'archive_title_format' =>
|
458 |
'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
|
459 |
'type' => 'text',
|
460 |
'default' => '%archive_title% | %blog_title%',
|
461 |
-
'condshow' =>
|
462 |
),
|
463 |
-
'date_title_format' =>
|
464 |
'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
|
465 |
'type' => 'text',
|
466 |
'default' => '%date% | %blog_title%',
|
467 |
-
'condshow' =>
|
468 |
),
|
469 |
-
'author_title_format' =>
|
470 |
'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
|
471 |
'type' => 'text',
|
472 |
'default' => '%author% | %blog_title%',
|
473 |
-
'condshow' =>
|
474 |
),
|
475 |
-
'tag_title_format' =>
|
476 |
'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
|
477 |
'type' => 'text',
|
478 |
'default' => '%tag% | %blog_title%',
|
479 |
-
'condshow' =>
|
480 |
),
|
481 |
-
'search_title_format' =>
|
482 |
'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
|
483 |
'type' => 'text',
|
484 |
'default' => '%search% | %blog_title%',
|
485 |
-
'condshow' =>
|
486 |
),
|
487 |
-
'description_format' =>
|
488 |
'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
|
489 |
'type' => 'text',
|
490 |
'default' => '%description%',
|
491 |
-
'condshow' =>
|
492 |
),
|
493 |
-
'404_title_format' =>
|
494 |
'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
|
495 |
'type' => 'text',
|
496 |
'default' => 'Nothing found for %request_words%',
|
497 |
-
'condshow' =>
|
498 |
),
|
499 |
-
'paged_format' =>
|
500 |
'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
|
501 |
'type' => 'text',
|
502 |
'default' => ' - Part %page%',
|
503 |
-
'condshow' =>
|
504 |
),
|
505 |
-
'enablecpost' =>
|
506 |
'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
|
507 |
'default' => 'on',
|
508 |
'type' => 'radio',
|
509 |
-
'initial_options' =>
|
510 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
511 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
512 |
-
)
|
513 |
),
|
514 |
-
'cpostactive' =>
|
515 |
'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
|
516 |
'type' => 'multicheckbox',
|
517 |
'default' => array( 'post', 'page' ),
|
518 |
-
'condshow' =>
|
519 |
),
|
520 |
-
'taxactive' =>
|
521 |
'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
|
522 |
'type' => 'multicheckbox',
|
523 |
'default' => array( 'category', 'post_tag' ),
|
524 |
-
'condshow' =>
|
525 |
),
|
526 |
-
'cpostadvanced' =>
|
527 |
'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
|
528 |
'default' => 0,
|
529 |
'type' => 'radio',
|
530 |
-
'initial_options' =>
|
531 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
532 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
533 |
),
|
534 |
'label' => null,
|
535 |
-
'condshow' =>
|
536 |
),
|
537 |
-
'cpostnoindex' =>
|
538 |
'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
|
539 |
'type' => 'multicheckbox',
|
540 |
'default' => array(),
|
541 |
),
|
542 |
-
'cpostnofollow' =>
|
543 |
'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
|
544 |
'type' => 'multicheckbox',
|
545 |
'default' => array(),
|
546 |
),
|
547 |
-
'cpostnoodp' =>
|
548 |
'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
|
549 |
'type' => 'multicheckbox',
|
550 |
'default' => array(),
|
551 |
),
|
552 |
-
'cpostnoydir' =>
|
553 |
'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
|
554 |
'type' => 'multicheckbox',
|
555 |
'default' => array(),
|
556 |
),
|
557 |
-
'cposttitles' =>
|
558 |
'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
|
559 |
'type' => 'checkbox',
|
560 |
'default' => 0,
|
561 |
-
'condshow' =>
|
562 |
'aiosp_rewrite_titles' => 1,
|
563 |
'aiosp_enablecpost' => 'on',
|
564 |
-
'aiosp_cpostadvanced' => 'on'
|
565 |
-
)
|
566 |
),
|
567 |
-
'posttypecolumns' =>
|
568 |
'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
|
569 |
'type' => 'multicheckbox',
|
570 |
'default' => array( 'post', 'page' ),
|
571 |
-
'condshow' =>
|
572 |
),
|
573 |
-
'admin_bar' =>
|
574 |
'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ),
|
575 |
'default' => 'on',
|
576 |
),
|
577 |
-
'custom_menu_order' =>
|
578 |
'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ),
|
579 |
'default' => 'on',
|
580 |
),
|
581 |
-
'google_verify' =>
|
582 |
'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ),
|
583 |
'default' => '',
|
584 |
-
'type' => 'text'
|
585 |
),
|
586 |
-
'bing_verify' =>
|
587 |
'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ),
|
588 |
'default' => '',
|
589 |
-
'type' => 'text'
|
590 |
),
|
591 |
-
'pinterest_verify' =>
|
592 |
'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
|
593 |
'default' => '',
|
594 |
-
'type' => 'text'
|
595 |
),
|
596 |
-
'google_publisher' =>
|
597 |
'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ),
|
598 |
'default' => '',
|
599 |
-
'type' => 'text'
|
600 |
),
|
601 |
-
'google_disable_profile' =>
|
602 |
'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ),
|
603 |
'default' => 0,
|
604 |
-
'type' => 'checkbox'
|
605 |
),
|
606 |
-
'google_sitelinks_search' =>
|
607 |
-
'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' )
|
608 |
),
|
609 |
-
'google_set_site_name' =>
|
610 |
-
'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' )
|
611 |
),
|
612 |
-
'google_specify_site_name' =>
|
613 |
'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
|
614 |
'type' => 'text',
|
615 |
'placeholder' => $blog_name,
|
616 |
-
'condshow' =>
|
617 |
),
|
618 |
-
'google_author_advanced' =>
|
619 |
'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
|
620 |
'default' => 0,
|
621 |
'type' => 'radio',
|
622 |
-
'initial_options' =>
|
623 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
624 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
625 |
),
|
626 |
-
'label' => null
|
627 |
),
|
628 |
-
'google_author_location' =>
|
629 |
'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ),
|
630 |
'default' => array( 'all' ),
|
631 |
'type' => 'multicheckbox',
|
632 |
-
'condshow' =>
|
633 |
),
|
634 |
-
'google_enable_publisher' =>
|
635 |
'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
|
636 |
'default' => 'on',
|
637 |
'type' => 'radio',
|
638 |
-
'initial_options' =>
|
639 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
640 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
641 |
),
|
642 |
-
'condshow' =>
|
643 |
),
|
644 |
-
'google_specify_publisher' =>
|
645 |
'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ),
|
646 |
'type' => 'text',
|
647 |
-
'condshow' =>
|
648 |
),
|
649 |
-
//
|
650 |
-
'google_analytics_id' =>
|
651 |
'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
|
652 |
'default' => null,
|
653 |
'type' => 'text',
|
654 |
-
'placeholder' => 'UA-########-#'
|
655 |
),
|
656 |
-
'ga_use_universal_analytics' =>
|
657 |
'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
|
658 |
'default' => 0,
|
659 |
-
'condshow' =>
|
660 |
-
'aiosp_google_analytics_id' =>
|
661 |
'lhs' => 'aiosp_google_analytics_id',
|
662 |
'op' => '!=',
|
663 |
-
'rhs' => ''
|
664 |
-
)
|
665 |
-
)
|
666 |
),
|
667 |
-
'ga_advanced_options' =>
|
668 |
'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
|
669 |
'default' => 'on',
|
670 |
'type' => 'radio',
|
671 |
-
'initial_options' =>
|
672 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
673 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
674 |
),
|
675 |
-
'condshow' =>
|
676 |
-
'aiosp_google_analytics_id' =>
|
677 |
'lhs' => 'aiosp_google_analytics_id',
|
678 |
'op' => '!=',
|
679 |
-
'rhs' => ''
|
680 |
-
)
|
681 |
-
)
|
682 |
),
|
683 |
-
'ga_domain' =>
|
684 |
'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
|
685 |
'type' => 'text',
|
686 |
-
'condshow' =>
|
687 |
-
'aiosp_google_analytics_id' =>
|
688 |
'lhs' => 'aiosp_google_analytics_id',
|
689 |
'op' => '!=',
|
690 |
-
'rhs' => ''
|
691 |
),
|
692 |
-
'aiosp_ga_advanced_options' => 'on'
|
693 |
-
)
|
694 |
),
|
695 |
-
'ga_multi_domain' =>
|
696 |
'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
|
697 |
'default' => 0,
|
698 |
-
'condshow' =>
|
699 |
-
'aiosp_google_analytics_id' =>
|
700 |
'lhs' => 'aiosp_google_analytics_id',
|
701 |
'op' => '!=',
|
702 |
-
'rhs' => ''
|
703 |
),
|
704 |
-
'aiosp_ga_advanced_options' => 'on'
|
705 |
-
)
|
706 |
),
|
707 |
-
'ga_addl_domains' =>
|
708 |
'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
|
709 |
'type' => 'textarea',
|
710 |
-
'condshow' =>
|
711 |
-
'aiosp_google_analytics_id' =>
|
712 |
'lhs' => 'aiosp_google_analytics_id',
|
713 |
'op' => '!=',
|
714 |
-
'rhs' => ''
|
715 |
),
|
716 |
'aiosp_ga_advanced_options' => 'on',
|
717 |
-
'aiosp_ga_multi_domain' => 'on'
|
718 |
-
)
|
719 |
),
|
720 |
-
'ga_anonymize_ip' =>
|
721 |
'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
|
722 |
'type' => 'checkbox',
|
723 |
-
'condshow' =>
|
724 |
-
'aiosp_google_analytics_id' =>
|
725 |
'lhs' => 'aiosp_google_analytics_id',
|
726 |
'op' => '!=',
|
727 |
-
'rhs' => ''
|
728 |
),
|
729 |
-
'aiosp_ga_advanced_options' => 'on'
|
730 |
-
)
|
731 |
),
|
732 |
-
'ga_display_advertising' =>
|
733 |
'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
|
734 |
'type' => 'checkbox',
|
735 |
-
'condshow' =>
|
736 |
-
'aiosp_google_analytics_id' =>
|
737 |
'lhs' => 'aiosp_google_analytics_id',
|
738 |
'op' => '!=',
|
739 |
-
'rhs' => ''
|
740 |
),
|
741 |
-
'aiosp_ga_advanced_options' => 'on'
|
742 |
-
)
|
743 |
),
|
744 |
-
'ga_exclude_users' =>
|
745 |
'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
|
746 |
'type' => 'multicheckbox',
|
747 |
-
'condshow' =>
|
748 |
-
'aiosp_google_analytics_id' =>
|
749 |
'lhs' => 'aiosp_google_analytics_id',
|
750 |
'op' => '!=',
|
751 |
-
'rhs' => ''
|
752 |
),
|
753 |
-
'aiosp_ga_advanced_options' => 'on'
|
754 |
-
)
|
755 |
),
|
756 |
-
'ga_track_outbound_links' =>
|
757 |
'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
|
758 |
'default' => 0,
|
759 |
-
'condshow' =>
|
760 |
-
'aiosp_google_analytics_id' =>
|
761 |
'lhs' => 'aiosp_google_analytics_id',
|
762 |
'op' => '!=',
|
763 |
-
'rhs' => ''
|
764 |
),
|
765 |
-
'aiosp_ga_advanced_options' => 'on'
|
766 |
-
)
|
767 |
),
|
768 |
-
'ga_link_attribution' =>
|
769 |
'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
|
770 |
'default' => 0,
|
771 |
-
'condshow' =>
|
772 |
-
'aiosp_google_analytics_id' =>
|
773 |
'lhs' => 'aiosp_google_analytics_id',
|
774 |
'op' => '!=',
|
775 |
-
'rhs' => ''
|
776 |
),
|
777 |
-
'aiosp_ga_advanced_options' => 'on'
|
778 |
-
)
|
779 |
),
|
780 |
-
'ga_enhanced_ecommerce' =>
|
781 |
'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
|
782 |
'default' => 0,
|
783 |
-
'condshow' =>
|
784 |
-
'aiosp_google_analytics_id' =>
|
785 |
'lhs' => 'aiosp_google_analytics_id',
|
786 |
'op' => '!=',
|
787 |
-
'rhs' => ''
|
788 |
),
|
789 |
'aiosp_ga_use_universal_analytics' => 'on',
|
790 |
-
'aiosp_ga_advanced_options' => 'on'
|
791 |
-
)
|
792 |
),
|
793 |
-
'use_categories' =>
|
794 |
'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
|
795 |
'default' => 0,
|
796 |
-
'condshow' =>
|
797 |
),
|
798 |
-
'use_tags_as_keywords' =>
|
799 |
'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
|
800 |
'default' => 1,
|
801 |
-
'condshow' =>
|
802 |
),
|
803 |
-
'dynamic_postspage_keywords' =>
|
804 |
'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
|
805 |
'default' => 1,
|
806 |
-
'condshow' =>
|
807 |
),
|
808 |
-
'category_noindex' =>
|
809 |
'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
|
810 |
-
'default' => 1
|
811 |
),
|
812 |
-
'archive_date_noindex' =>
|
813 |
'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
|
814 |
-
'default' => 1
|
815 |
),
|
816 |
-
'archive_author_noindex' =>
|
817 |
'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
|
818 |
-
'default' => 1
|
819 |
),
|
820 |
-
'tags_noindex' =>
|
821 |
'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
|
822 |
-
'default' => 0
|
823 |
),
|
824 |
-
'search_noindex' =>
|
825 |
'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
|
826 |
-
'default' => 0
|
827 |
),
|
828 |
-
'404_noindex' =>
|
829 |
'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
|
830 |
-
'default' => 0
|
831 |
),
|
832 |
-
'tax_noindex' =>
|
833 |
'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
|
834 |
'type' => 'multicheckbox',
|
835 |
'default' => array(),
|
836 |
-
'condshow' =>
|
837 |
),
|
838 |
-
'paginated_noindex' =>
|
839 |
'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
840 |
-
'default' => 0
|
841 |
),
|
842 |
-
'paginated_nofollow' =>
|
843 |
'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
844 |
-
'default' => 0
|
845 |
),
|
846 |
-
'noodp' =>
|
847 |
'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
|
848 |
-
'default' => 0
|
849 |
),
|
850 |
-
'noydir' =>
|
851 |
'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
|
852 |
-
'default' => 0
|
853 |
),
|
854 |
-
'skip_excerpt' =>
|
855 |
'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
|
856 |
-
'default' => 0
|
857 |
),
|
858 |
-
'generate_descriptions' =>
|
859 |
'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
|
860 |
-
'default' => 1
|
861 |
),
|
862 |
-
'run_shortcodes' =>
|
863 |
'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
|
864 |
'default' => 0,
|
865 |
-
'condshow' =>
|
866 |
),
|
867 |
-
'hide_paginated_descriptions' =>
|
868 |
'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
|
869 |
-
'default' => 0
|
870 |
),
|
871 |
-
'dont_truncate_descriptions' =>
|
872 |
'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
|
873 |
-
'default' => 0
|
874 |
),
|
875 |
-
'schema_markup' =>
|
876 |
'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
|
877 |
-
'default' => 1
|
878 |
),
|
879 |
-
'unprotect_meta' =>
|
880 |
'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
|
881 |
-
'default' => 0
|
882 |
),
|
883 |
-
'ex_pages' =>
|
884 |
'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
|
885 |
'type' => 'textarea',
|
886 |
-
'default' => ''
|
887 |
),
|
888 |
-
'post_meta_tags' =>
|
889 |
'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
|
890 |
'type' => 'textarea',
|
891 |
'default' => '',
|
892 |
-
'sanitize' => 'default'
|
893 |
),
|
894 |
-
'page_meta_tags' =>
|
895 |
'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
|
896 |
'type' => 'textarea',
|
897 |
'default' => '',
|
898 |
-
'sanitize' => 'default'
|
899 |
),
|
900 |
-
'front_meta_tags' =>
|
901 |
'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
|
902 |
'type' => 'textarea',
|
903 |
'default' => '',
|
904 |
-
'sanitize' => 'default'
|
905 |
),
|
906 |
-
'home_meta_tags' =>
|
907 |
'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
|
908 |
'type' => 'textarea',
|
909 |
'default' => '',
|
910 |
-
'sanitize' => 'default'
|
911 |
),
|
912 |
-
'do_log' =>
|
913 |
'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
|
914 |
-
'default' => null
|
915 |
),
|
916 |
);
|
917 |
|
@@ -922,14 +948,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
922 |
unset( $this->default_options['taxactive'] );
|
923 |
}
|
924 |
|
925 |
-
$this->locations =
|
926 |
-
'default' =>
|
927 |
-
'aiosp' =>
|
928 |
'name' => $this->plugin_name,
|
929 |
'type' => 'metabox',
|
930 |
'prefix' => '',
|
931 |
'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
|
932 |
-
'options' =>
|
933 |
'edit',
|
934 |
'nonce-aioseop-edit',
|
935 |
AIOSEOPPRO ? 'support' : 'upgrade',
|
@@ -946,33 +972,33 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
946 |
'menulabel',
|
947 |
'sitemap_exclude',
|
948 |
'disable',
|
949 |
-
'disable_analytics'
|
950 |
),
|
951 |
-
'default_options' =>
|
952 |
-
'edit' =>
|
953 |
'type' => 'hidden',
|
954 |
'default' => 'aiosp_edit',
|
955 |
'prefix' => true,
|
956 |
-
'nowrap' => 1
|
957 |
),
|
958 |
-
'nonce-aioseop-edit' =>
|
959 |
'type' => 'hidden',
|
960 |
'default' => null,
|
961 |
'prefix' => false,
|
962 |
-
'nowrap' => 1
|
963 |
),
|
964 |
-
'upgrade' =>
|
965 |
'type' => 'html',
|
966 |
'label' => 'none',
|
967 |
-
'default' => aiosp_common::get_upgrade_hyperlink( 'meta', __( 'Upgrade to All in One SEO Pack Pro Version', 'all-in-one-seo-pack' ), __( 'UPGRADE TO PRO VERSION', 'all-in-one-seo-pack' ), '_blank' )
|
968 |
),
|
969 |
-
'support' =>
|
970 |
'type' => 'html',
|
971 |
'label' => 'none',
|
972 |
-
'default' => '<a target="_blank" href="
|
973 |
-
. __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>'
|
974 |
),
|
975 |
-
'snippet' =>
|
976 |
'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ),
|
977 |
'type' => 'custom',
|
978 |
'label' => 'top',
|
@@ -987,60 +1013,60 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
987 |
});
|
988 |
});
|
989 |
</script>
|
990 |
-
<div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>'
|
991 |
),
|
992 |
-
'title' =>
|
993 |
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
994 |
'type' => 'text',
|
995 |
'count' => true,
|
996 |
-
'size' => 60
|
997 |
),
|
998 |
-
'description' =>
|
999 |
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
1000 |
'type' => 'textarea',
|
1001 |
'count' => true,
|
1002 |
'cols' => 80,
|
1003 |
-
'rows' => 2
|
1004 |
),
|
1005 |
|
1006 |
-
'keywords' =>
|
1007 |
'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ),
|
1008 |
-
'type' => 'text'
|
1009 |
),
|
1010 |
-
'custom_link' =>
|
1011 |
'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ),
|
1012 |
'type' => 'text',
|
1013 |
-
'size' => 60
|
1014 |
),
|
1015 |
-
'noindex' =>
|
1016 |
'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ),
|
1017 |
-
'default' => ''
|
1018 |
),
|
1019 |
-
'nofollow' =>
|
1020 |
'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ),
|
1021 |
-
'default' => ''
|
1022 |
),
|
1023 |
-
'noodp' =>
|
1024 |
-
'noydir' =>
|
1025 |
-
'titleatr' =>
|
1026 |
'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ),
|
1027 |
'type' => 'text',
|
1028 |
-
'size' => 60
|
1029 |
),
|
1030 |
-
'menulabel' =>
|
1031 |
'name' => __( 'Menu Label', 'all-in-one-seo-pack' ),
|
1032 |
'type' => 'text',
|
1033 |
-
'size' => 60
|
1034 |
),
|
1035 |
-
'sitemap_exclude' =>
|
1036 |
-
'disable' =>
|
1037 |
-
'disable_analytics' =>
|
1038 |
'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ),
|
1039 |
-
'condshow' =>
|
1040 |
-
)
|
1041 |
),
|
1042 |
-
'display' => null
|
1043 |
-
)
|
1044 |
);
|
1045 |
|
1046 |
if ( ! empty( $meta_help_text ) ) {
|
@@ -1049,21 +1075,21 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1049 |
}
|
1050 |
}
|
1051 |
|
1052 |
-
$this->layout =
|
1053 |
-
'default' =>
|
1054 |
'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
|
1055 |
-
'help_link' => '
|
1056 |
-
'options' =>
|
1057 |
),
|
1058 |
-
'home' =>
|
1059 |
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
1060 |
-
'help_link' => '
|
1061 |
-
'options' =>
|
1062 |
),
|
1063 |
-
'title' =>
|
1064 |
'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
|
1065 |
-
'help_link' => '
|
1066 |
-
'options' =>
|
1067 |
'rewrite_titles',
|
1068 |
'force_rewrites',
|
1069 |
'cap_titles',
|
@@ -1079,28 +1105,28 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1079 |
'search_title_format',
|
1080 |
'description_format',
|
1081 |
'404_title_format',
|
1082 |
-
'paged_format'
|
1083 |
-
)
|
1084 |
),
|
1085 |
-
'cpt' =>
|
1086 |
'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
|
1087 |
'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
|
1088 |
-
'options' =>
|
1089 |
),
|
1090 |
-
'display' =>
|
1091 |
'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
|
1092 |
'help_link' => 'http://semperplugins.com/documentation/display-settings/',
|
1093 |
-
'options' =>
|
1094 |
),
|
1095 |
-
'webmaster' =>
|
1096 |
'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
|
1097 |
'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
|
1098 |
-
'options' =>
|
1099 |
),
|
1100 |
-
'google' =>
|
1101 |
'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
|
1102 |
'help_link' => 'http://semperplugins.com/documentation/google-settings/',
|
1103 |
-
'options' =>
|
1104 |
'google_publisher',
|
1105 |
'google_disable_profile',
|
1106 |
'google_sitelinks_search',
|
@@ -1122,13 +1148,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1122 |
'ga_exclude_users',
|
1123 |
'ga_track_outbound_links',
|
1124 |
'ga_link_attribution',
|
1125 |
-
'ga_enhanced_ecommerce'
|
1126 |
-
)
|
1127 |
),
|
1128 |
-
'noindex' =>
|
1129 |
'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
|
1130 |
'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
|
1131 |
-
'options' =>
|
1132 |
'cpostnoindex',
|
1133 |
'cpostnofollow',
|
1134 |
'cpostnoodp',
|
@@ -1143,13 +1169,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1143 |
'paginated_noindex',
|
1144 |
'paginated_nofollow',
|
1145 |
'noodp',
|
1146 |
-
'noydir'
|
1147 |
-
)
|
1148 |
),
|
1149 |
-
'advanced' =>
|
1150 |
'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
|
1151 |
'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
|
1152 |
-
'options' =>
|
1153 |
'generate_descriptions',
|
1154 |
'skip_excerpt',
|
1155 |
'run_shortcodes',
|
@@ -1160,26 +1186,26 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1160 |
'post_meta_tags',
|
1161 |
'page_meta_tags',
|
1162 |
'front_meta_tags',
|
1163 |
-
'home_meta_tags'
|
1164 |
-
)
|
1165 |
),
|
1166 |
-
'keywords' =>
|
1167 |
'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
|
1168 |
'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
|
1169 |
-
'options' =>
|
1170 |
'togglekeywords',
|
1171 |
'use_categories',
|
1172 |
'use_tags_as_keywords',
|
1173 |
-
'dynamic_postspage_keywords'
|
1174 |
-
)
|
1175 |
-
)
|
1176 |
);
|
1177 |
|
1178 |
if ( ! AIOSEOPPRO ) {
|
1179 |
unset( $this->layout['cpt']['options']['2'] );
|
1180 |
}
|
1181 |
|
1182 |
-
$other_options =
|
1183 |
foreach ( $this->layout as $k => $v ) {
|
1184 |
$other_options = array_merge( $other_options, $v['options'] );
|
1185 |
}
|
@@ -1188,9 +1214,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1188 |
|
1189 |
if ( is_admin() ) {
|
1190 |
$this->add_help_text_links();
|
1191 |
-
add_action( 'aioseop_global_settings_header',
|
1192 |
-
add_action( 'aioseop_global_settings_footer',
|
1193 |
-
add_action( 'output_option',
|
1194 |
add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) );
|
1195 |
|
1196 |
if ( ! AIOSEOPPRO ) {
|
@@ -1198,15 +1224,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1198 |
}
|
1199 |
}
|
1200 |
if ( AIOSEOPPRO ) {
|
1201 |
-
add_action( 'split_shared_term',
|
1202 |
}
|
1203 |
}
|
1204 |
|
1205 |
-
//good candidate for pro dir
|
1206 |
|
1207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1208 |
function custom_output_option( $buf, $args ) {
|
1209 |
-
if ( $args['name']
|
1210 |
$args['options']['type'] = 'html';
|
1211 |
$args['options']['nowrap'] = false;
|
1212 |
$args['options']['save'] = false;
|
@@ -1238,16 +1271,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1238 |
$title_format = str_replace( '%page_title%', $replace_title, $title_format );
|
1239 |
}
|
1240 |
if ( $w->is_category || $w->is_tag || $w->is_tax ) {
|
1241 |
-
if ( AIOSEOPPRO ) {
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
$this->split_shared_term( $term_id, $new_term );
|
1250 |
-
}
|
1251 |
}
|
1252 |
}
|
1253 |
}
|
@@ -1305,8 +1336,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1305 |
|
1306 |
//good candidate for pro dir
|
1307 |
|
|
|
|
|
|
|
1308 |
function get_page_snippet_info() {
|
1309 |
-
static $info =
|
1310 |
if ( ! empty( $info ) ) {
|
1311 |
return $info;
|
1312 |
}
|
@@ -1318,7 +1352,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1318 |
$post = $this->get_queried_object();
|
1319 |
}
|
1320 |
if ( empty( $this->meta_opts ) ) {
|
1321 |
-
$this->meta_opts = $this->get_current_options(
|
1322 |
}
|
1323 |
if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) {
|
1324 |
$term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
|
@@ -1329,9 +1363,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1329 |
if ( empty( $post->post_modified_gmt ) ) {
|
1330 |
$wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
|
1331 |
}
|
1332 |
-
if ( $post->post_type
|
1333 |
$wp_query->is_page = true;
|
1334 |
-
} elseif ( $post->post_type
|
1335 |
$wp_query->is_attachment = true;
|
1336 |
} else {
|
1337 |
$wp_query->is_single = true;
|
@@ -1339,7 +1373,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1339 |
if ( empty( $this->is_front_page ) ) {
|
1340 |
$this->is_front_page = false;
|
1341 |
}
|
1342 |
-
if ( get_option( 'show_on_front' )
|
1343 |
if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
|
1344 |
$this->is_front_page = true;
|
1345 |
} elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
|
@@ -1374,19 +1408,19 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1374 |
$category = $categories[0];
|
1375 |
}
|
1376 |
} else if ( is_object( $term ) ) {
|
1377 |
-
if ( $_GET['taxonomy']
|
1378 |
-
query_posts(
|
1379 |
-
} else if ( $_GET['taxonomy']
|
1380 |
-
query_posts(
|
1381 |
} else {
|
1382 |
-
query_posts(
|
1383 |
'page' => '',
|
1384 |
$_GET['taxonomy'] => $term->slug,
|
1385 |
-
'post_type' => $_GET['post_type']
|
1386 |
) );
|
1387 |
}
|
1388 |
if ( empty( $this->meta_opts ) ) {
|
1389 |
-
$this->meta_opts = $this->get_current_options(
|
1390 |
}
|
1391 |
$title = $this->get_tax_name( $_GET['taxonomy'] );
|
1392 |
$title_format = $this->get_tax_title_format();
|
@@ -1425,7 +1459,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1425 |
$keywords = $this->apply_cf_fields( $keywords );
|
1426 |
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
1427 |
|
1428 |
-
$info =
|
1429 |
'title' => $title,
|
1430 |
'description' => $description,
|
1431 |
'keywords' => $keywords,
|
@@ -1433,7 +1467,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1433 |
'title_format' => $title_format,
|
1434 |
'category' => $category,
|
1435 |
'w' => $wp_query,
|
1436 |
-
'p' => $post
|
1437 |
);
|
1438 |
wp_reset_postdata();
|
1439 |
$wp_query = $w;
|
@@ -1442,10 +1476,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1442 |
return $info;
|
1443 |
}
|
1444 |
|
|
|
|
|
|
|
1445 |
function get_queried_object() {
|
1446 |
static $p = null;
|
1447 |
global $wp_query, $post;
|
1448 |
-
if (
|
1449 |
return $p;
|
1450 |
}
|
1451 |
if ( is_object( $post ) ) {
|
@@ -1460,9 +1497,17 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1460 |
return $p;
|
1461 |
}
|
1462 |
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1466 |
global $post;
|
1467 |
}
|
1468 |
$post_id = $post;
|
@@ -1470,7 +1515,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1470 |
$post_id = $post_id->ID;
|
1471 |
}
|
1472 |
$get_opts = $this->default_options( $location );
|
1473 |
-
$optlist =
|
1474 |
'keywords',
|
1475 |
'description',
|
1476 |
'title',
|
@@ -1483,7 +1528,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1483 |
'noodp',
|
1484 |
'noydir',
|
1485 |
'titleatr',
|
1486 |
-
'menulabel'
|
1487 |
);
|
1488 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
1489 |
unset( $optlist['custom_link'] );
|
@@ -1506,7 +1551,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1506 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1507 |
}
|
1508 |
if ( 'title' === $f || 'description' === $f ) {
|
1509 |
-
$get_opts[ $field ] = htmlspecialchars(
|
1510 |
} else {
|
1511 |
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1512 |
}
|
@@ -1514,7 +1559,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1514 |
$field = "aiosp_$f";
|
1515 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1516 |
if ( 'title' === $f || 'description' === $f ) {
|
1517 |
-
$get_opts[ $field ] = htmlspecialchars(
|
1518 |
} else {
|
1519 |
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1520 |
}
|
@@ -1531,6 +1576,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1531 |
}
|
1532 |
}
|
1533 |
|
|
|
|
|
|
|
|
|
|
|
1534 |
function internationalize( $in ) {
|
1535 |
if ( function_exists( 'langswitch_filter_langs_with_message' ) ) {
|
1536 |
$in = langswitch_filter_langs_with_message( $in );
|
@@ -1561,11 +1611,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1561 |
$title = $this->apply_cf_fields( $title );
|
1562 |
}
|
1563 |
|
1564 |
-
if (
|
1565 |
$title = $this->get_original_title();
|
1566 |
}
|
1567 |
|
1568 |
-
//
|
1569 |
// The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
|
1570 |
// if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
|
1571 |
// $title = $this->capitalize( $title );
|
@@ -1573,10 +1623,16 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1573 |
return apply_filters( 'aioseop_title', $title );
|
1574 |
}
|
1575 |
|
1576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1577 |
function get_aioseop_title( $post ) {
|
1578 |
global $aioseop_options;
|
1579 |
-
// the_search_query() is not suitable, it cannot just return
|
1580 |
global $s, $STagging;
|
1581 |
$opts = $this->meta_opts;
|
1582 |
if ( is_front_page() ) {
|
@@ -1615,10 +1671,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1615 |
if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
1616 |
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1617 |
}
|
1618 |
-
|
1619 |
if ( ! $title ) {
|
1620 |
$title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) );
|
1621 |
-
} //
|
1622 |
if ( ! $title ) {
|
1623 |
$title = $this->internationalize( $post->post_title );
|
1624 |
}
|
@@ -1626,7 +1682,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1626 |
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1627 |
}
|
1628 |
|
1629 |
-
|
1630 |
$title = $this->apply_page_title_format( $title, $post );
|
1631 |
$title = $this->paged_title( $title );
|
1632 |
$title = apply_filters( 'aioseop_title_page', $title );
|
@@ -1637,7 +1692,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1637 |
|
1638 |
return $this->paged_title( $title ); //this is returned for woo
|
1639 |
} else if ( is_attachment() ) {
|
1640 |
-
if (
|
1641 |
return false;
|
1642 |
}
|
1643 |
$title = get_post_meta( $post->ID, '_aioseop_title', true );
|
@@ -1654,15 +1709,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1654 |
|
1655 |
return $title;
|
1656 |
} else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) {
|
1657 |
-
if (
|
1658 |
return false;
|
1659 |
}
|
1660 |
-
if (
|
1661 |
if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
|
1662 |
$home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
|
1663 |
}
|
1664 |
|
1665 |
-
//
|
1666 |
return apply_filters( 'aioseop_home_page_title', $home_title );
|
1667 |
} else {
|
1668 |
$page_for_posts = '';
|
@@ -1695,7 +1750,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1695 |
return $title;
|
1696 |
}
|
1697 |
} else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
1698 |
-
//
|
1699 |
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1700 |
if ( ! $title ) {
|
1701 |
$title = $this->internationalize( $post->post_title );
|
@@ -1709,8 +1764,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1709 |
|
1710 |
return $title;
|
1711 |
} else if ( is_single() ) {
|
1712 |
-
//
|
1713 |
-
if (
|
1714 |
return false;
|
1715 |
}
|
1716 |
$categories = $this->get_all_categories();
|
@@ -1799,14 +1854,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1799 |
$title = str_replace( '%taxonomy_description%', $tag_description, $title );
|
1800 |
}
|
1801 |
$title = trim( wp_strip_all_tags( $title ) );
|
1802 |
-
$title = str_replace(
|
1803 |
$title = $this->paged_title( $title );
|
1804 |
|
1805 |
return $title;
|
1806 |
}
|
1807 |
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1808 |
return $this->get_tax_title();
|
1809 |
-
} else if ( isset( $STagging ) && $STagging->is_tag_view() ) { //
|
1810 |
$tag = $STagging->search_tag;
|
1811 |
if ( $tag ) {
|
1812 |
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
@@ -1891,13 +1946,19 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1891 |
return false;
|
1892 |
}
|
1893 |
|
1894 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1895 |
function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
|
1896 |
global $aioseop_options;
|
1897 |
if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) {
|
1898 |
-
$has_filter = has_filter( 'wp_title',
|
1899 |
-
if (
|
1900 |
-
remove_filter( 'wp_title',
|
1901 |
}
|
1902 |
if ( current_theme_supports( 'title-tag' ) ) {
|
1903 |
$sep = '|';
|
@@ -1905,15 +1966,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1905 |
$seplocation = 'right';
|
1906 |
}
|
1907 |
$title = wp_title( $sep, $echo, $seplocation );
|
1908 |
-
if ( $has_filter
|
1909 |
-
add_filter( 'wp_title',
|
1910 |
}
|
1911 |
if ( $title && ( $title = trim( $title ) ) ) {
|
1912 |
return trim( $title );
|
1913 |
}
|
1914 |
}
|
1915 |
|
1916 |
-
// the_search_query() is not suitable, it cannot just return
|
1917 |
global $s;
|
1918 |
|
1919 |
$title = null;
|
@@ -1940,7 +2001,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1940 |
$tag = $tags[0]->tag;
|
1941 |
$tag = str_replace( '-', ' ', $tag );
|
1942 |
} else {
|
1943 |
-
//
|
1944 |
$tag = $this->internationalize( single_term_title( '', false ) );
|
1945 |
}
|
1946 |
if ( $tag ) {
|
@@ -1981,6 +2042,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1981 |
return trim( $title );
|
1982 |
}
|
1983 |
|
|
|
|
|
|
|
|
|
|
|
1984 |
function capitalize( $s ) {
|
1985 |
$s = trim( $s );
|
1986 |
$tokens = explode( ' ', $s );
|
@@ -1994,7 +2060,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1994 |
}
|
1995 |
|
1996 |
/**
|
1997 |
-
* @
|
|
|
|
|
1998 |
*/
|
1999 |
function request_as_words( $request ) {
|
2000 |
$request = htmlspecialchars( $request );
|
@@ -2013,6 +2081,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2013 |
return $request;
|
2014 |
}
|
2015 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016 |
function apply_page_title_format( $title, $p = null, $title_format = '' ) {
|
2017 |
global $aioseop_options;
|
2018 |
if ( $p === null ) {
|
@@ -2027,6 +2102,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2027 |
return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
|
2028 |
}
|
2029 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2030 |
function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
|
2031 |
if ( ! empty( $post ) ) {
|
2032 |
$authordata = get_userdata( $post->post_author );
|
@@ -2080,8 +2164,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2080 |
return $title;
|
2081 |
}
|
2082 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2083 |
function get_all_terms( $id, $taxonomy ) {
|
2084 |
-
$keywords =
|
2085 |
$terms = get_the_terms( $id, $taxonomy );
|
2086 |
if ( ! empty( $terms ) ) {
|
2087 |
foreach ( $terms as $term ) {
|
@@ -2092,11 +2182,16 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2092 |
return $keywords;
|
2093 |
}
|
2094 |
|
|
|
|
|
|
|
|
|
|
|
2095 |
function paged_title( $title ) {
|
2096 |
-
//
|
2097 |
global $paged;
|
2098 |
global $aioseop_options;
|
2099 |
-
//
|
2100 |
global $STagging;
|
2101 |
$page = get_query_var( 'page' );
|
2102 |
if ( $paged > $page ) {
|
@@ -2115,12 +2210,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2115 |
return $title;
|
2116 |
}
|
2117 |
|
|
|
|
|
|
|
2118 |
function log( $message ) {
|
2119 |
if ( $this->do_log ) {
|
2120 |
@error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file );
|
2121 |
}
|
2122 |
}
|
2123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2124 |
function apply_post_title_format( $title, $category = '', $p = null ) {
|
2125 |
if ( $p === null ) {
|
2126 |
global $post;
|
@@ -2132,6 +2237,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2132 |
return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
|
2133 |
}
|
2134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2135 |
function get_post_title_format( $title_type = 'post', $p = null ) {
|
2136 |
global $aioseop_options;
|
2137 |
if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
|
@@ -2158,7 +2269,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2158 |
return $title_format;
|
2159 |
}
|
2160 |
|
2161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2162 |
if ( ! empty( $post_types ) && is_object( $post ) ) {
|
2163 |
return in_array( $post->post_type, (array) $post_types );
|
2164 |
} else {
|
@@ -2166,6 +2283,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2166 |
}
|
2167 |
}
|
2168 |
|
|
|
|
|
|
|
2169 |
function is_static_posts_page() {
|
2170 |
static $is_posts_page = null;
|
2171 |
if ( $is_posts_page !== null ) {
|
@@ -2177,6 +2297,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2177 |
return $is_posts_page;
|
2178 |
}
|
2179 |
|
|
|
|
|
|
|
2180 |
function is_static_front_page() {
|
2181 |
if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
|
2182 |
return $this->is_front_page;
|
@@ -2187,8 +2310,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2187 |
return $this->is_front_page;
|
2188 |
}
|
2189 |
|
|
|
|
|
|
|
|
|
|
|
2190 |
function get_all_categories( $id = 0 ) {
|
2191 |
-
$keywords =
|
2192 |
$categories = get_the_category( $id );
|
2193 |
if ( ! empty( $categories ) ) {
|
2194 |
foreach ( $categories as $category ) {
|
@@ -2199,10 +2327,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2199 |
return $keywords;
|
2200 |
}
|
2201 |
|
|
|
|
|
|
|
|
|
|
|
2202 |
function get_tax_title( $tax = '' ) {
|
2203 |
if ( AIOSEOPPRO ) {
|
2204 |
if ( empty( $this->meta_opts ) ) {
|
2205 |
-
$this->meta_opts = $this->get_current_options(
|
2206 |
}
|
2207 |
}
|
2208 |
if ( empty( $tax ) ) {
|
@@ -2218,8 +2351,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2218 |
return $this->apply_tax_title_format( $name, $desc, $tax );
|
2219 |
}
|
2220 |
|
2221 |
-
//
|
2222 |
|
|
|
|
|
|
|
|
|
|
|
2223 |
function get_tax_name( $tax ) {
|
2224 |
global $aioseop_options;
|
2225 |
if ( AIOSEOPPRO ) {
|
@@ -2233,13 +2371,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2233 |
if ( empty( $name ) ) {
|
2234 |
$name = single_term_title( '', false );
|
2235 |
}
|
2236 |
-
//
|
2237 |
// if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
|
2238 |
// $name = $this->ucwords( $name );
|
2239 |
|
2240 |
return $this->internationalize( $name );
|
2241 |
}
|
2242 |
|
|
|
|
|
|
|
|
|
|
|
2243 |
function get_tax_desc( $tax ) {
|
2244 |
if ( AIOSEOPPRO ) {
|
2245 |
$opts = $this->meta_opts;
|
@@ -2256,6 +2399,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2256 |
return $this->internationalize( $desc );
|
2257 |
}
|
2258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2259 |
function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
|
2260 |
if ( empty( $tax ) ) {
|
2261 |
$tax = get_query_var( 'taxonomy' );
|
@@ -2282,6 +2432,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2282 |
return $this->paged_title( $title );
|
2283 |
}
|
2284 |
|
|
|
|
|
|
|
|
|
|
|
2285 |
function get_tax_title_format( $tax = '' ) {
|
2286 |
global $aioseop_options;
|
2287 |
if ( AIOSEOPPRO ) {
|
@@ -2312,23 +2467,37 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2312 |
return $title_format;
|
2313 |
}
|
2314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2315 |
function apply_archive_title_format( $title, $category = '' ) {
|
2316 |
$title_format = $this->get_archive_title_format();
|
2317 |
$r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
|
2318 |
$d_title = array(
|
2319 |
$this->internationalize( get_bloginfo( 'name' ) ),
|
2320 |
$this->internationalize( get_bloginfo( 'description' ) ),
|
2321 |
-
post_type_archive_title( '', false )
|
2322 |
);
|
2323 |
$title = trim( str_replace( $r_title, $d_title, $title_format ) );
|
2324 |
|
2325 |
return $title;
|
2326 |
}
|
2327 |
|
|
|
|
|
|
|
2328 |
function get_archive_title_format() {
|
2329 |
return $this->get_post_title_format( 'archive' );
|
2330 |
}
|
2331 |
|
|
|
|
|
|
|
|
|
|
|
2332 |
function get_main_description( $post = null ) {
|
2333 |
global $aioseop_options;
|
2334 |
$opts = $this->meta_opts;
|
@@ -2336,13 +2505,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2336 |
if ( is_author() && $this->show_page_description() ) {
|
2337 |
$description = $this->internationalize( get_the_author_meta( 'description' ) );
|
2338 |
} else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
2339 |
-
|
2340 |
-
|
2341 |
if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
|
2342 |
-
$description = trim(
|
2343 |
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2344 |
-
|
2345 |
-
$description = trim(
|
2346 |
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2347 |
$description = $this->get_aioseop_description( $post );
|
2348 |
}
|
@@ -2366,6 +2535,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2366 |
return $description;
|
2367 |
}
|
2368 |
|
|
|
|
|
|
|
2369 |
function show_page_description() {
|
2370 |
global $aioseop_options;
|
2371 |
if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
|
@@ -2378,6 +2550,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2378 |
return true;
|
2379 |
}
|
2380 |
|
|
|
|
|
|
|
2381 |
function get_page_number() {
|
2382 |
$page = get_query_var( 'page' );
|
2383 |
if ( empty( $page ) ) {
|
@@ -2387,15 +2562,20 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2387 |
return $page;
|
2388 |
}
|
2389 |
|
|
|
|
|
|
|
|
|
|
|
2390 |
function get_aioseop_description( $post = null ) {
|
2391 |
global $aioseop_options;
|
2392 |
-
if (
|
2393 |
$post = $GLOBALS['post'];
|
2394 |
}
|
2395 |
$blog_page = aiosp_common::get_blog_page();
|
2396 |
$description = '';
|
2397 |
if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2398 |
-
$description = trim(
|
2399 |
} elseif ( ! empty( $blog_page ) ) {
|
2400 |
$description = $this->get_post_description( $blog_page );
|
2401 |
}
|
@@ -2407,13 +2587,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2407 |
return $description;
|
2408 |
}
|
2409 |
|
|
|
|
|
|
|
|
|
|
|
2410 |
function get_post_description( $post ) {
|
2411 |
global $aioseop_options;
|
2412 |
$description = '';
|
2413 |
if ( ! $this->show_page_description() ) {
|
2414 |
return '';
|
2415 |
}
|
2416 |
-
$description = trim(
|
2417 |
if ( ! empty( $post ) && post_password_required( $post ) ) {
|
2418 |
return $description;
|
2419 |
}
|
@@ -2421,7 +2606,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2421 |
if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) {
|
2422 |
$description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
|
2423 |
}
|
2424 |
-
if ( ! $description && $aioseop_options['aiosp_generate_descriptions'] ) {
|
2425 |
$content = $post->post_content;
|
2426 |
if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
|
2427 |
$content = do_shortcode( $content );
|
@@ -2431,25 +2616,36 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2431 |
}
|
2432 |
}
|
2433 |
|
2434 |
-
//
|
2435 |
-
$description = preg_replace(
|
2436 |
|
2437 |
return $description;
|
2438 |
}
|
2439 |
|
|
|
|
|
|
|
|
|
|
|
2440 |
function trim_excerpt_without_filters_full_length( $text ) {
|
2441 |
$text = str_replace( ']]>', ']]>', $text );
|
2442 |
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2443 |
$text = wp_strip_all_tags( $text );
|
2444 |
|
2445 |
-
return trim(
|
2446 |
}
|
2447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2448 |
function trim_excerpt_without_filters( $text, $max = 0 ) {
|
2449 |
$text = str_replace( ']]>', ']]>', $text );
|
2450 |
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2451 |
$text = wp_strip_all_tags( $text );
|
2452 |
-
// Treat other common word-break characters like a space
|
2453 |
$text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
|
2454 |
if ( ! $max ) {
|
2455 |
$max = $this->maximum_description_length;
|
@@ -2459,7 +2655,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2459 |
if ( $max < $len ) {
|
2460 |
if ( function_exists( 'mb_strrpos' ) ) {
|
2461 |
$pos = mb_strrpos( $text2, ' ', - ( $len - $max ) );
|
2462 |
-
if (
|
2463 |
$pos = $max;
|
2464 |
}
|
2465 |
if ( $pos > $this->minimum_description_length ) {
|
@@ -2468,12 +2664,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2468 |
$max = $this->minimum_description_length;
|
2469 |
}
|
2470 |
} else {
|
2471 |
-
while ( $text2[ $max ]
|
2472 |
$max --;
|
2473 |
}
|
2474 |
}
|
2475 |
|
2476 |
-
//
|
2477 |
if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
|
2478 |
$max = $max_orig;
|
2479 |
}
|
@@ -2483,6 +2679,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2483 |
return trim( $text );
|
2484 |
}
|
2485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2486 |
function aiosp_mrt_get_url( $query, $show_page = true ) {
|
2487 |
if ( $query->is_404 || $query->is_search ) {
|
2488 |
return false;
|
@@ -2504,7 +2706,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2504 |
default:
|
2505 |
return false;
|
2506 |
}
|
2507 |
-
} elseif (
|
2508 |
$link = get_permalink( $pageid );
|
2509 |
} elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
|
2510 |
if ( function_exists( 'icl_get_home_url' ) ) {
|
@@ -2517,7 +2719,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2517 |
$link = get_permalink( $post->ID );
|
2518 |
} elseif ( $query->is_author && $haspost ) {
|
2519 |
$author = get_userdata( get_query_var( 'author' ) );
|
2520 |
-
if (
|
2521 |
return false;
|
2522 |
}
|
2523 |
$link = get_author_posts_url( $author->ID, $author->user_nicename );
|
@@ -2559,10 +2761,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2559 |
}
|
2560 |
if ( ! empty( $link ) ) {
|
2561 |
global $aioseop_options;
|
2562 |
-
if (
|
2563 |
-
if ( $aioseop_options['aiosp_can_set_protocol']
|
2564 |
$link = preg_replace( '/^https:/i', 'http:', $link );
|
2565 |
-
} elseif ( $aioseop_options['aiosp_can_set_protocol']
|
2566 |
$link = preg_replace( '/^http:/i', 'https:', $link );
|
2567 |
}
|
2568 |
}
|
@@ -2571,6 +2773,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2571 |
return $link;
|
2572 |
}
|
2573 |
|
|
|
|
|
|
|
|
|
|
|
2574 |
function get_paged( $link ) {
|
2575 |
global $wp_rewrite;
|
2576 |
$page = $this->get_page_number();
|
@@ -2579,7 +2786,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2579 |
$page_name = $wp_rewrite->pagination_base;
|
2580 |
}
|
2581 |
if ( ! empty( $page ) && $page > 1 ) {
|
2582 |
-
if ( get_query_var( 'page' )
|
2583 |
$link = trailingslashit( $link ) . "$page";
|
2584 |
} else {
|
2585 |
$link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
|
@@ -2590,19 +2797,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2590 |
return $link;
|
2591 |
}
|
2592 |
|
|
|
|
|
|
|
2593 |
function get_main_keywords() {
|
2594 |
global $aioseop_options;
|
2595 |
global $aioseop_keywords;
|
2596 |
global $post;
|
2597 |
$opts = $this->meta_opts;
|
2598 |
-
if ( (
|
2599 |
if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2600 |
$keywords = $this->get_all_keywords();
|
2601 |
} else {
|
2602 |
$keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
|
2603 |
}
|
2604 |
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
|
2605 |
-
$keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); //
|
2606 |
} elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
|
2607 |
$keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
|
2608 |
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
|
@@ -2623,7 +2833,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2623 |
if ( is_404() ) {
|
2624 |
return null;
|
2625 |
}
|
2626 |
-
//
|
2627 |
if ( ! is_home() && ! is_page() && ! is_single() && ! $this->is_static_front_page() && ! $this->is_static_posts_page() && ! is_archive() && ! is_post_type_archive() && ! is_category() && ! is_tag() && ! is_tax() ) {
|
2628 |
return null;
|
2629 |
}
|
@@ -2639,7 +2849,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2639 |
}
|
2640 |
if ( empty( $posts ) ) {
|
2641 |
global $post;
|
2642 |
-
$post_arr =
|
2643 |
} else {
|
2644 |
$post_arr = $posts;
|
2645 |
}
|
@@ -2648,8 +2858,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2648 |
foreach ( $post_arr as $p ) {
|
2649 |
if ( $p ) {
|
2650 |
$id = $p->ID;
|
2651 |
-
if (
|
2652 |
-
//
|
2653 |
$keywords_i = null;
|
2654 |
$keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
|
2655 |
if ( is_attachment() ) {
|
@@ -2669,7 +2879,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2669 |
if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
|
2670 |
$keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
|
2671 |
}
|
2672 |
-
//
|
2673 |
$autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
|
2674 |
if ( isset( $autometa ) && ! empty( $autometa ) ) {
|
2675 |
$autometa_array = explode( ' ', $autometa );
|
@@ -2678,7 +2888,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2678 |
}
|
2679 |
}
|
2680 |
|
2681 |
-
if ( $aioseop_options['aiosp_use_categories'] && ! is_page() ) {
|
2682 |
$keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
|
2683 |
}
|
2684 |
}
|
@@ -2688,8 +2898,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2688 |
return $this->get_unique_keywords( $keywords );
|
2689 |
}
|
2690 |
|
|
|
|
|
|
|
|
|
|
|
2691 |
function keyword_string_to_list( $keywords ) {
|
2692 |
-
$traverse =
|
2693 |
$keywords_i = str_replace( '"', '', $keywords );
|
2694 |
if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) {
|
2695 |
$traverse = explode( ',', $keywords_i );
|
@@ -2698,15 +2913,20 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2698 |
return $traverse;
|
2699 |
}
|
2700 |
|
|
|
|
|
|
|
|
|
|
|
2701 |
function get_all_tags( $id = 0 ) {
|
2702 |
-
$keywords =
|
2703 |
$tags = get_the_tags( $id );
|
2704 |
if ( ! empty( $tags ) && is_array( $tags ) ) {
|
2705 |
foreach ( $tags as $tag ) {
|
2706 |
$keywords[] = $this->internationalize( $tag->name );
|
2707 |
}
|
2708 |
}
|
2709 |
-
// Ultimate Tag Warrior integration
|
2710 |
global $utw;
|
2711 |
if ( $utw ) {
|
2712 |
$tags = $utw->GetTagsForPost( $p );
|
@@ -2724,10 +2944,20 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2724 |
return $keywords;
|
2725 |
}
|
2726 |
|
|
|
|
|
|
|
|
|
|
|
2727 |
function get_unique_keywords( $keywords ) {
|
2728 |
return implode( ',', $this->clean_keyword_list( $keywords ) );
|
2729 |
}
|
2730 |
|
|
|
|
|
|
|
|
|
|
|
2731 |
function clean_keyword_list( $keywords ) {
|
2732 |
$small_keywords = array();
|
2733 |
if ( ! is_array( $keywords ) ) {
|
@@ -2742,6 +2972,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2742 |
return array_unique( $small_keywords );
|
2743 |
}
|
2744 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2745 |
function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
|
2746 |
$terms = $this->get_all_term_data( $term_id );
|
2747 |
if ( ! empty( $terms ) ) {
|
@@ -2755,9 +2991,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2755 |
}
|
2756 |
}
|
2757 |
|
|
|
|
|
|
|
|
|
|
|
2758 |
function get_all_term_data( $term_id ) {
|
2759 |
-
$terms =
|
2760 |
-
$optlist =
|
2761 |
'keywords',
|
2762 |
'description',
|
2763 |
'title',
|
@@ -2770,7 +3011,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2770 |
'noodp',
|
2771 |
'noydir',
|
2772 |
'titleatr',
|
2773 |
-
'menulabel'
|
2774 |
);
|
2775 |
foreach ( $optlist as $f ) {
|
2776 |
$meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
|
@@ -2787,7 +3028,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2787 |
wp_enqueue_style( 'wp-pointer' );
|
2788 |
$this->add_admin_pointers();
|
2789 |
|
2790 |
-
|
2791 |
wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
|
2792 |
?>
|
2793 |
<script>
|
@@ -2822,58 +3062,56 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2822 |
var admin_pointer;
|
2823 |
var admin_index;
|
2824 |
<?php
|
2825 |
-
|
2826 |
-
{if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope']
|
2827 |
?>admin_index = "<?php echo esc_attr( $k ); ?>";
|
2828 |
admin_pointer = <?php echo json_encode( $p ); ?>;
|
2829 |
aioseop_show_pointer(admin_index, admin_pointer);
|
2830 |
<?php
|
2831 |
-
}
|
2832 |
-
?>
|
2833 |
});
|
2834 |
}
|
2835 |
-
<?php
|
2836 |
-
}
|
2837 |
-
?>
|
2838 |
</script>
|
2839 |
<?php
|
2840 |
}
|
2841 |
|
2842 |
function add_admin_pointers() {
|
2843 |
if ( AIOSEOPPRO ) {
|
2844 |
-
$this->pointers['aioseop_menu_236'] =
|
2845 |
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
|
2846 |
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
2847 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack Pro ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '</p>',
|
2848 |
'pointer_edge' => 'top',
|
2849 |
'pointer_align' => 'left',
|
2850 |
-
'pointer_scope' => 'global'
|
2851 |
);
|
2852 |
-
$this->pointers['aioseop_welcome_230'] =
|
2853 |
'pointer_target' => '#aioseop_top_button',
|
2854 |
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
2855 |
. '</h3><p>' . __( 'New in 2.4: Improved support for taxonomies, Woocommerce and massive performance improvements under the hood! Please review your settings on each options page!', 'all-in-one-seo-pack' ) . '</p>',
|
2856 |
'pointer_edge' => 'bottom',
|
2857 |
'pointer_align' => 'left',
|
2858 |
-
'pointer_scope' => 'local'
|
2859 |
);
|
2860 |
$this->filter_pointers();
|
2861 |
} else {
|
2862 |
-
$this->pointers['aioseop_menu_220'] =
|
2863 |
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
|
2864 |
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
2865 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '</p>',
|
2866 |
'pointer_edge' => 'top',
|
2867 |
'pointer_align' => 'left',
|
2868 |
-
'pointer_scope' => 'global'
|
2869 |
);
|
2870 |
-
$this->pointers['aioseop_welcome_220'] =
|
2871 |
'pointer_target' => '#aioseop_top_button',
|
2872 |
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
2873 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.2: Control who accesses your site with the new Robots.txt Editor and File Editor modules! Enable them from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all-in-one-seo-pack' ) . '</p>',
|
2874 |
'pointer_edge' => 'bottom',
|
2875 |
'pointer_align' => 'left',
|
2876 |
-
'pointer_scope' => 'local'
|
2877 |
);
|
2878 |
$this->filter_pointers();
|
2879 |
}
|
@@ -2887,7 +3125,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2887 |
$pt = array_keys( $post_objs );
|
2888 |
$rempost = array( 'revision', 'nav_menu_item' );
|
2889 |
$pt = array_diff( $pt, $rempost );
|
2890 |
-
$post_types =
|
2891 |
|
2892 |
$aiosp_enablecpost = '';
|
2893 |
if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) {
|
@@ -2916,7 +3154,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2916 |
$tx = array_keys( $taxes );
|
2917 |
$remtax = array( 'nav_menu', 'link_category', 'post_format' );
|
2918 |
$tx = array_diff( $tx, $remtax );
|
2919 |
-
$tax_types =
|
2920 |
foreach ( $tx as $t ) {
|
2921 |
if ( ! empty( $taxes[ $t ]->label ) ) {
|
2922 |
$tax_types[ $t ] = $taxes[ $t ]->label;
|
@@ -2934,24 +3172,24 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2934 |
$this->default_options['taxactive']['initial_options'] = $tax_types;
|
2935 |
}
|
2936 |
$this->default_options['google_author_location']['initial_options'] = $post_types;
|
2937 |
-
$this->default_options['google_author_location']['initial_options'] = array_merge(
|
2938 |
$this->default_options['google_author_location']['default'] = array_keys( $this->default_options['google_author_location']['initial_options'] );
|
2939 |
|
2940 |
foreach ( $post_types as $p => $pt ) {
|
2941 |
$field = $p . '_title_format';
|
2942 |
$name = $post_objs[ $p ]->labels->singular_name;
|
2943 |
if ( ! isset( $this->default_options[ $field ] ) ) {
|
2944 |
-
$this->default_options[ $field ] =
|
2945 |
'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
|
2946 |
'type' => 'text',
|
2947 |
'default' => '%post_title% | %blog_title%',
|
2948 |
-
'condshow' =>
|
2949 |
'aiosp_rewrite_titles' => 1,
|
2950 |
'aiosp_enablecpost' => 'on',
|
2951 |
'aiosp_cpostadvanced' => 'on',
|
2952 |
'aiosp_cposttitles' => 'on',
|
2953 |
-
'aiosp_cpostactive\[\]' => $p
|
2954 |
-
)
|
2955 |
);
|
2956 |
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
|
2957 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -2993,17 +3231,17 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2993 |
$field = $p . '_tax_title_format';
|
2994 |
$name = $pt;
|
2995 |
if ( ! isset( $this->default_options[ $field ] ) ) {
|
2996 |
-
$this->default_options[ $field ] =
|
2997 |
'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
|
2998 |
'type' => 'text',
|
2999 |
'default' => '%taxonomy_title% | %blog_title%',
|
3000 |
-
'condshow' =>
|
3001 |
'aiosp_rewrite_titles' => 1,
|
3002 |
'aiosp_enablecpost' => 'on',
|
3003 |
'aiosp_cpostadvanced' => 'on',
|
3004 |
'aiosp_cposttitles' => 'on',
|
3005 |
-
'aiosp_taxactive\[\]' => $p
|
3006 |
-
)
|
3007 |
);
|
3008 |
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' ) .
|
3009 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -3020,33 +3258,38 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3020 |
|
3021 |
if ( AIOSEOPPRO ) {
|
3022 |
global $aioseop_update_checker;
|
3023 |
-
add_action( "{$this->prefix}update_options",
|
3024 |
$aioseop_update_checker,
|
3025 |
-
'license_change_check'
|
3026 |
), 10, 2 );
|
3027 |
-
add_action( "{$this->prefix}settings_update",
|
3028 |
}
|
3029 |
|
3030 |
-
add_filter( "{$this->prefix}display_options",
|
3031 |
parent::add_page_hooks();
|
3032 |
}
|
3033 |
|
3034 |
function settings_page_init() {
|
3035 |
-
add_filter( "{$this->prefix}submit_options",
|
3036 |
}
|
3037 |
|
3038 |
function enqueue_scripts() {
|
3039 |
-
add_filter( "{$this->prefix}display_settings",
|
3040 |
-
add_filter( "{$this->prefix}display_options",
|
3041 |
parent::enqueue_scripts();
|
3042 |
}
|
3043 |
|
|
|
|
|
|
|
|
|
|
|
3044 |
function filter_submit( $submit ) {
|
3045 |
$submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' »';
|
3046 |
-
$submit['Submit_All_Default'] =
|
3047 |
'type' => 'submit',
|
3048 |
'class' => 'button-secondary',
|
3049 |
-
'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »'
|
3050 |
);
|
3051 |
|
3052 |
return $submit;
|
@@ -3054,6 +3297,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3054 |
|
3055 |
/**
|
3056 |
* Handle resetting options to defaults, but preserve the license key if pro.
|
|
|
|
|
|
|
3057 |
*/
|
3058 |
function reset_options( $location = null, $delete = false ) {
|
3059 |
if ( AIOSEOPPRO ) {
|
@@ -3071,9 +3317,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3071 |
$this->delete_class_option( $delete );
|
3072 |
|
3073 |
if ( AIOSEOPPRO ) {
|
3074 |
-
$this->options =
|
3075 |
} else {
|
3076 |
-
$this->options =
|
3077 |
}
|
3078 |
}
|
3079 |
$default_options = $this->default_options( $location );
|
@@ -3093,11 +3339,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3093 |
$this->update_class_option( $this->options );
|
3094 |
}
|
3095 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3096 |
function filter_settings( $settings, $location, $current ) {
|
3097 |
if ( $location == null ) {
|
3098 |
$prefix = $this->prefix;
|
3099 |
|
3100 |
-
foreach (
|
3101 |
unset( $settings["{$prefix}$opt"] );
|
3102 |
}
|
3103 |
|
@@ -3115,36 +3368,36 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3115 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
3116 |
if ( ! empty( $post ) ) {
|
3117 |
$post_type = get_post_type( $post );
|
3118 |
-
if ( ! empty( $this->options['aiosp_cpostnoindex'] ) &&
|
3119 |
$settings["{$prefix}noindex"]['type'] = 'select';
|
3120 |
-
$settings["{$prefix}noindex"]['initial_options'] =
|
3121 |
'' => __( 'Default - noindex', 'all-in-one-seo-pack' ),
|
3122 |
'off' => __( 'index', 'all-in-one-seo-pack' ),
|
3123 |
-
'on' => __( 'noindex', 'all-in-one-seo-pack' )
|
3124 |
);
|
3125 |
}
|
3126 |
-
if ( ! empty( $this->options['aiosp_cpostnofollow'] ) &&
|
3127 |
$settings["{$prefix}nofollow"]['type'] = 'select';
|
3128 |
-
$settings["{$prefix}nofollow"]['initial_options'] =
|
3129 |
'' => __( 'Default - nofollow', 'all-in-one-seo-pack' ),
|
3130 |
'off' => __( 'follow', 'all-in-one-seo-pack' ),
|
3131 |
-
'on' => __( 'nofollow', 'all-in-one-seo-pack' )
|
3132 |
);
|
3133 |
}
|
3134 |
-
if ( ! empty( $this->options['aiosp_cpostnoodp'] ) &&
|
3135 |
$settings["{$prefix}noodp"]['type'] = 'select';
|
3136 |
-
$settings["{$prefix}noodp"]['initial_options'] =
|
3137 |
'' => __( 'Default - noodp', 'all-in-one-seo-pack' ),
|
3138 |
'off' => __( 'odp', 'all-in-one-seo-pack' ),
|
3139 |
-
'on' => __( 'noodp', 'all-in-one-seo-pack' )
|
3140 |
);
|
3141 |
}
|
3142 |
-
if ( ! empty( $this->options['aiosp_cpostnoydir'] ) &&
|
3143 |
$settings["{$prefix}noydir"]['type'] = 'select';
|
3144 |
-
$settings["{$prefix}noydir"]['initial_options'] =
|
3145 |
'' => __( 'Default - noydir', 'all-in-one-seo-pack' ),
|
3146 |
'off' => __( 'ydir', 'all-in-one-seo-pack' ),
|
3147 |
-
'on' => __( 'noydir', 'all-in-one-seo-pack' )
|
3148 |
);
|
3149 |
}
|
3150 |
global $post;
|
@@ -3176,7 +3429,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3176 |
} elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) {
|
3177 |
unset( $settings["{$prefix}keywords"] );
|
3178 |
}
|
3179 |
-
if ( empty( $this->options['aiosp_can'] ) ||
|
3180 |
unset( $settings["{$prefix}custom_link"] );
|
3181 |
}
|
3182 |
}
|
@@ -3184,13 +3437,19 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3184 |
return $settings;
|
3185 |
}
|
3186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3187 |
function filter_options( $options, $location ) {
|
3188 |
if ( $location == 'aiosp' ) {
|
3189 |
global $post;
|
3190 |
if ( ! empty( $post ) ) {
|
3191 |
$prefix = $this->prefix;
|
3192 |
$post_type = get_post_type( $post );
|
3193 |
-
foreach (
|
3194 |
if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
|
3195 |
if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) {
|
3196 |
unset( $options["{$prefix}{$no}"] );
|
@@ -3204,10 +3463,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3204 |
if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) {
|
3205 |
$options["{$prefix}rewrite_titles"] = 1;
|
3206 |
}
|
3207 |
-
if (
|
3208 |
$options["{$prefix}enablecpost"] = 0;
|
3209 |
}
|
3210 |
-
if (
|
3211 |
$options["{$prefix}use_original_title"] = 0;
|
3212 |
}
|
3213 |
}
|
@@ -3237,6 +3496,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3237 |
}
|
3238 |
}
|
3239 |
|
|
|
|
|
|
|
3240 |
function is_page_included() {
|
3241 |
global $aioseop_options;
|
3242 |
if ( is_feed() ) {
|
@@ -3251,14 +3513,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3251 |
$post_type = $post->post_type;
|
3252 |
}
|
3253 |
if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
|
3254 |
-
$wp_post_types = get_post_types(
|
3255 |
if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
|
3256 |
return false;
|
3257 |
}
|
3258 |
} else {
|
3259 |
$wp_post_types = $aioseop_options['aiosp_cpostactive'];
|
3260 |
if ( empty( $wp_post_types ) ) {
|
3261 |
-
$wp_post_types =
|
3262 |
}
|
3263 |
if ( AIOSEOPPRO ) {
|
3264 |
if ( is_tax() ) {
|
@@ -3286,7 +3548,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3286 |
}
|
3287 |
}
|
3288 |
|
3289 |
-
$this->meta_opts = $this->get_current_options(
|
3290 |
|
3291 |
$aiosp_disable = $aiosp_disable_analytics = false;
|
3292 |
|
@@ -3317,11 +3579,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3317 |
return true;
|
3318 |
}
|
3319 |
|
|
|
|
|
|
|
|
|
|
|
3320 |
function output_callback_for_title( $content ) {
|
3321 |
return $this->rewrite_title( $content );
|
3322 |
}
|
3323 |
|
3324 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3325 |
function rewrite_title( $header ) {
|
3326 |
global $wp_query;
|
3327 |
if ( ! $wp_query ) {
|
@@ -3337,8 +3610,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3337 |
return $header;
|
3338 |
}
|
3339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3340 |
function replace_title( $content, $title ) {
|
3341 |
-
//We can probably improve this... I'm not sure half of this is even being used.
|
3342 |
$title = trim( strip_tags( $title ) );
|
3343 |
$title_tag_start = '<title';
|
3344 |
$title_tag_end = '</title';
|
@@ -3354,10 +3633,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3354 |
function add_hooks() {
|
3355 |
global $aioseop_options, $aioseop_update_checker;
|
3356 |
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
|
|
3361 |
|
3362 |
aioseop_update_settings_check();
|
3363 |
add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
|
@@ -3372,18 +3652,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3372 |
add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
|
3373 |
if ( AIOSEOPPRO ) {
|
3374 |
if ( current_user_can( 'update_plugins' ) ) {
|
3375 |
-
add_action( 'admin_notices',
|
3376 |
}
|
3377 |
-
add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME,
|
3378 |
$aioseop_update_checker,
|
3379 |
-
'add_plugin_row'
|
3380 |
) );
|
3381 |
}
|
3382 |
} else {
|
3383 |
if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
|
3384 |
remove_action( 'wp_head', 'rel_canonical' );
|
3385 |
}
|
3386 |
-
|
3387 |
if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
|
3388 |
add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
|
3389 |
}
|
@@ -3439,22 +3719,27 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3439 |
}
|
3440 |
}
|
3441 |
|
|
|
|
|
|
|
|
|
|
|
3442 |
function make_unique_att_desc( $description ) {
|
3443 |
global $wp_query;
|
3444 |
if ( is_attachment() ) {
|
3445 |
|
3446 |
$url = $this->aiosp_mrt_get_url( $wp_query );
|
3447 |
if ( $url ) {
|
3448 |
-
$matches =
|
3449 |
preg_match_all( '/(\d+)/', $url, $matches );
|
3450 |
if ( is_array( $matches ) ) {
|
3451 |
$uniqueDesc = join( '', $matches[0] );
|
3452 |
}
|
3453 |
}
|
3454 |
$description .= ' ' . $uniqueDesc;
|
3455 |
-
|
3456 |
-
return $description;
|
3457 |
}
|
|
|
|
|
3458 |
}
|
3459 |
|
3460 |
function wp_head() {
|
@@ -3477,7 +3762,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3477 |
}
|
3478 |
$meta_string = null;
|
3479 |
$description = '';
|
3480 |
-
//
|
3481 |
$this->check_rewrite_handler();
|
3482 |
if ( AIOSEOPPRO ) {
|
3483 |
echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
|
@@ -3496,19 +3781,19 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3496 |
$save_posts = $posts;
|
3497 |
if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
3498 |
global $posts;
|
3499 |
-
$opts = $this->meta_opts = $this->get_current_options(
|
3500 |
-
$posts =
|
3501 |
$posts[] = $post;
|
3502 |
}
|
3503 |
$posts = $save_posts;
|
3504 |
-
$description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); //
|
3505 |
-
//
|
3506 |
if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
|
3507 |
$description = $this->trim_description( $description );
|
3508 |
if ( ! isset( $meta_string ) ) {
|
3509 |
$meta_string = '';
|
3510 |
}
|
3511 |
-
//
|
3512 |
$description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
|
3513 |
$desc_attr = '';
|
3514 |
if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
@@ -3517,7 +3802,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3517 |
$desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
|
3518 |
$meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
|
3519 |
}
|
3520 |
-
//
|
3521 |
$togglekeywords = 0;
|
3522 |
if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
|
3523 |
$togglekeywords = $aioseop_options['aiosp_togglekeywords'];
|
@@ -3540,18 +3825,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3540 |
$meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
|
3541 |
}
|
3542 |
}
|
3543 |
-
//
|
3544 |
$robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
|
3545 |
if ( ! empty( $robots_meta ) ) {
|
3546 |
$meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
|
3547 |
}
|
3548 |
-
//
|
3549 |
if ( is_front_page() ) {
|
3550 |
foreach (
|
3551 |
-
|
3552 |
'google' => 'google-site-verification',
|
3553 |
'bing' => 'msvalidate.01',
|
3554 |
-
'pinterest' => 'p:domain_verify'
|
3555 |
) as $k => $v
|
3556 |
) {
|
3557 |
if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
|
@@ -3559,13 +3844,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3559 |
}
|
3560 |
}
|
3561 |
|
3562 |
-
//
|
3563 |
if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
|
3564 |
$meta_string .= $this->sitelinks_search_box() . "\n";
|
3565 |
}
|
3566 |
}
|
3567 |
-
//
|
3568 |
-
foreach (
|
3569 |
if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
|
3570 |
$$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
|
3571 |
} else {
|
@@ -3584,7 +3869,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3584 |
}
|
3585 |
$meta_string .= $post_meta;
|
3586 |
}
|
3587 |
-
//
|
3588 |
$authorship = $this->get_google_authorship( $post );
|
3589 |
$publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
|
3590 |
if ( ! empty( $publisher ) ) {
|
@@ -3621,7 +3906,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3621 |
echo "$meta_string\n";
|
3622 |
}
|
3623 |
|
3624 |
-
//
|
3625 |
$show_page = true;
|
3626 |
if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
|
3627 |
$show_page = false;
|
@@ -3651,6 +3936,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3651 |
}
|
3652 |
}
|
3653 |
|
|
|
|
|
|
|
3654 |
function check_rewrite_handler() {
|
3655 |
global $aioseop_options;
|
3656 |
|
@@ -3660,7 +3948,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3660 |
}
|
3661 |
|
3662 |
if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
|
3663 |
-
//
|
3664 |
if ( function_exists( 'ob_list_handlers' ) ) {
|
3665 |
$active_handlers = ob_list_handlers();
|
3666 |
} else {
|
@@ -3673,9 +3961,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3673 |
ob_end_flush();
|
3674 |
} else {
|
3675 |
$this->log( 'another plugin interfering?' );
|
3676 |
-
//
|
3677 |
$this->ob_start_detected = true;
|
3678 |
-
if ( $this->option_isset( 'rewrite_titles' ) ) { //
|
3679 |
$aioseop_options['aiosp_rewrite_titles'] = 0;
|
3680 |
$force_rewrites = 0;
|
3681 |
add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
|
@@ -3689,6 +3977,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3689 |
}
|
3690 |
}
|
3691 |
|
|
|
|
|
|
|
|
|
|
|
3692 |
function trim_description( $description ) {
|
3693 |
$description = trim( wp_strip_all_tags( $description ) );
|
3694 |
$description = str_replace( '"', '"', $description );
|
@@ -3698,6 +3991,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3698 |
return $description;
|
3699 |
}
|
3700 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3701 |
function apply_description_format( $description, $post = null ) {
|
3702 |
global $aioseop_options;
|
3703 |
$description_format = $aioseop_options['aiosp_description_format'];
|
@@ -3727,6 +4026,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3727 |
return $description;
|
3728 |
}
|
3729 |
|
|
|
|
|
|
|
3730 |
function get_robots_meta() {
|
3731 |
global $aioseop_options;
|
3732 |
$opts = $this->meta_opts;
|
@@ -3737,7 +4039,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3737 |
}
|
3738 |
|
3739 |
if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
|
3740 |
-
$tax_noindex =
|
3741 |
}
|
3742 |
|
3743 |
$aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
|
@@ -3751,7 +4053,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3751 |
|| ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
|
3752 |
) {
|
3753 |
$noindex = 'noindex';
|
3754 |
-
} elseif (
|
3755 |
$post_type = get_post_type();
|
3756 |
if ( ! empty( $opts ) ) {
|
3757 |
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
|
@@ -3763,22 +4065,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3763 |
|| ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] )
|
3764 |
|| ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
|
3765 |
) {
|
3766 |
-
if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) &&
|
3767 |
-
( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) &&
|
3768 |
) {
|
3769 |
$noindex = 'noindex';
|
3770 |
}
|
3771 |
-
if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) &&
|
3772 |
-
( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) &&
|
3773 |
) {
|
3774 |
$nofollow = 'nofollow';
|
3775 |
}
|
3776 |
-
if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) &&
|
3777 |
$aiosp_noodp = true;
|
3778 |
} else {
|
3779 |
$aiosp_noodp = false;
|
3780 |
}
|
3781 |
-
if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) &&
|
3782 |
$aiosp_noydir = true;
|
3783 |
} else {
|
3784 |
$aiosp_noydir = false;
|
@@ -3805,6 +4107,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3805 |
return $robots_meta;
|
3806 |
}
|
3807 |
|
|
|
|
|
|
|
3808 |
function sitelinks_search_box() {
|
3809 |
global $aioseop_options;
|
3810 |
$home_url = esc_url( get_home_url() );
|
@@ -3852,10 +4157,15 @@ EOF;
|
|
3852 |
return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
|
3853 |
}
|
3854 |
|
|
|
|
|
|
|
|
|
|
|
3855 |
function get_google_authorship( $post ) {
|
3856 |
global $aioseop_options;
|
3857 |
$page = $this->get_page_number();
|
3858 |
-
//
|
3859 |
$googleplus = $publisher = $author = '';
|
3860 |
|
3861 |
if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
@@ -3866,7 +4176,7 @@ EOF;
|
|
3866 |
$googleplus = $aioseop_options['aiosp_google_publisher'];
|
3867 |
}
|
3868 |
|
3869 |
-
if (
|
3870 |
if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
|
3871 |
$publisher = $aioseop_options['aiosp_google_publisher'];
|
3872 |
}
|
@@ -3887,7 +4197,7 @@ EOF;
|
|
3887 |
|
3888 |
if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
|
3889 |
if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) {
|
3890 |
-
$aioseop_options['aiosp_google_author_location'] =
|
3891 |
}
|
3892 |
if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
|
3893 |
$author = '';
|
@@ -3904,9 +4214,14 @@ EOF;
|
|
3904 |
}
|
3905 |
}
|
3906 |
|
3907 |
-
return
|
3908 |
}
|
3909 |
|
|
|
|
|
|
|
|
|
|
|
3910 |
function get_prev_next_links( $post = null ) {
|
3911 |
$prev = $next = '';
|
3912 |
$page = $this->get_page_number();
|
@@ -3972,7 +4287,7 @@ EOF;
|
|
3972 |
}
|
3973 |
}
|
3974 |
|
3975 |
-
return
|
3976 |
}
|
3977 |
|
3978 |
/**
|
@@ -3989,10 +4304,14 @@ EOF;
|
|
3989 |
*/
|
3990 |
function validate_url_scheme( $url ) {
|
3991 |
|
3992 |
-
//TODO we should check for the site setting in the case of auto
|
3993 |
|
3994 |
global $aioseop_options;
|
3995 |
|
|
|
|
|
|
|
|
|
3996 |
if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
|
3997 |
$url = preg_replace( '/^https:/i', 'http:', $url );
|
3998 |
}
|
@@ -4003,6 +4322,13 @@ EOF;
|
|
4003 |
return $url;
|
4004 |
}
|
4005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4006 |
function override_options( $options, $location, $settings ) {
|
4007 |
if ( class_exists( 'DOMDocument' ) ) {
|
4008 |
$options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
|
@@ -4144,8 +4470,12 @@ EOF;
|
|
4144 |
$analytics = ob_get_clean();
|
4145 |
}
|
4146 |
echo apply_filters( 'aiosp_google_analytics', $analytics );
|
|
|
4147 |
}
|
4148 |
|
|
|
|
|
|
|
4149 |
function universal_analytics() {
|
4150 |
global $aioseop_options;
|
4151 |
$analytics = '';
|
@@ -4208,8 +4538,8 @@ EOF;
|
|
4208 |
}
|
4209 |
$extra_options .= "ga('set', 'anonymizeIp', true);";
|
4210 |
}
|
4211 |
-
$js_options =
|
4212 |
-
foreach (
|
4213 |
if ( ! empty( $$opts ) ) {
|
4214 |
$js_options[] = $$opts;
|
4215 |
}
|
@@ -4239,6 +4569,9 @@ EOF;
|
|
4239 |
return $analytics;
|
4240 |
}
|
4241 |
|
|
|
|
|
|
|
4242 |
function get_analytics_domain() {
|
4243 |
global $aioseop_options;
|
4244 |
if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
|
@@ -4248,6 +4581,11 @@ EOF;
|
|
4248 |
return '';
|
4249 |
}
|
4250 |
|
|
|
|
|
|
|
|
|
|
|
4251 |
function save_post_data( $id ) {
|
4252 |
$awmp_edit = $nonce = null;
|
4253 |
if ( empty( $_POST ) ) {
|
@@ -4262,7 +4600,7 @@ EOF;
|
|
4262 |
|
4263 |
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4264 |
|
4265 |
-
$optlist =
|
4266 |
'keywords',
|
4267 |
'description',
|
4268 |
'title',
|
@@ -4275,7 +4613,7 @@ EOF;
|
|
4275 |
'noodp',
|
4276 |
'noydir',
|
4277 |
'titleatr',
|
4278 |
-
'menulabel'
|
4279 |
);
|
4280 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4281 |
unset( $optlist['custom_link'] );
|
@@ -4287,7 +4625,7 @@ EOF;
|
|
4287 |
}
|
4288 |
}
|
4289 |
|
4290 |
-
$optlist =
|
4291 |
'keywords',
|
4292 |
'description',
|
4293 |
'title',
|
@@ -4297,7 +4635,7 @@ EOF;
|
|
4297 |
'noodp',
|
4298 |
'noydir',
|
4299 |
'titleatr',
|
4300 |
-
'menulabel'
|
4301 |
);
|
4302 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4303 |
unset( $optlist['custom_link'] );
|
@@ -4331,6 +4669,10 @@ EOF;
|
|
4331 |
}
|
4332 |
}
|
4333 |
|
|
|
|
|
|
|
|
|
4334 |
function display_tabbed_metabox( $post, $metabox ) {
|
4335 |
$tabs = $metabox['args'];
|
4336 |
echo '<div class="aioseop_tabs">';
|
@@ -4349,6 +4691,11 @@ EOF;
|
|
4349 |
echo '</div>';
|
4350 |
}
|
4351 |
|
|
|
|
|
|
|
|
|
|
|
4352 |
function get_metabox_header( $tabs ) {
|
4353 |
$header = '<ul class="aioseop_header_tabs hide">';
|
4354 |
$active = ' active';
|
@@ -4391,7 +4738,7 @@ EOF;
|
|
4391 |
$wp_admin_bar->add_menu( array(
|
4392 |
'id' => AIOSEOP_PLUGIN_DIRNAME,
|
4393 |
'title' => __( 'SEO', 'all-in-one-seo-pack' ),
|
4394 |
-
'href' => $url
|
4395 |
) );
|
4396 |
|
4397 |
if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) {
|
@@ -4400,9 +4747,9 @@ EOF;
|
|
4400 |
'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ),
|
4401 |
'id' => 'aioseop-pro-upgrade',
|
4402 |
'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu',
|
4403 |
-
'meta' =>
|
4404 |
) );
|
4405 |
-
//
|
4406 |
}
|
4407 |
|
4408 |
$aioseop_admin_menu = 1;
|
@@ -4415,25 +4762,34 @@ EOF;
|
|
4415 |
'id' => 'aiosp_edit_' . $post->ID,
|
4416 |
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
4417 |
'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ),
|
4418 |
-
'href' => get_edit_post_link( $post->ID ) . '#aiosp'
|
4419 |
) );
|
4420 |
}
|
4421 |
}
|
4422 |
}
|
4423 |
|
|
|
|
|
|
|
4424 |
function menu_order() {
|
4425 |
return 5;
|
4426 |
}
|
4427 |
|
|
|
|
|
|
|
4428 |
function display_category_metaboxes( $tax ) {
|
4429 |
$screen = 'edit-' . $tax->taxonomy;
|
4430 |
?>
|
4431 |
<div id="poststuff">
|
4432 |
-
|
4433 |
</div>
|
4434 |
<?php
|
4435 |
}
|
4436 |
|
|
|
|
|
|
|
4437 |
function save_category_metaboxes( $id ) {
|
4438 |
$awmp_edit = $nonce = null;
|
4439 |
if ( isset( $_POST['aiosp_edit'] ) ) {
|
@@ -4444,7 +4800,7 @@ EOF;
|
|
4444 |
}
|
4445 |
|
4446 |
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4447 |
-
$optlist =
|
4448 |
'keywords',
|
4449 |
'description',
|
4450 |
'title',
|
@@ -4457,7 +4813,7 @@ EOF;
|
|
4457 |
'noodp',
|
4458 |
'noydir',
|
4459 |
'titleatr',
|
4460 |
-
'menulabel'
|
4461 |
);
|
4462 |
foreach ( $optlist as $f ) {
|
4463 |
$field = "aiosp_$f";
|
@@ -4466,7 +4822,7 @@ EOF;
|
|
4466 |
}
|
4467 |
}
|
4468 |
|
4469 |
-
$optlist =
|
4470 |
'keywords',
|
4471 |
'description',
|
4472 |
'title',
|
@@ -4476,7 +4832,7 @@ EOF;
|
|
4476 |
'noodp',
|
4477 |
'noydir',
|
4478 |
'titleatr',
|
4479 |
-
'menulabel'
|
4480 |
);
|
4481 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4482 |
unset( $optlist['custom_link'] );
|
@@ -4534,7 +4890,7 @@ EOF;
|
|
4534 |
}
|
4535 |
|
4536 |
$donated = false;
|
4537 |
-
if (
|
4538 |
if ( isset( $_POST['aiosp_donate'] ) ) {
|
4539 |
$donated = $_POST['aiosp_donate'];
|
4540 |
}
|
@@ -4544,7 +4900,7 @@ EOF;
|
|
4544 |
} else {
|
4545 |
$custom_menu_order = false;
|
4546 |
}
|
4547 |
-
} else if (
|
4548 |
$custom_menu_order = true;
|
4549 |
}
|
4550 |
} else {
|
@@ -4562,11 +4918,11 @@ EOF;
|
|
4562 |
}
|
4563 |
|
4564 |
if ( $donated ) {
|
4565 |
-
// Thank you for your donation
|
4566 |
-
$this->pointers['aioseop_donate'] =
|
4567 |
'pointer_target' => '#aiosp_donate_wrapper',
|
4568 |
'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
|
4569 |
-
. '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>'
|
4570 |
);
|
4571 |
}
|
4572 |
|
@@ -4588,59 +4944,59 @@ EOF;
|
|
4588 |
if ( ! empty( $this->options['aiosp_taxactive'] ) ) {
|
4589 |
foreach ( $this->options['aiosp_taxactive'] as $tax ) {
|
4590 |
$this->locations['aiosp']['display'][] = 'edit-' . $tax;
|
4591 |
-
add_action( "{$tax}_edit_form",
|
4592 |
-
add_action( "edited_{$tax}",
|
4593 |
}
|
4594 |
}
|
4595 |
} else {
|
4596 |
if ( ! empty( $this->options['aiosp_cpostactive'] ) ) {
|
4597 |
$this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
|
4598 |
} else {
|
4599 |
-
$this->locations['aiosp']['display'] =
|
4600 |
}
|
4601 |
}
|
4602 |
} else {
|
4603 |
-
$this->locations['aiosp']['display'] =
|
4604 |
}
|
4605 |
|
4606 |
|
4607 |
-
add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file,
|
4608 |
$this,
|
4609 |
-
'display_settings_page'
|
4610 |
) );
|
4611 |
|
4612 |
add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array(
|
4613 |
'aiosp_metaboxes',
|
4614 |
-
'display_extra_metaboxes'
|
4615 |
), 'aioseop_metaboxes', 'normal', 'core' );
|
4616 |
if ( AIOSEOPPRO ) {
|
4617 |
add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array(
|
4618 |
'aiosp_metaboxes',
|
4619 |
-
'display_extra_metaboxes'
|
4620 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4621 |
} else {
|
4622 |
add_meta_box( 'aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . '</b></span>', array(
|
4623 |
'aiosp_metaboxes',
|
4624 |
-
'display_extra_metaboxes'
|
4625 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4626 |
}
|
4627 |
add_meta_box( 'aioseop-support', __( 'Support', 'all-in-one-seo-pack' ) . " <span class='Taha' style='float:right;'>" . __( 'Version', 'all-in-one-seo-pack' ) . ' <b>' . AIOSEOP_VERSION . '</b></span>', array(
|
4628 |
'aiosp_metaboxes',
|
4629 |
-
'display_extra_metaboxes'
|
4630 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4631 |
|
4632 |
-
add_action( 'aioseop_modules_add_menus',
|
4633 |
do_action( 'aioseop_modules_add_menus', $file );
|
4634 |
|
4635 |
-
$metaboxes = apply_filters( 'aioseop_add_post_metabox',
|
4636 |
|
4637 |
if ( ! empty( $metaboxes ) ) {
|
4638 |
if ( $this->tabbed_metaboxes ) {
|
4639 |
-
$tabs =
|
4640 |
$tab_num = 0;
|
4641 |
foreach ( $metaboxes as $m ) {
|
4642 |
if ( ! isset( $tabs[ $m['post_type'] ] ) ) {
|
4643 |
-
$tabs[ $m['post_type'] ] =
|
4644 |
}
|
4645 |
$tabs[ $m['post_type'] ][] = $m;
|
4646 |
}
|
@@ -4658,9 +5014,9 @@ EOF;
|
|
4658 |
}
|
4659 |
add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
|
4660 |
} elseif ( $tab_num > 1 ) {
|
4661 |
-
add_meta_box( $m[0]['id'] . '_tabbed', $title,
|
4662 |
$this,
|
4663 |
-
'display_tabbed_metabox'
|
4664 |
), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
|
4665 |
}
|
4666 |
}
|
@@ -4680,6 +5036,11 @@ EOF;
|
|
4680 |
}
|
4681 |
}
|
4682 |
|
|
|
|
|
|
|
|
|
|
|
4683 |
function set_menu_order( $menu_order ) {
|
4684 |
$order = array();
|
4685 |
$file = plugin_basename( __FILE__ );
|
@@ -4716,7 +5077,7 @@ EOF;
|
|
4716 |
?>
|
4717 |
<div class="aioseop_top">
|
4718 |
<div class="aioseop_top_sidebar aioseop_options_wrapper">
|
4719 |
-
<?php do_meta_boxes( 'aioseop_metaboxes', 'normal',
|
4720 |
</div>
|
4721 |
</div>
|
4722 |
<style>
|
@@ -4728,14 +5089,14 @@ EOF;
|
|
4728 |
|
4729 |
<div class="aioseop_sidebar">
|
4730 |
<?php
|
4731 |
-
do_meta_boxes( 'aioseop_metaboxes', 'side',
|
4732 |
?>
|
4733 |
<script type="text/javascript">
|
4734 |
//<![CDATA[
|
4735 |
jQuery(document).ready(function ($) {
|
4736 |
-
//
|
4737 |
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
4738 |
-
//
|
4739 |
if (typeof postboxes !== 'undefined')
|
4740 |
postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
|
4741 |
});
|
@@ -4748,15 +5109,16 @@ EOF;
|
|
4748 |
if ( $adid == 23 ) { ?>
|
4749 |
<div
|
4750 |
style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
|
4751 |
-
|
4752 |
-
|
4753 |
-
|
4754 |
-
|
4755 |
-
|
4756 |
-
|
4757 |
-
|
4758 |
-
|
4759 |
-
|
|
|
4760 |
<?
|
4761 |
} else {
|
4762 |
?>
|
@@ -4767,7 +5129,6 @@ EOF;
|
|
4767 |
</a>
|
4768 |
<?php } ?>
|
4769 |
</div>
|
4770 |
-
<!-- Headway Themes-->
|
4771 |
<div class="aioseop_advert headwaythemes">
|
4772 |
<div>
|
4773 |
<h3>Drag and Drop WordPress Design</h3>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* All in One SEO Pack Main Class file.
|
4 |
+
*
|
5 |
+
* Main class file, to be broken up later.
|
6 |
+
*
|
7 |
* @package All-in-One-SEO-Pack
|
8 |
*/
|
9 |
|
10 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_class.php' ); // Include the module base class.
|
11 |
|
12 |
+
/**
|
13 |
+
* Class All_in_One_SEO_Pack
|
14 |
+
*
|
15 |
+
* The main class.
|
16 |
+
*/
|
17 |
class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
|
18 |
|
19 |
+
// Current version of the plugin.
|
20 |
var $version = AIOSEOP_VERSION;
|
21 |
|
22 |
+
// Max numbers of chars in auto-generated description.
|
23 |
var $maximum_description_length = 160;
|
24 |
|
25 |
+
// Minimum number of chars an excerpt should be so that it can be used as description.
|
|
|
|
|
26 |
var $minimum_description_length = 1;
|
27 |
|
28 |
+
// Whether output buffering is already being used during forced title rewrites.
|
29 |
var $ob_start_detected = false;
|
30 |
|
31 |
+
// The start of the title text in the head section for forced title rewrites.
|
32 |
var $title_start = - 1;
|
33 |
|
34 |
+
// The end of the title text in the head section for forced title rewrites.
|
35 |
var $title_end = - 1;
|
36 |
|
37 |
+
// The title before rewriting.
|
38 |
var $orig_title = '';
|
39 |
|
40 |
+
// Filename of log file.
|
41 |
var $log_file;
|
42 |
|
43 |
+
// Flag whether there should be logging.
|
44 |
var $do_log;
|
45 |
|
46 |
var $token;
|
52 |
var $meta_opts = false;
|
53 |
var $is_front_page = null;
|
54 |
|
55 |
+
/**
|
56 |
+
* All_in_One_SEO_Pack constructor.
|
57 |
+
*/
|
58 |
function __construct() {
|
59 |
global $aioseop_options;
|
60 |
+
$this->log_file = dirname( __FILE__ ) . '/all-in-one-seo-pack.log'; // PHP <5.3 compatibility, once we drop support we can use __DIR___.
|
61 |
|
62 |
if ( ! empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] ) {
|
63 |
$this->do_log = true;
|
68 |
$this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
|
69 |
$this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
|
70 |
|
71 |
+
$this->prefix = 'aiosp_'; // Option prefix.
|
72 |
$this->option_name = 'aioseop_options';
|
73 |
$this->store_option = true;
|
74 |
+
$this->file = __FILE__; // The current file.
|
75 |
$blog_name = esc_attr( get_bloginfo( 'name' ) );
|
76 |
parent::__construct();
|
77 |
|
78 |
+
$this->help_text = array(
|
79 |
'donate' => __( 'All donations support continued development of this free software.', 'all-in-one-seo-pack' ),
|
80 |
'license_key' => __( 'This will be the license key received when the product was purchased. This is used for automatic upgrades.', 'all-in-one-seo-pack' ),
|
81 |
'can' => __( "This option will automatically generate Canonical URLs for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href=\'http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html\' target=\'_blank\'>Google</a>.", 'all-in-one-seo-pack' ),
|
103 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
104 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
105 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
106 |
+
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
|
|
107 |
'page_title_format' =>
|
108 |
__( 'This controls the format of the title tag for Pages.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
109 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
112 |
__( "%page_author_login% - This page's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
113 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
114 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
115 |
+
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
|
|
116 |
'post_title_format' =>
|
117 |
__( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
118 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
123 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
124 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
125 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
126 |
+
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li></ul>',
|
|
|
127 |
'category_title_format' =>
|
128 |
__( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
129 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
187 |
'google_publisher' => __( 'Enter your Google+ Profile URL here to add the rel=“author” tag to your site for Google authorship. It is recommended that the URL you enter here should be your personal Google+ profile. Use the Advanced Authorship Options below if you want greater control over the use of authorship.', 'all-in-one-seo-pack' ),
|
188 |
'google_disable_profile' => __( 'Check this to remove the Google Plus field from the user profile screen.', 'all-in-one-seo-pack' ),
|
189 |
'google_author_advanced' => __( 'Enable this to display advanced options for controlling Google Plus authorship information on your website.', 'all-in-one-seo-pack' ),
|
190 |
+
'google_author_location' => __( 'This option allows you to control which types of pages you want to display rel=\"author\" on for Google authorship. The options include the Front Page (the homepage of your site), Posts, Pages, and any Custom Post Types. The Everywhere Else option includes 404, search, categories, tags, custom taxonomies, date archives, author archives and any other page template.', 'all-in-one-seo-pack' ),
|
191 |
+
'google_enable_publisher' => __( 'This option allows you to control whether rel=\"publisher\" is displayed on the homepage of your site. Google recommends using this if the site is a business website.', 'all-in-one-seo-pack' ),
|
192 |
+
'google_specify_publisher' => __( 'The Google+ profile you enter here will appear on your homepage only as the rel=\"publisher\" tag. It is recommended that the URL you enter here should be the Google+ profile for your business.', 'all-in-one-seo-pack' ),
|
193 |
'google_sitelinks_search' => __( 'Add markup to display the Google Sitelinks Search Box next to your search results in Google.', 'all-in-one-seo-pack' ),
|
194 |
'google_set_site_name' => __( 'Add markup to tell Google the preferred name for your website.', 'all-in-one-seo-pack' ),
|
195 |
'google_connect' => __( 'Press the connect button to connect with Google Analytics; or if already connected, press the disconnect button to disable and remove any stored analytics credentials.', 'all-in-one-seo-pack' ),
|
207 |
'ga_enhanced_ecommerce' => __( 'This enables support for the Enhanced Ecommerce in Google Analytics.', 'all-in-one-seo-pack' ),
|
208 |
'cpostnoindex' => __( 'Set the default NOINDEX setting for each Post Type.', 'all-in-one-seo-pack' ),
|
209 |
'cpostnofollow' => __( 'Set the default NOFOLLOW setting for each Post Type.', 'all-in-one-seo-pack' ),
|
210 |
+
|
211 |
'category_noindex' => __( 'Check this to ask search engines not to index Category Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
212 |
'archive_date_noindex' => __( 'Check this to ask search engines not to index Date Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
213 |
'archive_author_noindex' => __( 'Check this to ask search engines not to index Author Archives. Useful for avoiding duplicate content.', 'all-in-one-seo-pack' ),
|
228 |
'dont_truncate_descriptions' => __( 'Check this to prevent your Description from being truncated regardless of its length.', 'all-in-one-seo-pack' ),
|
229 |
'schema_markup' => __( 'Check this to support Schema.org markup, i.e., itemprop on supported metadata.', 'all-in-one-seo-pack' ),
|
230 |
'unprotect_meta' => __( "Check this to unprotect internal postmeta fields for use with XMLRPC. If you don't know what that is, leave it unchecked.", 'all-in-one-seo-pack' ),
|
231 |
+
'ex_pages' => __( 'Enter a comma separated list of pages here to be excluded by All in One SEO Pack. This is helpful when using plugins which generate their own non-WordPress dynamic pages. Ex: <em>/forum/, /contact/</em> For instance, if you want to exclude the virtual pages generated by a forum plugin, all you have to do is add forum or /forum or /forum/ or and any URL with the word \"forum\" in it, such as http://mysite.com/forum or http://mysite.com/forum/someforumpage here and it will be excluded from All in One SEO Pack.', 'all-in-one-seo-pack' ),
|
232 |
'post_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Posts. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
233 |
'page_meta_tags' => __( 'What you enter here will be copied verbatim to the header of all Pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
234 |
'front_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the front page if you have set a static page in Settings, Reading, Front Page Displays. You can enter whatever additional headers you want here, even references to stylesheets. This will fall back to using Additional Page Headers if you have them set and nothing is entered here.', 'all-in-one-seo-pack' ),
|
235 |
'home_meta_tags' => __( 'What you enter here will be copied verbatim to the header of the home page if you have Front page displays your latest posts selected in Settings, Reading. It will also be copied verbatim to the header on the Posts page if you have one set in Settings, Reading. You can enter whatever additional headers you want here, even references to stylesheets.', 'all-in-one-seo-pack' ),
|
236 |
);
|
237 |
|
238 |
+
$this->help_anchors = array(
|
239 |
'license_key' => '#license-key',
|
240 |
'can' => '#canonical-urls',
|
241 |
'no_paged_canonical_links' => '#no-pagination-for-canonical-urls',
|
242 |
'customize_canonical_links' => '#enable-custom-canonical-urls',
|
243 |
+
'can_set_protocol' => '#set-protocol-for-canonical-urls',
|
244 |
'use_original_title' => '#use-original-title',
|
245 |
'schema_markup' => '#use-schema-markup',
|
246 |
'do_log' => '#log-important-events',
|
247 |
'home_title' => '#home-title',
|
248 |
'home_description' => '#home-description',
|
249 |
'home_keywords' => '#home-keywords',
|
250 |
+
'use_static_home_info' => '#use-static-front-page-instead',
|
251 |
'togglekeywords' => '#use-keywords',
|
252 |
'use_categories' => '#use-categories-for-meta-keywords',
|
253 |
'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
|
254 |
'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
|
255 |
'rewrite_titles' => '#rewrite-titles',
|
256 |
'cap_titles' => '#capitalize-titles',
|
257 |
+
'cap_cats' => '#capitalize-titles',
|
258 |
'home_page_title_format' => '#title-format-fields',
|
259 |
'page_title_format' => '#title-format-fields',
|
260 |
'post_title_format' => '#title-format-fields',
|
264 |
'author_title_format' => '#title-format-fields',
|
265 |
'tag_title_format' => '#title-format-fields',
|
266 |
'search_title_format' => '#title-format-fields',
|
267 |
+
'description_format' => '#title-format-fields',
|
268 |
'404_title_format' => '#title-format-fields',
|
269 |
+
'paged_format' => '#title-format-fields',
|
270 |
'enablecpost' => '#seo-for-custom-post-types',
|
271 |
'cpostadvanced' => '#enable-advanced-options',
|
272 |
'cpostactive' => '#seo-on-only-these-post-types',
|
280 |
'pinterest_verify' => '',
|
281 |
'google_publisher' => '#google-plus-default-profile',
|
282 |
'google_disable_profile' => '#disable-google-plus-profile',
|
283 |
+
'google_sitelinks_search' => '#display-sitelinks-search-box',
|
284 |
+
'google_set_site_name' => '#set-preferred-site-name',
|
285 |
'google_author_advanced' => '#advanced-authorship-options',
|
286 |
'google_author_location' => '#display-google-authorship',
|
287 |
'google_enable_publisher' => '#display-publisher-meta-on-front-page',
|
297 |
'ga_track_outbound_links' => '#track-outbound-links',
|
298 |
'ga_link_attribution' => '#enhanced-link-attribution',
|
299 |
'ga_enhanced_ecommerce' => '#enhanced-ecommerce',
|
300 |
+
'cpostnoindex' => '#noindex',
|
301 |
+
'cpostnofollow' => '#nofollow',
|
302 |
+
'cpostnoodp' => '#noodp',
|
303 |
+
'cpostnoydir' => '#noydir',
|
304 |
+
'category_noindex' => '#noindex-settings',
|
305 |
+
'archive_date_noindex' => '#noindex-settings',
|
306 |
+
'archive_author_noindex' => '#noindex-settings',
|
307 |
+
'tags_noindex' => '#noindex-settings',
|
308 |
+
'search_noindex' => '#use-noindex-for-the-search-page',
|
309 |
+
'404_noindex' => '#use-noindex-for-the-404-page',
|
310 |
+
'tax_noindex' => '#use-noindex-for-the-taxonomy-archives',
|
311 |
+
'paginated_noindex' => '#use-noindex-for-paginated-pages-posts',
|
312 |
+
'paginated_nofollow' => '#use-nofollow-for-paginated-pages-posts',
|
313 |
'noodp' => '#exclude-site-from-the-open-directory-project',
|
314 |
'noydir' => '#exclude-site-from-yahoo-directory',
|
315 |
+
'skip_excerpt' => '#avoid-using-the-excerpt-in-descriptions',
|
316 |
'generate_descriptions' => '#autogenerate-descriptions',
|
317 |
'run_shortcodes' => '#run-shortcodes-in-autogenerated-descriptions',
|
318 |
'hide_paginated_descriptions' => '#remove-descriptions-for-paginated-pages',
|
322 |
'post_meta_tags' => '#additional-post-headers',
|
323 |
'page_meta_tags' => '#additional-page-headers',
|
324 |
'front_meta_tags' => '#additional-front-page-headers',
|
325 |
+
'home_meta_tags' => '#additional-blog-page-headers',
|
326 |
);
|
327 |
|
328 |
+
$meta_help_text = array(
|
329 |
'snippet' => __( 'A preview of what this page might look like in search engine results.', 'all-in-one-seo-pack' ),
|
330 |
'title' => __( 'A custom title that shows up in the title tag for this page.', 'all-in-one-seo-pack' ),
|
331 |
'description' => __( 'The META description for this page. This will override any autogenerated descriptions.', 'all-in-one-seo-pack' ),
|
339 |
'menulabel' => __( 'Set the label for this page menu item.', 'all-in-one-seo-pack' ),
|
340 |
'sitemap_exclude' => __( "Don't display this page in the sitemap.", 'all-in-one-seo-pack' ),
|
341 |
'disable' => __( 'Disable SEO on this page.', 'all-in-one-seo-pack' ),
|
342 |
+
'disable_analytics' => __( 'Disable Google Analytics on this page.', 'all-in-one-seo-pack' ),
|
343 |
);
|
344 |
|
345 |
$this->default_options = array(
|
346 |
+
'license_key' => array(
|
347 |
'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
|
348 |
+
'type' => 'text',
|
349 |
),
|
350 |
+
'donate' => array(
|
351 |
+
'name' => __( 'I enjoy this plugin and have made a donation:', 'all-in-one-seo-pack' ),
|
352 |
),
|
353 |
+
'home_title' => array(
|
354 |
'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
|
355 |
'default' => null,
|
356 |
'type' => 'textarea',
|
358 |
'count' => true,
|
359 |
'rows' => 1,
|
360 |
'cols' => 60,
|
361 |
+
'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
|
362 |
),
|
363 |
+
'home_description' => array(
|
364 |
'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
|
365 |
'default' => '',
|
366 |
'type' => 'textarea',
|
368 |
'count' => true,
|
369 |
'cols' => 80,
|
370 |
'rows' => 2,
|
371 |
+
'condshow' => array( 'aiosp_use_static_home_info' => 0 ),
|
372 |
),
|
373 |
+
'togglekeywords' => array(
|
374 |
'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
|
375 |
'default' => 1,
|
376 |
'type' => 'radio',
|
377 |
+
'initial_options' => array(
|
378 |
0 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
379 |
+
1 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
380 |
+
),
|
381 |
),
|
382 |
+
'home_keywords' => array(
|
383 |
'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
|
384 |
'default' => null,
|
385 |
'type' => 'textarea',
|
386 |
'sanitize' => 'text',
|
387 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0, 'aiosp_use_static_home_info' => 0 ),
|
388 |
),
|
389 |
+
'use_static_home_info' => array(
|
390 |
'name' => __( 'Use Static Front Page Instead', 'all-in-one-seo-pack' ),
|
391 |
'default' => 0,
|
392 |
'type' => 'radio',
|
393 |
+
'initial_options' => array(
|
394 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
395 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
396 |
+
),
|
397 |
),
|
398 |
+
'can' => array(
|
399 |
'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
|
400 |
+
'default' => 1,
|
401 |
),
|
402 |
+
'no_paged_canonical_links' => array(
|
403 |
'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
|
404 |
'default' => 0,
|
405 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
406 |
),
|
407 |
+
'customize_canonical_links' => array(
|
408 |
'name' => __( 'Enable Custom Canonical URLs:', 'all-in-one-seo-pack' ),
|
409 |
'default' => 0,
|
410 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
411 |
),
|
412 |
+
'can_set_protocol' => array(
|
413 |
'name' => __( 'Set Protocol For Canonical URLs:', 'all-in-one-seo-pack' ),
|
414 |
'type' => 'radio',
|
415 |
'default' => 'auto',
|
416 |
+
'initial_options' => array(
|
417 |
'auto' => __( 'Auto', 'all-in-one-seo-pack' ),
|
418 |
'http' => __( 'HTTP', 'all-in-one-seo-pack' ),
|
419 |
+
'https' => __( 'HTTPS', 'all-in-one-seo-pack' ),
|
420 |
),
|
421 |
+
'condshow' => array( 'aiosp_can' => 'on' ),
|
422 |
),
|
423 |
+
'rewrite_titles' => array(
|
424 |
'name' => __( 'Rewrite Titles:', 'all-in-one-seo-pack' ),
|
425 |
'default' => 1,
|
426 |
'type' => 'radio',
|
427 |
+
'initial_options' => array(
|
428 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
429 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
430 |
+
),
|
431 |
),
|
432 |
+
'force_rewrites' => array(
|
433 |
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
434 |
'default' => 1,
|
435 |
'type' => 'hidden',
|
436 |
'prefix' => $this->prefix,
|
437 |
+
'initial_options' => array(
|
438 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
439 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
440 |
+
),
|
441 |
),
|
442 |
+
'use_original_title' => array(
|
443 |
'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
|
444 |
'type' => 'radio',
|
445 |
'default' => 0,
|
446 |
+
'initial_options' => array(
|
447 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
448 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
449 |
+
),
|
450 |
),
|
451 |
+
'cap_titles' => array(
|
452 |
'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
|
453 |
+
'default' => 1,
|
454 |
),
|
455 |
+
'cap_cats' => array(
|
456 |
'name' => __( 'Capitalize Category Titles:', 'all-in-one-seo-pack' ),
|
457 |
+
'default' => 1,
|
458 |
),
|
459 |
+
'home_page_title_format' => array(
|
460 |
'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
|
461 |
'type' => 'text',
|
462 |
'default' => '%page_title%',
|
463 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
464 |
),
|
465 |
+
'page_title_format' => array(
|
466 |
'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
|
467 |
'type' => 'text',
|
468 |
'default' => '%page_title% | %blog_title%',
|
469 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
470 |
),
|
471 |
+
'post_title_format' => array(
|
472 |
'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
|
473 |
'type' => 'text',
|
474 |
'default' => '%post_title% | %blog_title%',
|
475 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
476 |
),
|
477 |
+
'category_title_format' => array(
|
478 |
'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
|
479 |
'type' => 'text',
|
480 |
'default' => '%category_title% | %blog_title%',
|
481 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
482 |
),
|
483 |
+
'archive_title_format' => array(
|
484 |
'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
|
485 |
'type' => 'text',
|
486 |
'default' => '%archive_title% | %blog_title%',
|
487 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
488 |
),
|
489 |
+
'date_title_format' => array(
|
490 |
'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
|
491 |
'type' => 'text',
|
492 |
'default' => '%date% | %blog_title%',
|
493 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
494 |
),
|
495 |
+
'author_title_format' => array(
|
496 |
'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
|
497 |
'type' => 'text',
|
498 |
'default' => '%author% | %blog_title%',
|
499 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
500 |
),
|
501 |
+
'tag_title_format' => array(
|
502 |
'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
|
503 |
'type' => 'text',
|
504 |
'default' => '%tag% | %blog_title%',
|
505 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
506 |
),
|
507 |
+
'search_title_format' => array(
|
508 |
'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
|
509 |
'type' => 'text',
|
510 |
'default' => '%search% | %blog_title%',
|
511 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
512 |
),
|
513 |
+
'description_format' => array(
|
514 |
'name' => __( 'Description Format', 'all-in-one-seo-pack' ),
|
515 |
'type' => 'text',
|
516 |
'default' => '%description%',
|
517 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
518 |
),
|
519 |
+
'404_title_format' => array(
|
520 |
'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
|
521 |
'type' => 'text',
|
522 |
'default' => 'Nothing found for %request_words%',
|
523 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
524 |
),
|
525 |
+
'paged_format' => array(
|
526 |
'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
|
527 |
'type' => 'text',
|
528 |
'default' => ' - Part %page%',
|
529 |
+
'condshow' => array( 'aiosp_rewrite_titles' => 1 ),
|
530 |
),
|
531 |
+
'enablecpost' => array(
|
532 |
'name' => __( 'SEO for Custom Post Types:', 'all-in-one-seo-pack' ),
|
533 |
'default' => 'on',
|
534 |
'type' => 'radio',
|
535 |
+
'initial_options' => array(
|
536 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
537 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
538 |
+
),
|
539 |
),
|
540 |
+
'cpostactive' => array(
|
541 |
'name' => __( 'SEO on only these post types:', 'all-in-one-seo-pack' ),
|
542 |
'type' => 'multicheckbox',
|
543 |
'default' => array( 'post', 'page' ),
|
544 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
545 |
),
|
546 |
+
'taxactive' => array(
|
547 |
'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
|
548 |
'type' => 'multicheckbox',
|
549 |
'default' => array( 'category', 'post_tag' ),
|
550 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
551 |
),
|
552 |
+
'cpostadvanced' => array(
|
553 |
'name' => __( 'Enable Advanced Options:', 'all-in-one-seo-pack' ),
|
554 |
'default' => 0,
|
555 |
'type' => 'radio',
|
556 |
+
'initial_options' => array(
|
557 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
558 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
559 |
),
|
560 |
'label' => null,
|
561 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
562 |
),
|
563 |
+
'cpostnoindex' => array(
|
564 |
'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
|
565 |
'type' => 'multicheckbox',
|
566 |
'default' => array(),
|
567 |
),
|
568 |
+
'cpostnofollow' => array(
|
569 |
'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
|
570 |
'type' => 'multicheckbox',
|
571 |
'default' => array(),
|
572 |
),
|
573 |
+
'cpostnoodp' => array(
|
574 |
'name' => __( 'Default to NOODP:', 'all-in-one-seo-pack' ),
|
575 |
'type' => 'multicheckbox',
|
576 |
'default' => array(),
|
577 |
),
|
578 |
+
'cpostnoydir' => array(
|
579 |
'name' => __( 'Default to NOYDIR:', 'all-in-one-seo-pack' ),
|
580 |
'type' => 'multicheckbox',
|
581 |
'default' => array(),
|
582 |
),
|
583 |
+
'cposttitles' => array(
|
584 |
'name' => __( 'Custom titles:', 'all-in-one-seo-pack' ),
|
585 |
'type' => 'checkbox',
|
586 |
'default' => 0,
|
587 |
+
'condshow' => array(
|
588 |
'aiosp_rewrite_titles' => 1,
|
589 |
'aiosp_enablecpost' => 'on',
|
590 |
+
'aiosp_cpostadvanced' => 'on',
|
591 |
+
),
|
592 |
),
|
593 |
+
'posttypecolumns' => array(
|
594 |
'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
|
595 |
'type' => 'multicheckbox',
|
596 |
'default' => array( 'post', 'page' ),
|
597 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on' ),
|
598 |
),
|
599 |
+
'admin_bar' => array(
|
600 |
'name' => __( 'Display Menu In Admin Bar:', 'all-in-one-seo-pack' ),
|
601 |
'default' => 'on',
|
602 |
),
|
603 |
+
'custom_menu_order' => array(
|
604 |
'name' => __( 'Display Menu At The Top:', 'all-in-one-seo-pack' ),
|
605 |
'default' => 'on',
|
606 |
),
|
607 |
+
'google_verify' => array(
|
608 |
'name' => __( 'Google Webmaster Tools:', 'all-in-one-seo-pack' ),
|
609 |
'default' => '',
|
610 |
+
'type' => 'text',
|
611 |
),
|
612 |
+
'bing_verify' => array(
|
613 |
'name' => __( 'Bing Webmaster Center:', 'all-in-one-seo-pack' ),
|
614 |
'default' => '',
|
615 |
+
'type' => 'text',
|
616 |
),
|
617 |
+
'pinterest_verify' => array(
|
618 |
'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
|
619 |
'default' => '',
|
620 |
+
'type' => 'text',
|
621 |
),
|
622 |
+
'google_publisher' => array(
|
623 |
'name' => __( 'Google Plus Default Profile:', 'all-in-one-seo-pack' ),
|
624 |
'default' => '',
|
625 |
+
'type' => 'text',
|
626 |
),
|
627 |
+
'google_disable_profile' => array(
|
628 |
'name' => __( 'Disable Google Plus Profile:', 'all-in-one-seo-pack' ),
|
629 |
'default' => 0,
|
630 |
+
'type' => 'checkbox',
|
631 |
),
|
632 |
+
'google_sitelinks_search' => array(
|
633 |
+
'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ),
|
634 |
),
|
635 |
+
'google_set_site_name' => array(
|
636 |
+
'name' => __( 'Set Preferred Site Name:', 'all-in-one-seo-pack' ),
|
637 |
),
|
638 |
+
'google_specify_site_name' => array(
|
639 |
'name' => __( 'Specify A Preferred Name:', 'all-in-one-seo-pack' ),
|
640 |
'type' => 'text',
|
641 |
'placeholder' => $blog_name,
|
642 |
+
'condshow' => array( 'aiosp_google_set_site_name' => 'on' ),
|
643 |
),
|
644 |
+
'google_author_advanced' => array(
|
645 |
'name' => __( 'Advanced Authorship Options:', 'all-in-one-seo-pack' ),
|
646 |
'default' => 0,
|
647 |
'type' => 'radio',
|
648 |
+
'initial_options' => array(
|
649 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
650 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
651 |
),
|
652 |
+
'label' => null,
|
653 |
),
|
654 |
+
'google_author_location' => array(
|
655 |
'name' => __( 'Display Google Authorship:', 'all-in-one-seo-pack' ),
|
656 |
'default' => array( 'all' ),
|
657 |
'type' => 'multicheckbox',
|
658 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
|
659 |
),
|
660 |
+
'google_enable_publisher' => array(
|
661 |
'name' => __( 'Display Publisher Meta on Front Page:', 'all-in-one-seo-pack' ),
|
662 |
'default' => 'on',
|
663 |
'type' => 'radio',
|
664 |
+
'initial_options' => array(
|
665 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
666 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
667 |
),
|
668 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on' ),
|
669 |
),
|
670 |
+
'google_specify_publisher' => array(
|
671 |
'name' => __( 'Specify Publisher URL:', 'all-in-one-seo-pack' ),
|
672 |
'type' => 'text',
|
673 |
+
'condshow' => array( 'aiosp_google_author_advanced' => 'on', 'aiosp_google_enable_publisher' => 'on' ),
|
674 |
),
|
675 |
+
// "google_connect"=>array( 'name' => __( 'Connect With Google Analytics', 'all-in-one-seo-pack' ), ),
|
676 |
+
'google_analytics_id' => array(
|
677 |
'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
|
678 |
'default' => null,
|
679 |
'type' => 'text',
|
680 |
+
'placeholder' => 'UA-########-#',
|
681 |
),
|
682 |
+
'ga_use_universal_analytics' => array(
|
683 |
'name' => __( 'Use Universal Analytics:', 'all-in-one-seo-pack' ),
|
684 |
'default' => 0,
|
685 |
+
'condshow' => array(
|
686 |
+
'aiosp_google_analytics_id' => array(
|
687 |
'lhs' => 'aiosp_google_analytics_id',
|
688 |
'op' => '!=',
|
689 |
+
'rhs' => '',
|
690 |
+
),
|
691 |
+
),
|
692 |
),
|
693 |
+
'ga_advanced_options' => array(
|
694 |
'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
|
695 |
'default' => 'on',
|
696 |
'type' => 'radio',
|
697 |
+
'initial_options' => array(
|
698 |
'on' => __( 'Enabled', 'all-in-one-seo-pack' ),
|
699 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
700 |
),
|
701 |
+
'condshow' => array(
|
702 |
+
'aiosp_google_analytics_id' => array(
|
703 |
'lhs' => 'aiosp_google_analytics_id',
|
704 |
'op' => '!=',
|
705 |
+
'rhs' => '',
|
706 |
+
),
|
707 |
+
),
|
708 |
),
|
709 |
+
'ga_domain' => array(
|
710 |
'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
|
711 |
'type' => 'text',
|
712 |
+
'condshow' => array(
|
713 |
+
'aiosp_google_analytics_id' => array(
|
714 |
'lhs' => 'aiosp_google_analytics_id',
|
715 |
'op' => '!=',
|
716 |
+
'rhs' => '',
|
717 |
),
|
718 |
+
'aiosp_ga_advanced_options' => 'on',
|
719 |
+
),
|
720 |
),
|
721 |
+
'ga_multi_domain' => array(
|
722 |
'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
|
723 |
'default' => 0,
|
724 |
+
'condshow' => array(
|
725 |
+
'aiosp_google_analytics_id' => array(
|
726 |
'lhs' => 'aiosp_google_analytics_id',
|
727 |
'op' => '!=',
|
728 |
+
'rhs' => '',
|
729 |
),
|
730 |
+
'aiosp_ga_advanced_options' => 'on',
|
731 |
+
),
|
732 |
),
|
733 |
+
'ga_addl_domains' => array(
|
734 |
'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
|
735 |
'type' => 'textarea',
|
736 |
+
'condshow' => array(
|
737 |
+
'aiosp_google_analytics_id' => array(
|
738 |
'lhs' => 'aiosp_google_analytics_id',
|
739 |
'op' => '!=',
|
740 |
+
'rhs' => '',
|
741 |
),
|
742 |
'aiosp_ga_advanced_options' => 'on',
|
743 |
+
'aiosp_ga_multi_domain' => 'on',
|
744 |
+
),
|
745 |
),
|
746 |
+
'ga_anonymize_ip' => array(
|
747 |
'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
|
748 |
'type' => 'checkbox',
|
749 |
+
'condshow' => array(
|
750 |
+
'aiosp_google_analytics_id' => array(
|
751 |
'lhs' => 'aiosp_google_analytics_id',
|
752 |
'op' => '!=',
|
753 |
+
'rhs' => '',
|
754 |
),
|
755 |
+
'aiosp_ga_advanced_options' => 'on',
|
756 |
+
),
|
757 |
),
|
758 |
+
'ga_display_advertising' => array(
|
759 |
'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
|
760 |
'type' => 'checkbox',
|
761 |
+
'condshow' => array(
|
762 |
+
'aiosp_google_analytics_id' => array(
|
763 |
'lhs' => 'aiosp_google_analytics_id',
|
764 |
'op' => '!=',
|
765 |
+
'rhs' => '',
|
766 |
),
|
767 |
+
'aiosp_ga_advanced_options' => 'on',
|
768 |
+
),
|
769 |
),
|
770 |
+
'ga_exclude_users' => array(
|
771 |
'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
|
772 |
'type' => 'multicheckbox',
|
773 |
+
'condshow' => array(
|
774 |
+
'aiosp_google_analytics_id' => array(
|
775 |
'lhs' => 'aiosp_google_analytics_id',
|
776 |
'op' => '!=',
|
777 |
+
'rhs' => '',
|
778 |
),
|
779 |
+
'aiosp_ga_advanced_options' => 'on',
|
780 |
+
),
|
781 |
),
|
782 |
+
'ga_track_outbound_links' => array(
|
783 |
'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
|
784 |
'default' => 0,
|
785 |
+
'condshow' => array(
|
786 |
+
'aiosp_google_analytics_id' => array(
|
787 |
'lhs' => 'aiosp_google_analytics_id',
|
788 |
'op' => '!=',
|
789 |
+
'rhs' => '',
|
790 |
),
|
791 |
+
'aiosp_ga_advanced_options' => 'on',
|
792 |
+
),
|
793 |
),
|
794 |
+
'ga_link_attribution' => array(
|
795 |
'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
|
796 |
'default' => 0,
|
797 |
+
'condshow' => array(
|
798 |
+
'aiosp_google_analytics_id' => array(
|
799 |
'lhs' => 'aiosp_google_analytics_id',
|
800 |
'op' => '!=',
|
801 |
+
'rhs' => '',
|
802 |
),
|
803 |
+
'aiosp_ga_advanced_options' => 'on',
|
804 |
+
),
|
805 |
),
|
806 |
+
'ga_enhanced_ecommerce' => array(
|
807 |
'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
|
808 |
'default' => 0,
|
809 |
+
'condshow' => array(
|
810 |
+
'aiosp_google_analytics_id' => array(
|
811 |
'lhs' => 'aiosp_google_analytics_id',
|
812 |
'op' => '!=',
|
813 |
+
'rhs' => '',
|
814 |
),
|
815 |
'aiosp_ga_use_universal_analytics' => 'on',
|
816 |
+
'aiosp_ga_advanced_options' => 'on',
|
817 |
+
),
|
818 |
),
|
819 |
+
'use_categories' => array(
|
820 |
'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
|
821 |
'default' => 0,
|
822 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
823 |
),
|
824 |
+
'use_tags_as_keywords' => array(
|
825 |
'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
|
826 |
'default' => 1,
|
827 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
828 |
),
|
829 |
+
'dynamic_postspage_keywords' => array(
|
830 |
'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
|
831 |
'default' => 1,
|
832 |
+
'condshow' => array( 'aiosp_togglekeywords' => 0 ),
|
833 |
),
|
834 |
+
'category_noindex' => array(
|
835 |
'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
|
836 |
+
'default' => 1,
|
837 |
),
|
838 |
+
'archive_date_noindex' => array(
|
839 |
'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
|
840 |
+
'default' => 1,
|
841 |
),
|
842 |
+
'archive_author_noindex' => array(
|
843 |
'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
|
844 |
+
'default' => 1,
|
845 |
),
|
846 |
+
'tags_noindex' => array(
|
847 |
'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
|
848 |
+
'default' => 0,
|
849 |
),
|
850 |
+
'search_noindex' => array(
|
851 |
'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
|
852 |
+
'default' => 0,
|
853 |
),
|
854 |
+
'404_noindex' => array(
|
855 |
'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
|
856 |
+
'default' => 0,
|
857 |
),
|
858 |
+
'tax_noindex' => array(
|
859 |
'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
|
860 |
'type' => 'multicheckbox',
|
861 |
'default' => array(),
|
862 |
+
'condshow' => array( 'aiosp_enablecpost' => 'on', 'aiosp_cpostadvanced' => 'on' ),
|
863 |
),
|
864 |
+
'paginated_noindex' => array(
|
865 |
'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
866 |
+
'default' => 0,
|
867 |
),
|
868 |
+
'paginated_nofollow' => array(
|
869 |
'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
|
870 |
+
'default' => 0,
|
871 |
),
|
872 |
+
'noodp' => array(
|
873 |
'name' => __( 'Exclude site from the Open Directory Project:', 'all-in-one-seo-pack' ),
|
874 |
+
'default' => 0,
|
875 |
),
|
876 |
+
'noydir' => array(
|
877 |
'name' => __( 'Exclude site from Yahoo! Directory:', 'all-in-one-seo-pack' ),
|
878 |
+
'default' => 0,
|
879 |
),
|
880 |
+
'skip_excerpt' => array(
|
881 |
'name' => __( 'Avoid Using The Excerpt In Descriptions:', 'all-in-one-seo-pack' ),
|
882 |
+
'default' => 0,
|
883 |
),
|
884 |
+
'generate_descriptions' => array(
|
885 |
'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
|
886 |
+
'default' => 1,
|
887 |
),
|
888 |
+
'run_shortcodes' => array(
|
889 |
'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
|
890 |
'default' => 0,
|
891 |
+
'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
|
892 |
),
|
893 |
+
'hide_paginated_descriptions' => array(
|
894 |
'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
|
895 |
+
'default' => 0,
|
896 |
),
|
897 |
+
'dont_truncate_descriptions' => array(
|
898 |
'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
|
899 |
+
'default' => 0,
|
900 |
),
|
901 |
+
'schema_markup' => array(
|
902 |
'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
|
903 |
+
'default' => 1,
|
904 |
),
|
905 |
+
'unprotect_meta' => array(
|
906 |
'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
|
907 |
+
'default' => 0,
|
908 |
),
|
909 |
+
'ex_pages' => array(
|
910 |
'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
|
911 |
'type' => 'textarea',
|
912 |
+
'default' => '',
|
913 |
),
|
914 |
+
'post_meta_tags' => array(
|
915 |
'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
|
916 |
'type' => 'textarea',
|
917 |
'default' => '',
|
918 |
+
'sanitize' => 'default',
|
919 |
),
|
920 |
+
'page_meta_tags' => array(
|
921 |
'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
|
922 |
'type' => 'textarea',
|
923 |
'default' => '',
|
924 |
+
'sanitize' => 'default',
|
925 |
),
|
926 |
+
'front_meta_tags' => array(
|
927 |
'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
|
928 |
'type' => 'textarea',
|
929 |
'default' => '',
|
930 |
+
'sanitize' => 'default',
|
931 |
),
|
932 |
+
'home_meta_tags' => array(
|
933 |
'name' => __( 'Additional Blog Page Headers:', 'all-in-one-seo-pack' ),
|
934 |
'type' => 'textarea',
|
935 |
'default' => '',
|
936 |
+
'sanitize' => 'default',
|
937 |
),
|
938 |
+
'do_log' => array(
|
939 |
'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
|
940 |
+
'default' => null,
|
941 |
),
|
942 |
);
|
943 |
|
948 |
unset( $this->default_options['taxactive'] );
|
949 |
}
|
950 |
|
951 |
+
$this->locations = array(
|
952 |
+
'default' => array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings', 'options' => null ),
|
953 |
+
'aiosp' => array(
|
954 |
'name' => $this->plugin_name,
|
955 |
'type' => 'metabox',
|
956 |
'prefix' => '',
|
957 |
'help_link' => 'http://semperplugins.com/sections/postpage-settings/',
|
958 |
+
'options' => array(
|
959 |
'edit',
|
960 |
'nonce-aioseop-edit',
|
961 |
AIOSEOPPRO ? 'support' : 'upgrade',
|
972 |
'menulabel',
|
973 |
'sitemap_exclude',
|
974 |
'disable',
|
975 |
+
'disable_analytics',
|
976 |
),
|
977 |
+
'default_options' => array(
|
978 |
+
'edit' => array(
|
979 |
'type' => 'hidden',
|
980 |
'default' => 'aiosp_edit',
|
981 |
'prefix' => true,
|
982 |
+
'nowrap' => 1,
|
983 |
),
|
984 |
+
'nonce-aioseop-edit' => array(
|
985 |
'type' => 'hidden',
|
986 |
'default' => null,
|
987 |
'prefix' => false,
|
988 |
+
'nowrap' => 1,
|
989 |
),
|
990 |
+
'upgrade' => array(
|
991 |
'type' => 'html',
|
992 |
'label' => 'none',
|
993 |
+
'default' => aiosp_common::get_upgrade_hyperlink( 'meta', __( 'Upgrade to All in One SEO Pack Pro Version', 'all-in-one-seo-pack' ), __( 'UPGRADE TO PRO VERSION', 'all-in-one-seo-pack' ), '_blank' ),
|
994 |
),
|
995 |
+
'support' => array(
|
996 |
'type' => 'html',
|
997 |
'label' => 'none',
|
998 |
+
'default' => '<a target="_blank" href="https://semperplugins.com/support/">'
|
999 |
+
. __( 'Support Forum', 'all-in-one-seo-pack' ) . '</a>',
|
1000 |
),
|
1001 |
+
'snippet' => array(
|
1002 |
'name' => __( 'Preview Snippet', 'all-in-one-seo-pack' ),
|
1003 |
'type' => 'custom',
|
1004 |
'label' => 'top',
|
1013 |
});
|
1014 |
});
|
1015 |
</script>
|
1016 |
+
<div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>',
|
1017 |
),
|
1018 |
+
'title' => array(
|
1019 |
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
1020 |
'type' => 'text',
|
1021 |
'count' => true,
|
1022 |
+
'size' => 60,
|
1023 |
),
|
1024 |
+
'description' => array(
|
1025 |
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
1026 |
'type' => 'textarea',
|
1027 |
'count' => true,
|
1028 |
'cols' => 80,
|
1029 |
+
'rows' => 2,
|
1030 |
),
|
1031 |
|
1032 |
+
'keywords' => array(
|
1033 |
'name' => __( 'Keywords (comma separated)', 'all-in-one-seo-pack' ),
|
1034 |
+
'type' => 'text',
|
1035 |
),
|
1036 |
+
'custom_link' => array(
|
1037 |
'name' => __( 'Custom Canonical URL', 'all-in-one-seo-pack' ),
|
1038 |
'type' => 'text',
|
1039 |
+
'size' => 60,
|
1040 |
),
|
1041 |
+
'noindex' => array(
|
1042 |
'name' => __( 'Robots Meta NOINDEX', 'all-in-one-seo-pack' ),
|
1043 |
+
'default' => '',
|
1044 |
),
|
1045 |
+
'nofollow' => array(
|
1046 |
'name' => __( 'Robots Meta NOFOLLOW', 'all-in-one-seo-pack' ),
|
1047 |
+
'default' => '',
|
1048 |
),
|
1049 |
+
'noodp' => array( 'name' => __( 'Robots Meta NOODP', 'all-in-one-seo-pack' ) ),
|
1050 |
+
'noydir' => array( 'name' => __( 'Robots Meta NOYDIR', 'all-in-one-seo-pack' ) ),
|
1051 |
+
'titleatr' => array(
|
1052 |
'name' => __( 'Title Attribute', 'all-in-one-seo-pack' ),
|
1053 |
'type' => 'text',
|
1054 |
+
'size' => 60,
|
1055 |
),
|
1056 |
+
'menulabel' => array(
|
1057 |
'name' => __( 'Menu Label', 'all-in-one-seo-pack' ),
|
1058 |
'type' => 'text',
|
1059 |
+
'size' => 60,
|
1060 |
),
|
1061 |
+
'sitemap_exclude' => array( 'name' => __( 'Exclude From Sitemap', 'all-in-one-seo-pack' ) ),
|
1062 |
+
'disable' => array( 'name' => __( 'Disable on this page/post', 'all-in-one-seo-pack' ) ),
|
1063 |
+
'disable_analytics' => array(
|
1064 |
'name' => __( 'Disable Google Analytics', 'all-in-one-seo-pack' ),
|
1065 |
+
'condshow' => array( 'aiosp_disable' => 'on' ),
|
1066 |
+
),
|
1067 |
),
|
1068 |
+
'display' => null,
|
1069 |
+
),
|
1070 |
);
|
1071 |
|
1072 |
if ( ! empty( $meta_help_text ) ) {
|
1075 |
}
|
1076 |
}
|
1077 |
|
1078 |
+
$this->layout = array(
|
1079 |
+
'default' => array(
|
1080 |
'name' => __( 'General Settings', 'all-in-one-seo-pack' ),
|
1081 |
+
'help_link' => 'https://semperplugins.com/documentation/general-settings/',
|
1082 |
+
'options' => array(), // This is set below, to the remaining options -- pdb.
|
1083 |
),
|
1084 |
+
'home' => array(
|
1085 |
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
1086 |
+
'help_link' => 'https://semperplugins.com/documentation/home-page-settings/',
|
1087 |
+
'options' => array( 'home_title', 'home_description', 'home_keywords', 'use_static_home_info' ),
|
1088 |
),
|
1089 |
+
'title' => array(
|
1090 |
'name' => __( 'Title Settings', 'all-in-one-seo-pack' ),
|
1091 |
+
'help_link' => 'https://semperplugins.com/documentation/title-settings/',
|
1092 |
+
'options' => array(
|
1093 |
'rewrite_titles',
|
1094 |
'force_rewrites',
|
1095 |
'cap_titles',
|
1105 |
'search_title_format',
|
1106 |
'description_format',
|
1107 |
'404_title_format',
|
1108 |
+
'paged_format',
|
1109 |
+
),
|
1110 |
),
|
1111 |
+
'cpt' => array(
|
1112 |
'name' => __( 'Custom Post Type Settings', 'all-in-one-seo-pack' ),
|
1113 |
'help_link' => 'http://semperplugins.com/documentation/custom-post-type-settings/',
|
1114 |
+
'options' => array( 'enablecpost', 'cpostadvanced', 'taxactive', 'cpostactive', 'cposttitles' ),
|
1115 |
),
|
1116 |
+
'display' => array(
|
1117 |
'name' => __( 'Display Settings', 'all-in-one-seo-pack' ),
|
1118 |
'help_link' => 'http://semperplugins.com/documentation/display-settings/',
|
1119 |
+
'options' => array( 'posttypecolumns', 'admin_bar', 'custom_menu_order' ),
|
1120 |
),
|
1121 |
+
'webmaster' => array(
|
1122 |
'name' => __( 'Webmaster Verification', 'all-in-one-seo-pack' ),
|
1123 |
'help_link' => 'http://semperplugins.com/sections/webmaster-verification/',
|
1124 |
+
'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify' ),
|
1125 |
),
|
1126 |
+
'google' => array(
|
1127 |
'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
|
1128 |
'help_link' => 'http://semperplugins.com/documentation/google-settings/',
|
1129 |
+
'options' => array(
|
1130 |
'google_publisher',
|
1131 |
'google_disable_profile',
|
1132 |
'google_sitelinks_search',
|
1148 |
'ga_exclude_users',
|
1149 |
'ga_track_outbound_links',
|
1150 |
'ga_link_attribution',
|
1151 |
+
'ga_enhanced_ecommerce',
|
1152 |
+
),
|
1153 |
),
|
1154 |
+
'noindex' => array(
|
1155 |
'name' => __( 'Noindex Settings', 'all-in-one-seo-pack' ),
|
1156 |
'help_link' => 'http://semperplugins.com/documentation/noindex-settings/',
|
1157 |
+
'options' => array(
|
1158 |
'cpostnoindex',
|
1159 |
'cpostnofollow',
|
1160 |
'cpostnoodp',
|
1169 |
'paginated_noindex',
|
1170 |
'paginated_nofollow',
|
1171 |
'noodp',
|
1172 |
+
'noydir',
|
1173 |
+
),
|
1174 |
),
|
1175 |
+
'advanced' => array(
|
1176 |
'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ),
|
1177 |
'help_link' => 'http://semperplugins.com/documentation/advanced-settings/',
|
1178 |
+
'options' => array(
|
1179 |
'generate_descriptions',
|
1180 |
'skip_excerpt',
|
1181 |
'run_shortcodes',
|
1186 |
'post_meta_tags',
|
1187 |
'page_meta_tags',
|
1188 |
'front_meta_tags',
|
1189 |
+
'home_meta_tags',
|
1190 |
+
),
|
1191 |
),
|
1192 |
+
'keywords' => array(
|
1193 |
'name' => __( 'Keyword Settings', 'all-in-one-seo-pack' ),
|
1194 |
'help_link' => 'http://semperplugins.com/documentation/keyword-settings/',
|
1195 |
+
'options' => array(
|
1196 |
'togglekeywords',
|
1197 |
'use_categories',
|
1198 |
'use_tags_as_keywords',
|
1199 |
+
'dynamic_postspage_keywords',
|
1200 |
+
),
|
1201 |
+
),
|
1202 |
);
|
1203 |
|
1204 |
if ( ! AIOSEOPPRO ) {
|
1205 |
unset( $this->layout['cpt']['options']['2'] );
|
1206 |
}
|
1207 |
|
1208 |
+
$other_options = array();
|
1209 |
foreach ( $this->layout as $k => $v ) {
|
1210 |
$other_options = array_merge( $other_options, $v['options'] );
|
1211 |
}
|
1214 |
|
1215 |
if ( is_admin() ) {
|
1216 |
$this->add_help_text_links();
|
1217 |
+
add_action( 'aioseop_global_settings_header', array( $this, 'display_right_sidebar' ) );
|
1218 |
+
add_action( 'aioseop_global_settings_footer', array( $this, 'display_settings_footer' ) );
|
1219 |
+
add_action( 'output_option', array( $this, 'custom_output_option' ), 10, 2 );
|
1220 |
add_action( 'all_admin_notices', array( $this, 'visibility_warning' ) );
|
1221 |
|
1222 |
if ( ! AIOSEOPPRO ) {
|
1224 |
}
|
1225 |
}
|
1226 |
if ( AIOSEOPPRO ) {
|
1227 |
+
add_action( 'split_shared_term', array( $this, 'split_shared_term' ), 10, 4 );
|
1228 |
}
|
1229 |
}
|
1230 |
|
1231 |
+
//good candidate for pro dir
|
1232 |
|
1233 |
+
/**
|
1234 |
+
* Use custom callback for outputting snippet
|
1235 |
+
*
|
1236 |
+
* @param $buf
|
1237 |
+
* @param $args
|
1238 |
+
*
|
1239 |
+
* @return string
|
1240 |
+
*/
|
1241 |
function custom_output_option( $buf, $args ) {
|
1242 |
+
if ( 'aiosp_snippet' === $args['name'] ) {
|
1243 |
$args['options']['type'] = 'html';
|
1244 |
$args['options']['nowrap'] = false;
|
1245 |
$args['options']['save'] = false;
|
1271 |
$title_format = str_replace( '%page_title%', $replace_title, $title_format );
|
1272 |
}
|
1273 |
if ( $w->is_category || $w->is_tag || $w->is_tax ) {
|
1274 |
+
if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
|
1275 |
+
$term_id = intval( $_GET['tag_ID'] );
|
1276 |
+
$was_split = get_term_meta( $term_id, '_aioseop_term_was_split', true );
|
1277 |
+
if ( ! $was_split ) {
|
1278 |
+
$split_terms = wp_get_split_terms( $term_id, $_GET['taxonomy'] );
|
1279 |
+
if ( ! empty( $split_terms ) ) {
|
1280 |
+
foreach ( $split_terms as $new_tax => $new_term ) {
|
1281 |
+
$this->split_shared_term( $term_id, $new_term );
|
|
|
|
|
1282 |
}
|
1283 |
}
|
1284 |
}
|
1336 |
|
1337 |
//good candidate for pro dir
|
1338 |
|
1339 |
+
/**
|
1340 |
+
* @return array
|
1341 |
+
*/
|
1342 |
function get_page_snippet_info() {
|
1343 |
+
static $info = array();
|
1344 |
if ( ! empty( $info ) ) {
|
1345 |
return $info;
|
1346 |
}
|
1352 |
$post = $this->get_queried_object();
|
1353 |
}
|
1354 |
if ( empty( $this->meta_opts ) ) {
|
1355 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
1356 |
}
|
1357 |
if ( ! is_object( $post ) && is_admin() && ! empty( $_GET ) && ! empty( $_GET['post_type'] ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) ) {
|
1358 |
$term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
|
1363 |
if ( empty( $post->post_modified_gmt ) ) {
|
1364 |
$wp_query = new WP_Query( array( 'p' => $post_id, 'post_type' => $post->post_type ) );
|
1365 |
}
|
1366 |
+
if ( 'page' === $post->post_type ) {
|
1367 |
$wp_query->is_page = true;
|
1368 |
+
} elseif ( 'attachment' === $post->post_type ) {
|
1369 |
$wp_query->is_attachment = true;
|
1370 |
} else {
|
1371 |
$wp_query->is_single = true;
|
1373 |
if ( empty( $this->is_front_page ) ) {
|
1374 |
$this->is_front_page = false;
|
1375 |
}
|
1376 |
+
if ( 'page' === get_option( 'show_on_front' ) ) {
|
1377 |
if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
|
1378 |
$this->is_front_page = true;
|
1379 |
} elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
|
1408 |
$category = $categories[0];
|
1409 |
}
|
1410 |
} else if ( is_object( $term ) ) {
|
1411 |
+
if ( 'category' === $_GET['taxonomy'] ) {
|
1412 |
+
query_posts( array( 'cat' => $_GET['tag_ID'] ) );
|
1413 |
+
} else if ( 'post_tag' === $_GET['taxonomy'] ) {
|
1414 |
+
query_posts( array( 'tag' => $term->slug ) );
|
1415 |
} else {
|
1416 |
+
query_posts( array(
|
1417 |
'page' => '',
|
1418 |
$_GET['taxonomy'] => $term->slug,
|
1419 |
+
'post_type' => $_GET['post_type'],
|
1420 |
) );
|
1421 |
}
|
1422 |
if ( empty( $this->meta_opts ) ) {
|
1423 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
1424 |
}
|
1425 |
$title = $this->get_tax_name( $_GET['taxonomy'] );
|
1426 |
$title_format = $this->get_tax_title_format();
|
1459 |
$keywords = $this->apply_cf_fields( $keywords );
|
1460 |
$keywords = apply_filters( 'aioseop_keywords', $keywords );
|
1461 |
|
1462 |
+
$info = array(
|
1463 |
'title' => $title,
|
1464 |
'description' => $description,
|
1465 |
'keywords' => $keywords,
|
1467 |
'title_format' => $title_format,
|
1468 |
'category' => $category,
|
1469 |
'w' => $wp_query,
|
1470 |
+
'p' => $post,
|
1471 |
);
|
1472 |
wp_reset_postdata();
|
1473 |
$wp_query = $w;
|
1476 |
return $info;
|
1477 |
}
|
1478 |
|
1479 |
+
/**
|
1480 |
+
* @return null|object|WP_Post
|
1481 |
+
*/
|
1482 |
function get_queried_object() {
|
1483 |
static $p = null;
|
1484 |
global $wp_query, $post;
|
1485 |
+
if ( null !== $p ) {
|
1486 |
return $p;
|
1487 |
}
|
1488 |
if ( is_object( $post ) ) {
|
1497 |
return $p;
|
1498 |
}
|
1499 |
|
1500 |
+
/**
|
1501 |
+
* @param array $opts
|
1502 |
+
* @param null $location
|
1503 |
+
* @param null $defaults
|
1504 |
+
* @param null $post
|
1505 |
+
*
|
1506 |
+
* @return array
|
1507 |
+
*/
|
1508 |
+
function get_current_options( $opts = array(), $location = null, $defaults = null, $post = null ) {
|
1509 |
+
if ( ( 'aiosp' === $location) && ( 'metabox' == $this->locations[ $location ]['type'] ) ) {
|
1510 |
+
if ( null === $post ) {
|
1511 |
global $post;
|
1512 |
}
|
1513 |
$post_id = $post;
|
1515 |
$post_id = $post_id->ID;
|
1516 |
}
|
1517 |
$get_opts = $this->default_options( $location );
|
1518 |
+
$optlist = array(
|
1519 |
'keywords',
|
1520 |
'description',
|
1521 |
'title',
|
1528 |
'noodp',
|
1529 |
'noydir',
|
1530 |
'titleatr',
|
1531 |
+
'menulabel',
|
1532 |
);
|
1533 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
1534 |
unset( $optlist['custom_link'] );
|
1551 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1552 |
}
|
1553 |
if ( 'title' === $f || 'description' === $f ) {
|
1554 |
+
$get_opts[ $field ] = htmlspecialchars( $meta );
|
1555 |
} else {
|
1556 |
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1557 |
}
|
1559 |
$field = "aiosp_$f";
|
1560 |
$meta = get_post_meta( $post_id, '_aioseop_' . $f, true );
|
1561 |
if ( 'title' === $f || 'description' === $f ) {
|
1562 |
+
$get_opts[ $field ] = htmlspecialchars( $meta );
|
1563 |
} else {
|
1564 |
$get_opts[ $field ] = htmlspecialchars( stripslashes( $meta ) );
|
1565 |
}
|
1576 |
}
|
1577 |
}
|
1578 |
|
1579 |
+
/**
|
1580 |
+
* @param $in
|
1581 |
+
*
|
1582 |
+
* @return mixed|void
|
1583 |
+
*/
|
1584 |
function internationalize( $in ) {
|
1585 |
if ( function_exists( 'langswitch_filter_langs_with_message' ) ) {
|
1586 |
$in = langswitch_filter_langs_with_message( $in );
|
1611 |
$title = $this->apply_cf_fields( $title );
|
1612 |
}
|
1613 |
|
1614 |
+
if ( false === $title ) {
|
1615 |
$title = $this->get_original_title();
|
1616 |
}
|
1617 |
|
1618 |
+
// If we're going to have this here, which seems logical, we should probably take it out of other places... do all titles pass through here?
|
1619 |
// The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
|
1620 |
// if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
|
1621 |
// $title = $this->capitalize( $title );
|
1623 |
return apply_filters( 'aioseop_title', $title );
|
1624 |
}
|
1625 |
|
1626 |
+
/**
|
1627 |
+
* Gets the title that will be used by AIOSEOP for title rewrites or returns false.
|
1628 |
+
*
|
1629 |
+
* @param $post
|
1630 |
+
*
|
1631 |
+
* @return bool|string
|
1632 |
+
*/
|
1633 |
function get_aioseop_title( $post ) {
|
1634 |
global $aioseop_options;
|
1635 |
+
// the_search_query() is not suitable, it cannot just return.
|
1636 |
global $s, $STagging;
|
1637 |
$opts = $this->meta_opts;
|
1638 |
if ( is_front_page() ) {
|
1671 |
if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
1672 |
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1673 |
}
|
1674 |
+
// $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
|
1675 |
if ( ! $title ) {
|
1676 |
$title = $this->internationalize( get_post_meta( $frontpage_id, '_aioseop_title', true ) );
|
1677 |
+
} // This is/was causing the first product to come through.
|
1678 |
if ( ! $title ) {
|
1679 |
$title = $this->internationalize( $post->post_title );
|
1680 |
}
|
1682 |
$title = $this->internationalize( $this->get_original_title( '', false ) );
|
1683 |
}
|
1684 |
|
|
|
1685 |
$title = $this->apply_page_title_format( $title, $post );
|
1686 |
$title = $this->paged_title( $title );
|
1687 |
$title = apply_filters( 'aioseop_title_page', $title );
|
1692 |
|
1693 |
return $this->paged_title( $title ); //this is returned for woo
|
1694 |
} else if ( is_attachment() ) {
|
1695 |
+
if ( null === $post ) {
|
1696 |
return false;
|
1697 |
}
|
1698 |
$title = get_post_meta( $post->ID, '_aioseop_title', true );
|
1709 |
|
1710 |
return $title;
|
1711 |
} else if ( is_page() || $this->is_static_posts_page() || ( is_home() && ! $this->is_static_posts_page() ) ) {
|
1712 |
+
if ( null === $post ) {
|
1713 |
return false;
|
1714 |
}
|
1715 |
+
if ( $this->is_static_front_page() && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
|
1716 |
if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
|
1717 |
$home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
|
1718 |
}
|
1719 |
|
1720 |
+
// Home title filter.
|
1721 |
return apply_filters( 'aioseop_home_page_title', $home_title );
|
1722 |
} else {
|
1723 |
$page_for_posts = '';
|
1750 |
return $title;
|
1751 |
}
|
1752 |
} else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
1753 |
+
// Too far down? -mrt.
|
1754 |
$title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
|
1755 |
if ( ! $title ) {
|
1756 |
$title = $this->internationalize( $post->post_title );
|
1764 |
|
1765 |
return $title;
|
1766 |
} else if ( is_single() ) {
|
1767 |
+
// We're not in the loop :(.
|
1768 |
+
if ( null === $post ) {
|
1769 |
return false;
|
1770 |
}
|
1771 |
$categories = $this->get_all_categories();
|
1854 |
$title = str_replace( '%taxonomy_description%', $tag_description, $title );
|
1855 |
}
|
1856 |
$title = trim( wp_strip_all_tags( $title ) );
|
1857 |
+
$title = str_replace( array( '"', "\r\n", "\n" ), array( '"', ' ', ' ' ), $title );
|
1858 |
$title = $this->paged_title( $title );
|
1859 |
|
1860 |
return $title;
|
1861 |
}
|
1862 |
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1863 |
return $this->get_tax_title();
|
1864 |
+
} else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support.
|
1865 |
$tag = $STagging->search_tag;
|
1866 |
if ( $tag ) {
|
1867 |
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1946 |
return false;
|
1947 |
}
|
1948 |
|
1949 |
+
/**
|
1950 |
+
* @param string $sep
|
1951 |
+
* @param bool $echo
|
1952 |
+
* @param string $seplocation
|
1953 |
+
*
|
1954 |
+
* @return The original title as delivered by WP (well, in most cases).
|
1955 |
+
*/
|
1956 |
function get_original_title( $sep = '|', $echo = false, $seplocation = '' ) {
|
1957 |
global $aioseop_options;
|
1958 |
if ( ! empty( $aioseop_options['aiosp_use_original_title'] ) ) {
|
1959 |
+
$has_filter = has_filter( 'wp_title', array( $this, 'wp_title' ) );
|
1960 |
+
if ( false !== $has_filter ) {
|
1961 |
+
remove_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
|
1962 |
}
|
1963 |
if ( current_theme_supports( 'title-tag' ) ) {
|
1964 |
$sep = '|';
|
1966 |
$seplocation = 'right';
|
1967 |
}
|
1968 |
$title = wp_title( $sep, $echo, $seplocation );
|
1969 |
+
if ( false !== $has_filter ) {
|
1970 |
+
add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
|
1971 |
}
|
1972 |
if ( $title && ( $title = trim( $title ) ) ) {
|
1973 |
return trim( $title );
|
1974 |
}
|
1975 |
}
|
1976 |
|
1977 |
+
// the_search_query() is not suitable, it cannot just return.
|
1978 |
global $s;
|
1979 |
|
1980 |
$title = null;
|
2001 |
$tag = $tags[0]->tag;
|
2002 |
$tag = str_replace( '-', ' ', $tag );
|
2003 |
} else {
|
2004 |
+
// For WordPress > 2.3.
|
2005 |
$tag = $this->internationalize( single_term_title( '', false ) );
|
2006 |
}
|
2007 |
if ( $tag ) {
|
2042 |
return trim( $title );
|
2043 |
}
|
2044 |
|
2045 |
+
/**
|
2046 |
+
* @param $s
|
2047 |
+
*
|
2048 |
+
* @return string
|
2049 |
+
*/
|
2050 |
function capitalize( $s ) {
|
2051 |
$s = trim( $s );
|
2052 |
$tokens = explode( ' ', $s );
|
2060 |
}
|
2061 |
|
2062 |
/**
|
2063 |
+
* @param $request
|
2064 |
+
*
|
2065 |
+
* @return User -readable nice words for a given request.
|
2066 |
*/
|
2067 |
function request_as_words( $request ) {
|
2068 |
$request = htmlspecialchars( $request );
|
2081 |
return $request;
|
2082 |
}
|
2083 |
|
2084 |
+
/**
|
2085 |
+
* @param $title
|
2086 |
+
* @param null $p
|
2087 |
+
* @param string $title_format
|
2088 |
+
*
|
2089 |
+
* @return string
|
2090 |
+
*/
|
2091 |
function apply_page_title_format( $title, $p = null, $title_format = '' ) {
|
2092 |
global $aioseop_options;
|
2093 |
if ( $p === null ) {
|
2102 |
return $this->title_placeholder_helper( $title, $post, 'page', $title_format );
|
2103 |
}
|
2104 |
|
2105 |
+
/**
|
2106 |
+
* @param $title
|
2107 |
+
* @param $post
|
2108 |
+
* @param string $type
|
2109 |
+
* @param string $title_format
|
2110 |
+
* @param string $category
|
2111 |
+
*
|
2112 |
+
* @return string
|
2113 |
+
*/
|
2114 |
function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
|
2115 |
if ( ! empty( $post ) ) {
|
2116 |
$authordata = get_userdata( $post->post_author );
|
2164 |
return $title;
|
2165 |
}
|
2166 |
|
2167 |
+
/**
|
2168 |
+
* @param $id
|
2169 |
+
* @param $taxonomy
|
2170 |
+
*
|
2171 |
+
* @return array
|
2172 |
+
*/
|
2173 |
function get_all_terms( $id, $taxonomy ) {
|
2174 |
+
$keywords = array();
|
2175 |
$terms = get_the_terms( $id, $taxonomy );
|
2176 |
if ( ! empty( $terms ) ) {
|
2177 |
foreach ( $terms as $term ) {
|
2182 |
return $keywords;
|
2183 |
}
|
2184 |
|
2185 |
+
/**
|
2186 |
+
* @param $title
|
2187 |
+
*
|
2188 |
+
* @return string
|
2189 |
+
*/
|
2190 |
function paged_title( $title ) {
|
2191 |
+
// The page number if paged.
|
2192 |
global $paged;
|
2193 |
global $aioseop_options;
|
2194 |
+
// Simple tagging support.
|
2195 |
global $STagging;
|
2196 |
$page = get_query_var( 'page' );
|
2197 |
if ( $paged > $page ) {
|
2210 |
return $title;
|
2211 |
}
|
2212 |
|
2213 |
+
/**
|
2214 |
+
* @param $message
|
2215 |
+
*/
|
2216 |
function log( $message ) {
|
2217 |
if ( $this->do_log ) {
|
2218 |
@error_log( date( 'Y-m-d H:i:s' ) . ' ' . $message . "\n", 3, $this->log_file );
|
2219 |
}
|
2220 |
}
|
2221 |
|
2222 |
+
/**
|
2223 |
+
* @param $title
|
2224 |
+
* @param string $category
|
2225 |
+
* @param null $p
|
2226 |
+
*
|
2227 |
+
* @return string
|
2228 |
+
*/
|
2229 |
function apply_post_title_format( $title, $category = '', $p = null ) {
|
2230 |
if ( $p === null ) {
|
2231 |
global $post;
|
2237 |
return $this->title_placeholder_helper( $title, $post, 'post', $title_format, $category );
|
2238 |
}
|
2239 |
|
2240 |
+
/**
|
2241 |
+
* @param string $title_type
|
2242 |
+
* @param null $p
|
2243 |
+
*
|
2244 |
+
* @return bool|string
|
2245 |
+
*/
|
2246 |
function get_post_title_format( $title_type = 'post', $p = null ) {
|
2247 |
global $aioseop_options;
|
2248 |
if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
|
2269 |
return $title_format;
|
2270 |
}
|
2271 |
|
2272 |
+
/**
|
2273 |
+
* @param array $post_types
|
2274 |
+
* @param null $post
|
2275 |
+
*
|
2276 |
+
* @return bool
|
2277 |
+
*/
|
2278 |
+
function is_singular( $post_types = array(), $post = null ) {
|
2279 |
if ( ! empty( $post_types ) && is_object( $post ) ) {
|
2280 |
return in_array( $post->post_type, (array) $post_types );
|
2281 |
} else {
|
2283 |
}
|
2284 |
}
|
2285 |
|
2286 |
+
/**
|
2287 |
+
* @return bool|null
|
2288 |
+
*/
|
2289 |
function is_static_posts_page() {
|
2290 |
static $is_posts_page = null;
|
2291 |
if ( $is_posts_page !== null ) {
|
2297 |
return $is_posts_page;
|
2298 |
}
|
2299 |
|
2300 |
+
/**
|
2301 |
+
* @return bool|null
|
2302 |
+
*/
|
2303 |
function is_static_front_page() {
|
2304 |
if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
|
2305 |
return $this->is_front_page;
|
2310 |
return $this->is_front_page;
|
2311 |
}
|
2312 |
|
2313 |
+
/**
|
2314 |
+
* @param int $id
|
2315 |
+
*
|
2316 |
+
* @return array
|
2317 |
+
*/
|
2318 |
function get_all_categories( $id = 0 ) {
|
2319 |
+
$keywords = array();
|
2320 |
$categories = get_the_category( $id );
|
2321 |
if ( ! empty( $categories ) ) {
|
2322 |
foreach ( $categories as $category ) {
|
2327 |
return $keywords;
|
2328 |
}
|
2329 |
|
2330 |
+
/**
|
2331 |
+
* @param string $tax
|
2332 |
+
*
|
2333 |
+
* @return string
|
2334 |
+
*/
|
2335 |
function get_tax_title( $tax = '' ) {
|
2336 |
if ( AIOSEOPPRO ) {
|
2337 |
if ( empty( $this->meta_opts ) ) {
|
2338 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
2339 |
}
|
2340 |
}
|
2341 |
if ( empty( $tax ) ) {
|
2351 |
return $this->apply_tax_title_format( $name, $desc, $tax );
|
2352 |
}
|
2353 |
|
2354 |
+
// Handle prev / next links.
|
2355 |
|
2356 |
+
/**
|
2357 |
+
* @param $tax
|
2358 |
+
*
|
2359 |
+
* @return mixed|void
|
2360 |
+
*/
|
2361 |
function get_tax_name( $tax ) {
|
2362 |
global $aioseop_options;
|
2363 |
if ( AIOSEOPPRO ) {
|
2371 |
if ( empty( $name ) ) {
|
2372 |
$name = single_term_title( '', false );
|
2373 |
}
|
2374 |
+
// Apparently we're already ucwordsing this elsewhere, and doing it a second time messes it up... why aren't we just doing this at the end?
|
2375 |
// if ( ( $tax == 'category' ) && ( !empty( $aioseop_options['aiosp_cap_cats'] ) ) )
|
2376 |
// $name = $this->ucwords( $name );
|
2377 |
|
2378 |
return $this->internationalize( $name );
|
2379 |
}
|
2380 |
|
2381 |
+
/**
|
2382 |
+
* @param $tax
|
2383 |
+
*
|
2384 |
+
* @return mixed|void
|
2385 |
+
*/
|
2386 |
function get_tax_desc( $tax ) {
|
2387 |
if ( AIOSEOPPRO ) {
|
2388 |
$opts = $this->meta_opts;
|
2399 |
return $this->internationalize( $desc );
|
2400 |
}
|
2401 |
|
2402 |
+
/**
|
2403 |
+
* @param $category_name
|
2404 |
+
* @param $category_description
|
2405 |
+
* @param string $tax
|
2406 |
+
*
|
2407 |
+
* @return string
|
2408 |
+
*/
|
2409 |
function apply_tax_title_format( $category_name, $category_description, $tax = '' ) {
|
2410 |
if ( empty( $tax ) ) {
|
2411 |
$tax = get_query_var( 'taxonomy' );
|
2432 |
return $this->paged_title( $title );
|
2433 |
}
|
2434 |
|
2435 |
+
/**
|
2436 |
+
* @param string $tax
|
2437 |
+
*
|
2438 |
+
* @return string
|
2439 |
+
*/
|
2440 |
function get_tax_title_format( $tax = '' ) {
|
2441 |
global $aioseop_options;
|
2442 |
if ( AIOSEOPPRO ) {
|
2467 |
return $title_format;
|
2468 |
}
|
2469 |
|
2470 |
+
/**
|
2471 |
+
* @param $title
|
2472 |
+
* @param string $category
|
2473 |
+
*
|
2474 |
+
* @return string
|
2475 |
+
*/
|
2476 |
function apply_archive_title_format( $title, $category = '' ) {
|
2477 |
$title_format = $this->get_archive_title_format();
|
2478 |
$r_title = array( '%blog_title%', '%blog_description%', '%archive_title%' );
|
2479 |
$d_title = array(
|
2480 |
$this->internationalize( get_bloginfo( 'name' ) ),
|
2481 |
$this->internationalize( get_bloginfo( 'description' ) ),
|
2482 |
+
post_type_archive_title( '', false ),
|
2483 |
);
|
2484 |
$title = trim( str_replace( $r_title, $d_title, $title_format ) );
|
2485 |
|
2486 |
return $title;
|
2487 |
}
|
2488 |
|
2489 |
+
/**
|
2490 |
+
* @return bool|string
|
2491 |
+
*/
|
2492 |
function get_archive_title_format() {
|
2493 |
return $this->get_post_title_format( 'archive' );
|
2494 |
}
|
2495 |
|
2496 |
+
/**
|
2497 |
+
* @param null $post
|
2498 |
+
*
|
2499 |
+
* @return mixed|string|void
|
2500 |
+
*/
|
2501 |
function get_main_description( $post = null ) {
|
2502 |
global $aioseop_options;
|
2503 |
$opts = $this->meta_opts;
|
2505 |
if ( is_author() && $this->show_page_description() ) {
|
2506 |
$description = $this->internationalize( get_the_author_meta( 'description' ) );
|
2507 |
} else if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
2508 |
+
// $description = $this->get_post_description( $post );
|
2509 |
+
// $description = $this->apply_cf_fields( $description );
|
2510 |
if ( ! ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
|
2511 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2512 |
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2513 |
+
// $description = $this->get_aioseop_description( $post );
|
2514 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2515 |
} else if ( woocommerce_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2516 |
$description = $this->get_aioseop_description( $post );
|
2517 |
}
|
2535 |
return $description;
|
2536 |
}
|
2537 |
|
2538 |
+
/**
|
2539 |
+
* @return bool
|
2540 |
+
*/
|
2541 |
function show_page_description() {
|
2542 |
global $aioseop_options;
|
2543 |
if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) {
|
2550 |
return true;
|
2551 |
}
|
2552 |
|
2553 |
+
/**
|
2554 |
+
* @return mixed
|
2555 |
+
*/
|
2556 |
function get_page_number() {
|
2557 |
$page = get_query_var( 'page' );
|
2558 |
if ( empty( $page ) ) {
|
2562 |
return $page;
|
2563 |
}
|
2564 |
|
2565 |
+
/**
|
2566 |
+
* @param null $post
|
2567 |
+
*
|
2568 |
+
* @return mixed|string
|
2569 |
+
*/
|
2570 |
function get_aioseop_description( $post = null ) {
|
2571 |
global $aioseop_options;
|
2572 |
+
if ( null === $post ) {
|
2573 |
$post = $GLOBALS['post'];
|
2574 |
}
|
2575 |
$blog_page = aiosp_common::get_blog_page();
|
2576 |
$description = '';
|
2577 |
if ( is_front_page() && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2578 |
+
$description = trim( $this->internationalize( $aioseop_options['aiosp_home_description'] ) );
|
2579 |
} elseif ( ! empty( $blog_page ) ) {
|
2580 |
$description = $this->get_post_description( $blog_page );
|
2581 |
}
|
2587 |
return $description;
|
2588 |
}
|
2589 |
|
2590 |
+
/**
|
2591 |
+
* @param $post
|
2592 |
+
*
|
2593 |
+
* @return mixed|string
|
2594 |
+
*/
|
2595 |
function get_post_description( $post ) {
|
2596 |
global $aioseop_options;
|
2597 |
$description = '';
|
2598 |
if ( ! $this->show_page_description() ) {
|
2599 |
return '';
|
2600 |
}
|
2601 |
+
$description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
|
2602 |
if ( ! empty( $post ) && post_password_required( $post ) ) {
|
2603 |
return $description;
|
2604 |
}
|
2606 |
if ( empty( $aioseop_options['aiosp_skip_excerpt'] ) ) {
|
2607 |
$description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
|
2608 |
}
|
2609 |
+
if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) {
|
2610 |
$content = $post->post_content;
|
2611 |
if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
|
2612 |
$content = do_shortcode( $content );
|
2616 |
}
|
2617 |
}
|
2618 |
|
2619 |
+
// Internal whitespace trim.
|
2620 |
+
$description = preg_replace( '/\s\s+/u', ' ', $description );
|
2621 |
|
2622 |
return $description;
|
2623 |
}
|
2624 |
|
2625 |
+
/**
|
2626 |
+
* @param $text
|
2627 |
+
*
|
2628 |
+
* @return string
|
2629 |
+
*/
|
2630 |
function trim_excerpt_without_filters_full_length( $text ) {
|
2631 |
$text = str_replace( ']]>', ']]>', $text );
|
2632 |
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2633 |
$text = wp_strip_all_tags( $text );
|
2634 |
|
2635 |
+
return trim( $text );
|
2636 |
}
|
2637 |
|
2638 |
+
/**
|
2639 |
+
* @param $text
|
2640 |
+
* @param int $max
|
2641 |
+
*
|
2642 |
+
* @return string
|
2643 |
+
*/
|
2644 |
function trim_excerpt_without_filters( $text, $max = 0 ) {
|
2645 |
$text = str_replace( ']]>', ']]>', $text );
|
2646 |
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
2647 |
$text = wp_strip_all_tags( $text );
|
2648 |
+
// Treat other common word-break characters like a space.
|
2649 |
$text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
|
2650 |
if ( ! $max ) {
|
2651 |
$max = $this->maximum_description_length;
|
2655 |
if ( $max < $len ) {
|
2656 |
if ( function_exists( 'mb_strrpos' ) ) {
|
2657 |
$pos = mb_strrpos( $text2, ' ', - ( $len - $max ) );
|
2658 |
+
if ( false === $pos ) {
|
2659 |
$pos = $max;
|
2660 |
}
|
2661 |
if ( $pos > $this->minimum_description_length ) {
|
2664 |
$max = $this->minimum_description_length;
|
2665 |
}
|
2666 |
} else {
|
2667 |
+
while ( ' ' != $text2[ $max ] && $max > $this->minimum_description_length ) {
|
2668 |
$max --;
|
2669 |
}
|
2670 |
}
|
2671 |
|
2672 |
+
// Probably no valid chars to break on?
|
2673 |
if ( $len > $max_orig && $max < intval( $max_orig / 2 ) ) {
|
2674 |
$max = $max_orig;
|
2675 |
}
|
2679 |
return trim( $text );
|
2680 |
}
|
2681 |
|
2682 |
+
/**
|
2683 |
+
* @param $query
|
2684 |
+
* @param bool $show_page
|
2685 |
+
*
|
2686 |
+
* @return bool|false|string
|
2687 |
+
*/
|
2688 |
function aiosp_mrt_get_url( $query, $show_page = true ) {
|
2689 |
if ( $query->is_404 || $query->is_search ) {
|
2690 |
return false;
|
2706 |
default:
|
2707 |
return false;
|
2708 |
}
|
2709 |
+
} elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) {
|
2710 |
$link = get_permalink( $pageid );
|
2711 |
} elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
|
2712 |
if ( function_exists( 'icl_get_home_url' ) ) {
|
2719 |
$link = get_permalink( $post->ID );
|
2720 |
} elseif ( $query->is_author && $haspost ) {
|
2721 |
$author = get_userdata( get_query_var( 'author' ) );
|
2722 |
+
if ( false === $author ) {
|
2723 |
return false;
|
2724 |
}
|
2725 |
$link = get_author_posts_url( $author->ID, $author->user_nicename );
|
2761 |
}
|
2762 |
if ( ! empty( $link ) ) {
|
2763 |
global $aioseop_options;
|
2764 |
+
if ( isset( $aioseop_options['aiosp_can_set_protocol'] ) && ( 'auto' !== $aioseop_options['aiosp_can_set_protocol'] ) ) {
|
2765 |
+
if ( 'http' === $aioseop_options['aiosp_can_set_protocol'] ) {
|
2766 |
$link = preg_replace( '/^https:/i', 'http:', $link );
|
2767 |
+
} elseif ( 'https' === $aioseop_options['aiosp_can_set_protocol'] ) {
|
2768 |
$link = preg_replace( '/^http:/i', 'https:', $link );
|
2769 |
}
|
2770 |
}
|
2773 |
return $link;
|
2774 |
}
|
2775 |
|
2776 |
+
/**
|
2777 |
+
* @param $link
|
2778 |
+
*
|
2779 |
+
* @return string
|
2780 |
+
*/
|
2781 |
function get_paged( $link ) {
|
2782 |
global $wp_rewrite;
|
2783 |
$page = $this->get_page_number();
|
2786 |
$page_name = $wp_rewrite->pagination_base;
|
2787 |
}
|
2788 |
if ( ! empty( $page ) && $page > 1 ) {
|
2789 |
+
if ( $page == get_query_var( 'page' ) ) {
|
2790 |
$link = trailingslashit( $link ) . "$page";
|
2791 |
} else {
|
2792 |
$link = trailingslashit( $link ) . trailingslashit( $page_name ) . $page;
|
2797 |
return $link;
|
2798 |
}
|
2799 |
|
2800 |
+
/**
|
2801 |
+
* @return comma|string
|
2802 |
+
*/
|
2803 |
function get_main_keywords() {
|
2804 |
global $aioseop_options;
|
2805 |
global $aioseop_keywords;
|
2806 |
global $post;
|
2807 |
$opts = $this->meta_opts;
|
2808 |
+
if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) {
|
2809 |
if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
|
2810 |
$keywords = $this->get_all_keywords();
|
2811 |
} else {
|
2812 |
$keywords = trim( $this->internationalize( $aioseop_options['aiosp_home_keywords'] ) );
|
2813 |
}
|
2814 |
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
|
2815 |
+
$keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts.
|
2816 |
} elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
|
2817 |
$keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
|
2818 |
} elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
|
2833 |
if ( is_404() ) {
|
2834 |
return null;
|
2835 |
}
|
2836 |
+
// If we are on synthetic pages.
|
2837 |
if ( ! is_home() && ! is_page() && ! is_single() && ! $this->is_static_front_page() && ! $this->is_static_posts_page() && ! is_archive() && ! is_post_type_archive() && ! is_category() && ! is_tag() && ! is_tax() ) {
|
2838 |
return null;
|
2839 |
}
|
2849 |
}
|
2850 |
if ( empty( $posts ) ) {
|
2851 |
global $post;
|
2852 |
+
$post_arr = array( $post );
|
2853 |
} else {
|
2854 |
$post_arr = $posts;
|
2855 |
}
|
2858 |
foreach ( $post_arr as $p ) {
|
2859 |
if ( $p ) {
|
2860 |
$id = $p->ID;
|
2861 |
+
if ( 1 == $postcount || ! empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
|
2862 |
+
// Custom field keywords.
|
2863 |
$keywords_i = null;
|
2864 |
$keywords_i = stripslashes( $this->internationalize( get_post_meta( $id, '_aioseop_keywords', true ) ) );
|
2865 |
if ( is_attachment() ) {
|
2879 |
if ( ! empty( $aioseop_options['aiosp_use_tags_as_keywords'] ) ) {
|
2880 |
$keywords = array_merge( $keywords, $this->get_all_tags( $id ) );
|
2881 |
}
|
2882 |
+
// Autometa.
|
2883 |
$autometa = stripslashes( get_post_meta( $id, 'autometa', true ) );
|
2884 |
if ( isset( $autometa ) && ! empty( $autometa ) ) {
|
2885 |
$autometa_array = explode( ' ', $autometa );
|
2888 |
}
|
2889 |
}
|
2890 |
|
2891 |
+
if ( isset( $aioseop_options['aiosp_use_categories'] ) && $aioseop_options['aiosp_use_categories'] && ! is_page() ) {
|
2892 |
$keywords = array_merge( $keywords, $this->get_all_categories( $id ) );
|
2893 |
}
|
2894 |
}
|
2898 |
return $this->get_unique_keywords( $keywords );
|
2899 |
}
|
2900 |
|
2901 |
+
/**
|
2902 |
+
* @param $keywords
|
2903 |
+
*
|
2904 |
+
* @return array
|
2905 |
+
*/
|
2906 |
function keyword_string_to_list( $keywords ) {
|
2907 |
+
$traverse = array();
|
2908 |
$keywords_i = str_replace( '"', '', $keywords );
|
2909 |
if ( isset( $keywords_i ) && ! empty( $keywords_i ) ) {
|
2910 |
$traverse = explode( ',', $keywords_i );
|
2913 |
return $traverse;
|
2914 |
}
|
2915 |
|
2916 |
+
/**
|
2917 |
+
* @param int $id
|
2918 |
+
*
|
2919 |
+
* @return array
|
2920 |
+
*/
|
2921 |
function get_all_tags( $id = 0 ) {
|
2922 |
+
$keywords = array();
|
2923 |
$tags = get_the_tags( $id );
|
2924 |
if ( ! empty( $tags ) && is_array( $tags ) ) {
|
2925 |
foreach ( $tags as $tag ) {
|
2926 |
$keywords[] = $this->internationalize( $tag->name );
|
2927 |
}
|
2928 |
}
|
2929 |
+
// Ultimate Tag Warrior integration.
|
2930 |
global $utw;
|
2931 |
if ( $utw ) {
|
2932 |
$tags = $utw->GetTagsForPost( $p );
|
2944 |
return $keywords;
|
2945 |
}
|
2946 |
|
2947 |
+
/**
|
2948 |
+
* @param $keywords
|
2949 |
+
*
|
2950 |
+
* @return string
|
2951 |
+
*/
|
2952 |
function get_unique_keywords( $keywords ) {
|
2953 |
return implode( ',', $this->clean_keyword_list( $keywords ) );
|
2954 |
}
|
2955 |
|
2956 |
+
/**
|
2957 |
+
* @param $keywords
|
2958 |
+
*
|
2959 |
+
* @return array
|
2960 |
+
*/
|
2961 |
function clean_keyword_list( $keywords ) {
|
2962 |
$small_keywords = array();
|
2963 |
if ( ! is_array( $keywords ) ) {
|
2972 |
return array_unique( $small_keywords );
|
2973 |
}
|
2974 |
|
2975 |
+
/**
|
2976 |
+
* @param $term_id
|
2977 |
+
* @param $new_term_id
|
2978 |
+
* @param string $term_taxonomy_id
|
2979 |
+
* @param string $taxonomy
|
2980 |
+
*/
|
2981 |
function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id = '', $taxonomy = '' ) {
|
2982 |
$terms = $this->get_all_term_data( $term_id );
|
2983 |
if ( ! empty( $terms ) ) {
|
2991 |
}
|
2992 |
}
|
2993 |
|
2994 |
+
/**
|
2995 |
+
* @param $term_id
|
2996 |
+
*
|
2997 |
+
* @return array
|
2998 |
+
*/
|
2999 |
function get_all_term_data( $term_id ) {
|
3000 |
+
$terms = array();
|
3001 |
+
$optlist = array(
|
3002 |
'keywords',
|
3003 |
'description',
|
3004 |
'title',
|
3011 |
'noodp',
|
3012 |
'noydir',
|
3013 |
'titleatr',
|
3014 |
+
'menulabel',
|
3015 |
);
|
3016 |
foreach ( $optlist as $f ) {
|
3017 |
$meta = get_term_meta( $term_id, '_aioseop_' . $f, true );
|
3028 |
wp_enqueue_style( 'wp-pointer' );
|
3029 |
$this->add_admin_pointers();
|
3030 |
|
|
|
3031 |
wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css' );
|
3032 |
?>
|
3033 |
<script>
|
3062 |
var admin_pointer;
|
3063 |
var admin_index;
|
3064 |
<?php
|
3065 |
+
foreach ( $this->pointers as $k => $p )
|
3066 |
+
{if ( ! empty( $p['pointer_scope'] ) && ( 'global' === $p['pointer_scope'] ) ) {
|
3067 |
?>admin_index = "<?php echo esc_attr( $k ); ?>";
|
3068 |
admin_pointer = <?php echo json_encode( $p ); ?>;
|
3069 |
aioseop_show_pointer(admin_index, admin_pointer);
|
3070 |
<?php
|
3071 |
+
}
|
3072 |
+
} ?>
|
3073 |
});
|
3074 |
}
|
3075 |
+
<?php } ?>
|
|
|
|
|
3076 |
</script>
|
3077 |
<?php
|
3078 |
}
|
3079 |
|
3080 |
function add_admin_pointers() {
|
3081 |
if ( AIOSEOPPRO ) {
|
3082 |
+
$this->pointers['aioseop_menu_236'] = array(
|
3083 |
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-pro-aioseop_class',
|
3084 |
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3085 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack Pro ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '</p>',
|
3086 |
'pointer_edge' => 'top',
|
3087 |
'pointer_align' => 'left',
|
3088 |
+
'pointer_scope' => 'global',
|
3089 |
);
|
3090 |
+
$this->pointers['aioseop_welcome_230'] = array(
|
3091 |
'pointer_target' => '#aioseop_top_button',
|
3092 |
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3093 |
. '</h3><p>' . __( 'New in 2.4: Improved support for taxonomies, Woocommerce and massive performance improvements under the hood! Please review your settings on each options page!', 'all-in-one-seo-pack' ) . '</p>',
|
3094 |
'pointer_edge' => 'bottom',
|
3095 |
'pointer_align' => 'left',
|
3096 |
+
'pointer_scope' => 'local',
|
3097 |
);
|
3098 |
$this->filter_pointers();
|
3099 |
} else {
|
3100 |
+
$this->pointers['aioseop_menu_220'] = array(
|
3101 |
'pointer_target' => '#toplevel_page_all-in-one-seo-pack-aioseop_class',
|
3102 |
'pointer_text' => '<h3>' . sprintf( __( 'Welcome to Version %s!', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3103 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! Please review your settings, as we\'re always adding new features for you!', 'all-in-one-seo-pack' ) . '</p>',
|
3104 |
'pointer_edge' => 'top',
|
3105 |
'pointer_align' => 'left',
|
3106 |
+
'pointer_scope' => 'global',
|
3107 |
);
|
3108 |
+
$this->pointers['aioseop_welcome_220'] = array(
|
3109 |
'pointer_target' => '#aioseop_top_button',
|
3110 |
'pointer_text' => '<h3>' . sprintf( __( 'Review Your Settings', 'all-in-one-seo-pack' ), AIOSEOP_VERSION )
|
3111 |
. '</h3><p>' . __( 'Thank you for running the latest and greatest All in One SEO Pack ever! New since 2.2: Control who accesses your site with the new Robots.txt Editor and File Editor modules! Enable them from the Feature Manager. Remember to review your settings, we have added some new ones!', 'all-in-one-seo-pack' ) . '</p>',
|
3112 |
'pointer_edge' => 'bottom',
|
3113 |
'pointer_align' => 'left',
|
3114 |
+
'pointer_scope' => 'local',
|
3115 |
);
|
3116 |
$this->filter_pointers();
|
3117 |
}
|
3125 |
$pt = array_keys( $post_objs );
|
3126 |
$rempost = array( 'revision', 'nav_menu_item' );
|
3127 |
$pt = array_diff( $pt, $rempost );
|
3128 |
+
$post_types = array();
|
3129 |
|
3130 |
$aiosp_enablecpost = '';
|
3131 |
if ( isset( $_REQUEST['aiosp_enablecpost'] ) ) {
|
3154 |
$tx = array_keys( $taxes );
|
3155 |
$remtax = array( 'nav_menu', 'link_category', 'post_format' );
|
3156 |
$tx = array_diff( $tx, $remtax );
|
3157 |
+
$tax_types = array();
|
3158 |
foreach ( $tx as $t ) {
|
3159 |
if ( ! empty( $taxes[ $t ]->label ) ) {
|
3160 |
$tax_types[ $t ] = $taxes[ $t ]->label;
|
3172 |
$this->default_options['taxactive']['initial_options'] = $tax_types;
|
3173 |
}
|
3174 |
$this->default_options['google_author_location']['initial_options'] = $post_types;
|
3175 |
+
$this->default_options['google_author_location']['initial_options'] = array_merge( array( 'front' => __( 'Front Page', 'all-in-one-seo-pack' ) ), $post_types, array( 'all' => __( 'Everywhere Else', 'all-in-one-seo-pack' ) ) );
|
3176 |
$this->default_options['google_author_location']['default'] = array_keys( $this->default_options['google_author_location']['initial_options'] );
|
3177 |
|
3178 |
foreach ( $post_types as $p => $pt ) {
|
3179 |
$field = $p . '_title_format';
|
3180 |
$name = $post_objs[ $p ]->labels->singular_name;
|
3181 |
if ( ! isset( $this->default_options[ $field ] ) ) {
|
3182 |
+
$this->default_options[ $field ] = array(
|
3183 |
'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
|
3184 |
'type' => 'text',
|
3185 |
'default' => '%post_title% | %blog_title%',
|
3186 |
+
'condshow' => array(
|
3187 |
'aiosp_rewrite_titles' => 1,
|
3188 |
'aiosp_enablecpost' => 'on',
|
3189 |
'aiosp_cpostadvanced' => 'on',
|
3190 |
'aiosp_cposttitles' => 'on',
|
3191 |
+
'aiosp_cpostactive\[\]' => $p,
|
3192 |
+
),
|
3193 |
);
|
3194 |
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' )
|
3195 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3231 |
$field = $p . '_tax_title_format';
|
3232 |
$name = $pt;
|
3233 |
if ( ! isset( $this->default_options[ $field ] ) ) {
|
3234 |
+
$this->default_options[ $field ] = array(
|
3235 |
'name' => "$name " . __( 'Taxonomy Title Format:', 'all-in-one-seo-pack' ),
|
3236 |
'type' => 'text',
|
3237 |
'default' => '%taxonomy_title% | %blog_title%',
|
3238 |
+
'condshow' => array(
|
3239 |
'aiosp_rewrite_titles' => 1,
|
3240 |
'aiosp_enablecpost' => 'on',
|
3241 |
'aiosp_cpostadvanced' => 'on',
|
3242 |
'aiosp_cposttitles' => 'on',
|
3243 |
+
'aiosp_taxactive\[\]' => $p,
|
3244 |
+
),
|
3245 |
);
|
3246 |
$this->help_text[ $field ] = __( 'The following macros are supported:', 'all-in-one-seo-pack' ) .
|
3247 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
3258 |
|
3259 |
if ( AIOSEOPPRO ) {
|
3260 |
global $aioseop_update_checker;
|
3261 |
+
add_action( "{$this->prefix}update_options", array(
|
3262 |
$aioseop_update_checker,
|
3263 |
+
'license_change_check',
|
3264 |
), 10, 2 );
|
3265 |
+
add_action( "{$this->prefix}settings_update", array( $aioseop_update_checker, 'update_check' ), 10, 2 );
|
3266 |
}
|
3267 |
|
3268 |
+
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
3269 |
parent::add_page_hooks();
|
3270 |
}
|
3271 |
|
3272 |
function settings_page_init() {
|
3273 |
+
add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) );
|
3274 |
}
|
3275 |
|
3276 |
function enqueue_scripts() {
|
3277 |
+
add_filter( "{$this->prefix}display_settings", array( $this, 'filter_settings' ), 10, 3 );
|
3278 |
+
add_filter( "{$this->prefix}display_options", array( $this, 'filter_options' ), 10, 2 );
|
3279 |
parent::enqueue_scripts();
|
3280 |
}
|
3281 |
|
3282 |
+
/**
|
3283 |
+
* @param $submit
|
3284 |
+
*
|
3285 |
+
* @return mixed
|
3286 |
+
*/
|
3287 |
function filter_submit( $submit ) {
|
3288 |
$submit['Submit_Default']['value'] = __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' »';
|
3289 |
+
$submit['Submit_All_Default'] = array(
|
3290 |
'type' => 'submit',
|
3291 |
'class' => 'button-secondary',
|
3292 |
+
'value' => __( 'Reset ALL Settings to Defaults', 'all-in-one-seo-pack' ) . ' »',
|
3293 |
);
|
3294 |
|
3295 |
return $submit;
|
3297 |
|
3298 |
/**
|
3299 |
* Handle resetting options to defaults, but preserve the license key if pro.
|
3300 |
+
*
|
3301 |
+
* @param null $location
|
3302 |
+
* @param bool $delete
|
3303 |
*/
|
3304 |
function reset_options( $location = null, $delete = false ) {
|
3305 |
if ( AIOSEOPPRO ) {
|
3317 |
$this->delete_class_option( $delete );
|
3318 |
|
3319 |
if ( AIOSEOPPRO ) {
|
3320 |
+
$this->options = array( 'aiosp_license_key' => $license_key );
|
3321 |
} else {
|
3322 |
+
$this->options = array();
|
3323 |
}
|
3324 |
}
|
3325 |
$default_options = $this->default_options( $location );
|
3339 |
$this->update_class_option( $this->options );
|
3340 |
}
|
3341 |
|
3342 |
+
/**
|
3343 |
+
* @param $settings
|
3344 |
+
* @param $location
|
3345 |
+
* @param $current
|
3346 |
+
*
|
3347 |
+
* @return mixed
|
3348 |
+
*/
|
3349 |
function filter_settings( $settings, $location, $current ) {
|
3350 |
if ( $location == null ) {
|
3351 |
$prefix = $this->prefix;
|
3352 |
|
3353 |
+
foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
|
3354 |
unset( $settings["{$prefix}$opt"] );
|
3355 |
}
|
3356 |
|
3368 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
3369 |
if ( ! empty( $post ) ) {
|
3370 |
$post_type = get_post_type( $post );
|
3371 |
+
if ( ! empty( $this->options['aiosp_cpostnoindex'] ) && in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) {
|
3372 |
$settings["{$prefix}noindex"]['type'] = 'select';
|
3373 |
+
$settings["{$prefix}noindex"]['initial_options'] = array(
|
3374 |
'' => __( 'Default - noindex', 'all-in-one-seo-pack' ),
|
3375 |
'off' => __( 'index', 'all-in-one-seo-pack' ),
|
3376 |
+
'on' => __( 'noindex', 'all-in-one-seo-pack' ),
|
3377 |
);
|
3378 |
}
|
3379 |
+
if ( ! empty( $this->options['aiosp_cpostnofollow'] ) && in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) {
|
3380 |
$settings["{$prefix}nofollow"]['type'] = 'select';
|
3381 |
+
$settings["{$prefix}nofollow"]['initial_options'] = array(
|
3382 |
'' => __( 'Default - nofollow', 'all-in-one-seo-pack' ),
|
3383 |
'off' => __( 'follow', 'all-in-one-seo-pack' ),
|
3384 |
+
'on' => __( 'nofollow', 'all-in-one-seo-pack' ),
|
3385 |
);
|
3386 |
}
|
3387 |
+
if ( ! empty( $this->options['aiosp_cpostnoodp'] ) && in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) {
|
3388 |
$settings["{$prefix}noodp"]['type'] = 'select';
|
3389 |
+
$settings["{$prefix}noodp"]['initial_options'] = array(
|
3390 |
'' => __( 'Default - noodp', 'all-in-one-seo-pack' ),
|
3391 |
'off' => __( 'odp', 'all-in-one-seo-pack' ),
|
3392 |
+
'on' => __( 'noodp', 'all-in-one-seo-pack' ),
|
3393 |
);
|
3394 |
}
|
3395 |
+
if ( ! empty( $this->options['aiosp_cpostnoydir'] ) && in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) {
|
3396 |
$settings["{$prefix}noydir"]['type'] = 'select';
|
3397 |
+
$settings["{$prefix}noydir"]['initial_options'] = array(
|
3398 |
'' => __( 'Default - noydir', 'all-in-one-seo-pack' ),
|
3399 |
'off' => __( 'ydir', 'all-in-one-seo-pack' ),
|
3400 |
+
'on' => __( 'noydir', 'all-in-one-seo-pack' ),
|
3401 |
);
|
3402 |
}
|
3403 |
global $post;
|
3429 |
} elseif ( ! empty( $current["{$prefix}togglekeywords"] ) ) {
|
3430 |
unset( $settings["{$prefix}keywords"] );
|
3431 |
}
|
3432 |
+
if ( empty( $this->options['aiosp_can'] ) || empty( $this->options['aiosp_customize_canonical_links'] ) ) {
|
3433 |
unset( $settings["{$prefix}custom_link"] );
|
3434 |
}
|
3435 |
}
|
3437 |
return $settings;
|
3438 |
}
|
3439 |
|
3440 |
+
/**
|
3441 |
+
* @param $options
|
3442 |
+
* @param $location
|
3443 |
+
*
|
3444 |
+
* @return mixed
|
3445 |
+
*/
|
3446 |
function filter_options( $options, $location ) {
|
3447 |
if ( $location == 'aiosp' ) {
|
3448 |
global $post;
|
3449 |
if ( ! empty( $post ) ) {
|
3450 |
$prefix = $this->prefix;
|
3451 |
$post_type = get_post_type( $post );
|
3452 |
+
foreach ( array( 'noindex', 'nofollow', 'noodp', 'noydir' ) as $no ) {
|
3453 |
if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
|
3454 |
if ( isset( $options["{$prefix}{$no}"] ) && ( $options["{$prefix}{$no}"] != 'on' ) ) {
|
3455 |
unset( $options["{$prefix}{$no}"] );
|
3463 |
if ( isset( $options["{$prefix}rewrite_titles"] ) && ( ! empty( $options["{$prefix}rewrite_titles"] ) ) ) {
|
3464 |
$options["{$prefix}rewrite_titles"] = 1;
|
3465 |
}
|
3466 |
+
if ( isset( $options["{$prefix}enablecpost"] ) && ( $options["{$prefix}enablecpost"] === '' ) ) {
|
3467 |
$options["{$prefix}enablecpost"] = 0;
|
3468 |
}
|
3469 |
+
if ( isset( $options["{$prefix}use_original_title"] ) && ( $options["{$prefix}use_original_title"] === '' ) ) {
|
3470 |
$options["{$prefix}use_original_title"] = 0;
|
3471 |
}
|
3472 |
}
|
3496 |
}
|
3497 |
}
|
3498 |
|
3499 |
+
/**
|
3500 |
+
* @return bool
|
3501 |
+
*/
|
3502 |
function is_page_included() {
|
3503 |
global $aioseop_options;
|
3504 |
if ( is_feed() ) {
|
3513 |
$post_type = $post->post_type;
|
3514 |
}
|
3515 |
if ( empty( $aioseop_options['aiosp_enablecpost'] ) ) {
|
3516 |
+
$wp_post_types = get_post_types( array( '_builtin' => true ) ); // Don't display meta if SEO isn't enabled on custom post types -- pdb.
|
3517 |
if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) {
|
3518 |
return false;
|
3519 |
}
|
3520 |
} else {
|
3521 |
$wp_post_types = $aioseop_options['aiosp_cpostactive'];
|
3522 |
if ( empty( $wp_post_types ) ) {
|
3523 |
+
$wp_post_types = array();
|
3524 |
}
|
3525 |
if ( AIOSEOPPRO ) {
|
3526 |
if ( is_tax() ) {
|
3548 |
}
|
3549 |
}
|
3550 |
|
3551 |
+
$this->meta_opts = $this->get_current_options( array(), 'aiosp' );
|
3552 |
|
3553 |
$aiosp_disable = $aiosp_disable_analytics = false;
|
3554 |
|
3579 |
return true;
|
3580 |
}
|
3581 |
|
3582 |
+
/**
|
3583 |
+
* @param $content
|
3584 |
+
*
|
3585 |
+
* @return mixed|string
|
3586 |
+
*/
|
3587 |
function output_callback_for_title( $content ) {
|
3588 |
return $this->rewrite_title( $content );
|
3589 |
}
|
3590 |
|
3591 |
+
/**
|
3592 |
+
* Used for forcing title rewrites.
|
3593 |
+
*
|
3594 |
+
* @param $header
|
3595 |
+
*
|
3596 |
+
* @return mixed|string
|
3597 |
+
*/
|
3598 |
function rewrite_title( $header ) {
|
3599 |
global $wp_query;
|
3600 |
if ( ! $wp_query ) {
|
3610 |
return $header;
|
3611 |
}
|
3612 |
|
3613 |
+
/**
|
3614 |
+
* @param $content
|
3615 |
+
* @param $title
|
3616 |
+
*
|
3617 |
+
* @return mixed
|
3618 |
+
*/
|
3619 |
function replace_title( $content, $title ) {
|
3620 |
+
// We can probably improve this... I'm not sure half of this is even being used.
|
3621 |
$title = trim( strip_tags( $title ) );
|
3622 |
$title_tag_start = '<title';
|
3623 |
$title_tag_end = '</title';
|
3633 |
function add_hooks() {
|
3634 |
global $aioseop_options, $aioseop_update_checker;
|
3635 |
|
3636 |
+
// MOVED TO MAIN PLUGIN FILE IN ORDER TO FIRE SOONS
|
3637 |
+
//$role = get_role( 'administrator' );
|
3638 |
+
//if ( is_object( $role ) ) {
|
3639 |
+
// $role->add_cap( 'aiosp_manage_seo' );
|
3640 |
+
//}
|
3641 |
|
3642 |
aioseop_update_settings_check();
|
3643 |
add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
|
3652 |
add_action( 'admin_init', 'aioseop_handle_ignore_notice' );
|
3653 |
if ( AIOSEOPPRO ) {
|
3654 |
if ( current_user_can( 'update_plugins' ) ) {
|
3655 |
+
add_action( 'admin_notices', array( $aioseop_update_checker, 'key_warning' ) );
|
3656 |
}
|
3657 |
+
add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array(
|
3658 |
$aioseop_update_checker,
|
3659 |
+
'add_plugin_row',
|
3660 |
) );
|
3661 |
}
|
3662 |
} else {
|
3663 |
if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
|
3664 |
remove_action( 'wp_head', 'rel_canonical' );
|
3665 |
}
|
3666 |
+
// Analytics.
|
3667 |
if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
|
3668 |
add_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
|
3669 |
}
|
3719 |
}
|
3720 |
}
|
3721 |
|
3722 |
+
/**
|
3723 |
+
* @param $description
|
3724 |
+
*
|
3725 |
+
* @return string
|
3726 |
+
*/
|
3727 |
function make_unique_att_desc( $description ) {
|
3728 |
global $wp_query;
|
3729 |
if ( is_attachment() ) {
|
3730 |
|
3731 |
$url = $this->aiosp_mrt_get_url( $wp_query );
|
3732 |
if ( $url ) {
|
3733 |
+
$matches = array();
|
3734 |
preg_match_all( '/(\d+)/', $url, $matches );
|
3735 |
if ( is_array( $matches ) ) {
|
3736 |
$uniqueDesc = join( '', $matches[0] );
|
3737 |
}
|
3738 |
}
|
3739 |
$description .= ' ' . $uniqueDesc;
|
|
|
|
|
3740 |
}
|
3741 |
+
|
3742 |
+
return $description;
|
3743 |
}
|
3744 |
|
3745 |
function wp_head() {
|
3762 |
}
|
3763 |
$meta_string = null;
|
3764 |
$description = '';
|
3765 |
+
// Logging - rewrite handler check for output buffering.
|
3766 |
$this->check_rewrite_handler();
|
3767 |
if ( AIOSEOPPRO ) {
|
3768 |
echo "\n<!-- All in One SEO Pack Pro $this->version by Michael Torbert of Semper Fi Web Design";
|
3781 |
$save_posts = $posts;
|
3782 |
if ( function_exists( 'woocommerce_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = woocommerce_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
|
3783 |
global $posts;
|
3784 |
+
$opts = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
|
3785 |
+
$posts = array();
|
3786 |
$posts[] = $post;
|
3787 |
}
|
3788 |
$posts = $save_posts;
|
3789 |
+
$description = apply_filters( 'aioseop_description', $this->get_main_description( $post ) ); // Get the description.
|
3790 |
+
// Handle the description format.
|
3791 |
if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) {
|
3792 |
$description = $this->trim_description( $description );
|
3793 |
if ( ! isset( $meta_string ) ) {
|
3794 |
$meta_string = '';
|
3795 |
}
|
3796 |
+
// Description format.
|
3797 |
$description = apply_filters( 'aioseop_description_full', $this->apply_description_format( $description, $post ) );
|
3798 |
$desc_attr = '';
|
3799 |
if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
|
3802 |
$desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr );
|
3803 |
$meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
|
3804 |
}
|
3805 |
+
// Get the keywords.
|
3806 |
$togglekeywords = 0;
|
3807 |
if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
|
3808 |
$togglekeywords = $aioseop_options['aiosp_togglekeywords'];
|
3825 |
$meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
|
3826 |
}
|
3827 |
}
|
3828 |
+
// Handle noindex, nofollow - robots meta.
|
3829 |
$robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
|
3830 |
if ( ! empty( $robots_meta ) ) {
|
3831 |
$meta_string .= '<meta name="robots" content="' . esc_attr( $robots_meta ) . '" />' . "\n";
|
3832 |
}
|
3833 |
+
// Handle site verification.
|
3834 |
if ( is_front_page() ) {
|
3835 |
foreach (
|
3836 |
+
array(
|
3837 |
'google' => 'google-site-verification',
|
3838 |
'bing' => 'msvalidate.01',
|
3839 |
+
'pinterest' => 'p:domain_verify',
|
3840 |
) as $k => $v
|
3841 |
) {
|
3842 |
if ( ! empty( $aioseop_options["aiosp_{$k}_verify"] ) ) {
|
3844 |
}
|
3845 |
}
|
3846 |
|
3847 |
+
// Sitelinks search.
|
3848 |
if ( ! empty( $aioseop_options['aiosp_google_sitelinks_search'] ) || ! empty( $aioseop_options['aiosp_google_set_site_name'] ) ) {
|
3849 |
$meta_string .= $this->sitelinks_search_box() . "\n";
|
3850 |
}
|
3851 |
}
|
3852 |
+
// Handle extra meta fields.
|
3853 |
+
foreach ( array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
|
3854 |
if ( ! empty( $aioseop_options["aiosp_{$meta}_tags"] ) ) {
|
3855 |
$$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags"] ), ENT_QUOTES );
|
3856 |
} else {
|
3869 |
}
|
3870 |
$meta_string .= $post_meta;
|
3871 |
}
|
3872 |
+
// Handle authorship.
|
3873 |
$authorship = $this->get_google_authorship( $post );
|
3874 |
$publisher = apply_filters( 'aioseop_google_publisher', $authorship['publisher'] );
|
3875 |
if ( ! empty( $publisher ) ) {
|
3906 |
echo "$meta_string\n";
|
3907 |
}
|
3908 |
|
3909 |
+
// Handle canonical links.
|
3910 |
$show_page = true;
|
3911 |
if ( ! empty( $aioseop_options['aiosp_no_paged_canonical_links'] ) ) {
|
3912 |
$show_page = false;
|
3936 |
}
|
3937 |
}
|
3938 |
|
3939 |
+
/**
|
3940 |
+
* Check rewrite handler.
|
3941 |
+
*/
|
3942 |
function check_rewrite_handler() {
|
3943 |
global $aioseop_options;
|
3944 |
|
3948 |
}
|
3949 |
|
3950 |
if ( ! empty( $aioseop_options['aiosp_rewrite_titles'] ) && $force_rewrites ) {
|
3951 |
+
// Make the title rewrite as short as possible.
|
3952 |
if ( function_exists( 'ob_list_handlers' ) ) {
|
3953 |
$active_handlers = ob_list_handlers();
|
3954 |
} else {
|
3961 |
ob_end_flush();
|
3962 |
} else {
|
3963 |
$this->log( 'another plugin interfering?' );
|
3964 |
+
// If we get here there *could* be trouble with another plugin :(.
|
3965 |
$this->ob_start_detected = true;
|
3966 |
+
if ( $this->option_isset( 'rewrite_titles' ) ) { // Try alternate method -- pdb.
|
3967 |
$aioseop_options['aiosp_rewrite_titles'] = 0;
|
3968 |
$force_rewrites = 0;
|
3969 |
add_filter( 'wp_title', array( $this, 'wp_title' ), 20 );
|
3977 |
}
|
3978 |
}
|
3979 |
|
3980 |
+
/**
|
3981 |
+
* @param $description
|
3982 |
+
*
|
3983 |
+
* @return mixed|string
|
3984 |
+
*/
|
3985 |
function trim_description( $description ) {
|
3986 |
$description = trim( wp_strip_all_tags( $description ) );
|
3987 |
$description = str_replace( '"', '"', $description );
|
3991 |
return $description;
|
3992 |
}
|
3993 |
|
3994 |
+
/**
|
3995 |
+
* @param $description
|
3996 |
+
* @param null $post
|
3997 |
+
*
|
3998 |
+
* @return mixed
|
3999 |
+
*/
|
4000 |
function apply_description_format( $description, $post = null ) {
|
4001 |
global $aioseop_options;
|
4002 |
$description_format = $aioseop_options['aiosp_description_format'];
|
4026 |
return $description;
|
4027 |
}
|
4028 |
|
4029 |
+
/**
|
4030 |
+
* @return string
|
4031 |
+
*/
|
4032 |
function get_robots_meta() {
|
4033 |
global $aioseop_options;
|
4034 |
$opts = $this->meta_opts;
|
4039 |
}
|
4040 |
|
4041 |
if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
|
4042 |
+
$tax_noindex = array();
|
4043 |
}
|
4044 |
|
4045 |
$aiosp_noindex = $aiosp_nofollow = $aiosp_noodp = $aiosp_noydir = '';
|
4053 |
|| ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
|
4054 |
) {
|
4055 |
$noindex = 'noindex';
|
4056 |
+
} elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
|
4057 |
$post_type = get_post_type();
|
4058 |
if ( ! empty( $opts ) ) {
|
4059 |
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
|
4065 |
|| ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_cpostnoodp'] ) || ! empty( $aioseop_options['aiosp_cpostnoydir'] )
|
4066 |
|| ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
|
4067 |
) {
|
4068 |
+
if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
|
4069 |
+
( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
|
4070 |
) {
|
4071 |
$noindex = 'noindex';
|
4072 |
}
|
4073 |
+
if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
|
4074 |
+
( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
|
4075 |
) {
|
4076 |
$nofollow = 'nofollow';
|
4077 |
}
|
4078 |
+
if ( ( $aiosp_noodp == 'on' ) || ( empty( $aiosp_noodp ) && ( ! empty( $aioseop_options['aiosp_cpostnoodp'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoodp'] ) ) ) ) {
|
4079 |
$aiosp_noodp = true;
|
4080 |
} else {
|
4081 |
$aiosp_noodp = false;
|
4082 |
}
|
4083 |
+
if ( ( $aiosp_noydir == 'on' ) || ( empty( $aiosp_noydir ) && ( ! empty( $aioseop_options['aiosp_cpostnoydir'] ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoydir'] ) ) ) ) {
|
4084 |
$aiosp_noydir = true;
|
4085 |
} else {
|
4086 |
$aiosp_noydir = false;
|
4107 |
return $robots_meta;
|
4108 |
}
|
4109 |
|
4110 |
+
/**
|
4111 |
+
* @return mixed|void
|
4112 |
+
*/
|
4113 |
function sitelinks_search_box() {
|
4114 |
global $aioseop_options;
|
4115 |
$home_url = esc_url( get_home_url() );
|
4157 |
return apply_filters( 'aiosp_sitelinks_search_box', $search_box );
|
4158 |
}
|
4159 |
|
4160 |
+
/**
|
4161 |
+
* @param $post
|
4162 |
+
*
|
4163 |
+
* @return array
|
4164 |
+
*/
|
4165 |
function get_google_authorship( $post ) {
|
4166 |
global $aioseop_options;
|
4167 |
$page = $this->get_page_number();
|
4168 |
+
// Handle authorship.
|
4169 |
$googleplus = $publisher = $author = '';
|
4170 |
|
4171 |
if ( ! empty( $post ) && isset( $post->post_author ) && empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
4176 |
$googleplus = $aioseop_options['aiosp_google_publisher'];
|
4177 |
}
|
4178 |
|
4179 |
+
if ( is_front_page() && ( $page < 2 ) ) {
|
4180 |
if ( ! empty( $aioseop_options['aiosp_google_publisher'] ) ) {
|
4181 |
$publisher = $aioseop_options['aiosp_google_publisher'];
|
4182 |
}
|
4197 |
|
4198 |
if ( ! empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4199 |
if ( empty( $aioseop_options['aiosp_google_author_location'] ) ) {
|
4200 |
+
$aioseop_options['aiosp_google_author_location'] = array();
|
4201 |
}
|
4202 |
if ( is_front_page() && ! in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
|
4203 |
$author = '';
|
4214 |
}
|
4215 |
}
|
4216 |
|
4217 |
+
return array( 'publisher' => $publisher, 'author' => $author );
|
4218 |
}
|
4219 |
|
4220 |
+
/**
|
4221 |
+
* @param null $post
|
4222 |
+
*
|
4223 |
+
* @return array
|
4224 |
+
*/
|
4225 |
function get_prev_next_links( $post = null ) {
|
4226 |
$prev = $next = '';
|
4227 |
$page = $this->get_page_number();
|
4287 |
}
|
4288 |
}
|
4289 |
|
4290 |
+
return array( 'prev' => $prev, 'next' => $next );
|
4291 |
}
|
4292 |
|
4293 |
/**
|
4304 |
*/
|
4305 |
function validate_url_scheme( $url ) {
|
4306 |
|
4307 |
+
// TODO we should check for the site setting in the case of auto.
|
4308 |
|
4309 |
global $aioseop_options;
|
4310 |
|
4311 |
+
if( ! isset( $aioseop_options['aiosp_can_set_protocol'] ) ){
|
4312 |
+
return $url; // Just send the url back if there's nothing there.
|
4313 |
+
}
|
4314 |
+
|
4315 |
if ( $aioseop_options['aiosp_can_set_protocol'] == 'http' ) {
|
4316 |
$url = preg_replace( '/^https:/i', 'http:', $url );
|
4317 |
}
|
4322 |
return $url;
|
4323 |
}
|
4324 |
|
4325 |
+
/**
|
4326 |
+
* @param $options
|
4327 |
+
* @param $location
|
4328 |
+
* @param $settings
|
4329 |
+
*
|
4330 |
+
* @return mixed
|
4331 |
+
*/
|
4332 |
function override_options( $options, $location, $settings ) {
|
4333 |
if ( class_exists( 'DOMDocument' ) ) {
|
4334 |
$options['aiosp_google_connect'] = $settings['aiosp_google_connect']['default'];
|
4470 |
$analytics = ob_get_clean();
|
4471 |
}
|
4472 |
echo apply_filters( 'aiosp_google_analytics', $analytics );
|
4473 |
+
do_action( 'after_aiosp_google_analytics' );
|
4474 |
}
|
4475 |
|
4476 |
+
/**
|
4477 |
+
* @return string
|
4478 |
+
*/
|
4479 |
function universal_analytics() {
|
4480 |
global $aioseop_options;
|
4481 |
$analytics = '';
|
4538 |
}
|
4539 |
$extra_options .= "ga('set', 'anonymizeIp', true);";
|
4540 |
}
|
4541 |
+
$js_options = array();
|
4542 |
+
foreach ( array( 'cookie_domain', 'allow_linker' ) as $opts ) {
|
4543 |
if ( ! empty( $$opts ) ) {
|
4544 |
$js_options[] = $$opts;
|
4545 |
}
|
4569 |
return $analytics;
|
4570 |
}
|
4571 |
|
4572 |
+
/**
|
4573 |
+
* @return mixed|string
|
4574 |
+
*/
|
4575 |
function get_analytics_domain() {
|
4576 |
global $aioseop_options;
|
4577 |
if ( ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
|
4581 |
return '';
|
4582 |
}
|
4583 |
|
4584 |
+
/**
|
4585 |
+
* @param $id
|
4586 |
+
*
|
4587 |
+
* @return bool
|
4588 |
+
*/
|
4589 |
function save_post_data( $id ) {
|
4590 |
$awmp_edit = $nonce = null;
|
4591 |
if ( empty( $_POST ) ) {
|
4600 |
|
4601 |
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4602 |
|
4603 |
+
$optlist = array(
|
4604 |
'keywords',
|
4605 |
'description',
|
4606 |
'title',
|
4613 |
'noodp',
|
4614 |
'noydir',
|
4615 |
'titleatr',
|
4616 |
+
'menulabel',
|
4617 |
);
|
4618 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4619 |
unset( $optlist['custom_link'] );
|
4625 |
}
|
4626 |
}
|
4627 |
|
4628 |
+
$optlist = array(
|
4629 |
'keywords',
|
4630 |
'description',
|
4631 |
'title',
|
4635 |
'noodp',
|
4636 |
'noydir',
|
4637 |
'titleatr',
|
4638 |
+
'menulabel',
|
4639 |
);
|
4640 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4641 |
unset( $optlist['custom_link'] );
|
4669 |
}
|
4670 |
}
|
4671 |
|
4672 |
+
/**
|
4673 |
+
* @param $post
|
4674 |
+
* @param $metabox
|
4675 |
+
*/
|
4676 |
function display_tabbed_metabox( $post, $metabox ) {
|
4677 |
$tabs = $metabox['args'];
|
4678 |
echo '<div class="aioseop_tabs">';
|
4691 |
echo '</div>';
|
4692 |
}
|
4693 |
|
4694 |
+
/**
|
4695 |
+
* @param $tabs
|
4696 |
+
*
|
4697 |
+
* @return string
|
4698 |
+
*/
|
4699 |
function get_metabox_header( $tabs ) {
|
4700 |
$header = '<ul class="aioseop_header_tabs hide">';
|
4701 |
$active = ' active';
|
4738 |
$wp_admin_bar->add_menu( array(
|
4739 |
'id' => AIOSEOP_PLUGIN_DIRNAME,
|
4740 |
'title' => __( 'SEO', 'all-in-one-seo-pack' ),
|
4741 |
+
'href' => $url,
|
4742 |
) );
|
4743 |
|
4744 |
if ( current_user_can( 'update_plugins' ) && ! AIOSEOPPRO ) {
|
4747 |
'title' => __( 'Upgrade To Pro', 'all-in-one-seo-pack' ),
|
4748 |
'id' => 'aioseop-pro-upgrade',
|
4749 |
'href' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=menu',
|
4750 |
+
'meta' => array( 'target' => '_blank' ),
|
4751 |
) );
|
4752 |
+
// add_action( 'admin_bar_menu', array( $this, 'admin_bar_upgrade_menu' ), 1101 );
|
4753 |
}
|
4754 |
|
4755 |
$aioseop_admin_menu = 1;
|
4762 |
'id' => 'aiosp_edit_' . $post->ID,
|
4763 |
'parent' => AIOSEOP_PLUGIN_DIRNAME,
|
4764 |
'title' => __( 'Edit SEO', 'all-in-one-seo-pack' ),
|
4765 |
+
'href' => get_edit_post_link( $post->ID ) . '#aiosp',
|
4766 |
) );
|
4767 |
}
|
4768 |
}
|
4769 |
}
|
4770 |
|
4771 |
+
/**
|
4772 |
+
* Order for adding the menus for the aioseop_modules_add_menus hook.
|
4773 |
+
*/
|
4774 |
function menu_order() {
|
4775 |
return 5;
|
4776 |
}
|
4777 |
|
4778 |
+
/**
|
4779 |
+
* @param $tax
|
4780 |
+
*/
|
4781 |
function display_category_metaboxes( $tax ) {
|
4782 |
$screen = 'edit-' . $tax->taxonomy;
|
4783 |
?>
|
4784 |
<div id="poststuff">
|
4785 |
+
<?php do_meta_boxes( '', 'advanced', $tax ); ?>
|
4786 |
</div>
|
4787 |
<?php
|
4788 |
}
|
4789 |
|
4790 |
+
/**
|
4791 |
+
* @param $id
|
4792 |
+
*/
|
4793 |
function save_category_metaboxes( $id ) {
|
4794 |
$awmp_edit = $nonce = null;
|
4795 |
if ( isset( $_POST['aiosp_edit'] ) ) {
|
4800 |
}
|
4801 |
|
4802 |
if ( isset( $awmp_edit ) && ! empty( $awmp_edit ) && wp_verify_nonce( $nonce, 'edit-aioseop-nonce' ) ) {
|
4803 |
+
$optlist = array(
|
4804 |
'keywords',
|
4805 |
'description',
|
4806 |
'title',
|
4813 |
'noodp',
|
4814 |
'noydir',
|
4815 |
'titleatr',
|
4816 |
+
'menulabel',
|
4817 |
);
|
4818 |
foreach ( $optlist as $f ) {
|
4819 |
$field = "aiosp_$f";
|
4822 |
}
|
4823 |
}
|
4824 |
|
4825 |
+
$optlist = array(
|
4826 |
'keywords',
|
4827 |
'description',
|
4828 |
'title',
|
4832 |
'noodp',
|
4833 |
'noydir',
|
4834 |
'titleatr',
|
4835 |
+
'menulabel',
|
4836 |
);
|
4837 |
if ( ! ( ! empty( $this->options['aiosp_can'] ) ) && ( ! empty( $this->options['aiosp_customize_canonical_links'] ) ) ) {
|
4838 |
unset( $optlist['custom_link'] );
|
4890 |
}
|
4891 |
|
4892 |
$donated = false;
|
4893 |
+
if ( isset( $_POST ) && isset( $_POST['module'] ) && isset( $_POST['nonce-aioseop'] ) && ( $_POST['module'] == 'All_in_One_SEO_Pack' ) && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
4894 |
if ( isset( $_POST['aiosp_donate'] ) ) {
|
4895 |
$donated = $_POST['aiosp_donate'];
|
4896 |
}
|
4900 |
} else {
|
4901 |
$custom_menu_order = false;
|
4902 |
}
|
4903 |
+
} else if ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) ) {
|
4904 |
$custom_menu_order = true;
|
4905 |
}
|
4906 |
} else {
|
4918 |
}
|
4919 |
|
4920 |
if ( $donated ) {
|
4921 |
+
// Thank you for your donation.
|
4922 |
+
$this->pointers['aioseop_donate'] = array(
|
4923 |
'pointer_target' => '#aiosp_donate_wrapper',
|
4924 |
'pointer_text' => '<h3>' . __( 'Thank you!', 'all-in-one-seo-pack' )
|
4925 |
+
. '</h3><p>' . __( 'Thank you for your donation, it helps keep this plugin free and actively developed!', 'all-in-one-seo-pack' ) . '</p>',
|
4926 |
);
|
4927 |
}
|
4928 |
|
4944 |
if ( ! empty( $this->options['aiosp_taxactive'] ) ) {
|
4945 |
foreach ( $this->options['aiosp_taxactive'] as $tax ) {
|
4946 |
$this->locations['aiosp']['display'][] = 'edit-' . $tax;
|
4947 |
+
add_action( "{$tax}_edit_form", array( $this, 'display_category_metaboxes' ) );
|
4948 |
+
add_action( "edited_{$tax}", array( $this, 'save_category_metaboxes' ) );
|
4949 |
}
|
4950 |
}
|
4951 |
} else {
|
4952 |
if ( ! empty( $this->options['aiosp_cpostactive'] ) ) {
|
4953 |
$this->locations['aiosp']['display'] = $this->options['aiosp_cpostactive'];
|
4954 |
} else {
|
4955 |
+
$this->locations['aiosp']['display'] = array();
|
4956 |
}
|
4957 |
}
|
4958 |
} else {
|
4959 |
+
$this->locations['aiosp']['display'] = array( 'post', 'page' );
|
4960 |
}
|
4961 |
|
4962 |
|
4963 |
+
add_menu_page( $menu_name, $menu_name, apply_filters( 'manage_aiosp', 'aiosp_manage_seo' ), $file, array(
|
4964 |
$this,
|
4965 |
+
'display_settings_page',
|
4966 |
) );
|
4967 |
|
4968 |
add_meta_box( 'aioseop-list', __( 'Join Our Mailing List', 'all-in-one-seo-pack' ), array(
|
4969 |
'aiosp_metaboxes',
|
4970 |
+
'display_extra_metaboxes',
|
4971 |
), 'aioseop_metaboxes', 'normal', 'core' );
|
4972 |
if ( AIOSEOPPRO ) {
|
4973 |
add_meta_box( 'aioseop-about', __( 'About', 'all-in-one-seo-pack' ), array(
|
4974 |
'aiosp_metaboxes',
|
4975 |
+
'display_extra_metaboxes',
|
4976 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4977 |
} else {
|
4978 |
add_meta_box( 'aioseop-about', "About <span class='Taha' style='float:right;'>Version <b>" . AIOSEOP_VERSION . '</b></span>', array(
|
4979 |
'aiosp_metaboxes',
|
4980 |
+
'display_extra_metaboxes',
|
4981 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4982 |
}
|
4983 |
add_meta_box( 'aioseop-support', __( 'Support', 'all-in-one-seo-pack' ) . " <span class='Taha' style='float:right;'>" . __( 'Version', 'all-in-one-seo-pack' ) . ' <b>' . AIOSEOP_VERSION . '</b></span>', array(
|
4984 |
'aiosp_metaboxes',
|
4985 |
+
'display_extra_metaboxes',
|
4986 |
), 'aioseop_metaboxes', 'side', 'core' );
|
4987 |
|
4988 |
+
add_action( 'aioseop_modules_add_menus', array( $this, 'add_menu' ), 5 );
|
4989 |
do_action( 'aioseop_modules_add_menus', $file );
|
4990 |
|
4991 |
+
$metaboxes = apply_filters( 'aioseop_add_post_metabox', array() );
|
4992 |
|
4993 |
if ( ! empty( $metaboxes ) ) {
|
4994 |
if ( $this->tabbed_metaboxes ) {
|
4995 |
+
$tabs = array();
|
4996 |
$tab_num = 0;
|
4997 |
foreach ( $metaboxes as $m ) {
|
4998 |
if ( ! isset( $tabs[ $m['post_type'] ] ) ) {
|
4999 |
+
$tabs[ $m['post_type'] ] = array();
|
5000 |
}
|
5001 |
$tabs[ $m['post_type'] ][] = $m;
|
5002 |
}
|
5014 |
}
|
5015 |
add_meta_box( $m[0]['id'], $title, $m[0]['callback'], $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m[0]['callback_args'] );
|
5016 |
} elseif ( $tab_num > 1 ) {
|
5017 |
+
add_meta_box( $m[0]['id'] . '_tabbed', $title, array(
|
5018 |
$this,
|
5019 |
+
'display_tabbed_metabox',
|
5020 |
), $m[0]['post_type'], $m[0]['context'], $m[0]['priority'], $m );
|
5021 |
}
|
5022 |
}
|
5036 |
}
|
5037 |
}
|
5038 |
|
5039 |
+
/**
|
5040 |
+
* @param $menu_order
|
5041 |
+
*
|
5042 |
+
* @return array
|
5043 |
+
*/
|
5044 |
function set_menu_order( $menu_order ) {
|
5045 |
$order = array();
|
5046 |
$file = plugin_basename( __FILE__ );
|
5077 |
?>
|
5078 |
<div class="aioseop_top">
|
5079 |
<div class="aioseop_top_sidebar aioseop_options_wrapper">
|
5080 |
+
<?php do_meta_boxes( 'aioseop_metaboxes', 'normal', array( 'test' ) ); ?>
|
5081 |
</div>
|
5082 |
</div>
|
5083 |
<style>
|
5089 |
|
5090 |
<div class="aioseop_sidebar">
|
5091 |
<?php
|
5092 |
+
do_meta_boxes( 'aioseop_metaboxes', 'side', array( 'test' ) );
|
5093 |
?>
|
5094 |
<script type="text/javascript">
|
5095 |
//<![CDATA[
|
5096 |
jQuery(document).ready(function ($) {
|
5097 |
+
// Close postboxes that should be closed.
|
5098 |
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
5099 |
+
// Postboxes setup.
|
5100 |
if (typeof postboxes !== 'undefined')
|
5101 |
postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
|
5102 |
});
|
5109 |
if ( $adid == 23 ) { ?>
|
5110 |
<div
|
5111 |
style="height: 220px; background-image: url('https://www.wincher.com/Content/Images/plugin/wp/banner30.jpg')">
|
5112 |
+
<form style="position: relative; top: 170px; left: 40px;"
|
5113 |
+
action="https://www.wincher.com/FastReg" method="post" target="_blank">
|
5114 |
+
<input type="hidden" name="adreferer" value="banner<?php echo $adid; ?>"/>
|
5115 |
+
<input type="hidden" name="referer" value="all-in-one-seo-pack"/>
|
5116 |
+
<input type="text" name="email" placeholder="Email"
|
5117 |
+
style="padding-left: 7px; height: 30px; width: 290px; border: solid 1px #DDD;"/>
|
5118 |
+
<input type="submit" name="sub" value="Sign up!"
|
5119 |
+
style="height: 30px; width: 90px; background-color: #42DA76; color: #FFF; font-weight: bold; border:none; margin-left:5px;"/>
|
5120 |
+
</form>
|
5121 |
+
</div>
|
5122 |
<?
|
5123 |
} else {
|
5124 |
?>
|
5129 |
</a>
|
5130 |
<?php } ?>
|
5131 |
</div>
|
|
|
5132 |
<div class="aioseop_advert headwaythemes">
|
5133 |
<div>
|
5134 |
<h3>Drag and Drop WordPress Design</h3>
|
aioseop_init.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
all_in_one_seo_pack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: http://semperfiwebdesign.com
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
|
6 |
-
Version: 2.3.
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
Text Domain: all-in-one-seo-pack
|
@@ -11,7 +11,7 @@ Domain Path: /i18n/
|
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
-
Copyright (C) 2007-2016 Michael Torbert, semperfiwebdesign.com
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
@@ -28,24 +28,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
28 |
*/
|
29 |
|
30 |
/**
|
|
|
|
|
|
|
31 |
* @package All-in-One-SEO-Pack
|
32 |
-
* @version 2.3.
|
33 |
*/
|
34 |
|
35 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
36 |
define( 'AIOSEOPPRO', false );
|
37 |
}
|
38 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
39 |
-
define( 'AIOSEOP_VERSION', '2.3.
|
40 |
}
|
41 |
global $aioseop_plugin_name;
|
42 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
43 |
|
44 |
-
|
45 |
-
*
|
46 |
-
|
47 |
-
*
|
48 |
-
*******/
|
49 |
|
50 |
if ( ! defined( 'ABSPATH' ) ) {
|
51 |
return;
|
@@ -57,18 +58,33 @@ if ( AIOSEOPPRO ) {
|
|
57 |
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
|
61 |
define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
|
62 |
}
|
63 |
|
64 |
-
//register_activation_hook(__FILE__,'aioseop_activate_pl')
|
65 |
-
|
66 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
67 |
define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
68 |
} elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) {
|
69 |
|
70 |
-
//this is not a great message
|
71 |
/*
|
|
|
72 |
add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
|
73 |
__( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
|
74 |
$aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
|
@@ -222,10 +238,10 @@ if ( AIOSEOPPRO ) {
|
|
222 |
|
223 |
|
224 |
if ( ! function_exists( 'aioseop_activate' ) ) {
|
|
|
225 |
function aioseop_activate() {
|
226 |
|
227 |
//Check if we just got activated.
|
228 |
-
|
229 |
global $aiosp_activation;
|
230 |
if ( AIOSEOPPRO ) {
|
231 |
global $aioseop_update_checker;
|
@@ -315,7 +331,7 @@ if ( ! function_exists( 'aiosp_add_action_links' ) ) {
|
|
315 |
$action_links['proupgrade'] =
|
316 |
array(
|
317 |
'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ),
|
318 |
-
'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins'
|
319 |
|
320 |
);
|
321 |
}
|
@@ -353,6 +369,7 @@ if ( ! function_exists( 'aiosp_action_links' ) ) {
|
|
353 |
}
|
354 |
}
|
355 |
|
|
|
356 |
if ( ! function_exists( 'aioseop_init_class' ) ) {
|
357 |
function aioseop_init_class() {
|
358 |
global $aiosp;
|
@@ -367,6 +384,8 @@ if ( ! function_exists( 'aioseop_init_class' ) ) {
|
|
367 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
|
368 |
require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
|
369 |
require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
|
|
|
|
|
370 |
|
371 |
if ( AIOSEOPPRO ) {
|
372 |
require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
|
@@ -437,7 +456,7 @@ if ( ! function_exists( 'aioseop_scan_post_header' ) ) {
|
|
437 |
}
|
438 |
}
|
439 |
|
440 |
-
require_once( AIOSEOP_PLUGIN_DIR . '
|
441 |
|
442 |
if ( ! function_exists( 'aioseop_install' ) ) {
|
443 |
register_activation_hook( __FILE__, 'aioseop_install' );
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: http://semperfiwebdesign.com
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. Almost 30 million downloads since 2007.
|
6 |
+
Version: 2.3.8
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
Text Domain: all-in-one-seo-pack
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
Copyright (C) 2007-2016 Michael Torbert, https://semperfiwebdesign.com
|
15 |
|
16 |
This program is free software; you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
28 |
*/
|
29 |
|
30 |
/**
|
31 |
+
* All in One SEO Pack.
|
32 |
+
* The original WordPress SEO plugin.
|
33 |
+
*
|
34 |
* @package All-in-One-SEO-Pack
|
35 |
+
* @version 2.3.8
|
36 |
*/
|
37 |
|
38 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
39 |
define( 'AIOSEOPPRO', false );
|
40 |
}
|
41 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
42 |
+
define( 'AIOSEOP_VERSION', '2.3.8' );
|
43 |
}
|
44 |
global $aioseop_plugin_name;
|
45 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
46 |
|
47 |
+
/*
|
48 |
+
* DO NOT EDIT BELOW THIS LINE.
|
49 |
+
*/
|
|
|
|
|
50 |
|
51 |
if ( ! defined( 'ABSPATH' ) ) {
|
52 |
return;
|
58 |
|
59 |
}
|
60 |
|
61 |
+
if ( ! function_exists( 'aiosp_add_cap' ) ) {
|
62 |
+
|
63 |
+
function aiosp_add_cap() {
|
64 |
+
/*
|
65 |
+
TODO we should put this into an install script. We just need to make sure it runs soon enough and we need to make
|
66 |
+
sure people updating from previous versions have access to it.
|
67 |
+
*/
|
68 |
+
|
69 |
+
$role = get_role( 'administrator' );
|
70 |
+
if ( is_object( $role ) ) {
|
71 |
+
$role->add_cap( 'aiosp_manage_seo' );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
add_action( 'plugins_loaded', 'aiosp_add_cap' );
|
76 |
+
|
77 |
if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
|
78 |
define( 'AIOSEOP_PLUGIN_NAME', $aioseop_plugin_name );
|
79 |
}
|
80 |
|
81 |
+
// Do we need this? register_activation_hook(__FILE__,'aioseop_activate_pl');.
|
|
|
82 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
83 |
define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
84 |
} elseif ( AIOSEOP_PLUGIN_DIR !== plugin_dir_path( __FILE__ ) ) {
|
85 |
|
|
|
86 |
/*
|
87 |
+
This is not a great message.
|
88 |
add_action( 'admin_notices', create_function( '', 'echo "' . "<div class='error'>" . sprintf(
|
89 |
__( "%s detected a conflict; please deactivate the plugin located in %s.", 'all-in-one-seo-pack' ),
|
90 |
$aioseop_plugin_name, AIOSEOP_PLUGIN_DIR ) . "</div>" . '";' ) );
|
238 |
|
239 |
|
240 |
if ( ! function_exists( 'aioseop_activate' ) ) {
|
241 |
+
|
242 |
function aioseop_activate() {
|
243 |
|
244 |
//Check if we just got activated.
|
|
|
245 |
global $aiosp_activation;
|
246 |
if ( AIOSEOPPRO ) {
|
247 |
global $aioseop_update_checker;
|
331 |
$action_links['proupgrade'] =
|
332 |
array(
|
333 |
'label' => __( 'Upgrade to Pro', 'all-in-one-seo-pack' ),
|
334 |
+
'url' => 'http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins',
|
335 |
|
336 |
);
|
337 |
}
|
369 |
}
|
370 |
}
|
371 |
|
372 |
+
|
373 |
if ( ! function_exists( 'aioseop_init_class' ) ) {
|
374 |
function aioseop_init_class() {
|
375 |
global $aiosp;
|
384 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/meta_import.php' );
|
385 |
require_once( AIOSEOP_PLUGIN_DIR . 'inc/translations.php' );
|
386 |
require_once( AIOSEOP_PLUGIN_DIR . 'public/opengraph.php' );
|
387 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-init.php');
|
388 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'public/front.php' );
|
389 |
|
390 |
if ( AIOSEOPPRO ) {
|
391 |
require_once( AIOSEOP_PLUGIN_DIR . 'pro/functions_general.php' );
|
456 |
}
|
457 |
}
|
458 |
|
459 |
+
require_once( AIOSEOP_PLUGIN_DIR . 'aioseop-init.php' );
|
460 |
|
461 |
if ( ! function_exists( 'aioseop_install' ) ) {
|
462 |
register_activation_hook( __FILE__, 'aioseop_install' );
|
css/modules/aioseop_module-rtl.css
CHANGED
@@ -132,6 +132,20 @@ div.aioseop_feature {
|
|
132 |
float: right
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
.aioseop_feature .feature_button {
|
136 |
float: left;
|
137 |
margin-right: 0;
|
132 |
float: right
|
133 |
}
|
134 |
|
135 |
+
.aioseop_feature #free-flag {
|
136 |
+
float: left;
|
137 |
+
margin-right: 0;
|
138 |
+
background: none repeat scroll 0 0 #D23D46;
|
139 |
+
color: #FFFFFF;
|
140 |
+
padding: 5px 12px;
|
141 |
+
position: relative;
|
142 |
+
}
|
143 |
+
|
144 |
+
.aioseop_feature #free-flag:before,
|
145 |
+
.aioseop_feature #free-flag:after {
|
146 |
+
display: none;
|
147 |
+
}
|
148 |
+
|
149 |
.aioseop_feature .feature_button {
|
150 |
float: left;
|
151 |
margin-right: 0;
|
css/modules/aioseop_module.css
CHANGED
@@ -501,6 +501,39 @@ div.aioseop_feature {
|
|
501 |
-moz-transition-duration: .4s;
|
502 |
}
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
.aioseop_feature h3 {
|
505 |
font-size: 17px;
|
506 |
margin: 0;
|
@@ -1156,6 +1189,19 @@ div.aioseop_notice a.aioseop_dismiss_link {
|
|
1156 |
color: #5F5F5F;
|
1157 |
}
|
1158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1159 |
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
|
1160 |
border-left: solid 1px #CCC;
|
1161 |
margin-left: 5px;
|
501 |
-moz-transition-duration: .4s;
|
502 |
}
|
503 |
|
504 |
+
.aioseop_feature #free-flag {
|
505 |
+
float: right;
|
506 |
+
margin-right: -7px;
|
507 |
+
background: none repeat scroll 0 0 #D23D46;
|
508 |
+
color: #FFFFFF;
|
509 |
+
padding: 5px 12px 6px 5px;
|
510 |
+
position: relative;
|
511 |
+
}
|
512 |
+
|
513 |
+
.aioseop_feature #free-flag:before {
|
514 |
+
border-color: #D23D46 #D23D46 #D23D46 transparent;
|
515 |
+
border-style: solid;
|
516 |
+
border-width: 14px 4px 15px 10px;
|
517 |
+
content: "";
|
518 |
+
left: -14px;
|
519 |
+
position: absolute;
|
520 |
+
top: 0;
|
521 |
+
}
|
522 |
+
|
523 |
+
.aioseop_feature #free-flag:after {
|
524 |
+
border-color: #892026 transparent transparent;
|
525 |
+
border-style: solid;
|
526 |
+
border-width: 6px 6px 6px 0;
|
527 |
+
bottom: -12px;
|
528 |
+
content: "";
|
529 |
+
position: absolute;
|
530 |
+
right: 0;
|
531 |
+
}
|
532 |
+
|
533 |
+
#aioseop_coming_soon #free-flag {
|
534 |
+
display: none;
|
535 |
+
}
|
536 |
+
|
537 |
.aioseop_feature h3 {
|
538 |
font-size: 17px;
|
539 |
margin: 0;
|
1189 |
color: #5F5F5F;
|
1190 |
}
|
1191 |
|
1192 |
+
/* Fix for Chrome */
|
1193 |
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
1194 |
+
|
1195 |
+
.aioseop_header_tabs li a.aioseop_header_tab {
|
1196 |
+
padding-bottom: 0;
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/* Fix for Safari */
|
1201 |
+
_:-webkit-full-screen:not(:root:root), .aioseop_header_tabs li a.aioseop_header_tab {
|
1202 |
+
padding-bottom: 2px;
|
1203 |
+
}
|
1204 |
+
|
1205 |
.aioseop_header_tabs li:first-child a.aioseop_header_tab {
|
1206 |
border-left: solid 1px #CCC;
|
1207 |
margin-left: 5px;
|
i18n/all-in-one-seo-pack-ar.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-ary.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-bg_BG.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-ca.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-de_DE.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-en_AU.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-en_CA.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-en_GB.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-en_NZ.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-es_CL.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-es_MX.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-fa_IR.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-fi.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-hi_IN.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-hr.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-hu_HU.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-it_IT.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-ko_KR.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-nb_NO.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-nl_NL.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-nn_NO.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-pl_PL.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-pt_BR.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-pt_PT.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-ro_RO.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-ru_RU.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-sl_SL.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-sq.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-sr_RS.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-tr_TR.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-vi.mo
DELETED
Binary file
|
i18n/all-in-one-seo-pack-zh_CN.mo
DELETED
Binary file
|
inc/aioseop_functions.php
CHANGED
@@ -1,12 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
|
6 |
-
/**
|
7 |
-
* Load the module manager.
|
8 |
-
*/
|
9 |
if ( ! function_exists( 'aioseop_load_modules' ) ) {
|
|
|
|
|
|
|
10 |
function aioseop_load_modules() {
|
11 |
global $aioseop_modules, $aioseop_module_list;
|
12 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
|
@@ -16,6 +20,9 @@ if ( ! function_exists( 'aioseop_load_modules' ) ) {
|
|
16 |
}
|
17 |
|
18 |
if ( ! function_exists( 'aioseop_get_options' ) ) {
|
|
|
|
|
|
|
19 |
function aioseop_get_options() {
|
20 |
global $aioseop_options;
|
21 |
$aioseop_options = get_option( 'aioseop_options' );
|
@@ -25,22 +32,22 @@ if ( ! function_exists( 'aioseop_get_options' ) ) {
|
|
25 |
}
|
26 |
}
|
27 |
|
28 |
-
/**
|
29 |
-
* Check if settings need to be updated / migrated from old version.
|
30 |
-
*/
|
31 |
if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
|
|
|
|
|
|
|
|
|
|
|
32 |
function aioseop_update_settings_check() {
|
33 |
global $aioseop_options;
|
34 |
-
if ( ( isset( $_POST['aioseop_migrate_options'] ) )
|
35 |
-
( empty( $aioseop_options ) )
|
36 |
-
) {
|
37 |
aioseop_mrt_mkarry();
|
38 |
}
|
39 |
-
// WPML has now attached to filters, read settings again so they can be translated
|
40 |
aioseop_get_options();
|
41 |
$update_options = false;
|
42 |
if ( ! empty( $aioseop_options ) ) {
|
43 |
-
if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { //
|
44 |
$aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
|
45 |
unset( $aioseop_options['aiosp_archive_noindex'] );
|
46 |
$update_options = true;
|
@@ -50,7 +57,7 @@ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
|
|
50 |
unset( $aioseop_options['aiosp_archive_title_format'] );
|
51 |
$update_options = true;
|
52 |
}
|
53 |
-
if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format']
|
54 |
$aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
|
55 |
$update_options = true;
|
56 |
}
|
@@ -61,10 +68,12 @@ if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
|
|
61 |
}
|
62 |
}
|
63 |
|
64 |
-
/**
|
65 |
-
* Initialize settings to defaults.
|
66 |
-
*/
|
67 |
if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
|
|
|
|
|
|
|
|
|
|
|
68 |
function aioseop_mrt_mkarry() {
|
69 |
global $aiosp;
|
70 |
global $aioseop_options;
|
@@ -87,9 +96,12 @@ if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
|
|
87 |
}
|
88 |
|
89 |
if ( ! function_exists( 'aioseop_activate_pl' ) ) {
|
|
|
|
|
|
|
90 |
function aioseop_activate_pl() {
|
91 |
if ( $aioseop_options = get_option( 'aioseop_options' ) ) {
|
92 |
-
$aioseop_options['aiosp_enabled'] =
|
93 |
|
94 |
if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
95 |
$aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' );
|
@@ -101,27 +113,46 @@ if ( ! function_exists( 'aioseop_activate_pl' ) ) {
|
|
101 |
}
|
102 |
|
103 |
if ( ! function_exists( 'aioseop_get_version' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
function aioseop_get_version() {
|
105 |
return AIOSEOP_VERSION;
|
106 |
}
|
107 |
}
|
108 |
|
109 |
if ( ! function_exists( 'aioseop_option_isset' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
function aioseop_option_isset( $option ) {
|
111 |
global $aioseop_options;
|
112 |
|
113 |
-
return (
|
114 |
}
|
115 |
}
|
116 |
|
117 |
if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
|
|
|
|
|
|
|
|
|
|
|
118 |
function aioseop_addmycolumns() {
|
119 |
global $aioseop_options, $pagenow;
|
120 |
$aiosp_posttypecolumns = Array();
|
121 |
if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
122 |
$aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
|
123 |
}
|
124 |
-
if ( ! empty( $pagenow ) && ( $pagenow
|
125 |
$post_type = 'attachment';
|
126 |
} elseif ( ! isset( $_REQUEST['post_type'] ) ) {
|
127 |
$post_type = 'post';
|
@@ -131,14 +162,14 @@ if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
|
|
131 |
|
132 |
if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
|
133 |
add_action( 'admin_head', 'aioseop_admin_head' );
|
134 |
-
if ( $post_type
|
135 |
add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
|
136 |
-
} elseif ( $post_type
|
137 |
add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
|
138 |
} else {
|
139 |
add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
|
140 |
}
|
141 |
-
if ( $post_type
|
142 |
add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
143 |
} elseif ( is_post_type_hierarchical( $post_type ) ) {
|
144 |
add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
@@ -150,6 +181,12 @@ if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
|
|
150 |
}
|
151 |
|
152 |
if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
function aioseop_mrt_pcolumns( $aioseopc ) {
|
154 |
global $aioseop_options;
|
155 |
$aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
|
@@ -163,6 +200,7 @@ if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
|
|
163 |
}
|
164 |
|
165 |
if ( ! function_exists( 'aioseop_admin_head' ) ) {
|
|
|
166 |
function aioseop_admin_head() {
|
167 |
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
|
168 |
?>
|
@@ -241,13 +279,14 @@ if ( ! function_exists( 'aioseop_admin_head' ) ) {
|
|
241 |
}
|
242 |
|
243 |
if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
|
|
|
244 |
function aioseop_handle_ignore_notice() {
|
245 |
|
246 |
if ( ! empty( $_GET ) ) {
|
247 |
global $current_user;
|
248 |
$user_id = $current_user->ID;
|
249 |
|
250 |
-
if ( ! empty( $_GET[
|
251 |
delete_user_meta( $user_id, 'aioseop_ignore_notice' );
|
252 |
}
|
253 |
if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) {
|
@@ -258,7 +297,15 @@ if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
|
|
258 |
}
|
259 |
|
260 |
if ( ! function_exists( 'aioseop_output_notice' ) ) {
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
$class = 'aioseop_notice ' . $class;
|
263 |
if ( ! empty( $class ) ) {
|
264 |
$class = ' class="' . esc_attr( $class ) . '"';
|
@@ -267,14 +314,22 @@ if ( ! function_exists( 'aioseop_output_notice' ) ) {
|
|
267 |
$class .= ' id="' . esc_attr( $id ) . '"';
|
268 |
}
|
269 |
$dismiss = ' ';
|
270 |
-
echo "<div{$class}>" . wp_kses_post( $message ) .
|
271 |
|
272 |
return true;
|
273 |
}
|
274 |
}
|
275 |
|
276 |
if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
global $current_user;
|
279 |
if ( ! empty( $current_user ) ) {
|
280 |
$user_id = $current_user->ID;
|
@@ -285,7 +340,7 @@ if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
|
285 |
}
|
286 |
global $wp;
|
287 |
$qa = Array();
|
288 |
-
wp_parse_str( $_SERVER[
|
289 |
$qa['aioseop_ignore_notice'] = $msgid;
|
290 |
$url = '?' . build_query( $qa );
|
291 |
$message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
|
@@ -296,8 +351,9 @@ if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
|
296 |
}
|
297 |
|
298 |
if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
|
|
|
299 |
function aioseop_ajax_save_meta() {
|
300 |
-
if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit']
|
301 |
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
302 |
}
|
303 |
$post_id = intval( $_POST['post_id'] );
|
@@ -308,7 +364,7 @@ if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
|
|
308 |
if ( in_array( $target, Array(
|
309 |
'title',
|
310 |
'description',
|
311 |
-
'keywords'
|
312 |
) ) && current_user_can( 'edit_post', $post_id )
|
313 |
) {
|
314 |
update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
|
@@ -325,13 +381,14 @@ if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
|
|
325 |
$output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
|
326 |
. 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
|
327 |
. '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
|
328 |
-
die( "jQuery('div#aioseop_" . $target .
|
329 |
-
jQuery('div#aioseop_" . $target .
|
330 |
});" );
|
331 |
}
|
332 |
}
|
333 |
|
334 |
if ( ! function_exists( 'aioseop_ajax_init' ) ) {
|
|
|
335 |
function aioseop_ajax_init() {
|
336 |
if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) {
|
337 |
$_POST = stripslashes_deep( $_POST );
|
@@ -341,7 +398,7 @@ if ( ! function_exists( 'aioseop_ajax_init' ) ) {
|
|
341 |
}
|
342 |
|
343 |
if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
344 |
-
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __(
|
345 |
}
|
346 |
} else {
|
347 |
die( 0 );
|
@@ -349,6 +406,13 @@ if ( ! function_exists( 'aioseop_ajax_init' ) ) {
|
|
349 |
}
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
function aioseop_embed_handler_html( $return, $url, $attr ) {
|
353 |
return AIO_ProGeneral::aioseop_embed_handler_html();
|
354 |
}
|
@@ -358,6 +422,7 @@ function aioseop_ajax_update_oembed() {
|
|
358 |
}
|
359 |
|
360 |
if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
|
|
361 |
function aioseop_ajax_save_url() {
|
362 |
aioseop_ajax_init();
|
363 |
$options = Array();
|
@@ -369,12 +434,12 @@ if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
|
369 |
global $aiosp, $aioseop_modules;
|
370 |
aioseop_load_modules();
|
371 |
$aiosp->admin_menu();
|
372 |
-
if ( ! empty( $_POST['settings'] ) && ( $_POST['settings']
|
373 |
-
$module = $aioseop_modules->return_module(
|
374 |
-
} elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings']
|
375 |
-
$module = $aioseop_modules->return_module(
|
376 |
} else {
|
377 |
-
$module = $aioseop_modules->return_module(
|
378 |
}
|
379 |
$_POST['location'] = null;
|
380 |
$_POST['Submit'] = 'ajax';
|
@@ -388,7 +453,7 @@ if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
|
388 |
'type' => 'custom',
|
389 |
'save' => true,
|
390 |
'value' => $options[ $prefix . 'addl_pages' ],
|
391 |
-
'attr' => ''
|
392 |
) );
|
393 |
$output = str_replace( "'", "\'", $output );
|
394 |
$output = str_replace( "\n", '\n', $output );
|
@@ -397,6 +462,7 @@ if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
|
397 |
}
|
398 |
|
399 |
if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
|
|
400 |
function aioseop_ajax_delete_url() {
|
401 |
aioseop_ajax_init();
|
402 |
$options = Array();
|
@@ -405,12 +471,12 @@ if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
|
405 |
global $aiosp, $aioseop_modules;
|
406 |
aioseop_load_modules();
|
407 |
$aiosp->admin_menu();
|
408 |
-
$module = $aioseop_modules->return_module(
|
409 |
$_POST['location'] = null;
|
410 |
$_POST['Submit'] = 'ajax';
|
411 |
$module->add_page_hooks();
|
412 |
$_POST = (Array) $module->get_current_options( $_POST, null );
|
413 |
-
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) &&
|
414 |
$_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages'];
|
415 |
}
|
416 |
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
|
@@ -427,12 +493,12 @@ if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
|
427 |
'type' => 'custom',
|
428 |
'save' => true,
|
429 |
'value' => $options['aiosp_sitemap_addl_pages'],
|
430 |
-
'attr' => ''
|
431 |
) );
|
432 |
$output = str_replace( "'", "\'", $output );
|
433 |
$output = str_replace( "\n", '\n', $output );
|
434 |
} else {
|
435 |
-
$output = sprintf( __(
|
436 |
}
|
437 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
438 |
}
|
@@ -441,7 +507,7 @@ if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
|
441 |
if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
442 |
|
443 |
function aioseop_ajax_scan_header() {
|
444 |
-
$_POST[
|
445 |
aioseop_ajax_init();
|
446 |
$options = Array();
|
447 |
parse_str( $_POST['options'], $options );
|
@@ -454,7 +520,7 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
454 |
ob_start();
|
455 |
do_action( 'wp' );
|
456 |
global $aioseop_modules;
|
457 |
-
$module = $aioseop_modules->return_module(
|
458 |
wp_head();
|
459 |
$output = ob_get_clean();
|
460 |
global $aiosp;
|
@@ -463,7 +529,7 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
463 |
$metatags = Array(
|
464 |
'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
|
465 |
'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
|
466 |
-
'google+' => Array( 'name' => 'itemprop', 'value' => 'content' )
|
467 |
);
|
468 |
$metadata = Array(
|
469 |
'facebook' => Array(
|
@@ -473,20 +539,20 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
473 |
'thumbnail' => 'og:image',
|
474 |
'sitename' => 'og:site_name',
|
475 |
'key' => 'fb:admins',
|
476 |
-
'description' => 'og:description'
|
477 |
),
|
478 |
'google+' => Array(
|
479 |
'thumbnail' => 'image',
|
480 |
'title' => 'name',
|
481 |
-
'description' => 'description'
|
482 |
),
|
483 |
'twitter' => Array(
|
484 |
'card' => 'twitter:card',
|
485 |
'url' => 'twitter:url',
|
486 |
'title' => 'twitter:title',
|
487 |
'description' => 'twitter:description',
|
488 |
-
'thumbnail' => 'twitter:image'
|
489 |
-
)
|
490 |
);
|
491 |
if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) {
|
492 |
foreach ( $output['head']['meta'] as $v ) {
|
@@ -496,7 +562,7 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
496 |
if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) {
|
497 |
foreach ( $metadata[ $type ] as $tk => $tv ) {
|
498 |
if ( $m[ $tags['name'] ] == $tv ) {
|
499 |
-
$meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) .
|
500 |
}
|
501 |
}
|
502 |
}
|
@@ -507,22 +573,22 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
507 |
if ( empty( $meta ) ) {
|
508 |
$meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
|
509 |
} else {
|
510 |
-
$meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta .
|
511 |
$meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>"
|
512 |
-
.
|
513 |
-
.
|
514 |
-
.
|
515 |
|
516 |
foreach (
|
517 |
Array(
|
518 |
'https://developers.facebook.com/tools/debug',
|
519 |
'http://www.google.com/webmasters/tools/richsnippets',
|
520 |
-
'https://dev.twitter.com/docs/cards/validation/validator'
|
521 |
) as $link
|
522 |
) {
|
523 |
$meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
|
524 |
}
|
525 |
-
$meta .=
|
526 |
}
|
527 |
$output = $meta;
|
528 |
$output = str_replace( "'", "\'", $output );
|
@@ -532,6 +598,7 @@ if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
|
532 |
}
|
533 |
|
534 |
if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
|
|
|
535 |
function aioseop_ajax_save_settings() {
|
536 |
aioseop_ajax_init();
|
537 |
$options = Array();
|
@@ -561,6 +628,7 @@ if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
|
|
561 |
}
|
562 |
|
563 |
if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
|
|
|
564 |
function aioseop_ajax_get_menu_links() {
|
565 |
aioseop_ajax_init();
|
566 |
$options = Array();
|
@@ -613,33 +681,38 @@ if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
|
|
613 |
}
|
614 |
}
|
615 |
}
|
616 |
-
$output =
|
617 |
if ( ! empty( $links ) ) {
|
618 |
foreach ( $links as $k => $v ) {
|
619 |
-
if ( $k
|
620 |
$current = ' class="current"';
|
621 |
} else {
|
622 |
$current = '';
|
623 |
}
|
624 |
-
$output .= "<li{$current}><a href='" . esc_url( $v ) . "'>" . esc_attr( $k ) .
|
625 |
}
|
626 |
}
|
627 |
-
$output .=
|
628 |
die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) );
|
629 |
}
|
630 |
}
|
631 |
|
632 |
if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
|
|
|
|
|
|
|
|
|
|
633 |
function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) {
|
634 |
$id = $aioseoppi;
|
635 |
$target = null;
|
636 |
-
if ( $aioseopcn
|
637 |
$target = 'title';
|
638 |
}
|
639 |
-
if ( $aioseopcn
|
640 |
$target = 'keywords';
|
641 |
}
|
642 |
-
if ( $aioseopcn
|
643 |
$target = 'description';
|
644 |
}
|
645 |
if ( ! $target ) {
|
@@ -650,11 +723,11 @@ if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
|
650 |
<div class="aioseop_mpc_admin_meta_options"
|
651 |
id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
|
652 |
style="float:left;">
|
653 |
-
<?php $content = strip_tags( stripslashes( get_post_meta( $id,
|
654 |
if ( ! empty( $content ) ):
|
655 |
$label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
|
656 |
else:
|
657 |
-
$label = "<label id='aioseop_label_{$target}_{$id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) .
|
658 |
endif;
|
659 |
$nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
|
660 |
echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
|
@@ -670,6 +743,14 @@ if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
|
670 |
}
|
671 |
|
672 |
if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
673 |
function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
|
674 |
if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) {
|
675 |
return false;
|
@@ -680,6 +761,12 @@ if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
|
|
680 |
}
|
681 |
|
682 |
if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
function aioseop_mrt_exclude_this_page( $url = null ) {
|
684 |
static $excluded = false;
|
685 |
if ( $excluded === false ) {
|
@@ -716,7 +803,7 @@ if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
|
|
716 |
}
|
717 |
if ( ! empty( $url ) ) {
|
718 |
foreach ( $excluded as $exedd ) {
|
719 |
-
if (
|
720 |
return true;
|
721 |
}
|
722 |
}
|
@@ -728,6 +815,12 @@ if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
|
|
728 |
}
|
729 |
|
730 |
if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
function aioseop_get_pages_start( $excludes ) {
|
732 |
global $aioseop_get_pages_start;
|
733 |
$aioseop_get_pages_start = 1;
|
@@ -737,6 +830,12 @@ if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
|
|
737 |
}
|
738 |
|
739 |
if ( ! function_exists( 'aioseop_get_pages' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
740 |
function aioseop_get_pages( $pages ) {
|
741 |
global $aioseop_get_pages_start;
|
742 |
if ( ! $aioseop_get_pages_start ) {
|
@@ -757,6 +856,14 @@ if ( ! function_exists( 'aioseop_get_pages' ) ) {
|
|
757 |
|
758 |
// The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
|
759 |
if ( ! function_exists( 'aioseop_list_pages' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
760 |
function aioseop_list_pages( $content ) {
|
761 |
global $wp_version;
|
762 |
$matches = array();
|
@@ -769,7 +876,7 @@ if ( ! function_exists( 'aioseop_list_pages' ) ) {
|
|
769 |
$pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
|
770 |
}
|
771 |
|
772 |
-
return preg_replace_callback( $pattern,
|
773 |
}
|
774 |
|
775 |
return $content;
|
@@ -777,12 +884,18 @@ if ( ! function_exists( 'aioseop_list_pages' ) ) {
|
|
777 |
}
|
778 |
|
779 |
if ( ! function_exists( 'aioseop_filter_callback' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
function aioseop_filter_callback( $matches ) {
|
781 |
if ( $matches[1] && ! empty( $matches[1] ) ) {
|
782 |
$postID = $matches[1];
|
783 |
}
|
784 |
if ( empty( $postID ) ) {
|
785 |
-
$postID = get_option(
|
786 |
}
|
787 |
$title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) );
|
788 |
if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) {
|
@@ -797,6 +910,12 @@ if ( ! function_exists( 'aioseop_filter_callback' ) ) {
|
|
797 |
}
|
798 |
|
799 |
if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
800 |
function aioseop_add_contactmethods( $contactmethods ) {
|
801 |
global $aioseop_options, $aioseop_modules;
|
802 |
if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
@@ -819,6 +938,7 @@ if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
|
|
819 |
}
|
820 |
|
821 |
if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
|
|
|
822 |
function aioseop_localize_script_data() {
|
823 |
static $loaded = 0;
|
824 |
if ( ! $loaded ) {
|
@@ -829,10 +949,16 @@ if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
|
|
829 |
}
|
830 |
}
|
831 |
|
832 |
-
/***
|
833 |
-
* Utility function for inserting elements into associative arrays by key
|
834 |
-
*/
|
835 |
if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
836 |
function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
|
837 |
$keys = array_keys( $arr );
|
838 |
$vals = array_values( $arr );
|
@@ -848,10 +974,13 @@ if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
|
|
848 |
}
|
849 |
}
|
850 |
|
851 |
-
/***
|
852 |
-
* JSON support for PHP < 5.2
|
853 |
-
*/
|
854 |
if ( ! function_exists( 'aioseop_load_json_services' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
855 |
function aioseop_load_json_services() {
|
856 |
static $services_json = null;
|
857 |
if ( $services_json ) {
|
@@ -869,6 +998,12 @@ if ( ! function_exists( 'aioseop_load_json_services' ) ) {
|
|
869 |
}
|
870 |
|
871 |
if ( ! function_exists( 'json_encode' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
function json_encode( $arg ) {
|
873 |
$services_json = aioseop_load_json_services();
|
874 |
|
@@ -877,6 +1012,12 @@ if ( ! function_exists( 'json_encode' ) ) {
|
|
877 |
}
|
878 |
|
879 |
if ( ! function_exists( 'json_decode' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
880 |
function json_decode( $arg ) {
|
881 |
$services_json = aioseop_load_json_services();
|
882 |
|
@@ -884,29 +1025,54 @@ if ( ! function_exists( 'json_decode' ) ) {
|
|
884 |
}
|
885 |
}
|
886 |
|
887 |
-
/***
|
888 |
-
* fnmatch() doesn't exist on Windows pre PHP 5.3
|
889 |
-
*/
|
890 |
if ( ! function_exists( 'fnmatch' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
891 |
function fnmatch( $pattern, $string ) {
|
892 |
-
return preg_match(
|
893 |
'\*' => '.*',
|
894 |
-
'\?' => '.'
|
895 |
) ) . "$#i", $string );
|
896 |
}
|
897 |
}
|
898 |
|
899 |
-
/***
|
900 |
-
* parse_ini_string() doesn't exist pre PHP 5.3
|
901 |
-
*/
|
902 |
if ( ! function_exists( 'parse_ini_string' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
903 |
function parse_ini_string( $string, $process_sections ) {
|
|
|
904 |
if ( ! class_exists( 'parse_ini_filter' ) ) {
|
905 |
-
/* Define our filter class */
|
906 |
|
|
|
|
|
|
|
|
|
|
|
907 |
class parse_ini_filter extends php_user_filter {
|
908 |
static $buf = '';
|
909 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
function filter( $in, $out, &$consumed, $closing ) {
|
911 |
$bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf );
|
912 |
stream_bucket_append( $out, $bucket );
|
@@ -915,31 +1081,28 @@ if ( ! function_exists( 'parse_ini_string' ) ) {
|
|
915 |
}
|
916 |
}
|
917 |
|
918 |
-
|
919 |
-
if ( ! stream_filter_register(
|
920 |
return false;
|
921 |
}
|
922 |
}
|
923 |
parse_ini_filter::$buf = $string;
|
924 |
|
925 |
-
return parse_ini_file(
|
926 |
}
|
927 |
}
|
928 |
|
929 |
function aioseop_update_user_visibilitynotice() {
|
930 |
|
931 |
update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
|
932 |
-
|
933 |
}
|
934 |
|
935 |
function aioseop_update_yst_detected_notice() {
|
936 |
|
937 |
update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
938 |
-
|
939 |
}
|
940 |
|
941 |
function aioseop_woo_upgrade_notice_dismissed() {
|
942 |
|
943 |
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
944 |
-
|
945 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* General functions file.
|
4 |
+
*
|
5 |
+
* We'll eventually move these to a better place, and figure out ones not being used anymore.
|
6 |
+
*
|
7 |
* @package All-in-One-SEO-Pack
|
8 |
*/
|
9 |
|
|
|
|
|
|
|
10 |
if ( ! function_exists( 'aioseop_load_modules' ) ) {
|
11 |
+
/**
|
12 |
+
* Load the module manager.
|
13 |
+
*/
|
14 |
function aioseop_load_modules() {
|
15 |
global $aioseop_modules, $aioseop_module_list;
|
16 |
require_once( AIOSEOP_PLUGIN_DIR . 'admin/aioseop_module_manager.php' );
|
20 |
}
|
21 |
|
22 |
if ( ! function_exists( 'aioseop_get_options' ) ) {
|
23 |
+
/**
|
24 |
+
* @return mixed|void
|
25 |
+
*/
|
26 |
function aioseop_get_options() {
|
27 |
global $aioseop_options;
|
28 |
$aioseop_options = get_option( 'aioseop_options' );
|
32 |
}
|
33 |
}
|
34 |
|
|
|
|
|
|
|
35 |
if ( ! function_exists( 'aioseop_update_settings_check' ) ) {
|
36 |
+
/**
|
37 |
+
* Check if settings need to be updated / migrated from old version.
|
38 |
+
*
|
39 |
+
* @TODO See when this is from and if we can move it elsewhere... our new db updates/upgrades class?
|
40 |
+
*/
|
41 |
function aioseop_update_settings_check() {
|
42 |
global $aioseop_options;
|
43 |
+
if ( empty( $aioseop_options ) || isset( $_POST['aioseop_migrate_options'] ) ) {
|
|
|
|
|
44 |
aioseop_mrt_mkarry();
|
45 |
}
|
46 |
+
// WPML has now attached to filters, read settings again so they can be translated.
|
47 |
aioseop_get_options();
|
48 |
$update_options = false;
|
49 |
if ( ! empty( $aioseop_options ) ) {
|
50 |
+
if ( ! empty( $aioseop_options['aiosp_archive_noindex'] ) ) { // Migrate setting for noindex archives.
|
51 |
$aioseop_options['aiosp_archive_date_noindex'] = $aioseop_options['aiosp_archive_author_noindex'] = $aioseop_options['aiosp_archive_noindex'];
|
52 |
unset( $aioseop_options['aiosp_archive_noindex'] );
|
53 |
$update_options = true;
|
57 |
unset( $aioseop_options['aiosp_archive_title_format'] );
|
58 |
$update_options = true;
|
59 |
}
|
60 |
+
if ( ! empty( $aioseop_options['aiosp_archive_title_format'] ) && ( $aioseop_options['aiosp_archive_title_format'] === '%date% | %blog_title%' ) ) {
|
61 |
$aioseop_options['aiosp_archive_title_format'] = '%archive_title% | %blog_title%';
|
62 |
$update_options = true;
|
63 |
}
|
68 |
}
|
69 |
}
|
70 |
|
|
|
|
|
|
|
71 |
if ( ! function_exists( 'aioseop_mrt_mkarry' ) ) {
|
72 |
+
/**
|
73 |
+
* Initialize settings to defaults.
|
74 |
+
*
|
75 |
+
* @TODO Should also move.
|
76 |
+
*/
|
77 |
function aioseop_mrt_mkarry() {
|
78 |
global $aiosp;
|
79 |
global $aioseop_options;
|
96 |
}
|
97 |
|
98 |
if ( ! function_exists( 'aioseop_activate_pl' ) ) {
|
99 |
+
/**
|
100 |
+
* @TODO see if this still gets used.
|
101 |
+
*/
|
102 |
function aioseop_activate_pl() {
|
103 |
if ( $aioseop_options = get_option( 'aioseop_options' ) ) {
|
104 |
+
$aioseop_options['aiosp_enabled'] = '0';
|
105 |
|
106 |
if ( empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
107 |
$aioseop_options['aiosp_posttypecolumns'] = array( 'post', 'page' );
|
113 |
}
|
114 |
|
115 |
if ( ! function_exists( 'aioseop_get_version' ) ) {
|
116 |
+
/**
|
117 |
+
* Returns the version.
|
118 |
+
*
|
119 |
+
* I'm not sure why we have BOTH a function and a constant for this. -mrt
|
120 |
+
*
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
function aioseop_get_version() {
|
124 |
return AIOSEOP_VERSION;
|
125 |
}
|
126 |
}
|
127 |
|
128 |
if ( ! function_exists( 'aioseop_option_isset' ) ) {
|
129 |
+
/**
|
130 |
+
* Checks if an option isset.
|
131 |
+
*
|
132 |
+
* @param $option
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
function aioseop_option_isset( $option ) {
|
137 |
global $aioseop_options;
|
138 |
|
139 |
+
return ( isset( $aioseop_options[ $option ] ) && $aioseop_options[ $option ] );
|
140 |
}
|
141 |
}
|
142 |
|
143 |
if ( ! function_exists( 'aioseop_addmycolumns' ) ) {
|
144 |
+
/**
|
145 |
+
* Adds posttype columns.
|
146 |
+
*
|
147 |
+
* @TODO We should see if this is still being used, and move it either way.
|
148 |
+
*/
|
149 |
function aioseop_addmycolumns() {
|
150 |
global $aioseop_options, $pagenow;
|
151 |
$aiosp_posttypecolumns = Array();
|
152 |
if ( ! empty( $aioseop_options ) && ! empty( $aioseop_options['aiosp_posttypecolumns'] ) ) {
|
153 |
$aiosp_posttypecolumns = $aioseop_options['aiosp_posttypecolumns'];
|
154 |
}
|
155 |
+
if ( ! empty( $pagenow ) && ( $pagenow === 'upload.php' ) ) {
|
156 |
$post_type = 'attachment';
|
157 |
} elseif ( ! isset( $_REQUEST['post_type'] ) ) {
|
158 |
$post_type = 'post';
|
162 |
|
163 |
if ( is_array( $aiosp_posttypecolumns ) && in_array( $post_type, $aiosp_posttypecolumns ) ) {
|
164 |
add_action( 'admin_head', 'aioseop_admin_head' );
|
165 |
+
if ( $post_type === 'page' ) {
|
166 |
add_filter( 'manage_pages_columns', 'aioseop_mrt_pcolumns' );
|
167 |
+
} elseif ( $post_type === 'attachment' ) {
|
168 |
add_filter( 'manage_media_columns', 'aioseop_mrt_pcolumns' );
|
169 |
} else {
|
170 |
add_filter( 'manage_posts_columns', 'aioseop_mrt_pcolumns' );
|
171 |
}
|
172 |
+
if ( $post_type === 'attachment' ) {
|
173 |
add_action( 'manage_media_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
174 |
} elseif ( is_post_type_hierarchical( $post_type ) ) {
|
175 |
add_action( 'manage_pages_custom_column', 'aioseop_mrt_pccolumn', 10, 2 );
|
181 |
}
|
182 |
|
183 |
if ( ! function_exists( 'aioseop_mrt_pcolumns' ) ) {
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @param $aioseopc
|
187 |
+
*
|
188 |
+
* @return mixed
|
189 |
+
*/
|
190 |
function aioseop_mrt_pcolumns( $aioseopc ) {
|
191 |
global $aioseop_options;
|
192 |
$aioseopc['seotitle'] = __( 'SEO Title', 'all-in-one-seo-pack' );
|
200 |
}
|
201 |
|
202 |
if ( ! function_exists( 'aioseop_admin_head' ) ) {
|
203 |
+
|
204 |
function aioseop_admin_head() {
|
205 |
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'js/quickedit_functions.js" ></script>';
|
206 |
?>
|
279 |
}
|
280 |
|
281 |
if ( ! function_exists( 'aioseop_handle_ignore_notice' ) ) {
|
282 |
+
|
283 |
function aioseop_handle_ignore_notice() {
|
284 |
|
285 |
if ( ! empty( $_GET ) ) {
|
286 |
global $current_user;
|
287 |
$user_id = $current_user->ID;
|
288 |
|
289 |
+
if ( ! empty( $_GET['aioseop_reset_notices'] ) ) {
|
290 |
delete_user_meta( $user_id, 'aioseop_ignore_notice' );
|
291 |
}
|
292 |
if ( ! empty( $_GET['aioseop_ignore_notice'] ) ) {
|
297 |
}
|
298 |
|
299 |
if ( ! function_exists( 'aioseop_output_notice' ) ) {
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @param $message
|
303 |
+
* @param string $id
|
304 |
+
* @param string $class
|
305 |
+
*
|
306 |
+
* @return bool
|
307 |
+
*/
|
308 |
+
function aioseop_output_notice( $message, $id = '', $class = 'updated fade' ) {
|
309 |
$class = 'aioseop_notice ' . $class;
|
310 |
if ( ! empty( $class ) ) {
|
311 |
$class = ' class="' . esc_attr( $class ) . '"';
|
314 |
$class .= ' id="' . esc_attr( $id ) . '"';
|
315 |
}
|
316 |
$dismiss = ' ';
|
317 |
+
echo "<div{$class}>" . wp_kses_post( $message ) . '<br class=clear /></div>';
|
318 |
|
319 |
return true;
|
320 |
}
|
321 |
}
|
322 |
|
323 |
if ( ! function_exists( 'aioseop_output_dismissable_notice' ) ) {
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @param $message
|
327 |
+
* @param string $id
|
328 |
+
* @param string $class
|
329 |
+
*
|
330 |
+
* @return bool
|
331 |
+
*/
|
332 |
+
function aioseop_output_dismissable_notice( $message, $id = '', $class = 'updated fade' ) {
|
333 |
global $current_user;
|
334 |
if ( ! empty( $current_user ) ) {
|
335 |
$user_id = $current_user->ID;
|
340 |
}
|
341 |
global $wp;
|
342 |
$qa = Array();
|
343 |
+
wp_parse_str( $_SERVER['QUERY_STRING'], $qa );
|
344 |
$qa['aioseop_ignore_notice'] = $msgid;
|
345 |
$url = '?' . build_query( $qa );
|
346 |
$message = '<p class=alignleft>' . $message . '</p><p class="alignright"><a class="aioseop_dismiss_link" href="' . $url . '">Dismiss</a></p>';
|
351 |
}
|
352 |
|
353 |
if ( ! function_exists( 'aioseop_ajax_save_meta' ) ) {
|
354 |
+
|
355 |
function aioseop_ajax_save_meta() {
|
356 |
+
if ( ! empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] !== 'undefined' ) ) {
|
357 |
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
358 |
}
|
359 |
$post_id = intval( $_POST['post_id'] );
|
364 |
if ( in_array( $target, Array(
|
365 |
'title',
|
366 |
'description',
|
367 |
+
'keywords',
|
368 |
) ) && current_user_can( 'edit_post', $post_id )
|
369 |
) {
|
370 |
update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
|
381 |
$output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
|
382 |
. 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __( 'Edit' ) . '">'
|
383 |
. '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
|
384 |
+
die( "jQuery('div#aioseop_" . $target . '_' . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
|
385 |
+
jQuery('div#aioseop_" . $target . '_' . $post_id . "').html(my_label).fadeIn('fast');
|
386 |
});" );
|
387 |
}
|
388 |
}
|
389 |
|
390 |
if ( ! function_exists( 'aioseop_ajax_init' ) ) {
|
391 |
+
|
392 |
function aioseop_ajax_init() {
|
393 |
if ( ! empty( $_POST ) && ! empty( $_POST['settings'] ) && ( ! empty( $_POST['nonce-aioseop'] ) || ( ! empty( $_POST['nonce-aioseop-edit'] ) ) ) && ! empty( $_POST['options'] ) ) {
|
394 |
$_POST = stripslashes_deep( $_POST );
|
398 |
}
|
399 |
|
400 |
if ( ! wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
|
401 |
+
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( 'Unauthorized access; try reloading the page.', 'all-in-one-seo-pack' ) ) );
|
402 |
}
|
403 |
} else {
|
404 |
die( 0 );
|
406 |
}
|
407 |
}
|
408 |
|
409 |
+
/**
|
410 |
+
* @param $return
|
411 |
+
* @param $url
|
412 |
+
* @param $attr
|
413 |
+
*
|
414 |
+
* @return mixed
|
415 |
+
*/
|
416 |
function aioseop_embed_handler_html( $return, $url, $attr ) {
|
417 |
return AIO_ProGeneral::aioseop_embed_handler_html();
|
418 |
}
|
422 |
}
|
423 |
|
424 |
if ( ! function_exists( 'aioseop_ajax_save_url' ) ) {
|
425 |
+
|
426 |
function aioseop_ajax_save_url() {
|
427 |
aioseop_ajax_init();
|
428 |
$options = Array();
|
434 |
global $aiosp, $aioseop_modules;
|
435 |
aioseop_load_modules();
|
436 |
$aiosp->admin_menu();
|
437 |
+
if ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'video_sitemap_addl_pages' ) ) {
|
438 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Video_Sitemap' );
|
439 |
+
} elseif ( ! empty( $_POST['settings'] ) && ( $_POST['settings'] === 'news_sitemap_addl_pages' ) ) {
|
440 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_News_Sitemap' );
|
441 |
} else {
|
442 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
|
443 |
}
|
444 |
$_POST['location'] = null;
|
445 |
$_POST['Submit'] = 'ajax';
|
453 |
'type' => 'custom',
|
454 |
'save' => true,
|
455 |
'value' => $options[ $prefix . 'addl_pages' ],
|
456 |
+
'attr' => '',
|
457 |
) );
|
458 |
$output = str_replace( "'", "\'", $output );
|
459 |
$output = str_replace( "\n", '\n', $output );
|
462 |
}
|
463 |
|
464 |
if ( ! function_exists( 'aioseop_ajax_delete_url' ) ) {
|
465 |
+
|
466 |
function aioseop_ajax_delete_url() {
|
467 |
aioseop_ajax_init();
|
468 |
$options = Array();
|
471 |
global $aiosp, $aioseop_modules;
|
472 |
aioseop_load_modules();
|
473 |
$aiosp->admin_menu();
|
474 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Sitemap' );
|
475 |
$_POST['location'] = null;
|
476 |
$_POST['Submit'] = 'ajax';
|
477 |
$module->add_page_hooks();
|
478 |
$_POST = (Array) $module->get_current_options( $_POST, null );
|
479 |
+
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && is_object( $_POST['aiosp_sitemap_addl_pages'] ) ) {
|
480 |
$_POST['aiosp_sitemap_addl_pages'] = (Array) $_POST['aiosp_sitemap_addl_pages'];
|
481 |
}
|
482 |
if ( ! empty( $_POST['aiosp_sitemap_addl_pages'] ) && ( ! empty( $_POST['aiosp_sitemap_addl_pages'][ $options ] ) ) ) {
|
493 |
'type' => 'custom',
|
494 |
'save' => true,
|
495 |
'value' => $options['aiosp_sitemap_addl_pages'],
|
496 |
+
'attr' => '',
|
497 |
) );
|
498 |
$output = str_replace( "'", "\'", $output );
|
499 |
$output = str_replace( "\n", '\n', $output );
|
500 |
} else {
|
501 |
+
$output = sprintf( __( 'Row %s not found; no rows were deleted.', 'all-in-one-seo-pack' ), esc_attr( $options ) );
|
502 |
}
|
503 |
die( sprintf( AIOSEOP_AJAX_MSG_TMPL, $output ) );
|
504 |
}
|
507 |
if ( ! function_exists( 'aioseop_ajax_scan_header' ) ) {
|
508 |
|
509 |
function aioseop_ajax_scan_header() {
|
510 |
+
$_POST['options'] = 'foo';
|
511 |
aioseop_ajax_init();
|
512 |
$options = Array();
|
513 |
parse_str( $_POST['options'], $options );
|
520 |
ob_start();
|
521 |
do_action( 'wp' );
|
522 |
global $aioseop_modules;
|
523 |
+
$module = $aioseop_modules->return_module( 'All_in_One_SEO_Pack_Opengraph' );
|
524 |
wp_head();
|
525 |
$output = ob_get_clean();
|
526 |
global $aiosp;
|
529 |
$metatags = Array(
|
530 |
'facebook' => Array( 'name' => 'property', 'value' => 'content' ),
|
531 |
'twitter' => Array( 'name' => 'name', 'value' => 'value' ),
|
532 |
+
'google+' => Array( 'name' => 'itemprop', 'value' => 'content' ),
|
533 |
);
|
534 |
$metadata = Array(
|
535 |
'facebook' => Array(
|
539 |
'thumbnail' => 'og:image',
|
540 |
'sitename' => 'og:site_name',
|
541 |
'key' => 'fb:admins',
|
542 |
+
'description' => 'og:description',
|
543 |
),
|
544 |
'google+' => Array(
|
545 |
'thumbnail' => 'image',
|
546 |
'title' => 'name',
|
547 |
+
'description' => 'description',
|
548 |
),
|
549 |
'twitter' => Array(
|
550 |
'card' => 'twitter:card',
|
551 |
'url' => 'twitter:url',
|
552 |
'title' => 'twitter:title',
|
553 |
'description' => 'twitter:description',
|
554 |
+
'thumbnail' => 'twitter:image',
|
555 |
+
),
|
556 |
);
|
557 |
if ( ! empty( $output ) && ! empty( $output['head'] ) && ! empty( $output['head']['meta'] ) ) {
|
558 |
foreach ( $output['head']['meta'] as $v ) {
|
562 |
if ( ! empty( $m[ $tags['name'] ] ) && ! empty( $m[ $tags['value'] ] ) ) {
|
563 |
foreach ( $metadata[ $type ] as $tk => $tv ) {
|
564 |
if ( $m[ $tags['name'] ] == $tv ) {
|
565 |
+
$meta .= "<tr><th style='color:red;'>" . sprintf( __( 'Duplicate %s Meta' ), ucwords( $type ) ) . '</th><td>' . ucwords( $tk ) . "</td><td>{$m[$tags['name']]}</td><td>{$m[$tags['value']]}</td></tr>\n";
|
566 |
}
|
567 |
}
|
568 |
}
|
573 |
if ( empty( $meta ) ) {
|
574 |
$meta = '<span style="color:green;">' . __( 'No duplicate meta tags found.', 'all-in-one-seo-pack' ) . '</span>';
|
575 |
} else {
|
576 |
+
$meta = "<table cellspacing=0 cellpadding=0 width=80% class='aioseop_table'><tr class='aioseop_table_header'><th>Meta For Site</th><th>Kind of Meta</th><th>Element Name</th><th>Element Value</th></tr>" . $meta . '</table>';
|
577 |
$meta .= "<p><div class='aioseop_meta_info'><h3 style='padding:5px;margin-bottom:0px;'>" . __( 'What Does This Mean?', 'all-in-one-seo-pack' ) . "</h3><div style='padding:5px;padding-top:0px;'>"
|
578 |
+
. '<p>' . __( 'All in One SEO Pack has detected that a plugin(s) or theme is also outputting social meta tags on your site. You can view this social meta in the source code of your site (check your browser help for instructions on how to view source code).', 'all-in-one-seo-pack' )
|
579 |
+
. '</p><p>' . __( 'You may prefer to use the social meta tags that are being output by the other plugin(s) or theme. If so, then you should deactivate this Social Meta feature in All in One SEO Pack Feature Manager.', 'all-in-one-seo-pack' )
|
580 |
+
. '</p><p>' . __( 'You should avoid duplicate social meta tags. You can use these free tools from Facebook, Google and Twitter to validate your social meta and check for errors:', 'all-in-one-seo-pack' ) . '</p>';
|
581 |
|
582 |
foreach (
|
583 |
Array(
|
584 |
'https://developers.facebook.com/tools/debug',
|
585 |
'http://www.google.com/webmasters/tools/richsnippets',
|
586 |
+
'https://dev.twitter.com/docs/cards/validation/validator',
|
587 |
) as $link
|
588 |
) {
|
589 |
$meta .= "<a href='{$link}' target='_blank'>{$link}</a><br />";
|
590 |
}
|
591 |
+
$meta .= '<p>' . __( 'Please refer to the document for each tool for help in using these to debug your social meta.', 'all-in-one-seo-pack' ) . '</div></div>';
|
592 |
}
|
593 |
$output = $meta;
|
594 |
$output = str_replace( "'", "\'", $output );
|
598 |
}
|
599 |
|
600 |
if ( ! function_exists( 'aioseop_ajax_save_settings' ) ) {
|
601 |
+
|
602 |
function aioseop_ajax_save_settings() {
|
603 |
aioseop_ajax_init();
|
604 |
$options = Array();
|
628 |
}
|
629 |
|
630 |
if ( ! function_exists( 'aioseop_ajax_get_menu_links' ) ) {
|
631 |
+
|
632 |
function aioseop_ajax_get_menu_links() {
|
633 |
aioseop_ajax_init();
|
634 |
$options = Array();
|
681 |
}
|
682 |
}
|
683 |
}
|
684 |
+
$output = '<ul>';
|
685 |
if ( ! empty( $links ) ) {
|
686 |
foreach ( $links as $k => $v ) {
|
687 |
+
if ( $k === 'Feature Manager' ) {
|
688 |
$current = ' class="current"';
|
689 |
} else {
|
690 |
$current = '';
|
691 |
}
|
692 |
+
$output .= "<li{$current}><a href='" . esc_url( $v ) . "'>" . esc_attr( $k ) . '</a></li>';
|
693 |
}
|
694 |
}
|
695 |
+
$output .= '</ul>';
|
696 |
die( sprintf( "jQuery('{$_POST['target']}').fadeOut('fast', function(){jQuery('{$_POST['target']}').html('%s').fadeIn('fast');});", addslashes( $output ) ) );
|
697 |
}
|
698 |
}
|
699 |
|
700 |
if ( ! function_exists( 'aioseop_mrt_pccolumn' ) ) {
|
701 |
+
|
702 |
+
/**
|
703 |
+
* @param $aioseopcn
|
704 |
+
* @param $aioseoppi
|
705 |
+
*/
|
706 |
function aioseop_mrt_pccolumn( $aioseopcn, $aioseoppi ) {
|
707 |
$id = $aioseoppi;
|
708 |
$target = null;
|
709 |
+
if ( $aioseopcn === 'seotitle' ) {
|
710 |
$target = 'title';
|
711 |
}
|
712 |
+
if ( $aioseopcn === 'seokeywords' ) {
|
713 |
$target = 'keywords';
|
714 |
}
|
715 |
+
if ( $aioseopcn === 'seodesc' ) {
|
716 |
$target = 'description';
|
717 |
}
|
718 |
if ( ! $target ) {
|
723 |
<div class="aioseop_mpc_admin_meta_options"
|
724 |
id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
|
725 |
style="float:left;">
|
726 |
+
<?php $content = strip_tags( stripslashes( get_post_meta( $id, '_aioseop_' . $target, true ) ) );
|
727 |
if ( ! empty( $content ) ):
|
728 |
$label = "<label id='aioseop_label_{$target}_{$id}'><span style='width: 20px;display: inline-block;'></span>" . $content . '</label>';
|
729 |
else:
|
730 |
+
$label = "<label id='aioseop_label_{$target}_{$id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __( 'No', 'all-in-one-seo-pack' ) . ' ' . $target . '</i></strong>';
|
731 |
endif;
|
732 |
$nonce = wp_create_nonce( "aioseop_meta_{$target}_{$id}" );
|
733 |
echo '<a id="' . $target . 'editlink' . $id . '" class="aioseop_edit_link" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
|
743 |
}
|
744 |
|
745 |
if ( ! function_exists( 'aioseop_unprotect_meta' ) ) {
|
746 |
+
|
747 |
+
/**
|
748 |
+
* @param $protected
|
749 |
+
* @param $meta_key
|
750 |
+
* @param $meta_type
|
751 |
+
*
|
752 |
+
* @return bool
|
753 |
+
*/
|
754 |
function aioseop_unprotect_meta( $protected, $meta_key, $meta_type ) {
|
755 |
if ( isset( $meta_key ) && ( substr( $meta_key, 0, 9 ) === '_aioseop_' ) ) {
|
756 |
return false;
|
761 |
}
|
762 |
|
763 |
if ( ! function_exists( 'aioseop_mrt_exclude_this_page' ) ) {
|
764 |
+
|
765 |
+
/**
|
766 |
+
* @param null $url
|
767 |
+
*
|
768 |
+
* @return bool
|
769 |
+
*/
|
770 |
function aioseop_mrt_exclude_this_page( $url = null ) {
|
771 |
static $excluded = false;
|
772 |
if ( $excluded === false ) {
|
803 |
}
|
804 |
if ( ! empty( $url ) ) {
|
805 |
foreach ( $excluded as $exedd ) {
|
806 |
+
if ( $exedd && ( stripos( $url, $exedd ) !== false ) ) {
|
807 |
return true;
|
808 |
}
|
809 |
}
|
815 |
}
|
816 |
|
817 |
if ( ! function_exists( 'aioseop_get_pages_start' ) ) {
|
818 |
+
|
819 |
+
/**
|
820 |
+
* @param $excludes
|
821 |
+
*
|
822 |
+
* @return mixed
|
823 |
+
*/
|
824 |
function aioseop_get_pages_start( $excludes ) {
|
825 |
global $aioseop_get_pages_start;
|
826 |
$aioseop_get_pages_start = 1;
|
830 |
}
|
831 |
|
832 |
if ( ! function_exists( 'aioseop_get_pages' ) ) {
|
833 |
+
|
834 |
+
/**
|
835 |
+
* @param $pages
|
836 |
+
*
|
837 |
+
* @return mixed
|
838 |
+
*/
|
839 |
function aioseop_get_pages( $pages ) {
|
840 |
global $aioseop_get_pages_start;
|
841 |
if ( ! $aioseop_get_pages_start ) {
|
856 |
|
857 |
// The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
|
858 |
if ( ! function_exists( 'aioseop_list_pages' ) ) {
|
859 |
+
/**
|
860 |
+
* Adds stuff to the HTML in list_pages.
|
861 |
+
* @TODO See if we still use, or even want, these functions.
|
862 |
+
*
|
863 |
+
* @param $content
|
864 |
+
*
|
865 |
+
* @return mixed
|
866 |
+
*/
|
867 |
function aioseop_list_pages( $content ) {
|
868 |
global $wp_version;
|
869 |
$matches = array();
|
876 |
$pattern = '@<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">@is';
|
877 |
}
|
878 |
|
879 |
+
return preg_replace_callback( $pattern, 'aioseop_filter_callback', $content );
|
880 |
}
|
881 |
|
882 |
return $content;
|
884 |
}
|
885 |
|
886 |
if ( ! function_exists( 'aioseop_filter_callback' ) ) {
|
887 |
+
|
888 |
+
/**
|
889 |
+
* @param $matches
|
890 |
+
*
|
891 |
+
* @return string
|
892 |
+
*/
|
893 |
function aioseop_filter_callback( $matches ) {
|
894 |
if ( $matches[1] && ! empty( $matches[1] ) ) {
|
895 |
$postID = $matches[1];
|
896 |
}
|
897 |
if ( empty( $postID ) ) {
|
898 |
+
$postID = get_option( 'page_on_front' );
|
899 |
}
|
900 |
$title_attrib = stripslashes( get_post_meta( $postID, '_aioseop_titleatr', true ) );
|
901 |
if ( empty( $title_attrib ) && ! empty( $matches[4] ) ) {
|
910 |
}
|
911 |
|
912 |
if ( ! function_exists( 'aioseop_add_contactmethods' ) ) {
|
913 |
+
|
914 |
+
/**
|
915 |
+
* @param $contactmethods
|
916 |
+
*
|
917 |
+
* @return mixed
|
918 |
+
*/
|
919 |
function aioseop_add_contactmethods( $contactmethods ) {
|
920 |
global $aioseop_options, $aioseop_modules;
|
921 |
if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) ) {
|
938 |
}
|
939 |
|
940 |
if ( ! function_exists( 'aioseop_localize_script_data' ) ) {
|
941 |
+
|
942 |
function aioseop_localize_script_data() {
|
943 |
static $loaded = 0;
|
944 |
if ( ! $loaded ) {
|
949 |
}
|
950 |
}
|
951 |
|
|
|
|
|
|
|
952 |
if ( ! function_exists( 'aioseop_array_insert_after' ) ) {
|
953 |
+
/**
|
954 |
+
* Utility function for inserting elements into associative arrays by key.
|
955 |
+
*
|
956 |
+
* @param $arr
|
957 |
+
* @param $insertKey
|
958 |
+
* @param $newValues
|
959 |
+
*
|
960 |
+
* @return array
|
961 |
+
*/
|
962 |
function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
|
963 |
$keys = array_keys( $arr );
|
964 |
$vals = array_values( $arr );
|
974 |
}
|
975 |
}
|
976 |
|
|
|
|
|
|
|
977 |
if ( ! function_exists( 'aioseop_load_json_services' ) ) {
|
978 |
+
/**
|
979 |
+
* JSON support for PHP < 5.2.
|
980 |
+
*
|
981 |
+
* @TODO Do we really need to support < PHP 5.2 with the following functions??
|
982 |
+
* @return null|Services_JSON
|
983 |
+
*/
|
984 |
function aioseop_load_json_services() {
|
985 |
static $services_json = null;
|
986 |
if ( $services_json ) {
|
998 |
}
|
999 |
|
1000 |
if ( ! function_exists( 'json_encode' ) ) {
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* @param $arg
|
1004 |
+
*
|
1005 |
+
* @return mixed
|
1006 |
+
*/
|
1007 |
function json_encode( $arg ) {
|
1008 |
$services_json = aioseop_load_json_services();
|
1009 |
|
1012 |
}
|
1013 |
|
1014 |
if ( ! function_exists( 'json_decode' ) ) {
|
1015 |
+
|
1016 |
+
/**
|
1017 |
+
* @param $arg
|
1018 |
+
*
|
1019 |
+
* @return mixed
|
1020 |
+
*/
|
1021 |
function json_decode( $arg ) {
|
1022 |
$services_json = aioseop_load_json_services();
|
1023 |
|
1025 |
}
|
1026 |
}
|
1027 |
|
|
|
|
|
|
|
1028 |
if ( ! function_exists( 'fnmatch' ) ) {
|
1029 |
+
/**
|
1030 |
+
* Support for fnmatch() doesn't exist on Windows pre PHP 5.3.
|
1031 |
+
*
|
1032 |
+
* @param $pattern
|
1033 |
+
* @param $string
|
1034 |
+
*
|
1035 |
+
* @return int
|
1036 |
+
*/
|
1037 |
function fnmatch( $pattern, $string ) {
|
1038 |
+
return preg_match( '#^' . strtr( preg_quote( $pattern, '#' ), array(
|
1039 |
'\*' => '.*',
|
1040 |
+
'\?' => '.',
|
1041 |
) ) . "$#i", $string );
|
1042 |
}
|
1043 |
}
|
1044 |
|
|
|
|
|
|
|
1045 |
if ( ! function_exists( 'parse_ini_string' ) ) {
|
1046 |
+
/**
|
1047 |
+
* Parse_ini_string() doesn't exist pre PHP 5.3.
|
1048 |
+
*
|
1049 |
+
* @param $string
|
1050 |
+
* @param $process_sections
|
1051 |
+
*
|
1052 |
+
* @return array|bool
|
1053 |
+
*/
|
1054 |
function parse_ini_string( $string, $process_sections ) {
|
1055 |
+
|
1056 |
if ( ! class_exists( 'parse_ini_filter' ) ) {
|
|
|
1057 |
|
1058 |
+
/**
|
1059 |
+
* Class parse_ini_filter
|
1060 |
+
*
|
1061 |
+
* Define our filter class.
|
1062 |
+
*/
|
1063 |
class parse_ini_filter extends php_user_filter {
|
1064 |
static $buf = '';
|
1065 |
|
1066 |
+
/**
|
1067 |
+
* The actual filter for parsing.
|
1068 |
+
*
|
1069 |
+
* @param $in
|
1070 |
+
* @param $out
|
1071 |
+
* @param $consumed
|
1072 |
+
* @param $closing
|
1073 |
+
*
|
1074 |
+
* @return int
|
1075 |
+
*/
|
1076 |
function filter( $in, $out, &$consumed, $closing ) {
|
1077 |
$bucket = stream_bucket_new( fopen( 'php://memory', 'wb' ), self::$buf );
|
1078 |
stream_bucket_append( $out, $bucket );
|
1081 |
}
|
1082 |
}
|
1083 |
|
1084 |
+
// Register our filter with PHP.
|
1085 |
+
if ( ! stream_filter_register( 'parse_ini', 'parse_ini_filter' ) ) {
|
1086 |
return false;
|
1087 |
}
|
1088 |
}
|
1089 |
parse_ini_filter::$buf = $string;
|
1090 |
|
1091 |
+
return parse_ini_file( 'php://filter/read=parse_ini/resource=php://memory', $process_sections );
|
1092 |
}
|
1093 |
}
|
1094 |
|
1095 |
function aioseop_update_user_visibilitynotice() {
|
1096 |
|
1097 |
update_user_meta( get_current_user_id(), 'aioseop_visibility_notice_dismissed', true );
|
|
|
1098 |
}
|
1099 |
|
1100 |
function aioseop_update_yst_detected_notice() {
|
1101 |
|
1102 |
update_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed', true );
|
|
|
1103 |
}
|
1104 |
|
1105 |
function aioseop_woo_upgrade_notice_dismissed() {
|
1106 |
|
1107 |
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
|
|
|
1108 |
}
|
inc/aioseop_updates_class.php
CHANGED
@@ -6,16 +6,15 @@
|
|
6 |
* Handles detection of new plugin version updates, migration of old settings,
|
7 |
* new WP core feature support, etc.
|
8 |
* AIOSEOP Updates class.
|
9 |
-
*
|
10 |
-
* @author Semper Fi Web Design.
|
11 |
-
* @copyright http://semperplugins.com
|
12 |
* @package All-in-One-SEO-Pack.
|
13 |
* @version 1.0.0
|
14 |
*/
|
15 |
-
class
|
16 |
|
17 |
/**
|
18 |
* Constructor
|
|
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
function __construct() {
|
@@ -23,6 +22,7 @@ class aioseop_updates {
|
|
23 |
|
24 |
/**
|
25 |
* Updates version.
|
|
|
26 |
* @since 1.0.0
|
27 |
* @global $aiosp , $aioseop_options.
|
28 |
* @return null
|
@@ -32,25 +32,28 @@ class aioseop_updates {
|
|
32 |
if ( empty( $aioseop_options ) ) {
|
33 |
$aioseop_options = get_option( $aioseop_options );
|
34 |
if ( empty( $aioseop_options ) ) {
|
35 |
-
//
|
36 |
return;
|
37 |
}
|
38 |
}
|
39 |
|
40 |
-
// Last known running plugin version
|
41 |
-
$last_active_version =
|
42 |
-
|
|
|
|
|
43 |
|
44 |
// Compares version to see which one is the newer.
|
45 |
if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
|
46 |
|
47 |
-
// Upgrades based on previous version
|
|
|
48 |
$this->do_version_updates( $last_active_version );
|
49 |
-
|
50 |
// If we're running Pro, let the Pro updater set the version.
|
51 |
if ( ! AIOSEOPPRO ) {
|
52 |
|
53 |
-
// Save the current plugin version as the new last_active_version
|
54 |
$aioseop_options['last_active_version'] = AIOSEOP_VERSION;
|
55 |
$aiosp->update_class_option( $aioseop_options );
|
56 |
}
|
@@ -66,7 +69,9 @@ class aioseop_updates {
|
|
66 |
|
67 |
/**
|
68 |
* Updates version.
|
|
|
69 |
* TODO: the compare here should be extracted into a function
|
|
|
70 |
* @since 1.0.0
|
71 |
* @global $aioseop_options .
|
72 |
*
|
@@ -93,18 +98,19 @@ class aioseop_updates {
|
|
93 |
/**
|
94 |
* Removes overzealous 'DOC' entry which is causing false-positive bad
|
95 |
* bot blocking.
|
|
|
96 |
* @since 2.3.3
|
97 |
* @global $aiosp , $aioseop_options.
|
98 |
*/
|
99 |
function bad_bots_201603() {
|
100 |
global $aiosp, $aioseop_options;
|
101 |
|
102 |
-
// Remove 'DOC' from bad bots list to avoid false positives
|
103 |
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
104 |
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
105 |
$list = str_replace( array(
|
106 |
"DOC\r\n",
|
107 |
-
"DOC\n"
|
108 |
), '', $list );
|
109 |
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
110 |
update_option( 'aioseop_options', $aioseop_options );
|
@@ -126,34 +132,32 @@ class aioseop_updates {
|
|
126 |
$aiosp_reset_htaccess->generate_htaccess_blocklist();
|
127 |
}
|
128 |
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
|
129 |
-
&& extract_from_markers(
|
130 |
-
get_home_path() . '.htaccess',
|
131 |
-
'Bad Bot Blocker' )
|
132 |
) {
|
133 |
-
insert_with_markers(
|
134 |
-
get_home_path() . '.htaccess',
|
135 |
-
'Bad Bot Blocker',
|
136 |
-
''
|
137 |
-
);
|
138 |
}
|
139 |
}
|
140 |
}
|
141 |
|
142 |
-
|
|
|
|
|
143 |
|
144 |
/**
|
145 |
* Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
|
|
|
146 |
* @since 2.3.4.1
|
147 |
* @global $aiosp , $aioseop_options.
|
148 |
*/
|
149 |
function bad_bots_remove_yandex_201604() {
|
150 |
global $aiosp, $aioseop_options;
|
151 |
-
|
|
|
152 |
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
153 |
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
154 |
$list = str_replace( array(
|
155 |
"yandex\r\n",
|
156 |
-
"yandex\n"
|
157 |
), '', $list );
|
158 |
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
159 |
update_option( 'aioseop_options', $aioseop_options );
|
@@ -178,8 +182,13 @@ class aioseop_updates {
|
|
178 |
|
179 |
/**
|
180 |
* Updates features.
|
|
|
181 |
* @since 1.0.0
|
182 |
* @return null
|
|
|
|
|
|
|
|
|
183 |
*/
|
184 |
public function do_feature_updates() {
|
185 |
global $aioseop_options;
|
@@ -199,15 +208,5 @@ class aioseop_updates {
|
|
199 |
apply_filters( 'aioseop_update_check_time', 3600 * 6 )
|
200 |
);
|
201 |
}
|
202 |
-
|
203 |
-
|
204 |
-
/*
|
205 |
-
if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
|
206 |
-
$aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
|
207 |
-
$this->some_feature_update_method(); // sets flag to 'yes' on completion.
|
208 |
-
}
|
209 |
-
*/
|
210 |
}
|
211 |
-
|
212 |
-
|
213 |
}
|
6 |
* Handles detection of new plugin version updates, migration of old settings,
|
7 |
* new WP core feature support, etc.
|
8 |
* AIOSEOP Updates class.
|
9 |
+
*
|
|
|
|
|
10 |
* @package All-in-One-SEO-Pack.
|
11 |
* @version 1.0.0
|
12 |
*/
|
13 |
+
class AIOSEOP_Updates {
|
14 |
|
15 |
/**
|
16 |
* Constructor
|
17 |
+
*
|
18 |
* @since 1.0.0
|
19 |
*/
|
20 |
function __construct() {
|
22 |
|
23 |
/**
|
24 |
* Updates version.
|
25 |
+
*
|
26 |
* @since 1.0.0
|
27 |
* @global $aiosp , $aioseop_options.
|
28 |
* @return null
|
32 |
if ( empty( $aioseop_options ) ) {
|
33 |
$aioseop_options = get_option( $aioseop_options );
|
34 |
if ( empty( $aioseop_options ) ) {
|
35 |
+
// Something's wrong. bail.
|
36 |
return;
|
37 |
}
|
38 |
}
|
39 |
|
40 |
+
// Last known running plugin version.
|
41 |
+
$last_active_version = '0.0';
|
42 |
+
if ( isset( $aioseop_options['last_active_version'] ) ) {
|
43 |
+
$last_active_version = $aioseop_options['last_active_version'];
|
44 |
+
}
|
45 |
|
46 |
// Compares version to see which one is the newer.
|
47 |
if ( version_compare( $last_active_version, AIOSEOP_VERSION, '<' ) ) {
|
48 |
|
49 |
+
// Upgrades based on previous version.
|
50 |
+
do_action( 'before_doing_aioseop_updates' );
|
51 |
$this->do_version_updates( $last_active_version );
|
52 |
+
do_action( 'after_doing_aioseop_updates' );
|
53 |
// If we're running Pro, let the Pro updater set the version.
|
54 |
if ( ! AIOSEOPPRO ) {
|
55 |
|
56 |
+
// Save the current plugin version as the new last_active_version.
|
57 |
$aioseop_options['last_active_version'] = AIOSEOP_VERSION;
|
58 |
$aiosp->update_class_option( $aioseop_options );
|
59 |
}
|
69 |
|
70 |
/**
|
71 |
* Updates version.
|
72 |
+
*
|
73 |
* TODO: the compare here should be extracted into a function
|
74 |
+
*
|
75 |
* @since 1.0.0
|
76 |
* @global $aioseop_options .
|
77 |
*
|
98 |
/**
|
99 |
* Removes overzealous 'DOC' entry which is causing false-positive bad
|
100 |
* bot blocking.
|
101 |
+
|
102 |
* @since 2.3.3
|
103 |
* @global $aiosp , $aioseop_options.
|
104 |
*/
|
105 |
function bad_bots_201603() {
|
106 |
global $aiosp, $aioseop_options;
|
107 |
|
108 |
+
// Remove 'DOC' from bad bots list to avoid false positives.
|
109 |
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
110 |
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
111 |
$list = str_replace( array(
|
112 |
"DOC\r\n",
|
113 |
+
"DOC\n",
|
114 |
), '', $list );
|
115 |
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
116 |
update_option( 'aioseop_options', $aioseop_options );
|
132 |
$aiosp_reset_htaccess->generate_htaccess_blocklist();
|
133 |
}
|
134 |
if ( ! isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_htaccess_rules'] )
|
135 |
+
&& extract_from_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker' )
|
|
|
|
|
136 |
) {
|
137 |
+
insert_with_markers( get_home_path() . '.htaccess', 'Bad Bot Blocker', '' );
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
/*
|
143 |
+
* Functions for specific version milestones.
|
144 |
+
*/
|
145 |
|
146 |
/**
|
147 |
* Remove 'yandex' entry. This is a major Russian search engine, and no longer needs to be blocked.
|
148 |
+
*
|
149 |
* @since 2.3.4.1
|
150 |
* @global $aiosp , $aioseop_options.
|
151 |
*/
|
152 |
function bad_bots_remove_yandex_201604() {
|
153 |
global $aiosp, $aioseop_options;
|
154 |
+
|
155 |
+
// Remove 'yandex' from bad bots list to avoid false positives.
|
156 |
if ( isset( $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] ) ) {
|
157 |
$list = $aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'];
|
158 |
$list = str_replace( array(
|
159 |
"yandex\r\n",
|
160 |
+
"yandex\n",
|
161 |
), '', $list );
|
162 |
$aioseop_options['modules']['aiosp_bad_robots_options']['aiosp_bad_robots_blocklist'] = $list;
|
163 |
update_option( 'aioseop_options', $aioseop_options );
|
182 |
|
183 |
/**
|
184 |
* Updates features.
|
185 |
+
|
186 |
* @since 1.0.0
|
187 |
* @return null
|
188 |
+
*
|
189 |
+
* if ( ! ( isset( $aioseop_options['version_feature_flags']['FEATURE_NAME'] ) &&
|
190 |
+
* $aioseop_options['version_feature_flags']['FEATURE_NAME'] === 'yes' ) ) {
|
191 |
+
* $this->some_feature_update_method(); // sets flag to 'yes' on completion.
|
192 |
*/
|
193 |
public function do_feature_updates() {
|
194 |
global $aioseop_options;
|
208 |
apply_filters( 'aioseop_update_check_time', 3600 * 6 )
|
209 |
);
|
210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
|
|
|
|
212 |
}
|
inc/commonstrings.php
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
* Class AIOSP_Common_Strings
|
5 |
*
|
6 |
* This is just for Pro strings to be translated.
|
7 |
*
|
|
|
8 |
*/
|
|
|
9 |
class AIOSP_Common_Strings {
|
10 |
|
11 |
/**
|
12 |
* AIOSP_Common_Strings constructor.
|
13 |
*
|
14 |
* We'll just put all the strings in the contruct for lack of a better.
|
15 |
-
*
|
16 |
*/
|
|
|
17 |
private function __construct() {
|
18 |
|
19 |
-
//
|
20 |
__( 'Video Sitemap', 'all-in-one-seo-pack' );
|
21 |
__( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
|
22 |
__( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
|
@@ -27,10 +28,10 @@ class AIOSP_Common_Strings {
|
|
27 |
__( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' );
|
28 |
__( 'Scan', 'all-in-one-seo-pack' );
|
29 |
|
30 |
-
//functions_class strings
|
31 |
__( 'Finished scanning posts', 'all-in-one-seo-pack' );
|
32 |
|
33 |
-
//
|
34 |
__( 'Purchase one now', 'all-in-one-seo-pack' );
|
35 |
__( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
|
36 |
__( ' Need a license key?', 'all-in-one-seo-pack' );
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Class AIOSP_Common_Strings
|
4 |
*
|
5 |
* This is just for Pro strings to be translated.
|
6 |
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
*/
|
9 |
+
|
10 |
class AIOSP_Common_Strings {
|
11 |
|
12 |
/**
|
13 |
* AIOSP_Common_Strings constructor.
|
14 |
*
|
15 |
* We'll just put all the strings in the contruct for lack of a better.
|
|
|
16 |
*/
|
17 |
+
|
18 |
private function __construct() {
|
19 |
|
20 |
+
// Video sitemap strings.
|
21 |
__( 'Video Sitemap', 'all-in-one-seo-pack' );
|
22 |
__( 'Show Only Posts With Videos', 'all-in-one-seo-pack' );
|
23 |
__( 'Scan Posts For Videos', 'all-in-one-seo-pack' );
|
28 |
__( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' );
|
29 |
__( 'Scan', 'all-in-one-seo-pack' );
|
30 |
|
31 |
+
// These are functions_class strings.
|
32 |
__( 'Finished scanning posts', 'all-in-one-seo-pack' );
|
33 |
|
34 |
+
// Update checker strings (incomplete... need to separate out html).
|
35 |
__( 'Purchase one now', 'all-in-one-seo-pack' );
|
36 |
__( 'License Key is not set yet or invalid. ', 'all-in-one-seo-pack' );
|
37 |
__( ' Need a license key?', 'all-in-one-seo-pack' );
|
inc/compatability/compat-init.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Initiates compatibility code with other plugins/themes
|
4 |
+
*
|
5 |
+
* Eventually we'll have subclasses for each.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
* @since 2.3.6
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Compatibility' ) ) {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class All_in_One_SEO_Pack_Compatibility
|
15 |
+
*
|
16 |
+
* @since 2.3.6
|
17 |
+
*/
|
18 |
+
class All_in_One_SEO_Pack_Compatibility {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* All_in_One_SEO_Pack_Compatibility constructor.
|
22 |
+
*
|
23 |
+
* @since 2.3.6
|
24 |
+
*/
|
25 |
+
public function __construct() {
|
26 |
+
|
27 |
+
$this->load_compatibility_classes();
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Load Compatibility Hooks.
|
33 |
+
*
|
34 |
+
* @since 2.3.6
|
35 |
+
*/
|
36 |
+
public function load_compatibility_hooks() {
|
37 |
+
// We'll use this until we set up our classes.
|
38 |
+
if ( class_exists( 'jetpack' ) ) {
|
39 |
+
add_filter( 'jetpack_get_available_modules', array( $this, 'remove_jetpack_sitemap' ) );
|
40 |
+
add_filter( 'jetpack_site_verification_output', array(
|
41 |
+
$this,
|
42 |
+
'filter_jetpack_site_verification_output',
|
43 |
+
), 10, 1 );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Filter Jetpack's site verification.
|
49 |
+
*
|
50 |
+
* If we have a value for a particular verification, use ours.
|
51 |
+
*
|
52 |
+
* @param $ver_tag
|
53 |
+
*
|
54 |
+
* @since 2.3.7
|
55 |
+
*
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
function filter_jetpack_site_verification_output( $ver_tag ) {
|
59 |
+
|
60 |
+
global $aioseop_options;
|
61 |
+
|
62 |
+
if ( isset( $aioseop_options['aiosp_pinterest_verify'] ) && ! empty( $aioseop_options['aiosp_pinterest_verify'] ) && strpos( $ver_tag, 'p:domain_verify' ) ) {
|
63 |
+
return '';
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( isset( $aioseop_options['aiosp_google_verify'] ) && ! empty( $aioseop_options['aiosp_google_verify'] ) && strpos( $ver_tag, 'google-site-verification' ) ) {
|
68 |
+
return '';
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( isset( $aioseop_options['aiosp_bing_verify'] ) && ! empty( $aioseop_options['aiosp_bing_verify'] ) && strpos( $ver_tag, 'msvalidate.01' ) ) {
|
72 |
+
return '';
|
73 |
+
}
|
74 |
+
|
75 |
+
return $ver_tag;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Remove Jetpack's sitemap.
|
81 |
+
*
|
82 |
+
* @param array $modules All the Jetpack modules.
|
83 |
+
*
|
84 |
+
* @since 2.3.6
|
85 |
+
* @since 2.3.6.1 Make sure we only disable Jetpack's sitemap if they're using ours.
|
86 |
+
*
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function remove_jetpack_sitemap( $modules ) {
|
90 |
+
|
91 |
+
global $aioseop_options;
|
92 |
+
// Check if AIOSEOP's sitemap exists.
|
93 |
+
if ( isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] === 'on' ) {
|
94 |
+
unset( $modules['sitemaps'] ); // Remove Jetpack's sitemap.
|
95 |
+
}
|
96 |
+
|
97 |
+
return $modules;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Load Compatibility classes.
|
102 |
+
*
|
103 |
+
* @since 2.3.6
|
104 |
+
*/
|
105 |
+
public function load_compatibility_classes() {
|
106 |
+
// Eventually we'll load our other classes from here.
|
107 |
+
$this->load_compatibility_hooks();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
$aiosp_compat = new All_in_One_SEO_Pack_Compatibility();
|
inc/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
inc/sitemap-xsl.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitemap XSL.
|
4 |
+
*
|
5 |
+
* Dynamically generates the XML Sitemap's XSL file.
|
6 |
+
*
|
7 |
+
* @package All-in-One-SEO-Pack
|
8 |
+
*
|
9 |
+
* @since 2.3.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
13 |
+
?>
|
14 |
+
<xsl:stylesheet version="2.0"
|
15 |
+
xmlns:html="http://www.w3.org/TR/REC-html40"
|
16 |
+
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
17 |
+
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
18 |
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
19 |
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
20 |
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
21 |
+
<xsl:template match="/">
|
22 |
+
<xsl:variable name="fileType">
|
23 |
+
<xsl:choose>
|
24 |
+
<xsl:when test="//sitemap:url">Sitemap</xsl:when>
|
25 |
+
<xsl:otherwise>SitemapIndex</xsl:otherwise>
|
26 |
+
</xsl:choose>
|
27 |
+
</xsl:variable>
|
28 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
29 |
+
<head>
|
30 |
+
<title>
|
31 |
+
<xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
|
32 |
+
<xsl:otherwise>Sitemap Index</xsl:otherwise>
|
33 |
+
</xsl:choose>
|
34 |
+
</title>
|
35 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
36 |
+
<style type="text/css">
|
37 |
+
body {
|
38 |
+
margin: 0;
|
39 |
+
font-family: Helvetica, Arial, sans-serif;
|
40 |
+
font-size: 68.5%;
|
41 |
+
}
|
42 |
+
#content-head {
|
43 |
+
background-color: #4275f4;
|
44 |
+
padding: 20px 40px;
|
45 |
+
}
|
46 |
+
#content-head h1,
|
47 |
+
#content-head p,
|
48 |
+
#content-head a {
|
49 |
+
color: #fff;
|
50 |
+
font-size: 1.2em;
|
51 |
+
}
|
52 |
+
#content-head h1 {
|
53 |
+
font-size: 2em;
|
54 |
+
}
|
55 |
+
table {
|
56 |
+
margin: 20px 40px;
|
57 |
+
border: none;
|
58 |
+
border-collapse: collapse;
|
59 |
+
}
|
60 |
+
table {
|
61 |
+
font-size: 1em;
|
62 |
+
width: 75%;
|
63 |
+
}
|
64 |
+
th {
|
65 |
+
border-bottom: 1px solid #ccc;
|
66 |
+
text-align: left;
|
67 |
+
padding: 15px 5px;
|
68 |
+
font-size: 14px;
|
69 |
+
}
|
70 |
+
td {
|
71 |
+
padding: 10px 5px;
|
72 |
+
border-left: 3px solid #fff;
|
73 |
+
}
|
74 |
+
tr.stripe {
|
75 |
+
background-color: #f7f7f7;
|
76 |
+
}
|
77 |
+
</style>
|
78 |
+
</head>
|
79 |
+
<body>
|
80 |
+
<div id="content">
|
81 |
+
<div id="content-head">
|
82 |
+
<h1>XML Sitemap</h1>
|
83 |
+
<p>Generated by <a href="https://semperplugins.com">All in One </a> <a href="https://semperplugins.com/all-in-one-seo-pack-pro-version/">SEO</a>, this is an XML Sitemap, meant to be consumed by search engines like Google or Bing.<br/>
|
84 |
+
You can find more information about XML sitemaps at <a href="http://sitemaps.org">sitemaps.org</a>.</p>
|
85 |
+
<p><xsl:choose>
|
86 |
+
<xsl:when test="$fileType='Sitemap'">
|
87 |
+
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
|
88 |
+
<xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
|
89 |
+
</xsl:choose></p>
|
90 |
+
</div>
|
91 |
+
<xsl:choose>
|
92 |
+
<xsl:when test="$fileType='Sitemap'">
|
93 |
+
<xsl:call-template name="sitemapTable"/></xsl:when>
|
94 |
+
<xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
|
95 |
+
</xsl:choose>
|
96 |
+
|
97 |
+
</div>
|
98 |
+
</body>
|
99 |
+
</html>
|
100 |
+
</xsl:template>
|
101 |
+
<xsl:template name="siteindexTable">
|
102 |
+
<table cellpadding="3">
|
103 |
+
<thead>
|
104 |
+
<tr>
|
105 |
+
<th width="50%">URL</th>
|
106 |
+
<th>LastChange</th>
|
107 |
+
</tr>
|
108 |
+
</thead>
|
109 |
+
<tbody>
|
110 |
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
111 |
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
112 |
+
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
113 |
+
<tr>
|
114 |
+
<xsl:if test="position() mod 2 != 1">
|
115 |
+
<xsl:attribute name="class">stripe</xsl:attribute>
|
116 |
+
</xsl:if>
|
117 |
+
<td>
|
118 |
+
<xsl:variable name="itemURL">
|
119 |
+
<xsl:value-of select="sitemap:loc"/>
|
120 |
+
</xsl:variable>
|
121 |
+
<a href="{$itemURL}">
|
122 |
+
<xsl:value-of select="sitemap:loc"/>
|
123 |
+
</a>
|
124 |
+
</td>
|
125 |
+
<td>
|
126 |
+
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</xsl:for-each>
|
130 |
+
</tbody>
|
131 |
+
</table>
|
132 |
+
</xsl:template>
|
133 |
+
<xsl:template name="sitemapTable">
|
134 |
+
<table cellpadding="3">
|
135 |
+
<thead>
|
136 |
+
<tr>
|
137 |
+
<th width="50%">URL</th>
|
138 |
+
<th>Priority</th>
|
139 |
+
<th>Change Frequency</th>
|
140 |
+
<th>LastChange</th>
|
141 |
+
</tr>
|
142 |
+
</thead>
|
143 |
+
<tbody>
|
144 |
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
145 |
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
146 |
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
147 |
+
<tr>
|
148 |
+
<xsl:if test="position() mod 2 != 1">
|
149 |
+
<xsl:attribute name="class">stripe</xsl:attribute>
|
150 |
+
</xsl:if>
|
151 |
+
<td>
|
152 |
+
<xsl:variable name="itemURL">
|
153 |
+
<xsl:value-of select="sitemap:loc"/>
|
154 |
+
</xsl:variable>
|
155 |
+
<a href="{$itemURL}">
|
156 |
+
<xsl:value-of select="sitemap:loc"/>
|
157 |
+
</a>
|
158 |
+
<xsl:variable name="thumbURL">
|
159 |
+
<xsl:value-of select="video:video/video:thumbnail_loc"/>
|
160 |
+
</xsl:variable>
|
161 |
+
<xsl:variable name="playURL">
|
162 |
+
<xsl:value-of select="video:video/video:player_loc"/>
|
163 |
+
</xsl:variable>
|
164 |
+
<xsl:if test="$thumbURL != ''">
|
165 |
+
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
|
166 |
+
</xsl:if>
|
167 |
+
</td>
|
168 |
+
<td>
|
169 |
+
<xsl:if test="string(number(sitemap:priority))!='NaN'">
|
170 |
+
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
171 |
+
</xsl:if>
|
172 |
+
</td>
|
173 |
+
<td>
|
174 |
+
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
175 |
+
</td>
|
176 |
+
<td>
|
177 |
+
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
178 |
+
</td>
|
179 |
+
<td>
|
180 |
+
|
181 |
+
|
182 |
+
|
183 |
+
</td>
|
184 |
+
</tr>
|
185 |
+
</xsl:for-each>
|
186 |
+
</tbody>
|
187 |
+
</table>
|
188 |
+
</xsl:template>
|
189 |
+
</xsl:stylesheet>
|
190 |
+
<?php
|
inc/translations.php
CHANGED
@@ -50,12 +50,17 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
|
|
50 |
* Fetch locale data from WP.
|
51 |
*
|
52 |
* @since 2.3.5
|
|
|
53 |
*
|
54 |
* @return mixed
|
55 |
*/
|
56 |
private function get_locale_data() {
|
57 |
$response = wp_remote_get( $this->url );
|
58 |
|
|
|
|
|
|
|
|
|
59 |
return $response['body'];
|
60 |
}
|
61 |
|
@@ -142,12 +147,17 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
|
|
142 |
/**
|
143 |
*
|
144 |
* @since 2.3.5
|
|
|
145 |
*
|
146 |
*/
|
147 |
private function init() {
|
148 |
|
149 |
$json = $this->get_locale_data();
|
150 |
|
|
|
|
|
|
|
|
|
151 |
$translation_data = json_decode( $json );
|
152 |
|
153 |
$locales = $translation_data->translation_sets;
|
50 |
* Fetch locale data from WP.
|
51 |
*
|
52 |
* @since 2.3.5
|
53 |
+
* @since 2.3.6 Return FALSE on WP_Error object.
|
54 |
*
|
55 |
* @return mixed
|
56 |
*/
|
57 |
private function get_locale_data() {
|
58 |
$response = wp_remote_get( $this->url );
|
59 |
|
60 |
+
if ( is_wp_error( $response ) ) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
return $response['body'];
|
65 |
}
|
66 |
|
147 |
/**
|
148 |
*
|
149 |
* @since 2.3.5
|
150 |
+
* @since 2.3.6 Return FALSE on WP_Error object in get_locale_data().
|
151 |
*
|
152 |
*/
|
153 |
private function init() {
|
154 |
|
155 |
$json = $this->get_locale_data();
|
156 |
|
157 |
+
if ( $json === false ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
$translation_data = json_decode( $json );
|
162 |
|
163 |
$locales = $translation_data->translation_sets;
|
index.php
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
modules/aioseop_bad_robots.php
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
*/
|
5 |
|
6 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
|
7 |
/**
|
8 |
* Class All_in_One_SEO_Pack_Bad_Robots
|
9 |
*/
|
@@ -13,12 +14,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
13 |
* All_in_One_SEO_Pack_Bad_Robots constructor.
|
14 |
*/
|
15 |
function __construct() {
|
16 |
-
$this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
17 |
-
$this->prefix = 'aiosp_bad_robots_'; //
|
18 |
-
$this->file = __FILE__; //
|
19 |
parent::__construct();
|
20 |
|
21 |
-
$help_text =
|
22 |
'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
|
23 |
'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
|
24 |
'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
|
@@ -30,47 +31,47 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
30 |
);
|
31 |
|
32 |
$this->default_options = array(
|
33 |
-
'block_bots' =>
|
34 |
-
'block_refer' =>
|
35 |
-
'track_blocks' =>
|
36 |
-
'htaccess_rules' =>
|
37 |
-
'edit_blocks' =>
|
38 |
-
'blocklist' =>
|
39 |
'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
|
40 |
'type' => 'textarea',
|
41 |
'rows' => 5,
|
42 |
'cols' => 120,
|
43 |
-
'condshow' =>
|
44 |
-
'default' => join( "\n", $this->default_bad_bots() )
|
45 |
),
|
46 |
-
'referlist' =>
|
47 |
'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ),
|
48 |
'type' => 'textarea',
|
49 |
'rows' => 5,
|
50 |
'cols' => 120,
|
51 |
-
'condshow' =>
|
52 |
"{$this->prefix}edit_blocks" => 'on',
|
53 |
"{$this->prefix}block_refer" => 'on',
|
54 |
),
|
55 |
-
'default' => join( "\n", $this->default_bad_referers() )
|
56 |
),
|
57 |
-
'blocked_log' =>
|
58 |
'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ),
|
59 |
'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ),
|
60 |
-
'type' => '
|
61 |
'disabled' => 'disabled',
|
62 |
'save' => false,
|
63 |
'label' => 'top',
|
64 |
'rows' => 5,
|
65 |
'cols' => 120,
|
66 |
'style' => 'min-width:950px',
|
67 |
-
'condshow' =>
|
68 |
-
)
|
69 |
);
|
70 |
$is_apache = false;
|
71 |
if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
|
72 |
$is_apache = true;
|
73 |
-
add_action( $this->prefix . 'settings_update',
|
74 |
} else {
|
75 |
unset( $this->default_options['htaccess_rules'] );
|
76 |
unset( $help_text['htaccess_rules'] );
|
@@ -82,34 +83,60 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
82 |
}
|
83 |
}
|
84 |
|
85 |
-
add_filter( $this->prefix . 'display_options',
|
86 |
|
87 |
-
//
|
88 |
$this->update_options();
|
89 |
|
90 |
if ( $this->option_isset( 'edit_blocks' ) ) {
|
91 |
-
add_filter( $this->prefix . 'badbotlist',
|
92 |
if ( $this->option_isset( 'block_refer' ) ) {
|
93 |
-
add_filter( $this->prefix . 'badreferlist',
|
94 |
}
|
95 |
}
|
96 |
|
97 |
if ( $this->option_isset( 'block_bots' ) ) {
|
98 |
if ( ! $this->allow_bot() ) {
|
99 |
status_header( 503 );
|
100 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
101 |
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
102 |
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) );
|
103 |
exit();
|
104 |
} elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
|
105 |
status_header( 503 );
|
106 |
-
$ip = $_SERVER['REMOTE_ADDR'];
|
107 |
$referer = $_SERVER['HTTP_REFERER'];
|
108 |
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) );
|
109 |
}
|
110 |
}
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
function generate_htaccess_blocklist() {
|
114 |
if ( ! $this->option_isset( 'htaccess_rules' ) ) {
|
115 |
|
@@ -125,7 +152,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
125 |
|
126 |
if ( function_exists( 'apache_get_modules' ) ) {
|
127 |
$modules = apache_get_modules();
|
128 |
-
foreach (
|
129 |
if ( ! in_array( $m, $modules ) ) {
|
130 |
aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
|
131 |
}
|
@@ -135,7 +162,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
135 |
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
136 |
if ( ! empty( $botlist ) ) {
|
137 |
$regex = $this->quote_list_for_regex( $botlist, '"' );
|
138 |
-
$htaccess =
|
139 |
$htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
|
140 |
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
|
141 |
$referlist = $this->default_bad_referers();
|
@@ -184,17 +211,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
184 |
|
185 |
|
186 |
/**
|
|
|
|
|
187 |
* @param string $msg
|
188 |
*/
|
189 |
function blocked_message( $msg ) {
|
190 |
-
/** Updates blocked log messages. **/
|
191 |
if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
|
192 |
$this->options["{$this->prefix}blocked_log"] = '';
|
193 |
}
|
194 |
$this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
|
195 |
if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
|
196 |
$end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
|
197 |
-
if (
|
198 |
$end = 4096;
|
199 |
}
|
200 |
$this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
|
@@ -204,14 +232,20 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
|
204 |
|
205 |
|
206 |
/**
|
|
|
|
|
|
|
|
|
207 |
* @param $options
|
208 |
*
|
209 |
* @return mixed
|
210 |
*/
|
211 |
function filter_display_options( $options ) {
|
212 |
-
|
213 |
if ( $this->option_isset( 'blocked_log' ) ) {
|
214 |
-
|
|
|
|
|
215 |
}
|
216 |
|
217 |
return $options;
|
4 |
*/
|
5 |
|
6 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Bad_Robots' ) ) {
|
7 |
+
|
8 |
/**
|
9 |
* Class All_in_One_SEO_Pack_Bad_Robots
|
10 |
*/
|
14 |
* All_in_One_SEO_Pack_Bad_Robots constructor.
|
15 |
*/
|
16 |
function __construct() {
|
17 |
+
$this->name = __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
18 |
+
$this->prefix = 'aiosp_bad_robots_'; // Option prefix.
|
19 |
+
$this->file = __FILE__; // The current file.
|
20 |
parent::__construct();
|
21 |
|
22 |
+
$help_text = array(
|
23 |
'block_bots' => __( 'Block requests from user agents that are known to misbehave with 503.', 'all-in-one-seo-pack' ),
|
24 |
'block_refer' => __( 'Block Referral Spam using HTTP.', 'all-in-one-seo-pack' ),
|
25 |
'track_blocks' => __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
|
31 |
);
|
32 |
|
33 |
$this->default_options = array(
|
34 |
+
'block_bots' => array( 'name' => __( 'Block Bad Bots using HTTP', 'all-in-one-seo-pack' ) ),
|
35 |
+
'block_refer' => array( 'name' => __( 'Block Referral Spam using HTTP', 'all-in-one-seo-pack' ) ),
|
36 |
+
'track_blocks' => array( 'name' => __( 'Track Blocked Bots', 'all-in-one-seo-pack' ) ),
|
37 |
+
'htaccess_rules' => array( 'name' => __( 'Block Bad Bots using .htaccess', 'all-in-one-seo-pack' ) ),
|
38 |
+
'edit_blocks' => array( 'name' => __( 'Use Custom Blocklists', 'all-in-one-seo-pack' ) ),
|
39 |
+
'blocklist' => array(
|
40 |
'name' => __( 'User Agent Blocklist', 'all-in-one-seo-pack' ),
|
41 |
'type' => 'textarea',
|
42 |
'rows' => 5,
|
43 |
'cols' => 120,
|
44 |
+
'condshow' => array( "{$this->prefix}edit_blocks" => 'on' ),
|
45 |
+
'default' => join( "\n", $this->default_bad_bots() ),
|
46 |
),
|
47 |
+
'referlist' => array(
|
48 |
'name' => __( 'Referer Blocklist', 'all-in-one-seo-pack' ),
|
49 |
'type' => 'textarea',
|
50 |
'rows' => 5,
|
51 |
'cols' => 120,
|
52 |
+
'condshow' => array(
|
53 |
"{$this->prefix}edit_blocks" => 'on',
|
54 |
"{$this->prefix}block_refer" => 'on',
|
55 |
),
|
56 |
+
'default' => join( "\n", $this->default_bad_referers() ),
|
57 |
),
|
58 |
+
'blocked_log' => array(
|
59 |
'name' => __( 'Log Of Blocked Bots', 'all-in-one-seo-pack' ),
|
60 |
'default' => __( 'No requests yet.', 'all-in-one-seo-pack' ),
|
61 |
+
'type' => 'esc_html',
|
62 |
'disabled' => 'disabled',
|
63 |
'save' => false,
|
64 |
'label' => 'top',
|
65 |
'rows' => 5,
|
66 |
'cols' => 120,
|
67 |
'style' => 'min-width:950px',
|
68 |
+
'condshow' => array( "{$this->prefix}track_blocks" => 'on' ),
|
69 |
+
),
|
70 |
);
|
71 |
$is_apache = false;
|
72 |
if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) && stristr( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false ) {
|
73 |
$is_apache = true;
|
74 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'generate_htaccess_blocklist' ), 10 );
|
75 |
} else {
|
76 |
unset( $this->default_options['htaccess_rules'] );
|
77 |
unset( $help_text['htaccess_rules'] );
|
83 |
}
|
84 |
}
|
85 |
|
86 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) );
|
87 |
|
88 |
+
// Load initial options / set defaults,
|
89 |
$this->update_options();
|
90 |
|
91 |
if ( $this->option_isset( 'edit_blocks' ) ) {
|
92 |
+
add_filter( $this->prefix . 'badbotlist', array( $this, 'filter_bad_botlist' ) );
|
93 |
if ( $this->option_isset( 'block_refer' ) ) {
|
94 |
+
add_filter( $this->prefix . 'badreferlist', array( $this, 'filter_bad_referlist' ) );
|
95 |
}
|
96 |
}
|
97 |
|
98 |
if ( $this->option_isset( 'block_bots' ) ) {
|
99 |
if ( ! $this->allow_bot() ) {
|
100 |
status_header( 503 );
|
101 |
+
$ip = $this->validate_ip( $_SERVER['REMOTE_ADDR'] );
|
102 |
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
103 |
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched user agent %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $user_agent ) );
|
104 |
exit();
|
105 |
} elseif ( $this->option_isset( 'block_refer' ) && $this->is_bad_referer() ) {
|
106 |
status_header( 503 );
|
107 |
+
$ip = $this->validate_ip( $_SERVER['REMOTE_ADDR'] );
|
108 |
$referer = $_SERVER['HTTP_REFERER'];
|
109 |
$this->blocked_message( sprintf( __( 'Blocked bot with IP %s -- matched referer %s found in blocklist.', 'all-in-one-seo-pack' ), $ip, $referer ) );
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
|
114 |
+
/**
|
115 |
+
* Validate IP.
|
116 |
+
*
|
117 |
+
* @param $ip
|
118 |
+
*
|
119 |
+
* @since 2.3.7
|
120 |
+
*
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
function validate_ip( $ip ) {
|
124 |
+
|
125 |
+
if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
|
126 |
+
// Valid IPV4.
|
127 |
+
return $ip;
|
128 |
+
}
|
129 |
+
|
130 |
+
if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
|
131 |
+
// Valid IPV6.
|
132 |
+
return $ip;
|
133 |
+
}
|
134 |
+
|
135 |
+
// Doesn't seem to be a valid IP.
|
136 |
+
return 'invalid IP submitted';
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
function generate_htaccess_blocklist() {
|
141 |
if ( ! $this->option_isset( 'htaccess_rules' ) ) {
|
142 |
|
152 |
|
153 |
if ( function_exists( 'apache_get_modules' ) ) {
|
154 |
$modules = apache_get_modules();
|
155 |
+
foreach ( array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
|
156 |
if ( ! in_array( $m, $modules ) ) {
|
157 |
aioseop_output_notice( sprintf( __( 'Apache module %s is required!', 'all-in-one-seo-pack' ), $m ), '', 'error' );
|
158 |
}
|
162 |
$botlist = apply_filters( $this->prefix . 'badbotlist', $botlist );
|
163 |
if ( ! empty( $botlist ) ) {
|
164 |
$regex = $this->quote_list_for_regex( $botlist, '"' );
|
165 |
+
$htaccess = array();
|
166 |
$htaccess[] = 'SetEnvIfNoCase User-Agent "' . $regex . '" bad_bot';
|
167 |
if ( $this->option_isset( 'edit_blocks' ) && $this->option_isset( 'block_refer' ) && $this->option_isset( 'referlist' ) ) {
|
168 |
$referlist = $this->default_bad_referers();
|
211 |
|
212 |
|
213 |
/**
|
214 |
+
* Updates blocked message.
|
215 |
+
*
|
216 |
* @param string $msg
|
217 |
*/
|
218 |
function blocked_message( $msg ) {
|
|
|
219 |
if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) {
|
220 |
$this->options["{$this->prefix}blocked_log"] = '';
|
221 |
}
|
222 |
$this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
|
223 |
if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
|
224 |
$end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
|
225 |
+
if ( false === $end ) {
|
226 |
$end = 4096;
|
227 |
}
|
228 |
$this->options["{$this->prefix}blocked_log"] = $this->substr( $this->options["{$this->prefix}blocked_log"], 0, $end );
|
232 |
|
233 |
|
234 |
/**
|
235 |
+
* Filter display options.
|
236 |
+
*
|
237 |
+
* Add in options for status display on settings page, sitemap rewriting on multisite.
|
238 |
+
*
|
239 |
* @param $options
|
240 |
*
|
241 |
* @return mixed
|
242 |
*/
|
243 |
function filter_display_options( $options ) {
|
244 |
+
|
245 |
if ( $this->option_isset( 'blocked_log' ) ) {
|
246 |
+
if ( preg_match( '/\<(\?php|script)/', $options["{$this->prefix}blocked_log"] ) ) {
|
247 |
+
$options["{$this->prefix}blocked_log"] = "Probable XSS attempt detected!\n" . $options["{$this->prefix}blocked_log"];
|
248 |
+
}
|
249 |
}
|
250 |
|
251 |
return $options;
|
modules/aioseop_feature_manager.php
CHANGED
@@ -1,139 +1,162 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Feature Manager class.
|
|
|
|
|
7 |
*/
|
|
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
|
|
|
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
protected $module_info =
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
function __construct( $mod ) {
|
14 |
-
$this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
15 |
-
$this->prefix = 'aiosp_feature_manager_'; //
|
16 |
-
$this->file = __FILE__; //
|
17 |
parent::__construct();
|
18 |
-
$this->module_info =
|
19 |
-
'sitemap' =>
|
20 |
'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
|
21 |
-
'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' )
|
22 |
),
|
23 |
-
'opengraph' =>
|
24 |
'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
|
25 |
-
'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' )
|
26 |
),
|
27 |
-
'robots' =>
|
28 |
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
|
29 |
-
'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' )
|
30 |
),
|
31 |
-
'file_editor' =>
|
32 |
'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
|
33 |
-
'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' )
|
34 |
),
|
35 |
-
'importer_exporter' =>
|
36 |
'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
|
37 |
-
'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' )
|
38 |
),
|
39 |
-
'bad_robots' =>
|
40 |
'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
|
41 |
-
'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' )
|
42 |
),
|
43 |
-
'performance' =>
|
44 |
'name' => __( 'Performance', 'all-in-one-seo-pack' ),
|
45 |
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
|
46 |
-
'default' => 'on'
|
47 |
-
)
|
48 |
);
|
49 |
|
50 |
-
|
51 |
if ( AIOSEOPPRO ) {
|
52 |
|
53 |
-
$this->module_info['coming_soon'] =
|
54 |
'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
|
55 |
'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
|
56 |
-
'save' => false
|
57 |
);
|
58 |
-
$this->module_info['video_sitemap'] =
|
59 |
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
60 |
-
'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' )
|
61 |
);
|
62 |
|
63 |
-
|
64 |
} else {
|
65 |
|
66 |
-
$this->module_info['coming_soon'] =
|
67 |
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
68 |
'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
|
69 |
-
'save' => false
|
70 |
);
|
71 |
|
72 |
}
|
73 |
|
74 |
-
// Set up default settings fields
|
75 |
-
//
|
76 |
-
//
|
77 |
-
//
|
78 |
-
//
|
79 |
-
//
|
80 |
-
// Other supported options: class, id, style -- allows you to set these HTML attributes on the field
|
81 |
|
82 |
$this->default_options = array();
|
83 |
$this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
|
84 |
$mod[] = 'coming_soon';
|
85 |
|
86 |
foreach ( $mod as $m ) {
|
87 |
-
if (
|
88 |
continue;
|
89 |
}
|
90 |
-
$this->default_options["enable_$m"] =
|
91 |
'name' => $this->module_info[ $m ]['name'],
|
92 |
'help_text' => $this->module_info[ $m ]['description'],
|
93 |
'type' => 'custom',
|
94 |
'class' => 'aioseop_feature',
|
95 |
'id' => "aioseop_$m",
|
96 |
-
'save' => true
|
97 |
);
|
98 |
|
99 |
if ( ! empty( $this->module_info[ $m ]['image'] ) ) {
|
100 |
$this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image'];
|
101 |
}
|
102 |
if ( ! empty( $this->module_info[ $m ] ) ) {
|
103 |
-
foreach (
|
104 |
if ( isset( $this->module_info[ $m ][ $option ] ) ) {
|
105 |
$this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ];
|
106 |
}
|
107 |
}
|
108 |
}
|
109 |
}
|
110 |
-
$this->layout =
|
111 |
-
'default' =>
|
112 |
'name' => $this->name,
|
113 |
'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
|
114 |
-
'options' => array_keys( $this->default_options )
|
115 |
-
)
|
116 |
);
|
117 |
-
//
|
118 |
$this->update_options();
|
119 |
if ( is_admin() ) {
|
120 |
-
add_filter( $this->prefix . 'output_option',
|
121 |
-
add_filter( $this->prefix . 'submit_options',
|
122 |
}
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
function menu_order() {
|
126 |
return 20;
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
129 |
function filter_submit( $submit ) {
|
130 |
$submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' »';
|
131 |
-
$submit['Submit']['class'] .=
|
132 |
$submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' »';
|
133 |
|
134 |
return $submit;
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
function display_option_div( $buf, $args ) {
|
138 |
$name = $img = $desc = $checkbox = $class = '';
|
139 |
if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
|
@@ -150,9 +173,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
|
150 |
|
151 |
if ( $args['options']['save'] ) {
|
152 |
$name = "<h3>{$args['options']['name']}</h3>";
|
153 |
-
$checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args[
|
154 |
if ( $args['value'] ) {
|
155 |
-
$checkbox .=
|
156 |
}
|
157 |
$checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
|
158 |
} else {
|
@@ -162,7 +185,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
|
162 |
$args['attr'] .= " id='{$args['options']['id']}'";
|
163 |
}
|
164 |
|
165 |
-
return $buf . "<div {$args['attr']}><label for='{$args['name']}'>{$name}{$img}{$desc}{$checkbox}</label></div>";
|
166 |
}
|
167 |
}
|
168 |
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Feature Manager class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class All_in_One_SEO_Pack_Feature_Manager
|
12 |
+
*/
|
13 |
class All_in_One_SEO_Pack_Feature_Manager extends All_in_One_SEO_Pack_Module {
|
14 |
|
15 |
+
protected $module_info = array();
|
16 |
|
17 |
+
/**
|
18 |
+
* All_in_One_SEO_Pack_Feature_Manager constructor.
|
19 |
+
*
|
20 |
+
* @param $mod Module.
|
21 |
+
*/
|
22 |
function __construct( $mod ) {
|
23 |
+
$this->name = __( 'Feature Manager', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
24 |
+
$this->prefix = 'aiosp_feature_manager_'; // Option prefix.
|
25 |
+
$this->file = __FILE__; // The current file.
|
26 |
parent::__construct();
|
27 |
+
$this->module_info = array(
|
28 |
+
'sitemap' => array(
|
29 |
'name' => __( 'XML Sitemaps', 'all-in-one-seo-pack' ),
|
30 |
+
'description' => __( 'Create and manage your XML Sitemaps using this feature and submit your XML Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
|
31 |
),
|
32 |
+
'opengraph' => array(
|
33 |
'name' => __( 'Social Meta', 'all-in-one-seo-pack' ),
|
34 |
+
'description' => __( 'Activate this feature to add Social Meta data to your site to deliver closer integration between your website/blog and Facebook, Twitter, and Google+.', 'all-in-one-seo-pack' ),
|
35 |
),
|
36 |
+
'robots' => array(
|
37 |
'name' => __( 'Robots.txt', 'all-in-one-seo-pack' ),
|
38 |
+
'description' => __( 'Generate and validate your robots.txt file to guide search engines through your site.', 'all-in-one-seo-pack' ),
|
39 |
),
|
40 |
+
'file_editor' => array(
|
41 |
'name' => __( 'File Editor', 'all-in-one-seo-pack' ),
|
42 |
+
'description' => __( 'Edit your robots.txt file and your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ),
|
43 |
),
|
44 |
+
'importer_exporter' => array(
|
45 |
'name' => __( 'Importer & Exporter', 'all-in-one-seo-pack' ),
|
46 |
+
'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all-in-one-seo-pack' ),
|
47 |
),
|
48 |
+
'bad_robots' => array(
|
49 |
'name' => __( 'Bad Bot Blocker', 'all-in-one-seo-pack' ),
|
50 |
+
'description' => __( 'Stop badly behaving bots from slowing down your website.', 'all-in-one-seo-pack' ),
|
51 |
),
|
52 |
+
'performance' => array(
|
53 |
'name' => __( 'Performance', 'all-in-one-seo-pack' ),
|
54 |
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all-in-one-seo-pack' ),
|
55 |
+
'default' => 'on',
|
56 |
+
),
|
57 |
);
|
58 |
|
|
|
59 |
if ( AIOSEOPPRO ) {
|
60 |
|
61 |
+
$this->module_info['coming_soon'] = array(
|
62 |
'name' => __( 'Coming Soon...', 'all-in-one-seo-pack' ),
|
63 |
'description' => __( 'Image SEO', 'all-in-one-seo-pack' ),
|
64 |
+
'save' => false,
|
65 |
);
|
66 |
+
$this->module_info['video_sitemap'] = array(
|
67 |
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
68 |
+
'description' => __( 'Create and manage your Video Sitemap using this feature and submit your Video Sitemap to Google, Bing/Yahoo and Ask.com.', 'all-in-one-seo-pack' ),
|
69 |
);
|
70 |
|
|
|
71 |
} else {
|
72 |
|
73 |
+
$this->module_info['coming_soon'] = array(
|
74 |
'name' => __( 'Video Sitemap', 'all-in-one-seo-pack' ),
|
75 |
'description' => __( 'Pro Version Only', 'all-in-one-seo-pack' ),
|
76 |
+
'save' => false,
|
77 |
);
|
78 |
|
79 |
}
|
80 |
|
81 |
+
// Set up default settings fields.
|
82 |
+
// Name - Human-readable name of the setting.
|
83 |
+
// Help_text - Inline documentation for the setting.
|
84 |
+
// Type - Type of field; this defaults to checkbox; currently supported types are checkbox, text, select, multiselect.
|
85 |
+
// Default - Default value of the field.
|
86 |
+
// Initial_options - Initial option list used for selects and multiselects.
|
87 |
+
// Other supported options: class, id, style -- allows you to set these HTML attributes on the field.
|
88 |
|
89 |
$this->default_options = array();
|
90 |
$this->module_info = apply_filters( 'aioseop_module_info', $this->module_info );
|
91 |
$mod[] = 'coming_soon';
|
92 |
|
93 |
foreach ( $mod as $m ) {
|
94 |
+
if ( 'performance' === $m && ! is_super_admin() ) {
|
95 |
continue;
|
96 |
}
|
97 |
+
$this->default_options["enable_$m"] = array(
|
98 |
'name' => $this->module_info[ $m ]['name'],
|
99 |
'help_text' => $this->module_info[ $m ]['description'],
|
100 |
'type' => 'custom',
|
101 |
'class' => 'aioseop_feature',
|
102 |
'id' => "aioseop_$m",
|
103 |
+
'save' => true,
|
104 |
);
|
105 |
|
106 |
if ( ! empty( $this->module_info[ $m ]['image'] ) ) {
|
107 |
$this->default_options["enable_$m"]['image'] = $this->module_info[ $m ]['image'];
|
108 |
}
|
109 |
if ( ! empty( $this->module_info[ $m ] ) ) {
|
110 |
+
foreach ( array( 'save', 'default' ) as $option ) {
|
111 |
if ( isset( $this->module_info[ $m ][ $option ] ) ) {
|
112 |
$this->default_options["enable_$m"][ $option ] = $this->module_info[ $m ][ $option ];
|
113 |
}
|
114 |
}
|
115 |
}
|
116 |
}
|
117 |
+
$this->layout = array(
|
118 |
+
'default' => array(
|
119 |
'name' => $this->name,
|
120 |
'help_link' => 'http://semperplugins.com/documentation/feature-manager/',
|
121 |
+
'options' => array_keys( $this->default_options ),
|
122 |
+
),
|
123 |
);
|
124 |
+
// Load initial options / set defaults.
|
125 |
$this->update_options();
|
126 |
if ( is_admin() ) {
|
127 |
+
add_filter( $this->prefix . 'output_option', array( $this, 'display_option_div' ), 10, 2 );
|
128 |
+
add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ) );
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* Determines the menu order.
|
134 |
+
*
|
135 |
+
* @return int
|
136 |
+
*/
|
137 |
function menu_order() {
|
138 |
return 20;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @param $submit
|
143 |
+
*
|
144 |
+
* @return mixed
|
145 |
+
*/
|
146 |
function filter_submit( $submit ) {
|
147 |
$submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' »';
|
148 |
+
$submit['Submit']['class'] .= ' hidden';
|
149 |
$submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' »';
|
150 |
|
151 |
return $submit;
|
152 |
}
|
153 |
|
154 |
+
/**
|
155 |
+
* @param $buf
|
156 |
+
* @param $args
|
157 |
+
*
|
158 |
+
* @return string
|
159 |
+
*/
|
160 |
function display_option_div( $buf, $args ) {
|
161 |
$name = $img = $desc = $checkbox = $class = '';
|
162 |
if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
|
173 |
|
174 |
if ( $args['options']['save'] ) {
|
175 |
$name = "<h3>{$args['options']['name']}</h3>";
|
176 |
+
$checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args['options']['id'] . ' .aioseop_featured_image, #' . $args['options']['id'] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
|
177 |
if ( $args['value'] ) {
|
178 |
+
$checkbox .= ' CHECKED';
|
179 |
}
|
180 |
$checkbox .= '><span class="button-primary feature_button' . $class . '"></span>';
|
181 |
} else {
|
185 |
$args['attr'] .= " id='{$args['options']['id']}'";
|
186 |
}
|
187 |
|
188 |
+
return $buf . "<div {$args['attr']}><label for='{$args['name']}'><div id='free-flag'>FREE</div>{$name}{$img}{$desc}{$checkbox}</label></div>";
|
189 |
}
|
190 |
}
|
191 |
}
|
modules/aioseop_file_editor.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The File Editor class.
|
|
|
|
|
7 |
*/
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
9 |
|
@@ -25,29 +25,29 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
|
25 |
$this->current_tab = $_REQUEST['tab'];
|
26 |
}
|
27 |
|
28 |
-
$help_text =
|
29 |
'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
|
30 |
-
'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' )
|
31 |
);
|
32 |
$this->default_options = array(
|
33 |
-
'robotfile' =>
|
34 |
'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack' ),
|
35 |
'save' => false,
|
36 |
'default' => '',
|
37 |
'type' => 'textarea',
|
38 |
'cols' => 70,
|
39 |
'rows' => 25,
|
40 |
-
'label' => 'top'
|
41 |
),
|
42 |
-
'htaccfile' =>
|
43 |
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
44 |
'save' => false,
|
45 |
'default' => '',
|
46 |
'type' => 'textarea',
|
47 |
'cols' => 70,
|
48 |
'rows' => 25,
|
49 |
-
'label' => 'top'
|
50 |
-
)
|
51 |
);
|
52 |
|
53 |
if ( ! empty( $help_text ) ) {
|
@@ -55,35 +55,35 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
|
55 |
$this->default_options[ $k ]['help_text'] = $v;
|
56 |
}
|
57 |
}
|
58 |
-
$this->tabs =
|
59 |
-
'robots' =>
|
60 |
-
'htaccess' =>
|
61 |
);
|
62 |
|
63 |
-
$this->layout =
|
64 |
-
'robots' =>
|
65 |
'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ),
|
66 |
-
'options' =>
|
67 |
-
'tab' => 'robots'
|
68 |
),
|
69 |
-
'htaccess' =>
|
70 |
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
71 |
-
'options' =>
|
72 |
-
'tab' => 'htaccess'
|
73 |
-
)
|
74 |
);
|
75 |
|
76 |
$this->update_options(); // load initial options / set defaults
|
77 |
}
|
78 |
|
79 |
function settings_page_init() {
|
80 |
-
add_filter( $this->prefix . 'display_options',
|
81 |
-
add_filter( $this->prefix . 'submit_options',
|
82 |
}
|
83 |
|
84 |
function add_page_hooks() {
|
85 |
parent::add_page_hooks();
|
86 |
-
add_action( $this->prefix . 'settings_update',
|
87 |
}
|
88 |
|
89 |
/**
|
@@ -95,17 +95,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
|
95 |
function filter_submit( $submit, $location ) {
|
96 |
unset( $submit['Submit_Default'] );
|
97 |
$submit['Submit']['type'] = 'hidden';
|
98 |
-
if ( $this->current_tab
|
99 |
-
$submit['Submit_File_Editor'] =
|
100 |
'type' => 'submit',
|
101 |
'class' => 'button-primary',
|
102 |
-
'value' => __( 'Update robots.txt', 'all-in-one-seo-pack' ) . ' »'
|
103 |
);
|
104 |
-
} elseif ( $this->current_tab
|
105 |
-
$submit['Submit_htaccess'] =
|
106 |
'type' => 'submit',
|
107 |
'class' => 'button-primary',
|
108 |
-
'value' => __( 'Update .htaccess', 'all-in-one-seo-pack' ) . ' »'
|
109 |
);
|
110 |
}
|
111 |
|
@@ -120,25 +120,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
|
120 |
*/
|
121 |
function filter_options( $options, $location ) {
|
122 |
$prefix = $this->get_prefix( $location );
|
123 |
-
if ( $this->current_tab
|
124 |
-
$options = $this->load_files( $options,
|
125 |
-
} elseif ( $this->current_tab
|
126 |
-
$options = $this->load_files( $options,
|
127 |
}
|
128 |
|
129 |
return $options;
|
130 |
}
|
131 |
|
132 |
/**
|
133 |
-
* @param $options
|
134 |
* @param $location
|
135 |
*/
|
136 |
function do_file_editor( $options, $location ) {
|
137 |
$prefix = $this->get_prefix( $location );
|
138 |
-
if ( $this->current_tab
|
139 |
-
$this->save_files(
|
140 |
-
} elseif ( $this->current_tab
|
141 |
-
$this->save_files(
|
142 |
}
|
143 |
}
|
144 |
}
|
1 |
<?php
|
2 |
+
|
|
|
|
|
3 |
/**
|
4 |
* The File Editor class.
|
5 |
+
*
|
6 |
+
* @package All-in-One-SEO-Pack
|
7 |
*/
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
|
9 |
|
25 |
$this->current_tab = $_REQUEST['tab'];
|
26 |
}
|
27 |
|
28 |
+
$help_text = array(
|
29 |
'robotfile' => __( 'Robots.txt editor', 'all-in-one-seo-pack' ),
|
30 |
+
'htaccfile' => __( '.htaccess editor', 'all-in-one-seo-pack' ),
|
31 |
);
|
32 |
$this->default_options = array(
|
33 |
+
'robotfile' => array(
|
34 |
'name' => __( 'Edit Robots.txt', 'all-in-one-seo-pack' ),
|
35 |
'save' => false,
|
36 |
'default' => '',
|
37 |
'type' => 'textarea',
|
38 |
'cols' => 70,
|
39 |
'rows' => 25,
|
40 |
+
'label' => 'top',
|
41 |
),
|
42 |
+
'htaccfile' => array(
|
43 |
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
44 |
'save' => false,
|
45 |
'default' => '',
|
46 |
'type' => 'textarea',
|
47 |
'cols' => 70,
|
48 |
'rows' => 25,
|
49 |
+
'label' => 'top',
|
50 |
+
),
|
51 |
);
|
52 |
|
53 |
if ( ! empty( $help_text ) ) {
|
55 |
$this->default_options[ $k ]['help_text'] = $v;
|
56 |
}
|
57 |
}
|
58 |
+
$this->tabs = array(
|
59 |
+
'robots' => array( 'name' => __( 'robots.txt' ) ),
|
60 |
+
'htaccess' => array( 'name' => __( '.htaccess' ) ),
|
61 |
);
|
62 |
|
63 |
+
$this->layout = array(
|
64 |
+
'robots' => array(
|
65 |
'name' => __( 'Edit robots.txt', 'all-in-one-seo-pack' ),
|
66 |
+
'options' => array( 'robotfile' ),
|
67 |
+
'tab' => 'robots',
|
68 |
),
|
69 |
+
'htaccess' => array(
|
70 |
'name' => __( 'Edit .htaccess', 'all-in-one-seo-pack' ),
|
71 |
+
'options' => array( 'htaccfile' ),
|
72 |
+
'tab' => 'htaccess',
|
73 |
+
),
|
74 |
);
|
75 |
|
76 |
$this->update_options(); // load initial options / set defaults
|
77 |
}
|
78 |
|
79 |
function settings_page_init() {
|
80 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'filter_options' ), 10, 2 );
|
81 |
+
add_filter( $this->prefix . 'submit_options', array( $this, 'filter_submit' ), 10, 2 );
|
82 |
}
|
83 |
|
84 |
function add_page_hooks() {
|
85 |
parent::add_page_hooks();
|
86 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'do_file_editor' ), 10, 2 );
|
87 |
}
|
88 |
|
89 |
/**
|
95 |
function filter_submit( $submit, $location ) {
|
96 |
unset( $submit['Submit_Default'] );
|
97 |
$submit['Submit']['type'] = 'hidden';
|
98 |
+
if ( 'robots' === $this->current_tab ) {
|
99 |
+
$submit['Submit_File_Editor'] = array(
|
100 |
'type' => 'submit',
|
101 |
'class' => 'button-primary',
|
102 |
+
'value' => __( 'Update robots.txt', 'all-in-one-seo-pack' ) . ' »',
|
103 |
);
|
104 |
+
} elseif ( 'htaccess' === $this->current_tab ) {
|
105 |
+
$submit['Submit_htaccess'] = array(
|
106 |
'type' => 'submit',
|
107 |
'class' => 'button-primary',
|
108 |
+
'value' => __( 'Update .htaccess', 'all-in-one-seo-pack' ) . ' »',
|
109 |
);
|
110 |
}
|
111 |
|
120 |
*/
|
121 |
function filter_options( $options, $location ) {
|
122 |
$prefix = $this->get_prefix( $location );
|
123 |
+
if ( 'robots' === $this->current_tab ) {
|
124 |
+
$options = $this->load_files( $options, array( 'robotfile' => 'robots.txt' ), $prefix );
|
125 |
+
} elseif ( 'htaccess' === $this->current_tab ) {
|
126 |
+
$options = $this->load_files( $options, array( 'htaccfile' => '.htaccess' ), $prefix );
|
127 |
}
|
128 |
|
129 |
return $options;
|
130 |
}
|
131 |
|
132 |
/**
|
133 |
+
* @param $options This seems to be unused.
|
134 |
* @param $location
|
135 |
*/
|
136 |
function do_file_editor( $options, $location ) {
|
137 |
$prefix = $this->get_prefix( $location );
|
138 |
+
if ( 'robots' === $this->current_tab && isset( $_POST['Submit_File_Editor'] ) && $_POST['Submit_File_Editor'] ) {
|
139 |
+
$this->save_files( array( 'robotfile' => 'robots.txt' ), $prefix );
|
140 |
+
} elseif ( 'htaccess' === $this->current_tab && isset( $_POST['Submit_htaccess'] ) && $_POST['Submit_htaccess'] ) {
|
141 |
+
$this->save_files( array( 'htaccfile' => '.htaccess' ), $prefix );
|
142 |
}
|
143 |
}
|
144 |
}
|
modules/aioseop_importer_exporter.php
CHANGED
@@ -19,40 +19,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
19 |
parent::__construct();
|
20 |
$help_text = Array(
|
21 |
'import_submit' => __(
|
22 |
-
"Select a valid All in One SEO Pack ini file and
|
23 |
-
click 'Import' to import options from a
|
24 |
-
previous state or install of All in
|
25 |
-
One SEO Pack.<br />
|
26 |
-
<a
|
27 |
-
href='http://semperplugins.com/documentation/importer-exporter-module/'
|
28 |
-
target='_blank'
|
29 |
-
>
|
30 |
-
Click here for documentation on this setting
|
31 |
-
</a>",
|
32 |
'all-in-one-seo-pack'
|
33 |
),
|
34 |
'export_choices' => __(
|
35 |
-
"You may choose to export settings from active modules,
|
36 |
-
and content from post data.<br />
|
37 |
-
<a
|
38 |
-
href='http://semperplugins.com/documentation/importer-exporter-module/'
|
39 |
-
target='_blank'
|
40 |
-
>
|
41 |
-
Click here for documentation on this setting
|
42 |
-
</a>",
|
43 |
'all-in-one-seo-pack'
|
44 |
),
|
45 |
'export_post_types' => __(
|
46 |
-
"Select which Post Types you want to export your
|
47 |
-
All in One SEO Pack meta data for.<br />
|
48 |
-
<a
|
49 |
-
href='http://semperplugins.com/documentation/importer-exporter-module/'
|
50 |
-
target='_blank'
|
51 |
-
>
|
52 |
-
Click here for documentation on this setting
|
53 |
-
</a>",
|
54 |
'all-in-one-seo-pack'
|
55 |
-
)
|
56 |
);
|
57 |
$this->warnings = Array();
|
58 |
$this->default_options = array(
|
@@ -60,26 +37,26 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
60 |
'name' => __( 'Import', 'all-in-one-seo-pack' ),
|
61 |
'default' => '',
|
62 |
'type' => 'file',
|
63 |
-
'save' => false
|
64 |
),
|
65 |
'export_choices' => Array(
|
66 |
'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
|
67 |
'type' => 'multicheckbox',
|
68 |
'initial_options' => Array(
|
69 |
1 => 'General Settings',
|
70 |
-
2 => 'Post Data'
|
71 |
-
)
|
72 |
),
|
73 |
'export_post_types' => Array(
|
74 |
'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
|
75 |
'default' => Array(
|
76 |
'post' => 'post',
|
77 |
-
'page' => 'page'
|
78 |
),
|
79 |
'type' => 'multicheckbox',
|
80 |
'initial_options' => $this->get_post_type_titles(
|
81 |
Array( '_builtin' => false )
|
82 |
-
)
|
83 |
),
|
84 |
'import_export_help' => Array(
|
85 |
'type' => 'html',
|
@@ -90,8 +67,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
90 |
and the following currently active modules will
|
91 |
have their settings data exported:',
|
92 |
'all-in-one-seo-pack'
|
93 |
-
) . '<br />'
|
94 |
-
)
|
95 |
);
|
96 |
if ( ! empty( $help_text ) ) {
|
97 |
foreach ( $help_text as $k => $v ) {
|
@@ -102,8 +79,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
102 |
'default' => Array(
|
103 |
'name' => $this->name,
|
104 |
'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
|
105 |
-
'options' => array_keys( $this->default_options )
|
106 |
-
)
|
107 |
);
|
108 |
|
109 |
// load initial options / set defaults
|
@@ -135,8 +112,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
135 |
'export_submit' => Array(
|
136 |
'type' => 'submit',
|
137 |
'class' => 'button-primary',
|
138 |
-
'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' »'
|
139 |
-
)
|
140 |
) + $submit;
|
141 |
}
|
142 |
|
@@ -146,7 +123,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
146 |
$rempost = array(
|
147 |
'attachment' => 1,
|
148 |
'revision' => 1,
|
149 |
-
'nav_menu_item' => 1
|
150 |
);
|
151 |
$this->default_options['export_post_types']['initial_options'] = array_diff_key(
|
152 |
$post_types,
|
@@ -222,7 +199,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
222 |
|
223 |
if ( is_array( $this->warnings ) ) {
|
224 |
foreach ( $this->warnings as $warning ) {
|
225 |
-
echo "<p>
|
226 |
}
|
227 |
}
|
228 |
echo '</div>';
|
@@ -314,7 +291,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
314 |
|
315 |
|
316 |
/**
|
317 |
-
* @param
|
318 |
* @param bool $has_sections
|
319 |
*
|
320 |
* @return string
|
@@ -387,7 +364,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
387 |
'disable_analytics',
|
388 |
'titleatr',
|
389 |
'menulabel',
|
390 |
-
'togglekeywords'
|
391 |
);
|
392 |
if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) {
|
393 |
$submit = 'Import';
|
@@ -437,17 +414,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
437 |
} else {
|
438 |
$this->warnings[] = sprintf(
|
439 |
__(
|
440 |
-
'<b>
|
441 |
-
Warning:
|
442 |
-
</b>
|
443 |
-
Line not matched:
|
444 |
-
<b>
|
445 |
-
"%s"
|
446 |
-
</b>
|
447 |
-
, On Line:
|
448 |
-
<b>
|
449 |
-
%s
|
450 |
-
</b>',
|
451 |
'all-in-one-seo-pack'
|
452 |
),
|
453 |
$line,
|
@@ -496,13 +463,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
|
496 |
$target_title = $module_options[ $key ]['post_title'];
|
497 |
$post_warning = sprintf(
|
498 |
__(
|
499 |
-
'<b>
|
500 |
-
Warning:
|
501 |
-
</b>
|
502 |
-
This following post could not be found:
|
503 |
-
<b>
|
504 |
-
"%s"
|
505 |
-
</b>',
|
506 |
'all-in-one-seo-pack'
|
507 |
),
|
508 |
$target_title
|
19 |
parent::__construct();
|
20 |
$help_text = Array(
|
21 |
'import_submit' => __(
|
22 |
+
"Select a valid All in One SEO Pack ini file and click 'Import' to import options from a previous state or install of All in One SEO Pack.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
'all-in-one-seo-pack'
|
24 |
),
|
25 |
'export_choices' => __(
|
26 |
+
"You may choose to export settings from active modules, and content from post data.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
'all-in-one-seo-pack'
|
28 |
),
|
29 |
'export_post_types' => __(
|
30 |
+
"Select which Post Types you want to export your All in One SEO Pack meta data for.<br /><a href='http://semperplugins.com/documentation/importer-exporter-module/' target='_blank'>Click here for documentation on this setting</a>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
'all-in-one-seo-pack'
|
32 |
+
),
|
33 |
);
|
34 |
$this->warnings = Array();
|
35 |
$this->default_options = array(
|
37 |
'name' => __( 'Import', 'all-in-one-seo-pack' ),
|
38 |
'default' => '',
|
39 |
'type' => 'file',
|
40 |
+
'save' => false,
|
41 |
),
|
42 |
'export_choices' => Array(
|
43 |
'name' => __( 'Export Settings', 'all-in-one-seo-pack' ),
|
44 |
'type' => 'multicheckbox',
|
45 |
'initial_options' => Array(
|
46 |
1 => 'General Settings',
|
47 |
+
2 => 'Post Data',
|
48 |
+
),
|
49 |
),
|
50 |
'export_post_types' => Array(
|
51 |
'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
|
52 |
'default' => Array(
|
53 |
'post' => 'post',
|
54 |
+
'page' => 'page',
|
55 |
),
|
56 |
'type' => 'multicheckbox',
|
57 |
'initial_options' => $this->get_post_type_titles(
|
58 |
Array( '_builtin' => false )
|
59 |
+
),
|
60 |
),
|
61 |
'import_export_help' => Array(
|
62 |
'type' => 'html',
|
67 |
and the following currently active modules will
|
68 |
have their settings data exported:',
|
69 |
'all-in-one-seo-pack'
|
70 |
+
) . '<br />',
|
71 |
+
),
|
72 |
);
|
73 |
if ( ! empty( $help_text ) ) {
|
74 |
foreach ( $help_text as $k => $v ) {
|
79 |
'default' => Array(
|
80 |
'name' => $this->name,
|
81 |
'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
|
82 |
+
'options' => array_keys( $this->default_options ),
|
83 |
+
),
|
84 |
);
|
85 |
|
86 |
// load initial options / set defaults
|
112 |
'export_submit' => Array(
|
113 |
'type' => 'submit',
|
114 |
'class' => 'button-primary',
|
115 |
+
'value' => __( 'Export', 'all-in-one-seo-pack' ) . ' »',
|
116 |
+
),
|
117 |
) + $submit;
|
118 |
}
|
119 |
|
123 |
$rempost = array(
|
124 |
'attachment' => 1,
|
125 |
'revision' => 1,
|
126 |
+
'nav_menu_item' => 1,
|
127 |
);
|
128 |
$this->default_options['export_post_types']['initial_options'] = array_diff_key(
|
129 |
$post_types,
|
199 |
|
200 |
if ( is_array( $this->warnings ) ) {
|
201 |
foreach ( $this->warnings as $warning ) {
|
202 |
+
echo "<p>" . esc_html( $warning ) . "</p>";
|
203 |
}
|
204 |
}
|
205 |
echo '</div>';
|
291 |
|
292 |
|
293 |
/**
|
294 |
+
* @param $assoc_arr
|
295 |
* @param bool $has_sections
|
296 |
*
|
297 |
* @return string
|
364 |
'disable_analytics',
|
365 |
'titleatr',
|
366 |
'menulabel',
|
367 |
+
'togglekeywords',
|
368 |
);
|
369 |
if ( ! empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) {
|
370 |
$submit = 'Import';
|
414 |
} else {
|
415 |
$this->warnings[] = sprintf(
|
416 |
__(
|
417 |
+
'<b>Warning:</b> Line not matched: <b>"%s"</b>, On Line: <b>%s</b>',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
'all-in-one-seo-pack'
|
419 |
),
|
420 |
$line,
|
463 |
$target_title = $module_options[ $key ]['post_title'];
|
464 |
$post_warning = sprintf(
|
465 |
__(
|
466 |
+
'<b>Warning:</b> This following post could not be found: <b>"%s"</b>',
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
'all-in-one-seo-pack'
|
468 |
),
|
469 |
$target_title
|
modules/aioseop_opengraph.php
CHANGED
@@ -1137,7 +1137,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
1137 |
'title' => 'twitter:title',
|
1138 |
'description' => 'twitter:description',
|
1139 |
'thumbnail' => 'twitter:image'
|
1140 |
-
|
1141 |
)
|
1142 |
);
|
1143 |
*/
|
1137 |
'title' => 'twitter:title',
|
1138 |
'description' => 'twitter:description',
|
1139 |
'thumbnail' => 'twitter:image'
|
1140 |
+
|
1141 |
)
|
1142 |
);
|
1143 |
*/
|
modules/aioseop_performance.php
CHANGED
@@ -1,105 +1,105 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Performance class.
|
|
|
|
|
7 |
*/
|
|
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
|
9 |
class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
|
10 |
|
11 |
-
protected $module_info =
|
12 |
|
13 |
function __construct( $mod ) {
|
14 |
-
$this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
15 |
-
$this->prefix = 'aiosp_performance_'; //
|
16 |
-
$this->file = __FILE__; //
|
17 |
parent::__construct();
|
18 |
|
19 |
-
$this->help_text =
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
);
|
24 |
|
25 |
$this->default_options = array(
|
26 |
-
'memory_limit' =>
|
27 |
'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
|
28 |
'default' => '256M',
|
29 |
'type' => 'select',
|
30 |
-
'initial_options' =>
|
31 |
-
0 => __(
|
32 |
'32M' => '32MB',
|
33 |
'64M' => '64MB',
|
34 |
'128M' => '128MB',
|
35 |
-
'256M' => '256MB'
|
36 |
-
)
|
37 |
),
|
38 |
-
'execution_time' =>
|
39 |
'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
|
40 |
'default' => '',
|
41 |
'type' => 'select',
|
42 |
-
'initial_options' =>
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
);
|
51 |
|
52 |
-
$this->help_anchors =
|
53 |
'memory_limit' => '#raise-memory-limit',
|
54 |
'execution_time' => '#raise-execution-time',
|
55 |
-
'force_rewrites' => '#force-rewrites'
|
56 |
);
|
57 |
|
58 |
global $aiosp, $aioseop_options;
|
59 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
|
60 |
-
$this->default_options['force_rewrites'] =
|
61 |
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
62 |
'default' => 1,
|
63 |
'type' => 'radio',
|
64 |
-
'initial_options' =>
|
65 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
66 |
-
0 => __( 'Disabled', 'all-in-one-seo-pack' )
|
67 |
-
)
|
68 |
);
|
69 |
}
|
70 |
|
71 |
-
$this->layout =
|
72 |
-
'default' =>
|
73 |
'name' => $this->name,
|
74 |
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
75 |
-
'options' => array_keys( $this->default_options )
|
76 |
-
)
|
77 |
);
|
78 |
|
79 |
-
$system_status =
|
80 |
-
'status' =>
|
81 |
);
|
82 |
|
83 |
-
$this->layout['system_status'] =
|
84 |
'name' => __( 'System Status', 'all-in-one-seo-pack' ),
|
85 |
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
86 |
-
'options' => array_keys( $system_status )
|
87 |
);
|
88 |
|
89 |
$this->default_options = array_merge( $this->default_options, $system_status );
|
90 |
|
91 |
$this->add_help_text_links();
|
92 |
|
93 |
-
add_filter( $this->prefix . 'display_options',
|
94 |
-
add_filter( $this->prefix . 'update_options',
|
95 |
-
add_action( $this->prefix . 'settings_update',
|
96 |
}
|
97 |
|
98 |
function update_options_filter( $options, $location ) {
|
99 |
-
if ( $location == null ) {
|
100 |
-
|
101 |
-
unset( $options[ $this->prefix . 'force_rewrites' ] );
|
102 |
-
}
|
103 |
}
|
104 |
|
105 |
return $options;
|
@@ -110,7 +110,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
110 |
$options[ $this->prefix . 'force_rewrites' ] = 1;
|
111 |
global $aiosp;
|
112 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) {
|
113 |
-
$opts = $aiosp->get_current_options(
|
114 |
$options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites'];
|
115 |
}
|
116 |
}
|
@@ -119,16 +119,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
119 |
}
|
120 |
|
121 |
function settings_update_action( $options, $location ) {
|
122 |
-
if ( $location == null ) {
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
wp_cache_flush();
|
131 |
-
}
|
132 |
}
|
133 |
}
|
134 |
}
|
@@ -207,7 +205,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
207 |
$memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
|
208 |
}
|
209 |
if ( is_callable( 'exif_read_data' ) ) {
|
210 |
-
$exif = __( 'Yes', 'all-in-one-seo-pack' ) .
|
211 |
} else {
|
212 |
$exif = __( 'No', 'all-in-one-seo-pack' );
|
213 |
}
|
@@ -222,12 +220,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
222 |
$xml = __( 'No', 'all-in-one-seo-pack' );
|
223 |
}
|
224 |
|
225 |
-
|
226 |
-
$theme = wp_get_theme();
|
227 |
-
} else {
|
228 |
-
$theme = get_theme( get_current_theme() );
|
229 |
-
}
|
230 |
-
|
231 |
|
232 |
if ( function_exists( 'is_multisite' ) ) {
|
233 |
if ( is_multisite() ) {
|
@@ -244,9 +237,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
244 |
$homeurl = get_option( 'home' );
|
245 |
$db_version = get_option( 'db_version' );
|
246 |
|
247 |
-
$debug_info =
|
248 |
__( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
|
249 |
-
__( 'Server', 'all-in-one-seo-pack' ) => $_SERVER[
|
250 |
__( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
|
251 |
__( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
|
252 |
__( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
|
@@ -265,10 +258,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
265 |
__( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
|
266 |
__( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
|
267 |
__( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
|
268 |
-
__( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version']
|
269 |
);
|
270 |
$debug_info['Active Plugins'] = null;
|
271 |
-
$active_plugins = $inactive_plugins =
|
272 |
$plugins = get_plugins();
|
273 |
foreach ( $plugins as $path => $plugin ) {
|
274 |
if ( is_plugin_active( $path ) ) {
|
@@ -280,8 +273,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
280 |
$debug_info['Inactive Plugins'] = null;
|
281 |
$debug_info = array_merge( $debug_info, (array) $inactive_plugins );
|
282 |
|
283 |
-
$mail_text = __(
|
284 |
-
$page_text =
|
285 |
if ( ! empty( $debug_info ) ) {
|
286 |
foreach ( $debug_info as $name => $value ) {
|
287 |
if ( $value !== null ) {
|
@@ -298,13 +291,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
298 |
if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
|
299 |
$nonce = $_REQUEST['sfwd_debug_nonce'];
|
300 |
if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
|
301 |
-
echo "<div class='sfwd_debug_error'>" . __(
|
302 |
break;
|
303 |
}
|
304 |
-
if (
|
305 |
global $aioseop_update_checker;
|
306 |
$aioseop_update_checker->checkForUpdates();
|
307 |
-
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __(
|
308 |
break;
|
309 |
}
|
310 |
$email = '';
|
@@ -312,19 +305,19 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
|
312 |
$email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
|
313 |
}
|
314 |
if ( $email ) {
|
315 |
-
if ( wp_mail( $email, sprintf( __(
|
316 |
-
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __(
|
317 |
} else {
|
318 |
-
echo "<div class='sfwd_debug_error'>" . sprintf( __(
|
319 |
}
|
320 |
} else {
|
321 |
-
echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) .
|
322 |
}
|
323 |
}
|
324 |
-
} while ( 0 ); //
|
325 |
$nonce = wp_create_nonce( 'sfwd-debug-nonce' );
|
326 |
$buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
|
327 |
-
'<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __(
|
328 |
$nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
|
329 |
|
330 |
if ( AIOSEOPPRO ) {
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Performance class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
|
9 |
+
|
10 |
class All_in_One_SEO_Pack_Performance extends All_in_One_SEO_Pack_Module {
|
11 |
|
12 |
+
protected $module_info = array();
|
13 |
|
14 |
function __construct( $mod ) {
|
15 |
+
$this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
16 |
+
$this->prefix = 'aiosp_performance_'; // Option prefix.
|
17 |
+
$this->file = __FILE__; // The current file.
|
18 |
parent::__construct();
|
19 |
|
20 |
+
$this->help_text = array(
|
21 |
+
'memory_limit' => __( 'This setting allows you to raise your PHP memory limit to a reasonable value. Note: WordPress core and other WordPress plugins may also change the value of the memory limit.', 'all-in-one-seo-pack' ),
|
22 |
+
'execution_time' => __( 'This setting allows you to raise your PHP execution time to a reasonable value.', 'all-in-one-seo-pack' ),
|
23 |
+
'force_rewrites' => __( 'Use output buffering to ensure that the title gets rewritten. Enable this option if you run into issues with the title tag being set by your theme or another plugin.', 'all-in-one-seo-pack' ),
|
24 |
);
|
25 |
|
26 |
$this->default_options = array(
|
27 |
+
'memory_limit' => array(
|
28 |
'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
|
29 |
'default' => '256M',
|
30 |
'type' => 'select',
|
31 |
+
'initial_options' => array(
|
32 |
+
0 => __( 'Use the system default', 'all-in-one-seo-pack' ),
|
33 |
'32M' => '32MB',
|
34 |
'64M' => '64MB',
|
35 |
'128M' => '128MB',
|
36 |
+
'256M' => '256MB',
|
37 |
+
),
|
38 |
),
|
39 |
+
'execution_time' => array(
|
40 |
'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
|
41 |
'default' => '',
|
42 |
'type' => 'select',
|
43 |
+
'initial_options' => array(
|
44 |
+
'' => __( 'Use the system default', 'all-in-one-seo-pack' ),
|
45 |
+
30 => '30s',
|
46 |
+
60 => '1m',
|
47 |
+
120 => '2m',
|
48 |
+
300 => '5m',
|
49 |
+
0 => __( 'No limit', 'all-in-one-seo-pack' ),
|
50 |
+
),
|
51 |
+
),
|
52 |
);
|
53 |
|
54 |
+
$this->help_anchors = array(
|
55 |
'memory_limit' => '#raise-memory-limit',
|
56 |
'execution_time' => '#raise-execution-time',
|
57 |
+
'force_rewrites' => '#force-rewrites',
|
58 |
);
|
59 |
|
60 |
global $aiosp, $aioseop_options;
|
61 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) && $aioseop_options['aiosp_rewrite_titles'] ) {
|
62 |
+
$this->default_options['force_rewrites'] = array(
|
63 |
'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
|
64 |
'default' => 1,
|
65 |
'type' => 'radio',
|
66 |
+
'initial_options' => array(
|
67 |
1 => __( 'Enabled', 'all-in-one-seo-pack' ),
|
68 |
+
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
69 |
+
),
|
70 |
);
|
71 |
}
|
72 |
|
73 |
+
$this->layout = array(
|
74 |
+
'default' => array(
|
75 |
'name' => $this->name,
|
76 |
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
77 |
+
'options' => array_keys( $this->default_options ),
|
78 |
+
),
|
79 |
);
|
80 |
|
81 |
+
$system_status = array(
|
82 |
+
'status' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
|
83 |
);
|
84 |
|
85 |
+
$this->layout['system_status'] = array(
|
86 |
'name' => __( 'System Status', 'all-in-one-seo-pack' ),
|
87 |
'help_link' => 'http://semperplugins.com/documentation/performance-settings/',
|
88 |
+
'options' => array_keys( $system_status ),
|
89 |
);
|
90 |
|
91 |
$this->default_options = array_merge( $this->default_options, $system_status );
|
92 |
|
93 |
$this->add_help_text_links();
|
94 |
|
95 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'display_options_filter' ), 10, 2 );
|
96 |
+
add_filter( $this->prefix . 'update_options', array( $this, 'update_options_filter' ), 10, 2 );
|
97 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'settings_update_action' ), 10, 2 );
|
98 |
}
|
99 |
|
100 |
function update_options_filter( $options, $location ) {
|
101 |
+
if ( $location == null && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
|
102 |
+
unset( $options[ $this->prefix . 'force_rewrites' ] );
|
|
|
|
|
103 |
}
|
104 |
|
105 |
return $options;
|
110 |
$options[ $this->prefix . 'force_rewrites' ] = 1;
|
111 |
global $aiosp;
|
112 |
if ( aioseop_option_isset( 'aiosp_rewrite_titles' ) ) {
|
113 |
+
$opts = $aiosp->get_current_options( array(), null );
|
114 |
$options[ $this->prefix . 'force_rewrites' ] = $opts['aiosp_force_rewrites'];
|
115 |
}
|
116 |
}
|
119 |
}
|
120 |
|
121 |
function settings_update_action( $options, $location ) {
|
122 |
+
if ( $location == null && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
|
123 |
+
$force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
|
124 |
+
if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
|
125 |
+
global $aiosp;
|
126 |
+
$opts = $aiosp->get_current_options( array(), null );
|
127 |
+
$opts['aiosp_force_rewrites'] = $force_rewrites;
|
128 |
+
$aiosp->update_class_option( $opts );
|
129 |
+
wp_cache_flush();
|
|
|
|
|
130 |
}
|
131 |
}
|
132 |
}
|
205 |
$memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
|
206 |
}
|
207 |
if ( is_callable( 'exif_read_data' ) ) {
|
208 |
+
$exif = __( 'Yes', 'all-in-one-seo-pack' ) . ' ( V' . $this->substr( phpversion( 'exif' ), 0, 4 ) . ')';
|
209 |
} else {
|
210 |
$exif = __( 'No', 'all-in-one-seo-pack' );
|
211 |
}
|
220 |
$xml = __( 'No', 'all-in-one-seo-pack' );
|
221 |
}
|
222 |
|
223 |
+
$theme = wp_get_theme();
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
if ( function_exists( 'is_multisite' ) ) {
|
226 |
if ( is_multisite() ) {
|
237 |
$homeurl = get_option( 'home' );
|
238 |
$db_version = get_option( 'db_version' );
|
239 |
|
240 |
+
$debug_info = array(
|
241 |
__( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
|
242 |
+
__( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'],
|
243 |
__( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
|
244 |
__( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
|
245 |
__( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
|
258 |
__( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
|
259 |
__( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
|
260 |
__( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
|
261 |
+
__( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
|
262 |
);
|
263 |
$debug_info['Active Plugins'] = null;
|
264 |
+
$active_plugins = $inactive_plugins = array();
|
265 |
$plugins = get_plugins();
|
266 |
foreach ( $plugins as $path => $plugin ) {
|
267 |
if ( is_plugin_active( $path ) ) {
|
273 |
$debug_info['Inactive Plugins'] = null;
|
274 |
$debug_info = array_merge( $debug_info, (array) $inactive_plugins );
|
275 |
|
276 |
+
$mail_text = __( 'All in One SEO Pack Pro Debug Info', 'all-in-one-seo-pack' ) . "\r\n------------------\r\n\r\n";
|
277 |
+
$page_text = '';
|
278 |
if ( ! empty( $debug_info ) ) {
|
279 |
foreach ( $debug_info as $name => $value ) {
|
280 |
if ( $value !== null ) {
|
291 |
if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) || ! empty( $_REQUEST['sfwd_update_check'] ) ) {
|
292 |
$nonce = $_REQUEST['sfwd_debug_nonce'];
|
293 |
if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
|
294 |
+
echo "<div class='sfwd_debug_error'>" . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '</div>';
|
295 |
break;
|
296 |
}
|
297 |
+
if ( $_REQUEST['sfwd_update_check'] ) {
|
298 |
global $aioseop_update_checker;
|
299 |
$aioseop_update_checker->checkForUpdates();
|
300 |
+
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( '%s has checked for updates.', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME ) . '</div>';
|
301 |
break;
|
302 |
}
|
303 |
$email = '';
|
305 |
$email = sanitize_email( $_REQUEST['sfwd_debug_send_email'] );
|
306 |
}
|
307 |
if ( $email ) {
|
308 |
+
if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text ) ) {
|
309 |
+
echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
|
310 |
} else {
|
311 |
+
echo "<div class='sfwd_debug_error'>" . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
|
312 |
}
|
313 |
} else {
|
314 |
+
echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '</div>';
|
315 |
}
|
316 |
}
|
317 |
+
} while ( 0 ); // Control structure for use with break.
|
318 |
$nonce = wp_create_nonce( 'sfwd-debug-nonce' );
|
319 |
$buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n<p>\n" .
|
320 |
+
'<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '"><input name="sfwd_debug_nonce" type="hidden" value="' .
|
321 |
$nonce . '"><input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
|
322 |
|
323 |
if ( AIOSEOPPRO ) {
|
modules/aioseop_robots.php
CHANGED
@@ -26,23 +26,23 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
26 |
'type' => 'html',
|
27 |
'label' => 'none',
|
28 |
'default' => __( 'Use the rule builder below to add rules to create a new Robots.txt file. If you already have a Robots.txt file you should use the File Editor feature in All in One SEO Pack to edit it or you can delete your current Robots.txt file and start a new one with the rule builder below.', 'all-in-one-seo-pack' ),
|
29 |
-
'save' => false
|
30 |
),
|
31 |
'additional' => Array(
|
32 |
'name' => __( 'Rule Type', 'all-in-one-seo-pack' ),
|
33 |
'save' => false,
|
34 |
'type' => 'select',
|
35 |
-
'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' )
|
36 |
),
|
37 |
'useragent' => Array(
|
38 |
'name' => __( 'User Agent', 'all-in-one-seo-pack' ),
|
39 |
'save' => false,
|
40 |
-
'type' => 'text'
|
41 |
),
|
42 |
'path' => Array(
|
43 |
'name' => __( 'Directory Path', 'all-in-one-seo-pack' ),
|
44 |
'save' => false,
|
45 |
-
'type' => 'text'
|
46 |
),
|
47 |
'robotgen' => Array(
|
48 |
'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack' ),
|
@@ -52,50 +52,50 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
52 |
'cols' => 57,
|
53 |
'rows' => 20,
|
54 |
'label' => 'none',
|
55 |
-
'readonly' => 'readonly'
|
56 |
),
|
57 |
'Submit_Preview' => Array(
|
58 |
'type' => 'submit',
|
59 |
'class' => 'button-primary MRL',
|
60 |
'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' »',
|
61 |
-
'nowrap' => 1
|
62 |
),
|
63 |
'Submit_Update' => Array(
|
64 |
'type' => 'submit',
|
65 |
'class' => 'button-primary',
|
66 |
'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
67 |
-
'nowrap' => 1
|
68 |
),
|
69 |
'Submit_Delete' => Array(
|
70 |
'type' => 'submit',
|
71 |
'class' => 'button-primary',
|
72 |
'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
73 |
-
'nowrap' => 1
|
74 |
),
|
75 |
'optusage' => Array(
|
76 |
'type' => 'html',
|
77 |
'label' => 'none',
|
78 |
'default' => __( 'Click the Optimize button below and All in One SEO Pack will analyze your Robots.txt file to make sure it complies with the standards for Robots.txt files. The results will be displayed in a table below.', 'all-in-one-seo-pack' ),
|
79 |
-
'save' => false
|
80 |
),
|
81 |
'Submit_Opt_Update' => Array(
|
82 |
'type' => 'submit',
|
83 |
'class' => 'button-primary',
|
84 |
'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
85 |
'nowrap' => 1,
|
86 |
-
'style' => 'margin-left: 20px;'
|
87 |
),
|
88 |
'Submit_Opt_Preview' => Array(
|
89 |
'type' => 'submit',
|
90 |
'class' => 'button-primary',
|
91 |
'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' »',
|
92 |
-
'nowrap' => 1
|
93 |
),
|
94 |
'Submit_Optimize' => Array(
|
95 |
'type' => 'submit',
|
96 |
'class' => 'button-primary',
|
97 |
-
'name' => __( 'Optimize', 'all-in-one-seo-pack' ) . ' »'
|
98 |
-
)
|
99 |
);
|
100 |
|
101 |
if ( ! empty( $help_text ) ) {
|
@@ -120,8 +120,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
120 |
'optusage',
|
121 |
'Submit_Opt_Update',
|
122 |
'Submit_Opt_Preview',
|
123 |
-
'Submit_Optimize'
|
124 |
-
)
|
125 |
),
|
126 |
);
|
127 |
|
@@ -136,20 +136,20 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
136 |
'Submit_Preview',
|
137 |
'Submit_Update',
|
138 |
'Submit_Delete',
|
139 |
-
'robotgen'
|
140 |
) // this is set below, to the remaining options -- pdb
|
141 |
-
)
|
142 |
);
|
143 |
$this->layout['optimize'] = Array(
|
144 |
'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ),
|
145 |
-
'options' => Array( 'optusage', 'Submit_Optimize' )
|
146 |
);
|
147 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
148 |
$this->layout['optimize']['options'] = Array(
|
149 |
'optusage',
|
150 |
'Submit_Opt_Update',
|
151 |
'Submit_Opt_Preview',
|
152 |
-
'robothtml'
|
153 |
);
|
154 |
$this->default_options['optusage']['default'] = __( "Your Robots.txt file has been optimized. Here are the results and recommendations. Click the Update Robots.txt File button below to write these changes to your Robots.txt file. Click the Disregard Changes button to ignore these recommendations and keep your current Robots.txt file.", 'all-in-one-seo-pack' );
|
155 |
}
|
@@ -177,7 +177,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
177 |
'default' => '',
|
178 |
'type' => 'html',
|
179 |
'label' => 'none',
|
180 |
-
'style' => 'margin-top:10px;'
|
181 |
);
|
182 |
}
|
183 |
}
|
@@ -195,6 +195,28 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
195 |
return $submit;
|
196 |
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
function filter_options( $options, $location ) {
|
199 |
if ( $location ) {
|
200 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
@@ -223,7 +245,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
223 |
}
|
224 |
$access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
|
225 |
if ( $access ) {
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
$block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
|
228 |
if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
|
229 |
$options[ $prefix . 'robotgen' ] = '';
|
@@ -354,7 +382,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
354 |
'type' => 'blank',
|
355 |
'content' => $l,
|
356 |
'valid' => true,
|
357 |
-
'strict' => true
|
358 |
);
|
359 |
$state = 0;
|
360 |
}
|
@@ -367,7 +395,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
367 |
'type' => 'comment',
|
368 |
'content' => $l,
|
369 |
'valid' => true,
|
370 |
-
'strict' => true
|
371 |
);
|
372 |
} elseif ( stripos( $l, 'sitemap' ) === 0 ) {
|
373 |
$state = 2;
|
@@ -376,7 +404,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
376 |
'type' => 'sitemap',
|
377 |
'content' => $l,
|
378 |
'valid' => true,
|
379 |
-
'strict' => false
|
380 |
);
|
381 |
} elseif ( stripos( $l, 'crawl-delay' ) === 0 ) {
|
382 |
$state = 3;
|
@@ -385,7 +413,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
385 |
'type' => 'crawl-delay',
|
386 |
'content' => $l,
|
387 |
'valid' => true,
|
388 |
-
'strict' => false
|
389 |
);
|
390 |
} elseif ( stripos( $l, 'user-agent' ) === 0 ) {
|
391 |
$state = 3;
|
@@ -394,7 +422,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
394 |
'type' => 'user-agent',
|
395 |
'content' => $l,
|
396 |
'valid' => true,
|
397 |
-
'strict' => true
|
398 |
);
|
399 |
} elseif ( stripos( $l, 'useragent' ) === 0 ) {
|
400 |
$state = 3;
|
@@ -403,7 +431,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
403 |
'type' => 'user-agent',
|
404 |
'content' => $l,
|
405 |
'valid' => true,
|
406 |
-
'strict' => false
|
407 |
);
|
408 |
} elseif ( stripos( $l, 'disallow' ) === 0 ) {
|
409 |
if ( $state < 3 ) {
|
@@ -412,7 +440,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
412 |
'type' => 'disallow',
|
413 |
'content' => $l,
|
414 |
'valid' => false,
|
415 |
-
'strict' => false
|
416 |
);
|
417 |
continue;
|
418 |
}
|
@@ -422,7 +450,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
422 |
'type' => 'disallow',
|
423 |
'content' => $l,
|
424 |
'valid' => true,
|
425 |
-
'strict' => true
|
426 |
);
|
427 |
} elseif ( stripos( $l, 'allow' ) === 0 ) {
|
428 |
if ( $state < 3 ) {
|
@@ -431,7 +459,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
431 |
'type' => 'allow',
|
432 |
'content' => $l,
|
433 |
'valid' => false,
|
434 |
-
'strict' => false
|
435 |
);
|
436 |
continue;
|
437 |
}
|
@@ -441,7 +469,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
441 |
'type' => 'allow',
|
442 |
'content' => $l,
|
443 |
'valid' => true,
|
444 |
-
'strict' => false
|
445 |
);
|
446 |
} else {
|
447 |
$rules[] = Array(
|
@@ -449,7 +477,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Robots' ) ) {
|
|
449 |
'type' => 'unknown',
|
450 |
'content' => $l,
|
451 |
'valid' => false,
|
452 |
-
'strict' => false
|
453 |
);
|
454 |
}
|
455 |
}
|
26 |
'type' => 'html',
|
27 |
'label' => 'none',
|
28 |
'default' => __( 'Use the rule builder below to add rules to create a new Robots.txt file. If you already have a Robots.txt file you should use the File Editor feature in All in One SEO Pack to edit it or you can delete your current Robots.txt file and start a new one with the rule builder below.', 'all-in-one-seo-pack' ),
|
29 |
+
'save' => false,
|
30 |
),
|
31 |
'additional' => Array(
|
32 |
'name' => __( 'Rule Type', 'all-in-one-seo-pack' ),
|
33 |
'save' => false,
|
34 |
'type' => 'select',
|
35 |
+
'initial_options' => Array( 'allow' => 'Allow', 'block' => 'Block' ),
|
36 |
),
|
37 |
'useragent' => Array(
|
38 |
'name' => __( 'User Agent', 'all-in-one-seo-pack' ),
|
39 |
'save' => false,
|
40 |
+
'type' => 'text',
|
41 |
),
|
42 |
'path' => Array(
|
43 |
'name' => __( 'Directory Path', 'all-in-one-seo-pack' ),
|
44 |
'save' => false,
|
45 |
+
'type' => 'text',
|
46 |
),
|
47 |
'robotgen' => Array(
|
48 |
'name' => __( 'Generate Robots.txt', 'all-in-one-seo-pack' ),
|
52 |
'cols' => 57,
|
53 |
'rows' => 20,
|
54 |
'label' => 'none',
|
55 |
+
'readonly' => 'readonly',
|
56 |
),
|
57 |
'Submit_Preview' => Array(
|
58 |
'type' => 'submit',
|
59 |
'class' => 'button-primary MRL',
|
60 |
'name' => __( 'Add Rule', 'all-in-one-seo-pack' ) . ' »',
|
61 |
+
'nowrap' => 1,
|
62 |
),
|
63 |
'Submit_Update' => Array(
|
64 |
'type' => 'submit',
|
65 |
'class' => 'button-primary',
|
66 |
'name' => __( 'Save Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
67 |
+
'nowrap' => 1,
|
68 |
),
|
69 |
'Submit_Delete' => Array(
|
70 |
'type' => 'submit',
|
71 |
'class' => 'button-primary',
|
72 |
'name' => __( 'Delete Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
73 |
+
'nowrap' => 1,
|
74 |
),
|
75 |
'optusage' => Array(
|
76 |
'type' => 'html',
|
77 |
'label' => 'none',
|
78 |
'default' => __( 'Click the Optimize button below and All in One SEO Pack will analyze your Robots.txt file to make sure it complies with the standards for Robots.txt files. The results will be displayed in a table below.', 'all-in-one-seo-pack' ),
|
79 |
+
'save' => false,
|
80 |
),
|
81 |
'Submit_Opt_Update' => Array(
|
82 |
'type' => 'submit',
|
83 |
'class' => 'button-primary',
|
84 |
'name' => __( 'Update Robots.txt File', 'all-in-one-seo-pack' ) . ' »',
|
85 |
'nowrap' => 1,
|
86 |
+
'style' => 'margin-left: 20px;',
|
87 |
),
|
88 |
'Submit_Opt_Preview' => Array(
|
89 |
'type' => 'submit',
|
90 |
'class' => 'button-primary',
|
91 |
'name' => __( 'Disregard Changes', 'all-in-one-seo-pack' ) . ' »',
|
92 |
+
'nowrap' => 1,
|
93 |
),
|
94 |
'Submit_Optimize' => Array(
|
95 |
'type' => 'submit',
|
96 |
'class' => 'button-primary',
|
97 |
+
'name' => __( 'Optimize', 'all-in-one-seo-pack' ) . ' »',
|
98 |
+
),
|
99 |
);
|
100 |
|
101 |
if ( ! empty( $help_text ) ) {
|
120 |
'optusage',
|
121 |
'Submit_Opt_Update',
|
122 |
'Submit_Opt_Preview',
|
123 |
+
'Submit_Optimize',
|
124 |
+
),
|
125 |
),
|
126 |
);
|
127 |
|
136 |
'Submit_Preview',
|
137 |
'Submit_Update',
|
138 |
'Submit_Delete',
|
139 |
+
'robotgen',
|
140 |
) // this is set below, to the remaining options -- pdb
|
141 |
+
),
|
142 |
);
|
143 |
$this->layout['optimize'] = Array(
|
144 |
'name' => __( 'Optimize your Robots.txt File', 'all-in-one-seo-pack' ),
|
145 |
+
'options' => Array( 'optusage', 'Submit_Optimize' ),
|
146 |
);
|
147 |
if ( isset( $_POST['Submit_Optimize'] ) ) {
|
148 |
$this->layout['optimize']['options'] = Array(
|
149 |
'optusage',
|
150 |
'Submit_Opt_Update',
|
151 |
'Submit_Opt_Preview',
|
152 |
+
'robothtml',
|
153 |
);
|
154 |
$this->default_options['optusage']['default'] = __( "Your Robots.txt file has been optimized. Here are the results and recommendations. Click the Update Robots.txt File button below to write these changes to your Robots.txt file. Click the Disregard Changes button to ignore these recommendations and keep your current Robots.txt file.", 'all-in-one-seo-pack' );
|
155 |
}
|
177 |
'default' => '',
|
178 |
'type' => 'html',
|
179 |
'label' => 'none',
|
180 |
+
'style' => 'margin-top:10px;',
|
181 |
);
|
182 |
}
|
183 |
}
|
195 |
return $submit;
|
196 |
}
|
197 |
|
198 |
+
/**
|
199 |
+
* Returns the sitemap filename;
|
200 |
+
*
|
201 |
+
* @return bool
|
202 |
+
*/
|
203 |
+
function get_sitemap_filename() {
|
204 |
+
|
205 |
+
global $aioseop_options;
|
206 |
+
if ( isset( $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename'] ) ) {
|
207 |
+
return $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_filename'];
|
208 |
+
}
|
209 |
+
|
210 |
+
return false;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Filters the options.
|
215 |
+
*
|
216 |
+
* @todo Much of this couldn't be considered filtering options, and should be extracted to other functions.
|
217 |
+
* @since ??
|
218 |
+
* @since 2.3.6
|
219 |
+
*/
|
220 |
function filter_options( $options, $location ) {
|
221 |
if ( $location ) {
|
222 |
$prefix = $this->get_prefix( $location ) . $location . '_';
|
245 |
}
|
246 |
$access = ( get_option( 'blog_public' ) ) ? 'allow' : 'block';
|
247 |
if ( $access ) {
|
248 |
+
global $aioseop_options;
|
249 |
+
$sitemap_url = '';
|
250 |
+
$sitemap_filename = $this->get_sitemap_filename();
|
251 |
+
if ( $sitemap_filename ) {
|
252 |
+
$sitemapurl = trailingslashit( get_home_url() ) . $sitemap_filename . '.xml';
|
253 |
+
}
|
254 |
+
$allow_rule = "Sitemap: $sitemapurl \n\n# global\nUser-agent: *\nDisallow: /xmlrpc.php\n\n";
|
255 |
$block_rule = "# global\nUser-agent: *\nDisallow: /\n\n";
|
256 |
if ( empty( $options[ $prefix . 'robotgen' ] ) ) {
|
257 |
$options[ $prefix . 'robotgen' ] = '';
|
382 |
'type' => 'blank',
|
383 |
'content' => $l,
|
384 |
'valid' => true,
|
385 |
+
'strict' => true,
|
386 |
);
|
387 |
$state = 0;
|
388 |
}
|
395 |
'type' => 'comment',
|
396 |
'content' => $l,
|
397 |
'valid' => true,
|
398 |
+
'strict' => true,
|
399 |
);
|
400 |
} elseif ( stripos( $l, 'sitemap' ) === 0 ) {
|
401 |
$state = 2;
|
404 |
'type' => 'sitemap',
|
405 |
'content' => $l,
|
406 |
'valid' => true,
|
407 |
+
'strict' => false,
|
408 |
);
|
409 |
} elseif ( stripos( $l, 'crawl-delay' ) === 0 ) {
|
410 |
$state = 3;
|
413 |
'type' => 'crawl-delay',
|
414 |
'content' => $l,
|
415 |
'valid' => true,
|
416 |
+
'strict' => false,
|
417 |
);
|
418 |
} elseif ( stripos( $l, 'user-agent' ) === 0 ) {
|
419 |
$state = 3;
|
422 |
'type' => 'user-agent',
|
423 |
'content' => $l,
|
424 |
'valid' => true,
|
425 |
+
'strict' => true,
|
426 |
);
|
427 |
} elseif ( stripos( $l, 'useragent' ) === 0 ) {
|
428 |
$state = 3;
|
431 |
'type' => 'user-agent',
|
432 |
'content' => $l,
|
433 |
'valid' => true,
|
434 |
+
'strict' => false,
|
435 |
);
|
436 |
} elseif ( stripos( $l, 'disallow' ) === 0 ) {
|
437 |
if ( $state < 3 ) {
|
440 |
'type' => 'disallow',
|
441 |
'content' => $l,
|
442 |
'valid' => false,
|
443 |
+
'strict' => false,
|
444 |
);
|
445 |
continue;
|
446 |
}
|
450 |
'type' => 'disallow',
|
451 |
'content' => $l,
|
452 |
'valid' => true,
|
453 |
+
'strict' => true,
|
454 |
);
|
455 |
} elseif ( stripos( $l, 'allow' ) === 0 ) {
|
456 |
if ( $state < 3 ) {
|
459 |
'type' => 'allow',
|
460 |
'content' => $l,
|
461 |
'valid' => false,
|
462 |
+
'strict' => false,
|
463 |
);
|
464 |
continue;
|
465 |
}
|
469 |
'type' => 'allow',
|
470 |
'content' => $l,
|
471 |
'valid' => true,
|
472 |
+
'strict' => false,
|
473 |
);
|
474 |
} else {
|
475 |
$rules[] = Array(
|
477 |
'type' => 'unknown',
|
478 |
'content' => $l,
|
479 |
'valid' => false,
|
480 |
+
'strict' => false,
|
481 |
);
|
482 |
}
|
483 |
}
|
modules/aioseop_sitemap.php
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @package All-in-One-SEO-Pack
|
4 |
*/
|
5 |
-
|
6 |
-
* The Sitemap class.
|
7 |
-
*/
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
|
|
|
|
|
|
|
9 |
class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
|
10 |
var $cache_struct = null;
|
11 |
var $cache_home = null;
|
@@ -19,47 +23,52 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
19 |
var $freq_sel;
|
20 |
var $extra_sitemaps;
|
21 |
|
|
|
|
|
|
|
22 |
function __construct() {
|
23 |
-
if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
|
24 |
-
$this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
|
25 |
-
$this->prefix = 'aiosp_sitemap_'; //
|
26 |
-
$this->file = __FILE__; //
|
27 |
-
$this->extra_sitemaps =
|
28 |
$this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps );
|
29 |
}
|
30 |
parent::__construct();
|
31 |
-
$this->comment_string =
|
32 |
-
|
33 |
-
$this->help_text =
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
"excl_pages" => __( "Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.", 'all-in-one-seo-pack' )
|
56 |
);
|
57 |
|
58 |
-
$this->help_anchors =
|
59 |
'filename' => '#filename-prefix',
|
60 |
'google' => '#notify-google-bing',
|
61 |
'bing' => '#notify-google-bing',
|
|
|
62 |
'indexes' => '#enable-sitemap-indexes',
|
|
|
|
|
63 |
'posttypes' => '#post-types-and-taxonomies',
|
64 |
'taxonomies' => '#post-types-and-taxonomies',
|
65 |
'archive' => '#include-archive-pages',
|
@@ -76,69 +85,65 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
76 |
);
|
77 |
|
78 |
$this->default_options = array(
|
79 |
-
'filename' =>
|
80 |
'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
|
81 |
'default' => 'sitemap',
|
82 |
'type' => 'text',
|
83 |
-
'sanitize' => 'filename'
|
84 |
),
|
85 |
-
'google' =>
|
86 |
-
'bing' =>
|
87 |
-
'daily_cron' =>
|
88 |
'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
|
89 |
'type' => 'select',
|
90 |
-
'initial_options' =>
|
91 |
0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
|
92 |
'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
|
93 |
'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
|
94 |
-
'monthly' => __( 'Monthly', 'all-in-one-seo-pack' )
|
95 |
),
|
96 |
-
'default' => 0
|
97 |
),
|
98 |
-
'indexes' =>
|
99 |
-
'paginate' =>
|
100 |
'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
|
101 |
-
'condshow' =>
|
102 |
),
|
103 |
-
'max_posts' =>
|
104 |
'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
|
105 |
'type' => 'text',
|
106 |
'default' => 50000,
|
107 |
-
'condshow' =>
|
108 |
),
|
109 |
-
'posttypes' =>
|
110 |
'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
|
111 |
'type' => 'multicheckbox',
|
112 |
-
'default' => 'all'
|
113 |
),
|
114 |
-
'taxonomies' =>
|
115 |
'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
|
116 |
'type' => 'multicheckbox',
|
117 |
-
'default' => 'all'
|
118 |
),
|
119 |
-
'archive' =>
|
120 |
-
'author' =>
|
121 |
-
'gzipped' =>
|
122 |
'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
|
123 |
-
'default' => 'On'
|
124 |
),
|
125 |
-
'robots' =>
|
126 |
'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ),
|
127 |
-
'default' => 'On'
|
128 |
),
|
129 |
-
'rewrite' =>
|
130 |
'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ),
|
131 |
-
'default' => 'On'
|
132 |
),
|
133 |
-
'noindex' => Array(
|
134 |
-
'name' => __( 'Noindex Sitemap file', 'all-in-one-seo-pack' ),
|
135 |
-
'condshow' => Array( "{$this->prefix}rewrite" => true )
|
136 |
-
)
|
137 |
);
|
138 |
|
139 |
-
$status_options =
|
140 |
-
'link' =>
|
141 |
-
'debug' =>
|
142 |
'name' => __( 'Debug Log', 'all-in-one-seo-pack' ),
|
143 |
'default' => '',
|
144 |
'type' => 'html',
|
@@ -147,212 +152,266 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
147 |
'label' => 'none',
|
148 |
'rows' => 5,
|
149 |
'cols' => 120,
|
150 |
-
'style' => 'min-width:950px'
|
151 |
-
)
|
152 |
);
|
153 |
|
154 |
-
$this->layout =
|
155 |
-
'status' =>
|
156 |
'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ),
|
157 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
158 |
-
'options' => array_keys( $status_options )
|
159 |
),
|
160 |
-
'default' =>
|
161 |
'name' => $this->name,
|
162 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
163 |
-
'options' => array_keys( $this->default_options )
|
164 |
-
)
|
165 |
);
|
166 |
|
167 |
-
$prio =
|
168 |
for ( $i = 0; $i <= 10; $i ++ ) {
|
169 |
-
$str = sprintf(
|
170 |
$prio[ $str ] = $str;
|
171 |
}
|
172 |
-
$arr_no =
|
173 |
-
$arr_sel =
|
174 |
$this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
|
175 |
$this->prio = array_merge( $arr_no, $prio );
|
176 |
|
177 |
-
$freq =
|
178 |
-
foreach (
|
179 |
$freq[ $f ] = $f;
|
180 |
}
|
181 |
$this->freq_sel = array_merge( $arr_no, $arr_sel, $freq );
|
182 |
$this->freq = array_merge( $arr_no, $freq );
|
183 |
|
184 |
foreach (
|
185 |
-
|
186 |
'prio' => __( 'priority', 'all-in-one-seo-pack' ),
|
187 |
-
'freq' => __( 'frequency', 'all-in-one-seo-pack' )
|
188 |
) as $k => $v
|
189 |
) {
|
190 |
$s = "{$k}_options";
|
191 |
-
$$s =
|
192 |
foreach (
|
193 |
-
|
194 |
'homepage' => __( 'homepage', 'all-in-one-seo-pack' ),
|
195 |
'post' => __( 'posts', 'all-in-one-seo-pack' ),
|
196 |
'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ),
|
197 |
'archive' => __( 'archive pages', 'all-in-one-seo-pack' ),
|
198 |
-
'author' => __( 'author pages', 'all-in-one-seo-pack' )
|
199 |
) as $opt => $val
|
200 |
) {
|
201 |
$arr = $$s;
|
202 |
-
if ( (
|
203 |
$iopts = $this->{"{$k}_sel"};
|
204 |
} else {
|
205 |
$iopts = $this->$k;
|
206 |
}
|
207 |
|
208 |
-
$arr[ $k . '_' . $opt ] =
|
209 |
'name' => $this->ucwords( $val ),
|
210 |
-
'help_text' => sprintf( __(
|
211 |
'type' => 'select',
|
212 |
'initial_options' => $iopts,
|
213 |
-
'default' => 'no'
|
214 |
);
|
215 |
-
if ( (
|
216 |
-
$arr[ $k . '_' . $opt ]['condshow'] =
|
217 |
}
|
218 |
$$s = $arr;
|
219 |
}
|
220 |
}
|
221 |
|
222 |
-
$addl_options =
|
223 |
-
'addl_instructions' =>
|
224 |
'default' => '<div>' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '</div><br />',
|
225 |
'type' => 'html',
|
226 |
'label' => 'none',
|
227 |
-
'save' => false
|
228 |
),
|
229 |
-
'addl_url' =>
|
230 |
'name' => __( 'Page URL', 'all-in-one-seo-pack' ),
|
231 |
'type' => 'text',
|
232 |
'label' => 'top',
|
233 |
-
'save' => false
|
234 |
),
|
235 |
-
'addl_prio' =>
|
236 |
'name' => __( 'Page Priority', 'all-in-one-seo-pack' ),
|
237 |
'type' => 'select',
|
238 |
'initial_options' => $prio,
|
239 |
'label' => 'top',
|
240 |
-
'save' => false
|
241 |
),
|
242 |
-
'addl_freq' =>
|
243 |
'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ),
|
244 |
'type' => 'select',
|
245 |
'initial_options' => $freq,
|
246 |
'label' => 'top',
|
247 |
-
'save' => false
|
248 |
),
|
249 |
-
'addl_mod' =>
|
250 |
'name' => __( 'Last Modified', 'all-in-one-seo-pack' ),
|
251 |
'type' => 'text',
|
252 |
'label' => 'top',
|
253 |
-
'save' => false
|
254 |
),
|
255 |
-
'addl_pages' =>
|
256 |
'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
|
257 |
'type' => 'custom',
|
258 |
-
'save' => true
|
259 |
),
|
260 |
-
'Submit' =>
|
261 |
'type' => 'submit',
|
262 |
'class' => 'button-primary',
|
263 |
'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' »',
|
264 |
'style' => 'margin-left: 20px;',
|
265 |
'label' => 'none',
|
266 |
'save' => false,
|
267 |
-
'value' => 1
|
268 |
-
)
|
269 |
);
|
270 |
|
271 |
-
$excl_options =
|
272 |
-
'excl_categories' =>
|
273 |
'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ),
|
274 |
'type' => 'multicheckbox',
|
275 |
-
'initial_options' => ''
|
276 |
),
|
277 |
-
'excl_pages' =>
|
278 |
);
|
279 |
|
280 |
-
$this->layout['addl_pages'] =
|
281 |
'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
|
282 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages',
|
283 |
-
'options' => array_keys( $addl_options )
|
284 |
);
|
285 |
|
286 |
-
$this->layout['excl_pages'] =
|
287 |
'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ),
|
288 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items',
|
289 |
-
'options' => array_keys( $excl_options )
|
290 |
);
|
291 |
|
292 |
-
$this->layout['priorities'] =
|
293 |
'name' => __( 'Priorities', 'all-in-one-seo-pack' ),
|
294 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
|
295 |
-
'options' => array_keys( $prio_options )
|
296 |
);
|
297 |
|
298 |
-
$this->layout['frequencies'] =
|
299 |
'name' => __( 'Frequencies', 'all-in-one-seo-pack' ),
|
300 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
|
301 |
-
'options' => array_keys( $freq_options )
|
302 |
);
|
303 |
|
304 |
$this->default_options = array_merge( $status_options, $this->default_options, $addl_options, $excl_options, $prio_options, $freq_options );
|
305 |
|
306 |
$this->add_help_text_links();
|
307 |
|
308 |
-
add_action( '
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
}
|
316 |
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
function add_cron_schedules( $schedules ) {
|
320 |
$schedules['weekly'] = array(
|
321 |
-
'interval' => 604800, // 1 week in seconds
|
322 |
-
'display' => __( 'Once Weekly', 'all-in-one-seo-pack' )
|
323 |
);
|
324 |
$schedules['monthly'] = array(
|
325 |
-
'interval' => 2629740, // 1 month in seconds
|
326 |
-
'display' => __( 'Once Monthly', 'all-in-one-seo-pack' )
|
327 |
);
|
328 |
|
329 |
return $schedules;
|
330 |
}
|
331 |
|
|
|
|
|
|
|
332 |
function cron_update() {
|
333 |
-
add_filter( 'cron_schedules',
|
334 |
if ( ! wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
|
335 |
wp_schedule_event( time(), $this->options[ $this->prefix . 'daily_cron' ], $this->prefix . 'daily_update_cron' );
|
336 |
}
|
337 |
}
|
338 |
|
|
|
|
|
|
|
339 |
function daily_update() {
|
340 |
$last_run = get_option( $this->prefix . 'cron_last_run' );
|
341 |
-
if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) )
|
342 |
-
|
343 |
-
$this->do_sitemaps( __(
|
344 |
}
|
345 |
$last_run = time();
|
346 |
update_option( $this->prefix . 'cron_last_run', $last_run );
|
347 |
}
|
348 |
|
349 |
-
/**
|
|
|
|
|
350 |
function load_sitemap_options() {
|
351 |
-
//
|
352 |
$this->update_options();
|
353 |
if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
|
354 |
$this->paginate = true;
|
355 |
-
if (
|
356 |
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
357 |
}
|
358 |
}
|
@@ -366,11 +425,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
366 |
}
|
367 |
|
368 |
if ( $this->option_isset( 'robots' ) ) {
|
369 |
-
add_action( 'do_robots',
|
370 |
}
|
371 |
|
372 |
if ( isset( $this->options[ $this->prefix . 'daily_cron' ] ) && $this->options[ $this->prefix . 'daily_cron' ] ) {
|
373 |
-
add_action( 'wp',
|
374 |
} else {
|
375 |
if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
|
376 |
wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' );
|
@@ -378,9 +437,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
378 |
}
|
379 |
}
|
380 |
|
381 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
function display_custom_options( $buf, $args ) {
|
383 |
-
if (
|
384 |
$buf .= "<div id='{$this->prefix}addl_pages'>";
|
385 |
if ( ! empty( $args['value'] ) ) {
|
386 |
$buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
|
@@ -395,7 +463,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
395 |
}
|
396 |
$args['options']['type'] = 'hidden';
|
397 |
if ( ! empty( $args['value'] ) ) {
|
398 |
-
$args['value'] =
|
399 |
} else {
|
400 |
$args['options']['type'] = 'html';
|
401 |
}
|
@@ -408,94 +476,114 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
408 |
return $buf;
|
409 |
}
|
410 |
|
411 |
-
/**
|
|
|
|
|
412 |
function add_post_types() {
|
413 |
-
$post_type_titles = $this->get_post_type_titles(
|
414 |
-
$taxonomy_titles = $this->get_taxonomy_titles(
|
415 |
if ( isset( $post_type_titles['attachment'] ) ) {
|
416 |
-
$post_type_titles['attachment'] = __(
|
417 |
}
|
418 |
-
$this->default_options['posttypes']['initial_options'] = array_merge(
|
419 |
-
$this->default_options['taxonomies']['initial_options'] = array_merge(
|
420 |
$this->default_options['posttypes']['default'] = array_keys( $this->default_options['posttypes']['initial_options'] );
|
421 |
$this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
|
422 |
$this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();
|
423 |
-
$prio_help = __(
|
424 |
-
$freq_help = __(
|
425 |
-
$post_name = __(
|
426 |
-
$tax_name = __(
|
427 |
foreach ( $post_type_titles as $k => $v ) {
|
428 |
$key = 'prio_post_' . $k;
|
429 |
-
$this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post',
|
430 |
-
$key =>
|
431 |
'name' => $v . $post_name,
|
432 |
'help_text' => $prio_help . $v . $post_name,
|
433 |
'type' => 'select',
|
434 |
'initial_options' => $this->prio,
|
435 |
'default' => 'no',
|
436 |
-
'condshow' =>
|
437 |
-
)
|
438 |
) );
|
439 |
$this->layout['priorities']['options'][] = $key;
|
440 |
$key = 'freq_post_' . $k;
|
441 |
-
$this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_post',
|
442 |
-
$key =>
|
443 |
'name' => $v . $post_name,
|
444 |
'help_text' => $freq_help . $v . $post_name,
|
445 |
'type' => 'select',
|
446 |
'initial_options' => $this->freq,
|
447 |
'default' => 'no',
|
448 |
-
'condshow' =>
|
449 |
-
)
|
450 |
) );
|
451 |
$this->layout['frequencies']['options'][] = $key;
|
452 |
}
|
453 |
foreach ( $taxonomy_titles as $k => $v ) {
|
454 |
$key = 'prio_taxonomies_' . $k;
|
455 |
-
$this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies',
|
456 |
-
$key =>
|
457 |
'name' => $v . $tax_name,
|
458 |
'help_text' => $prio_help . $v . $tax_name,
|
459 |
'type' => 'select',
|
460 |
'initial_options' => $this->prio,
|
461 |
'default' => 'no',
|
462 |
-
'condshow' =>
|
463 |
-
)
|
464 |
) );
|
465 |
$this->layout['priorities']['options'][] = $key;
|
466 |
$key = 'freq_taxonomies_' . $k;
|
467 |
-
$this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_taxonomies',
|
468 |
-
$key =>
|
469 |
'name' => $v . $tax_name,
|
470 |
'help_text' => $freq_help . $v . $tax_name,
|
471 |
'type' => 'select',
|
472 |
'initial_options' => $this->freq,
|
473 |
'default' => 'no',
|
474 |
-
'condshow' =>
|
475 |
-
)
|
476 |
) );
|
477 |
$this->layout['frequencies']['options'][] = $key;
|
478 |
}
|
479 |
$this->update_options();
|
480 |
}
|
481 |
|
482 |
-
/**
|
|
|
|
|
483 |
function add_page_hooks() {
|
484 |
$this->flush_rules_hook();
|
485 |
$this->add_post_types();
|
486 |
parent::add_page_hooks();
|
487 |
-
add_action( $this->prefix . 'settings_header',
|
488 |
-
add_filter( "{$this->prefix}submit_options",
|
489 |
-
}
|
490 |
-
|
491 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
function filter_submit( $submit ) {
|
493 |
$submit['Submit']['value'] = __( 'Update Sitemap', 'all-in-one-seo-pack' ) . ' »';
|
494 |
|
495 |
return $submit;
|
496 |
}
|
497 |
|
498 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
function update_post_data( $options ) {
|
500 |
if ( is_multisite() ) {
|
501 |
$options[ $this->prefix . 'rewrite' ]['disabled'] = 'disabled';
|
@@ -504,6 +592,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
504 |
return $options;
|
505 |
}
|
506 |
|
|
|
|
|
|
|
|
|
|
|
507 |
function get_rewrite_url( $url ) {
|
508 |
global $wp_rewrite;
|
509 |
$url = parse_url( esc_url( $url ), PHP_URL_PATH );
|
@@ -520,7 +613,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
520 |
return false;
|
521 |
}
|
522 |
|
523 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
function filter_display_options( $options ) {
|
525 |
if ( is_multisite() ) {
|
526 |
$options[ $this->prefix . 'rewrite' ] = 'On';
|
@@ -529,39 +630,47 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
529 |
$options[ $this->prefix . 'max_posts' ] = 50000;
|
530 |
}
|
531 |
$url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml';
|
532 |
-
$options[ $this->prefix . 'link' ] = sprintf( __(
|
533 |
'all-in-one-seo-pack' ), sprintf( '<a href="#" onclick="document.dofollow.elements[\'Submit\'][0].click();">%s</a>',
|
534 |
__( 'Update Sitemap', 'all-in-one-seo-pack' ) ), '<a href="' . esc_url( $url ) . '" target="_blank">' .
|
535 |
-
__(
|
536 |
if ( $this->option_isset( 'rewrite' ) ) {
|
537 |
|
538 |
-
$options[ $this->prefix . 'link' ] .= '<p>' . __(
|
539 |
$rule = $this->get_rewrite_url( $url );
|
540 |
$rules = $this->get_rewrite_rules();
|
541 |
if ( in_array( $rule, $rules ) ) {
|
542 |
-
$options[ $this->prefix . 'link' ] .= '<p>' . __(
|
543 |
} else {
|
544 |
-
$options[ $this->prefix . 'link' ] .= '<p>' . __(
|
545 |
}
|
546 |
}
|
547 |
if ( ! get_option( 'blog_public' ) ) {
|
548 |
global $wp_version;
|
549 |
-
if (
|
550 |
$privacy_link = '<a href="options-reading.php">' . __( 'Reading Settings', 'all-in-one-seo-pack' ) . '</a>';
|
551 |
} else {
|
552 |
$privacy_link = '<a href="options-privacy.php">' . __( 'Privacy Settings', 'all-in-one-seo-pack' ) . '</a>';
|
553 |
}
|
554 |
-
$options[ $this->prefix . 'link' ] .= '<p class="aioseop_error_notice">' . sprintf( __(
|
555 |
-
'all-in-one-seo-pack' ), $privacy_link );
|
556 |
}
|
557 |
if ( $this->option_isset( 'debug' ) ) {
|
558 |
-
$
|
|
|
559 |
}
|
560 |
|
561 |
return $options;
|
562 |
}
|
563 |
|
564 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
function filter_options( $options ) {
|
566 |
if ( ! isset( $this->default_options['posttypes']['initial_options'] ) ) {
|
567 |
$this->add_post_types();
|
@@ -584,13 +693,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
584 |
if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) {
|
585 |
$options[ $this->prefix . 'addl_pages' ] = wp_specialchars_decode( stripslashes_deep( $options[ $this->prefix . 'addl_pages' ] ), ENT_QUOTES );
|
586 |
$decoded = json_decode( $options[ $this->prefix . 'addl_pages' ] );
|
587 |
-
if (
|
588 |
$decoded = maybe_unserialize( $options[ $this->prefix . 'addl_pages' ] );
|
589 |
}
|
590 |
if ( ! is_array( $decoded ) ) {
|
591 |
$decoded = (Array) $decoded;
|
592 |
}
|
593 |
-
if (
|
594 |
$decoded = $options[ $this->prefix . 'addl_pages' ];
|
595 |
}
|
596 |
$options[ $this->prefix . 'addl_pages' ] = $decoded;
|
@@ -605,8 +714,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
605 |
if ( isset( $options[ $this->prefix . 'addl_pages' ][0] ) ) {
|
606 |
unset( $options[ $this->prefix . 'addl_pages' ][0] );
|
607 |
}
|
|
|
608 |
if ( ! empty( $_POST[ $this->prefix . 'addl_url' ] ) ) {
|
609 |
-
foreach (
|
610 |
if ( ! empty( $_POST[ $this->prefix . $field ] ) ) {
|
611 |
$_POST[ $this->prefix . $field ] = esc_attr( wp_kses_post( $_POST[ $this->prefix . $field ] ) );
|
612 |
} else {
|
@@ -614,9 +724,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
614 |
}
|
615 |
}
|
616 |
if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) {
|
617 |
-
$options[ $this->prefix . 'addl_pages' ] =
|
618 |
}
|
619 |
-
$options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] =
|
620 |
'prio' => $_POST[ $this->prefix . 'addl_prio' ],
|
621 |
'freq' => $_POST[ $this->prefix . 'addl_freq' ],
|
622 |
'mod' => $_POST[ $this->prefix . 'addl_mod' ],
|
@@ -626,9 +736,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
626 |
return $options;
|
627 |
}
|
628 |
|
629 |
-
/**
|
|
|
|
|
|
|
|
|
630 |
function get_child_sitemap_urls() {
|
631 |
-
$siteurls =
|
632 |
$blogs = $this->get_child_blogs();
|
633 |
if ( ! empty( $blogs ) ) {
|
634 |
$option_name = $this->get_option_name();
|
@@ -664,14 +778,48 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
664 |
}
|
665 |
}
|
666 |
}
|
667 |
-
$siteurls = apply_filters( $this->prefix . 'sitemap_urls', $siteurls ); //
|
668 |
return apply_filters( $this->prefix . 'child_urls', $siteurls );
|
669 |
}
|
670 |
|
671 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
function scan_match_files() {
|
673 |
$scan1 = $scan2 = '';
|
674 |
-
$files =
|
675 |
|
676 |
if ( ! empty( $this->options["{$this->prefix}filename"] ) ) {
|
677 |
$scan1 = get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml';
|
@@ -700,10 +848,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
700 |
}
|
701 |
}
|
702 |
|
703 |
-
/**
|
|
|
|
|
|
|
|
|
704 |
function do_sitemap_scan() {
|
705 |
$msg = '';
|
706 |
-
if ( ! empty( $this->options["{$this->prefix}rewrite"] ) && ( get_option( 'permalink_structure' )
|
707 |
$msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all-in-one-seo-pack' ) . '</p>';
|
708 |
}
|
709 |
if ( ! empty( $_POST['aioseop_sitemap_rename_files'] ) || ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
@@ -721,25 +873,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
721 |
if ( in_array( $ren_file, $files ) ) {
|
722 |
if ( ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
723 |
if ( $this->delete_file( $ren_file ) ) {
|
724 |
-
$msg .=
|
725 |
}
|
726 |
continue;
|
727 |
}
|
728 |
$count = 0;
|
729 |
do {
|
730 |
-
$ren_to = $ren_file . '._' . sprintf(
|
731 |
$count ++;
|
732 |
} while ( $this->file_exists( $ren_to ) && ( $count < 1000 ) );
|
733 |
if ( $count >= 1000 ) {
|
734 |
-
$msg .=
|
735 |
} else {
|
736 |
$ren = $this->rename_file( $ren_file, $ren_to );
|
737 |
if ( $ren ) {
|
738 |
-
$msg .=
|
739 |
}
|
740 |
}
|
741 |
} else {
|
742 |
-
$msg .=
|
743 |
}
|
744 |
}
|
745 |
}
|
@@ -752,7 +904,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
752 |
}
|
753 |
}
|
754 |
|
755 |
-
/**
|
|
|
|
|
|
|
|
|
756 |
function scan_sitemaps() {
|
757 |
$msg = '';
|
758 |
$files = $this->scan_match_files();
|
@@ -763,15 +919,24 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
763 |
return $msg;
|
764 |
}
|
765 |
|
766 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
767 |
function get_problem_files( $files, &$msg ) {
|
768 |
-
$problem_files =
|
769 |
$use_wpfs = true;
|
770 |
$wpfs = $this->get_filesystem_object();
|
771 |
if ( ! is_object( $wpfs ) ) {
|
772 |
$use_wpfs = false;
|
773 |
} else {
|
774 |
-
if ( $wpfs->method
|
775 |
$use_wpfs = false;
|
776 |
}
|
777 |
}
|
@@ -780,11 +945,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
780 |
if ( $this->is_file( $f ) ) {
|
781 |
$fn = $f;
|
782 |
$compressed = false;
|
783 |
-
if ( $this->substr( $f, - 3 )
|
784 |
$compressed = true;
|
785 |
}
|
786 |
if ( $use_wpfs ) {
|
787 |
-
if ( $compressed ) { //
|
788 |
$file = $this->load_file( $fn );
|
789 |
if ( ! empty( $file ) ) {
|
790 |
$file = gzuncompress( $file, 4096 );
|
@@ -799,8 +964,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
799 |
$file = file_get_contents( $fn, false, null, - 1, 4096 );
|
800 |
}
|
801 |
if ( ! empty( $file ) ) {
|
802 |
-
$matches =
|
803 |
-
if ( preg_match(
|
804 |
$file, $matches ) ) {
|
805 |
if ( ! empty( $this->options["{$this->prefix}rewrite"] ) ) {
|
806 |
$msg .= '<p>' . sprintf( __( "Warning: a static sitemap '%s' generated by All in One SEO Pack %s on %s already exists that may conflict with dynamic sitemap generation.", 'all-in-one-seo-pack' ),
|
@@ -808,7 +973,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
808 |
$problem_files[] = $f;
|
809 |
}
|
810 |
} else {
|
811 |
-
$msg .= '<p>' . sprintf( __(
|
812 |
$problem_files[] = $f;
|
813 |
}
|
814 |
}
|
@@ -818,7 +983,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
818 |
return $problem_files;
|
819 |
}
|
820 |
|
821 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
822 |
function sitemap_warning( $files ) {
|
823 |
$msg = '';
|
824 |
$conflict = false;
|
@@ -831,15 +1004,19 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
831 |
$msg .= "<input type='hidden' name='aioseop_sitemap_conflict[]' value='" . esc_attr( basename( realpath( $p ) ) ) . "'>\n";
|
832 |
}
|
833 |
$msg .= "<input type='hidden' name='nonce-aioseop' value='" . wp_create_nonce( 'aioseop-nonce' ) . "'>\n";
|
834 |
-
$msg .= "<input type='submit' name='aioseop_sitemap_rename_files' value='" . __(
|
835 |
-
$msg .= "<input type='submit' name='aioseop_sitemap_delete_files' value='" . __(
|
836 |
$msg = '<form action="" method="post">' . $msg . '</form>';
|
837 |
}
|
838 |
|
839 |
return $msg;
|
840 |
}
|
841 |
|
842 |
-
/**
|
|
|
|
|
|
|
|
|
843 |
function debug_message( $msg ) {
|
844 |
if ( empty( $this->options["{$this->prefix}debug"] ) ) {
|
845 |
$this->options["{$this->prefix}debug"] = '';
|
@@ -847,7 +1024,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
847 |
$this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
|
848 |
if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
|
849 |
$end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
|
850 |
-
if (
|
851 |
$end = 2048;
|
852 |
}
|
853 |
$this->options["{$this->prefix}debug"] = $this->substr( $this->options["{$this->prefix}debug"], 0, $end );
|
@@ -855,29 +1032,35 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
855 |
$this->update_class_option( $this->options );
|
856 |
}
|
857 |
|
858 |
-
/**
|
|
|
|
|
859 |
function setup_rewrites() {
|
860 |
-
add_action( 'rewrite_rules_array',
|
861 |
-
add_filter( 'query_vars',
|
862 |
-
add_action( 'parse_query',
|
863 |
if ( ! get_transient( "{$this->prefix}rules_flushed" ) ) {
|
864 |
-
add_action( 'wp_loaded',
|
865 |
}
|
866 |
}
|
867 |
|
868 |
-
/**
|
|
|
|
|
|
|
|
|
869 |
function get_rewrite_rules() {
|
870 |
-
$sitemap_rules_normal = $sitemap_rules_gzipped =
|
871 |
$sitemap_rules_normal = array(
|
872 |
$this->options["{$this->prefix}filename"] . '.xml' => "index.php?{$this->prefix}path=root",
|
873 |
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
|
874 |
-
$this->options["{$this->prefix}filename"] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]'
|
875 |
);
|
876 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
877 |
$sitemap_rules_gzipped = array(
|
878 |
$this->options["{$this->prefix}filename"] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz",
|
879 |
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]',
|
880 |
-
$this->options["{$this->prefix}filename"] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz'
|
881 |
);
|
882 |
}
|
883 |
$sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
|
@@ -885,7 +1068,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
885 |
return $sitemap_rules;
|
886 |
}
|
887 |
|
888 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
function rewrite_hook( $rules ) {
|
890 |
$sitemap_rules = $this->get_rewrite_rules();
|
891 |
if ( ! empty( $sitemap_rules ) ) {
|
@@ -895,21 +1084,29 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
895 |
return $rules;
|
896 |
}
|
897 |
|
898 |
-
/**
|
|
|
|
|
899 |
function flush_rules_hook() {
|
900 |
global $wp_rewrite;
|
901 |
$sitemap_rules = $this->get_rewrite_rules( $wp_rewrite );
|
902 |
if ( ! empty( $sitemap_rules ) ) {
|
903 |
$rules = get_option( 'rewrite_rules' );
|
904 |
$rule = key( $sitemap_rules );
|
905 |
-
if ( ! isset( $rules[ $rule ] ) || ( $rules[ $rule ]
|
906 |
$wp_rewrite->flush_rules();
|
907 |
set_transient( "{$this->prefix}rules_flushed", true, 43200 );
|
908 |
}
|
909 |
}
|
910 |
}
|
911 |
|
912 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
function query_var_hook( $vars ) {
|
914 |
$vars[] = "{$this->prefix}path";
|
915 |
if ( $this->paginate ) {
|
@@ -919,86 +1116,123 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
919 |
return $vars;
|
920 |
}
|
921 |
|
922 |
-
/**
|
|
|
|
|
923 |
function log_start() {
|
924 |
$this->start_memory_usage = memory_get_peak_usage();
|
925 |
timer_start();
|
926 |
}
|
927 |
|
928 |
-
|
929 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
930 |
$time = timer_stop();
|
931 |
$end_memory_usage = memory_get_peak_usage();
|
932 |
$sitemap_memory_usage = $end_memory_usage - $this->start_memory_usage;
|
933 |
$end_memory_usage = $end_memory_usage / 1024.0 / 1024.0;
|
934 |
$sitemap_memory_usage = $sitemap_memory_usage / 1024.0 / 1024.0;
|
|
|
935 |
if ( $compressed ) {
|
936 |
-
$sitemap_type = __( 'compressed', 'all-in-one-seo-pack' )
|
937 |
}
|
938 |
if ( $dynamic ) {
|
939 |
-
$sitemap_type = __( 'dynamic', 'all-in-one-seo-pack ' )
|
940 |
-
} else {
|
941 |
-
$sitemap_type = __( 'static', 'all-in-one-seo-pack ' ) . " $sitemap_type";
|
942 |
}
|
943 |
-
$this->debug_message( sprintf(
|
944 |
}
|
945 |
|
946 |
-
/**
|
|
|
|
|
|
|
|
|
947 |
function sitemap_output_hook( $query ) {
|
948 |
$page = 0;
|
949 |
-
if (
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
$this->
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
$
|
962 |
-
if ( $this->options["{$this->prefix}gzipped"] && $gzipped ) {
|
963 |
-
header( "Content-Type: application/x-gzip; charset=$blog_charset", true );
|
964 |
-
} else {
|
965 |
-
$gzipped = false;
|
966 |
-
header( "Content-Type: text/xml; charset=$blog_charset", true );
|
967 |
-
}
|
968 |
-
if ( $this->options["{$this->prefix}noindex"] ) {
|
969 |
-
header( "X-Robots-Tag: noindex", true );
|
970 |
-
}
|
971 |
-
if ( $gzipped ) {
|
972 |
-
ob_start();
|
973 |
-
}
|
974 |
-
$this->do_rewrite_sitemap( $sitemap_type, $page );
|
975 |
-
if ( $gzipped ) {
|
976 |
-
echo gzencode( ob_get_clean() );
|
977 |
-
}
|
978 |
-
$this->log_stats( $sitemap_type, $gzipped );
|
979 |
-
exit();
|
980 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
}
|
982 |
}
|
983 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
984 |
function get_sitemap_data( $sitemap_type, $page = 0 ) {
|
985 |
-
$sitemap_data =
|
986 |
if ( $this->options["{$this->prefix}indexes"] ) {
|
987 |
$posttypes = $this->options["{$this->prefix}posttypes"];
|
988 |
if ( empty( $posttypes ) ) {
|
989 |
-
$posttypes =
|
990 |
}
|
991 |
$taxonomies = $this->options["{$this->prefix}taxonomies"];
|
992 |
if ( empty( $taxonomies ) ) {
|
993 |
-
$taxonomies =
|
994 |
}
|
995 |
-
if (
|
996 |
$sitemap_data = array_merge( $this->get_sitemap_index_filenames() );
|
997 |
-
} elseif (
|
998 |
$sitemap_data = $this->get_addl_pages();
|
999 |
-
} elseif (
|
1000 |
$sitemap_data = $this->get_archive_prio_data();
|
1001 |
-
} elseif (
|
1002 |
$sitemap_data = $this->get_author_prio_data();
|
1003 |
} elseif ( in_array( $sitemap_type, $posttypes ) ) {
|
1004 |
$sitemap_data = $this->get_all_post_priority_data( $sitemap_type, 'publish', $page );
|
@@ -1009,21 +1243,32 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1009 |
$sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
|
1010 |
}
|
1011 |
}
|
1012 |
-
} elseif (
|
1013 |
$sitemap_data = $this->get_simple_sitemap();
|
1014 |
}
|
1015 |
|
1016 |
return apply_filters( $this->prefix . 'data', $sitemap_data, $sitemap_type, $page, $this->options );
|
1017 |
}
|
1018 |
|
1019 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
|
1021 |
$this->add_post_types();
|
1022 |
-
$comment =
|
1023 |
echo $this->do_build_sitemap( $sitemap_type, $page, '', $comment );
|
1024 |
}
|
1025 |
|
1026 |
-
/**
|
|
|
|
|
|
|
|
|
1027 |
function get_sitemap_url() {
|
1028 |
$url = get_home_url() . '/' . $this->options["{$this->prefix}filename"] . '.xml';
|
1029 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
@@ -1033,11 +1278,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1033 |
return $url;
|
1034 |
}
|
1035 |
|
1036 |
-
/**
|
|
|
|
|
1037 |
function do_notify() {
|
1038 |
-
$notify_url =
|
1039 |
'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=',
|
1040 |
-
'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap='
|
1041 |
);
|
1042 |
|
1043 |
$url = $this->get_sitemap_url();
|
@@ -1046,7 +1293,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1046 |
if ( isset( $this->options[ $this->prefix . $k ] ) && $this->options[ $this->prefix . $k ] ) {
|
1047 |
$response = wp_remote_get( $notify_url[ $k ] . urlencode( $url ) );
|
1048 |
if ( is_array( $response ) && ! empty( $response['response'] ) && ! empty( $response['response']['code'] ) ) {
|
1049 |
-
if ( $response['response']['code']
|
1050 |
$this->debug_message( sprintf( __( 'Successfully notified %s about changes to your sitemap at %s.', 'all-in-one-seo-pack' ), $k, $url ) );
|
1051 |
} else {
|
1052 |
$this->debug_message( sprintf( __( 'Failed to notify %s about changes to your sitemap at %s, error code %s.', 'all-in-one-seo-pack' ), $k, $url, $response['response']['code'] ) );
|
@@ -1061,17 +1308,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1061 |
}
|
1062 |
}
|
1063 |
|
1064 |
-
/**
|
|
|
|
|
1065 |
function do_robots() {
|
1066 |
$url = $this->get_sitemap_url();
|
1067 |
echo "\nSitemap: $url\n";
|
1068 |
}
|
1069 |
|
1070 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
function do_sitemaps( $message = '' ) {
|
1072 |
if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
|
1073 |
$this->paginate = true;
|
1074 |
-
if (
|
1075 |
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
1076 |
} else {
|
1077 |
$this->max_posts = 50000;
|
@@ -1085,7 +1340,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1085 |
$this->do_indexed_sitemaps();
|
1086 |
} else {
|
1087 |
$this->log_start();
|
1088 |
-
$comment = sprintf(
|
1089 |
$sitemap = $this->do_simple_sitemap( $comment );
|
1090 |
$this->write_sitemaps( $this->options["{$this->prefix}filename"], $sitemap );
|
1091 |
$this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false );
|
@@ -1101,6 +1356,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1101 |
}
|
1102 |
}
|
1103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1104 |
function add_xml_mime_type( $mime ) {
|
1105 |
if ( ! empty( $mime ) ) {
|
1106 |
$mime['xml'] = 'text/xml';
|
@@ -1109,47 +1371,77 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1109 |
return $mime;
|
1110 |
}
|
1111 |
|
1112 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1113 |
function write_sitemaps( $filename, $contents ) {
|
1114 |
-
$this->write_sitemap( $filename .
|
1115 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
1116 |
-
$this->write_sitemap( $filename .
|
1117 |
}
|
1118 |
}
|
1119 |
|
1120 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1121 |
function write_sitemap( $filename, $contents, $gzip = false ) {
|
1122 |
if ( $gzip ) {
|
1123 |
$contents = gzencode( $contents );
|
1124 |
}
|
1125 |
-
add_filter( 'upload_mimes',
|
1126 |
-
$filename = get_home_path() . sanitize_file_name( $filename );
|
1127 |
-
remove_filter( 'upload_mimes',
|
1128 |
|
1129 |
return $this->save_file( $filename, $contents );
|
1130 |
}
|
1131 |
|
1132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1133 |
function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
|
1134 |
if ( ! empty( $cache[ $item . $type ] ) ) {
|
1135 |
return $cache[ $item . $type ];
|
1136 |
}
|
1137 |
if ( ! empty( $defaults[ $item ] ) ) {
|
1138 |
$field = $this->prefix . $prefix . $item;
|
1139 |
-
if ( $this->option_isset( $prefix . $item ) && $this->options[ $field ]
|
1140 |
-
if ( ( $this->options[ $field ]
|
1141 |
-
if ( $this->options[ $this->prefix . $prefix . $item . '_' . $type ]
|
1142 |
return false;
|
1143 |
}
|
1144 |
-
if ( $this->options[ $this->prefix . $prefix . $item . '_' . $type ]
|
1145 |
return false;
|
1146 |
}
|
1147 |
$cache[ $item . $type ] = $this->options[ $this->prefix . $prefix . $item . '_' . $type ];
|
1148 |
} else {
|
1149 |
-
if ( $this->options[ $field ]
|
1150 |
return false;
|
1151 |
}
|
1152 |
-
if ( $this->options[ $field ]
|
1153 |
return false;
|
1154 |
}
|
1155 |
$cache[ $item . $type ] = $this->options[ $field ];
|
@@ -1167,41 +1459,61 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1167 |
return false;
|
1168 |
}
|
1169 |
|
1170 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
function get_default_priority( $item, $nodefaults = false, $type = '' ) {
|
1172 |
-
$defaults =
|
1173 |
'homepage' => '1.0',
|
1174 |
'blog' => '0.9',
|
1175 |
'sitemap' => '0.8',
|
1176 |
'post' => '0.7',
|
1177 |
'archive' => '0.5',
|
1178 |
'author' => '0.3',
|
1179 |
-
'taxonomies' => '0.3'
|
1180 |
);
|
1181 |
-
static $cache =
|
1182 |
|
1183 |
return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type );
|
1184 |
}
|
1185 |
|
1186 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1187 |
function get_default_frequency( $item, $nodefaults = false, $type = '' ) {
|
1188 |
-
$defaults =
|
1189 |
'homepage' => 'always',
|
1190 |
'blog' => 'daily',
|
1191 |
'sitemap' => 'hourly',
|
1192 |
'post' => 'weekly',
|
1193 |
'archive' => 'monthly',
|
1194 |
'author' => 'weekly',
|
1195 |
-
'taxonomies' => 'monthly'
|
1196 |
);
|
1197 |
-
static $cache =
|
1198 |
|
1199 |
return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type );
|
1200 |
}
|
1201 |
|
1202 |
-
/**
|
|
|
|
|
|
|
|
|
1203 |
function get_sitemap_index_filenames() {
|
1204 |
-
$files =
|
1205 |
$options = $this->options;
|
1206 |
$prefix = $options["{$this->prefix}filename"];
|
1207 |
$suffix = '.xml';
|
@@ -1209,67 +1521,67 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1209 |
$suffix .= '.gz';
|
1210 |
}
|
1211 |
if ( empty( $options["{$this->prefix}posttypes"] ) ) {
|
1212 |
-
$options["{$this->prefix}posttypes"] =
|
1213 |
}
|
1214 |
if ( empty( $options["{$this->prefix}taxonomies"] ) ) {
|
1215 |
-
$options["{$this->prefix}taxonomies"] =
|
1216 |
}
|
1217 |
-
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"],
|
1218 |
-
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"],
|
1219 |
$url_base = trailingslashit( get_home_url() );
|
1220 |
-
$files[] =
|
1221 |
if ( ! empty( $options["{$this->prefix}posttypes"] ) ) {
|
1222 |
$prio = $this->get_default_priority( 'post' );
|
1223 |
$freq = $this->get_default_frequency( 'post' );
|
1224 |
-
$post_counts = $this->get_all_post_counts(
|
1225 |
'post_type' => $options["{$this->prefix}posttypes"],
|
1226 |
-
'post_status' => 'publish'
|
1227 |
) );
|
1228 |
if ( ! is_array( $post_counts ) && is_array( $options["{$this->prefix}posttypes"] ) && count( $options["{$this->prefix}posttypes"] ) == 1 ) {
|
1229 |
-
$post_counts =
|
1230 |
}
|
1231 |
foreach ( $options["{$this->prefix}posttypes"] as $sm ) {
|
1232 |
-
if ( $post_counts[ $sm ]
|
1233 |
continue;
|
1234 |
}
|
1235 |
if ( $this->paginate ) {
|
1236 |
if ( $post_counts[ $sm ] > $this->max_posts ) {
|
1237 |
$count = 1;
|
1238 |
for ( $post_count = 0; $post_count < $post_counts[ $sm ]; $post_count += $this->max_posts ) {
|
1239 |
-
$files[] =
|
1240 |
'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix,
|
1241 |
'priority' => $prio,
|
1242 |
-
'changefreq' => $freq
|
1243 |
);
|
1244 |
}
|
1245 |
} else {
|
1246 |
-
$files[] =
|
1247 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1248 |
'priority' => $prio,
|
1249 |
-
'changefreq' => $freq
|
1250 |
);
|
1251 |
}
|
1252 |
} else {
|
1253 |
-
$files[] =
|
1254 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1255 |
'priority' => $prio,
|
1256 |
-
'changefreq' => $freq
|
1257 |
);
|
1258 |
}
|
1259 |
}
|
1260 |
}
|
1261 |
if ( $this->option_isset( 'archive' ) ) {
|
1262 |
-
$files[] =
|
1263 |
'loc' => $url_base . $prefix . '_archive' . $suffix,
|
1264 |
'priority' => $this->get_default_priority( 'archive' ),
|
1265 |
-
'changefreq' => $this->get_default_frequency( 'archive' )
|
1266 |
);
|
1267 |
}
|
1268 |
if ( $this->option_isset( 'author' ) ) {
|
1269 |
-
$files[] =
|
1270 |
'loc' => $url_base . $prefix . '_author' . $suffix,
|
1271 |
'priority' => $this->get_default_priority( 'author' ),
|
1272 |
-
'changefreq' => $this->get_default_frequency( 'author' )
|
1273 |
);
|
1274 |
}
|
1275 |
|
@@ -1281,74 +1593,94 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1281 |
if ( $term_count > $this->max_posts ) {
|
1282 |
$count = 1;
|
1283 |
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
|
1284 |
-
$files[] =
|
1285 |
'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix,
|
1286 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1287 |
-
'changefreq' => $this->get_default_frequency( 'taxonomies' )
|
1288 |
);
|
1289 |
}
|
1290 |
} else {
|
1291 |
-
$files[] =
|
1292 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1293 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1294 |
-
'changefreq' => $this->get_default_frequency( 'taxonomies' )
|
1295 |
);
|
1296 |
}
|
1297 |
} else {
|
1298 |
-
$files[] =
|
1299 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1300 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1301 |
-
'changefreq' => $this->get_default_frequency( 'taxonomies' )
|
1302 |
);
|
1303 |
}
|
1304 |
}
|
1305 |
}
|
1306 |
}
|
1307 |
foreach ( $this->get_child_sitemap_urls() as $csm ) {
|
1308 |
-
$files[] =
|
1309 |
'loc' => $csm,
|
1310 |
'priority' => $this->get_default_priority( 'sitemap' ),
|
1311 |
-
'changefreq' => $this->get_default_frequency( 'sitemap' )
|
1312 |
);
|
1313 |
}
|
1314 |
|
1315 |
return $files;
|
1316 |
}
|
1317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1318 |
function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
|
1319 |
if ( empty( $filename ) ) {
|
1320 |
-
if (
|
1321 |
$filename = $this->options["{$this->prefix}filename"];
|
1322 |
} else {
|
1323 |
$filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
|
1324 |
}
|
1325 |
}
|
1326 |
if ( empty( $comment ) ) {
|
1327 |
-
$comment =
|
1328 |
}
|
1329 |
$sitemap_data = $this->get_sitemap_data( $sitemap_type, $page );
|
1330 |
-
if ( (
|
1331 |
return $this->build_sitemap_index( $sitemap_data, sprintf( $comment, $filename ) );
|
1332 |
} else {
|
1333 |
return $this->build_sitemap( $sitemap_data, sprintf( $comment, $filename ) );
|
1334 |
}
|
1335 |
}
|
1336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1337 |
function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
|
1338 |
if ( empty( $filename ) ) {
|
1339 |
-
if (
|
1340 |
$filename = $this->options["{$this->prefix}filename"];
|
1341 |
} else {
|
1342 |
$filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
|
1343 |
}
|
1344 |
}
|
1345 |
if ( empty( $comment ) ) {
|
1346 |
-
$comment =
|
1347 |
}
|
1348 |
$this->write_sitemaps( $filename, $this->do_build_sitemap( $sitemap_type, $page, $filename, $comment ) );
|
1349 |
}
|
1350 |
|
1351 |
-
/**
|
|
|
|
|
1352 |
function do_indexed_sitemaps() {
|
1353 |
$this->start_memory_usage = memory_get_peak_usage();
|
1354 |
$options = $this->options;
|
@@ -1364,21 +1696,21 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1364 |
}
|
1365 |
|
1366 |
if ( ( ! isset( $options["{$this->prefix}posttypes"] ) ) || ( ! is_array( $options["{$this->prefix}posttypes"] ) ) ) {
|
1367 |
-
$options["{$this->prefix}posttypes"] =
|
1368 |
}
|
1369 |
if ( ( ! isset( $options["{$this->prefix}taxonomies"] ) ) || ( ! is_array( $options["{$this->prefix}taxonomies"] ) ) ) {
|
1370 |
-
$options["{$this->prefix}taxonomies"] =
|
1371 |
}
|
1372 |
-
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"],
|
1373 |
-
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"],
|
1374 |
|
1375 |
if ( ! empty( $options["{$this->prefix}posttypes"] ) ) {
|
1376 |
-
$post_counts = $this->get_all_post_counts(
|
1377 |
'post_type' => $options["{$this->prefix}posttypes"],
|
1378 |
-
'post_status' => 'publish'
|
1379 |
) );
|
1380 |
foreach ( $options["{$this->prefix}posttypes"] as $posttype ) {
|
1381 |
-
if ( $post_counts[ $posttype ]
|
1382 |
continue;
|
1383 |
}
|
1384 |
if ( $this->paginate && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
|
@@ -1416,11 +1748,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1416 |
$this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false );
|
1417 |
}
|
1418 |
|
|
|
|
|
|
|
|
|
|
|
1419 |
function get_simple_sitemap() {
|
1420 |
-
$home =
|
1421 |
'loc' => get_home_url(),
|
1422 |
'priority' => $this->get_default_priority( 'homepage' ),
|
1423 |
-
'changefreq' => $this->get_default_frequency( 'homepage' )
|
1424 |
);
|
1425 |
$posts = get_option( 'page_for_posts' );
|
1426 |
$this->paginate = false;
|
@@ -1429,20 +1766,20 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1429 |
if ( $posts == $home['loc'] ) {
|
1430 |
$posts = null;
|
1431 |
} else {
|
1432 |
-
$posts =
|
1433 |
'loc' => $posts,
|
1434 |
'priority' => $this->get_default_priority( 'blog' ),
|
1435 |
-
'changefreq' => $this->get_default_frequency( 'blog' )
|
1436 |
);
|
1437 |
}
|
1438 |
}
|
1439 |
$child = $this->get_child_sitemap_urls();
|
1440 |
$options = $this->options;
|
1441 |
if ( is_array( $options["{$this->prefix}posttypes"] ) ) {
|
1442 |
-
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"],
|
1443 |
}
|
1444 |
if ( is_array( $options["{$this->prefix}taxonomies"] ) ) {
|
1445 |
-
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"],
|
1446 |
}
|
1447 |
$prio = $this->get_all_post_priority_data( $options["{$this->prefix}posttypes"] );
|
1448 |
if ( $this->option_isset( 'archive' ) ) {
|
@@ -1452,15 +1789,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1452 |
$prio = array_merge( $prio, $this->get_author_prio_data() );
|
1453 |
}
|
1454 |
foreach ( $prio as $k => $p ) {
|
1455 |
-
if ( untrailingslashit( $p['loc'] )
|
1456 |
$prio[ $k ]['priority'] = '1.0';
|
1457 |
$home = null;
|
1458 |
break;
|
1459 |
}
|
1460 |
}
|
1461 |
-
if ( (
|
1462 |
foreach ( $prio as $k => $p ) {
|
1463 |
-
if ( $p['loc']
|
1464 |
$prio[ $k ]['priority'] = $this->get_default_priority( 'blog' );
|
1465 |
$prio[ $k ]['changefreq'] = $this->get_default_frequency( 'blog' );
|
1466 |
$posts = null;
|
@@ -1480,7 +1817,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1480 |
$prio = array_merge( $child, $prio, $prio2, $prio3 );
|
1481 |
if ( is_array( $this->extra_sitemaps ) ) {
|
1482 |
foreach ( $this->extra_sitemaps as $sitemap_type ) {
|
1483 |
-
$sitemap_data =
|
1484 |
$sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
|
1485 |
$prio = array_merge( $prio, $sitemap_data );
|
1486 |
}
|
@@ -1489,7 +1826,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1489 |
return $prio;
|
1490 |
}
|
1491 |
|
1492 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1493 |
function do_simple_sitemap( $comment = '' ) {
|
1494 |
$sitemap_data = $this->get_simple_sitemap();
|
1495 |
$sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'root', 0, $this->options );
|
@@ -1497,14 +1840,36 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1497 |
return $this->build_sitemap( $sitemap_data, $comment );
|
1498 |
}
|
1499 |
|
1500 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1501 |
function output_sitemap( $urls, $comment = '' ) {
|
1502 |
$max_items = 50000;
|
1503 |
if ( ! is_array( $urls ) ) {
|
1504 |
return null;
|
1505 |
}
|
1506 |
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
|
1507 |
-
echo
|
1508 |
$plugin_path = $this->plugin_path['url'];
|
1509 |
$plugin_url = parse_url( $plugin_path );
|
1510 |
$current_host = $_SERVER['HTTP_HOST'];
|
@@ -1512,20 +1877,23 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1512 |
$current_host = $_SERVER['SERVER_NAME'];
|
1513 |
}
|
1514 |
|
1515 |
-
if ( ! empty( $current_host ) && ( $current_host
|
1516 |
$plugin_url['host'] = $current_host;
|
1517 |
}
|
1518 |
|
1519 |
-
//unset( $plugin_url['scheme'] )
|
1520 |
$plugin_path = $this->unparse_url( $plugin_url );
|
1521 |
|
1522 |
-
|
|
|
|
|
|
|
1523 |
. '<urlset ';
|
1524 |
-
$namespaces = apply_filters( $this->prefix . 'xml_namespace',
|
1525 |
if ( ! empty( $namespaces ) ) {
|
1526 |
-
$ns =
|
1527 |
foreach ( $namespaces as $k => $v ) {
|
1528 |
-
$ns[] = esc_attr( $k ) . '=' . '"' . esc_url( $v,
|
1529 |
}
|
1530 |
$xml_header .= join( "\r\n\t", $ns );
|
1531 |
}
|
@@ -1537,7 +1905,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1537 |
if ( is_array( $url ) ) {
|
1538 |
foreach ( $url as $k => $v ) {
|
1539 |
if ( ! empty( $v ) ) {
|
1540 |
-
if (
|
1541 |
$v = esc_url( $v );
|
1542 |
}
|
1543 |
if ( is_array( $v ) ) {
|
@@ -1581,24 +1949,32 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1581 |
echo '</urlset>';
|
1582 |
}
|
1583 |
|
1584 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1585 |
function output_sitemap_index( $urls, $comment = '' ) {
|
1586 |
$max_items = 50000;
|
1587 |
if ( ! is_array( $urls ) ) {
|
1588 |
return null;
|
1589 |
}
|
1590 |
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
|
1591 |
-
echo
|
1592 |
-
|
|
|
1593 |
echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\r\n";
|
1594 |
$count = 0;
|
1595 |
foreach ( $urls as $url ) {
|
1596 |
echo "\t<sitemap>\r\n";
|
1597 |
if ( is_array( $url ) ) {
|
1598 |
foreach ( $url as $k => $v ) {
|
1599 |
-
if (
|
1600 |
echo "\t\t<$k>" . esc_url( $v ) . "</$k>\r\n";
|
1601 |
-
} elseif (
|
1602 |
echo "\t\t<$k>$v</$k>\r\n";
|
1603 |
}
|
1604 |
}
|
@@ -1614,7 +1990,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1614 |
echo '</sitemapindex>';
|
1615 |
}
|
1616 |
|
1617 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1618 |
function build_sitemap_index( $urls, $comment = '' ) {
|
1619 |
ob_start();
|
1620 |
$this->output_sitemap_index( $urls, $comment );
|
@@ -1622,7 +2005,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1622 |
return ob_get_clean();
|
1623 |
}
|
1624 |
|
1625 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1626 |
function build_sitemap( $urls, $comment = '' ) {
|
1627 |
ob_start();
|
1628 |
$this->output_sitemap( $urls, $comment );
|
@@ -1630,21 +2020,27 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1630 |
return ob_get_clean();
|
1631 |
}
|
1632 |
|
1633 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1634 |
function get_term_priority_data( $terms ) {
|
1635 |
-
$prio =
|
1636 |
if ( is_array( $terms ) ) {
|
1637 |
$def_prio = $this->get_default_priority( 'taxonomies' );
|
1638 |
$def_freq = $this->get_default_frequency( 'taxonomies' );
|
1639 |
foreach ( $terms as $term ) {
|
1640 |
-
$pr_info =
|
1641 |
$pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy );
|
1642 |
-
if ( ( $this->options[ $this->prefix . 'prio_taxonomies' ]
|
1643 |
$pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ];
|
1644 |
} else {
|
1645 |
$pr_info['priority'] = $def_prio;
|
1646 |
}
|
1647 |
-
if ( ( $this->options[ $this->prefix . 'freq_taxonomies' ]
|
1648 |
$pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ];
|
1649 |
} else {
|
1650 |
$pr_info['changefreq'] = $def_freq;
|
@@ -1656,9 +2052,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1656 |
return $prio;
|
1657 |
}
|
1658 |
|
1659 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1660 |
function get_term_permalinks( $terms ) {
|
1661 |
-
$links =
|
1662 |
if ( is_array( $terms ) ) {
|
1663 |
foreach ( $terms as $term ) {
|
1664 |
$url = $this->get_term_link( $term );
|
@@ -1669,16 +2071,22 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1669 |
return $links;
|
1670 |
}
|
1671 |
|
1672 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1673 |
function get_archive_permalinks( $posts ) {
|
1674 |
-
$links =
|
1675 |
-
$archives =
|
1676 |
if ( is_array( $posts ) ) {
|
1677 |
foreach ( $posts as $post ) {
|
1678 |
$date = mysql2date( 'U', $post->post_date );
|
1679 |
$year = date( 'Y', $date );
|
1680 |
$month = date( 'm', $date );
|
1681 |
-
$archives[ $year . '-' . $month ] =
|
1682 |
}
|
1683 |
}
|
1684 |
$archives = array_keys( $archives );
|
@@ -1689,10 +2097,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1689 |
return $links;
|
1690 |
}
|
1691 |
|
1692 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1693 |
function get_author_permalinks( $posts ) {
|
1694 |
-
$links =
|
1695 |
-
$authors =
|
1696 |
if ( is_array( $posts ) ) {
|
1697 |
foreach ( $posts as $post ) {
|
1698 |
$authors[ $post->author_id ] = 1;
|
@@ -1706,12 +2120,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1706 |
return $links;
|
1707 |
}
|
1708 |
|
1709 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1710 |
function get_post_permalinks( $posts ) {
|
1711 |
-
$links =
|
1712 |
if ( is_array( $posts ) ) {
|
1713 |
foreach ( $posts as $post ) {
|
1714 |
-
$post->filter =
|
1715 |
$url = $this->get_permalink( $post );
|
1716 |
$links[] = $url;
|
1717 |
}
|
@@ -1720,7 +2140,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1720 |
return $links;
|
1721 |
}
|
1722 |
|
1723 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1724 |
function unparse_url( $parsed_url ) {
|
1725 |
$scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : '';
|
1726 |
$host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
|
@@ -1738,9 +2168,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1738 |
return "$scheme$user$pass$host$port$path$query$fragment";
|
1739 |
}
|
1740 |
|
1741 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1742 |
function get_addl_pages_only() {
|
1743 |
-
$pages =
|
1744 |
if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
|
1745 |
$siteurl = parse_url( get_home_url() );
|
1746 |
foreach ( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) {
|
@@ -1751,6 +2187,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1751 |
if ( empty( $url['host'] ) ) {
|
1752 |
$url['host'] = $siteurl['host'];
|
1753 |
}
|
|
|
|
|
|
|
1754 |
$freq = $prio = $mod = '';
|
1755 |
if ( ! empty( $v['mod'] ) ) {
|
1756 |
$mod = $v['mod'];
|
@@ -1761,18 +2200,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1761 |
if ( ! empty( $v['prio'] ) ) {
|
1762 |
$prio = $v['prio'];
|
1763 |
}
|
1764 |
-
if (
|
1765 |
$freq = '';
|
1766 |
}
|
1767 |
-
if (
|
1768 |
$prio = '';
|
1769 |
}
|
1770 |
$mod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $mod ) );
|
1771 |
-
$pages[] =
|
1772 |
'loc' => $this->unparse_url( $url ),
|
1773 |
'lastmod' => $mod,
|
1774 |
'changefreq' => $freq,
|
1775 |
-
'priority' => $prio
|
1776 |
);
|
1777 |
}
|
1778 |
}
|
@@ -1781,28 +2220,32 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1781 |
return $pages;
|
1782 |
}
|
1783 |
|
1784 |
-
/**
|
|
|
|
|
|
|
|
|
1785 |
function get_addl_pages() {
|
1786 |
-
$home =
|
1787 |
-
$home =
|
1788 |
'loc' => get_home_url(),
|
1789 |
'priority' => $this->get_default_priority( 'homepage' ),
|
1790 |
-
'changefreq' => $this->get_default_frequency( 'homepage' )
|
1791 |
);
|
1792 |
$posts = get_option( 'page_for_posts' );
|
1793 |
if ( $posts ) {
|
1794 |
$posts = $this->get_permalink( $posts );
|
1795 |
if ( $posts == $home['loc'] ) {
|
1796 |
-
$posts =
|
1797 |
} else {
|
1798 |
-
$posts =
|
1799 |
'loc' => $posts,
|
1800 |
'priority' => $this->get_default_priority( 'blog' ),
|
1801 |
-
'changefreq' => $this->get_default_frequency( 'blog' )
|
1802 |
);
|
1803 |
}
|
1804 |
} else {
|
1805 |
-
$posts =
|
1806 |
}
|
1807 |
$pages = $this->get_addl_pages_only();
|
1808 |
if ( ! empty( $home ) ) {
|
@@ -1816,23 +2259,34 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1816 |
return $pages;
|
1817 |
}
|
1818 |
|
1819 |
-
/**
|
|
|
|
|
|
|
|
|
1820 |
function get_addl_page_links() {
|
1821 |
if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
|
1822 |
return array_keys( $this->options[ $this->prefix . 'addl_pages' ] );
|
1823 |
}
|
1824 |
|
1825 |
-
return
|
1826 |
}
|
1827 |
|
1828 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1829 |
function get_prio_calc( $date, $stats = 0 ) {
|
1830 |
static $cur_time = null;
|
1831 |
-
if (
|
1832 |
$cur_time = time();
|
1833 |
}
|
1834 |
$time = $cur_time - mysql2date( 'U', $date );
|
1835 |
-
if ( ! empty( $stats ) && isset( $stats['max'] ) &&
|
1836 |
$minadj = $time >> 3;
|
1837 |
$maxadj = $time >> 1;
|
1838 |
$avg = $stats['count'] / $stats['total'];
|
@@ -1852,17 +2306,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1852 |
$time -= $calc;
|
1853 |
}
|
1854 |
$days = $time / ( 60 * 60 * 24 );
|
1855 |
-
$prio_table =
|
1856 |
'daily' => 7,
|
1857 |
'weekly' => 30,
|
1858 |
'monthly' => 210,
|
1859 |
-
'yearly' => null
|
1860 |
);
|
1861 |
$interval = 1.0;
|
1862 |
$prev_days = 0;
|
1863 |
foreach ( $prio_table as $change => $max_days ) {
|
1864 |
$interval -= 0.3;
|
1865 |
-
if (
|
1866 |
$changefreq = $change;
|
1867 |
$prio = 0.1;
|
1868 |
break;
|
@@ -1877,15 +2331,21 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1877 |
$prev_days = $max_days;
|
1878 |
}
|
1879 |
|
1880 |
-
return
|
1881 |
}
|
1882 |
|
1883 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1884 |
function get_archive_prio_from_posts( $posts ) {
|
1885 |
-
$archives =
|
1886 |
if ( is_array( $posts ) ) {
|
1887 |
foreach ( $posts as $p ) {
|
1888 |
-
if ( $p->post_type
|
1889 |
continue;
|
1890 |
}
|
1891 |
$date = date( 'Y-m', mysql2date( 'U', $p->post_date ) );
|
@@ -1899,18 +2359,24 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1899 |
}
|
1900 |
}
|
1901 |
if ( ! empty( $archives ) ) {
|
1902 |
-
return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ),
|
1903 |
$this,
|
1904 |
-
'get_archive_link_from_post'
|
1905 |
) );
|
1906 |
}
|
1907 |
|
1908 |
return $archives;
|
1909 |
}
|
1910 |
|
1911 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1912 |
function get_archive_link_from_post( $post ) {
|
1913 |
-
if ( $post->post_type
|
1914 |
return false;
|
1915 |
}
|
1916 |
$date = mysql2date( 'U', $post->post_date );
|
@@ -1918,12 +2384,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1918 |
return get_month_link( date( 'Y', $date ), date( 'm', $date ) );
|
1919 |
}
|
1920 |
|
1921 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1922 |
function get_author_prio_from_posts( $posts ) {
|
1923 |
-
$authors =
|
1924 |
if ( is_array( $posts ) ) {
|
1925 |
foreach ( $posts as $p ) {
|
1926 |
-
if ( $p->post_type
|
1927 |
continue;
|
1928 |
}
|
1929 |
if ( empty( $authors[ $p->post_author ] ) ) {
|
@@ -1936,18 +2408,30 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1936 |
}
|
1937 |
}
|
1938 |
|
1939 |
-
return $this->get_prio_from_posts( $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ),
|
1940 |
$this,
|
1941 |
-
'get_author_link_from_post'
|
1942 |
) );
|
1943 |
}
|
1944 |
|
1945 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1946 |
function get_author_link_from_post( $post ) {
|
1947 |
return get_author_posts_url( $post->post_author );
|
1948 |
}
|
1949 |
|
1950 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
1951 |
function get_comment_count_stats( $posts ) {
|
1952 |
$count = 0;
|
1953 |
$total = 0.0;
|
@@ -1959,7 +2443,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1959 |
$cnt = $post->comment_count;
|
1960 |
$count ++;
|
1961 |
$total += $cnt;
|
1962 |
-
if (
|
1963 |
$min = $cnt;
|
1964 |
}
|
1965 |
if ( $max < $cnt ) {
|
@@ -1972,21 +2456,30 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1972 |
}
|
1973 |
}
|
1974 |
if ( $count ) {
|
1975 |
-
return
|
1976 |
} else {
|
1977 |
return 0;
|
1978 |
}
|
1979 |
}
|
1980 |
|
1981 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1982 |
function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
|
1983 |
-
$prio =
|
1984 |
-
$args =
|
1985 |
'prio_override' => $prio_override,
|
1986 |
'freq_override' => $freq_override,
|
1987 |
-
'linkfunc' => $linkfunc
|
1988 |
);
|
1989 |
-
if (
|
1990 |
$stats = 0;
|
1991 |
} else {
|
1992 |
$stats = $this->get_comment_count_stats( $posts );
|
@@ -1994,8 +2487,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1994 |
if ( is_array( $posts ) ) {
|
1995 |
foreach ( $posts as $post ) {
|
1996 |
$url = '';
|
1997 |
-
$post->filter =
|
1998 |
-
if (
|
1999 |
$url = $this->get_permalink( $post );
|
2000 |
} else {
|
2001 |
$url = call_user_func( $linkfunc, $post );
|
@@ -2009,8 +2502,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2009 |
} else {
|
2010 |
$date = 0;
|
2011 |
}
|
2012 |
-
if (
|
2013 |
-
$pr_info =
|
2014 |
} else {
|
2015 |
if ( empty( $post->comment_count ) ) {
|
2016 |
$stat = 0;
|
@@ -2028,19 +2521,19 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2028 |
if ( $freq_override ) {
|
2029 |
$pr_info['changefreq'] = $freq_override;
|
2030 |
}
|
2031 |
-
if ( ( $this->options[ $this->prefix . 'prio_post' ]
|
2032 |
-
if ( ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ]
|
2033 |
$pr_info['priority'] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ];
|
2034 |
}
|
2035 |
}
|
2036 |
-
if ( ( $this->options[ $this->prefix . 'freq_post' ]
|
2037 |
-
if ( ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ]
|
2038 |
$pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ];
|
2039 |
}
|
2040 |
}
|
2041 |
-
$pr_info
|
2042 |
if ( is_float( $pr_info['priority'] ) ) {
|
2043 |
-
$pr_info['priority'] = sprintf(
|
2044 |
}
|
2045 |
$pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args );
|
2046 |
if ( ! empty( $pr_info ) ) {
|
@@ -2052,9 +2545,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2052 |
return $prio;
|
2053 |
}
|
2054 |
|
2055 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2056 |
function get_tax_args( $page = 0 ) {
|
2057 |
-
$args =
|
2058 |
if ( $this->option_isset( 'excl_categories' ) ) {
|
2059 |
$args['exclude'] = $this->options[ $this->prefix . 'excl_categories' ];
|
2060 |
}
|
@@ -2067,10 +2566,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2067 |
return $args;
|
2068 |
}
|
2069 |
|
2070 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2071 |
function set_post_args( $args ) {
|
2072 |
if ( $this->option_isset( 'excl_categories' ) ) {
|
2073 |
-
$cats =
|
2074 |
foreach ( $this->options[ $this->prefix . 'excl_categories' ] as $c ) {
|
2075 |
$cats[] = - $c;
|
2076 |
}
|
@@ -2083,40 +2588,56 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2083 |
return $args;
|
2084 |
}
|
2085 |
|
2086 |
-
/**
|
|
|
|
|
|
|
|
|
2087 |
function get_archive_prio_data() {
|
2088 |
-
$args =
|
2089 |
$args = $this->set_post_args( $args );
|
2090 |
$posts = $this->get_all_post_type_data( $args );
|
2091 |
|
2092 |
return $this->get_archive_prio_from_posts( $posts );
|
2093 |
}
|
2094 |
|
2095 |
-
/**
|
|
|
|
|
|
|
|
|
2096 |
function get_author_prio_data() {
|
2097 |
-
$args =
|
2098 |
$args = $this->set_post_args( $args );
|
2099 |
$posts = $this->get_all_post_type_data( $args );
|
2100 |
|
2101 |
return $this->get_author_prio_from_posts( $posts );
|
2102 |
}
|
2103 |
|
2104 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2105 |
function get_all_post_priority_data( $include = 'any', $status = 'publish', $page = 0 ) {
|
2106 |
-
$posts = $page_query =
|
2107 |
if ( $this->paginate ) {
|
2108 |
-
$page_query =
|
2109 |
}
|
2110 |
-
if ( (
|
2111 |
$status = 'inherit';
|
2112 |
}
|
2113 |
if ( is_array( $include ) && ( ( $pos = array_search( 'attachment', $include ) ) !== false ) ) {
|
2114 |
unset( $include[ $pos ] );
|
2115 |
-
$att_args =
|
2116 |
$att_args = array_merge( $att_args, $page_query );
|
2117 |
$posts = $this->get_all_post_type_data( $att_args );
|
2118 |
}
|
2119 |
-
$args =
|
2120 |
$args = array_merge( $args, $page_query );
|
2121 |
$args = $this->set_post_args( $args );
|
2122 |
$posts = array_merge( $this->get_all_post_type_data( $args ), $posts );
|
@@ -2124,9 +2645,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2124 |
return $this->get_prio_from_posts( $posts, $this->get_default_priority( 'post', true ), $this->get_default_frequency( 'post', true ) );
|
2125 |
}
|
2126 |
|
2127 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2128 |
function get_all_permalinks( $include = 'any', $status = 'publish' ) {
|
2129 |
-
$args =
|
2130 |
$args = $this->set_post_args( $args );
|
2131 |
$posts = $this->get_all_post_type_data( $args );
|
2132 |
$links = $this->get_post_permalinks( $posts );
|
@@ -2140,33 +2668,54 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2140 |
return $links;
|
2141 |
}
|
2142 |
|
2143 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2144 |
function cache_structure( $pre ) {
|
2145 |
return $this->cache_struct;
|
2146 |
}
|
2147 |
|
2148 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2149 |
function cache_home( $pre ) {
|
2150 |
return $this->cache_home;
|
2151 |
}
|
2152 |
|
2153 |
-
/**
|
|
|
|
|
2154 |
function cache_options() {
|
2155 |
static $start = true;
|
2156 |
if ( $start ) {
|
2157 |
$this->cache_struct = get_option( 'permalink_structure' );
|
2158 |
if ( ! empty( $this->cache_struct ) ) {
|
2159 |
-
add_filter( 'pre_option_permalink_structure',
|
2160 |
}
|
2161 |
$this->cache_home = get_option( 'home' );
|
2162 |
if ( ! empty( $this->cache_home ) ) {
|
2163 |
-
add_filter( 'pre_option_home',
|
2164 |
}
|
2165 |
$start = false;
|
2166 |
}
|
2167 |
}
|
2168 |
|
2169 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2170 |
function get_term_link( $term, $taxonomy = '' ) {
|
2171 |
static $start = true;
|
2172 |
if ( $start ) {
|
@@ -2177,7 +2726,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2177 |
return get_term_link( $term, $taxonomy );
|
2178 |
}
|
2179 |
|
2180 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2181 |
function get_permalink( $post ) {
|
2182 |
static $start = true;
|
2183 |
if ( $start ) {
|
@@ -2188,7 +2743,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2188 |
return get_permalink( $post );
|
2189 |
}
|
2190 |
|
2191 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2192 |
function get_all_term_counts( $args ) {
|
2193 |
$term_counts = null;
|
2194 |
if ( ! empty( $args ) && ! empty( $args['taxonomy'] ) ) {
|
@@ -2199,7 +2760,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2199 |
$term_counts = wp_count_terms( $args['taxonomy'], array( 'hide_empty' => true ) );
|
2200 |
} else {
|
2201 |
foreach ( $args['taxonomy'] as $taxonomy ) {
|
2202 |
-
if (
|
2203 |
continue;
|
2204 |
}
|
2205 |
$term_counts[ $taxonomy ] = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) );
|
@@ -2211,7 +2772,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2211 |
return $term_counts;
|
2212 |
}
|
2213 |
|
2214 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2215 |
function get_all_post_counts( $args ) {
|
2216 |
$post_counts = null;
|
2217 |
$status = 'inherit';
|
@@ -2227,7 +2794,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2227 |
$post_counts = $count[ $status ];
|
2228 |
} else {
|
2229 |
foreach ( $args['post_type'] as $post_type ) {
|
2230 |
-
if (
|
2231 |
continue;
|
2232 |
}
|
2233 |
$count = (Array) wp_count_posts( $post_type );
|
@@ -2235,7 +2802,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2235 |
if ( empty( $count ) ) {
|
2236 |
$post_counts[ $post_type ] = 0;
|
2237 |
} else {
|
2238 |
-
if (
|
2239 |
$post_counts[ $post_type ] = $count['inherit'];
|
2240 |
} else {
|
2241 |
$post_counts[ $post_type ] = $count[ $status ];
|
@@ -2249,6 +2816,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2249 |
return $post_counts;
|
2250 |
}
|
2251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2252 |
function get_total_post_count( $args ) {
|
2253 |
$total = 0;
|
2254 |
$counts = $this->get_all_post_counts( $args );
|
@@ -2265,7 +2839,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2265 |
return $total;
|
2266 |
}
|
2267 |
|
2268 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
2269 |
function get_all_post_type_data( $args ) {
|
2270 |
$defaults = array(
|
2271 |
'numberposts' => $this->max_posts,
|
@@ -2281,16 +2861,16 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2281 |
'meta_compare' => '',
|
2282 |
'meta_query' => '',
|
2283 |
'cache_results' => false,
|
2284 |
-
'no_found_rows' => true
|
2285 |
);
|
2286 |
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
2287 |
$defaults['suppress_filters'] = false;
|
2288 |
}
|
2289 |
$args = wp_parse_args( $args, $defaults );
|
2290 |
if ( empty( $args['post_type'] ) ) {
|
2291 |
-
return apply_filters( $this->prefix . 'post_filter',
|
2292 |
}
|
2293 |
-
$exclude_slugs =
|
2294 |
if ( ! empty( $args['exclude'] ) ) {
|
2295 |
$exclude = preg_split( '/[\s,]+/', trim( $args['exclude'] ) );
|
2296 |
if ( ! empty( $exclude ) ) {
|
@@ -2319,7 +2899,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
2319 |
if ( ! empty( $q->posts ) ) {
|
2320 |
$args['exclude'] = array_merge( $args['exclude'], $q->posts );
|
2321 |
}
|
2322 |
-
// }
|
2323 |
|
2324 |
$posts = get_posts( apply_filters( $this->prefix . 'post_query', $args ) );
|
2325 |
if ( ! empty( $exclude_slugs ) ) {
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Sitemap class.
|
4 |
+
*
|
5 |
* @package All-in-One-SEO-Pack
|
6 |
*/
|
7 |
+
|
|
|
|
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class All_in_One_SEO_Pack_Sitemap
|
12 |
+
*/
|
13 |
class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
|
14 |
var $cache_struct = null;
|
15 |
var $cache_home = null;
|
23 |
var $freq_sel;
|
24 |
var $extra_sitemaps;
|
25 |
|
26 |
+
/**
|
27 |
+
* All_in_One_SEO_Pack_Sitemap constructor.
|
28 |
+
*/
|
29 |
function __construct() {
|
30 |
+
if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class.
|
31 |
+
$this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
|
32 |
+
$this->prefix = 'aiosp_sitemap_'; // Option prefix.
|
33 |
+
$this->file = __FILE__; // The current file.
|
34 |
+
$this->extra_sitemaps = array();
|
35 |
$this->extra_sitemaps = apply_filters( $this->prefix . 'extra', $this->extra_sitemaps );
|
36 |
}
|
37 |
parent::__construct();
|
38 |
+
$this->comment_string = 'Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s';
|
39 |
+
|
40 |
+
$this->help_text = array(
|
41 |
+
'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
|
42 |
+
'google' => __( 'Notify Google when you update your sitemap settings.', 'all-in-one-seo-pack' ),
|
43 |
+
'bing' => __( 'Notify Bing when you update your sitemap settings.', 'all-in-one-seo-pack' ),
|
44 |
+
'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ),
|
45 |
+
'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ),
|
46 |
+
'paginate' => __( 'Split long sitemaps into separate files.', 'all-in-one-seo-pack' ),
|
47 |
+
'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
|
48 |
+
'posttypes' => __( 'Select which Post Types appear in your sitemap.', 'all-in-one-seo-pack' ),
|
49 |
+
'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
|
50 |
+
'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ),
|
51 |
+
'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ),
|
52 |
+
'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ),
|
53 |
+
'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ),
|
54 |
+
'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ),
|
55 |
+
'debug' => __( 'Use rewrites to generate your sitemap on the fly. NOTE: This is required for WordPress Multisite.', 'all-in-one-seo-pack' ),
|
56 |
+
'addl_url' => __( 'URL to the page.', 'all-in-one-seo-pack' ),
|
57 |
+
'addl_prio' => __( 'The priority of the page.', 'all-in-one-seo-pack' ),
|
58 |
+
'addl_freq' => __( 'The frequency of the page.', 'all-in-one-seo-pack' ),
|
59 |
+
'addl_mod' => __( 'Last modified date of the page.', 'all-in-one-seo-pack' ),
|
60 |
+
'excl_categories' => __( 'Entries from these categories will be excluded from the sitemap.', 'all-in-one-seo-pack' ),
|
61 |
+
'excl_pages' => __( 'Use page slugs or page IDs, seperated by commas, to exclude pages from the sitemap.', 'all-in-one-seo-pack' ),
|
|
|
62 |
);
|
63 |
|
64 |
+
$this->help_anchors = array(
|
65 |
'filename' => '#filename-prefix',
|
66 |
'google' => '#notify-google-bing',
|
67 |
'bing' => '#notify-google-bing',
|
68 |
+
'daily_cron' => '#schedule-updates',
|
69 |
'indexes' => '#enable-sitemap-indexes',
|
70 |
+
'paginate' => '#enable-sitemap-indexes',
|
71 |
+
'max_posts' => '#enable-sitemap-indexes',
|
72 |
'posttypes' => '#post-types-and-taxonomies',
|
73 |
'taxonomies' => '#post-types-and-taxonomies',
|
74 |
'archive' => '#include-archive-pages',
|
85 |
);
|
86 |
|
87 |
$this->default_options = array(
|
88 |
+
'filename' => array(
|
89 |
'name' => __( 'Filename Prefix', 'all-in-one-seo-pack' ),
|
90 |
'default' => 'sitemap',
|
91 |
'type' => 'text',
|
92 |
+
'sanitize' => 'filename',
|
93 |
),
|
94 |
+
'google' => array( 'name' => __( 'Notify Google', 'all-in-one-seo-pack' ) ),
|
95 |
+
'bing' => array( 'name' => __( 'Notify Bing', 'all-in-one-seo-pack' ) ),
|
96 |
+
'daily_cron' => array(
|
97 |
'name' => __( 'Schedule Updates', 'all-in-one-seo-pack' ),
|
98 |
'type' => 'select',
|
99 |
+
'initial_options' => array(
|
100 |
0 => __( 'No Schedule', 'all-in-one-seo-pack' ),
|
101 |
'daily' => __( 'Daily', 'all-in-one-seo-pack' ),
|
102 |
'weekly' => __( 'Weekly', 'all-in-one-seo-pack' ),
|
103 |
+
'monthly' => __( 'Monthly', 'all-in-one-seo-pack' ),
|
104 |
),
|
105 |
+
'default' => 0,
|
106 |
),
|
107 |
+
'indexes' => array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
|
108 |
+
'paginate' => array(
|
109 |
'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
|
110 |
+
'condshow' => array( "{$this->prefix}indexes" => 'on' ),
|
111 |
),
|
112 |
+
'max_posts' => array(
|
113 |
'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
|
114 |
'type' => 'text',
|
115 |
'default' => 50000,
|
116 |
+
'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ),
|
117 |
),
|
118 |
+
'posttypes' => array(
|
119 |
'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
|
120 |
'type' => 'multicheckbox',
|
121 |
+
'default' => 'all',
|
122 |
),
|
123 |
+
'taxonomies' => array(
|
124 |
'name' => __( 'Taxonomies', 'all-in-one-seo-pack' ),
|
125 |
'type' => 'multicheckbox',
|
126 |
+
'default' => 'all',
|
127 |
),
|
128 |
+
'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
|
129 |
+
'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
|
130 |
+
'gzipped' => array(
|
131 |
'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
|
132 |
+
'default' => 'On',
|
133 |
),
|
134 |
+
'robots' => array(
|
135 |
'name' => __( 'Link From Virtual Robots.txt', 'all-in-one-seo-pack' ),
|
136 |
+
'default' => 'On',
|
137 |
),
|
138 |
+
'rewrite' => array(
|
139 |
'name' => __( 'Dynamically Generate Sitemap', 'all-in-one-seo-pack' ),
|
140 |
+
'default' => 'On',
|
141 |
),
|
|
|
|
|
|
|
|
|
142 |
);
|
143 |
|
144 |
+
$status_options = array(
|
145 |
+
'link' => array( 'default' => '', 'type' => 'html', 'label' => 'none', 'save' => false ),
|
146 |
+
'debug' => array(
|
147 |
'name' => __( 'Debug Log', 'all-in-one-seo-pack' ),
|
148 |
'default' => '',
|
149 |
'type' => 'html',
|
152 |
'label' => 'none',
|
153 |
'rows' => 5,
|
154 |
'cols' => 120,
|
155 |
+
'style' => 'min-width:950px',
|
156 |
+
),
|
157 |
);
|
158 |
|
159 |
+
$this->layout = array(
|
160 |
+
'status' => array(
|
161 |
'name' => __( 'Sitemap Status', 'all-in-one-seo-pack' ),
|
162 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
163 |
+
'options' => array_keys( $status_options ),
|
164 |
),
|
165 |
+
'default' => array(
|
166 |
'name' => $this->name,
|
167 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/',
|
168 |
+
'options' => array_keys( $this->default_options ),
|
169 |
+
),
|
170 |
);
|
171 |
|
172 |
+
$prio = array();
|
173 |
for ( $i = 0; $i <= 10; $i ++ ) {
|
174 |
+
$str = sprintf( '%0.1f', $i / 10.0 );
|
175 |
$prio[ $str ] = $str;
|
176 |
}
|
177 |
+
$arr_no = array( 'no' => __( 'Do Not Override', 'all-in-one-seo-pack' ) );
|
178 |
+
$arr_sel = array( 'sel' => __( 'Select Individual', 'all-in-one-seo-pack' ) );
|
179 |
$this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
|
180 |
$this->prio = array_merge( $arr_no, $prio );
|
181 |
|
182 |
+
$freq = array();
|
183 |
+
foreach ( array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) {
|
184 |
$freq[ $f ] = $f;
|
185 |
}
|
186 |
$this->freq_sel = array_merge( $arr_no, $arr_sel, $freq );
|
187 |
$this->freq = array_merge( $arr_no, $freq );
|
188 |
|
189 |
foreach (
|
190 |
+
array(
|
191 |
'prio' => __( 'priority', 'all-in-one-seo-pack' ),
|
192 |
+
'freq' => __( 'frequency', 'all-in-one-seo-pack' ),
|
193 |
) as $k => $v
|
194 |
) {
|
195 |
$s = "{$k}_options";
|
196 |
+
$$s = array();
|
197 |
foreach (
|
198 |
+
array(
|
199 |
'homepage' => __( 'homepage', 'all-in-one-seo-pack' ),
|
200 |
'post' => __( 'posts', 'all-in-one-seo-pack' ),
|
201 |
'taxonomies' => __( 'taxonomies', 'all-in-one-seo-pack' ),
|
202 |
'archive' => __( 'archive pages', 'all-in-one-seo-pack' ),
|
203 |
+
'author' => __( 'author pages', 'all-in-one-seo-pack' ),
|
204 |
) as $opt => $val
|
205 |
) {
|
206 |
$arr = $$s;
|
207 |
+
if ( ( 'post' === $opt ) || ( 'taxonomies' === $opt ) ) {
|
208 |
$iopts = $this->{"{$k}_sel"};
|
209 |
} else {
|
210 |
$iopts = $this->$k;
|
211 |
}
|
212 |
|
213 |
+
$arr[ $k . '_' . $opt ] = array(
|
214 |
'name' => $this->ucwords( $val ),
|
215 |
+
'help_text' => sprintf( __( 'Manually set the %s of your %s.', 'all-in-one-seo-pack' ), $v, $val ),
|
216 |
'type' => 'select',
|
217 |
'initial_options' => $iopts,
|
218 |
+
'default' => 'no',
|
219 |
);
|
220 |
+
if ( ( 'archive' === $opt ) || ( 'author' === $opt ) ) {
|
221 |
+
$arr[ $k . '_' . $opt ]['condshow'] = array( $this->prefix . $opt => 'on' );
|
222 |
}
|
223 |
$$s = $arr;
|
224 |
}
|
225 |
}
|
226 |
|
227 |
+
$addl_options = array(
|
228 |
+
'addl_instructions' => array(
|
229 |
'default' => '<div>' . __( 'Enter information below for any additional links for your sitemap not already managed through WordPress.', 'all-in-one-seo-pack' ) . '</div><br />',
|
230 |
'type' => 'html',
|
231 |
'label' => 'none',
|
232 |
+
'save' => false,
|
233 |
),
|
234 |
+
'addl_url' => array(
|
235 |
'name' => __( 'Page URL', 'all-in-one-seo-pack' ),
|
236 |
'type' => 'text',
|
237 |
'label' => 'top',
|
238 |
+
'save' => false,
|
239 |
),
|
240 |
+
'addl_prio' => array(
|
241 |
'name' => __( 'Page Priority', 'all-in-one-seo-pack' ),
|
242 |
'type' => 'select',
|
243 |
'initial_options' => $prio,
|
244 |
'label' => 'top',
|
245 |
+
'save' => false,
|
246 |
),
|
247 |
+
'addl_freq' => array(
|
248 |
'name' => __( 'Page Frequency', 'all-in-one-seo-pack' ),
|
249 |
'type' => 'select',
|
250 |
'initial_options' => $freq,
|
251 |
'label' => 'top',
|
252 |
+
'save' => false,
|
253 |
),
|
254 |
+
'addl_mod' => array(
|
255 |
'name' => __( 'Last Modified', 'all-in-one-seo-pack' ),
|
256 |
'type' => 'text',
|
257 |
'label' => 'top',
|
258 |
+
'save' => false,
|
259 |
),
|
260 |
+
'addl_pages' => array(
|
261 |
'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
|
262 |
'type' => 'custom',
|
263 |
+
'save' => true,
|
264 |
),
|
265 |
+
'Submit' => array(
|
266 |
'type' => 'submit',
|
267 |
'class' => 'button-primary',
|
268 |
'name' => __( 'Add URL', 'all-in-one-seo-pack' ) . ' »',
|
269 |
'style' => 'margin-left: 20px;',
|
270 |
'label' => 'none',
|
271 |
'save' => false,
|
272 |
+
'value' => 1,
|
273 |
+
),
|
274 |
);
|
275 |
|
276 |
+
$excl_options = array(
|
277 |
+
'excl_categories' => array(
|
278 |
'name' => __( 'Excluded Categories', 'all-in-one-seo-pack' ),
|
279 |
'type' => 'multicheckbox',
|
280 |
+
'initial_options' => '',
|
281 |
),
|
282 |
+
'excl_pages' => array( 'name' => __( 'Excluded Pages', 'all-in-one-seo-pack' ), 'type' => 'text' ),
|
283 |
);
|
284 |
|
285 |
+
$this->layout['addl_pages'] = array(
|
286 |
'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
|
287 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#additional-pages',
|
288 |
+
'options' => array_keys( $addl_options ),
|
289 |
);
|
290 |
|
291 |
+
$this->layout['excl_pages'] = array(
|
292 |
'name' => __( 'Excluded Items', 'all-in-one-seo-pack' ),
|
293 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#excluded-items',
|
294 |
+
'options' => array_keys( $excl_options ),
|
295 |
);
|
296 |
|
297 |
+
$this->layout['priorities'] = array(
|
298 |
'name' => __( 'Priorities', 'all-in-one-seo-pack' ),
|
299 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
|
300 |
+
'options' => array_keys( $prio_options ),
|
301 |
);
|
302 |
|
303 |
+
$this->layout['frequencies'] = array(
|
304 |
'name' => __( 'Frequencies', 'all-in-one-seo-pack' ),
|
305 |
'help_link' => 'http://semperplugins.com/documentation/xml-sitemaps-module/#priorities-and-frequencies',
|
306 |
+
'options' => array_keys( $freq_options ),
|
307 |
);
|
308 |
|
309 |
$this->default_options = array_merge( $status_options, $this->default_options, $addl_options, $excl_options, $prio_options, $freq_options );
|
310 |
|
311 |
$this->add_help_text_links();
|
312 |
|
313 |
+
add_action( 'after_doing_aioseop_updates', array(
|
314 |
+
$this,
|
315 |
+
'do_sitemaps',
|
316 |
+
) ); // Update static sitemap when AIOSEOP is upgrade to new version.
|
317 |
+
add_action( 'init', array( $this, 'load_sitemap_options' ) );
|
318 |
+
add_action( $this->prefix . 'settings_update', array( $this, 'do_sitemaps' ) );
|
319 |
+
add_filter( $this->prefix . 'display_settings', array( $this, 'update_post_data' ) );
|
320 |
+
add_filter( $this->prefix . 'display_options', array( $this, 'filter_display_options' ) );
|
321 |
+
add_filter( $this->prefix . 'update_options', array( $this, 'filter_options' ) );
|
322 |
+
add_filter( $this->prefix . 'output_option', array( $this, 'display_custom_options' ), 10, 2 );
|
323 |
+
add_action( $this->prefix . 'daily_update_cron', array( $this, 'daily_update' ) );
|
324 |
+
add_action( 'init', array( $this, 'make_dynamic_xsl' ) );
|
325 |
+
add_action( 'transition_post_status', array( $this, 'update_sitemap_from_posts' ), 10, 3 );
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Update sitemap from posts.
|
330 |
+
*
|
331 |
+
* @param $new_status
|
332 |
+
* @param $old_status
|
333 |
+
* @param $post
|
334 |
+
*/
|
335 |
+
function update_sitemap_from_posts( $new_status, $old_status, $post ) {
|
336 |
+
|
337 |
+
if ( $this->option_isset( 'rewrite' ) ) {
|
338 |
+
// TODO if dynamic, delete transient (we currently don't do transients).
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
$posttypes = array();
|
343 |
+
if ( ! empty( $this->options["{$this->prefix}posttypes"] ) ) {
|
344 |
+
$posttypes = $this->options["{$this->prefix}posttypes"];
|
345 |
+
}
|
346 |
+
|
347 |
+
if ( ! in_array( $post->post_type, $posttypes, true ) ) {
|
348 |
+
return;
|
349 |
+
}
|
350 |
+
|
351 |
+
$statuses_for_updating = array( 'new', 'publish', 'trash' );
|
352 |
+
if ( ! in_array( $new_status, $statuses_for_updating, true ) ) {
|
353 |
+
return;
|
354 |
+
}
|
355 |
+
|
356 |
+
$this->do_sitemaps();
|
357 |
}
|
358 |
|
359 |
+
/**
|
360 |
+
* Add cron schedules.
|
361 |
+
*
|
362 |
+
* Add new intervals of a week and a month.
|
363 |
+
*
|
364 |
+
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
|
365 |
+
*
|
366 |
+
* @param $schedules
|
367 |
+
*
|
368 |
+
* @return mixed
|
369 |
+
*/
|
370 |
function add_cron_schedules( $schedules ) {
|
371 |
$schedules['weekly'] = array(
|
372 |
+
'interval' => 604800, // 1 week in seconds.
|
373 |
+
'display' => __( 'Once Weekly', 'all-in-one-seo-pack' ),
|
374 |
);
|
375 |
$schedules['monthly'] = array(
|
376 |
+
'interval' => 2629740, // 1 month in seconds.
|
377 |
+
'display' => __( 'Once Monthly', 'all-in-one-seo-pack' ),
|
378 |
);
|
379 |
|
380 |
return $schedules;
|
381 |
}
|
382 |
|
383 |
+
/**
|
384 |
+
* Cron update.
|
385 |
+
*/
|
386 |
function cron_update() {
|
387 |
+
add_filter( 'cron_schedules', array( $this, 'add_cron_schedules' ) );
|
388 |
if ( ! wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
|
389 |
wp_schedule_event( time(), $this->options[ $this->prefix . 'daily_cron' ], $this->prefix . 'daily_update_cron' );
|
390 |
}
|
391 |
}
|
392 |
|
393 |
+
/**
|
394 |
+
* Daily update.
|
395 |
+
*/
|
396 |
function daily_update() {
|
397 |
$last_run = get_option( $this->prefix . 'cron_last_run' );
|
398 |
+
if ( empty( $last_run ) || ( time() - $last_run > 23.5 * 60 * 60 ) ) {
|
399 |
+
// Sanity check.
|
400 |
+
$this->do_sitemaps( __( 'Daily scheduled sitemap check has finished.', 'all-in-one-seo-pack' ) );
|
401 |
}
|
402 |
$last_run = time();
|
403 |
update_option( $this->prefix . 'cron_last_run', $last_run );
|
404 |
}
|
405 |
|
406 |
+
/**
|
407 |
+
* Initialize options, after constructor.
|
408 |
+
*/
|
409 |
function load_sitemap_options() {
|
410 |
+
// Load initial options / set defaults.
|
411 |
$this->update_options();
|
412 |
if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
|
413 |
$this->paginate = true;
|
414 |
+
if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) {
|
415 |
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
416 |
}
|
417 |
}
|
425 |
}
|
426 |
|
427 |
if ( $this->option_isset( 'robots' ) ) {
|
428 |
+
add_action( 'do_robots', array( $this, 'do_robots' ), 100 );
|
429 |
}
|
430 |
|
431 |
if ( isset( $this->options[ $this->prefix . 'daily_cron' ] ) && $this->options[ $this->prefix . 'daily_cron' ] ) {
|
432 |
+
add_action( 'wp', array( $this, 'cron_update' ) );
|
433 |
} else {
|
434 |
if ( $time = wp_next_scheduled( $this->prefix . 'daily_update_cron' ) ) {
|
435 |
wp_unschedule_event( $time, $this->prefix . 'daily_update_cron' );
|
437 |
}
|
438 |
}
|
439 |
|
440 |
+
/**
|
441 |
+
* Custom settings.
|
442 |
+
*
|
443 |
+
* Displays boxes for add pages to sitemap option. Requires WordPress 4.1.
|
444 |
+
*
|
445 |
+
* @param $buf
|
446 |
+
* @param $args
|
447 |
+
*
|
448 |
+
* @return string
|
449 |
+
*/
|
450 |
function display_custom_options( $buf, $args ) {
|
451 |
+
if ( "{$this->prefix}addl_pages" === $args['name'] ) {
|
452 |
$buf .= "<div id='{$this->prefix}addl_pages'>";
|
453 |
if ( ! empty( $args['value'] ) ) {
|
454 |
$buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
|
463 |
}
|
464 |
$args['options']['type'] = 'hidden';
|
465 |
if ( ! empty( $args['value'] ) ) {
|
466 |
+
$args['value'] = wp_json_encode( $args['value'] );
|
467 |
} else {
|
468 |
$args['options']['type'] = 'html';
|
469 |
}
|
476 |
return $buf;
|
477 |
}
|
478 |
|
479 |
+
/**
|
480 |
+
* Add post type details for settings once post types have been registered.
|
481 |
+
*/
|
482 |
function add_post_types() {
|
483 |
+
$post_type_titles = $this->get_post_type_titles( array( 'public' => true ) );
|
484 |
+
$taxonomy_titles = $this->get_taxonomy_titles( array( 'public' => true ) );
|
485 |
if ( isset( $post_type_titles['attachment'] ) ) {
|
486 |
+
$post_type_titles['attachment'] = __( 'Media / Attachments', 'all-in-one-seo-pack' );
|
487 |
}
|
488 |
+
$this->default_options['posttypes']['initial_options'] = array_merge( array( 'all' => __( 'All Post Types', 'all-in-one-seo-pack' ) ), $post_type_titles );
|
489 |
+
$this->default_options['taxonomies']['initial_options'] = array_merge( array( 'all' => __( 'All Taxonomies', 'all-in-one-seo-pack' ) ), $taxonomy_titles );
|
490 |
$this->default_options['posttypes']['default'] = array_keys( $this->default_options['posttypes']['initial_options'] );
|
491 |
$this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
|
492 |
$this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();
|
493 |
+
$prio_help = __( 'Manually set the priority for the ', 'all-in-one-seo-pack' );
|
494 |
+
$freq_help = __( 'Manually set the frequency for the ', 'all-in-one-seo-pack' );
|
495 |
+
$post_name = __( ' Post Type', 'all-in-one-seo-pack' );
|
496 |
+
$tax_name = __( ' Taxonomy', 'all-in-one-seo-pack' );
|
497 |
foreach ( $post_type_titles as $k => $v ) {
|
498 |
$key = 'prio_post_' . $k;
|
499 |
+
$this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post', array(
|
500 |
+
$key => array(
|
501 |
'name' => $v . $post_name,
|
502 |
'help_text' => $prio_help . $v . $post_name,
|
503 |
'type' => 'select',
|
504 |
'initial_options' => $this->prio,
|
505 |
'default' => 'no',
|
506 |
+
'condshow' => array( "{$this->prefix}prio_post" => 'sel' ),
|
507 |
+
),
|
508 |
) );
|
509 |
$this->layout['priorities']['options'][] = $key;
|
510 |
$key = 'freq_post_' . $k;
|
511 |
+
$this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_post', array(
|
512 |
+
$key => array(
|
513 |
'name' => $v . $post_name,
|
514 |
'help_text' => $freq_help . $v . $post_name,
|
515 |
'type' => 'select',
|
516 |
'initial_options' => $this->freq,
|
517 |
'default' => 'no',
|
518 |
+
'condshow' => array( "{$this->prefix}freq_post" => 'sel' ),
|
519 |
+
),
|
520 |
) );
|
521 |
$this->layout['frequencies']['options'][] = $key;
|
522 |
}
|
523 |
foreach ( $taxonomy_titles as $k => $v ) {
|
524 |
$key = 'prio_taxonomies_' . $k;
|
525 |
+
$this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', array(
|
526 |
+
$key => array(
|
527 |
'name' => $v . $tax_name,
|
528 |
'help_text' => $prio_help . $v . $tax_name,
|
529 |
'type' => 'select',
|
530 |
'initial_options' => $this->prio,
|
531 |
'default' => 'no',
|
532 |
+
'condshow' => array( "{$this->prefix}prio_taxonomies" => 'sel' ),
|
533 |
+
),
|
534 |
) );
|
535 |
$this->layout['priorities']['options'][] = $key;
|
536 |
$key = 'freq_taxonomies_' . $k;
|
537 |
+
$this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_taxonomies', array(
|
538 |
+
$key => array(
|
539 |
'name' => $v . $tax_name,
|
540 |
'help_text' => $freq_help . $v . $tax_name,
|
541 |
'type' => 'select',
|
542 |
'initial_options' => $this->freq,
|
543 |
'default' => 'no',
|
544 |
+
'condshow' => array( "{$this->prefix}freq_taxonomies" => 'sel' ),
|
545 |
+
),
|
546 |
) );
|
547 |
$this->layout['frequencies']['options'][] = $key;
|
548 |
}
|
549 |
$this->update_options();
|
550 |
}
|
551 |
|
552 |
+
/**
|
553 |
+
* Set up settings, checking for sitemap conflicts, on settings page.
|
554 |
+
*/
|
555 |
function add_page_hooks() {
|
556 |
$this->flush_rules_hook();
|
557 |
$this->add_post_types();
|
558 |
parent::add_page_hooks();
|
559 |
+
add_action( $this->prefix . 'settings_header', array( $this, 'do_sitemap_scan' ), 5 );
|
560 |
+
add_filter( "{$this->prefix}submit_options", array( $this, 'filter_submit' ) );
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Filter submit button.
|
565 |
+
*
|
566 |
+
* Change settings page submit button to read "Update Sitemap".
|
567 |
+
*
|
568 |
+
* @param $submit
|
569 |
+
*
|
570 |
+
* @return mixed
|
571 |
+
*/
|
572 |
function filter_submit( $submit ) {
|
573 |
$submit['Submit']['value'] = __( 'Update Sitemap', 'all-in-one-seo-pack' ) . ' »';
|
574 |
|
575 |
return $submit;
|
576 |
}
|
577 |
|
578 |
+
/**
|
579 |
+
* Updates post data.
|
580 |
+
*
|
581 |
+
* Disable writing sitemaps to the filesystem for multisite.
|
582 |
+
*
|
583 |
+
* @param $options
|
584 |
+
*
|
585 |
+
* @return mixed
|
586 |
+
*/
|
587 |
function update_post_data( $options ) {
|
588 |
if ( is_multisite() ) {
|
589 |
$options[ $this->prefix . 'rewrite' ]['disabled'] = 'disabled';
|
592 |
return $options;
|
593 |
}
|
594 |
|
595 |
+
/**
|
596 |
+
* @param $url
|
597 |
+
*
|
598 |
+
* @return bool
|
599 |
+
*/
|
600 |
function get_rewrite_url( $url ) {
|
601 |
global $wp_rewrite;
|
602 |
$url = parse_url( esc_url( $url ), PHP_URL_PATH );
|
613 |
return false;
|
614 |
}
|
615 |
|
616 |
+
/**
|
617 |
+
* Filter display options.
|
618 |
+
*
|
619 |
+
* Add in options for status display on settings page, sitemap rewriting on multisite.
|
620 |
+
*
|
621 |
+
* @param $options
|
622 |
+
*
|
623 |
+
* @return mixed
|
624 |
+
*/
|
625 |
function filter_display_options( $options ) {
|
626 |
if ( is_multisite() ) {
|
627 |
$options[ $this->prefix . 'rewrite' ] = 'On';
|
630 |
$options[ $this->prefix . 'max_posts' ] = 50000;
|
631 |
}
|
632 |
$url = trailingslashit( get_home_url() ) . $options[ $this->prefix . 'filename' ] . '.xml';
|
633 |
+
$options[ $this->prefix . 'link' ] = sprintf( __( 'Please review your settings below and click %s to build your sitemap; then, %s.',
|
634 |
'all-in-one-seo-pack' ), sprintf( '<a href="#" onclick="document.dofollow.elements[\'Submit\'][0].click();">%s</a>',
|
635 |
__( 'Update Sitemap', 'all-in-one-seo-pack' ) ), '<a href="' . esc_url( $url ) . '" target="_blank">' .
|
636 |
+
__( 'view your sitemap', 'all-in-one-seo-pack' ) . '</a>' );
|
637 |
if ( $this->option_isset( 'rewrite' ) ) {
|
638 |
|
639 |
+
$options[ $this->prefix . 'link' ] .= '<p>' . __( 'Note: you are using dynamic sitemap generation to keep your sitemap current; this will not generate a static sitemap file.', 'all-in-one-seo-pack' ) . '</p>';
|
640 |
$rule = $this->get_rewrite_url( $url );
|
641 |
$rules = $this->get_rewrite_rules();
|
642 |
if ( in_array( $rule, $rules ) ) {
|
643 |
+
$options[ $this->prefix . 'link' ] .= '<p>' . __( 'Dynamic sitemap generation appears to be using the correct rewrite rules.', 'all-in-one-seo-pack' ) . '</p>';
|
644 |
} else {
|
645 |
+
$options[ $this->prefix . 'link' ] .= '<p>' . __( 'Dynamic sitemap generation does not appear to be using the correct rewrite rules; please disable any other sitemap plugins or functionality on your site and reset your permalinks.', 'all-in-one-seo-pack' ) . '</p>';
|
646 |
}
|
647 |
}
|
648 |
if ( ! get_option( 'blog_public' ) ) {
|
649 |
global $wp_version;
|
650 |
+
if ( version_compare( $wp_version, '3.5.0', '>=' ) || function_exists( 'set_url_scheme' ) ) {
|
651 |
$privacy_link = '<a href="options-reading.php">' . __( 'Reading Settings', 'all-in-one-seo-pack' ) . '</a>';
|
652 |
} else {
|
653 |
$privacy_link = '<a href="options-privacy.php">' . __( 'Privacy Settings', 'all-in-one-seo-pack' ) . '</a>';
|
654 |
}
|
655 |
+
$options[ $this->prefix . 'link' ] .= '<p class="aioseop_error_notice">' . sprintf( __( 'Warning: your privacy settings are configured to ask search engines to not index your site; you can change this under %s for your blog.', 'all-in-one-seo-pack' ), $privacy_link );
|
|
|
656 |
}
|
657 |
if ( $this->option_isset( 'debug' ) ) {
|
658 |
+
$debug_msg = esc_html( $options["{$this->prefix}debug"] );
|
659 |
+
$options["{$this->prefix}debug"] = '<pre>' . $debug_msg . '</pre>';
|
660 |
}
|
661 |
|
662 |
return $options;
|
663 |
}
|
664 |
|
665 |
+
/**
|
666 |
+
* Filter options.
|
667 |
+
*
|
668 |
+
* Handle 'all' option for post types / taxonomies, further sanitization of filename, rewrites on for multisite, setting up addl pages option.
|
669 |
+
*
|
670 |
+
* @param $options
|
671 |
+
*
|
672 |
+
* @return mixed
|
673 |
+
*/
|
674 |
function filter_options( $options ) {
|
675 |
if ( ! isset( $this->default_options['posttypes']['initial_options'] ) ) {
|
676 |
$this->add_post_types();
|
693 |
if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) {
|
694 |
$options[ $this->prefix . 'addl_pages' ] = wp_specialchars_decode( stripslashes_deep( $options[ $this->prefix . 'addl_pages' ] ), ENT_QUOTES );
|
695 |
$decoded = json_decode( $options[ $this->prefix . 'addl_pages' ] );
|
696 |
+
if ( null === $decoded ) {
|
697 |
$decoded = maybe_unserialize( $options[ $this->prefix . 'addl_pages' ] );
|
698 |
}
|
699 |
if ( ! is_array( $decoded ) ) {
|
700 |
$decoded = (Array) $decoded;
|
701 |
}
|
702 |
+
if ( null === $decoded ) {
|
703 |
$decoded = $options[ $this->prefix . 'addl_pages' ];
|
704 |
}
|
705 |
$options[ $this->prefix . 'addl_pages' ] = $decoded;
|
714 |
if ( isset( $options[ $this->prefix . 'addl_pages' ][0] ) ) {
|
715 |
unset( $options[ $this->prefix . 'addl_pages' ][0] );
|
716 |
}
|
717 |
+
// TODO Refactor all these... use a nonce, dump the incoming _Post into an array and use that.
|
718 |
if ( ! empty( $_POST[ $this->prefix . 'addl_url' ] ) ) {
|
719 |
+
foreach ( array( 'addl_url', 'addl_prio', 'addl_freq', 'addl_mod' ) as $field ) {
|
720 |
if ( ! empty( $_POST[ $this->prefix . $field ] ) ) {
|
721 |
$_POST[ $this->prefix . $field ] = esc_attr( wp_kses_post( $_POST[ $this->prefix . $field ] ) );
|
722 |
} else {
|
724 |
}
|
725 |
}
|
726 |
if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) {
|
727 |
+
$options[ $this->prefix . 'addl_pages' ] = array();
|
728 |
}
|
729 |
+
$options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] = array(
|
730 |
'prio' => $_POST[ $this->prefix . 'addl_prio' ],
|
731 |
'freq' => $_POST[ $this->prefix . 'addl_freq' ],
|
732 |
'mod' => $_POST[ $this->prefix . 'addl_mod' ],
|
736 |
return $options;
|
737 |
}
|
738 |
|
739 |
+
/**
|
740 |
+
* Get sitemap urls of child blogs, if any.
|
741 |
+
*
|
742 |
+
* @return mixed|void
|
743 |
+
*/
|
744 |
function get_child_sitemap_urls() {
|
745 |
+
$siteurls = array();
|
746 |
$blogs = $this->get_child_blogs();
|
747 |
if ( ! empty( $blogs ) ) {
|
748 |
$option_name = $this->get_option_name();
|
778 |
}
|
779 |
}
|
780 |
}
|
781 |
+
$siteurls = apply_filters( $this->prefix . 'sitemap_urls', $siteurls ); // Legacy.
|
782 |
return apply_filters( $this->prefix . 'child_urls', $siteurls );
|
783 |
}
|
784 |
|
785 |
+
/**
|
786 |
+
* Gets the home path.
|
787 |
+
*
|
788 |
+
* If we're in wp-admin, use the WordPress function, otherwise we user our own version here.
|
789 |
+
* This only applies to static sitemaps.
|
790 |
+
*
|
791 |
+
* @since 2.3.6.1
|
792 |
+
*
|
793 |
+
* @return mixed|string
|
794 |
+
*/
|
795 |
+
function get_home_path() {
|
796 |
+
|
797 |
+
if ( function_exists( 'get_home_path' ) ) {
|
798 |
+
return get_home_path();
|
799 |
+
}
|
800 |
+
|
801 |
+
$home = set_url_scheme( get_option( 'home' ), 'http' );
|
802 |
+
$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
|
803 |
+
if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
|
804 |
+
$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
|
805 |
+
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
|
806 |
+
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
|
807 |
+
$home_path = trailingslashit( $home_path );
|
808 |
+
} else {
|
809 |
+
$home_path = ABSPATH;
|
810 |
+
}
|
811 |
+
|
812 |
+
return str_replace( '\\', '/', $home_path );
|
813 |
+
}
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Scan for sitemaps on filesystem.
|
817 |
+
*
|
818 |
+
* @return array
|
819 |
+
*/
|
820 |
function scan_match_files() {
|
821 |
$scan1 = $scan2 = '';
|
822 |
+
$files = array();
|
823 |
|
824 |
if ( ! empty( $this->options["{$this->prefix}filename"] ) ) {
|
825 |
$scan1 = get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml';
|
848 |
}
|
849 |
}
|
850 |
|
851 |
+
/**
|
852 |
+
* Scan for sitemaps.
|
853 |
+
*
|
854 |
+
* Handle deleting / renaming of conflicting sitemap files.
|
855 |
+
*/
|
856 |
function do_sitemap_scan() {
|
857 |
$msg = '';
|
858 |
+
if ( ! empty( $this->options["{$this->prefix}rewrite"] ) && ( get_option( 'permalink_structure' ) === '' ) ) {
|
859 |
$msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all-in-one-seo-pack' ) . '</p>';
|
860 |
}
|
861 |
if ( ! empty( $_POST['aioseop_sitemap_rename_files'] ) || ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
873 |
if ( in_array( $ren_file, $files ) ) {
|
874 |
if ( ! empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
875 |
if ( $this->delete_file( $ren_file ) ) {
|
876 |
+
$msg .= '<p>' . sprintf( __( 'Deleted %s.', 'all-in-one-seo-pack' ), $ren_file ) . '</p>';
|
877 |
}
|
878 |
continue;
|
879 |
}
|
880 |
$count = 0;
|
881 |
do {
|
882 |
+
$ren_to = $ren_file . '._' . sprintf( '%03d', $count ) . '.old';
|
883 |
$count ++;
|
884 |
} while ( $this->file_exists( $ren_to ) && ( $count < 1000 ) );
|
885 |
if ( $count >= 1000 ) {
|
886 |
+
$msg .= '<p>' . sprintf( __( "Couldn't rename file %s!", 'all-in-one-seo-pack' ), $ren_file ) . '</p>';
|
887 |
} else {
|
888 |
$ren = $this->rename_file( $ren_file, $ren_to );
|
889 |
if ( $ren ) {
|
890 |
+
$msg .= '<p>' . sprintf( __( 'Renamed %s to %s.', 'all-in-one-seo-pack' ), $ren_file, $ren_to ) . '</p>';
|
891 |
}
|
892 |
}
|
893 |
} else {
|
894 |
+
$msg .= '<p>' . sprintf( __( "Couldn't find file %s!", 'all-in-one-seo-pack' ), $ren_file ) . '</p>';
|
895 |
}
|
896 |
}
|
897 |
}
|
904 |
}
|
905 |
}
|
906 |
|
907 |
+
/**
|
908 |
+
* Do the scan, return the results.
|
909 |
+
*
|
910 |
+
* @return string
|
911 |
+
*/
|
912 |
function scan_sitemaps() {
|
913 |
$msg = '';
|
914 |
$files = $this->scan_match_files();
|
919 |
return $msg;
|
920 |
}
|
921 |
|
922 |
+
/**
|
923 |
+
* Get problem files.
|
924 |
+
*
|
925 |
+
* Get the list of potentially conflicting sitemap files.
|
926 |
+
*
|
927 |
+
* @param $files
|
928 |
+
* @param $msg
|
929 |
+
*
|
930 |
+
* @return array
|
931 |
+
*/
|
932 |
function get_problem_files( $files, &$msg ) {
|
933 |
+
$problem_files = array();
|
934 |
$use_wpfs = true;
|
935 |
$wpfs = $this->get_filesystem_object();
|
936 |
if ( ! is_object( $wpfs ) ) {
|
937 |
$use_wpfs = false;
|
938 |
} else {
|
939 |
+
if ( 'direct' === $wpfs->method ) {
|
940 |
$use_wpfs = false;
|
941 |
}
|
942 |
}
|
945 |
if ( $this->is_file( $f ) ) {
|
946 |
$fn = $f;
|
947 |
$compressed = false;
|
948 |
+
if ( $this->substr( $f, - 3 ) === '.gz' ) {
|
949 |
$compressed = true;
|
950 |
}
|
951 |
if ( $use_wpfs ) {
|
952 |
+
if ( $compressed ) { // Inefficient but necessary.
|
953 |
$file = $this->load_file( $fn );
|
954 |
if ( ! empty( $file ) ) {
|
955 |
$file = gzuncompress( $file, 4096 );
|
964 |
$file = file_get_contents( $fn, false, null, - 1, 4096 );
|
965 |
}
|
966 |
if ( ! empty( $file ) ) {
|
967 |
+
$matches = array();
|
968 |
+
if ( preg_match( '/<!-- ' . sprintf( $this->comment_string, '(.*)', '(.*)', '(.*)' ) . ' -->/',
|
969 |
$file, $matches ) ) {
|
970 |
if ( ! empty( $this->options["{$this->prefix}rewrite"] ) ) {
|
971 |
$msg .= '<p>' . sprintf( __( "Warning: a static sitemap '%s' generated by All in One SEO Pack %s on %s already exists that may conflict with dynamic sitemap generation.", 'all-in-one-seo-pack' ),
|
973 |
$problem_files[] = $f;
|
974 |
}
|
975 |
} else {
|
976 |
+
$msg .= '<p>' . sprintf( __( 'Potential conflict with unknown file %s.', 'all-in-one-seo-pack' ), $f ) . "</p>\n";
|
977 |
$problem_files[] = $f;
|
978 |
}
|
979 |
}
|
983 |
return $problem_files;
|
984 |
}
|
985 |
|
986 |
+
/**
|
987 |
+
* Display sitemap warning.
|
988 |
+
*
|
989 |
+
* Display the warning and the form for conflicting sitemap files.
|
990 |
+
*
|
991 |
+
* @param $files
|
992 |
+
*
|
993 |
+
* @return string
|
994 |
+
*/
|
995 |
function sitemap_warning( $files ) {
|
996 |
$msg = '';
|
997 |
$conflict = false;
|
1004 |
$msg .= "<input type='hidden' name='aioseop_sitemap_conflict[]' value='" . esc_attr( basename( realpath( $p ) ) ) . "'>\n";
|
1005 |
}
|
1006 |
$msg .= "<input type='hidden' name='nonce-aioseop' value='" . wp_create_nonce( 'aioseop-nonce' ) . "'>\n";
|
1007 |
+
$msg .= "<input type='submit' name='aioseop_sitemap_rename_files' value='" . __( 'Rename Conflicting Files', 'all-in-one-seo-pack' ) . "'> ";
|
1008 |
+
$msg .= "<input type='submit' name='aioseop_sitemap_delete_files' value='" . __( 'Delete Conflicting Files', 'all-in-one-seo-pack' ) . "'>";
|
1009 |
$msg = '<form action="" method="post">' . $msg . '</form>';
|
1010 |
}
|
1011 |
|
1012 |
return $msg;
|
1013 |
}
|
1014 |
|
1015 |
+
/**
|
1016 |
+
* Updates debug log messages.
|
1017 |
+
*
|
1018 |
+
* @param $msg
|
1019 |
+
*/
|
1020 |
function debug_message( $msg ) {
|
1021 |
if ( empty( $this->options["{$this->prefix}debug"] ) ) {
|
1022 |
$this->options["{$this->prefix}debug"] = '';
|
1024 |
$this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
|
1025 |
if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
|
1026 |
$end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
|
1027 |
+
if ( false === $end ) {
|
1028 |
$end = 2048;
|
1029 |
}
|
1030 |
$this->options["{$this->prefix}debug"] = $this->substr( $this->options["{$this->prefix}debug"], 0, $end );
|
1032 |
$this->update_class_option( $this->options );
|
1033 |
}
|
1034 |
|
1035 |
+
/**
|
1036 |
+
* Set up hooks for rewrite rules for dynamic sitemap generation.
|
1037 |
+
*/
|
1038 |
function setup_rewrites() {
|
1039 |
+
add_action( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) );
|
1040 |
+
add_filter( 'query_vars', array( $this, 'query_var_hook' ) );
|
1041 |
+
add_action( 'parse_query', array( $this, 'sitemap_output_hook' ) );
|
1042 |
if ( ! get_transient( "{$this->prefix}rules_flushed" ) ) {
|
1043 |
+
add_action( 'wp_loaded', array( $this, 'flush_rules_hook' ) );
|
1044 |
}
|
1045 |
}
|
1046 |
|
1047 |
+
/**
|
1048 |
+
* Build and return our rewrite rules.
|
1049 |
+
*
|
1050 |
+
* @return array
|
1051 |
+
*/
|
1052 |
function get_rewrite_rules() {
|
1053 |
+
$sitemap_rules_normal = $sitemap_rules_gzipped = array();
|
1054 |
$sitemap_rules_normal = array(
|
1055 |
$this->options["{$this->prefix}filename"] . '.xml' => "index.php?{$this->prefix}path=root",
|
1056 |
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
|
1057 |
+
$this->options["{$this->prefix}filename"] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]',
|
1058 |
);
|
1059 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
1060 |
$sitemap_rules_gzipped = array(
|
1061 |
$this->options["{$this->prefix}filename"] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz",
|
1062 |
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]',
|
1063 |
+
$this->options["{$this->prefix}filename"] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz',
|
1064 |
);
|
1065 |
}
|
1066 |
$sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
|
1068 |
return $sitemap_rules;
|
1069 |
}
|
1070 |
|
1071 |
+
/**
|
1072 |
+
* Add in our rewrite rules.
|
1073 |
+
*
|
1074 |
+
* @param $rules
|
1075 |
+
*
|
1076 |
+
* @return array
|
1077 |
+
*/
|
1078 |
function rewrite_hook( $rules ) {
|
1079 |
$sitemap_rules = $this->get_rewrite_rules();
|
1080 |
if ( ! empty( $sitemap_rules ) ) {
|
1084 |
return $rules;
|
1085 |
}
|
1086 |
|
1087 |
+
/**
|
1088 |
+
* Flush rewrite rules when necessary.
|
1089 |
+
*/
|
1090 |
function flush_rules_hook() {
|
1091 |
global $wp_rewrite;
|
1092 |
$sitemap_rules = $this->get_rewrite_rules( $wp_rewrite );
|
1093 |
if ( ! empty( $sitemap_rules ) ) {
|
1094 |
$rules = get_option( 'rewrite_rules' );
|
1095 |
$rule = key( $sitemap_rules );
|
1096 |
+
if ( ! isset( $rules[ $rule ] ) || ( $rules[ $rule ] !== $sitemap_rules[ $rule ] ) ) {
|
1097 |
$wp_rewrite->flush_rules();
|
1098 |
set_transient( "{$this->prefix}rules_flushed", true, 43200 );
|
1099 |
}
|
1100 |
}
|
1101 |
}
|
1102 |
|
1103 |
+
/**
|
1104 |
+
* Add our query variable for sitemap generation.
|
1105 |
+
*
|
1106 |
+
* @param $vars
|
1107 |
+
*
|
1108 |
+
* @return array
|
1109 |
+
*/
|
1110 |
function query_var_hook( $vars ) {
|
1111 |
$vars[] = "{$this->prefix}path";
|
1112 |
if ( $this->paginate ) {
|
1116 |
return $vars;
|
1117 |
}
|
1118 |
|
1119 |
+
/**
|
1120 |
+
* Start timing and get initial memory usage for debug info.
|
1121 |
+
*/
|
1122 |
function log_start() {
|
1123 |
$this->start_memory_usage = memory_get_peak_usage();
|
1124 |
timer_start();
|
1125 |
}
|
1126 |
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* Stop timing and log memory usage for debug info.
|
1130 |
+
*
|
1131 |
+
* @param string $sitemap_type
|
1132 |
+
* @param bool $compressed
|
1133 |
+
* @param bool $dynamic
|
1134 |
+
*/
|
1135 |
+
function log_stats( $sitemap_type = 'static', $compressed = false, $dynamic = true ) {
|
1136 |
$time = timer_stop();
|
1137 |
$end_memory_usage = memory_get_peak_usage();
|
1138 |
$sitemap_memory_usage = $end_memory_usage - $this->start_memory_usage;
|
1139 |
$end_memory_usage = $end_memory_usage / 1024.0 / 1024.0;
|
1140 |
$sitemap_memory_usage = $sitemap_memory_usage / 1024.0 / 1024.0;
|
1141 |
+
$sitemap_type = __( 'static', 'all-in-one-seo-pack ' );
|
1142 |
if ( $compressed ) {
|
1143 |
+
$sitemap_type = __( 'compressed', 'all-in-one-seo-pack' );
|
1144 |
}
|
1145 |
if ( $dynamic ) {
|
1146 |
+
$sitemap_type = __( 'dynamic', 'all-in-one-seo-pack ' );
|
|
|
|
|
1147 |
}
|
1148 |
+
$this->debug_message( sprintf( ' %01.2f MB memory used generating the %s sitemap in %01.3f seconds, %01.2f MB total memory used.', $sitemap_memory_usage, $sitemap_type, $time, $end_memory_usage ) );
|
1149 |
}
|
1150 |
|
1151 |
+
/**
|
1152 |
+
* Handle outputting of dynamic sitemaps, logging.
|
1153 |
+
*
|
1154 |
+
* @param $query
|
1155 |
+
*/
|
1156 |
function sitemap_output_hook( $query ) {
|
1157 |
$page = 0;
|
1158 |
+
if ( $this->options["{$this->prefix}rewrite"] && ! empty( $query->query_vars["{$this->prefix}path"] ) ) {
|
1159 |
+
|
1160 |
+
// Make dynamic sitemap.
|
1161 |
+
|
1162 |
+
if ( ! empty( $query->query_vars["{$this->prefix}page"] ) ) {
|
1163 |
+
$page = $query->query_vars["{$this->prefix}page"] - 1;
|
1164 |
+
}
|
1165 |
+
$this->start_memory_usage = memory_get_peak_usage();
|
1166 |
+
$sitemap_type = $query->query_vars["{$this->prefix}path"];
|
1167 |
+
$gzipped = false;
|
1168 |
+
if ( $this->substr( $sitemap_type, - 3 ) === '.gz' ) {
|
1169 |
+
$gzipped = true;
|
1170 |
+
$sitemap_type = $this->substr( $sitemap_type, 0, - 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
}
|
1172 |
+
$blog_charset = get_option( 'blog_charset' );
|
1173 |
+
if ( $this->options["{$this->prefix}gzipped"] && $gzipped ) {
|
1174 |
+
header( "Content-Type: application/x-gzip; charset=$blog_charset", true );
|
1175 |
+
} else {
|
1176 |
+
$gzipped = false;
|
1177 |
+
header( "Content-Type: text/xml; charset=$blog_charset", true );
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
// Always follow and noindex the sitemap.
|
1181 |
+
header( 'X-Robots-Tag: noindex, follow', true );
|
1182 |
+
|
1183 |
+
if ( $gzipped ) {
|
1184 |
+
ob_start();
|
1185 |
+
}
|
1186 |
+
$this->do_rewrite_sitemap( $sitemap_type, $page );
|
1187 |
+
if ( $gzipped ) {
|
1188 |
+
echo gzencode( ob_get_clean() );
|
1189 |
+
}
|
1190 |
+
$this->log_stats( $sitemap_type, $gzipped );
|
1191 |
+
exit();
|
1192 |
+
|
1193 |
+
|
1194 |
}
|
1195 |
}
|
1196 |
|
1197 |
+
/**
|
1198 |
+
* Make dynamic xsl.
|
1199 |
+
*/
|
1200 |
+
function make_dynamic_xsl() {
|
1201 |
+
// Make dynamic xsl file.
|
1202 |
+
if ( preg_match( '#(/sitemap\.xsl)$#i', $_SERVER['REQUEST_URI'] ) ) {
|
1203 |
+
$blog_charset = get_option( 'blog_charset' );
|
1204 |
+
header( "Content-Type: text/xml; charset=$blog_charset", true );
|
1205 |
+
include_once( AIOSEOP_PLUGIN_DIR . '/inc/sitemap-xsl.php' );
|
1206 |
+
exit();
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Get sitemap data.
|
1212 |
+
*
|
1213 |
+
* @param $sitemap_type
|
1214 |
+
* @param int $page
|
1215 |
+
*
|
1216 |
+
* @return mixed|void
|
1217 |
+
*/
|
1218 |
function get_sitemap_data( $sitemap_type, $page = 0 ) {
|
1219 |
+
$sitemap_data = array();
|
1220 |
if ( $this->options["{$this->prefix}indexes"] ) {
|
1221 |
$posttypes = $this->options["{$this->prefix}posttypes"];
|
1222 |
if ( empty( $posttypes ) ) {
|
1223 |
+
$posttypes = array();
|
1224 |
}
|
1225 |
$taxonomies = $this->options["{$this->prefix}taxonomies"];
|
1226 |
if ( empty( $taxonomies ) ) {
|
1227 |
+
$taxonomies = array();
|
1228 |
}
|
1229 |
+
if ( 'root' === $sitemap_type ) {
|
1230 |
$sitemap_data = array_merge( $this->get_sitemap_index_filenames() );
|
1231 |
+
} elseif ( 'addl' === $sitemap_type ) {
|
1232 |
$sitemap_data = $this->get_addl_pages();
|
1233 |
+
} elseif ( 'archive' === $sitemap_type && $this->option_isset( 'archive' ) ) {
|
1234 |
$sitemap_data = $this->get_archive_prio_data();
|
1235 |
+
} elseif ( 'author' === $sitemap_type && $this->option_isset( 'author' ) ) {
|
1236 |
$sitemap_data = $this->get_author_prio_data();
|
1237 |
} elseif ( in_array( $sitemap_type, $posttypes ) ) {
|
1238 |
$sitemap_data = $this->get_all_post_priority_data( $sitemap_type, 'publish', $page );
|
1243 |
$sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
|
1244 |
}
|
1245 |
}
|
1246 |
+
} elseif ( 'root' === $sitemap_type ) {
|
1247 |
$sitemap_data = $this->get_simple_sitemap();
|
1248 |
}
|
1249 |
|
1250 |
return apply_filters( $this->prefix . 'data', $sitemap_data, $sitemap_type, $page, $this->options );
|
1251 |
}
|
1252 |
|
1253 |
+
/**
|
1254 |
+
* Rewrite sitemap.
|
1255 |
+
*
|
1256 |
+
* Output sitemaps dynamically based on rewrite rules.
|
1257 |
+
*
|
1258 |
+
* @param $sitemap_type
|
1259 |
+
* @param int $page
|
1260 |
+
*/
|
1261 |
function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
|
1262 |
$this->add_post_types();
|
1263 |
+
$comment = 'dynamically';
|
1264 |
echo $this->do_build_sitemap( $sitemap_type, $page, '', $comment );
|
1265 |
}
|
1266 |
|
1267 |
+
/**
|
1268 |
+
* Build a url to the sitemap.
|
1269 |
+
*
|
1270 |
+
* @return string
|
1271 |
+
*/
|
1272 |
function get_sitemap_url() {
|
1273 |
$url = get_home_url() . '/' . $this->options["{$this->prefix}filename"] . '.xml';
|
1274 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
1278 |
return $url;
|
1279 |
}
|
1280 |
|
1281 |
+
/**
|
1282 |
+
* Notify search engines, do logging.
|
1283 |
+
*/
|
1284 |
function do_notify() {
|
1285 |
+
$notify_url = array(
|
1286 |
'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=',
|
1287 |
+
'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap=',
|
1288 |
);
|
1289 |
|
1290 |
$url = $this->get_sitemap_url();
|
1293 |
if ( isset( $this->options[ $this->prefix . $k ] ) && $this->options[ $this->prefix . $k ] ) {
|
1294 |
$response = wp_remote_get( $notify_url[ $k ] . urlencode( $url ) );
|
1295 |
if ( is_array( $response ) && ! empty( $response['response'] ) && ! empty( $response['response']['code'] ) ) {
|
1296 |
+
if ( 200 == $response['response']['code'] ) {
|
1297 |
$this->debug_message( sprintf( __( 'Successfully notified %s about changes to your sitemap at %s.', 'all-in-one-seo-pack' ), $k, $url ) );
|
1298 |
} else {
|
1299 |
$this->debug_message( sprintf( __( 'Failed to notify %s about changes to your sitemap at %s, error code %s.', 'all-in-one-seo-pack' ), $k, $url, $response['response']['code'] ) );
|
1308 |
}
|
1309 |
}
|
1310 |
|
1311 |
+
/**
|
1312 |
+
* Add Sitemap parameter to virtual robots.txt file.
|
1313 |
+
*/
|
1314 |
function do_robots() {
|
1315 |
$url = $this->get_sitemap_url();
|
1316 |
echo "\nSitemap: $url\n";
|
1317 |
}
|
1318 |
|
1319 |
+
/**
|
1320 |
+
* Build static sitemaps.
|
1321 |
+
*
|
1322 |
+
* Build static sitemaps on submit if rewrite rules are not in use, do logging.
|
1323 |
+
*
|
1324 |
+
* @param string $message
|
1325 |
+
*/
|
1326 |
function do_sitemaps( $message = '' ) {
|
1327 |
if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
|
1328 |
$this->paginate = true;
|
1329 |
+
if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) {
|
1330 |
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
1331 |
} else {
|
1332 |
$this->max_posts = 50000;
|
1340 |
$this->do_indexed_sitemaps();
|
1341 |
} else {
|
1342 |
$this->log_start();
|
1343 |
+
$comment = sprintf( "file '%s' statically", $this->options["{$this->prefix}filename"] );
|
1344 |
$sitemap = $this->do_simple_sitemap( $comment );
|
1345 |
$this->write_sitemaps( $this->options["{$this->prefix}filename"], $sitemap );
|
1346 |
$this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false );
|
1356 |
}
|
1357 |
}
|
1358 |
|
1359 |
+
/**
|
1360 |
+
* Add mime type.
|
1361 |
+
*
|
1362 |
+
* @param $mime
|
1363 |
+
*
|
1364 |
+
* @return mixed
|
1365 |
+
*/
|
1366 |
function add_xml_mime_type( $mime ) {
|
1367 |
if ( ! empty( $mime ) ) {
|
1368 |
$mime['xml'] = 'text/xml';
|
1371 |
return $mime;
|
1372 |
}
|
1373 |
|
1374 |
+
/**
|
1375 |
+
* Write multiple sitemaps.
|
1376 |
+
*
|
1377 |
+
* Write sitemaps (compressed or otherwise) to the filesystem.
|
1378 |
+
*
|
1379 |
+
* @param $filename
|
1380 |
+
* @param $contents
|
1381 |
+
*/
|
1382 |
function write_sitemaps( $filename, $contents ) {
|
1383 |
+
$this->write_sitemap( $filename . '.xml', $contents );
|
1384 |
if ( $this->options["{$this->prefix}gzipped"] ) {
|
1385 |
+
$this->write_sitemap( $filename . '.xml.gz', $contents, true );
|
1386 |
}
|
1387 |
}
|
1388 |
|
1389 |
+
/**
|
1390 |
+
* Write single sitemap.
|
1391 |
+
*
|
1392 |
+
* Write a single sitemap to the filesystem, handle compression.
|
1393 |
+
*
|
1394 |
+
* @param $filename
|
1395 |
+
* @param $contents
|
1396 |
+
* @param bool $gzip
|
1397 |
+
*
|
1398 |
+
* @return bool
|
1399 |
+
*/
|
1400 |
function write_sitemap( $filename, $contents, $gzip = false ) {
|
1401 |
if ( $gzip ) {
|
1402 |
$contents = gzencode( $contents );
|
1403 |
}
|
1404 |
+
add_filter( 'upload_mimes', array( $this, 'add_xml_mime_type' ) );
|
1405 |
+
$filename = $this->get_home_path() . sanitize_file_name( $filename );
|
1406 |
+
remove_filter( 'upload_mimes', array( $this, 'add_xml_mime_type' ) );
|
1407 |
|
1408 |
return $this->save_file( $filename, $contents );
|
1409 |
}
|
1410 |
|
1411 |
+
/**
|
1412 |
+
* Gets the default values.
|
1413 |
+
*
|
1414 |
+
* Helper function for handling default values.
|
1415 |
+
*
|
1416 |
+
* @param $defaults
|
1417 |
+
* @param $prefix
|
1418 |
+
* @param $cache
|
1419 |
+
* @param $item
|
1420 |
+
* @param bool $nodefaults
|
1421 |
+
* @param string $type
|
1422 |
+
*
|
1423 |
+
* @return bool
|
1424 |
+
*/
|
1425 |
function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
|
1426 |
if ( ! empty( $cache[ $item . $type ] ) ) {
|
1427 |
return $cache[ $item . $type ];
|
1428 |
}
|
1429 |
if ( ! empty( $defaults[ $item ] ) ) {
|
1430 |
$field = $this->prefix . $prefix . $item;
|
1431 |
+
if ( $this->option_isset( $prefix . $item ) && 'no' != $this->options[ $field ] ) {
|
1432 |
+
if ( ( 'sel' === $this->options[ $field ] ) && ! empty( $type ) && isset( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) ) {
|
1433 |
+
if ( 'no' == $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) {
|
1434 |
return false;
|
1435 |
}
|
1436 |
+
if ( 'sel' === $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) {
|
1437 |
return false;
|
1438 |
}
|
1439 |
$cache[ $item . $type ] = $this->options[ $this->prefix . $prefix . $item . '_' . $type ];
|
1440 |
} else {
|
1441 |
+
if ( 'no' == $this->options[ $field ] ) {
|
1442 |
return false;
|
1443 |
}
|
1444 |
+
if ( 'sel' === $this->options[ $field ] ) {
|
1445 |
return false;
|
1446 |
}
|
1447 |
$cache[ $item . $type ] = $this->options[ $field ];
|
1459 |
return false;
|
1460 |
}
|
1461 |
|
1462 |
+
/**
|
1463 |
+
* Get priority settings for sitemap entries.
|
1464 |
+
*
|
1465 |
+
* @param $item
|
1466 |
+
* @param bool $nodefaults
|
1467 |
+
* @param string $type
|
1468 |
+
*
|
1469 |
+
* @return bool
|
1470 |
+
*/
|
1471 |
function get_default_priority( $item, $nodefaults = false, $type = '' ) {
|
1472 |
+
$defaults = array(
|
1473 |
'homepage' => '1.0',
|
1474 |
'blog' => '0.9',
|
1475 |
'sitemap' => '0.8',
|
1476 |
'post' => '0.7',
|
1477 |
'archive' => '0.5',
|
1478 |
'author' => '0.3',
|
1479 |
+
'taxonomies' => '0.3',
|
1480 |
);
|
1481 |
+
static $cache = array();
|
1482 |
|
1483 |
return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type );
|
1484 |
}
|
1485 |
|
1486 |
+
/**
|
1487 |
+
* Get frequency settings for sitemap entries.
|
1488 |
+
*
|
1489 |
+
* @param $item
|
1490 |
+
* @param bool $nodefaults
|
1491 |
+
* @param string $type
|
1492 |
+
*
|
1493 |
+
* @return bool
|
1494 |
+
*/
|
1495 |
function get_default_frequency( $item, $nodefaults = false, $type = '' ) {
|
1496 |
+
$defaults = array(
|
1497 |
'homepage' => 'always',
|
1498 |
'blog' => 'daily',
|
1499 |
'sitemap' => 'hourly',
|
1500 |
'post' => 'weekly',
|
1501 |
'archive' => 'monthly',
|
1502 |
'author' => 'weekly',
|
1503 |
+
'taxonomies' => 'monthly',
|
1504 |
);
|
1505 |
+
static $cache = array();
|
1506 |
|
1507 |
return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type );
|
1508 |
}
|
1509 |
|
1510 |
+
/**
|
1511 |
+
* Build an index of sitemaps used.
|
1512 |
+
*
|
1513 |
+
* @return array
|
1514 |
+
*/
|
1515 |
function get_sitemap_index_filenames() {
|
1516 |
+
$files = array();
|
1517 |
$options = $this->options;
|
1518 |
$prefix = $options["{$this->prefix}filename"];
|
1519 |
$suffix = '.xml';
|
1521 |
$suffix .= '.gz';
|
1522 |
}
|
1523 |
if ( empty( $options["{$this->prefix}posttypes"] ) ) {
|
1524 |
+
$options["{$this->prefix}posttypes"] = array();
|
1525 |
}
|
1526 |
if ( empty( $options["{$this->prefix}taxonomies"] ) ) {
|
1527 |
+
$options["{$this->prefix}taxonomies"] = array();
|
1528 |
}
|
1529 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) );
|
1530 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) );
|
1531 |
$url_base = trailingslashit( get_home_url() );
|
1532 |
+
$files[] = array( 'loc' => $url_base . $prefix . '_addl' . $suffix );
|
1533 |
if ( ! empty( $options["{$this->prefix}posttypes"] ) ) {
|
1534 |
$prio = $this->get_default_priority( 'post' );
|
1535 |
$freq = $this->get_default_frequency( 'post' );
|
1536 |
+
$post_counts = $this->get_all_post_counts( array(
|
1537 |
'post_type' => $options["{$this->prefix}posttypes"],
|
1538 |
+
'post_status' => 'publish',
|
1539 |
) );
|
1540 |
if ( ! is_array( $post_counts ) && is_array( $options["{$this->prefix}posttypes"] ) && count( $options["{$this->prefix}posttypes"] ) == 1 ) {
|
1541 |
+
$post_counts = array( $options["{$this->prefix}posttypes"][0] => $post_counts );
|
1542 |
}
|
1543 |
foreach ( $options["{$this->prefix}posttypes"] as $sm ) {
|
1544 |
+
if ( 0 == $post_counts[ $sm ] ) {
|
1545 |
continue;
|
1546 |
}
|
1547 |
if ( $this->paginate ) {
|
1548 |
if ( $post_counts[ $sm ] > $this->max_posts ) {
|
1549 |
$count = 1;
|
1550 |
for ( $post_count = 0; $post_count < $post_counts[ $sm ]; $post_count += $this->max_posts ) {
|
1551 |
+
$files[] = array(
|
1552 |
'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix,
|
1553 |
'priority' => $prio,
|
1554 |
+
'changefreq' => $freq,
|
1555 |
);
|
1556 |
}
|
1557 |
} else {
|
1558 |
+
$files[] = array(
|
1559 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1560 |
'priority' => $prio,
|
1561 |
+
'changefreq' => $freq,
|
1562 |
);
|
1563 |
}
|
1564 |
} else {
|
1565 |
+
$files[] = array(
|
1566 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1567 |
'priority' => $prio,
|
1568 |
+
'changefreq' => $freq,
|
1569 |
);
|
1570 |
}
|
1571 |
}
|
1572 |
}
|
1573 |
if ( $this->option_isset( 'archive' ) ) {
|
1574 |
+
$files[] = array(
|
1575 |
'loc' => $url_base . $prefix . '_archive' . $suffix,
|
1576 |
'priority' => $this->get_default_priority( 'archive' ),
|
1577 |
+
'changefreq' => $this->get_default_frequency( 'archive' ),
|
1578 |
);
|
1579 |
}
|
1580 |
if ( $this->option_isset( 'author' ) ) {
|
1581 |
+
$files[] = array(
|
1582 |
'loc' => $url_base . $prefix . '_author' . $suffix,
|
1583 |
'priority' => $this->get_default_priority( 'author' ),
|
1584 |
+
'changefreq' => $this->get_default_frequency( 'author' ),
|
1585 |
);
|
1586 |
}
|
1587 |
|
1593 |
if ( $term_count > $this->max_posts ) {
|
1594 |
$count = 1;
|
1595 |
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
|
1596 |
+
$files[] = array(
|
1597 |
'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix,
|
1598 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1599 |
+
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
|
1600 |
);
|
1601 |
}
|
1602 |
} else {
|
1603 |
+
$files[] = array(
|
1604 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1605 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1606 |
+
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
|
1607 |
);
|
1608 |
}
|
1609 |
} else {
|
1610 |
+
$files[] = array(
|
1611 |
'loc' => $url_base . $prefix . '_' . $sm . $suffix,
|
1612 |
'priority' => $this->get_default_priority( 'taxonomies' ),
|
1613 |
+
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
|
1614 |
);
|
1615 |
}
|
1616 |
}
|
1617 |
}
|
1618 |
}
|
1619 |
foreach ( $this->get_child_sitemap_urls() as $csm ) {
|
1620 |
+
$files[] = array(
|
1621 |
'loc' => $csm,
|
1622 |
'priority' => $this->get_default_priority( 'sitemap' ),
|
1623 |
+
'changefreq' => $this->get_default_frequency( 'sitemap' ),
|
1624 |
);
|
1625 |
}
|
1626 |
|
1627 |
return $files;
|
1628 |
}
|
1629 |
|
1630 |
+
/**
|
1631 |
+
* Build the sitemap.
|
1632 |
+
*
|
1633 |
+
* @param $sitemap_type
|
1634 |
+
* @param int $page
|
1635 |
+
* @param string $filename
|
1636 |
+
* @param string $comment
|
1637 |
+
*
|
1638 |
+
* @return string
|
1639 |
+
*/
|
1640 |
function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
|
1641 |
if ( empty( $filename ) ) {
|
1642 |
+
if ( 'root' === $sitemap_type ) {
|
1643 |
$filename = $this->options["{$this->prefix}filename"];
|
1644 |
} else {
|
1645 |
$filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
|
1646 |
}
|
1647 |
}
|
1648 |
if ( empty( $comment ) ) {
|
1649 |
+
$comment = "file '%s' statically";
|
1650 |
}
|
1651 |
$sitemap_data = $this->get_sitemap_data( $sitemap_type, $page );
|
1652 |
+
if ( ( 'root' === $sitemap_type ) && ! empty( $this->options["{$this->prefix}indexes"] ) ) {
|
1653 |
return $this->build_sitemap_index( $sitemap_data, sprintf( $comment, $filename ) );
|
1654 |
} else {
|
1655 |
return $this->build_sitemap( $sitemap_data, sprintf( $comment, $filename ) );
|
1656 |
}
|
1657 |
}
|
1658 |
|
1659 |
+
/**
|
1660 |
+
* Write the sitemap.
|
1661 |
+
*
|
1662 |
+
* @param $sitemap_type
|
1663 |
+
* @param int $page
|
1664 |
+
* @param string $filename
|
1665 |
+
* @param string $comment
|
1666 |
+
*/
|
1667 |
function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
|
1668 |
if ( empty( $filename ) ) {
|
1669 |
+
if ( 'root' === $sitemap_type ) {
|
1670 |
$filename = $this->options["{$this->prefix}filename"];
|
1671 |
} else {
|
1672 |
$filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
|
1673 |
}
|
1674 |
}
|
1675 |
if ( empty( $comment ) ) {
|
1676 |
+
$comment = "file '%s' statically";
|
1677 |
}
|
1678 |
$this->write_sitemaps( $filename, $this->do_build_sitemap( $sitemap_type, $page, $filename, $comment ) );
|
1679 |
}
|
1680 |
|
1681 |
+
/**
|
1682 |
+
* Build all the indexes.
|
1683 |
+
*/
|
1684 |
function do_indexed_sitemaps() {
|
1685 |
$this->start_memory_usage = memory_get_peak_usage();
|
1686 |
$options = $this->options;
|
1696 |
}
|
1697 |
|
1698 |
if ( ( ! isset( $options["{$this->prefix}posttypes"] ) ) || ( ! is_array( $options["{$this->prefix}posttypes"] ) ) ) {
|
1699 |
+
$options["{$this->prefix}posttypes"] = array();
|
1700 |
}
|
1701 |
if ( ( ! isset( $options["{$this->prefix}taxonomies"] ) ) || ( ! is_array( $options["{$this->prefix}taxonomies"] ) ) ) {
|
1702 |
+
$options["{$this->prefix}taxonomies"] = array();
|
1703 |
}
|
1704 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) );
|
1705 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) );
|
1706 |
|
1707 |
if ( ! empty( $options["{$this->prefix}posttypes"] ) ) {
|
1708 |
+
$post_counts = $this->get_all_post_counts( array(
|
1709 |
'post_type' => $options["{$this->prefix}posttypes"],
|
1710 |
+
'post_status' => 'publish',
|
1711 |
) );
|
1712 |
foreach ( $options["{$this->prefix}posttypes"] as $posttype ) {
|
1713 |
+
if ( 0 === $post_counts[ $posttype ] ) {
|
1714 |
continue;
|
1715 |
}
|
1716 |
if ( $this->paginate && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
|
1748 |
$this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false );
|
1749 |
}
|
1750 |
|
1751 |
+
/**
|
1752 |
+
* Get simple sitemap.
|
1753 |
+
*
|
1754 |
+
* @return array
|
1755 |
+
*/
|
1756 |
function get_simple_sitemap() {
|
1757 |
+
$home = array(
|
1758 |
'loc' => get_home_url(),
|
1759 |
'priority' => $this->get_default_priority( 'homepage' ),
|
1760 |
+
'changefreq' => $this->get_default_frequency( 'homepage' ),
|
1761 |
);
|
1762 |
$posts = get_option( 'page_for_posts' );
|
1763 |
$this->paginate = false;
|
1766 |
if ( $posts == $home['loc'] ) {
|
1767 |
$posts = null;
|
1768 |
} else {
|
1769 |
+
$posts = array(
|
1770 |
'loc' => $posts,
|
1771 |
'priority' => $this->get_default_priority( 'blog' ),
|
1772 |
+
'changefreq' => $this->get_default_frequency( 'blog' ),
|
1773 |
);
|
1774 |
}
|
1775 |
}
|
1776 |
$child = $this->get_child_sitemap_urls();
|
1777 |
$options = $this->options;
|
1778 |
if ( is_array( $options["{$this->prefix}posttypes"] ) ) {
|
1779 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], array( 'all' ) );
|
1780 |
}
|
1781 |
if ( is_array( $options["{$this->prefix}taxonomies"] ) ) {
|
1782 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], array( 'all' ) );
|
1783 |
}
|
1784 |
$prio = $this->get_all_post_priority_data( $options["{$this->prefix}posttypes"] );
|
1785 |
if ( $this->option_isset( 'archive' ) ) {
|
1789 |
$prio = array_merge( $prio, $this->get_author_prio_data() );
|
1790 |
}
|
1791 |
foreach ( $prio as $k => $p ) {
|
1792 |
+
if ( untrailingslashit( $p['loc'] ) === untrailingslashit( $home['loc'] ) ) {
|
1793 |
$prio[ $k ]['priority'] = '1.0';
|
1794 |
$home = null;
|
1795 |
break;
|
1796 |
}
|
1797 |
}
|
1798 |
+
if ( ( null != $posts ) && isset( $posts['loc'] ) ) {
|
1799 |
foreach ( $prio as $k => $p ) {
|
1800 |
+
if ( $p['loc'] === $posts['loc'] ) {
|
1801 |
$prio[ $k ]['priority'] = $this->get_default_priority( 'blog' );
|
1802 |
$prio[ $k ]['changefreq'] = $this->get_default_frequency( 'blog' );
|
1803 |
$posts = null;
|
1817 |
$prio = array_merge( $child, $prio, $prio2, $prio3 );
|
1818 |
if ( is_array( $this->extra_sitemaps ) ) {
|
1819 |
foreach ( $this->extra_sitemaps as $sitemap_type ) {
|
1820 |
+
$sitemap_data = array();
|
1821 |
$sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
|
1822 |
$prio = array_merge( $prio, $sitemap_data );
|
1823 |
}
|
1826 |
return $prio;
|
1827 |
}
|
1828 |
|
1829 |
+
/**
|
1830 |
+
* Build a single, stand-alone sitemap without indexes.
|
1831 |
+
*
|
1832 |
+
* @param string $comment
|
1833 |
+
*
|
1834 |
+
* @return string
|
1835 |
+
*/
|
1836 |
function do_simple_sitemap( $comment = '' ) {
|
1837 |
$sitemap_data = $this->get_simple_sitemap();
|
1838 |
$sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'root', 0, $this->options );
|
1840 |
return $this->build_sitemap( $sitemap_data, $comment );
|
1841 |
}
|
1842 |
|
1843 |
+
/**
|
1844 |
+
* Gets the sitemap URL.
|
1845 |
+
*
|
1846 |
+
* Has a filter for using something other than the dynamically generated one.
|
1847 |
+
* Using the filter you need the full path to the custom xsl file.
|
1848 |
+
*
|
1849 |
+
* @see https://semperplugins.com/documentation/aioseop_sitemap_xsl_url/
|
1850 |
+
*
|
1851 |
+
* @since 2.3.6
|
1852 |
+
*/
|
1853 |
+
function get_sitemap_xsl() {
|
1854 |
+
|
1855 |
+
return esc_url( apply_filters( 'aioseop_sitemap_xsl_url', home_url( '/sitemap.xsl' ) ) );
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
/**
|
1859 |
+
* Output the XML for a sitemap.
|
1860 |
+
*
|
1861 |
+
* @param $urls
|
1862 |
+
* @param string $comment
|
1863 |
+
*
|
1864 |
+
* @return null
|
1865 |
+
*/
|
1866 |
function output_sitemap( $urls, $comment = '' ) {
|
1867 |
$max_items = 50000;
|
1868 |
if ( ! is_array( $urls ) ) {
|
1869 |
return null;
|
1870 |
}
|
1871 |
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
|
1872 |
+
echo '<!-- ' . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date( 'D, d M Y H:i:s e' ) ) . " -->\r\n";
|
1873 |
$plugin_path = $this->plugin_path['url'];
|
1874 |
$plugin_url = parse_url( $plugin_path );
|
1875 |
$current_host = $_SERVER['HTTP_HOST'];
|
1877 |
$current_host = $_SERVER['SERVER_NAME'];
|
1878 |
}
|
1879 |
|
1880 |
+
if ( ! empty( $current_host ) && ( $current_host !== $plugin_url['host'] ) ) {
|
1881 |
$plugin_url['host'] = $current_host;
|
1882 |
}
|
1883 |
|
1884 |
+
// Code unset( $plugin_url['scheme'] );.
|
1885 |
$plugin_path = $this->unparse_url( $plugin_url );
|
1886 |
|
1887 |
+
// Using the filter you need the full path to the custom xsl file.
|
1888 |
+
$xsl_url = $this->get_sitemap_xsl();
|
1889 |
+
|
1890 |
+
$xml_header = '<?xml-stylesheet type="text/xsl" href="' . $xsl_url . '"?>' . "\r\n"
|
1891 |
. '<urlset ';
|
1892 |
+
$namespaces = apply_filters( $this->prefix . 'xml_namespace', array( 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' ) );
|
1893 |
if ( ! empty( $namespaces ) ) {
|
1894 |
+
$ns = array();
|
1895 |
foreach ( $namespaces as $k => $v ) {
|
1896 |
+
$ns[] = esc_attr( $k ) . '=' . '"' . esc_url( $v, array( 'http', 'https' ) ) . '"';
|
1897 |
}
|
1898 |
$xml_header .= join( "\r\n\t", $ns );
|
1899 |
}
|
1905 |
if ( is_array( $url ) ) {
|
1906 |
foreach ( $url as $k => $v ) {
|
1907 |
if ( ! empty( $v ) ) {
|
1908 |
+
if ( 'loc' === $k ) {
|
1909 |
$v = esc_url( $v );
|
1910 |
}
|
1911 |
if ( is_array( $v ) ) {
|
1949 |
echo '</urlset>';
|
1950 |
}
|
1951 |
|
1952 |
+
/**
|
1953 |
+
* Output the XML for a sitemap index.
|
1954 |
+
*
|
1955 |
+
* @param $urls
|
1956 |
+
* @param string $comment
|
1957 |
+
*
|
1958 |
+
* @return null
|
1959 |
+
*/
|
1960 |
function output_sitemap_index( $urls, $comment = '' ) {
|
1961 |
$max_items = 50000;
|
1962 |
if ( ! is_array( $urls ) ) {
|
1963 |
return null;
|
1964 |
}
|
1965 |
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
|
1966 |
+
echo '<!-- ' . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date( 'D, d M Y H:i:s e' ) ) . " -->\r\n";
|
1967 |
+
$xsl_url = $this->get_sitemap_xsl();
|
1968 |
+
echo '<?xml-stylesheet type="text/xsl" href="' . $xsl_url . '"?>' . "\r\n";
|
1969 |
echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\r\n";
|
1970 |
$count = 0;
|
1971 |
foreach ( $urls as $url ) {
|
1972 |
echo "\t<sitemap>\r\n";
|
1973 |
if ( is_array( $url ) ) {
|
1974 |
foreach ( $url as $k => $v ) {
|
1975 |
+
if ( 'loc' === $k ) {
|
1976 |
echo "\t\t<$k>" . esc_url( $v ) . "</$k>\r\n";
|
1977 |
+
} elseif ( 'lastmod' === $k ) {
|
1978 |
echo "\t\t<$k>$v</$k>\r\n";
|
1979 |
}
|
1980 |
}
|
1990 |
echo '</sitemapindex>';
|
1991 |
}
|
1992 |
|
1993 |
+
/**
|
1994 |
+
* Return an XML sitemap index as a string.
|
1995 |
+
*
|
1996 |
+
* @param $urls
|
1997 |
+
* @param string $comment
|
1998 |
+
*
|
1999 |
+
* @return string
|
2000 |
+
*/
|
2001 |
function build_sitemap_index( $urls, $comment = '' ) {
|
2002 |
ob_start();
|
2003 |
$this->output_sitemap_index( $urls, $comment );
|
2005 |
return ob_get_clean();
|
2006 |
}
|
2007 |
|
2008 |
+
/**
|
2009 |
+
* Return an XML sitemap as a string.
|
2010 |
+
*
|
2011 |
+
* @param $urls
|
2012 |
+
* @param string $comment
|
2013 |
+
*
|
2014 |
+
* @return string
|
2015 |
+
*/
|
2016 |
function build_sitemap( $urls, $comment = '' ) {
|
2017 |
ob_start();
|
2018 |
$this->output_sitemap( $urls, $comment );
|
2020 |
return ob_get_clean();
|
2021 |
}
|
2022 |
|
2023 |
+
/**
|
2024 |
+
* Return sitemap data for an array of terms.
|
2025 |
+
*
|
2026 |
+
* @param $terms
|
2027 |
+
*
|
2028 |
+
* @return array
|
2029 |
+
*/
|
2030 |
function get_term_priority_data( $terms ) {
|
2031 |
+
$prio = array();
|
2032 |
if ( is_array( $terms ) ) {
|
2033 |
$def_prio = $this->get_default_priority( 'taxonomies' );
|
2034 |
$def_freq = $this->get_default_frequency( 'taxonomies' );
|
2035 |
foreach ( $terms as $term ) {
|
2036 |
+
$pr_info = array();
|
2037 |
$pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy );
|
2038 |
+
if ( ( 'sel' === $this->options[ $this->prefix . 'prio_taxonomies' ] ) && isset( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) && ( 'no' != $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) ) {
|
2039 |
$pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ];
|
2040 |
} else {
|
2041 |
$pr_info['priority'] = $def_prio;
|
2042 |
}
|
2043 |
+
if ( ( 'sel' === $this->options[ $this->prefix . 'freq_taxonomies' ] ) && isset( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) && ( 'no' != $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) ) {
|
2044 |
$pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ];
|
2045 |
} else {
|
2046 |
$pr_info['changefreq'] = $def_freq;
|
2052 |
return $prio;
|
2053 |
}
|
2054 |
|
2055 |
+
/**
|
2056 |
+
* Return a list of permalinks for an array of terms.
|
2057 |
+
*
|
2058 |
+
* @param $terms
|
2059 |
+
*
|
2060 |
+
* @return array
|
2061 |
+
*/
|
2062 |
function get_term_permalinks( $terms ) {
|
2063 |
+
$links = array();
|
2064 |
if ( is_array( $terms ) ) {
|
2065 |
foreach ( $terms as $term ) {
|
2066 |
$url = $this->get_term_link( $term );
|
2071 |
return $links;
|
2072 |
}
|
2073 |
|
2074 |
+
/**
|
2075 |
+
* Return permalinks for archives.
|
2076 |
+
*
|
2077 |
+
* @param $posts
|
2078 |
+
*
|
2079 |
+
* @return array
|
2080 |
+
*/
|
2081 |
function get_archive_permalinks( $posts ) {
|
2082 |
+
$links = array();
|
2083 |
+
$archives = array();
|
2084 |
if ( is_array( $posts ) ) {
|
2085 |
foreach ( $posts as $post ) {
|
2086 |
$date = mysql2date( 'U', $post->post_date );
|
2087 |
$year = date( 'Y', $date );
|
2088 |
$month = date( 'm', $date );
|
2089 |
+
$archives[ $year . '-' . $month ] = array( $year, $month );
|
2090 |
}
|
2091 |
}
|
2092 |
$archives = array_keys( $archives );
|
2097 |
return $links;
|
2098 |
}
|
2099 |
|
2100 |
+
/**
|
2101 |
+
* Return permalinks for authors.
|
2102 |
+
*
|
2103 |
+
* @param $posts
|
2104 |
+
*
|
2105 |
+
* @return array
|
2106 |
+
*/
|
2107 |
function get_author_permalinks( $posts ) {
|
2108 |
+
$links = array();
|
2109 |
+
$authors = array();
|
2110 |
if ( is_array( $posts ) ) {
|
2111 |
foreach ( $posts as $post ) {
|
2112 |
$authors[ $post->author_id ] = 1;
|
2120 |
return $links;
|
2121 |
}
|
2122 |
|
2123 |
+
/**
|
2124 |
+
* Return permalinks for posts.
|
2125 |
+
*
|
2126 |
+
* @param $posts
|
2127 |
+
*
|
2128 |
+
* @return array
|
2129 |
+
*/
|
2130 |
function get_post_permalinks( $posts ) {
|
2131 |
+
$links = array();
|
2132 |
if ( is_array( $posts ) ) {
|
2133 |
foreach ( $posts as $post ) {
|
2134 |
+
$post->filter = 'sample';
|
2135 |
$url = $this->get_permalink( $post );
|
2136 |
$links[] = $url;
|
2137 |
}
|
2140 |
return $links;
|
2141 |
}
|
2142 |
|
2143 |
+
/**
|
2144 |
+
* Convert back from parse_url.
|
2145 |
+
*
|
2146 |
+
* Props to thomas at gielfeldt dot com.
|
2147 |
+
*
|
2148 |
+
* @link http://www.php.net/manual/en/function.parse-url.php#106731
|
2149 |
+
*
|
2150 |
+
* @param $parsed_url
|
2151 |
+
*
|
2152 |
+
* @return string
|
2153 |
+
*/
|
2154 |
function unparse_url( $parsed_url ) {
|
2155 |
$scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : '';
|
2156 |
$host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
|
2168 |
return "$scheme$user$pass$host$port$path$query$fragment";
|
2169 |
}
|
2170 |
|
2171 |
+
/**
|
2172 |
+
* Gets additional pages.
|
2173 |
+
*
|
2174 |
+
* Return data for user entered additional pages.
|
2175 |
+
*
|
2176 |
+
* @return array|mixed|void
|
2177 |
+
*/
|
2178 |
function get_addl_pages_only() {
|
2179 |
+
$pages = array();
|
2180 |
if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
|
2181 |
$siteurl = parse_url( get_home_url() );
|
2182 |
foreach ( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) {
|
2187 |
if ( empty( $url['host'] ) ) {
|
2188 |
$url['host'] = $siteurl['host'];
|
2189 |
}
|
2190 |
+
if ( ! empty( $url['path'] ) && substr( $url['path'], 0, 1 ) !== '/' ) {
|
2191 |
+
$url['path'] = '/' . $url['path'];
|
2192 |
+
}
|
2193 |
$freq = $prio = $mod = '';
|
2194 |
if ( ! empty( $v['mod'] ) ) {
|
2195 |
$mod = $v['mod'];
|
2200 |
if ( ! empty( $v['prio'] ) ) {
|
2201 |
$prio = $v['prio'];
|
2202 |
}
|
2203 |
+
if ( 'no' == $freq ) {
|
2204 |
$freq = '';
|
2205 |
}
|
2206 |
+
if ( 'no' == $prio ) {
|
2207 |
$prio = '';
|
2208 |
}
|
2209 |
$mod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $mod ) );
|
2210 |
+
$pages[] = array(
|
2211 |
'loc' => $this->unparse_url( $url ),
|
2212 |
'lastmod' => $mod,
|
2213 |
'changefreq' => $freq,
|
2214 |
+
'priority' => $prio,
|
2215 |
);
|
2216 |
}
|
2217 |
}
|
2220 |
return $pages;
|
2221 |
}
|
2222 |
|
2223 |
+
/**
|
2224 |
+
* Return data for user entered additional pages and extra pages.
|
2225 |
+
*
|
2226 |
+
* @return array|mixed|void
|
2227 |
+
*/
|
2228 |
function get_addl_pages() {
|
2229 |
+
$home = array();
|
2230 |
+
$home = array(
|
2231 |
'loc' => get_home_url(),
|
2232 |
'priority' => $this->get_default_priority( 'homepage' ),
|
2233 |
+
'changefreq' => $this->get_default_frequency( 'homepage' ),
|
2234 |
);
|
2235 |
$posts = get_option( 'page_for_posts' );
|
2236 |
if ( $posts ) {
|
2237 |
$posts = $this->get_permalink( $posts );
|
2238 |
if ( $posts == $home['loc'] ) {
|
2239 |
+
$posts = array();
|
2240 |
} else {
|
2241 |
+
$posts = array(
|
2242 |
'loc' => $posts,
|
2243 |
'priority' => $this->get_default_priority( 'blog' ),
|
2244 |
+
'changefreq' => $this->get_default_frequency( 'blog' ),
|
2245 |
);
|
2246 |
}
|
2247 |
} else {
|
2248 |
+
$posts = array();
|
2249 |
}
|
2250 |
$pages = $this->get_addl_pages_only();
|
2251 |
if ( ! empty( $home ) ) {
|
2259 |
return $pages;
|
2260 |
}
|
2261 |
|
2262 |
+
/**
|
2263 |
+
* Return links for user entered additional pages.
|
2264 |
+
*
|
2265 |
+
* @return array
|
2266 |
+
*/
|
2267 |
function get_addl_page_links() {
|
2268 |
if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
|
2269 |
return array_keys( $this->options[ $this->prefix . 'addl_pages' ] );
|
2270 |
}
|
2271 |
|
2272 |
+
return array();
|
2273 |
}
|
2274 |
|
2275 |
+
/**
|
2276 |
+
* Scores posts based on date and relative comment count, if any.
|
2277 |
+
*
|
2278 |
+
* @param $date
|
2279 |
+
* @param int $stats
|
2280 |
+
*
|
2281 |
+
* @return array
|
2282 |
+
*/
|
2283 |
function get_prio_calc( $date, $stats = 0 ) {
|
2284 |
static $cur_time = null;
|
2285 |
+
if ( null === $cur_time ) {
|
2286 |
$cur_time = time();
|
2287 |
}
|
2288 |
$time = $cur_time - mysql2date( 'U', $date );
|
2289 |
+
if ( ! empty( $stats ) && isset( $stats['max'] ) && $stats['max'] ) {
|
2290 |
$minadj = $time >> 3;
|
2291 |
$maxadj = $time >> 1;
|
2292 |
$avg = $stats['count'] / $stats['total'];
|
2306 |
$time -= $calc;
|
2307 |
}
|
2308 |
$days = $time / ( 60 * 60 * 24 );
|
2309 |
+
$prio_table = array(
|
2310 |
'daily' => 7,
|
2311 |
'weekly' => 30,
|
2312 |
'monthly' => 210,
|
2313 |
+
'yearly' => null,
|
2314 |
);
|
2315 |
$interval = 1.0;
|
2316 |
$prev_days = 0;
|
2317 |
foreach ( $prio_table as $change => $max_days ) {
|
2318 |
$interval -= 0.3;
|
2319 |
+
if ( null === $max_days ) {
|
2320 |
$changefreq = $change;
|
2321 |
$prio = 0.1;
|
2322 |
break;
|
2331 |
$prev_days = $max_days;
|
2332 |
}
|
2333 |
|
2334 |
+
return array( 'lastmod' => $date, 'changefreq' => $changefreq, 'priority' => $prio );
|
2335 |
}
|
2336 |
|
2337 |
+
/**
|
2338 |
+
* Generate sitemap priority data for archives from an array of posts.
|
2339 |
+
*
|
2340 |
+
* @param $posts
|
2341 |
+
*
|
2342 |
+
* @return array
|
2343 |
+
*/
|
2344 |
function get_archive_prio_from_posts( $posts ) {
|
2345 |
+
$archives = array();
|
2346 |
if ( is_array( $posts ) ) {
|
2347 |
foreach ( $posts as $p ) {
|
2348 |
+
if ( 'post' !== $p->post_type ) {
|
2349 |
continue;
|
2350 |
}
|
2351 |
$date = date( 'Y-m', mysql2date( 'U', $p->post_date ) );
|
2359 |
}
|
2360 |
}
|
2361 |
if ( ! empty( $archives ) ) {
|
2362 |
+
return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), array(
|
2363 |
$this,
|
2364 |
+
'get_archive_link_from_post',
|
2365 |
) );
|
2366 |
}
|
2367 |
|
2368 |
return $archives;
|
2369 |
}
|
2370 |
|
2371 |
+
/**
|
2372 |
+
* Return an archive link from a post.
|
2373 |
+
*
|
2374 |
+
* @param $post
|
2375 |
+
*
|
2376 |
+
* @return bool|string
|
2377 |
+
*/
|
2378 |
function get_archive_link_from_post( $post ) {
|
2379 |
+
if ( 'post' !== $post->post_type ) {
|
2380 |
return false;
|
2381 |
}
|
2382 |
$date = mysql2date( 'U', $post->post_date );
|
2384 |
return get_month_link( date( 'Y', $date ), date( 'm', $date ) );
|
2385 |
}
|
2386 |
|
2387 |
+
/**
|
2388 |
+
* Generate sitemap priority data for authors from an array of posts.
|
2389 |
+
*
|
2390 |
+
* @param $posts
|
2391 |
+
*
|
2392 |
+
* @return array
|
2393 |
+
*/
|
2394 |
function get_author_prio_from_posts( $posts ) {
|
2395 |
+
$authors = array();
|
2396 |
if ( is_array( $posts ) ) {
|
2397 |
foreach ( $posts as $p ) {
|
2398 |
+
if ( 'post' !== $p->post_type ) {
|
2399 |
continue;
|
2400 |
}
|
2401 |
if ( empty( $authors[ $p->post_author ] ) ) {
|
2408 |
}
|
2409 |
}
|
2410 |
|
2411 |
+
return $this->get_prio_from_posts( $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ), array(
|
2412 |
$this,
|
2413 |
+
'get_author_link_from_post',
|
2414 |
) );
|
2415 |
}
|
2416 |
|
2417 |
+
/**
|
2418 |
+
* Return an author link from a post.
|
2419 |
+
*
|
2420 |
+
* @param $post
|
2421 |
+
*
|
2422 |
+
* @return string
|
2423 |
+
*/
|
2424 |
function get_author_link_from_post( $post ) {
|
2425 |
return get_author_posts_url( $post->post_author );
|
2426 |
}
|
2427 |
|
2428 |
+
/**
|
2429 |
+
* Return comment statistics on an array of posts.
|
2430 |
+
*
|
2431 |
+
* @param $posts
|
2432 |
+
*
|
2433 |
+
* @return array|int
|
2434 |
+
*/
|
2435 |
function get_comment_count_stats( $posts ) {
|
2436 |
$count = 0;
|
2437 |
$total = 0.0;
|
2443 |
$cnt = $post->comment_count;
|
2444 |
$count ++;
|
2445 |
$total += $cnt;
|
2446 |
+
if ( null === $min ) {
|
2447 |
$min = $cnt;
|
2448 |
}
|
2449 |
if ( $max < $cnt ) {
|
2456 |
}
|
2457 |
}
|
2458 |
if ( $count ) {
|
2459 |
+
return array( 'max' => $max, 'min' => $min, 'total' => $total, 'count' => $cnt );
|
2460 |
} else {
|
2461 |
return 0;
|
2462 |
}
|
2463 |
}
|
2464 |
|
2465 |
+
/**
|
2466 |
+
* Generate sitemap priority data from an array of posts.
|
2467 |
+
*
|
2468 |
+
* @param $posts
|
2469 |
+
* @param bool $prio_override
|
2470 |
+
* @param bool $freq_override
|
2471 |
+
* @param string $linkfunc
|
2472 |
+
*
|
2473 |
+
* @return array
|
2474 |
+
*/
|
2475 |
function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
|
2476 |
+
$prio = array();
|
2477 |
+
$args = array(
|
2478 |
'prio_override' => $prio_override,
|
2479 |
'freq_override' => $freq_override,
|
2480 |
+
'linkfunc' => $linkfunc,
|
2481 |
);
|
2482 |
+
if ( $prio_override && $freq_override ) {
|
2483 |
$stats = 0;
|
2484 |
} else {
|
2485 |
$stats = $this->get_comment_count_stats( $posts );
|
2487 |
if ( is_array( $posts ) ) {
|
2488 |
foreach ( $posts as $post ) {
|
2489 |
$url = '';
|
2490 |
+
$post->filter = 'sample';
|
2491 |
+
if ( 'get_permalink' === $linkfunc ) {
|
2492 |
$url = $this->get_permalink( $post );
|
2493 |
} else {
|
2494 |
$url = call_user_func( $linkfunc, $post );
|
2502 |
} else {
|
2503 |
$date = 0;
|
2504 |
}
|
2505 |
+
if ( $prio_override && $freq_override ) {
|
2506 |
+
$pr_info = array( 'lastmod' => $date, 'changefreq' => null, 'priority' => null );
|
2507 |
} else {
|
2508 |
if ( empty( $post->comment_count ) ) {
|
2509 |
$stat = 0;
|
2521 |
if ( $freq_override ) {
|
2522 |
$pr_info['changefreq'] = $freq_override;
|
2523 |
}
|
2524 |
+
if ( ( 'sel' === $this->options[ $this->prefix . 'prio_post' ] ) && isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) {
|
2525 |
+
if ( ( 'no' != $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) && ( 'sel' !== $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) {
|
2526 |
$pr_info['priority'] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ];
|
2527 |
}
|
2528 |
}
|
2529 |
+
if ( ( 'sel' === $this->options[ $this->prefix . 'freq_post' ] ) && isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) {
|
2530 |
+
if ( ( 'no' != $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) && ( 'sel' !== $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) {
|
2531 |
$pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ];
|
2532 |
}
|
2533 |
}
|
2534 |
+
$pr_info = array( 'loc' => $url ) + $pr_info; // Prepend loc to the array.
|
2535 |
if ( is_float( $pr_info['priority'] ) ) {
|
2536 |
+
$pr_info['priority'] = sprintf( '%0.1F', $pr_info['priority'] );
|
2537 |
}
|
2538 |
$pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args );
|
2539 |
if ( ! empty( $pr_info ) ) {
|
2545 |
return $prio;
|
2546 |
}
|
2547 |
|
2548 |
+
/**
|
2549 |
+
* Return excluded categories for taxonomy queries.
|
2550 |
+
*
|
2551 |
+
* @param int $page
|
2552 |
+
*
|
2553 |
+
* @return array
|
2554 |
+
*/
|
2555 |
function get_tax_args( $page = 0 ) {
|
2556 |
+
$args = array();
|
2557 |
if ( $this->option_isset( 'excl_categories' ) ) {
|
2558 |
$args['exclude'] = $this->options[ $this->prefix . 'excl_categories' ];
|
2559 |
}
|
2566 |
return $args;
|
2567 |
}
|
2568 |
|
2569 |
+
/**
|
2570 |
+
* Return excluded categories and pages for post queries.
|
2571 |
+
*
|
2572 |
+
* @param $args
|
2573 |
+
*
|
2574 |
+
* @return mixed
|
2575 |
+
*/
|
2576 |
function set_post_args( $args ) {
|
2577 |
if ( $this->option_isset( 'excl_categories' ) ) {
|
2578 |
+
$cats = array();
|
2579 |
foreach ( $this->options[ $this->prefix . 'excl_categories' ] as $c ) {
|
2580 |
$cats[] = - $c;
|
2581 |
}
|
2588 |
return $args;
|
2589 |
}
|
2590 |
|
2591 |
+
/**
|
2592 |
+
* Return sitemap data for archives.
|
2593 |
+
*
|
2594 |
+
* @return array
|
2595 |
+
*/
|
2596 |
function get_archive_prio_data() {
|
2597 |
+
$args = array( 'numberposts' => 50000, 'post_type' => 'post' );
|
2598 |
$args = $this->set_post_args( $args );
|
2599 |
$posts = $this->get_all_post_type_data( $args );
|
2600 |
|
2601 |
return $this->get_archive_prio_from_posts( $posts );
|
2602 |
}
|
2603 |
|
2604 |
+
/**
|
2605 |
+
* Return sitemap data for authors.
|
2606 |
+
*
|
2607 |
+
* @return array
|
2608 |
+
*/
|
2609 |
function get_author_prio_data() {
|
2610 |
+
$args = array( 'numberposts' => 50000, 'post_type' => 'post' );
|
2611 |
$args = $this->set_post_args( $args );
|
2612 |
$posts = $this->get_all_post_type_data( $args );
|
2613 |
|
2614 |
return $this->get_author_prio_from_posts( $posts );
|
2615 |
}
|
2616 |
|
2617 |
+
/**
|
2618 |
+
* Return sitemap data for posts.
|
2619 |
+
*
|
2620 |
+
* @param string $include
|
2621 |
+
* @param string $status
|
2622 |
+
* @param int $page
|
2623 |
+
*
|
2624 |
+
* @return array
|
2625 |
+
*/
|
2626 |
function get_all_post_priority_data( $include = 'any', $status = 'publish', $page = 0 ) {
|
2627 |
+
$posts = $page_query = array();
|
2628 |
if ( $this->paginate ) {
|
2629 |
+
$page_query = array( 'offset' => $page * $this->max_posts );
|
2630 |
}
|
2631 |
+
if ( ( 'publish' === $status ) && ( 'attachment' === $include ) ) {
|
2632 |
$status = 'inherit';
|
2633 |
}
|
2634 |
if ( is_array( $include ) && ( ( $pos = array_search( 'attachment', $include ) ) !== false ) ) {
|
2635 |
unset( $include[ $pos ] );
|
2636 |
+
$att_args = array( 'post_type' => 'attachment', 'post_status' => 'inherit' );
|
2637 |
$att_args = array_merge( $att_args, $page_query );
|
2638 |
$posts = $this->get_all_post_type_data( $att_args );
|
2639 |
}
|
2640 |
+
$args = array( 'post_type' => $include, 'post_status' => $status );
|
2641 |
$args = array_merge( $args, $page_query );
|
2642 |
$args = $this->set_post_args( $args );
|
2643 |
$posts = array_merge( $this->get_all_post_type_data( $args ), $posts );
|
2645 |
return $this->get_prio_from_posts( $posts, $this->get_default_priority( 'post', true ), $this->get_default_frequency( 'post', true ) );
|
2646 |
}
|
2647 |
|
2648 |
+
/**
|
2649 |
+
* Return a list of all permalinks.
|
2650 |
+
*
|
2651 |
+
* @param string $include
|
2652 |
+
* @param string $status
|
2653 |
+
*
|
2654 |
+
* @return array
|
2655 |
+
*/
|
2656 |
function get_all_permalinks( $include = 'any', $status = 'publish' ) {
|
2657 |
+
$args = array( 'post_type' => $include, 'post_status' => $status );
|
2658 |
$args = $this->set_post_args( $args );
|
2659 |
$posts = $this->get_all_post_type_data( $args );
|
2660 |
$links = $this->get_post_permalinks( $posts );
|
2668 |
return $links;
|
2669 |
}
|
2670 |
|
2671 |
+
/**
|
2672 |
+
* Static memory cache for permalink_structure option.
|
2673 |
+
*
|
2674 |
+
* @param $pre
|
2675 |
+
*
|
2676 |
+
* @return null
|
2677 |
+
*/
|
2678 |
function cache_structure( $pre ) {
|
2679 |
return $this->cache_struct;
|
2680 |
}
|
2681 |
|
2682 |
+
/**
|
2683 |
+
* Static memory cache for home option.
|
2684 |
+
*
|
2685 |
+
* @param $pre
|
2686 |
+
*
|
2687 |
+
* @return null
|
2688 |
+
*/
|
2689 |
function cache_home( $pre ) {
|
2690 |
return $this->cache_home;
|
2691 |
}
|
2692 |
|
2693 |
+
/**
|
2694 |
+
* Cache permalink_structure and home for repeated sitemap queries.
|
2695 |
+
*/
|
2696 |
function cache_options() {
|
2697 |
static $start = true;
|
2698 |
if ( $start ) {
|
2699 |
$this->cache_struct = get_option( 'permalink_structure' );
|
2700 |
if ( ! empty( $this->cache_struct ) ) {
|
2701 |
+
add_filter( 'pre_option_permalink_structure', array( $this, 'cache_structure' ) );
|
2702 |
}
|
2703 |
$this->cache_home = get_option( 'home' );
|
2704 |
if ( ! empty( $this->cache_home ) ) {
|
2705 |
+
add_filter( 'pre_option_home', array( $this, 'cache_home' ) );
|
2706 |
}
|
2707 |
$start = false;
|
2708 |
}
|
2709 |
}
|
2710 |
|
2711 |
+
/**
|
2712 |
+
* Call get_term_link with caching in place.
|
2713 |
+
*
|
2714 |
+
* @param $term
|
2715 |
+
* @param string $taxonomy
|
2716 |
+
*
|
2717 |
+
* @return string|WP_Error
|
2718 |
+
*/
|
2719 |
function get_term_link( $term, $taxonomy = '' ) {
|
2720 |
static $start = true;
|
2721 |
if ( $start ) {
|
2726 |
return get_term_link( $term, $taxonomy );
|
2727 |
}
|
2728 |
|
2729 |
+
/**
|
2730 |
+
* Call get_permalink with caching in place.
|
2731 |
+
*
|
2732 |
+
* @param $post
|
2733 |
+
*
|
2734 |
+
* @return false|string
|
2735 |
+
*/
|
2736 |
function get_permalink( $post ) {
|
2737 |
static $start = true;
|
2738 |
if ( $start ) {
|
2743 |
return get_permalink( $post );
|
2744 |
}
|
2745 |
|
2746 |
+
/**
|
2747 |
+
* Return term counts using wp_count_terms().
|
2748 |
+
*
|
2749 |
+
* @param $args
|
2750 |
+
*
|
2751 |
+
* @return array|int|mixed|null|void|WP_Error
|
2752 |
+
*/
|
2753 |
function get_all_term_counts( $args ) {
|
2754 |
$term_counts = null;
|
2755 |
if ( ! empty( $args ) && ! empty( $args['taxonomy'] ) ) {
|
2760 |
$term_counts = wp_count_terms( $args['taxonomy'], array( 'hide_empty' => true ) );
|
2761 |
} else {
|
2762 |
foreach ( $args['taxonomy'] as $taxonomy ) {
|
2763 |
+
if ( 'all' === $taxonomy ) {
|
2764 |
continue;
|
2765 |
}
|
2766 |
$term_counts[ $taxonomy ] = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) );
|
2772 |
return $term_counts;
|
2773 |
}
|
2774 |
|
2775 |
+
/**
|
2776 |
+
* Return post counts using wp_count_posts().
|
2777 |
+
*
|
2778 |
+
* @param $args
|
2779 |
+
*
|
2780 |
+
* @return mixed|null|void
|
2781 |
+
*/
|
2782 |
function get_all_post_counts( $args ) {
|
2783 |
$post_counts = null;
|
2784 |
$status = 'inherit';
|
2794 |
$post_counts = $count[ $status ];
|
2795 |
} else {
|
2796 |
foreach ( $args['post_type'] as $post_type ) {
|
2797 |
+
if ( 'all' === $post_type ) {
|
2798 |
continue;
|
2799 |
}
|
2800 |
$count = (Array) wp_count_posts( $post_type );
|
2802 |
if ( empty( $count ) ) {
|
2803 |
$post_counts[ $post_type ] = 0;
|
2804 |
} else {
|
2805 |
+
if ( 'attachment' === $post_type ) {
|
2806 |
$post_counts[ $post_type ] = $count['inherit'];
|
2807 |
} else {
|
2808 |
$post_counts[ $post_type ] = $count[ $status ];
|
2816 |
return $post_counts;
|
2817 |
}
|
2818 |
|
2819 |
+
/**
|
2820 |
+
* Get total post count.
|
2821 |
+
*
|
2822 |
+
* @param $args
|
2823 |
+
*
|
2824 |
+
* @return int|mixed|null|void
|
2825 |
+
*/
|
2826 |
function get_total_post_count( $args ) {
|
2827 |
$total = 0;
|
2828 |
$counts = $this->get_all_post_counts( $args );
|
2839 |
return $total;
|
2840 |
}
|
2841 |
|
2842 |
+
/**
|
2843 |
+
* Return post data using get_posts().
|
2844 |
+
*
|
2845 |
+
* @param $args
|
2846 |
+
*
|
2847 |
+
* @return array|mixed|void
|
2848 |
+
*/
|
2849 |
function get_all_post_type_data( $args ) {
|
2850 |
$defaults = array(
|
2851 |
'numberposts' => $this->max_posts,
|
2861 |
'meta_compare' => '',
|
2862 |
'meta_query' => '',
|
2863 |
'cache_results' => false,
|
2864 |
+
'no_found_rows' => true,
|
2865 |
);
|
2866 |
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
2867 |
$defaults['suppress_filters'] = false;
|
2868 |
}
|
2869 |
$args = wp_parse_args( $args, $defaults );
|
2870 |
if ( empty( $args['post_type'] ) ) {
|
2871 |
+
return apply_filters( $this->prefix . 'post_filter', array(), $args );
|
2872 |
}
|
2873 |
+
$exclude_slugs = array();
|
2874 |
if ( ! empty( $args['exclude'] ) ) {
|
2875 |
$exclude = preg_split( '/[\s,]+/', trim( $args['exclude'] ) );
|
2876 |
if ( ! empty( $exclude ) ) {
|
2899 |
if ( ! empty( $q->posts ) ) {
|
2900 |
$args['exclude'] = array_merge( $args['exclude'], $q->posts );
|
2901 |
}
|
|
|
2902 |
|
2903 |
$posts = get_posts( apply_filters( $this->prefix . 'post_query', $args ) );
|
2904 |
if ( ! empty( $exclude_slugs ) ) {
|
modules/aioseop_video_sitemap.php
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
if ( AIOSEOPPRO ) {
|
4 |
require_once( AIOSEOP_PLUGIN_DIR . 'pro/video_sitemap.php' );
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Loads video sitemap class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
+
*
|
7 |
+
*/
|
8 |
|
9 |
if ( AIOSEOPPRO ) {
|
10 |
require_once( AIOSEOP_PLUGIN_DIR . 'pro/video_sitemap.php' );
|
modules/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
public/front.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for public facing code
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
+
* @since 2.3.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'All_in_One_SEO_Pack_Front' ) ) {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class All_in_One_SEO_Pack_Front
|
13 |
+
*
|
14 |
+
* @since 2.3.6
|
15 |
+
*/
|
16 |
+
class All_in_One_SEO_Pack_Front {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* All_in_One_SEO_Pack_Front constructor.
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
|
23 |
+
add_action( 'template_redirect', array( $this, 'noindex_follow_rss' ) );
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Noindex and follow RSS feeds.
|
29 |
+
*
|
30 |
+
* @Since 2.3.6
|
31 |
+
*/
|
32 |
+
public function noindex_follow_rss() {
|
33 |
+
if ( is_feed() && headers_sent() === false ) {
|
34 |
+
header( 'X-Robots-Tag: noindex, follow', true );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
$aiosp_front_class = new All_in_One_SEO_Pack_Front();
|
42 |
+
|
public/index.php
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Silence is golden.
|
4 |
+
*/
|
public/opengraph.php
CHANGED
@@ -62,11 +62,17 @@ if ( ! class_exists( 'AIOSEOP_Opengraph_Public' ) ) {
|
|
62 |
*
|
63 |
* @return mixed
|
64 |
* @since 2.3.5
|
|
|
65 |
*/
|
66 |
public static function twitter_url_to_user( $twitter_profile ) {
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
//extract the twitter username from the url
|
69 |
-
|
70 |
$parsed_twitter_profile = wp_parse_url( $twitter_profile );
|
71 |
|
72 |
$path = $parsed_twitter_profile['path'];
|
62 |
*
|
63 |
* @return mixed
|
64 |
* @since 2.3.5
|
65 |
+
* @since 2.3.5.1 Bail if < WordPress 4.4 for now.
|
66 |
*/
|
67 |
public static function twitter_url_to_user( $twitter_profile ) {
|
68 |
|
69 |
+
// If they're below 4.4 (no wp_parse_url) bail. We can improve this for <4.4 later or just hold out until we drop 4.4 support.
|
70 |
+
if ( ! function_exists( 'wp_parse_url' ) ) {
|
71 |
+
return $twitter_profile;
|
72 |
+
}
|
73 |
+
|
74 |
//extract the twitter username from the url
|
75 |
+
|
76 |
$parsed_twitter_profile = wp_parse_url( $twitter_profile );
|
77 |
|
78 |
$path = $parsed_twitter_profile['path'];
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: hallsofmontezuma, wpsmort, dougal, pbaylies, arnaudbroes
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
|
5 |
-
Requires at least: 3.
|
6 |
Tested up to: 4.5
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -14,9 +14,9 @@ The most downloaded plugin for WordPress (almost 30 million downloads). Use All
|
|
14 |
|
15 |
**All in One SEO Pack** Optimizes your WordPress blog for SEO (**Search Engine Optimization**).
|
16 |
|
17 |
-
**[Upgrade to Pro Version](http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version
|
18 |
|
19 |
-
[Premium Support](http://semperplugins.com/support
|
20 |
|
21 |
First created in 2007, see why AIOSEO is the most downloaded plugin for WordPress.
|
22 |
|
@@ -24,7 +24,7 @@ First created in 2007, see why AIOSEO is the most downloaded plugin for WordPres
|
|
24 |
* Google Analytics support
|
25 |
* Support for SEO on Custom Post Types
|
26 |
* Advanced Canonical URLs
|
27 |
-
*
|
28 |
* Built-in API so other plugins/themes can access and extend functionality
|
29 |
* ONLY free plugin to provide SEO Integration for e-Commerce sites, including WooCommerce
|
30 |
* Nonce Security built into All in One SEO Pack
|
@@ -55,13 +55,13 @@ manually.
|
|
55 |
|
56 |
1. Visit 'Plugins > Add New'
|
57 |
2. Search for 'All in One SEO'
|
58 |
-
3. Activate All in One SEO Pack from your Plugins page.
|
59 |
|
60 |
= From WordPress.org =
|
61 |
|
62 |
1. Download All in One SEO Pack.
|
63 |
2. Upload the 'All in One SEO Pack' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...)
|
64 |
-
3. Activate All in One SEO Pack from your Plugins page.
|
65 |
|
66 |
= Once Activated =
|
67 |
|
@@ -146,7 +146,7 @@ enhancements:
|
|
146 |
-futureproofing the file editor function for PHP7,8
|
147 |
-futureproofing the import-export function for PHP7,8
|
148 |
|
149 |
-
= 2.2.7.4 =
|
150 |
|
151 |
-Update for WordPress 4.4
|
152 |
-CSS fixes
|
2 |
Contributors: hallsofmontezuma, wpsmort, dougal, pbaylies, arnaudbroes
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
|
5 |
+
Requires at least: 3.4
|
6 |
Tested up to: 4.5
|
7 |
+
Stable tag: 2.3.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
**All in One SEO Pack** Optimizes your WordPress blog for SEO (**Search Engine Optimization**).
|
16 |
|
17 |
+
**[Upgrade to Pro Version](http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=readme_utpv)**
|
18 |
|
19 |
+
[Premium Support](http://semperplugins.com/support/?loc=readme_ps)
|
20 |
|
21 |
First created in 2007, see why AIOSEO is the most downloaded plugin for WordPress.
|
22 |
|
24 |
* Google Analytics support
|
25 |
* Support for SEO on Custom Post Types
|
26 |
* Advanced Canonical URLs
|
27 |
+
* Automatically notifies search engines like Google and Bing about changes to your site
|
28 |
* Built-in API so other plugins/themes can access and extend functionality
|
29 |
* ONLY free plugin to provide SEO Integration for e-Commerce sites, including WooCommerce
|
30 |
* Nonce Security built into All in One SEO Pack
|
55 |
|
56 |
1. Visit 'Plugins > Add New'
|
57 |
2. Search for 'All in One SEO'
|
58 |
+
3. Activate All in One SEO Pack from your Plugins page.
|
59 |
|
60 |
= From WordPress.org =
|
61 |
|
62 |
1. Download All in One SEO Pack.
|
63 |
2. Upload the 'All in One SEO Pack' directory to your '/wp-content/plugins/' directory, using your favorite method (ftp, sftp, scp, etc...)
|
64 |
+
3. Activate All in One SEO Pack from your Plugins page.
|
65 |
|
66 |
= Once Activated =
|
67 |
|
146 |
-futureproofing the file editor function for PHP7,8
|
147 |
-futureproofing the import-export function for PHP7,8
|
148 |
|
149 |
+
= 2.2.7.4 =
|
150 |
|
151 |
-Update for WordPress 4.4
|
152 |
-CSS fixes
|
sitemap.xsl
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<xsl:stylesheet version="2.0"
|
3 |
-
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
-
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
|
5 |
-
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
6 |
-
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
7 |
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
8 |
-
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
9 |
-
<xsl:template match="/">
|
10 |
-
<xsl:variable name="fileType">
|
11 |
-
<xsl:choose>
|
12 |
-
<xsl:when test="//sitemap:url">Sitemap</xsl:when>
|
13 |
-
<xsl:otherwise>SitemapIndex</xsl:otherwise>
|
14 |
-
</xsl:choose>
|
15 |
-
</xsl:variable>
|
16 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
17 |
-
<head>
|
18 |
-
<title>
|
19 |
-
<xsl:choose><xsl:when test="$fileType='Sitemap'">Sitemap</xsl:when>
|
20 |
-
<xsl:otherwise>Sitemap Index</xsl:otherwise>
|
21 |
-
</xsl:choose>
|
22 |
-
</title>
|
23 |
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
24 |
-
<style type="text/css">
|
25 |
-
body {
|
26 |
-
font-family: Helvetica, Arial, sans-serif;
|
27 |
-
font-size: 68.5%;
|
28 |
-
}
|
29 |
-
table {
|
30 |
-
border: none;
|
31 |
-
border-collapse: collapse;
|
32 |
-
}
|
33 |
-
table { font-size:1em; width:75% }
|
34 |
-
th { text-align:left; padding:5px }
|
35 |
-
tr.stripe { background-color:#f7f7f7; }
|
36 |
-
</style>
|
37 |
-
</head>
|
38 |
-
<body>
|
39 |
-
<div id="content">
|
40 |
-
<h1>XML Sitemap</h1>
|
41 |
-
<div>
|
42 |
-
<p><xsl:choose>
|
43 |
-
<xsl:when test="$fileType='Sitemap'">
|
44 |
-
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of> URLs</xsl:when>
|
45 |
-
<xsl:otherwise>This sitemap index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of> sitemaps</xsl:otherwise>
|
46 |
-
</xsl:choose></p>
|
47 |
-
</div>
|
48 |
-
<xsl:choose>
|
49 |
-
<xsl:when test="$fileType='Sitemap'">
|
50 |
-
<xsl:call-template name="sitemapTable"/></xsl:when>
|
51 |
-
<xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
|
52 |
-
</xsl:choose>
|
53 |
-
|
54 |
-
</div>
|
55 |
-
</body>
|
56 |
-
</html>
|
57 |
-
</xsl:template>
|
58 |
-
<xsl:template name="siteindexTable">
|
59 |
-
<table cellpadding="3">
|
60 |
-
<thead>
|
61 |
-
<tr>
|
62 |
-
<th width="50%">URL</th>
|
63 |
-
<th>LastChange</th>
|
64 |
-
</tr>
|
65 |
-
</thead>
|
66 |
-
<tbody>
|
67 |
-
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
68 |
-
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
69 |
-
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
70 |
-
<tr>
|
71 |
-
<xsl:if test="position() mod 2 != 1">
|
72 |
-
<xsl:attribute name="class">stripe</xsl:attribute>
|
73 |
-
</xsl:if>
|
74 |
-
<td>
|
75 |
-
<xsl:variable name="itemURL">
|
76 |
-
<xsl:value-of select="sitemap:loc"/>
|
77 |
-
</xsl:variable>
|
78 |
-
<a href="{$itemURL}">
|
79 |
-
<xsl:value-of select="sitemap:loc"/>
|
80 |
-
</a>
|
81 |
-
</td>
|
82 |
-
<td>
|
83 |
-
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
84 |
-
</td>
|
85 |
-
</tr>
|
86 |
-
</xsl:for-each>
|
87 |
-
</tbody>
|
88 |
-
</table>
|
89 |
-
</xsl:template>
|
90 |
-
<xsl:template name="sitemapTable">
|
91 |
-
<table cellpadding="3">
|
92 |
-
<thead>
|
93 |
-
<tr>
|
94 |
-
<th width="50%">URL</th>
|
95 |
-
<th>Priority</th>
|
96 |
-
<th>Change Frequency</th>
|
97 |
-
<th>LastChange</th>
|
98 |
-
</tr>
|
99 |
-
</thead>
|
100 |
-
<tbody>
|
101 |
-
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
102 |
-
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
103 |
-
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
104 |
-
<tr>
|
105 |
-
<xsl:if test="position() mod 2 != 1">
|
106 |
-
<xsl:attribute name="class">stripe</xsl:attribute>
|
107 |
-
</xsl:if>
|
108 |
-
<td>
|
109 |
-
<xsl:variable name="itemURL">
|
110 |
-
<xsl:value-of select="sitemap:loc"/>
|
111 |
-
</xsl:variable>
|
112 |
-
<a href="{$itemURL}">
|
113 |
-
<xsl:value-of select="sitemap:loc"/>
|
114 |
-
</a>
|
115 |
-
<xsl:variable name="thumbURL">
|
116 |
-
<xsl:value-of select="video:video/video:thumbnail_loc"/>
|
117 |
-
</xsl:variable>
|
118 |
-
<xsl:variable name="playURL">
|
119 |
-
<xsl:value-of select="video:video/video:player_loc"/>
|
120 |
-
</xsl:variable>
|
121 |
-
<xsl:if test="$thumbURL != ''">
|
122 |
-
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
|
123 |
-
</xsl:if>
|
124 |
-
</td>
|
125 |
-
<td>
|
126 |
-
<xsl:if test="string(number(sitemap:priority))!='NaN'">
|
127 |
-
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
128 |
-
</xsl:if>
|
129 |
-
</td>
|
130 |
-
<td>
|
131 |
-
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
132 |
-
</td>
|
133 |
-
<td>
|
134 |
-
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
135 |
-
</td>
|
136 |
-
<td>
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
</td>
|
141 |
-
</tr>
|
142 |
-
</xsl:for-each>
|
143 |
-
</tbody>
|
144 |
-
</table>
|
145 |
-
</xsl:template>
|
146 |
-
</xsl:stylesheet>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|