Version Description
Download this release
Release Info
Developer | pbaylies |
Plugin | All in One SEO Pack |
Version | 2.1.5 |
Comparing to | |
See all releases |
Code changes from version 2.1.4 to 2.1.5
- aioseop_class.php +17 -11
- aioseop_feature_manager.php +2 -0
- aioseop_functions.php +24 -0
- aioseop_importer_exporter.php +320 -0
- aioseop_module.css +9 -0
- aioseop_opengraph.php +13 -2
- aioseop_sitemap.php +277 -135
- all_in_one_seo_pack.php +4 -4
- images/ImporterExporter-BW-Retina.png +0 -0
- images/ImporterExporter-BW-Standard.png +0 -0
- images/ImporterExporter-Color-Retina.png +0 -0
- images/ImporterExporter-Color-Standard.png +0 -0
- readme.txt +3 -3
aioseop_class.php
CHANGED
@@ -50,7 +50,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
50 |
function All_in_One_SEO_Pack() {
|
51 |
global $aioseop_options;
|
52 |
$this->log_file = dirname( __FILE__ ) . '/all_in_one_seo_pack.log';
|
53 |
-
|
|
|
54 |
$this->do_log = true;
|
55 |
else
|
56 |
$this->do_log = false;
|
@@ -172,7 +173,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
172 |
"ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics; do this for new analytics accounts.", 'all_in_one_seo_pack' ),
|
173 |
"ga_domain" => __( "Enter your domain name if you have enabled tracking of Subdomains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
174 |
"ga_multi_domain" => __( "Check this if you have enabled tracking of Multiple top-level domains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
175 |
-
"ga_display_advertising"=> __( "Support for Doubleclick Display Advertising tracking
|
176 |
"ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all_in_one_seo_pack' ),
|
177 |
"ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
178 |
"cpostnoindex" => __( "Set the default NOINDEX setting for each Post Type.<br /><a href='http://semperplugins.com/documentation/noindex-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
@@ -398,8 +399,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
398 |
"ga_display_advertising"=> Array(
|
399 |
'name' => __( '"Display Advertising" Tracking:', 'all_in_one_seo_pack' ),
|
400 |
'type' => 'checkbox',
|
401 |
-
'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ),
|
402 |
-
'aiosp_ga_use_universal_analytics' => Array( 'lhs' => 'aiosp_ga_use_universal_analytics', 'op' => '!=', 'rhs' => 'on' ) ) ),
|
403 |
"ga_exclude_users"=> Array(
|
404 |
'name' => __( 'Exclude Users From Tracking:', 'all_in_one_seo_pack' ),
|
405 |
'type' => 'multicheckbox',
|
@@ -1337,8 +1337,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1337 |
if ( empty( $googleplus ) && !empty( $aioseop_options['aiosp_google_publisher'] ) )
|
1338 |
$googleplus = $aioseop_options['aiosp_google_publisher'];
|
1339 |
|
1340 |
-
|
1341 |
-
if ( $is_front_page ) {
|
1342 |
if ( !empty( $aioseop_options['aiosp_google_publisher'] ) )
|
1343 |
$publisher = $aioseop_options['aiosp_google_publisher'];
|
1344 |
|
@@ -1363,14 +1363,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1363 |
|
1364 |
if ( !empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
|
1365 |
if ( $is_front_page && !in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
|
1366 |
-
|
1367 |
} else {
|
1368 |
if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
|
1369 |
if ( is_singular() && !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
|
1370 |
-
|
1371 |
} else {
|
1372 |
if ( !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
|
1373 |
-
|
1374 |
}
|
1375 |
}
|
1376 |
}
|
@@ -1394,7 +1394,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1394 |
if ( is_home() || is_archive() || is_paged() ) {
|
1395 |
global $wp_query;
|
1396 |
$max_page = $wp_query->max_num_pages;
|
1397 |
-
$page = $this->get_page_number();
|
1398 |
if ( $page > 1 )
|
1399 |
$prev = get_previous_posts_page_link();
|
1400 |
if ( $page < $max_page ) {
|
@@ -1707,6 +1706,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1707 |
if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
1708 |
$allow_linker = "'allowLinker': true";
|
1709 |
}
|
|
|
|
|
|
|
|
|
1710 |
$js_options = Array();
|
1711 |
foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
|
1712 |
if ( !empty( $$opts ) ) $js_options[] = $$opts;
|
@@ -1724,6 +1727,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1724 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
1725 |
|
1726 |
ga('create', '{$analytics_id}'{$js_options});
|
|
|
1727 |
ga('send', 'pageview');
|
1728 |
</script>
|
1729 |
|
@@ -1898,7 +1902,9 @@ function aiosp_google_analytics() {
|
|
1898 |
if ( !empty( $term ) )
|
1899 |
$link = get_term_link( $term, $taxonomy );
|
1900 |
} elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
|
1901 |
-
|
|
|
|
|
1902 |
} else {
|
1903 |
return false;
|
1904 |
}
|
50 |
function All_in_One_SEO_Pack() {
|
51 |
global $aioseop_options;
|
52 |
$this->log_file = dirname( __FILE__ ) . '/all_in_one_seo_pack.log';
|
53 |
+
|
54 |
+
if ( !empty( $aioseop_options ) && isset( $aioseop_options['aiosp_do_log'] ) && $aioseop_options['aiosp_do_log'] )
|
55 |
$this->do_log = true;
|
56 |
else
|
57 |
$this->do_log = false;
|
173 |
"ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics; do this for new analytics accounts.", 'all_in_one_seo_pack' ),
|
174 |
"ga_domain" => __( "Enter your domain name if you have enabled tracking of Subdomains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
175 |
"ga_multi_domain" => __( "Check this if you have enabled tracking of Multiple top-level domains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
176 |
+
"ga_display_advertising"=> __( "Support for Doubleclick Display Advertising tracking.", 'all_in_one_seo_pack' ),
|
177 |
"ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all_in_one_seo_pack' ),
|
178 |
"ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
179 |
"cpostnoindex" => __( "Set the default NOINDEX setting for each Post Type.<br /><a href='http://semperplugins.com/documentation/noindex-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
399 |
"ga_display_advertising"=> Array(
|
400 |
'name' => __( '"Display Advertising" Tracking:', 'all_in_one_seo_pack' ),
|
401 |
'type' => 'checkbox',
|
402 |
+
'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
|
|
|
403 |
"ga_exclude_users"=> Array(
|
404 |
'name' => __( 'Exclude Users From Tracking:', 'all_in_one_seo_pack' ),
|
405 |
'type' => 'multicheckbox',
|
1337 |
if ( empty( $googleplus ) && !empty( $aioseop_options['aiosp_google_publisher'] ) )
|
1338 |
$googleplus = $aioseop_options['aiosp_google_publisher'];
|
1339 |
|
1340 |
+
$page = $this->get_page_number();
|
1341 |
+
if ( ( $is_front_page ) && ( $page < 2 ) ) {
|
1342 |
if ( !empty( $aioseop_options['aiosp_google_publisher'] ) )
|
1343 |
$publisher = $aioseop_options['aiosp_google_publisher'];
|
1344 |
|
1363 |
|
1364 |
if ( !empty( $aioseop_options['aiosp_google_author_advanced'] ) && isset( $aioseop_options['aiosp_google_author_location'] ) ) {
|
1365 |
if ( $is_front_page && !in_array( 'front', $aioseop_options['aiosp_google_author_location'] ) ) {
|
1366 |
+
$author = '';
|
1367 |
} else {
|
1368 |
if ( in_array( 'all', $aioseop_options['aiosp_google_author_location'] ) ) {
|
1369 |
if ( is_singular() && !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
|
1370 |
+
$author = '';
|
1371 |
} else {
|
1372 |
if ( !is_singular( $aioseop_options['aiosp_google_author_location'] ) )
|
1373 |
+
$author = '';
|
1374 |
}
|
1375 |
}
|
1376 |
}
|
1394 |
if ( is_home() || is_archive() || is_paged() ) {
|
1395 |
global $wp_query;
|
1396 |
$max_page = $wp_query->max_num_pages;
|
|
|
1397 |
if ( $page > 1 )
|
1398 |
$prev = get_previous_posts_page_link();
|
1399 |
if ( $page < $max_page ) {
|
1706 |
if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
1707 |
$allow_linker = "'allowLinker': true";
|
1708 |
}
|
1709 |
+
$display_advertising = '';
|
1710 |
+
if (!empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
|
1711 |
+
$display_advertising = "ga('require', 'displayfeatures');";
|
1712 |
+
}
|
1713 |
$js_options = Array();
|
1714 |
foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
|
1715 |
if ( !empty( $$opts ) ) $js_options[] = $$opts;
|
1727 |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
1728 |
|
1729 |
ga('create', '{$analytics_id}'{$js_options});
|
1730 |
+
{$display_advertising}
|
1731 |
ga('send', 'pageview');
|
1732 |
</script>
|
1733 |
|
1902 |
if ( !empty( $term ) )
|
1903 |
$link = get_term_link( $term, $taxonomy );
|
1904 |
} elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
|
1905 |
+
if ( is_array( $post_type ) )
|
1906 |
+
$post_type = reset( $post_type );
|
1907 |
+
$link = get_post_type_archive_link( $post_type );
|
1908 |
} else {
|
1909 |
return false;
|
1910 |
}
|
aioseop_feature_manager.php
CHANGED
@@ -23,6 +23,8 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
|
|
23 |
'performance' => Array( 'name' => __( 'Performance', 'all_in_one_seo_pack' ),
|
24 |
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all_in_one_seo_pack' ),
|
25 |
'default' => 'on' ),
|
|
|
|
|
26 |
'coming_soon' => Array( 'name' => __( 'Coming Soon...', 'all_in_one_seo_pack' ),
|
27 |
'description' => __( 'File Editor', 'all_in_one_seo_pack' ),
|
28 |
'save' => false ) );
|
23 |
'performance' => Array( 'name' => __( 'Performance', 'all_in_one_seo_pack' ),
|
24 |
'description' => __( 'Optimize performance related to SEO and check your system status.', 'all_in_one_seo_pack' ),
|
25 |
'default' => 'on' ),
|
26 |
+
'importer_exporter' => Array( 'name' => __( 'Importer & Exporter', 'all_in_one_seo_pack' ),
|
27 |
+
'description' => __( 'Exports and imports your All in One SEO Pack plugin settings.', 'all_in_one_seo_pack' ) ),
|
28 |
'coming_soon' => Array( 'name' => __( 'Coming Soon...', 'all_in_one_seo_pack' ),
|
29 |
'description' => __( 'File Editor', 'all_in_one_seo_pack' ),
|
30 |
'save' => false ) );
|
aioseop_functions.php
CHANGED
@@ -608,4 +608,28 @@ if( !function_exists( 'fnmatch' ) ) {
|
|
608 |
function fnmatch( $pattern, $string ) {
|
609 |
return preg_match( "#^" . strtr( preg_quote( $pattern, '#' ), array( '\*' => '.*', '\?' => '.' ) ) . "$#i", $string );
|
610 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
}
|
608 |
function fnmatch( $pattern, $string ) {
|
609 |
return preg_match( "#^" . strtr( preg_quote( $pattern, '#' ), array( '\*' => '.*', '\?' => '.' ) ) . "$#i", $string );
|
610 |
}
|
611 |
+
}
|
612 |
+
|
613 |
+
/***
|
614 |
+
* parse_ini_string() doesn't exist pre PHP 5.3
|
615 |
+
*/
|
616 |
+
if ( !function_exists( 'parse_ini_string' ) ) {
|
617 |
+
function parse_ini_string( $string, $process_sections ) {
|
618 |
+
if ( !class_exists( 'parse_ini_filter' ) ) {
|
619 |
+
/* Define our filter class */
|
620 |
+
class parse_ini_filter extends php_user_filter {
|
621 |
+
static $buf = '';
|
622 |
+
function filter( $in, $out, &$consumed, $closing ) {
|
623 |
+
$bucket = stream_bucket_new( fopen('php://memory', 'wb'), self::$buf );
|
624 |
+
stream_bucket_append( $out, $bucket );
|
625 |
+
return PSFS_PASS_ON;
|
626 |
+
}
|
627 |
+
}
|
628 |
+
/* Register our filter with PHP */
|
629 |
+
if ( !stream_filter_register("parse_ini", "parse_ini_filter") )
|
630 |
+
return false;
|
631 |
+
}
|
632 |
+
parse_ini_filter::$buf = $string;
|
633 |
+
return parse_ini_file( "php://filter/read=parse_ini/resource=php://memory", $process_sections );
|
634 |
+
}
|
635 |
}
|
aioseop_importer_exporter.php
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package All-in-One-SEO-Pack
|
4 |
+
*/
|
5 |
+
/**
|
6 |
+
* The Importer / Exporter class.
|
7 |
+
*/
|
8 |
+
if ( !class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
|
9 |
+
class All_in_One_SEO_Pack_Importer_Exporter extends All_in_One_SEO_Pack_Module {
|
10 |
+
|
11 |
+
function All_in_One_SEO_Pack_Importer_Exporter( ) {
|
12 |
+
$this->name = __( 'Importer & Exporter', 'all_in_one_seo_pack' ); // Human-readable name of the module
|
13 |
+
$this->prefix = 'aiosp_importer_exporter_'; // option prefix
|
14 |
+
$this->file = __FILE__;
|
15 |
+
parent::__construct();
|
16 |
+
$help_text = Array(
|
17 |
+
"import_submit" => __( "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>", 'all_in_one_seo_pack' ),
|
18 |
+
"export_choices" => __( "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>", 'all_in_one_seo_pack'),
|
19 |
+
"export_post_types" => __( "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>", 'all_in_one_seo_pack')
|
20 |
+
);
|
21 |
+
$this->warnings = Array();
|
22 |
+
$this->default_options = array(
|
23 |
+
'import_submit' => Array( 'name' => __( 'Import', 'all_in_one_seo_pack' ), 'default' => '', 'type' => 'file', 'save' => false ),
|
24 |
+
'export_choices' => Array( 'name' => __( 'Export Settings', 'all_in_one_seo_pack'),
|
25 |
+
'type' => 'multicheckbox',
|
26 |
+
'initial_options' => Array( 1 => 'General Settings',
|
27 |
+
2 => 'Post Data' ) ),
|
28 |
+
'export_post_types' => Array( 'name' => __( 'Export Post Types:', 'all_in_one_seo_pack' ),
|
29 |
+
'default' => Array( 'post' => 'post', 'page' => 'page' ),
|
30 |
+
'type' => 'multicheckbox',
|
31 |
+
'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ) ),
|
32 |
+
'import_export_help' => Array( 'type' => 'html', 'label' => 'none', 'default' => __( "Note: If General Settings is checked, the General Settings, the Feature Manager settings, and the following currently active modules will have their settings data exported:", 'all_in_one_seo_pack') . "<br />" )
|
33 |
+
);
|
34 |
+
|
35 |
+
if ( !empty( $help_text ) )
|
36 |
+
foreach( $help_text as $k => $v )
|
37 |
+
$this->default_options[$k]['help_text'] = $v;
|
38 |
+
|
39 |
+
$this->layout = Array(
|
40 |
+
'default' => Array(
|
41 |
+
'name' => $this->name,
|
42 |
+
'help_link' => 'http://semperplugins.com/documentation/importer-exporter-module/',
|
43 |
+
'options' => array_keys( $this->default_options )
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
// load initial options / set defaults
|
48 |
+
|
49 |
+
add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
|
50 |
+
}
|
51 |
+
|
52 |
+
function settings_page_init() {
|
53 |
+
add_filter($this->prefix . 'submit_options', Array( $this, 'filter_submit' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
function filter_submit( $submit ) {
|
57 |
+
$submit['Submit']['value'] = __('Import', 'all_in_one_seo_pack') . ' »';
|
58 |
+
return Array( 'export_submit' => Array( 'type' => 'submit',
|
59 |
+
'class' => 'button-primary',
|
60 |
+
'value' => __('Export', 'all_in_one_seo_pack') . ' »' ) ) + $submit;
|
61 |
+
}
|
62 |
+
|
63 |
+
function debug_post_types( ) {
|
64 |
+
$post_types = $this->get_post_type_titles( );
|
65 |
+
$rempost = array( 'attachment' => 1, 'revision' => 1, 'nav_menu_item' => 1 );
|
66 |
+
$this->default_options['export_post_types']['initial_options'] = array_diff_key( $post_types, $rempost );
|
67 |
+
|
68 |
+
global $aioseop_modules;
|
69 |
+
if ( !empty( $aioseop_modules ) ) {
|
70 |
+
$modules = $aioseop_modules->get_loaded_module_list();
|
71 |
+
if ( !empty( $modules ) && !empty( $modules['feature_manager'] ) )
|
72 |
+
unset( $modules['feature_manager'] );
|
73 |
+
if ( !empty( $modules ) ) {
|
74 |
+
$this->default_options['import_export_help']['default'] .= "<ul>\n";
|
75 |
+
foreach( $modules as $m ) {
|
76 |
+
$module = $aioseop_modules->return_module( $m );
|
77 |
+
$this->default_options['import_export_help']['default'] .= "\t<li>" . $module->name . "</li>\n";
|
78 |
+
}
|
79 |
+
$this->default_options['import_export_help']['default'] .= "\n</ul>\n";
|
80 |
+
} else $this->default_options['import_export_help']['default'] .= "<br />" . __( "There are no other modules currently loaded!", 'all_in_one_seo_pack' );
|
81 |
+
}
|
82 |
+
$this->default_options['import_export_help']['default'] .= '<br />' . __( "You may change this by activating or deactivating modules in the Feature Manager.", 'all_in_one_seo_pack' );
|
83 |
+
$this->update_options( );
|
84 |
+
|
85 |
+
if ( !empty( $_REQUEST['export_submit'] ) )
|
86 |
+
$this->do_importer_exporter();
|
87 |
+
else
|
88 |
+
add_action( $this->prefix . 'settings_update', Array( $this, 'do_importer_exporter' ) );
|
89 |
+
}
|
90 |
+
|
91 |
+
function importer_exporter_export( $args ){
|
92 |
+
|
93 |
+
/* Add all settings to settings file */
|
94 |
+
$name = $this->get_option_name();
|
95 |
+
|
96 |
+
$buf = '[' . $this->get_option_name() . "]\n";
|
97 |
+
if( !empty( $this->options ) ) {
|
98 |
+
foreach ( $this->options as $key => $value ) {
|
99 |
+
$buf .= "$key = '" . str_replace("'", "\'", trim( serialize( $value ) ) ) . "'\n";
|
100 |
+
}
|
101 |
+
}
|
102 |
+
return $buf;
|
103 |
+
}
|
104 |
+
|
105 |
+
function show_import_warnings(){
|
106 |
+
echo '<div class="error fade" style="width:52%">';
|
107 |
+
if( is_array( $this->warnings ) ){
|
108 |
+
foreach( $this->warnings as $warning ){
|
109 |
+
echo "<p>{$warning}</p>";
|
110 |
+
}
|
111 |
+
}
|
112 |
+
echo '</div>';
|
113 |
+
}
|
114 |
+
|
115 |
+
function parse_ini_helper( $array ) {
|
116 |
+
$returnArray = array();
|
117 |
+
if (is_array($array)) {
|
118 |
+
foreach ($array as $key => $value) {
|
119 |
+
$e = explode(':', $key);
|
120 |
+
if (!empty($e[1])) {
|
121 |
+
$x = array();
|
122 |
+
foreach ($e as $tk => $tv) {
|
123 |
+
$x[$tk] = trim($tv);
|
124 |
+
}
|
125 |
+
$x = array_reverse($x, true);
|
126 |
+
foreach ($x as $k => $v) {
|
127 |
+
$c = $x[0];
|
128 |
+
if (empty($returnArray[$c])) {
|
129 |
+
$returnArray[$c] = array();
|
130 |
+
}
|
131 |
+
if (isset($returnArray[$x[1]])) {
|
132 |
+
$returnArray[$c] = array_merge($returnArray[$c], $returnArray[$x[1]]);
|
133 |
+
}
|
134 |
+
if ($k === 0) {
|
135 |
+
$returnArray[$c] = array_merge($returnArray[$c], $array[$key]);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
} else {
|
139 |
+
$returnArray[$key] = $array[$key];
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return $returnArray;
|
144 |
+
}
|
145 |
+
|
146 |
+
function recursive_parse( $array ) {
|
147 |
+
$returnArray = array();
|
148 |
+
if (is_array($array)) {
|
149 |
+
foreach ($array as $key => $value) {
|
150 |
+
if (is_array($value)) {
|
151 |
+
$array[$key] = $this->recursive_parse( $value );
|
152 |
+
}
|
153 |
+
$x = explode('.', $key);
|
154 |
+
if (!empty($x[1])) {
|
155 |
+
$x = array_reverse($x, true);
|
156 |
+
if (isset($returnArray[$key])) {
|
157 |
+
unset($returnArray[$key]);
|
158 |
+
}
|
159 |
+
if (!isset($returnArray[$x[0]])) {
|
160 |
+
$returnArray[$x[0]] = array();
|
161 |
+
}
|
162 |
+
$first = true;
|
163 |
+
foreach ($x as $k => $v) {
|
164 |
+
if ($first === true) {
|
165 |
+
$b = $array[$key];
|
166 |
+
$first = false;
|
167 |
+
}
|
168 |
+
$b = array($v => $b);
|
169 |
+
}
|
170 |
+
$returnArray[$x[0]] = array_merge_recursive( $returnArray[$x[0]], $b[$x[0]] );
|
171 |
+
} else {
|
172 |
+
$returnArray[$key] = $array[$key];
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
return $returnArray;
|
177 |
+
}
|
178 |
+
|
179 |
+
function get_ini_file( $assoc_arr, $has_sections=TRUE ) {
|
180 |
+
$content = "";
|
181 |
+
if ($has_sections) {
|
182 |
+
foreach ($assoc_arr as $key=>$elem) {
|
183 |
+
$content .= "[".$key."]\n";
|
184 |
+
foreach ($elem as $key2=>$elem2) {
|
185 |
+
if(is_array($elem2))
|
186 |
+
{
|
187 |
+
for($i=0;$i<count($elem2);$i++)
|
188 |
+
{
|
189 |
+
$content .= $key2."[] = \"".$elem2[$i]."\"\n";
|
190 |
+
}
|
191 |
+
}
|
192 |
+
else if ($elem2=="") $content .= $key2." = \n";
|
193 |
+
else $content .= $key2." = \"".$elem2."\"\n";
|
194 |
+
}
|
195 |
+
}
|
196 |
+
} else {
|
197 |
+
foreach ($assoc_arr as $key=>$elem) {
|
198 |
+
if( is_array( $elem ) ) {
|
199 |
+
for($i=0;$i<count($elem);$i++) {
|
200 |
+
$content .= $key2."[] = \"".$elem[$i]."\"\n";
|
201 |
+
}
|
202 |
+
} else if ($elem=="") $content .= $key2." = \n";
|
203 |
+
else $content .= $key2." = \"".$elem."\"\n";
|
204 |
+
}
|
205 |
+
}
|
206 |
+
return $content;
|
207 |
+
}
|
208 |
+
|
209 |
+
function parse_ini_advanced( $string ) {
|
210 |
+
return $this->recursive_parse( $this->parse_ini_helper( parse_ini_string( $string, true ) ) );
|
211 |
+
}
|
212 |
+
|
213 |
+
function do_importer_exporter( ) {
|
214 |
+
$submit = null; $count = 0; $post_exists = null; $post_warning = null;
|
215 |
+
global $aioseop_options, $aiosp, $aioseop_module_list;
|
216 |
+
if ( isset( $_REQUEST['nonce-aioseop'] ) ) $nonce = $_REQUEST['nonce-aioseop'];
|
217 |
+
$post_fields = Array( 'keywords', 'description', 'title', 'meta', 'disable', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords' );
|
218 |
+
if ( !empty( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] ) ) $submit = "Import";
|
219 |
+
if ( !empty( $_REQUEST['export_submit'] ) ) $submit = 'Export';
|
220 |
+
if ( ($submit != null ) && ( wp_verify_nonce( $nonce, 'aioseop-nonce') ) ) {
|
221 |
+
switch ( $submit ) {
|
222 |
+
case 'Import':
|
223 |
+
/* Parse export file */
|
224 |
+
$file = file( $_FILES['aiosp_importer_exporter_import_submit']['tmp_name'] );
|
225 |
+
$section = Array(); $section_label = null;
|
226 |
+
foreach ( $file as $line_number => $line ) {
|
227 |
+
$line = trim( $line );
|
228 |
+
$matches = Array();
|
229 |
+
if ( empty( $line ) ) continue;
|
230 |
+
if ( $line[0] == ';' ) continue;
|
231 |
+
if ( preg_match("/^\[(\S+)\]$/", $line, $label ) ) {
|
232 |
+
$section_label = strval( $label[1] );
|
233 |
+
if ( $section_label == 'post_data') $count++;
|
234 |
+
if ( !isset( $section[ $section_label ] ) )
|
235 |
+
$section[ $section_label ] = Array();
|
236 |
+
} elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
|
237 |
+
if ( $section_label == 'post_data')
|
238 |
+
$section[ $section_label ][$count][ $matches[ 1 ] ] = $matches[ 2 ];
|
239 |
+
else
|
240 |
+
$section[ $section_label ][ $matches[ 1 ] ] = $matches[ 2 ];
|
241 |
+
} elseif ( preg_match( "/^(\S+)\s*=\s*NULL$/", $line, $matches ) ) {
|
242 |
+
if( $section_label == 'post_data' )
|
243 |
+
$section[ $section_label ][$count][ $matches[ 1 ] ] = NULL;
|
244 |
+
else
|
245 |
+
$section[ $section_label ][ $matches[ 1 ] ] = NULL;
|
246 |
+
} else {
|
247 |
+
$this->warnings[] = sprintf( __( '<b>Warning:</b> Line not matched: <b>"%s"</b>, On Line: <b>%s</b>', 'all_in_one_seo_pack' ), $line, $line_number ) ;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
/* Update Plugin Settings */
|
251 |
+
if( is_array( $section ) ) {
|
252 |
+
foreach( $section as $label => $module_options ) {
|
253 |
+
if( is_array( $module_options ) ) {
|
254 |
+
foreach( $module_options as $key => $value ) {
|
255 |
+
/* Update Post Data */
|
256 |
+
if( $label == 'post_data' ) {
|
257 |
+
$post_exists = post_exists( $module_options[$key]['post_title'], '', $module_options[$key]['post_date'] );
|
258 |
+
$target = get_post( $post_exists );
|
259 |
+
if( ( !empty( $module_options[$key]['post_type'] ) ) && $post_exists != null ) {
|
260 |
+
if( is_array($value) )
|
261 |
+
foreach ( $value as $field_name => $field_value )
|
262 |
+
if ( substr( $field_name, 1, 7) == 'aioseop' )
|
263 |
+
if ( $value )
|
264 |
+
update_post_meta( $target->ID, $field_name, maybe_unserialize( $field_value ) );
|
265 |
+
else
|
266 |
+
delete_post_meta($target->ID, $field_name );
|
267 |
+
$post_exists = null;
|
268 |
+
} else {
|
269 |
+
$target_title = $module_options[$key]['post_title'];
|
270 |
+
$post_warning = sprintf( __( '<b>Warning:</b> This following post could not be found: <b>"%s"</b>', 'all_in_one_seo_pack' ), $target_title );
|
271 |
+
}
|
272 |
+
if ( $post_warning != null ) {
|
273 |
+
$this->warnings[] = $post_warning;
|
274 |
+
$post_warning = null;
|
275 |
+
}
|
276 |
+
|
277 |
+
/* Update Module Settings */
|
278 |
+
} else{ $module_options[$key] = str_replace( Array( "\'", '\n', '\r' ), Array( "'", "\n", "\r" ), maybe_unserialize( $value ) ); }
|
279 |
+
}
|
280 |
+
/* Update Module Settings */
|
281 |
+
$this->update_class_option( $module_options, $label );
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
/* Show all errors found */
|
289 |
+
if( !empty( $this->warnings ) ) {
|
290 |
+
add_action( $this->prefix . 'settings_header', Array( $this, 'show_import_warnings' ), 5 );
|
291 |
+
}
|
292 |
+
|
293 |
+
break;
|
294 |
+
case 'Export':
|
295 |
+
|
296 |
+
/* Create File Contents */
|
297 |
+
$settings_file = "settings_aioseop.ini";
|
298 |
+
$buf = "; " . __( 'Settings export file for All in One SEO Pack', 'all_in_one_seo_pack' ) . "\n";
|
299 |
+
|
300 |
+
/* Add all settings to settings file */
|
301 |
+
$buf = $aiosp->settings_export( $buf );
|
302 |
+
$buf = apply_filters( 'aioseop_export_settings', $buf );
|
303 |
+
|
304 |
+
/* Send File to browser */
|
305 |
+
$strlength = strlen($buf);
|
306 |
+
header("Content-type: application/ini");
|
307 |
+
header("Content-Disposition: attachment; filename=$settings_file");
|
308 |
+
header("Content-Length: " . $strlength);
|
309 |
+
|
310 |
+
echo $buf;
|
311 |
+
die();
|
312 |
+
break;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
function settings_update( ) {
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
aioseop_module.css
CHANGED
@@ -360,6 +360,12 @@ div.aioseop_feature#aioseop_opengraph .aioseop_featured_image {
|
|
360 |
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
|
361 |
background-image: url(images/SocialMeta-Color-Standard.png);
|
362 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
div.aioseop_feature#aioseop_performance .aioseop_featured_image {
|
364 |
background-image: url(images/Performance-BW-Standard.png);
|
365 |
}
|
@@ -638,6 +644,9 @@ table.aioseop_table td, table.aioseop_table th {
|
|
638 |
vertical-align: text-bottom;
|
639 |
margin: 15px 0 0 0;
|
640 |
}
|
|
|
|
|
|
|
641 |
#aiosp {
|
642 |
width: 100%;
|
643 |
}
|
360 |
div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active {
|
361 |
background-image: url(images/SocialMeta-Color-Standard.png);
|
362 |
}
|
363 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image {
|
364 |
+
background-image: url(images/ImporterExporter-BW-Standard.png);
|
365 |
+
}
|
366 |
+
div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active {
|
367 |
+
background-image: url(images/ImporterExporter-Color-Standard.png);
|
368 |
+
}
|
369 |
div.aioseop_feature#aioseop_performance .aioseop_featured_image {
|
370 |
background-image: url(images/Performance-BW-Standard.png);
|
371 |
}
|
644 |
vertical-align: text-bottom;
|
645 |
margin: 15px 0 0 0;
|
646 |
}
|
647 |
+
#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div {
|
648 |
+
max-height: initial;
|
649 |
+
}
|
650 |
#aiosp {
|
651 |
width: 100%;
|
652 |
}
|
aioseop_opengraph.php
CHANGED
@@ -78,9 +78,11 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
78 |
"sitename" => __( "The Site Name is the name that is used to identify your website.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
79 |
"hometitle" => __( "The Home Title is the Open Graph title for your home page.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
80 |
"description" => __( "The Home Description is the Open Graph description for your home page.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
|
|
81 |
"generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
82 |
"disable_jetpack" => __( "Check this box to disable the Open Graph meta output by the Jetpack plugin.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
83 |
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
|
|
84 |
"dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
85 |
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
86 |
"categories" => __( "Set the Open Graph type for your website as either a blog or a website.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
@@ -103,9 +105,12 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
103 |
'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
|
104 |
'description' => Array( 'name' => __( 'Home Description', 'all_in_one_seo_pack'),
|
105 |
'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
|
|
|
|
|
106 |
'generate_descriptions' => Array( 'name' => __( 'Autogenerate OG Descriptions', 'all_in_one_seo_pack' ), 'default' => 1 ),
|
107 |
'disable_jetpack' => Array( 'name' => __( 'Disable Jetpack Tags', 'all_in_one_seo_pack' ), 'default' => 0 ),
|
108 |
'defimg' => Array( 'name' => __( 'Select OG:Image Source', 'all_in_one_seo_pack' ), 'type' => 'select', 'initial_options' => Array( '' => __( 'Default Image' ), 'featured' => __( 'Featured Image' ), 'attach' => __( 'First Attached Image' ), 'content' => __( 'First Image In Content' ), 'custom' => __( 'Image From Custom Field' ), 'auto' => __( 'First Available Image' ) ) ),
|
|
|
109 |
'dimg' => Array( 'name' => __( 'Default OG:Image', 'all_in_one_seo_pack' ), 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', 'type' => 'image' ),
|
110 |
'meta_key' => Array( 'name' => __( 'Use Custom Field For Image', 'all_in_one_seo_pack' ), 'type' => 'text', 'default' => '' ),
|
111 |
'categories' => Array( 'name' => __( 'Facebook Object Type', 'all_in_one_seo_pack'),
|
@@ -144,7 +149,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
144 |
|
145 |
$this->locations = array(
|
146 |
'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings',
|
147 |
-
'options' => Array('scan_header', 'setmeta', 'key', 'sitename', 'hometitle', 'description', 'disable_jetpack', 'generate_descriptions', 'defimg', 'dimg', 'meta_key', 'categories', 'types') ),
|
148 |
'settings' => Array( 'name' => __('Social Settings', 'all_in_one_seo_pack'),
|
149 |
'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
|
150 |
'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'category' ),
|
@@ -314,7 +319,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
314 |
if ( $first_page )
|
315 |
$description = $this->options['aiosp_opengraph_description'];
|
316 |
$type = $this->options['aiosp_opengraph_categories'];
|
317 |
-
|
|
|
|
|
|
|
318 |
|
319 |
/* If Use AIOSEO Title and Desc Selected */
|
320 |
if( $setmeta ) {
|
@@ -398,6 +406,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
398 |
}
|
399 |
}
|
400 |
|
|
|
|
|
|
|
401 |
$width = $height = '';
|
402 |
if ( !empty( $thumbnail ) ) {
|
403 |
if ( !empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) )
|
78 |
"sitename" => __( "The Site Name is the name that is used to identify your website.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
79 |
"hometitle" => __( "The Home Title is the Open Graph title for your home page.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
80 |
"description" => __( "The Home Description is the Open Graph description for your home page.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
81 |
+
"homeimage" => __( "The Home Image is the Open Graph image for your home page.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
82 |
"generate_descriptions" => __( "Check this and your Open Graph descriptions will be auto-generated from your content.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
83 |
"disable_jetpack" => __( "Check this box to disable the Open Graph meta output by the Jetpack plugin.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
84 |
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
85 |
+
"fallback" => __( "This option lets you fall back to the default image if no image could be found above.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
86 |
"dimg" => __( "This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
87 |
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
88 |
"categories" => __( "Set the Open Graph type for your website as either a blog or a website.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
|
105 |
'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
|
106 |
'description' => Array( 'name' => __( 'Home Description', 'all_in_one_seo_pack'),
|
107 |
'default' => '', 'type' => 'textarea', 'condshow' => Array( 'aiosp_opengraph_setmeta' => Array( 'lhs' => "aiosp_opengraph_setmeta", 'op' => '!=', 'rhs' => 'on' ) ) ),
|
108 |
+
'homeimage' => Array( 'name' => __( 'Home Image', 'all_in_one_seo_pack' ),
|
109 |
+
'type' => 'image' ),
|
110 |
'generate_descriptions' => Array( 'name' => __( 'Autogenerate OG Descriptions', 'all_in_one_seo_pack' ), 'default' => 1 ),
|
111 |
'disable_jetpack' => Array( 'name' => __( 'Disable Jetpack Tags', 'all_in_one_seo_pack' ), 'default' => 0 ),
|
112 |
'defimg' => Array( 'name' => __( 'Select OG:Image Source', 'all_in_one_seo_pack' ), 'type' => 'select', 'initial_options' => Array( '' => __( 'Default Image' ), 'featured' => __( 'Featured Image' ), 'attach' => __( 'First Attached Image' ), 'content' => __( 'First Image In Content' ), 'custom' => __( 'Image From Custom Field' ), 'auto' => __( 'First Available Image' ) ) ),
|
113 |
+
'fallback' => Array( 'name' => __( 'Use Default If No Image Found', 'all_in_one_seo_pack' ), 'type' => 'checkbox' ),
|
114 |
'dimg' => Array( 'name' => __( 'Default OG:Image', 'all_in_one_seo_pack' ), 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', 'type' => 'image' ),
|
115 |
'meta_key' => Array( 'name' => __( 'Use Custom Field For Image', 'all_in_one_seo_pack' ), 'type' => 'text', 'default' => '' ),
|
116 |
'categories' => Array( 'name' => __( 'Facebook Object Type', 'all_in_one_seo_pack'),
|
149 |
|
150 |
$this->locations = array(
|
151 |
'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings',
|
152 |
+
'options' => Array('scan_header', 'setmeta', 'key', 'sitename', 'hometitle', 'description', 'homeimage', 'disable_jetpack', 'generate_descriptions', 'defimg', 'fallback', 'dimg', 'meta_key', 'categories', 'types') ),
|
153 |
'settings' => Array( 'name' => __('Social Settings', 'all_in_one_seo_pack'),
|
154 |
'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
|
155 |
'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'category' ),
|
319 |
if ( $first_page )
|
320 |
$description = $this->options['aiosp_opengraph_description'];
|
321 |
$type = $this->options['aiosp_opengraph_categories'];
|
322 |
+
if ( !empty( $this->options['aiosp_opengraph_homeimage'] ) )
|
323 |
+
$thumbnail = $this->options['aiosp_opengraph_homeimage'];
|
324 |
+
else
|
325 |
+
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
326 |
|
327 |
/* If Use AIOSEO Title and Desc Selected */
|
328 |
if( $setmeta ) {
|
406 |
}
|
407 |
}
|
408 |
|
409 |
+
if ( ( empty( $thumbnail ) && !empty( $this->options['aiosp_opengraph_fallback'] ) ) )
|
410 |
+
$thumbnail = $this->options['aiosp_opengraph_dimg'];
|
411 |
+
|
412 |
$width = $height = '';
|
413 |
if ( !empty( $thumbnail ) ) {
|
414 |
if ( !empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) )
|
aioseop_sitemap.php
CHANGED
@@ -15,9 +15,11 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
15 |
var $paginate = false;
|
16 |
|
17 |
function All_in_One_SEO_Pack_Sitemap( ) {
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
parent::__construct();
|
22 |
$this->comment_string = __( "Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s", 'all_in_one_seo_pack' );
|
23 |
|
@@ -51,10 +53,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
51 |
'bing' => Array( 'name' => __( 'Notify Bing', 'all_in_one_seo_pack') ),
|
52 |
'indexes' => Array( 'name' => __( 'Enable Sitemap Indexes', 'all_in_one_seo_pack' ) ),
|
53 |
'paginate' => Array( 'name' => __( 'Paginate Sitemap Indexes', 'all_in_one_seo_pack' ),
|
54 |
-
'condshow' => Array( "
|
55 |
'max_posts' => Array( 'name' => __( 'Maximum Posts Per Sitemap', 'all_in_one_seo_pack' ),
|
56 |
'type' => 'text', 'default' => 50000,
|
57 |
-
'condshow' => Array( "
|
58 |
'posttypes' => Array( 'name' => __( 'Post Types', 'all_in_one_seo_pack'),
|
59 |
'type' => 'multicheckbox', 'default' => 'all' ),
|
60 |
'taxonomies'=> Array( 'name' => __( 'Taxonomies', 'all_in_one_seo_pack' ),
|
@@ -153,34 +155,37 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
153 |
if ( !empty( $help_text ) )
|
154 |
foreach( $help_text as $k => $v )
|
155 |
$this->default_options[$k]['help_text'] = $v;
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
// load initial options / set defaults
|
158 |
$this->update_options( );
|
159 |
-
|
160 |
-
if ( !empty( $this->options['aiosp_sitemap_paginate'] ) ) {
|
161 |
$this->paginate = true;
|
162 |
-
if ( ( $this->options[
|
163 |
-
$this->max_posts = $this->options[
|
164 |
}
|
165 |
|
166 |
-
if ( is_multisite() ) $this->options[
|
167 |
|
168 |
-
if ( $this->options[
|
169 |
|
170 |
if ( $this->option_isset( 'robots' ) )
|
171 |
add_action( 'do_robots', Array( $this, 'do_robots' ), 100 );
|
172 |
-
|
173 |
-
add_action( $this->prefix . 'settings_update', Array( $this, 'do_sitemaps' ) );
|
174 |
-
add_filter( $this->prefix . 'display_settings', Array( $this, 'update_post_data' ) );
|
175 |
-
add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
|
176 |
-
add_filter( $this->prefix . 'update_options', Array( $this, 'filter_options' ) );
|
177 |
-
add_filter( $this->prefix . 'output_option', Array( $this, 'display_custom_options' ), 10, 2 );
|
178 |
}
|
179 |
|
180 |
/** Custom settings - displays boxes for add pages to sitemap option. **/
|
181 |
function display_custom_options( $buf, $args ) {
|
182 |
-
if ( $args['name'] ==
|
183 |
-
$buf .=
|
184 |
if ( !empty( $args['value'] ) ) {
|
185 |
$buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
|
186 |
foreach ( $args['value'] as $k => $v ) {
|
@@ -201,6 +206,33 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
201 |
return $buf;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
/** Add post type details for settings once post types have been registered. **/
|
205 |
function add_post_types() {
|
206 |
$post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
|
@@ -278,16 +310,16 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
278 |
$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.",
|
279 |
'all_in_one_seo_pack' ), $privacy_link );
|
280 |
}
|
281 |
-
if ( $this->option_isset( 'debug' ) ) $options[
|
282 |
return $options;
|
283 |
}
|
284 |
|
285 |
/** Handle 'all' option for post types / taxonomies, further sanitization of filename, rewrites on for multisite, setting up addl pages option. **/
|
286 |
function filter_options( $options ) {
|
287 |
-
if ( is_array( $options[
|
288 |
-
$options[
|
289 |
-
if ( is_array( $options[
|
290 |
-
$options[
|
291 |
$opt = $this->prefix . 'filename';
|
292 |
if ( isset( $options[$opt] ) && !empty( $options[$opt] ) )
|
293 |
$options[$opt] = str_replace( '/', '', $options[$opt] );
|
@@ -354,8 +386,8 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
354 |
}
|
355 |
}
|
356 |
if ( !$siteurl ) $siteurl = get_home_url( $blog_id );
|
357 |
-
$url = $siteurl . '/' . $sitemap_options["
|
358 |
-
if ( $sitemap_options[
|
359 |
$siteurls[] = $url;
|
360 |
}
|
361 |
}
|
@@ -368,10 +400,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
368 |
$scan1 = $scan2 = '';
|
369 |
$files = Array();
|
370 |
|
371 |
-
if ( !empty( $this->options[
|
372 |
-
$scan1 = get_home_path() . $this->options[
|
373 |
-
if ( !empty( $this->options[
|
374 |
-
$scan2 .= get_home_path() . $this->options[
|
375 |
|
376 |
if ( empty( $scan1 ) && empty( $scan2 ) ) return $files;
|
377 |
$home_path = get_home_path();
|
@@ -393,7 +425,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
393 |
/** Handle deleting / renaming of conflicting sitemap files. **/
|
394 |
function do_sitemap_scan() {
|
395 |
$msg = '';
|
396 |
-
if ( !empty( $this->options[
|
397 |
$msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all_in_one_seo_pack' ) . '</p>';
|
398 |
}
|
399 |
if ( !empty( $_POST['aioseop_sitemap_rename_files'] ) || !empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
@@ -432,7 +464,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
432 |
if ( !empty( $msg ) )
|
433 |
$this->output_error( $msg );
|
434 |
}
|
435 |
-
|
436 |
/** Do the scan, return the results. **/
|
437 |
function scan_sitemaps() {
|
438 |
$msg = '';
|
@@ -473,7 +505,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
473 |
$matches = Array();
|
474 |
if ( preg_match( "/<!-- " . sprintf( $this->comment_string, '(.*)', '(.*)', '(.*)' ) . " -->/",
|
475 |
$file, $matches ) ) {
|
476 |
-
if ( !empty( $this->options[
|
477 |
$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' ),
|
478 |
$f, $matches[2], $matches[3] ) . "</p>\n";
|
479 |
$problem_files[] = $f;
|
@@ -507,12 +539,12 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
507 |
|
508 |
/** Updates debug log messages. **/
|
509 |
function debug_message( $msg ) {
|
510 |
-
if ( empty( $this->options["
|
511 |
-
$this->options["
|
512 |
-
if ( $this->strlen( $this->options["
|
513 |
-
$end = $this->strrpos( $this->options["
|
514 |
if ( $end === false ) $end = 2048;
|
515 |
-
$this->options["
|
516 |
}
|
517 |
$this->update_class_option( $this->options );
|
518 |
}
|
@@ -522,7 +554,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
522 |
add_action( 'rewrite_rules_array', Array( $this, 'rewrite_hook' ) );
|
523 |
add_filter( 'query_vars', Array( $this, 'query_var_hook' ) );
|
524 |
add_action( 'parse_query', Array( $this, 'sitemap_output_hook') );
|
525 |
-
if ( !get_transient(
|
526 |
add_action( 'wp_loaded', Array($this, 'flush_rules_hook' ) );
|
527 |
}
|
528 |
|
@@ -530,15 +562,15 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
530 |
function get_rewrite_rules() {
|
531 |
$sitemap_rules_normal = $sitemap_rules_gzipped = Array();
|
532 |
$sitemap_rules_normal = array(
|
533 |
-
$this->options["
|
534 |
-
$this->options["
|
535 |
-
$this->options["
|
536 |
);
|
537 |
-
if ( $this->options[
|
538 |
$sitemap_rules_gzipped = array(
|
539 |
-
$this->options["
|
540 |
-
$this->options["
|
541 |
-
$this->options["
|
542 |
);
|
543 |
}
|
544 |
$sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
|
@@ -562,16 +594,16 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
562 |
$rule = key( $sitemap_rules );
|
563 |
if ( !isset( $rules[ $rule ] ) || ( $rules[ $rule ] != $sitemap_rules[ $rule ] ) ) {
|
564 |
$wp_rewrite->flush_rules();
|
565 |
-
set_transient(
|
566 |
}
|
567 |
}
|
568 |
}
|
569 |
|
570 |
/** Add our query variable for sitemap generation. **/
|
571 |
function query_var_hook($vars) {
|
572 |
-
$vars[] =
|
573 |
if ( $this->paginate )
|
574 |
-
$vars[] =
|
575 |
return $vars;
|
576 |
}
|
577 |
|
@@ -599,19 +631,19 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
599 |
/** Handle outputting of dynamic sitemaps, logging. **/
|
600 |
function sitemap_output_hook($query) {
|
601 |
$page = 0;
|
602 |
-
if ( ( $this->options[
|
603 |
-
if( !empty( $query->query_vars[
|
604 |
-
if( !empty( $query->query_vars[
|
605 |
-
$page = $query->query_vars[
|
606 |
$this->start_memory_usage = memory_get_peak_usage();
|
607 |
-
$sitemap_type = $query->query_vars[
|
608 |
$gzipped = false;
|
609 |
if ( $this->substr( $sitemap_type, -3 ) === '.gz' ) {
|
610 |
$gzipped = true;
|
611 |
$sitemap_type = $this->substr( $sitemap_type, 0, -3 );
|
612 |
}
|
613 |
$blog_charset = get_option( 'blog_charset' );
|
614 |
-
if ( $this->options[
|
615 |
header( "Content-Type: application/x-gzip; charset=$blog_charset", true);
|
616 |
} else {
|
617 |
$gzipped = false;
|
@@ -629,10 +661,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
629 |
function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
|
630 |
$this->add_post_types();
|
631 |
$comment = __( "dynamically", 'all_in_one_seo_pack' );
|
632 |
-
if ( $this->options[
|
633 |
-
$posttypes = $this->options[
|
634 |
if ( empty( $posttypes ) ) $posttypes = Array();
|
635 |
-
$taxonomies = $this->options[
|
636 |
if ( empty( $taxonomies ) ) $taxonomies = Array();
|
637 |
if ( $sitemap_type === 'root' ) {
|
638 |
$this->output_sitemap_index( array_merge( $this->get_sitemap_index_filenames() ), $comment );
|
@@ -645,15 +677,15 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
645 |
} elseif ( in_array( $sitemap_type, $posttypes ) ) {
|
646 |
$this->output_sitemap( $this->get_all_post_priority_data( $sitemap_type, 'publish', $page ), $comment );
|
647 |
} elseif ( in_array( $sitemap_type, $taxonomies ) ) {
|
648 |
-
$this->output_sitemap( $this->get_term_priority_data( get_terms( $sitemap_type, $this->get_tax_args() ) ), $comment );
|
649 |
}
|
650 |
} elseif ( $sitemap_type === 'root' ) echo $this->do_simple_sitemap( $comment );
|
651 |
}
|
652 |
|
653 |
/** Build a url to the sitemap. **/
|
654 |
function get_sitemap_url() {
|
655 |
-
$url = get_home_url() . '/' . $this->options["
|
656 |
-
if ( $this->options[
|
657 |
return $url;
|
658 |
}
|
659 |
|
@@ -690,28 +722,28 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
690 |
|
691 |
/** Build static sitemaps on submit if rewrite rules are not in use, do logging. **/
|
692 |
function do_sitemaps() {
|
693 |
-
if ( !empty( $this->options[
|
694 |
$this->paginate = true;
|
695 |
-
if ( ( $this->options[
|
696 |
-
$this->max_posts = $this->options[
|
697 |
else
|
698 |
$this->max_posts = 50000;
|
699 |
} else {
|
700 |
$this->paginate = false;
|
701 |
$this->max_posts = 50000;
|
702 |
}
|
703 |
-
if ( !$this->options[
|
704 |
-
if ( $this->options[
|
705 |
$this->do_indexed_sitemaps();
|
706 |
} else {
|
707 |
$this->log_start();
|
708 |
-
$comment = sprintf( __( "file '%s' statically", 'all_in_one_seo_pack' ), $this->options[
|
709 |
$sitemap = $this->do_simple_sitemap( $comment );
|
710 |
-
$this->write_sitemaps( $this->options[
|
711 |
-
$this->log_stats( 'root', $this->options[
|
712 |
}
|
713 |
} else {
|
714 |
-
delete_transient(
|
715 |
}
|
716 |
$this->do_notify();
|
717 |
$this->debug_message( __( 'Updated sitemap settings.', 'all_in_one_seo_pack' ) );
|
@@ -727,7 +759,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
727 |
/** Write sitemaps (compressed or otherwise) to the filesystem. **/
|
728 |
function write_sitemaps( $filename, $contents ) {
|
729 |
$this->write_sitemap( $filename . ".xml", $contents );
|
730 |
-
if ( $this->options[
|
731 |
}
|
732 |
|
733 |
/** Write a single sitemap to the filesystem, handle compression. **/
|
@@ -777,22 +809,20 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
777 |
function get_sitemap_index_filenames() {
|
778 |
$files = Array();
|
779 |
$options = $this->options;
|
780 |
-
$prefix = $options["
|
781 |
$suffix = '.xml';
|
782 |
-
if ( $options[
|
783 |
-
if ( empty( $options[
|
784 |
-
if ( empty( $options[
|
785 |
-
$options[
|
786 |
-
$options[
|
787 |
$url_base = trailingslashit( get_home_url() );
|
788 |
$files[] = Array( 'loc' => $url_base . $prefix . '_addl' . $suffix );
|
789 |
-
if ( !empty( $options[
|
790 |
$prio = $this->get_default_priority( 'post' );
|
791 |
$freq = $this->get_default_frequency( 'post' );
|
792 |
-
|
793 |
-
|
794 |
-
}
|
795 |
-
foreach( $options['aiosp_sitemap_posttypes'] as $sm ) {
|
796 |
if ( $post_counts[$sm] == 0 ) continue;
|
797 |
if ( $this->paginate ) {
|
798 |
if ( $post_counts[$sm] > $this->max_posts ) {
|
@@ -804,15 +834,27 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
804 |
} else
|
805 |
$files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $prio, 'changefreq' => $freq );
|
806 |
}
|
807 |
-
|
808 |
}
|
809 |
if ( $this->option_isset( 'archive' ) )
|
810 |
$files[] = Array( 'loc' => $url_base . $prefix . '_archive' . $suffix, 'priority' => $this->get_default_priority( 'archive' ), 'changefreq' => $this->get_default_frequency( 'archive' ) );
|
811 |
if ( $this->option_isset( 'author' ) )
|
812 |
$files[] = Array( 'loc' => $url_base . $prefix . '_author' . $suffix, 'priority' => $this->get_default_priority( 'author' ), 'changefreq' => $this->get_default_frequency( 'author' ) );
|
813 |
-
|
814 |
-
|
815 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
816 |
foreach( $this->get_child_sitemap_urls() as $csm )
|
817 |
$files[] = Array( 'loc' => $csm, 'priority' => $this->get_default_priority( 'sitemap' ), 'changefreq' => $this->get_default_frequency( 'sitemap' ) );
|
818 |
return $files;
|
@@ -823,52 +865,77 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
823 |
$this->start_memory_usage = memory_get_peak_usage();
|
824 |
$options = $this->options;
|
825 |
$comment = __( "file '%s' statically", 'all_in_one_seo_pack' );
|
826 |
-
$this->write_sitemaps( $options[
|
827 |
-
$this->build_sitemap_index( $this->get_sitemap_index_filenames() ), sprintf( $comment, $options[
|
828 |
-
$this->write_sitemaps( $options[
|
829 |
-
$this->build_sitemap( $this->get_addl_pages(), sprintf( $comment, $options[
|
830 |
-
if ( ( !isset( $options[
|
831 |
-
if ( ( !isset( $options[
|
832 |
-
$options[
|
833 |
-
$options[
|
834 |
|
835 |
-
if ( !empty( $options[
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
if ( $this->paginate && ( $post_counts[$posttype] > $this->max_posts ) ) {
|
840 |
$count = 1;
|
841 |
for( $post_count = 0; $post_count < $post_counts[$posttype]; $post_count += $this->max_posts ) {
|
842 |
-
$comment = sprintf( $comment, $options[
|
843 |
-
$this->write_sitemaps( $options[
|
844 |
$this->build_sitemap( $this->get_all_post_priority_data( $posttype, 'publish', ( $count - 1 ) ), $comment ) );
|
845 |
$count++;
|
846 |
}
|
847 |
} else {
|
848 |
-
$comment = sprintf( $comment, $options[
|
849 |
-
$this->write_sitemaps( $options[
|
850 |
$this->build_sitemap( $this->get_all_post_priority_data( $posttype ), $comment ) );
|
851 |
}
|
852 |
}
|
853 |
}
|
854 |
|
855 |
if ( $this->option_isset( 'archive') ) {
|
856 |
-
$comment = sprintf( $comment, $options[
|
857 |
-
$this->write_sitemaps( $options[
|
858 |
$this->build_sitemap( $this->get_archive_prio_data(), $comment ) );
|
859 |
}
|
860 |
if ( $this->option_isset( 'author') ) {
|
861 |
-
$comment = sprintf( $comment, $options[
|
862 |
-
$this->write_sitemaps( $options[
|
863 |
$this->build_sitemap( $this->get_author_prio_data(), $comment ) );
|
864 |
}
|
865 |
-
if ( !empty( $options[
|
866 |
-
foreach ( $options[
|
867 |
-
|
868 |
-
|
869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
}
|
871 |
-
|
|
|
872 |
}
|
873 |
|
874 |
/** Build a single, stand-alone sitemap without indexes. **/
|
@@ -879,6 +946,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
879 |
'changefreq' => $this->get_default_frequency( 'homepage' )
|
880 |
);
|
881 |
$posts = get_option( 'page_for_posts' );
|
|
|
882 |
if ( $posts ) {
|
883 |
$posts = $this->get_permalink( $posts );
|
884 |
if ( $posts == $home['loc'] )
|
@@ -892,11 +960,11 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
892 |
}
|
893 |
$child = $this->get_child_sitemap_urls();
|
894 |
$options = $this->options;
|
895 |
-
if ( is_array( $options[
|
896 |
-
$options[
|
897 |
-
if ( is_array( $options[
|
898 |
-
$options[
|
899 |
-
$prio = $this->get_all_post_priority_data( $options[
|
900 |
if ( $this->option_isset( 'archive' ) ) $prio = array_merge( $prio, $this->get_archive_prio_data() );
|
901 |
if ( $this->option_isset( 'author' ) ) $prio = array_merge( $prio, $this->get_author_prio_data() );
|
902 |
foreach ( $prio as $k => $p )
|
@@ -915,7 +983,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
915 |
}
|
916 |
if ( is_array( $posts ) ) array_unshift( $prio, $posts );
|
917 |
if ( is_array( $home ) ) array_unshift( $prio, $home );
|
918 |
-
$terms = get_terms( $options[
|
919 |
$prio2 = $this->get_term_priority_data( $terms );
|
920 |
$prio3 = $this->get_addl_pages_only();
|
921 |
$prio = array_merge( $child, $prio, $prio2, $prio3 );
|
@@ -936,8 +1004,18 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
936 |
$plugin_url['host'] = $current_host;
|
937 |
$plugin_path = $this->unparse_url( $plugin_url );
|
938 |
}
|
939 |
-
|
940 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
$count = 0;
|
942 |
foreach ( $urls as $url ) {
|
943 |
echo "\t<url>\r\n";
|
@@ -945,14 +1023,32 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
945 |
foreach ( $url as $k => $v ) {
|
946 |
if ( !empty( $v ) ) {
|
947 |
if ( $k == 'loc' ) $v = esc_url( $v );
|
948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
}
|
950 |
}
|
951 |
} else {
|
952 |
echo "\t\t<loc>" . esc_url( $url ) . "</loc>\r\n";
|
953 |
}
|
954 |
echo "\t</url>\r\n";
|
955 |
-
$count++;
|
956 |
if ( $count >= $max_items ) break;
|
957 |
}
|
958 |
echo '</urlset>';
|
@@ -1084,7 +1180,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1084 |
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
1085 |
return "$scheme$user$pass$host$port$path$query$fragment";
|
1086 |
}
|
1087 |
-
|
1088 |
/** Return data for user entered additional pages. **/
|
1089 |
function get_addl_pages_only() {
|
1090 |
$pages = Array();
|
@@ -1104,6 +1200,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1104 |
$pages[] = Array( 'loc' => $this->unparse_url( $url ), 'lastmod' => $mod, 'changefreq' => $freq, 'priority' => $prio );
|
1105 |
}
|
1106 |
}
|
|
|
1107 |
return $pages;
|
1108 |
}
|
1109 |
|
@@ -1132,6 +1229,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1132 |
$pages[] = $home;
|
1133 |
if ( !empty( $posts ) )
|
1134 |
$pages[] = $posts;
|
|
|
1135 |
return $pages;
|
1136 |
}
|
1137 |
|
@@ -1261,6 +1359,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1261 |
/** Generate sitemap priority data from an array of posts. **/
|
1262 |
function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
|
1263 |
$prio = Array();
|
|
|
1264 |
if ( ( $prio_override ) && ( $freq_override ) )
|
1265 |
$stats = 0;
|
1266 |
else
|
@@ -1295,17 +1394,24 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1295 |
if ( $freq_override )
|
1296 |
$pr_info[ 'changefreq' ] = $freq_override;
|
1297 |
$pr_info['loc'] = $url;
|
1298 |
-
$
|
|
|
|
|
1299 |
}
|
1300 |
}
|
1301 |
return $prio;
|
1302 |
}
|
1303 |
|
1304 |
/** Return excluded categories for taxonomy queries. **/
|
1305 |
-
function get_tax_args() {
|
1306 |
$args = Array();
|
1307 |
if ( $this->option_isset( 'excl_categories' ) )
|
1308 |
$args['exclude'] = $this->options[ $this->prefix . 'excl_categories'];
|
|
|
|
|
|
|
|
|
|
|
1309 |
return $args;
|
1310 |
}
|
1311 |
|
@@ -1411,9 +1517,26 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1411 |
return get_permalink( $post );
|
1412 |
}
|
1413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1414 |
/** Return post counts using wp_count_posts(). **/
|
1415 |
function get_all_post_counts( $args ) {
|
1416 |
-
$post_counts =
|
1417 |
$status = 'inherit';
|
1418 |
if ( !empty( $args['post_status'] ) ) $status = $args['post_status'];
|
1419 |
if ( !empty( $args ) && !empty( $args['post_type'] ) )
|
@@ -1421,17 +1544,35 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1421 |
if ( is_array( $args['post_type'] ) )
|
1422 |
$args['post_type'] = array_shift( $args['post_type'] );
|
1423 |
$count = (Array)wp_count_posts( $args['post_type'] );
|
1424 |
-
$post_counts
|
1425 |
} else
|
1426 |
foreach( $args['post_type'] as $post_type ) {
|
|
|
1427 |
$count = (Array)wp_count_posts( $post_type );
|
1428 |
-
if ( $
|
1429 |
-
$post_counts[$post_type] =
|
1430 |
-
else
|
1431 |
-
$
|
|
|
|
|
|
|
|
|
1432 |
}
|
|
|
1433 |
return $post_counts;
|
1434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1435 |
|
1436 |
/** Return post data using get_posts(). **/
|
1437 |
function get_all_post_type_data( $args ) {
|
@@ -1468,7 +1609,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1468 |
/*
|
1469 |
if ( version_compare( $wp_version, '3.5', '>=' ) ) {
|
1470 |
$args['meta_query'] = Array(
|
1471 |
-
Array( 'key' => '_aioseop_sitemap_exclude', 'value' => '
|
1472 |
);
|
1473 |
} else {
|
1474 |
*/
|
@@ -1477,11 +1618,11 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1477 |
$ex_args['meta_value'] = 'on';
|
1478 |
$ex_args['meta_compare'] = '=';
|
1479 |
$ex_args['fields'] = 'ids';
|
1480 |
-
$ex_args['posts_per_page'] = -1;
|
1481 |
$q = new WP_Query( $ex_args );
|
1482 |
if ( !is_array( $args['exclude'] ) ) $args['exclude'] = explode( ',', $args['exclude'] );
|
1483 |
if ( !empty( $q->posts ) ) $args['exclude'] = array_merge( $args['exclude'], $q->posts );
|
1484 |
-
//}
|
|
|
1485 |
$posts = get_posts( apply_filters( $this->prefix . 'post_query', $args ) );
|
1486 |
if ( !empty( $exclude_slugs ) ) {
|
1487 |
foreach( $posts as $k => $v ) {
|
@@ -1494,3 +1635,4 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
|
|
1494 |
}
|
1495 |
}
|
1496 |
}
|
|
15 |
var $paginate = false;
|
16 |
|
17 |
function All_in_One_SEO_Pack_Sitemap( ) {
|
18 |
+
if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
|
19 |
+
$this->name = __( 'XML Sitemap', 'all_in_one_seo_pack' ); // Human-readable name of the plugin
|
20 |
+
$this->prefix = 'aiosp_sitemap_'; // option prefix
|
21 |
+
$this->file = __FILE__; // the current file
|
22 |
+
}
|
23 |
parent::__construct();
|
24 |
$this->comment_string = __( "Sitemap %s generated by All in One SEO Pack %s by Michael Torbert of Semper Fi Web Design on %s", 'all_in_one_seo_pack' );
|
25 |
|
53 |
'bing' => Array( 'name' => __( 'Notify Bing', 'all_in_one_seo_pack') ),
|
54 |
'indexes' => Array( 'name' => __( 'Enable Sitemap Indexes', 'all_in_one_seo_pack' ) ),
|
55 |
'paginate' => Array( 'name' => __( 'Paginate Sitemap Indexes', 'all_in_one_seo_pack' ),
|
56 |
+
'condshow' => Array( "{$this->prefix}indexes" => 'on' ) ),
|
57 |
'max_posts' => Array( 'name' => __( 'Maximum Posts Per Sitemap', 'all_in_one_seo_pack' ),
|
58 |
'type' => 'text', 'default' => 50000,
|
59 |
+
'condshow' => Array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ) ),
|
60 |
'posttypes' => Array( 'name' => __( 'Post Types', 'all_in_one_seo_pack'),
|
61 |
'type' => 'multicheckbox', 'default' => 'all' ),
|
62 |
'taxonomies'=> Array( 'name' => __( 'Taxonomies', 'all_in_one_seo_pack' ),
|
155 |
if ( !empty( $help_text ) )
|
156 |
foreach( $help_text as $k => $v )
|
157 |
$this->default_options[$k]['help_text'] = $v;
|
158 |
+
|
159 |
+
add_action( 'init', Array( $this, 'load_sitemap_options' ) );
|
160 |
+
add_action( $this->prefix . 'settings_update', Array( $this, 'do_sitemaps' ) );
|
161 |
+
add_filter( $this->prefix . 'display_settings', Array( $this, 'update_post_data' ) );
|
162 |
+
add_filter( $this->prefix . 'display_options', Array( $this, 'filter_display_options' ) );
|
163 |
+
add_filter( $this->prefix . 'update_options', Array( $this, 'filter_options' ) );
|
164 |
+
add_filter( $this->prefix . 'output_option', Array( $this, 'display_custom_options' ), 10, 2 );
|
165 |
+
}
|
166 |
+
|
167 |
+
/** Initialize options, after constructor **/
|
168 |
+
function load_sitemap_options() {
|
169 |
// load initial options / set defaults
|
170 |
$this->update_options( );
|
171 |
+
if ( !empty( $this->options["{$this->prefix}paginate"] ) ) {
|
|
|
172 |
$this->paginate = true;
|
173 |
+
if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
|
174 |
+
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
175 |
}
|
176 |
|
177 |
+
if ( is_multisite() ) $this->options["{$this->prefix}rewrite"] = 'On';
|
178 |
|
179 |
+
if ( $this->options["{$this->prefix}rewrite"] ) $this->setup_rewrites();
|
180 |
|
181 |
if ( $this->option_isset( 'robots' ) )
|
182 |
add_action( 'do_robots', Array( $this, 'do_robots' ), 100 );
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
/** Custom settings - displays boxes for add pages to sitemap option. **/
|
186 |
function display_custom_options( $buf, $args ) {
|
187 |
+
if ( $args['name'] == "{$this->prefix}addl_pages" ) {
|
188 |
+
$buf .= "<div id='{$this->prefix}addl_pages'>";
|
189 |
if ( !empty( $args['value'] ) ) {
|
190 |
$buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
|
191 |
foreach ( $args['value'] as $k => $v ) {
|
206 |
return $buf;
|
207 |
}
|
208 |
|
209 |
+
// original code thanks to Sean M. Brown -- http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/
|
210 |
+
function is_good_bot() {
|
211 |
+
$botlist = Array(
|
212 |
+
"Yahoo! Slurp" => "crawl.yahoo.net",
|
213 |
+
"googlebot" => ".googlebot.com",
|
214 |
+
"msnbot" => "search.msn.com"
|
215 |
+
);
|
216 |
+
$botlist = apply_filters( $this->prefix . "botlist", $botlist );
|
217 |
+
if ( !empty( $botlist ) )
|
218 |
+
$ua = $_SERVER['HTTP_USER_AGENT'];
|
219 |
+
$uas = join( '|', array_map( 'preg_quote', array_keys( $botlist ) ) );
|
220 |
+
if ( preg_match( '/' . $uas . '/i', $ua ) ) {
|
221 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
222 |
+
$hostname = gethostbyaddr( $ip );
|
223 |
+
$ip_by_hostname = gethostbyname( $hostname );
|
224 |
+
if ( $ip_by_hostname == $ip ) {
|
225 |
+
$hosts = array_values( $botlist );
|
226 |
+
foreach( $hosts as $k => $h )
|
227 |
+
$hosts[$k] = preg_quote( $h ) . '$';
|
228 |
+
$hosts = join( '|', $hosts );
|
229 |
+
if ( preg_match( '/' . $hosts . '/i', $hostname ) )
|
230 |
+
return true;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
return false;
|
234 |
+
}
|
235 |
+
|
236 |
/** Add post type details for settings once post types have been registered. **/
|
237 |
function add_post_types() {
|
238 |
$post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
|
310 |
$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.",
|
311 |
'all_in_one_seo_pack' ), $privacy_link );
|
312 |
}
|
313 |
+
if ( $this->option_isset( 'debug' ) ) $options["{$this->prefix}debug"] = '<pre>' . $options["{$this->prefix}debug"] . '</pre>';
|
314 |
return $options;
|
315 |
}
|
316 |
|
317 |
/** Handle 'all' option for post types / taxonomies, further sanitization of filename, rewrites on for multisite, setting up addl pages option. **/
|
318 |
function filter_options( $options ) {
|
319 |
+
if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
|
320 |
+
$options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
|
321 |
+
if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
|
322 |
+
$options["{$this->prefix}taxonomies"] = array_keys( $this->default_options['taxonomies' ]['initial_options'] );
|
323 |
$opt = $this->prefix . 'filename';
|
324 |
if ( isset( $options[$opt] ) && !empty( $options[$opt] ) )
|
325 |
$options[$opt] = str_replace( '/', '', $options[$opt] );
|
386 |
}
|
387 |
}
|
388 |
if ( !$siteurl ) $siteurl = get_home_url( $blog_id );
|
389 |
+
$url = $siteurl . '/' . $sitemap_options["{$this->prefix}filename"] . '.xml';
|
390 |
+
if ( $sitemap_options["{$this->prefix}gzipped"] ) $url .= '.gz';
|
391 |
$siteurls[] = $url;
|
392 |
}
|
393 |
}
|
400 |
$scan1 = $scan2 = '';
|
401 |
$files = Array();
|
402 |
|
403 |
+
if ( !empty( $this->options["{$this->prefix}filename"] ) ) {
|
404 |
+
$scan1 = get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml';
|
405 |
+
if ( !empty( $this->options["{$this->prefix}gzipped"] ) )
|
406 |
+
$scan2 .= get_home_path() . $this->options["{$this->prefix}filename"] . '*.xml.gz';
|
407 |
|
408 |
if ( empty( $scan1 ) && empty( $scan2 ) ) return $files;
|
409 |
$home_path = get_home_path();
|
425 |
/** Handle deleting / renaming of conflicting sitemap files. **/
|
426 |
function do_sitemap_scan() {
|
427 |
$msg = '';
|
428 |
+
if ( !empty( $this->options["{$this->prefix}rewrite"] ) && ( get_option('permalink_structure') == '' ) ) {
|
429 |
$msg = '<p>' . __( 'Warning: dynamic sitemap generation must have permalinks enabled.', 'all_in_one_seo_pack' ) . '</p>';
|
430 |
}
|
431 |
if ( !empty( $_POST['aioseop_sitemap_rename_files'] ) || !empty( $_POST['aioseop_sitemap_delete_files'] ) ) {
|
464 |
if ( !empty( $msg ) )
|
465 |
$this->output_error( $msg );
|
466 |
}
|
467 |
+
|
468 |
/** Do the scan, return the results. **/
|
469 |
function scan_sitemaps() {
|
470 |
$msg = '';
|
505 |
$matches = Array();
|
506 |
if ( preg_match( "/<!-- " . sprintf( $this->comment_string, '(.*)', '(.*)', '(.*)' ) . " -->/",
|
507 |
$file, $matches ) ) {
|
508 |
+
if ( !empty( $this->options["{$this->prefix}rewrite"] ) ) {
|
509 |
$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' ),
|
510 |
$f, $matches[2], $matches[3] ) . "</p>\n";
|
511 |
$problem_files[] = $f;
|
539 |
|
540 |
/** Updates debug log messages. **/
|
541 |
function debug_message( $msg ) {
|
542 |
+
if ( empty( $this->options["{$this->prefix}debug"] ) ) $this->options["{$this->prefix}debug"] = '';
|
543 |
+
$this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
|
544 |
+
if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
|
545 |
+
$end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
|
546 |
if ( $end === false ) $end = 2048;
|
547 |
+
$this->options["{$this->prefix}debug"] = $this->substr( $this->options["{$this->prefix}debug"], 0, $end );
|
548 |
}
|
549 |
$this->update_class_option( $this->options );
|
550 |
}
|
554 |
add_action( 'rewrite_rules_array', Array( $this, 'rewrite_hook' ) );
|
555 |
add_filter( 'query_vars', Array( $this, 'query_var_hook' ) );
|
556 |
add_action( 'parse_query', Array( $this, 'sitemap_output_hook') );
|
557 |
+
if ( !get_transient( "{$this->prefix}rules_flushed" ) )
|
558 |
add_action( 'wp_loaded', Array($this, 'flush_rules_hook' ) );
|
559 |
}
|
560 |
|
562 |
function get_rewrite_rules() {
|
563 |
$sitemap_rules_normal = $sitemap_rules_gzipped = Array();
|
564 |
$sitemap_rules_normal = array(
|
565 |
+
$this->options["{$this->prefix}filename"] . '.xml' => "index.php?{$this->prefix}path=root",
|
566 |
+
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml'=> 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
|
567 |
+
$this->options["{$this->prefix}filename"] . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]'
|
568 |
);
|
569 |
+
if ( $this->options["{$this->prefix}gzipped"] ) {
|
570 |
$sitemap_rules_gzipped = array(
|
571 |
+
$this->options["{$this->prefix}filename"] . '.xml.gz' => "index.php?{$this->prefix}gzipped=1&{$this->prefix}path=root.gz",
|
572 |
+
$this->options["{$this->prefix}filename"] . '_(.+)_(\d+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz&' . $this->prefix . 'page=$matches[2]',
|
573 |
+
$this->options["{$this->prefix}filename"] . '_(.+).xml.gz' => 'index.php?' . $this->prefix . 'path=$matches[1].gz'
|
574 |
);
|
575 |
}
|
576 |
$sitemap_rules = $sitemap_rules_gzipped + $sitemap_rules_normal;
|
594 |
$rule = key( $sitemap_rules );
|
595 |
if ( !isset( $rules[ $rule ] ) || ( $rules[ $rule ] != $sitemap_rules[ $rule ] ) ) {
|
596 |
$wp_rewrite->flush_rules();
|
597 |
+
set_transient( "{$this->prefix}rules_flushed", true, 43200 );
|
598 |
}
|
599 |
}
|
600 |
}
|
601 |
|
602 |
/** Add our query variable for sitemap generation. **/
|
603 |
function query_var_hook($vars) {
|
604 |
+
$vars[] = "{$this->prefix}path";
|
605 |
if ( $this->paginate )
|
606 |
+
$vars[] = "{$this->prefix}page";
|
607 |
return $vars;
|
608 |
}
|
609 |
|
631 |
/** Handle outputting of dynamic sitemaps, logging. **/
|
632 |
function sitemap_output_hook($query) {
|
633 |
$page = 0;
|
634 |
+
if ( ( $this->options["{$this->prefix}rewrite"] ) )
|
635 |
+
if( !empty( $query->query_vars["{$this->prefix}path"] ) ) {
|
636 |
+
if( !empty( $query->query_vars["{$this->prefix}page"] ) )
|
637 |
+
$page = $query->query_vars["{$this->prefix}page"] - 1;
|
638 |
$this->start_memory_usage = memory_get_peak_usage();
|
639 |
+
$sitemap_type = $query->query_vars["{$this->prefix}path"];
|
640 |
$gzipped = false;
|
641 |
if ( $this->substr( $sitemap_type, -3 ) === '.gz' ) {
|
642 |
$gzipped = true;
|
643 |
$sitemap_type = $this->substr( $sitemap_type, 0, -3 );
|
644 |
}
|
645 |
$blog_charset = get_option( 'blog_charset' );
|
646 |
+
if ( $this->options["{$this->prefix}gzipped"] && $gzipped ) {
|
647 |
header( "Content-Type: application/x-gzip; charset=$blog_charset", true);
|
648 |
} else {
|
649 |
$gzipped = false;
|
661 |
function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
|
662 |
$this->add_post_types();
|
663 |
$comment = __( "dynamically", 'all_in_one_seo_pack' );
|
664 |
+
if ( $this->options["{$this->prefix}indexes"] ) {
|
665 |
+
$posttypes = $this->options["{$this->prefix}posttypes"];
|
666 |
if ( empty( $posttypes ) ) $posttypes = Array();
|
667 |
+
$taxonomies = $this->options["{$this->prefix}taxonomies"];
|
668 |
if ( empty( $taxonomies ) ) $taxonomies = Array();
|
669 |
if ( $sitemap_type === 'root' ) {
|
670 |
$this->output_sitemap_index( array_merge( $this->get_sitemap_index_filenames() ), $comment );
|
677 |
} elseif ( in_array( $sitemap_type, $posttypes ) ) {
|
678 |
$this->output_sitemap( $this->get_all_post_priority_data( $sitemap_type, 'publish', $page ), $comment );
|
679 |
} elseif ( in_array( $sitemap_type, $taxonomies ) ) {
|
680 |
+
$this->output_sitemap( $this->get_term_priority_data( get_terms( $sitemap_type, $this->get_tax_args( $page ) ) ), $comment );
|
681 |
}
|
682 |
} elseif ( $sitemap_type === 'root' ) echo $this->do_simple_sitemap( $comment );
|
683 |
}
|
684 |
|
685 |
/** Build a url to the sitemap. **/
|
686 |
function get_sitemap_url() {
|
687 |
+
$url = get_home_url() . '/' . $this->options["{$this->prefix}filename"] . '.xml';
|
688 |
+
if ( $this->options["{$this->prefix}gzipped"] ) $url .= '.gz';
|
689 |
return $url;
|
690 |
}
|
691 |
|
722 |
|
723 |
/** Build static sitemaps on submit if rewrite rules are not in use, do logging. **/
|
724 |
function do_sitemaps() {
|
725 |
+
if ( !empty( $this->options["{$this->prefix}paginate"] ) ) {
|
726 |
$this->paginate = true;
|
727 |
+
if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
|
728 |
+
$this->max_posts = $this->options["{$this->prefix}max_posts"];
|
729 |
else
|
730 |
$this->max_posts = 50000;
|
731 |
} else {
|
732 |
$this->paginate = false;
|
733 |
$this->max_posts = 50000;
|
734 |
}
|
735 |
+
if ( !$this->options["{$this->prefix}rewrite"] ) {
|
736 |
+
if ( $this->options["{$this->prefix}indexes"] ) {
|
737 |
$this->do_indexed_sitemaps();
|
738 |
} else {
|
739 |
$this->log_start();
|
740 |
+
$comment = sprintf( __( "file '%s' statically", 'all_in_one_seo_pack' ), $this->options["{$this->prefix}filename"] );
|
741 |
$sitemap = $this->do_simple_sitemap( $comment );
|
742 |
+
$this->write_sitemaps( $this->options["{$this->prefix}filename"], $sitemap );
|
743 |
+
$this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false );
|
744 |
}
|
745 |
} else {
|
746 |
+
delete_transient( "{$this->prefix}rules_flushed" );
|
747 |
}
|
748 |
$this->do_notify();
|
749 |
$this->debug_message( __( 'Updated sitemap settings.', 'all_in_one_seo_pack' ) );
|
759 |
/** Write sitemaps (compressed or otherwise) to the filesystem. **/
|
760 |
function write_sitemaps( $filename, $contents ) {
|
761 |
$this->write_sitemap( $filename . ".xml", $contents );
|
762 |
+
if ( $this->options["{$this->prefix}gzipped"] ) $this->write_sitemap( $filename . ".xml.gz", $contents, true );
|
763 |
}
|
764 |
|
765 |
/** Write a single sitemap to the filesystem, handle compression. **/
|
809 |
function get_sitemap_index_filenames() {
|
810 |
$files = Array();
|
811 |
$options = $this->options;
|
812 |
+
$prefix = $options["{$this->prefix}filename"];
|
813 |
$suffix = '.xml';
|
814 |
+
if ( $options["{$this->prefix}gzipped"] ) $suffix .= '.gz';
|
815 |
+
if ( empty( $options["{$this->prefix}posttypes"] ) ) $options["{$this->prefix}posttypes"] = Array();
|
816 |
+
if ( empty( $options["{$this->prefix}taxonomies"] ) ) $options["{$this->prefix}taxonomies"] = Array();
|
817 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) );
|
818 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) );
|
819 |
$url_base = trailingslashit( get_home_url() );
|
820 |
$files[] = Array( 'loc' => $url_base . $prefix . '_addl' . $suffix );
|
821 |
+
if ( !empty( $options["{$this->prefix}posttypes"] ) ) {
|
822 |
$prio = $this->get_default_priority( 'post' );
|
823 |
$freq = $this->get_default_frequency( 'post' );
|
824 |
+
$post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') );
|
825 |
+
foreach( $options["{$this->prefix}posttypes"] as $sm ) {
|
|
|
|
|
826 |
if ( $post_counts[$sm] == 0 ) continue;
|
827 |
if ( $this->paginate ) {
|
828 |
if ( $post_counts[$sm] > $this->max_posts ) {
|
834 |
} else
|
835 |
$files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $prio, 'changefreq' => $freq );
|
836 |
}
|
|
|
837 |
}
|
838 |
if ( $this->option_isset( 'archive' ) )
|
839 |
$files[] = Array( 'loc' => $url_base . $prefix . '_archive' . $suffix, 'priority' => $this->get_default_priority( 'archive' ), 'changefreq' => $this->get_default_frequency( 'archive' ) );
|
840 |
if ( $this->option_isset( 'author' ) )
|
841 |
$files[] = Array( 'loc' => $url_base . $prefix . '_author' . $suffix, 'priority' => $this->get_default_priority( 'author' ), 'changefreq' => $this->get_default_frequency( 'author' ) );
|
842 |
+
|
843 |
+
if ( !empty( $options["{$this->prefix}taxonomies"] ) )
|
844 |
+
foreach( $options["{$this->prefix}taxonomies"] as $sm ) {
|
845 |
+
$term_count = wp_count_terms( $sm, array('hide_empty' => true) );
|
846 |
+
if ( !is_wp_error( $term_count ) && ( $term_count > 0 ) ) {
|
847 |
+
if ( $this->paginate ) {
|
848 |
+
if ( $term_count > $this->max_posts ) {
|
849 |
+
$count = 1;
|
850 |
+
for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
|
851 |
+
$files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . '_' . ( $count++ ) . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) );
|
852 |
+
}
|
853 |
+
} else $files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) );
|
854 |
+
} else
|
855 |
+
$files[] = Array( 'loc' => $url_base . $prefix . '_' . $sm . $suffix, 'priority' => $this->get_default_priority( 'taxonomies' ), 'changefreq' => $this->get_default_frequency( 'taxonomies' ) );
|
856 |
+
}
|
857 |
+
}
|
858 |
foreach( $this->get_child_sitemap_urls() as $csm )
|
859 |
$files[] = Array( 'loc' => $csm, 'priority' => $this->get_default_priority( 'sitemap' ), 'changefreq' => $this->get_default_frequency( 'sitemap' ) );
|
860 |
return $files;
|
865 |
$this->start_memory_usage = memory_get_peak_usage();
|
866 |
$options = $this->options;
|
867 |
$comment = __( "file '%s' statically", 'all_in_one_seo_pack' );
|
868 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"],
|
869 |
+
$this->build_sitemap_index( $this->get_sitemap_index_filenames() ), sprintf( $comment, $options["{$this->prefix}filename"] ) );
|
870 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_addl",
|
871 |
+
$this->build_sitemap( $this->get_addl_pages(), sprintf( $comment, $options["{$this->prefix}filename"] . "_addl" ) ) );
|
872 |
+
if ( ( !isset( $options["{$this->prefix}posttypes"] ) ) || ( !is_array( $options["{$this->prefix}posttypes"] ) ) ) $options["{$this->prefix}posttypes"] = Array();
|
873 |
+
if ( ( !isset( $options["{$this->prefix}taxonomies"] ) ) || ( !is_array( $options["{$this->prefix}taxonomies"] ) ) ) $options["{$this->prefix}taxonomies"] = Array();
|
874 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) );
|
875 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) );
|
876 |
|
877 |
+
if ( !empty( $options["{$this->prefix}posttypes"] ) ) {
|
878 |
+
$post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') );
|
879 |
+
foreach ( $options["{$this->prefix}posttypes"] as $posttype ) {
|
880 |
+
if ( $post_counts[$posttype] === 0 ) continue;
|
881 |
if ( $this->paginate && ( $post_counts[$posttype] > $this->max_posts ) ) {
|
882 |
$count = 1;
|
883 |
for( $post_count = 0; $post_count < $post_counts[$posttype]; $post_count += $this->max_posts ) {
|
884 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" );
|
885 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_{$posttype}_{$count}",
|
886 |
$this->build_sitemap( $this->get_all_post_priority_data( $posttype, 'publish', ( $count - 1 ) ), $comment ) );
|
887 |
$count++;
|
888 |
}
|
889 |
} else {
|
890 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$posttype" );
|
891 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_$posttype",
|
892 |
$this->build_sitemap( $this->get_all_post_priority_data( $posttype ), $comment ) );
|
893 |
}
|
894 |
}
|
895 |
}
|
896 |
|
897 |
if ( $this->option_isset( 'archive') ) {
|
898 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_archive" );
|
899 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_archive",
|
900 |
$this->build_sitemap( $this->get_archive_prio_data(), $comment ) );
|
901 |
}
|
902 |
if ( $this->option_isset( 'author') ) {
|
903 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_author" );
|
904 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_author",
|
905 |
$this->build_sitemap( $this->get_author_prio_data(), $comment ) );
|
906 |
}
|
907 |
+
if ( !empty( $options["{$this->prefix}taxonomies"] ) )
|
908 |
+
foreach ( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
|
909 |
+
|
910 |
+
}
|
911 |
+
|
912 |
+
if ( !empty( $options["{$this->prefix}taxonomies"] ) )
|
913 |
+
foreach( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
|
914 |
+
$term_count = wp_count_terms( $taxonomy, array('hide_empty' => true) );
|
915 |
+
if ( !is_wp_error( $term_count ) && ( $term_count > 0 ) ) {
|
916 |
+
if ( $this->paginate ) {
|
917 |
+
if ( $term_count > $this->max_posts ) {
|
918 |
+
$count = 1;
|
919 |
+
for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
|
920 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy_$count" );
|
921 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy_$count",
|
922 |
+
$this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args( $tc ) ), $comment ) ) );
|
923 |
+
$count++;
|
924 |
+
}
|
925 |
+
} else {
|
926 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy" );
|
927 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy",
|
928 |
+
$this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args() ), $comment ) ) );
|
929 |
+
}
|
930 |
+
} else {
|
931 |
+
$comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy" );
|
932 |
+
$this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy",
|
933 |
+
$this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args() ), $comment ) ) );
|
934 |
+
}
|
935 |
+
}
|
936 |
}
|
937 |
+
|
938 |
+
$this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false );
|
939 |
}
|
940 |
|
941 |
/** Build a single, stand-alone sitemap without indexes. **/
|
946 |
'changefreq' => $this->get_default_frequency( 'homepage' )
|
947 |
);
|
948 |
$posts = get_option( 'page_for_posts' );
|
949 |
+
$this->paginate = false;
|
950 |
if ( $posts ) {
|
951 |
$posts = $this->get_permalink( $posts );
|
952 |
if ( $posts == $home['loc'] )
|
960 |
}
|
961 |
$child = $this->get_child_sitemap_urls();
|
962 |
$options = $this->options;
|
963 |
+
if ( is_array( $options["{$this->prefix}posttypes"] ) )
|
964 |
+
$options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) );
|
965 |
+
if ( is_array( $options["{$this->prefix}taxonomies"] ) )
|
966 |
+
$options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) );
|
967 |
+
$prio = $this->get_all_post_priority_data( $options["{$this->prefix}posttypes"] );
|
968 |
if ( $this->option_isset( 'archive' ) ) $prio = array_merge( $prio, $this->get_archive_prio_data() );
|
969 |
if ( $this->option_isset( 'author' ) ) $prio = array_merge( $prio, $this->get_author_prio_data() );
|
970 |
foreach ( $prio as $k => $p )
|
983 |
}
|
984 |
if ( is_array( $posts ) ) array_unshift( $prio, $posts );
|
985 |
if ( is_array( $home ) ) array_unshift( $prio, $home );
|
986 |
+
$terms = get_terms( $options["{$this->prefix}taxonomies"], $this->get_tax_args() );
|
987 |
$prio2 = $this->get_term_priority_data( $terms );
|
988 |
$prio3 = $this->get_addl_pages_only();
|
989 |
$prio = array_merge( $child, $prio, $prio2, $prio3 );
|
1004 |
$plugin_url['host'] = $current_host;
|
1005 |
$plugin_path = $this->unparse_url( $plugin_url );
|
1006 |
}
|
1007 |
+
$xml_header = '<?xml-stylesheet type="text/xsl" href="' . $plugin_path . 'sitemap.xsl"?>' . "\r\n"
|
1008 |
+
. '<urlset ';
|
1009 |
+
$namespaces = apply_filters( $this->prefix . 'xml_namespace', Array( 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' ) );
|
1010 |
+
if ( !empty( $namespaces ) ) {
|
1011 |
+
$ns = Array();
|
1012 |
+
foreach( $namespaces as $k => $v ) {
|
1013 |
+
$ns[] = esc_attr( $k ) . '=' . '"' . esc_url( $v ) . '"';
|
1014 |
+
}
|
1015 |
+
$xml_header .= join( "\r\n\t", $ns );
|
1016 |
+
}
|
1017 |
+
$xml_header .= '>' . "\r\n";
|
1018 |
+
echo $xml_header;
|
1019 |
$count = 0;
|
1020 |
foreach ( $urls as $url ) {
|
1021 |
echo "\t<url>\r\n";
|
1023 |
foreach ( $url as $k => $v ) {
|
1024 |
if ( !empty( $v ) ) {
|
1025 |
if ( $k == 'loc' ) $v = esc_url( $v );
|
1026 |
+
if ( is_array( $v ) ) {
|
1027 |
+
$buf = "\t\t\t<$k>\r\n";
|
1028 |
+
foreach( $v as $ext => $attr ) {
|
1029 |
+
if ( is_array( $attr ) ) {
|
1030 |
+
$buf = '';
|
1031 |
+
echo "\t\t<$k>\r\n";
|
1032 |
+
foreach( $attr as $a => $nested ) {
|
1033 |
+
if ( is_array( $nested ) ) {
|
1034 |
+
echo "\t\t\t<$a>\r\n";
|
1035 |
+
foreach( $nested as $next => $nattr ) {
|
1036 |
+
echo "\t\t\t\t<$next>$nattr</$next>\r\n";
|
1037 |
+
}
|
1038 |
+
echo "\t\t\t</$a>\r\n";
|
1039 |
+
} else echo "\t\t\t<$a>$nested</$a>\r\n";
|
1040 |
+
}
|
1041 |
+
echo "\t\t</$k>\r\n";
|
1042 |
+
} else $buf .= "\t\t\t<$ext>$attr</$ext>\r\n";
|
1043 |
+
}
|
1044 |
+
if ( !empty( $buf ) ) echo $buf . "\t\t</$k>\r\n";
|
1045 |
+
} else echo "\t\t<$k>$v</$k>\r\n";
|
1046 |
}
|
1047 |
}
|
1048 |
} else {
|
1049 |
echo "\t\t<loc>" . esc_url( $url ) . "</loc>\r\n";
|
1050 |
}
|
1051 |
echo "\t</url>\r\n";
|
|
|
1052 |
if ( $count >= $max_items ) break;
|
1053 |
}
|
1054 |
echo '</urlset>';
|
1180 |
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
1181 |
return "$scheme$user$pass$host$port$path$query$fragment";
|
1182 |
}
|
1183 |
+
|
1184 |
/** Return data for user entered additional pages. **/
|
1185 |
function get_addl_pages_only() {
|
1186 |
$pages = Array();
|
1200 |
$pages[] = Array( 'loc' => $this->unparse_url( $url ), 'lastmod' => $mod, 'changefreq' => $freq, 'priority' => $prio );
|
1201 |
}
|
1202 |
}
|
1203 |
+
$pages = apply_filters( $this->prefix . 'addl_pages_only', $pages );
|
1204 |
return $pages;
|
1205 |
}
|
1206 |
|
1229 |
$pages[] = $home;
|
1230 |
if ( !empty( $posts ) )
|
1231 |
$pages[] = $posts;
|
1232 |
+
$pages = apply_filters( $this->prefix . 'addl_pages', $pages );
|
1233 |
return $pages;
|
1234 |
}
|
1235 |
|
1359 |
/** Generate sitemap priority data from an array of posts. **/
|
1360 |
function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
|
1361 |
$prio = Array();
|
1362 |
+
$args = Array( 'prio_override' => $prio_override, 'freq_override' => $freq_override, 'linkfunc' => $linkfunc );
|
1363 |
if ( ( $prio_override ) && ( $freq_override ) )
|
1364 |
$stats = 0;
|
1365 |
else
|
1394 |
if ( $freq_override )
|
1395 |
$pr_info[ 'changefreq' ] = $freq_override;
|
1396 |
$pr_info['loc'] = $url;
|
1397 |
+
$pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args );
|
1398 |
+
if ( !empty( $pr_info ) )
|
1399 |
+
$prio[] = $pr_info;
|
1400 |
}
|
1401 |
}
|
1402 |
return $prio;
|
1403 |
}
|
1404 |
|
1405 |
/** Return excluded categories for taxonomy queries. **/
|
1406 |
+
function get_tax_args( $page = 0 ) {
|
1407 |
$args = Array();
|
1408 |
if ( $this->option_isset( 'excl_categories' ) )
|
1409 |
$args['exclude'] = $this->options[ $this->prefix . 'excl_categories'];
|
1410 |
+
if ( $this->paginate ) {
|
1411 |
+
$args['number'] = $this->max_posts;
|
1412 |
+
$args['offset'] = $page * $this->max_posts;
|
1413 |
+
|
1414 |
+
}
|
1415 |
return $args;
|
1416 |
}
|
1417 |
|
1517 |
return get_permalink( $post );
|
1518 |
}
|
1519 |
|
1520 |
+
/** Return term counts using wp_count_terms(). **/
|
1521 |
+
function get_all_term_counts( $args ) {
|
1522 |
+
$term_counts = null;
|
1523 |
+
if ( !empty( $args ) && !empty( $args['taxonomy'] ) )
|
1524 |
+
if ( !is_array( $args['taxonomy'] ) || ( count( $args['taxonomy'] ) == 1 ) ) {
|
1525 |
+
if ( is_array( $args['taxonomy'] ) )
|
1526 |
+
$args['taxonomy'] = array_shift( $args['taxonomy'] );
|
1527 |
+
$term_counts = wp_count_terms( $args['taxonomy'], array('hide_empty' => true) );
|
1528 |
+
} else
|
1529 |
+
foreach( $args['taxonomy'] as $taxonomy ) {
|
1530 |
+
if ( $taxonomy === 'all' ) continue;
|
1531 |
+
$term_counts[$taxonomy] = wp_count_terms( $taxonomy, array('hide_empty' => true) );
|
1532 |
+
}
|
1533 |
+
$term_counts = apply_filters( $this->prefix . 'term_counts', $term_counts, $args );
|
1534 |
+
return $term_counts;
|
1535 |
+
}
|
1536 |
+
|
1537 |
/** Return post counts using wp_count_posts(). **/
|
1538 |
function get_all_post_counts( $args ) {
|
1539 |
+
$post_counts = null;
|
1540 |
$status = 'inherit';
|
1541 |
if ( !empty( $args['post_status'] ) ) $status = $args['post_status'];
|
1542 |
if ( !empty( $args ) && !empty( $args['post_type'] ) )
|
1544 |
if ( is_array( $args['post_type'] ) )
|
1545 |
$args['post_type'] = array_shift( $args['post_type'] );
|
1546 |
$count = (Array)wp_count_posts( $args['post_type'] );
|
1547 |
+
$post_counts = $count[$status];
|
1548 |
} else
|
1549 |
foreach( $args['post_type'] as $post_type ) {
|
1550 |
+
if ( $post_type === 'all' ) continue;
|
1551 |
$count = (Array)wp_count_posts( $post_type );
|
1552 |
+
if ( empty( $count ) )
|
1553 |
+
$post_counts[$post_type] = 0;
|
1554 |
+
else {
|
1555 |
+
if ( $post_type == 'attachment' )
|
1556 |
+
$post_counts[$post_type] = $count['inherit'];
|
1557 |
+
else
|
1558 |
+
$post_counts[$post_type] = $count[$status];
|
1559 |
+
}
|
1560 |
}
|
1561 |
+
$post_counts = apply_filters( $this->prefix . 'post_counts', $post_counts, $args );
|
1562 |
return $post_counts;
|
1563 |
}
|
1564 |
+
|
1565 |
+
function get_total_post_count( $args ) {
|
1566 |
+
$total = 0;
|
1567 |
+
$counts = $this->get_all_post_counts( $args );
|
1568 |
+
if ( !empty( $counts ) )
|
1569 |
+
if ( is_array( $counts ) )
|
1570 |
+
foreach( $counts as $count )
|
1571 |
+
$total += $count;
|
1572 |
+
else
|
1573 |
+
$total = $counts;
|
1574 |
+
return $total;
|
1575 |
+
}
|
1576 |
|
1577 |
/** Return post data using get_posts(). **/
|
1578 |
function get_all_post_type_data( $args ) {
|
1609 |
/*
|
1610 |
if ( version_compare( $wp_version, '3.5', '>=' ) ) {
|
1611 |
$args['meta_query'] = Array(
|
1612 |
+
Array( 'key' => '_aioseop_sitemap_exclude', 'value' => '', 'compare' => 'NOT EXISTS' )
|
1613 |
);
|
1614 |
} else {
|
1615 |
*/
|
1618 |
$ex_args['meta_value'] = 'on';
|
1619 |
$ex_args['meta_compare'] = '=';
|
1620 |
$ex_args['fields'] = 'ids';
|
|
|
1621 |
$q = new WP_Query( $ex_args );
|
1622 |
if ( !is_array( $args['exclude'] ) ) $args['exclude'] = explode( ',', $args['exclude'] );
|
1623 |
if ( !empty( $q->posts ) ) $args['exclude'] = array_merge( $args['exclude'], $q->posts );
|
1624 |
+
// }
|
1625 |
+
|
1626 |
$posts = get_posts( apply_filters( $this->prefix . 'post_query', $args ) );
|
1627 |
if ( !empty( $exclude_slugs ) ) {
|
1628 |
foreach( $posts as $k => $v ) {
|
1635 |
}
|
1636 |
}
|
1637 |
}
|
1638 |
+
|
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. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</a> | <a href="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">Donate</a> | <a href="http://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
|
6 |
-
Version: 2.1.
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
*/
|
@@ -30,11 +30,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30 |
|
31 |
/**
|
32 |
* @package All-in-One-SEO-Pack
|
33 |
-
* @version 2.1.
|
34 |
*/
|
35 |
|
36 |
if ( ! defined( 'AIOSEOP_VERSION' ) )
|
37 |
-
define( 'AIOSEOP_VERSION', '2.1.
|
38 |
|
39 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
40 |
define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
@@ -116,7 +116,7 @@ if ( !empty( $aioseop_mem_limit ) ) {
|
|
116 |
}
|
117 |
|
118 |
$aiosp_activation = false;
|
119 |
-
$aioseop_module_list = Array( 'sitemap', 'opengraph', 'performance' ); // list all available modules here
|
120 |
|
121 |
if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
|
122 |
add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
|
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. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</a> | <a href="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">Donate</a> | <a href="http://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
|
6 |
+
Version: 2.1.5
|
7 |
Author: Michael Torbert
|
8 |
Author URI: http://michaeltorbert.com
|
9 |
*/
|
30 |
|
31 |
/**
|
32 |
* @package All-in-One-SEO-Pack
|
33 |
+
* @version 2.1.5
|
34 |
*/
|
35 |
|
36 |
if ( ! defined( 'AIOSEOP_VERSION' ) )
|
37 |
+
define( 'AIOSEOP_VERSION', '2.1.5' );
|
38 |
|
39 |
if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
|
40 |
define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
116 |
}
|
117 |
|
118 |
$aiosp_activation = false;
|
119 |
+
$aioseop_module_list = Array( 'sitemap', 'opengraph', 'importer_exporter', 'performance' ); // list all available modules here
|
120 |
|
121 |
if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
|
122 |
add_action( 'admin_notices', create_function( '', 'echo "<div class=\'error\'>The All In One SEO Pack class is already defined";'
|
images/ImporterExporter-BW-Retina.png
ADDED
Binary file
|
images/ImporterExporter-BW-Standard.png
ADDED
Binary file
|
images/ImporterExporter-Color-Retina.png
ADDED
Binary file
|
images/ImporterExporter-Color-Standard.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: hallsofmontezuma
|
|
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: all in one, all in one seo, all in one seo pack, seo, search engine optimization, google
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
All in One SEO Pack is a WordPress SEO plugin to automatically optimize your
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
All in One SEO Pack **Optimizes** your
|
14 |
|
15 |
**[Upgrade to Pro Version](http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/)**
|
16 |
|
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: all in one, all in one seo, all in one seo pack, seo, search engine optimization, google
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 3.9
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
All in One SEO Pack is a WordPress SEO plugin to automatically optimize your WordPress blog for Search Engines such as Google.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
All in One SEO Pack **Optimizes** your WordPress blog for SEO (**Search Engine Optimization**).
|
14 |
|
15 |
**[Upgrade to Pro Version](http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/)**
|
16 |
|