Version Description
- Add XML sitemap feature
- Add HTML sitemap feature
- Add sitemap source: menus (any content), post, page, category, author
- Add HTML sitemap content position in page
- Add XML sitemap copy option on root option
- Add XML sitemap link in robot.txt option
- Add help text for all the sitemap parameters
- Add help text for all the global parameters
- Add AJAX sitemap regeneration
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.1 to 3.0.0
- css/html_sitemap.css +30 -0
- css/jPages.css +40 -0
- css/metaseo_admin.css +5 -0
- css/metaseo_sitemap.css +33 -0
- inc/class.metaseo-admin.php +115 -77
- inc/class.metaseo-broken-link-table.php +0 -4
- inc/class.metaseo-metabox.php +2 -1
- inc/class.metaseo-sitemap.php +1113 -0
- inc/pages/settings.php +76 -50
- inc/pages/sitemaps/metaseo-google-sitemap.php +19 -0
- inc/pages/sitemaps/metaseo-source_menu.php +19 -0
- inc/pages/sitemaps/metaseo-source_pages.php +49 -0
- inc/pages/sitemaps/metaseo-source_posts.php +70 -0
- inc/pages/sitemaps/sitemap_menus.php +7 -0
- js/jPages.js +574 -0
- js/metaseo_admin.js +0 -1
- js/metaseo_sitemap.js +198 -0
- js/site-jPages.js +31 -0
- readme.txt +39 -8
- wp-meta-seo.php +8 -9
- wpms-sitemap.xsl +144 -0
css/html_sitemap.css
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#wpms_sitemap{width:100%; position:relative; clear:both;}
|
2 |
+
#wpms_sitemap div{min-width:200px; width:100%;}
|
3 |
+
#wpms_sitemap h3{font-size:26px; line-height:32px; padding-bottom:0; margin-bottom:8px; width:100%}
|
4 |
+
#wpms_sitemap h4{font-size:18px; line-height:20px; padding-bottom:0; margin-bottom:4px}
|
5 |
+
#wpms_sitemap ul{list-style-type:disc; margin-bottom:0; padding-bottom:15px; margin-before:1em; margin-after:1em; padding-start:40px; font-size:15px; line-height:24px; font-weight:normal; background:none;}
|
6 |
+
#wpms_sitemap ul ul , #sitemap_pages ul{margin-bottom:0; list-style-type:circle;}
|
7 |
+
.wpms_frontend_menus_sitemap li{margin-bottom:0; list-style-type:circle;}
|
8 |
+
#wpms_sitemap li{display:list-item;}
|
9 |
+
.wpms_clearRow{width:100%; height:24px; display:block; clear:both; position:relative;}
|
10 |
+
#credits_link{font-size:12px;}
|
11 |
+
|
12 |
+
/* Columns */
|
13 |
+
/*#wpms_sitemap.columns_2{-moz-column-count: 2; -moz-column-gap: 30px; -webkit-column-count: 2; -webkit-column-gap: 30px; column-count: 2; column-gap: 30px;}
|
14 |
+
#wpms_sitemap.columns_3{-moz-column-count: 3; -moz-column-gap: 25px; -webkit-column-count: 3; -webkit-column-gap: 25px; column-count: 3; column-gap: 25px;}
|
15 |
+
#wpms_sitemap.columns_4{-moz-column-count: 4; -moz-column-gap: 20px; -webkit-column-count: 4; -webkit-column-gap: 20px; column-count: 4; column-gap: 20px;}*/
|
16 |
+
|
17 |
+
/* Responsive */
|
18 |
+
@media screen and (max-width:960px){
|
19 |
+
#wpms_sitemap.columns_4{-moz-column-count: 3 !important; -webkit-column-count: 3 !important; column-count: 3 !important;}
|
20 |
+
}
|
21 |
+
@media screen and (max-width:640px){
|
22 |
+
#wpms_sitemap.columns_3,#wpms_sitemap.columns_4{-moz-column-count: 2 !important; -webkit-column-count: 2 !important; column-count: 2 !important;}
|
23 |
+
}
|
24 |
+
@media screen and (max-width:480px){
|
25 |
+
#wpms_sitemap.columns_4,#wpms_sitemap.columns_3,#wpms_sitemap.columns_2{-moz-column-count: 1 !important; -webkit-column-count: 1 !important; column-count: 1 !important;}
|
26 |
+
}
|
27 |
+
.wpms_li_cate{
|
28 |
+
font-weight:bold;
|
29 |
+
font-size: 14px;
|
30 |
+
}
|
css/jPages.css
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.holder {
|
2 |
+
margin: 15px 0;
|
3 |
+
}
|
4 |
+
|
5 |
+
.holder_sitemaps{
|
6 |
+
text-align: center;
|
7 |
+
}
|
8 |
+
|
9 |
+
.holder a {
|
10 |
+
font-size: 12px;
|
11 |
+
cursor: pointer;
|
12 |
+
margin: 0 5px;
|
13 |
+
color: #333;
|
14 |
+
}
|
15 |
+
|
16 |
+
.holder a:hover {
|
17 |
+
background-color: #222;
|
18 |
+
color: #fff;
|
19 |
+
}
|
20 |
+
|
21 |
+
.holder a.jp-previous { margin-right: 15px; border-bottom:0 !important ; box-shadow: 0 0 0 0 currentColor !important; }
|
22 |
+
.holder a.jp-next { margin-left: 15px;border-bottom:0 !important ; box-shadow: 0 0 0 0 currentColor !important;}
|
23 |
+
|
24 |
+
.holder a.jp-current, a.jp-current:hover {
|
25 |
+
color: #FF4242;
|
26 |
+
font-weight: bold;
|
27 |
+
}
|
28 |
+
|
29 |
+
.holder a.jp-disabled, a.jp-disabled:hover {
|
30 |
+
color: #bbb;
|
31 |
+
}
|
32 |
+
|
33 |
+
.holder a.jp-current, a.jp-current:hover,
|
34 |
+
.holder a.jp-disabled, a.jp-disabled:hover {
|
35 |
+
cursor: default;
|
36 |
+
background: none;
|
37 |
+
}
|
38 |
+
|
39 |
+
.holder span { margin: 0 5px; }
|
40 |
+
.wpms_li_cate{list-style: none;}
|
css/metaseo_admin.css
CHANGED
@@ -606,4 +606,9 @@ strong {
|
|
606 |
|
607 |
.wpms_change_follow{
|
608 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
609 |
}
|
606 |
|
607 |
.wpms_change_follow{
|
608 |
cursor: pointer;
|
609 |
+
}
|
610 |
+
|
611 |
+
.metaseo-qtip {
|
612 |
+
font-size: 14px !important;
|
613 |
+
line-height: 18px !important;
|
614 |
}
|
css/metaseo_sitemap.css
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wrap_sitemap_option{
|
2 |
+
width: 100%;
|
3 |
+
float: left;
|
4 |
+
}
|
5 |
+
|
6 |
+
.wpms_save_create_sitemaps , .spinner_save_sitemaps{
|
7 |
+
float: left;
|
8 |
+
}
|
9 |
+
|
10 |
+
.div_wpms_save_sitemaps{
|
11 |
+
width: 100%;
|
12 |
+
margin-top: 10px;
|
13 |
+
float: left;
|
14 |
+
}
|
15 |
+
|
16 |
+
.div_sitemap_check_all{
|
17 |
+
width: 100%;
|
18 |
+
float: left;
|
19 |
+
margin: 10px 10px 0px 0px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.wpms_wrap .nav-tab{
|
23 |
+
cursor: pointer;
|
24 |
+
}
|
25 |
+
|
26 |
+
.wpms_source_menu , .wpms_source_posts , .wpms_source_pages{
|
27 |
+
display: none;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wpms_row_check_all_posts{
|
31 |
+
font-style: italic;
|
32 |
+
font-weight: bold;
|
33 |
+
}
|
inc/class.metaseo-admin.php
CHANGED
@@ -46,7 +46,9 @@ class MetaSeo_Admin {
|
|
46 |
//register ajax update meta handler...
|
47 |
add_action( 'wp_ajax_updateContentMeta', array($this, 'updateContentMeta_callback') );
|
48 |
add_action('admin_init', array($this,'metaseo_field_settings'));
|
49 |
-
|
|
|
|
|
50 |
add_action('init', array($this,'wpms_load_langguage'));
|
51 |
|
52 |
if(!get_option('wpms_set_ignore', false)){
|
@@ -64,77 +66,96 @@ class MetaSeo_Admin {
|
|
64 |
add_action( 'deleted_comment', array('MetaSeo_Broken_Link_Table','wpms_deleted_comment') );
|
65 |
}
|
66 |
|
67 |
-
function
|
68 |
global $wpdb;
|
69 |
-
|
70 |
-
|
71 |
-
$sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}wpms_links`(
|
72 |
-
`id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
73 |
-
`link_url` text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
74 |
-
`link_final_url` text CHARACTER SET latin1 COLLATE latin1_general_cs,
|
75 |
-
`link_url_redirect` text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
76 |
-
`link_text` text NOT NULL DEFAULT '',
|
77 |
-
`source_id` int(20) DEFAULT '0',
|
78 |
-
`type` varchar(100) DEFAULT '',
|
79 |
-
`status_code` varchar(100) DEFAULT '',
|
80 |
-
`status_text` varchar(250) DEFAULT '',
|
81 |
-
`hit` int(20) NOT NULL DEFAULT '1',
|
82 |
-
`redirect` tinyint(1) NOT NULL DEFAULT '0',
|
83 |
-
`broken_indexed` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
84 |
-
`broken_internal` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
85 |
-
`warning` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
86 |
-
`dismissed` tinyint(1) NOT NULL DEFAULT '0',
|
87 |
-
PRIMARY KEY (id))";
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
-
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
|
91 |
-
dbDelta($sql);
|
92 |
-
|
93 |
-
|
94 |
-
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
95 |
-
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'follow' AND TABLE_SCHEMA = '". $wpdb->dbname. "'" );
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
}
|
100 |
-
|
101 |
-
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
102 |
-
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'meta_title' AND TABLE_SCHEMA = '". $wpdb->dbname. "'" );
|
103 |
|
104 |
-
if(empty($row)){
|
105 |
-
$wpdb->query("ALTER TABLE ".$wpdb->prefix."wpms_links ADD meta_title varchar(250) DEFAULT ''");
|
106 |
-
}
|
107 |
-
|
108 |
-
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
109 |
-
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'internal' AND TABLE_SCHEMA = '". $wpdb->dbname."'" );
|
110 |
|
111 |
-
if(empty($row)){
|
112 |
-
$wpdb->query("ALTER TABLE ".$wpdb->prefix."wpms_links ADD internal tinyint(1) DEFAULT 1");
|
113 |
-
}
|
114 |
-
|
115 |
-
// create page 404
|
116 |
-
$sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "posts WHERE post_title = %s" , array("WP Meta SEO 404 Page"));
|
117 |
-
$post_if = $wpdb->get_var($sql);
|
118 |
-
if($post_if < 1){
|
119 |
-
$content = '<div class="wall" style="background-color: #F2F3F7; border: 30px solid #fff; width: 90%; height: 90%; margin: 0 auto;">
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
-
|
138 |
}
|
139 |
|
140 |
function wpms_link_title_field() {
|
@@ -615,19 +636,19 @@ class MetaSeo_Admin {
|
|
615 |
function metaseo_field_settings(){
|
616 |
register_setting('Wp Meta SEO','_metaseo_settings');
|
617 |
add_settings_section('metaseo_dashboard','',array( $this, 'showSettings' ),'metaseo_settings');
|
618 |
-
add_settings_field('metaseo_title_home', __('Homepage meta title', 'wp-meta-seo'), array( $this, 'metaseo_title_home' ), 'metaseo_settings', 'metaseo_dashboard');
|
619 |
-
add_settings_field('metaseo_desc_home', __('Homepage meta description', 'wp-meta-seo'), array( $this, 'metaseo_desc_home' ), 'metaseo_settings', 'metaseo_dashboard');
|
620 |
-
add_settings_field('metaseo_showfacebook', __('Facebook profile URL', 'wp-meta-seo'), array( $this, 'showfacebook' ), 'metaseo_settings', 'metaseo_dashboard');
|
621 |
-
add_settings_field('metaseo_showtwitter', __('Twitter Username', 'wp-meta-seo'), array( $this, 'showtwitter' ), 'metaseo_settings', 'metaseo_dashboard');
|
622 |
-
add_settings_field('metaseo_twitter_card', __('The default card type to use', 'wp-meta-seo'), array( $this, 'showtwittercard' ), 'metaseo_settings', 'metaseo_dashboard');
|
623 |
-
add_settings_field('metaseo_metatitle_tab', __('Meta title as page title', 'wp-meta-seo'), array( $this, 'showmetatitletab' ), 'metaseo_settings', 'metaseo_dashboard');
|
624 |
-
add_settings_field('metaseo_showkeywords', __('Meta keywords', 'wp-meta-seo'), array( $this, 'showkeywords' ), 'metaseo_settings', 'metaseo_dashboard');
|
625 |
-
add_settings_field('metaseo_showtmetablock', __('Meta block edition', 'wp-meta-seo'), array( $this, 'showtmetablock' ), 'metaseo_settings', 'metaseo_dashboard');
|
626 |
-
add_settings_field('metaseo_showsocial', __('Social
|
627 |
-
add_settings_field('metaseo_seovalidate', __('Force SEO validation', 'wp-meta-seo'), array( $this, 'showseovalidate' ), 'metaseo_settings', 'metaseo_dashboard');
|
628 |
-
add_settings_field('metaseo_linkfield', __('Link text field', 'wp-meta-seo'), array( $this, 'showlinkfield' ), 'metaseo_settings', 'metaseo_dashboard');
|
629 |
-
add_settings_field('metaseo_follow', __('Post/Page follow', 'wp-meta-seo'), array( $this, 'showfollow' ), 'metaseo_settings', 'metaseo_dashboard');
|
630 |
-
add_settings_field('metaseo_index', __('Post/Page index', 'wp-meta-seo'), array( $this, 'showindex' ), 'metaseo_settings', 'metaseo_dashboard');
|
631 |
}
|
632 |
|
633 |
public function showmetatitletab(){
|
@@ -881,6 +902,15 @@ class MetaSeo_Admin {
|
|
881 |
array($this, 'load_page'),
|
882 |
null,
|
883 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
array(
|
885 |
'metaseo_dashboard',
|
886 |
'',
|
@@ -961,6 +991,14 @@ class MetaSeo_Admin {
|
|
961 |
function load_page() {
|
962 |
if (isset($_GET['page'])) {
|
963 |
switch ($_GET['page']) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
964 |
case 'metaseo_image_compression':
|
965 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/metaseo-image-compression.php' );
|
966 |
break;
|
46 |
//register ajax update meta handler...
|
47 |
add_action( 'wp_ajax_updateContentMeta', array($this, 'updateContentMeta_callback') );
|
48 |
add_action('admin_init', array($this,'metaseo_field_settings'));
|
49 |
+
|
50 |
+
add_action('admin_init', array($this,'metaseo_create_db'));
|
51 |
+
|
52 |
add_action('init', array($this,'wpms_load_langguage'));
|
53 |
|
54 |
if(!get_option('wpms_set_ignore', false)){
|
66 |
add_action( 'deleted_comment', array('MetaSeo_Broken_Link_Table','wpms_deleted_comment') );
|
67 |
}
|
68 |
|
69 |
+
function metaseo_create_db(){
|
70 |
global $wpdb;
|
71 |
+
$option_v = 'metaseo_db_version2.2.0';
|
72 |
+
$db_installed = get_option( $option_v, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
if(!$db_installed){
|
75 |
+
// create table wpms_links
|
76 |
+
$sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}wpms_links`(
|
77 |
+
`id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
78 |
+
`link_url` text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
79 |
+
`link_final_url` text CHARACTER SET latin1 COLLATE latin1_general_cs,
|
80 |
+
`link_url_redirect` text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
|
81 |
+
`link_text` text NOT NULL DEFAULT '',
|
82 |
+
`source_id` int(20) DEFAULT '0',
|
83 |
+
`type` varchar(100) DEFAULT '',
|
84 |
+
`status_code` varchar(100) DEFAULT '',
|
85 |
+
`status_text` varchar(250) DEFAULT '',
|
86 |
+
`hit` int(20) NOT NULL DEFAULT '1',
|
87 |
+
`redirect` tinyint(1) NOT NULL DEFAULT '0',
|
88 |
+
`broken_indexed` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
89 |
+
`broken_internal` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
90 |
+
`warning` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
91 |
+
`dismissed` tinyint(1) NOT NULL DEFAULT '0',
|
92 |
+
PRIMARY KEY (id))";
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
|
96 |
+
dbDelta($sql);
|
|
|
|
|
|
|
|
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
+
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
101 |
+
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'follow' AND TABLE_SCHEMA = '". $wpdb->dbname. "'" );
|
102 |
+
|
103 |
+
if(empty($row)){
|
104 |
+
$wpdb->query("ALTER TABLE ".$wpdb->prefix."wpms_links ADD follow tinyint(1) DEFAULT 1");
|
105 |
+
}
|
106 |
+
|
107 |
+
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
108 |
+
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'meta_title' AND TABLE_SCHEMA = '". $wpdb->dbname. "'" );
|
109 |
+
|
110 |
+
if(empty($row)){
|
111 |
+
$wpdb->query("ALTER TABLE ".$wpdb->prefix."wpms_links ADD meta_title varchar(250) DEFAULT ''");
|
112 |
+
}
|
113 |
+
|
114 |
+
$row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
|
115 |
+
WHERE table_name = '".$wpdb->prefix."wpms_links' AND column_name = 'internal' AND TABLE_SCHEMA = '". $wpdb->dbname."'" );
|
116 |
+
|
117 |
+
if(empty($row)){
|
118 |
+
$wpdb->query("ALTER TABLE ".$wpdb->prefix."wpms_links ADD internal tinyint(1) DEFAULT 1");
|
119 |
+
}
|
120 |
+
|
121 |
+
// create page 404
|
122 |
+
$sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "posts WHERE post_title = %s AND post_excerpt = %s AND post_type = %s" , array("WP Meta SEO 404 Page","metaseo_404_page","page"));
|
123 |
+
$post_if = $wpdb->get_var($sql);
|
124 |
+
if($post_if < 1){
|
125 |
+
$content = '<div class="wall" style="background-color: #F2F3F7; border: 30px solid #fff; width: 90%; height: 90%; margin: 0 auto;">
|
126 |
+
|
127 |
+
<h1 style="text-align: center; font-family:\'open-sans\', arial; color: #444; font-size: 60px; padding: 50px;">ERROR 404 <br />-<br />NOT FOUND</h1>
|
128 |
+
<p style="text-align: center; font-family:\'open-sans\', arial; color: #444; font-size: 40px; padding: 20px; line-height: 55px;">
|
129 |
+
// You may have mis-typed the URL,<br />
|
130 |
+
// Or the page has been removed,<br />
|
131 |
+
// Actually, there is nothing to see here...</p>
|
132 |
+
<p style="text-align: center;"><a style=" font-family:\'open-sans\', arial; color: #444; font-size: 20px; padding: 20px; line-height: 30px; text-decoration: none;" href="'. get_home_url().'"><< Go back to home page >></a></p>
|
133 |
+
</div>';
|
134 |
+
$_page404 = array(
|
135 |
+
'post_title' => 'WP Meta SEO 404 Page',
|
136 |
+
'post_content' => $content,
|
137 |
+
'post_status' => 'publish',
|
138 |
+
'post_excerpt' => 'metaseo_404_page',
|
139 |
+
'post_type' => 'page',
|
140 |
+
);
|
141 |
+
wp_insert_post( $_page404 );
|
142 |
+
}
|
143 |
+
|
144 |
+
$sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "posts WHERE post_title = %s AND post_excerpt = %s AND post_type = %s" , array("WPMS HTML Sitemap","metaseo_html_sitemap","page"));
|
145 |
+
$post_if = $wpdb->get_var($sql);
|
146 |
+
if($post_if < 1){
|
147 |
+
$_sitemap_page = array(
|
148 |
+
'post_title' => 'WPMS HTML Sitemap',
|
149 |
+
'post_content' => '',
|
150 |
+
'post_status' => 'publish',
|
151 |
+
'post_excerpt' => 'metaseo_html_sitemap',
|
152 |
+
'post_type' => 'page',
|
153 |
+
);
|
154 |
+
wp_insert_post( $_sitemap_page );
|
155 |
+
}
|
156 |
+
|
157 |
+
update_option($option_v, true);
|
158 |
}
|
|
|
159 |
}
|
160 |
|
161 |
function wpms_link_title_field() {
|
636 |
function metaseo_field_settings(){
|
637 |
register_setting('Wp Meta SEO','_metaseo_settings');
|
638 |
add_settings_section('metaseo_dashboard','',array( $this, 'showSettings' ),'metaseo_settings');
|
639 |
+
add_settings_field('metaseo_title_home', __('Homepage meta title', 'wp-meta-seo'), array( $this, 'metaseo_title_home' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('You can define your home page meta title in the content itself (a page, a post category…), if for some reason it’s not possible, use this setting' , 'wp-meta-seo') ));
|
640 |
+
add_settings_field('metaseo_desc_home', __('Homepage meta description', 'wp-meta-seo'), array( $this, 'metaseo_desc_home' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('You can define your home page meta description in the content itself (a page, a post category…), if for some reason it’s not possible, use this setting' , 'wp-meta-seo') ));
|
641 |
+
add_settings_field('metaseo_showfacebook', __('Facebook profile URL', 'wp-meta-seo'), array( $this, 'showfacebook' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Used as profile in case of social sharing content on Facebook' , 'wp-meta-seo') ));
|
642 |
+
add_settings_field('metaseo_showtwitter', __('Twitter Username', 'wp-meta-seo'), array( $this, 'showtwitter' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Used as profile in case of social sharing content on Twitter' , 'wp-meta-seo') ));
|
643 |
+
add_settings_field('metaseo_twitter_card', __('The default card type to use', 'wp-meta-seo'), array( $this, 'showtwittercard' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Choose the Twitter card size generated when sharing a content' , 'wp-meta-seo') ));
|
644 |
+
add_settings_field('metaseo_metatitle_tab', __('Meta title as page title', 'wp-meta-seo'), array( $this, 'showmetatitletab' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Usually not recommended as meta information is for search engines and content title for readers, but in some case... :)' , 'wp-meta-seo') ));
|
645 |
+
add_settings_field('metaseo_showkeywords', __('Meta keywords', 'wp-meta-seo'), array( $this, 'showkeywords' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Not used directly by search engine to index content, but in some case it can be helpful (multilingual is an example)' , 'wp-meta-seo') ));
|
646 |
+
add_settings_field('metaseo_showtmetablock', __('Meta block edition', 'wp-meta-seo'), array( $this, 'showtmetablock' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Load the onpage meta edition and analysis block' , 'wp-meta-seo') ));
|
647 |
+
add_settings_field('metaseo_showsocial', __('Social sharing block', 'wp-meta-seo'), array( $this, 'showsocial' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Activate the custom social sharing tool, above the meta block' , 'wp-meta-seo') ));
|
648 |
+
add_settings_field('metaseo_seovalidate', __('Force SEO validation', 'wp-meta-seo'), array( $this, 'showseovalidate' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Possibility to force a criteria validation in the content analysis tool' , 'wp-meta-seo') ));
|
649 |
+
add_settings_field('metaseo_linkfield', __('Link text field', 'wp-meta-seo'), array( $this, 'showlinkfield' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Add the link title field in the text editor and in the bulk link edition view' , 'wp-meta-seo') ));
|
650 |
+
add_settings_field('metaseo_follow', __('Post/Page follow', 'wp-meta-seo'), array( $this, 'showfollow' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Add an option to setup Follow/Nofollow instruction for each content' , 'wp-meta-seo') ));
|
651 |
+
add_settings_field('metaseo_index', __('Post/Page index', 'wp-meta-seo'), array( $this, 'showindex' ), 'metaseo_settings', 'metaseo_dashboard' , array( 'label_for' => __('Add an option to say to search engine: hey! Do not index this content' , 'wp-meta-seo') ));
|
652 |
}
|
653 |
|
654 |
public function showmetatitletab(){
|
902 |
array($this, 'load_page'),
|
903 |
null,
|
904 |
),
|
905 |
+
array(
|
906 |
+
'metaseo_dashboard',
|
907 |
+
'',
|
908 |
+
__('Sitemap', 'wp-meta-seo'),
|
909 |
+
$manage_options_cap,
|
910 |
+
'metaseo_google_sitemap',
|
911 |
+
array($this, 'load_page'),
|
912 |
+
null,
|
913 |
+
),
|
914 |
array(
|
915 |
'metaseo_dashboard',
|
916 |
'',
|
991 |
function load_page() {
|
992 |
if (isset($_GET['page'])) {
|
993 |
switch ($_GET['page']) {
|
994 |
+
case 'metaseo_google_sitemap':
|
995 |
+
if (!class_exists('MetaSeo_Content_List_Table')) {
|
996 |
+
require_once( WPMETASEO_PLUGIN_DIR . '/inc/class.metaseo-sitemap.php' );
|
997 |
+
}
|
998 |
+
|
999 |
+
$metaseo_sitemap = new MetaSeo_Sitemap();
|
1000 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/sitemaps/metaseo-google-sitemap.php' );
|
1001 |
+
break;
|
1002 |
case 'metaseo_image_compression':
|
1003 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/metaseo-image-compression.php' );
|
1004 |
break;
|
inc/class.metaseo-broken-link-table.php
CHANGED
@@ -1432,10 +1432,6 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1432 |
|
1433 |
break;
|
1434 |
case 'comment':
|
1435 |
-
//$comment = get_comment($link_detail->source_id);
|
1436 |
-
//$old_value = $comment->comment_content;
|
1437 |
-
//$edit_result = MetaSeo_Broken_Link_Table::wpms_edit_linkhtml($old_value, $_POST['new_link'], 'http://www.testdev-united.com/wordpress/wp-file-download-sech/' , 'hehe');
|
1438 |
-
//var_dump($edit_result);die();
|
1439 |
wp_update_comment(array('comment_ID' => $link_detail->source_id, 'comment_author_url' => $_POST['new_link']));
|
1440 |
wp_send_json(array('status' => true, 'type' => 'orther', 'status_text' => $status_text, 'new_link' => $_POST['new_link']));
|
1441 |
break;
|
1432 |
|
1433 |
break;
|
1434 |
case 'comment':
|
|
|
|
|
|
|
|
|
1435 |
wp_update_comment(array('comment_ID' => $link_detail->source_id, 'comment_author_url' => $_POST['new_link']));
|
1436 |
wp_send_json(array('status' => true, 'type' => 'orther', 'status_text' => $status_text, 'new_link' => $_POST['new_link']));
|
1437 |
break;
|
inc/class.metaseo-metabox.php
CHANGED
@@ -15,10 +15,11 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
15 |
}
|
16 |
|
17 |
function metaseo_save_postdata($post_id) {
|
|
|
18 |
if ($post_id === null) {
|
19 |
return false;
|
20 |
}
|
21 |
-
|
22 |
if (wp_is_post_revision($post_id)) {
|
23 |
$post_id = wp_is_post_revision($post_id);
|
24 |
}
|
15 |
}
|
16 |
|
17 |
function metaseo_save_postdata($post_id) {
|
18 |
+
|
19 |
if ($post_id === null) {
|
20 |
return false;
|
21 |
}
|
22 |
+
|
23 |
if (wp_is_post_revision($post_id)) {
|
24 |
$post_id = wp_is_post_revision($post_id);
|
25 |
}
|
inc/class.metaseo-sitemap.php
ADDED
@@ -0,0 +1,1113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MetaSeo_Sitemap {
|
4 |
+
|
5 |
+
public $html = '';
|
6 |
+
public $wpms_sitemap_name = 'wpms-sitemap.xml';
|
7 |
+
public $wpms_sitemap_default_name = 'sitemap.xml';
|
8 |
+
public $columns = array('Zezo' , 'One' , 'Two' , 'Three');
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
$this->settings_sitemap = array(
|
12 |
+
"wpms_sitemap_add" => 0,
|
13 |
+
"wpms_sitemap_root" => 0,
|
14 |
+
"wpms_sitemap_author" => 0,
|
15 |
+
"wpms_sitemap_taxonomies" => array(),
|
16 |
+
"wpms_category_link" => array(),
|
17 |
+
"wpms_html_sitemap_page" => 0,
|
18 |
+
"wpms_html_sitemap_column" => 1,
|
19 |
+
"wpms_html_sitemap_position" => "after",
|
20 |
+
"wpms_display_column_menus" => (object)array(0),
|
21 |
+
"wpms_display_column_posts" => 1,
|
22 |
+
"wpms_display_column_pages" => 1,
|
23 |
+
);
|
24 |
+
|
25 |
+
if (is_multisite()) {
|
26 |
+
$home_url = preg_replace("/[^a-zA-ZА-Яа-я0-9\s]/", "_", str_replace('http://', '', str_replace('https://', '', site_url())));
|
27 |
+
$this->settings_sitemap['wpms_sitemap_link'] = site_url() . '/wpms-sitemap_' . $home_url . '.xml';
|
28 |
+
} else {
|
29 |
+
$this->settings_sitemap['wpms_sitemap_link'] = site_url() . '/'.$this->wpms_sitemap_name;
|
30 |
+
}
|
31 |
+
|
32 |
+
$settings = get_option('_metaseo_settings_sitemap');
|
33 |
+
if (is_array($settings)) {
|
34 |
+
$this->settings_sitemap = array_merge($this->settings_sitemap, $settings);
|
35 |
+
}
|
36 |
+
|
37 |
+
add_action('admin_init', array($this, 'metaseo_field_settings_sitemap'));
|
38 |
+
add_action('admin_enqueue_scripts', array($this, 'metaseo_sitemap_scripts'));
|
39 |
+
add_action('wp_enqueue_scripts', array($this, 'site_metaseo_sitemap_scripts'));
|
40 |
+
add_filter('the_content', array($this, 'wpms_html_sitemap_content'));
|
41 |
+
add_shortcode('wpms_html_sitemap', array($this, 'wpms_sitemap_shortcode'));
|
42 |
+
add_action('wp_ajax_wpms_regenerate_sitemaps',array($this,'wpms_regenerate_sitemaps'));
|
43 |
+
add_action('wp_ajax_wpms_save_sitemap_settings',array($this,'wpms_save_sitemap_settings'));
|
44 |
+
}
|
45 |
+
|
46 |
+
public function site_metaseo_sitemap_scripts(){
|
47 |
+
global $post;
|
48 |
+
if(!empty($this->settings_sitemap) && $this->settings_sitemap['wpms_html_sitemap_page'] != $post->ID) return;
|
49 |
+
wp_enqueue_script(
|
50 |
+
'site-jPages-js', plugins_url('js/site-jPages.js', dirname(__FILE__)), array('jquery'), WPMSEO_VERSION, true
|
51 |
+
);
|
52 |
+
wp_localize_script('site-jPages-js', 'wpms_avarible', $this->wpms_localize_script());
|
53 |
+
wp_enqueue_script(
|
54 |
+
'jpage-js', plugins_url('js/jPages.js', dirname(__FILE__)), array('jquery'), WPMSEO_VERSION, true
|
55 |
+
);
|
56 |
+
|
57 |
+
wp_enqueue_style(
|
58 |
+
'jpage-css', plugins_url('css/jPages.css', dirname(__FILE__)), array(), WPMSEO_VERSION
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
public function wpms_localize_script(){
|
63 |
+
$arrays = array('wpms_display_column_menus' => $this->settings_sitemap['wpms_display_column_menus']);
|
64 |
+
return $arrays;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function metaseo_sitemap_scripts(){
|
68 |
+
global $current_screen;
|
69 |
+
if(!empty($current_screen) && $current_screen->base != 'wp-meta-seo_page_metaseo_google_sitemap') return;
|
70 |
+
wp_enqueue_script(
|
71 |
+
'metaseositemap', plugins_url('js/metaseo_sitemap.js', dirname(__FILE__)), array('jquery'), WPMSEO_VERSION, true
|
72 |
+
);
|
73 |
+
|
74 |
+
wp_enqueue_script(
|
75 |
+
'jpage-js', plugins_url('js/jPages.js', dirname(__FILE__)), array('jquery'), WPMSEO_VERSION, true
|
76 |
+
);
|
77 |
+
|
78 |
+
wp_enqueue_style(
|
79 |
+
'metaseositemapstyle', plugins_url('css/metaseo_sitemap.css', dirname(__FILE__)), array(), WPMSEO_VERSION
|
80 |
+
);
|
81 |
+
|
82 |
+
wp_enqueue_style(
|
83 |
+
'jpage-css', plugins_url('css/jPages.css', dirname(__FILE__)), array(), WPMSEO_VERSION
|
84 |
+
);
|
85 |
+
|
86 |
+
wp_enqueue_style('m-style-qtip', plugins_url('css/jquery.qtip.css', dirname(__FILE__)), array(), WPMSEO_VERSION);
|
87 |
+
wp_enqueue_script('jquery-qtip', plugins_url('js/jquery.qtip.min.js', dirname(__FILE__)), array('jquery'), '2.2.1', true);
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
public function metaseo_field_settings_sitemap() {
|
92 |
+
register_setting('MetaSEO Sitemap', '_metaseo_settings_sitemap');
|
93 |
+
add_settings_section('metaseo_sitemap', '', array($this, 'showSettingSitemap'), 'metaseo_settings_sitemap');
|
94 |
+
add_settings_field('wpms_sitemap_link', __('XML sitemap link', 'wp-meta-seo'), array($this, 'wpms_sitemap_link'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('Link to the xml file generated. It’s highly recommended to add this sitemap link to your Google search console' , 'wp-meta-seo') ));
|
95 |
+
add_settings_field('wpms_html_sitemap_page', __('HTML Sitemap page', 'wp-meta-seo'), array($this, 'wpms_html_sitemap_page'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('A page is automatically generated to display your HTML sitemap. You can also use any of the existing pages' , 'wp-meta-seo') ));
|
96 |
+
add_settings_field('wpms_sitemap_taxonomies', __('Additional content', 'wp-meta-seo'), array($this, 'wpms_sitemap_taxonomies'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('The additional WordPress taxonomies that you want to load in your sitemaps' , 'wp-meta-seo') ));
|
97 |
+
add_settings_field('wpms_sitemap_author', __('Display author posts', 'wp-meta-seo'), array($this, 'wpms_sitemap_author'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('You can include a list of posts by author in your sitemaps' , 'wp-meta-seo') ));
|
98 |
+
add_settings_field('wpms_html_sitemap_column', __('HTML Sitemap display', 'wp-meta-seo'), array($this, 'wpms_html_sitemap_column'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('Number of columns of the HTML sitemap. You can also setup where your content will be displayed using the tabs above' , 'wp-meta-seo') ));
|
99 |
+
add_settings_field('wpms_html_sitemap_position', __('HTML Sitemap Position', 'wp-meta-seo'), array($this, 'wpms_html_sitemap_position'), 'metaseo_settings_sitemap', 'metaseo_sitemap');
|
100 |
+
add_settings_field('wpms_sitemap_add', __('Sitemap and robot.txt', 'wp-meta-seo'), array($this, 'wpms_sitemap_add'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('You can include a link to your xml sitemap in the robot.txt. It helps some search engines to find it' , 'wp-meta-seo') ));
|
101 |
+
add_settings_field('wpms_sitemap_root', __('Sitemap root', 'wp-meta-seo'), array($this, 'wpms_sitemap_root'), 'metaseo_settings_sitemap', 'metaseo_sitemap' , array( 'label_for' => __('Add a copy of the lastest version of your .xml sitemap at the root of your WordPress install named sitemap.xml. Some SEO tools and search engines bots are searching for it.' , 'wp-meta-seo') ));
|
102 |
+
}
|
103 |
+
|
104 |
+
public function showSettingSitemap() {
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
public function wpms_sitemap_link() {
|
109 |
+
echo '<input id="wpms_check_firstsave" name="_metaseo_settings_sitemap[wpms_check_firstsave]" type="hidden" value="1">';
|
110 |
+
$wpms_sitemap_link = isset($this->settings_sitemap['wpms_sitemap_link']) ? $this->settings_sitemap['wpms_sitemap_link'] : '';
|
111 |
+
echo '<input readonly id="wpms_sitemap_link" name="_metaseo_settings_sitemap[wpms_sitemap_link]" type="text" value="' . esc_attr($wpms_sitemap_link) . '" size="50"/>';
|
112 |
+
echo '<a class="button" href="' . $wpms_sitemap_link . '" target="_blank">' . __('Open', 'wp-meta-seo') . '</a>';
|
113 |
+
}
|
114 |
+
|
115 |
+
public function wpms_sitemap_add() {
|
116 |
+
?>
|
117 |
+
<?php if (is_multisite()) { ?>
|
118 |
+
<label><input id="wpms_sitemap_add" type='checkbox' disabled="disabled" name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap file path in robots.txt", 'wp-meta-seo'); ?></label>
|
119 |
+
<p style="color:red"><?php _e("Since you are using multisiting, the plugin does not allow to add a sitemap to robots.txt", 'wp-meta-seo'); ?></div>
|
120 |
+
<?php } else { ?>
|
121 |
+
<!-- for robots.txt we need to use site_url instead home_url ! -->
|
122 |
+
<label><input id="wpms_sitemap_add" type='checkbox' name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap link in the", 'wp-meta-seo'); ?> <a href="<?php echo site_url('/'); ?>robots.txt" target="_new">robots.txt</a></label>
|
123 |
+
<?php
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
public function wpms_sitemap_root() {
|
128 |
+
?>
|
129 |
+
<!-- for robots.txt we need to use site_url instead home_url ! -->
|
130 |
+
<label><input id="wpms_sitemap_root" type='checkbox' name='_metaseo_settings_sitemap[wpms_sitemap_root]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_root']); ?> /> <?php _e("Add a sitemap.xml copy @ the site root", 'wp-meta-seo'); ?></label>
|
131 |
+
<?php
|
132 |
+
}
|
133 |
+
|
134 |
+
public function wpms_sitemap_author() {
|
135 |
+
?>
|
136 |
+
<!-- for robots.txt we need to use site_url instead home_url ! -->
|
137 |
+
<label><input id="wpms_sitemap_author" type='checkbox' name='_metaseo_settings_sitemap[wpms_sitemap_author]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_author']); ?> /> <?php _e("Display author post archive", 'wp-meta-seo'); ?></label>
|
138 |
+
<?php
|
139 |
+
}
|
140 |
+
|
141 |
+
public function wpms_sitemap_taxonomies() {
|
142 |
+
$wpms_taxonomies = array(
|
143 |
+
'category' => 'Post category',
|
144 |
+
'post_tag' => 'Post tag'
|
145 |
+
);
|
146 |
+
foreach ($wpms_taxonomies as $key => $value) {
|
147 |
+
?>
|
148 |
+
<label><input class="wpms_sitemap_taxonomies" id="wpms_sitemap_taxonomies_<?php echo $key; ?>" type="checkbox" name="_metaseo_settings_sitemap[wpms_sitemap_taxonomies][]" value="<?php echo $key; ?>" <?php if (in_array($key, $this->settings_sitemap['wpms_sitemap_taxonomies'])) echo 'checked' ?>/><span style="padding-left: 5px;"><?php echo $value; ?></span></label><br />
|
149 |
+
<?php
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
public function wpms_html_sitemap_page() {
|
154 |
+
global $wpdb;
|
155 |
+
$pages = get_pages();
|
156 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_title = %s AND post_excerpt = %s AND post_type = %s", array("WPMS HTML Sitemap", "metaseo_html_sitemap", "page"));
|
157 |
+
$sitemap_page = $wpdb->get_row($sql);
|
158 |
+
|
159 |
+
if (empty($this->settings_sitemap['wpms_html_sitemap_page']) && !empty($sitemap_page))
|
160 |
+
$this->settings_sitemap['wpms_html_sitemap_page'] = $sitemap_page->ID;
|
161 |
+
?>
|
162 |
+
<select id="wpms_html_sitemap_page" name="_metaseo_settings_sitemap[wpms_html_sitemap_page]">
|
163 |
+
<option value="0"><?php _e('- Choose Your Sitemap Page -', 'wp-meta-seo') ?></option>
|
164 |
+
<?php
|
165 |
+
foreach ($pages as $page) {
|
166 |
+
if ($this->settings_sitemap['wpms_html_sitemap_page'] == $page->ID) {
|
167 |
+
echo '<option selected value="' . $page->ID . '">' . $page->post_title . '</option>';
|
168 |
+
} else {
|
169 |
+
echo '<option value="' . $page->ID . '">' . $page->post_title . '</option>';
|
170 |
+
}
|
171 |
+
}
|
172 |
+
?>
|
173 |
+
</select>
|
174 |
+
<?php
|
175 |
+
if (!empty($this->settings_sitemap['wpms_html_sitemap_page'])) {
|
176 |
+
echo '<a class="button" href="' . get_post_permalink($this->settings_sitemap['wpms_html_sitemap_page']) . '" target="_blank">' . __('Open', 'wp-meta-seo') . '</a>';
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
public function wpms_html_sitemap_column() {
|
181 |
+
?>
|
182 |
+
<select id="wpms_html_sitemap_column" name="_metaseo_settings_sitemap[wpms_html_sitemap_column]">
|
183 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_column'], 1) ?> value="1"><?php _e('1 column', 'wp-meta-seo') ?></option>
|
184 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_column'], 2) ?> value="2"><?php _e('2 column', 'wp-meta-seo') ?></option>
|
185 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_column'], 3) ?> value="3"><?php _e('3 column', 'wp-meta-seo') ?></option>
|
186 |
+
</select>
|
187 |
+
<?php
|
188 |
+
}
|
189 |
+
|
190 |
+
public function wpms_html_sitemap_position() {
|
191 |
+
?>
|
192 |
+
<select id="wpms_html_sitemap_position" name="_metaseo_settings_sitemap[wpms_html_sitemap_position]">
|
193 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_position'], 'replace') ?> value="replace"><?php _e('Replace the Page Content', 'wp-meta-seo') ?></option>
|
194 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_position'], 'before') ?> value="before"><?php _e('Before Page Content', 'wp-meta-seo') ?></option>
|
195 |
+
<option <?php selected($this->settings_sitemap['wpms_html_sitemap_position'], 'after') ?> value="after"><?php _e('After Page Content', 'wp-meta-seo') ?></option>
|
196 |
+
</select>
|
197 |
+
<?php
|
198 |
+
}
|
199 |
+
|
200 |
+
function wpms_get_path_filename_sitemap() {
|
201 |
+
if (is_multisite()) {
|
202 |
+
$home_url = preg_replace("/[^a-zA-ZА-Яа-я0-9\s]/", "_", str_replace('http://', '', str_replace('https://', '', site_url())));
|
203 |
+
$xml_file = 'wpms-sitemap_' . $home_url . '.xml';
|
204 |
+
} else {
|
205 |
+
$xml_file = $this->wpms_sitemap_name;
|
206 |
+
}
|
207 |
+
$xml_path = ABSPATH . $xml_file;
|
208 |
+
return array('path' => $xml_path, 'name' => $xml_file);
|
209 |
+
}
|
210 |
+
|
211 |
+
function metaseo_create_sitemap($sitemap_xml_name) {
|
212 |
+
global $wpdb;
|
213 |
+
$taxonomies = array();
|
214 |
+
foreach ($this->settings_sitemap['wpms_sitemap_taxonomies'] as $val) {
|
215 |
+
$taxonomies[] = $val;
|
216 |
+
}
|
217 |
+
|
218 |
+
$xml = new DomDocument('1.0', 'utf-8');
|
219 |
+
$home_url = site_url('/');
|
220 |
+
$xml_stylesheet_path = ( defined('WP_CONTENT_DIR') ) ? $home_url . basename(WP_CONTENT_DIR) : $home_url . 'wp-content';
|
221 |
+
$xml_stylesheet_path .= ( defined('WP_PLUGIN_DIR') ) ? '/' . basename(WP_PLUGIN_DIR) . '/wp-meta-seo/wpms-sitemap.xsl' : '/plugins/wp-meta-seo/sitemap.xsl';
|
222 |
+
|
223 |
+
$xslt = $xml->createProcessingInstruction('xml-stylesheet', "type=\"text/xsl\" href=\"$xml_stylesheet_path\"");
|
224 |
+
$xml->appendChild($xslt);
|
225 |
+
$gglstmp_urlset = $xml->appendChild($xml->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'));
|
226 |
+
|
227 |
+
/* add home page */
|
228 |
+
$url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
229 |
+
$loc = $url->appendChild($xml->createElement('loc'));
|
230 |
+
$loc->appendChild($xml->createTextNode(home_url('/')));
|
231 |
+
$lastmod = $url->appendChild($xml->createElement('lastmod'));
|
232 |
+
$lastmod->appendChild($xml->createTextNode(date('Y-m-d\TH:i:sP', time())));
|
233 |
+
$changefreq = $url->appendChild($xml->createElement('changefreq'));
|
234 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
235 |
+
$priority = $url->appendChild($xml->createElement('priority'));
|
236 |
+
$priority->appendChild($xml->createTextNode(1.0));
|
237 |
+
|
238 |
+
// menus post custom
|
239 |
+
$menus = $this->wpms_get_menus_all();
|
240 |
+
$loc = $menus['posts_custom'];
|
241 |
+
$menu_ids_array = array();
|
242 |
+
if (!empty($loc)) {
|
243 |
+
foreach ($loc as $val) {
|
244 |
+
$sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_menu_item_object_id' AND meta_value=".$val->ID;
|
245 |
+
$menu_object = $wpdb->get_results($sql);
|
246 |
+
if(!empty($menu_object)){
|
247 |
+
foreach ($menu_object as $menu){
|
248 |
+
$menu_id = $menu->post_id;
|
249 |
+
$check_type = get_post_meta($menu_id, '_menu_item_object',true);
|
250 |
+
if($check_type != 'category'){
|
251 |
+
$menu_ids_array[] = $val->ID;
|
252 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
253 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
254 |
+
$permalink = $this->wpms_get_permalink_sitemap($check_type,$val->ID);
|
255 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
256 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
257 |
+
$now = $val->post_modified;
|
258 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
259 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
260 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
261 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
262 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
263 |
+
}else{
|
264 |
+
$changefreq->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->frequency));
|
265 |
+
}
|
266 |
+
|
267 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
268 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
269 |
+
$priority->appendChild($xml->createTextNode('1.0'));
|
270 |
+
}else{
|
271 |
+
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->priority));
|
272 |
+
}
|
273 |
+
}
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
// menus category
|
280 |
+
$loc = $menus['categories'];
|
281 |
+
if (!empty($loc)) {
|
282 |
+
foreach ($loc as $k => $val) {
|
283 |
+
$sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_menu_item_object_id' AND meta_value=".$val;
|
284 |
+
$menu_object = $wpdb->get_results($sql);
|
285 |
+
if(!empty($menu_object)){
|
286 |
+
foreach ($menu_object as $menu){
|
287 |
+
$menu_id = $menu->post_id;
|
288 |
+
$check_type = get_post_meta($menu_id, '_menu_item_object',true);
|
289 |
+
if($check_type == 'category'){
|
290 |
+
$menu_ids_array[] = $val;
|
291 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
292 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
293 |
+
$permalink = get_category_link($val);
|
294 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
295 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
296 |
+
$ps = get_post($menu_id);
|
297 |
+
if(!empty($ps)){
|
298 |
+
$now = $ps->post_modified;
|
299 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
300 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
301 |
+
}
|
302 |
+
|
303 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
304 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
305 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
306 |
+
}else{
|
307 |
+
$changefreq->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->frequency));
|
308 |
+
}
|
309 |
+
|
310 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
311 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
312 |
+
$priority->appendChild($xml->createTextNode('1.0'));
|
313 |
+
}else{
|
314 |
+
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->priority));
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
// posts
|
324 |
+
$loc = $this->wpms_get_posts_sitemap();
|
325 |
+
if (!empty($loc)) {
|
326 |
+
foreach ($loc as $val) {
|
327 |
+
if(!in_array($val->ID, $menu_ids_array)){
|
328 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
329 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
330 |
+
$permalink = get_permalink($val->ID);
|
331 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
332 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
333 |
+
$now = $val->post_modified;
|
334 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
335 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
336 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
337 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
338 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
339 |
+
}else{
|
340 |
+
$changefreq->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_posts']->{$val->ID}->frequency));
|
341 |
+
}
|
342 |
+
|
343 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
344 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
345 |
+
$priority->appendChild($xml->createTextNode('1.0'));
|
346 |
+
}else{
|
347 |
+
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_posts']->{$val->ID}->priority));
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
// pages
|
354 |
+
$loc = $this->wpms_get_pages_sitemap();
|
355 |
+
if (!empty($loc)) {
|
356 |
+
foreach ($loc as $val) {
|
357 |
+
if(!in_array($val->ID, $menu_ids_array)){
|
358 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
359 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
360 |
+
$permalink = get_permalink($val->ID);
|
361 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
362 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
363 |
+
$now = $val->post_modified;
|
364 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
365 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
366 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
367 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
368 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
369 |
+
}else{
|
370 |
+
$changefreq->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_pages']->{$val->ID}->frequency));
|
371 |
+
}
|
372 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
373 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
374 |
+
$priority->appendChild($xml->createTextNode('1.0'));
|
375 |
+
}else{
|
376 |
+
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_pages']->{$val->ID}->priority));
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
// ====
|
383 |
+
if (!empty($taxonomies)) {
|
384 |
+
foreach ($taxonomies as $value) {
|
385 |
+
$terms = get_terms($value, 'hide_empty=1');
|
386 |
+
if (!empty($terms) && !is_wp_error($terms)) {
|
387 |
+
foreach ($terms as $term_value) {
|
388 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
389 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
390 |
+
$permalink = get_term_link((int) $term_value->term_id, $value);
|
391 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
392 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
393 |
+
|
394 |
+
$now = $wpdb->get_var("SELECT `post_modified` FROM $wpdb->posts, $wpdb->term_relationships WHERE `post_status` = 'publish' AND `term_taxonomy_id` = " . $term_value->term_taxonomy_id . " AND $wpdb->posts.ID= $wpdb->term_relationships.object_id ORDER BY `post_modified` DESC");
|
395 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
396 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
397 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
398 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
399 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
400 |
+
$priority->appendChild($xml->createTextNode(1.0));
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
$xml->formatOutput = true;
|
407 |
+
|
408 |
+
if (!is_writable(ABSPATH))
|
409 |
+
@chmod(ABSPATH, 0755);
|
410 |
+
|
411 |
+
if (is_multisite()) {
|
412 |
+
$home_url = preg_replace("/[^a-zA-ZА-Яа-я0-9\s]/", "_", str_replace('http://', '', str_replace('https://', '', site_url())));
|
413 |
+
$xml->save(ABSPATH . 'sitemap_' . $home_url . '.xml');
|
414 |
+
} else {
|
415 |
+
$xml->save(ABSPATH . $sitemap_xml_name);
|
416 |
+
}
|
417 |
+
$this->wpms_sitemap_info();
|
418 |
+
}
|
419 |
+
|
420 |
+
public function wpms_get_permalink_sitemap($type,$id){
|
421 |
+
if(isset($type) && $type == 'custom'){
|
422 |
+
$permalink = get_post_meta($id, '_menu_item_url',true);
|
423 |
+
}elseif($type == 'category'){
|
424 |
+
$permalink = get_category_link($id);
|
425 |
+
}else{
|
426 |
+
$permalink = get_permalink($id);
|
427 |
+
}
|
428 |
+
return $permalink;
|
429 |
+
}
|
430 |
+
|
431 |
+
function wpms_sitemap_info() {
|
432 |
+
$info_file = $this->wpms_get_path_filename_sitemap();
|
433 |
+
$xml_url = site_url('/') . $info_file['name'];
|
434 |
+
if (file_exists($info_file['path'])) {
|
435 |
+
$this->settings_sitemap['sitemap'] = array(
|
436 |
+
'file' => $info_file['name'],
|
437 |
+
'path' => $info_file['path'],
|
438 |
+
'loc' => $xml_url,
|
439 |
+
'lastmod' => date('Y-m-d\TH:i:sP', filemtime($info_file['path']))
|
440 |
+
);
|
441 |
+
update_option('_metaseo_settings_sitemap', $this->settings_sitemap);
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
public function wpms_display_column_posts() {
|
446 |
+
$html = '';
|
447 |
+
//if(!empty($this->settings_sitemap['wpms_sitemap_posts'])){
|
448 |
+
$postsTest = get_posts();
|
449 |
+
$postTitle = get_post_type_object('post');
|
450 |
+
$postTitle = $postTitle->label;
|
451 |
+
|
452 |
+
if (get_option('show_on_front') == 'page') {
|
453 |
+
$postsURL = get_permalink(get_option('page_for_posts'));
|
454 |
+
$postTitle = get_the_title(get_option('page_for_posts'));
|
455 |
+
} else {
|
456 |
+
$postsURL = get_bloginfo('url');
|
457 |
+
}
|
458 |
+
|
459 |
+
if(!empty($this->settings_sitemap['wpms_public_name_posts'])){
|
460 |
+
$postTitle = $this->settings_sitemap['wpms_public_name_posts'];
|
461 |
+
}
|
462 |
+
$html .= '<div id="sitemap_posts" class="wpms_sitemap_posts"><h4>';
|
463 |
+
if ($postsURL !== '' && $postsURL !== get_permalink(@$this->settings_sitemap['wpms_html_sitemap_page'])) {
|
464 |
+
$html .= '<a href="' . $postsURL . '">' . $postTitle . '</a>';
|
465 |
+
} else {
|
466 |
+
$html .= $postTitle;
|
467 |
+
}
|
468 |
+
$html .= '</h4><ul>';
|
469 |
+
|
470 |
+
|
471 |
+
//Categories
|
472 |
+
$ids = array(0);
|
473 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_posts'])){
|
474 |
+
foreach ((array)$this->settings_sitemap['wpms_sitemap_posts'] as $k => $v){
|
475 |
+
if(!empty($v->post_id)){
|
476 |
+
$ids[] = $k;
|
477 |
+
}
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
+
$posts = array();
|
482 |
+
$cats = get_categories();
|
483 |
+
foreach ($cats as $cat) {
|
484 |
+
if(in_array($cat->cat_ID, $this->settings_sitemap['wpms_category_link'])){
|
485 |
+
$cat_link = "<a href='" . esc_url(get_term_link($cat)) . "'>" . $cat->cat_name . "</a>";
|
486 |
+
}else{
|
487 |
+
$cat_link = $cat->cat_name;
|
488 |
+
}
|
489 |
+
$html .= "<li class='wpms_li_cate'><div class='cat_name'>$cat_link</div>";
|
490 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_posts'])){
|
491 |
+
$html .= "<ul>";
|
492 |
+
query_posts(array('post__in' => $ids,'posts_per_page' => -1 , 'cat' => $cat->cat_ID ));
|
493 |
+
while (have_posts()) {
|
494 |
+
the_post();
|
495 |
+
if (( get_post_meta(get_the_ID(), '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) !== 'always' ) || ( get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) === 'never' ) || ( get_post_meta(get_the_ID(), '_yoast_wpms_redirect', true) !== '' )) {
|
496 |
+
continue;
|
497 |
+
}
|
498 |
+
|
499 |
+
$category = get_the_category();
|
500 |
+
// Only display a post link once, even if it's in multiple categories
|
501 |
+
if ($category[0]->cat_ID == $cat->cat_ID) {
|
502 |
+
$html .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
|
503 |
+
}
|
504 |
+
}
|
505 |
+
wp_reset_query();
|
506 |
+
$html .= "</ul>";
|
507 |
+
}
|
508 |
+
$html .= "</li>";
|
509 |
+
}
|
510 |
+
$html .= '</ul></div>';
|
511 |
+
|
512 |
+
|
513 |
+
// ==============================================================================
|
514 |
+
// Custom Post Types
|
515 |
+
foreach (get_post_types(array('public' => true)) as $post_type) {
|
516 |
+
//$postsTest = get_posts('post_type=' . $post_type);
|
517 |
+
$args = array(
|
518 |
+
'posts_per_page' => -1,
|
519 |
+
'post_type' => $post_type,
|
520 |
+
'post__in' => $ids,
|
521 |
+
'post_status' => 'publish'
|
522 |
+
);
|
523 |
+
$query = new WP_Query($args);
|
524 |
+
$postsTest = $query->get_posts();
|
525 |
+
if (!empty($postsTest)) {
|
526 |
+
$checkSitemap = 'post_types-' . $post_type . '-not_in_sitemap';
|
527 |
+
if (( in_array($post_type, array('post', 'page', 'attachment')))) {
|
528 |
+
continue;
|
529 |
+
}
|
530 |
+
$postType = get_post_type_object($post_type);
|
531 |
+
$postTypeLink = get_post_type_archive_link($postType->name);
|
532 |
+
$html .= '<div id="sitemap_' . str_replace(' ', '', strtolower($postType->labels->name)) . '">';
|
533 |
+
if (!empty($postTypeLink)) {
|
534 |
+
$html .= '<h3><a href="' . $postTypeLink . '">' . $postType->labels->name . '</a></h3>';
|
535 |
+
} else {
|
536 |
+
$html .= '<h3>' . $postType->labels->name . '</h3>';
|
537 |
+
}
|
538 |
+
$html .= '<ul>';
|
539 |
+
foreach ($postsTest as $post){
|
540 |
+
if (( get_post_meta(get_the_ID(), '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) !== 'always' ) || ( get_post_meta(get_the_ID(), '_yoast_wpseo_sitemap-include', true) === 'never' ) || ( get_post_meta(get_the_ID(), '_yoast_wpms_redirect', true) !== '' )) {
|
541 |
+
continue;
|
542 |
+
}
|
543 |
+
$html .= '<li><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></li>';
|
544 |
+
}
|
545 |
+
$html .= '</ul></div>';
|
546 |
+
}
|
547 |
+
}
|
548 |
+
$html .= '<div class="holder holder_sitemaps_posts"></div>';
|
549 |
+
//}
|
550 |
+
|
551 |
+
return $html;
|
552 |
+
}
|
553 |
+
|
554 |
+
public function wpms_display_column_pages() {
|
555 |
+
$html = '';
|
556 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_pages'])){
|
557 |
+
$pageCheck = get_pages(array('exclude' => @$this->settings_sitemap['wpms_html_sitemap_page']));
|
558 |
+
$pageTitle = get_post_type_object('page');
|
559 |
+
$pageTitle = $pageTitle->label;
|
560 |
+
if(!empty($this->settings_sitemap['wpms_public_name_pages'])){
|
561 |
+
$pageTitle = $this->settings_sitemap['wpms_public_name_pages'];
|
562 |
+
}
|
563 |
+
$html .= '<div id="sitemap_pages" class="wpms_sitemap_pages"><h4>' . $pageTitle . '</h4>
|
564 |
+
<ul>';
|
565 |
+
$pageInc = '';
|
566 |
+
$getPages = $this->wpms_get_pages_sitemap();
|
567 |
+
foreach ($getPages as $page) {
|
568 |
+
if ($page->ID !== @$this->settings_sitemap['wpms_html_sitemap_page']) {
|
569 |
+
if (( get_post_meta($page->ID, '_yoast_wpseo_meta-robots-noindex', true) === '1' && get_post_meta($page->ID, '_yoast_wpseo_sitemap-include', true) !== 'always' ) || ( get_post_meta($page->ID, '_yoast_wpseo_sitemap-include', true) === 'never' ) || ( get_post_meta($page->ID, '_yoast_wpms_redirect', true) !== '' )) {
|
570 |
+
continue;
|
571 |
+
}
|
572 |
+
if ($pageInc == '') {
|
573 |
+
$pageInc = $page->ID;
|
574 |
+
continue;
|
575 |
+
}
|
576 |
+
$pageInc .= ', ' . $page->ID;
|
577 |
+
}
|
578 |
+
}
|
579 |
+
|
580 |
+
if($pageInc != ''){
|
581 |
+
$html .= wp_list_pages(array('include' => $pageInc, 'title_li' => '', 'sort_column' => 'post_title', 'sort_order' => 'ASC', 'echo' => false));
|
582 |
+
}
|
583 |
+
|
584 |
+
$html .= '</ul></div>';
|
585 |
+
$html .= '<div class="holder holder_sitemaps_pages"></div>';
|
586 |
+
}
|
587 |
+
return $html;
|
588 |
+
}
|
589 |
+
|
590 |
+
public function wpms_sitemap_shortcode() {
|
591 |
+
$html = '';
|
592 |
+
// include style
|
593 |
+
echo '<link rel="stylesheet" type="text/css" href="' . plugin_dir_url(dirname(__FILE__)) . 'css/html_sitemap.css" media="screen" />';
|
594 |
+
$html .= '<div id="wpms_sitemap" class="columns_' . $this->settings_sitemap['wpms_html_sitemap_column'] . '">';
|
595 |
+
|
596 |
+
|
597 |
+
$arrs = array("wpms_display_column_posts" , "wpms_display_column_pages");
|
598 |
+
$checkColumn = array();
|
599 |
+
for($i = 1 ; $i <= $this->settings_sitemap['wpms_html_sitemap_column'] ; $i++){
|
600 |
+
$html .= '<div class="wpms_column wpms_column_'.$i.'" style="width:33%;float:left;">';
|
601 |
+
if($i == 1){
|
602 |
+
// Authors
|
603 |
+
if($this->settings_sitemap['wpms_sitemap_author'] == 1){
|
604 |
+
$html .= '<div id="sitemap_authors"><h3>' . __('Authors') . '</h3>
|
605 |
+
<ul>';
|
606 |
+
|
607 |
+
$authEx = implode(", ", get_users('orderby=nicename&meta_key=wpms_excludeauthorsitemap&meta_value=on'));
|
608 |
+
$html .= wp_list_authors(array('exclude_admin' => false, 'exclude' => $authEx, 'echo' => false));
|
609 |
+
$html .= '</ul></div>';
|
610 |
+
}
|
611 |
+
}
|
612 |
+
|
613 |
+
foreach ($arrs as $arr){
|
614 |
+
if(empty($this->settings_sitemap[$arr])) $this->settings_sitemap[$arr] = 1;
|
615 |
+
if(!in_array($arr, $checkColumn)){
|
616 |
+
if($i == (int)$this->settings_sitemap[$arr]){
|
617 |
+
$checkColumn[] = $arr;
|
618 |
+
$output = $this->{$arr}();
|
619 |
+
$html .= $output;
|
620 |
+
}
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
|
625 |
+
|
626 |
+
$ids_menu = array(0);
|
627 |
+
$check_menu = array();
|
628 |
+
$terms = get_terms(array('taxonomy' => 'nav_menu' , 'hide_empty' => true));
|
629 |
+
foreach ($terms as $term){
|
630 |
+
$list_submenu_id = get_objects_in_term($term->term_id, 'nav_menu');
|
631 |
+
$ids_menu = array_merge($ids_menu , $list_submenu_id);
|
632 |
+
}
|
633 |
+
|
634 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
635 |
+
$this->settings_sitemap['wpms_sitemap_menus'] = $ids_menu;
|
636 |
+
}
|
637 |
+
|
638 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_menus'])){
|
639 |
+
$terms = get_terms(array('taxonomy' => 'nav_menu' , 'hide_empty' => true));
|
640 |
+
if(!empty($terms)){
|
641 |
+
|
642 |
+
|
643 |
+
foreach ($terms as $term){
|
644 |
+
if(!in_array('sitemap_menus_'.$term->term_id, $check_menu)){
|
645 |
+
if(empty($this->settings_sitemap['wpms_display_column_menus']->{$term->term_id})) $this->settings_sitemap['wpms_display_column_menus']->{$term->term_id} = 1;
|
646 |
+
if($i == (int)$this->settings_sitemap['wpms_display_column_menus']->{$term->term_id}){
|
647 |
+
|
648 |
+
$check_menu[] = 'sitemap_menus_'.$term->term_id;
|
649 |
+
$html .= '<div id="sitemap_menus_'.$term->term_id.'" class="wpms_sitemap_menus">';
|
650 |
+
//if(empty($this->settings_sitemap['wpms_display_column_menus']->{$term->term_id})) $this->settings_sitemap['wpms_display_column_menus']->{$term->term_id} = 1;
|
651 |
+
$viewmenu = $this->wpms_view_menus_frontend($term , $ids_menu);
|
652 |
+
$html .= $viewmenu;
|
653 |
+
|
654 |
+
$html .= '</div>';
|
655 |
+
$html .= '<div class="holder holder_sitemaps_menus_'.$term->term_id.'"></div>';
|
656 |
+
}
|
657 |
+
}
|
658 |
+
}
|
659 |
+
}
|
660 |
+
}
|
661 |
+
|
662 |
+
|
663 |
+
|
664 |
+
$html .= '</div>';
|
665 |
+
}
|
666 |
+
|
667 |
+
// ==============================================================================
|
668 |
+
|
669 |
+
$html .= '</div>';
|
670 |
+
$html .= '<div class="wpms_clearRow"></div>';
|
671 |
+
|
672 |
+
return $html;
|
673 |
+
}
|
674 |
+
|
675 |
+
public function wpms_html_sitemap_content($content) {
|
676 |
+
global $wpdb;
|
677 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_title = %s AND post_excerpt = %s AND post_type = %s" , array("WPMS HTML Sitemap","metaseo_html_sitemap","page"));
|
678 |
+
$sitemap_page = $wpdb->get_row($sql);
|
679 |
+
|
680 |
+
if(empty($this->settings_sitemap['wpms_html_sitemap_page']) && !empty($sitemap_page)) $this->settings_sitemap['wpms_html_sitemap_page'] = $sitemap_page->ID;
|
681 |
+
if (!empty($this->settings_sitemap['wpms_html_sitemap_page']) && is_page($this->settings_sitemap['wpms_html_sitemap_page'])) {
|
682 |
+
$sitemap = '[wpms_html_sitemap]';
|
683 |
+
switch ($this->settings_sitemap['wpms_html_sitemap_position']) {
|
684 |
+
case 'after':
|
685 |
+
$content .= $sitemap;
|
686 |
+
break;
|
687 |
+
case 'before':
|
688 |
+
$content = $sitemap . $content;
|
689 |
+
break;
|
690 |
+
case 'replace':
|
691 |
+
$content = $sitemap;
|
692 |
+
break;
|
693 |
+
default :
|
694 |
+
$content .= $sitemap;
|
695 |
+
}
|
696 |
+
}
|
697 |
+
return $content;
|
698 |
+
}
|
699 |
+
|
700 |
+
public function wpms_get_menus_all() {
|
701 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
702 |
+
$post_types = get_post_types( '', 'names' );
|
703 |
+
unset( $gglstmp_result['revision'] );
|
704 |
+
unset( $gglstmp_result['attachment'] );
|
705 |
+
$ids_posts_custom = array(0);
|
706 |
+
$ids_categories = array();
|
707 |
+
|
708 |
+
if(empty($settings_sitemap['wpms_check_firstsave'])){
|
709 |
+
$args = array(
|
710 |
+
'posts_per_page' => -1,
|
711 |
+
'post_type' => 'nav_menu_item',
|
712 |
+
'post_status' => 'publish'
|
713 |
+
);
|
714 |
+
$query = new WP_Query($args);
|
715 |
+
$posts_menu = $query->get_posts();
|
716 |
+
foreach ($posts_menu as $k => $v){
|
717 |
+
$type_menu = get_post_meta($v->ID, '_menu_item_object', true);
|
718 |
+
$post_meta_object_id = get_post_meta($v->ID, '_menu_item_object_id',true);
|
719 |
+
if($type_menu != 'category'){
|
720 |
+
$ids_posts_custom[] = $post_meta_object_id;
|
721 |
+
}else{
|
722 |
+
$ids_categories[] = $post_meta_object_id;
|
723 |
+
}
|
724 |
+
}
|
725 |
+
}else{
|
726 |
+
if(!empty($settings_sitemap['wpms_sitemap_menus'])){
|
727 |
+
foreach ($settings_sitemap['wpms_sitemap_menus'] as $k => $v){
|
728 |
+
if(!empty($v->menu_id)){
|
729 |
+
$type_menu = get_post_meta($k, '_menu_item_object', true);
|
730 |
+
$post_meta_object_id = get_post_meta($k, '_menu_item_object_id',true);
|
731 |
+
if($type_menu != 'category'){
|
732 |
+
$ids_posts_custom[] = $post_meta_object_id;
|
733 |
+
}else{
|
734 |
+
$ids_categories[] = $post_meta_object_id;
|
735 |
+
}
|
736 |
+
}
|
737 |
+
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
|
741 |
+
$args = array(
|
742 |
+
'posts_per_page' => -1,
|
743 |
+
'post_type' => $post_types,
|
744 |
+
'post__in' => $ids_posts_custom,
|
745 |
+
'post_status' => 'publish'
|
746 |
+
);
|
747 |
+
$query = new WP_Query($args);
|
748 |
+
$menus_post_custom = $query->get_posts();
|
749 |
+
return array('posts_custom' => $menus_post_custom , 'categories' => $ids_categories);
|
750 |
+
}
|
751 |
+
|
752 |
+
public function wpms_get_posts_sitemap() {
|
753 |
+
$post_types = $this->wpms_get_post_type();
|
754 |
+
$ids = array(0);
|
755 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
756 |
+
if(!empty($settings_sitemap['wpms_sitemap_posts'])){
|
757 |
+
foreach ((array)$settings_sitemap['wpms_sitemap_posts'] as $k => $v){
|
758 |
+
if(!empty($v->post_id)){
|
759 |
+
$ids[] = $k;
|
760 |
+
}
|
761 |
+
}
|
762 |
+
}
|
763 |
+
|
764 |
+
$args = array(
|
765 |
+
'posts_per_page' => -1,
|
766 |
+
'post_type' => $post_types,
|
767 |
+
'post__in' => $ids,
|
768 |
+
'post_status' => 'publish'
|
769 |
+
);
|
770 |
+
$query = new WP_Query($args);
|
771 |
+
$posts = $query->get_posts();
|
772 |
+
return $posts;
|
773 |
+
}
|
774 |
+
|
775 |
+
public function wpms_get_post_type(){
|
776 |
+
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false));
|
777 |
+
unset($post_types['attachment']);
|
778 |
+
unset($post_types['page']);
|
779 |
+
return $post_types;
|
780 |
+
}
|
781 |
+
|
782 |
+
public function wpms_get_pages_sitemap() {
|
783 |
+
$ids = array(0);
|
784 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
785 |
+
if(!empty($settings_sitemap['wpms_sitemap_pages'])){
|
786 |
+
foreach ($settings_sitemap['wpms_sitemap_pages'] as $k => $v){
|
787 |
+
if(!empty($v->post_id)){
|
788 |
+
$ids[] = $k;
|
789 |
+
}
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
$args = array(
|
794 |
+
'posts_per_page' => -1,
|
795 |
+
'post_type' => 'page',
|
796 |
+
'post__in' => $ids,
|
797 |
+
'post_status' => 'publish'
|
798 |
+
);
|
799 |
+
$query = new WP_Query($args);
|
800 |
+
$pages = $query->get_posts();
|
801 |
+
return $pages;
|
802 |
+
}
|
803 |
+
|
804 |
+
public function wpms_get_posts() {
|
805 |
+
$taxonomies = get_taxonomies();
|
806 |
+
if(!empty($taxonomies['nav_menu'])){
|
807 |
+
unset($taxonomies['nav_menu']);
|
808 |
+
}
|
809 |
+
$posts = array();
|
810 |
+
foreach ($taxonomies as $taxo){
|
811 |
+
$categorys = get_categories(array('hide_empty'=>false,'taxonomy'=>$taxo));
|
812 |
+
|
813 |
+
foreach ($categorys as $cat) {
|
814 |
+
$args = array(
|
815 |
+
'posts_per_page' => -1,
|
816 |
+
'tax_query' => array(
|
817 |
+
array(
|
818 |
+
'taxonomy' => $taxo,
|
819 |
+
'field' => 'slug',
|
820 |
+
'terms' => $cat->slug,
|
821 |
+
),
|
822 |
+
),
|
823 |
+
);
|
824 |
+
$query = new WP_Query( $args );
|
825 |
+
$results = $query->get_posts();
|
826 |
+
if(!empty($results)){
|
827 |
+
$posts[$cat->cat_name.'||'.$cat->cat_ID.'||'.$taxo.'||'.$cat->slug] = $results;
|
828 |
+
}
|
829 |
+
}
|
830 |
+
}
|
831 |
+
|
832 |
+
return $posts;
|
833 |
+
}
|
834 |
+
|
835 |
+
public function wpms_view_menus_frontend($term , $ids_menu) {
|
836 |
+
$html = '';
|
837 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
838 |
+
$list_menus = $ids_menu;
|
839 |
+
}else{
|
840 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_menus'])){
|
841 |
+
foreach ($this->settings_sitemap['wpms_sitemap_menus'] as $k => $v){
|
842 |
+
$list_menus[] = $k;
|
843 |
+
}
|
844 |
+
}
|
845 |
+
}
|
846 |
+
|
847 |
+
$args = array(
|
848 |
+
'orderby' => 'menu_order',
|
849 |
+
'order' => 'ASC',
|
850 |
+
'posts_per_page' => -1,
|
851 |
+
'post_type' => 'nav_menu_item',
|
852 |
+
'post_status' => 'any',
|
853 |
+
'post__in' => $list_menus,
|
854 |
+
'tax_query' => array(
|
855 |
+
array(
|
856 |
+
'taxonomy' => 'nav_menu',
|
857 |
+
'field' => 'slug',
|
858 |
+
'terms' => $term->slug,
|
859 |
+
),
|
860 |
+
),
|
861 |
+
);
|
862 |
+
|
863 |
+
$query = new WP_Query($args);
|
864 |
+
$submenus = $query->get_posts();
|
865 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
866 |
+
if(!empty($submenus)){
|
867 |
+
$html .= '<h4>' . $term->name . '</h4>';
|
868 |
+
$html .= '<ul class="wpms_frontend_menus_sitemap">';
|
869 |
+
foreach ($submenus as $menu) {
|
870 |
+
$type_menu = get_post_meta($menu->ID, '_menu_item_object', true);
|
871 |
+
$id_menu = get_post_meta($menu->ID, '_menu_item_object_id', true);
|
872 |
+
if($type_menu == 'category'){
|
873 |
+
$term = get_term($id_menu);
|
874 |
+
$title = $term->name;
|
875 |
+
}else{
|
876 |
+
$post = get_post($id_menu);
|
877 |
+
$title = $post->post_title;
|
878 |
+
}
|
879 |
+
|
880 |
+
$check_type = get_post_meta($menu->ID, '_menu_item_object',true);
|
881 |
+
$permalink = $this->wpms_get_permalink_sitemap($check_type,$id_menu);
|
882 |
+
$html .= '<li>';
|
883 |
+
$html .= '<a href="'.$permalink.'">'.$title.'</a>';
|
884 |
+
$html .= '</li>';
|
885 |
+
}
|
886 |
+
|
887 |
+
$html .= '</ul>';
|
888 |
+
}
|
889 |
+
return $html;
|
890 |
+
}
|
891 |
+
|
892 |
+
public function wpms_view_menus($term) {
|
893 |
+
$list_submenu_id = get_objects_in_term($term->term_id, 'nav_menu');
|
894 |
+
$args = array(
|
895 |
+
'orderby' => 'menu_order',
|
896 |
+
'order' => 'ASC',
|
897 |
+
'posts_per_page' => -1,
|
898 |
+
'post_type' => 'nav_menu_item',
|
899 |
+
'post_status' => 'any',
|
900 |
+
'post__in' => $list_submenu_id,
|
901 |
+
'meta_key' => '_menu_item_menu_item_parent',
|
902 |
+
'meta_value' => 0
|
903 |
+
);
|
904 |
+
$query = new WP_Query($args);
|
905 |
+
$submenus = $query->get_posts();
|
906 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
907 |
+
|
908 |
+
$this->html .= '<h3><input type="checkbox" class="sitemap_check_all_posts_categories" data-category="nav_menu'.$term->slug.'">' . $term->name . '</h3>';
|
909 |
+
|
910 |
+
$this->html .= __('Display in column' , 'wp-meta-seo');
|
911 |
+
$this->html .= '<select class="wpms_display_column wpms_display_column_menus" data-menu_id="'.$term->term_id.'">';
|
912 |
+
for($i = 1 ; $i <= $this->settings_sitemap['wpms_html_sitemap_column'] ; $i++){
|
913 |
+
if(@$this->settings_sitemap['wpms_display_column_menus']->{$term->term_id} == $i){
|
914 |
+
$this->html .= '<option selected value="'.$i.'">'.$this->columns[$i].'</option>';
|
915 |
+
}else{
|
916 |
+
$this->html .= '<option value="'.$i.'">'.$this->columns[$i].'</option>';
|
917 |
+
}
|
918 |
+
|
919 |
+
}
|
920 |
+
$this->html .= '</select>';
|
921 |
+
|
922 |
+
foreach ($submenus as $menu) {
|
923 |
+
$select_priority = $this->wpms_view_select_priority('priority_menu_'.$menu->ID,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][priority]' , @$this->settings_sitemap['wpms_sitemap_menus']->{$menu->ID}->priority);
|
924 |
+
$select_frequency = $this->wpms_view_select_frequency('frequency_menu_'.$menu->ID,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][frequency]' , @$this->settings_sitemap['wpms_sitemap_menus']->{$menu->ID}->frequency);
|
925 |
+
|
926 |
+
$type_menu = get_post_meta($menu->ID, '_menu_item_object', true);
|
927 |
+
$id_menu = get_post_meta($menu->ID, '_menu_item_object_id', true);
|
928 |
+
if($type_menu == 'category'){
|
929 |
+
$term = get_term($id_menu);
|
930 |
+
$title = $term->name;
|
931 |
+
}else{
|
932 |
+
$post = get_post($id_menu);
|
933 |
+
$title = $post->post_title;
|
934 |
+
}
|
935 |
+
$level = 1;
|
936 |
+
$this->html .= '<div class="wpms_row">';
|
937 |
+
$this->html .= '<div style="float:left;line-height:30px">';
|
938 |
+
//$this->html .= '<input name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][menu_id]" type="hidden" value="0">';
|
939 |
+
|
940 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
941 |
+
$checkbox = '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][menu_id]" type="checkbox" value="' . $menu->ID . '">';
|
942 |
+
}else{
|
943 |
+
if(isset($this->settings_sitemap['wpms_sitemap_menus']->{$menu->ID}->menu_id) && $this->settings_sitemap['wpms_sitemap_menus']->{$menu->ID}->menu_id == $menu->ID){
|
944 |
+
$checkbox = '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][menu_id]" type="checkbox" value="' . $menu->ID . '">';
|
945 |
+
}else{
|
946 |
+
$checkbox = '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$menu->ID.'][menu_id]" type="checkbox" value="' . $menu->ID . '">';
|
947 |
+
}
|
948 |
+
}
|
949 |
+
|
950 |
+
$this->html .= $checkbox . $title;
|
951 |
+
$this->html .= '</div>';
|
952 |
+
$this->html .= '<div style="margin-left:200px">'.$select_priority.$select_frequency.'</div>';
|
953 |
+
$this->html .= '</div>';
|
954 |
+
$this->html .= $this->wpms_loop($menu->ID, $level + 1,$this->settings_sitemap,$term);
|
955 |
+
}
|
956 |
+
|
957 |
+
return $this->html;
|
958 |
+
}
|
959 |
+
|
960 |
+
public function wpms_loop($menuID, $level,$settings_sitemap,$term) {
|
961 |
+
global $wpdb;
|
962 |
+
$sql = "SELECT * FROM " . $wpdb->postmeta . " WHERE meta_key='_menu_item_menu_item_parent' AND meta_value=" . $menuID;
|
963 |
+
$submenu = $wpdb->get_row($sql);
|
964 |
+
if (!empty($submenu)) {
|
965 |
+
$type_menu = get_post_meta($submenu->post_id, '_menu_item_object', true);
|
966 |
+
$post_subid = get_post_meta($submenu->post_id, '_menu_item_object_id', true);
|
967 |
+
if($type_menu == 'category'){
|
968 |
+
$term = get_term($post_subid);
|
969 |
+
$title = $term->name;
|
970 |
+
}else{
|
971 |
+
$post_submenu = get_post($post_subid);
|
972 |
+
$title = $post_submenu->post_title;
|
973 |
+
}
|
974 |
+
|
975 |
+
$space = '';
|
976 |
+
for ($i = 1; $i <= $level * 3; $i++) {
|
977 |
+
$space .= ' ';
|
978 |
+
}
|
979 |
+
$select_priority = $this->wpms_view_select_priority('priority_menu_'.$submenu->post_id,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][priority]' , @$settings_sitemap['wpms_sitemap_menus']->{$submenu->post_id}->priority);
|
980 |
+
$select_frequency = $this->wpms_view_select_frequency('frequency_menu_'.$submenu->post_id,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][frequency]' , @$settings_sitemap['wpms_sitemap_menus']->{$submenu->post_id}->frequency);
|
981 |
+
|
982 |
+
if(empty($settings_sitemap['wpms_check_firstsave'])){
|
983 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][menu_id]" type="checkbox" value="' . $submenu->post_id . '">';
|
984 |
+
}else{
|
985 |
+
if(isset($settings_sitemap['wpms_sitemap_menus']->{$submenu->post_id}->menu_id) && $settings_sitemap['wpms_sitemap_menus']->{$submenu->post_id}->menu_id == $submenu->post_id){
|
986 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][menu_id]" type="checkbox" value="' . $submenu->post_id . '">';
|
987 |
+
}else{
|
988 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][menu_id]" type="checkbox" value="' . $submenu->post_id . '">';
|
989 |
+
}
|
990 |
+
}
|
991 |
+
|
992 |
+
$this->html .= '<div class="wpms_row">';
|
993 |
+
$this->html .= '<div style="float:left;line-height:30px">';
|
994 |
+
//$this->html .= '<input name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][menu_id]" type="hidden" value="0">';
|
995 |
+
$this->html .= $checkbox . $title;
|
996 |
+
$this->html .= '</div>';
|
997 |
+
$this->html .= '<div style="margin-left:200px">'.$select_priority.$select_frequency.'</div>';
|
998 |
+
$this->html .= '</div>';
|
999 |
+
$this->wpms_loop($submenu->post_id, $level + 1,$settings_sitemap,$term);
|
1000 |
+
}
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
public function wpms_regenerate_sitemaps(){
|
1004 |
+
$info_file = $this->wpms_get_path_filename_sitemap();
|
1005 |
+
$wpms_url_robot = ABSPATH . "robots.txt";
|
1006 |
+
$wpms_url_home = site_url('/');
|
1007 |
+
$xml_url = site_url('/') . $info_file['name'];
|
1008 |
+
$this->metaseo_create_sitemap($this->wpms_sitemap_name);
|
1009 |
+
if($this->settings_sitemap['wpms_sitemap_root'] == 1){
|
1010 |
+
$this->metaseo_create_sitemap($this->wpms_sitemap_default_name);
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
if (file_exists($wpms_url_robot) && !is_multisite()) {
|
1014 |
+
if (!is_writable($wpms_url_robot))
|
1015 |
+
@chmod($wpms_url_robot, 0755);
|
1016 |
+
if (is_writable($wpms_url_robot)) {
|
1017 |
+
$file_content = file_get_contents($wpms_url_robot);
|
1018 |
+
if (isset($this->settings_sitemap['wpms_sitemap_add']) && $this->settings_sitemap['wpms_sitemap_add'] == 1 && !preg_match('|Sitemap: ' . $wpms_url_home . $this->wpms_sitemap_name.'|', $file_content)) {
|
1019 |
+
file_put_contents($wpms_url_robot, $file_content . "\nSitemap: " . $wpms_url_home . $this->wpms_sitemap_name);
|
1020 |
+
} elseif (preg_match("|Sitemap: " . $wpms_url_home . $this->wpms_sitemap_name."|", $file_content) && !isset($_POST['gglstmp_checkbox'])) {
|
1021 |
+
$file_content = preg_replace("|\nSitemap: " . $wpms_url_home . $this->wpms_sitemap_name."|", '', $file_content);
|
1022 |
+
file_put_contents($wpms_url_robot, $file_content);
|
1023 |
+
}
|
1024 |
+
} else {
|
1025 |
+
$error = __('Cannot edit "robots.txt". Check your permissions', 'wp-meta-seo');
|
1026 |
+
wp_send_json(array('status' => false , 'message' => $error));
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
wp_send_json(array('status' => true , 'message' => 'success'));
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
public function wpms_view_select_priority($id,$name,$selected) {
|
1033 |
+
$values = array('1' => '100%','0.9' => '90%','0.8' => '80%','0.7' => '70%','0.6' => '60%','0.5' => '50%');
|
1034 |
+
$select = '<select id="'.$id.'" name="'.$name.'">';
|
1035 |
+
$select .= '<option value="1">'.__('Priority','wp-meta-seo').'</option>';
|
1036 |
+
foreach ($values as $k => $v){
|
1037 |
+
if($k == $selected){
|
1038 |
+
$select .= '<option selected value="'.$k.'">'.$v.'</option>';
|
1039 |
+
}else{
|
1040 |
+
$select .= '<option value="'.$k.'">'.$v.'</option>';
|
1041 |
+
}
|
1042 |
+
}
|
1043 |
+
$select .= '</select>';
|
1044 |
+
return $select;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
public function wpms_view_select_frequency($id,$name,$selected) {
|
1048 |
+
$values = array('always' => 'Always','hourly' => 'Hourly','daily' => 'Daily','weekly' => 'Weekly','monthly' => 'Monthly','yearly' => 'Yearly','never' => 'Never');
|
1049 |
+
$select = '<select id="'.$id.'" name="'.$name.'">';
|
1050 |
+
$select .= '<option value="monthly">'.__('Frequency','wp-meta-seo').'</option>';
|
1051 |
+
foreach ($values as $k => $v){
|
1052 |
+
if($k == $selected){
|
1053 |
+
$select .= '<option selected value="'.$k.'">'.$v.'</option>';
|
1054 |
+
}else{
|
1055 |
+
$select .= '<option value="'.$k.'">'.$v.'</option>';
|
1056 |
+
}
|
1057 |
+
}
|
1058 |
+
$select .= '</select>';
|
1059 |
+
return $select;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
public function wpms_save_sitemap_settings(){
|
1063 |
+
$settings_sitemap = get_option('_metaseo_settings_sitemap');
|
1064 |
+
$lists = array(
|
1065 |
+
"wpms_sitemap_add" => 0,
|
1066 |
+
"wpms_sitemap_root" => 0,
|
1067 |
+
"wpms_sitemap_author" => 0,
|
1068 |
+
"wpms_html_sitemap_page" => 0,
|
1069 |
+
"wpms_html_sitemap_column" => 1,
|
1070 |
+
"wpms_html_sitemap_position" => "after",
|
1071 |
+
"wpms_sitemap_taxonomies" => array(),
|
1072 |
+
"wpms_check_firstsave" => 0,
|
1073 |
+
"wpms_display_column_posts" => 1,
|
1074 |
+
"wpms_display_column_pages" => 1,
|
1075 |
+
"wpms_category_link" => array()
|
1076 |
+
);
|
1077 |
+
|
1078 |
+
$wpms_display_column_menus = json_decode(stripslashes($_POST['wpms_display_column_menus']));
|
1079 |
+
if(!empty($wpms_display_column_menus)){
|
1080 |
+
$settings_sitemap['wpms_display_column_menus'] = $wpms_display_column_menus;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
foreach ($lists as $k => $v){
|
1084 |
+
if(isset($_POST[$k])){
|
1085 |
+
$settings_sitemap[$k] = $_POST[$k];
|
1086 |
+
}else{
|
1087 |
+
$settings_sitemap[$k] = $lists[$k];
|
1088 |
+
}
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
$lists_selected = array(
|
1092 |
+
"wpms_sitemap_posts" => array(),
|
1093 |
+
"wpms_sitemap_pages" => array(),
|
1094 |
+
"wpms_sitemap_menus" => array()
|
1095 |
+
);
|
1096 |
+
|
1097 |
+
foreach ($lists_selected as $k => $v){
|
1098 |
+
if(isset($_POST[$k]) && $_POST[$k] != '{}'){
|
1099 |
+
$values = json_decode(stripslashes($_POST[$k]));
|
1100 |
+
$settings_sitemap[$k] = $values;
|
1101 |
+
}else{
|
1102 |
+
$settings_sitemap[$k] = array();
|
1103 |
+
}
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
if(isset($_POST['wpms_public_name_posts'])) $settings_sitemap['wpms_public_name_posts'] = $_POST['wpms_public_name_posts'];
|
1107 |
+
if(isset($_POST['wpms_public_name_pages'])) $settings_sitemap['wpms_public_name_pages'] = $_POST['wpms_public_name_pages'];
|
1108 |
+
|
1109 |
+
update_option('_metaseo_settings_sitemap', $settings_sitemap);
|
1110 |
+
|
1111 |
+
wp_send_json(true);
|
1112 |
+
}
|
1113 |
+
}
|
inc/pages/settings.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
$posts = get_posts(array('post_type' => 'page','posts_per_page'=>-1,'numberposts' => -1));
|
3 |
$types_404 = array('none' => 'None','wp-meta-seo-page' => __('WP Meta SEO page','wp-meta-seo'), 'custom_page' => __('Custom page','wp-meta-seo'));
|
4 |
|
@@ -8,61 +10,85 @@
|
|
8 |
$defaul_settings_404 = array_merge($defaul_settings_404, $wpms_settings_404);
|
9 |
}
|
10 |
?>
|
11 |
-
<
|
12 |
-
<
|
13 |
-
<div class="
|
14 |
-
<div class="wpms-
|
15 |
-
|
|
|
|
|
16 |
</div>
|
17 |
-
|
18 |
-
<div class="
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
</
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
</
|
39 |
-
</
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
</
|
55 |
-
</
|
56 |
-
</
|
57 |
-
</
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
</div>
|
62 |
-
|
63 |
</div>
|
64 |
<script type="text/javascript">
|
65 |
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
$('.wpms-tab-header').on('click',function(){
|
67 |
var $this = $(this);
|
68 |
var label = $this.data('label');
|
1 |
<?php
|
2 |
+
wp_enqueue_style('m-style-qtip');
|
3 |
+
wp_enqueue_script('jquery-qtip');
|
4 |
$posts = get_posts(array('post_type' => 'page','posts_per_page'=>-1,'numberposts' => -1));
|
5 |
$types_404 = array('none' => 'None','wp-meta-seo-page' => __('WP Meta SEO page','wp-meta-seo'), 'custom_page' => __('Custom page','wp-meta-seo'));
|
6 |
|
10 |
$defaul_settings_404 = array_merge($defaul_settings_404, $wpms_settings_404);
|
11 |
}
|
12 |
?>
|
13 |
+
<div class="wrap wrap_wpms_settings">
|
14 |
+
<h1><?php _e('WP Meta SEO global settings','wp-meta-seo') ?></h1>
|
15 |
+
<div class="tab-header">
|
16 |
+
<div class="wpms-tabs">
|
17 |
+
<div class="wpms-tab-header active" data-label="wpms-global"><?php _e('Global','wp-meta-seo') ?></div>
|
18 |
+
<div class="wpms-tab-header" data-label="wpms-redirection"><?php _e('Redirections and 404','wp-meta-seo') ?></div>
|
19 |
+
</div>
|
20 |
</div>
|
21 |
+
<div class="wpms_content_settings">
|
22 |
+
<div class="content-box content-wpms-global">
|
23 |
+
<form method="post" action="options.php">
|
24 |
+
<?php
|
25 |
+
settings_fields( 'Wp Meta SEO' );
|
26 |
+
do_settings_sections('metaseo_settings');
|
27 |
+
submit_button();
|
28 |
+
?>
|
29 |
+
</form>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
<div class="content-box content-wpms-redirection">
|
33 |
+
<table class="form-table">
|
34 |
+
<tbody>
|
35 |
+
<tr>
|
36 |
+
<th scope="row"><?php _e('Global home redirect','wp-meta-seo') ?></th>
|
37 |
+
<td><label>
|
38 |
+
<input <?php checked($defaul_settings_404['wpms_redirect_homepage'], 1) ?> data-label="wpms_redirect_homepage" type="checkbox" class="cb_option" id="wpms_redirect_homepage">
|
39 |
+
<?php _e('Redirect all 404 errors to home page','wp-meta-seo') ?>
|
40 |
+
<input type="hidden" class="wpms_redirect_homepage" name="wpms_redirect[wpms_redirect_homepage]" value="<?php echo $defaul_settings_404['wpms_redirect_homepage'] ?>">
|
41 |
+
</label>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
<tr>
|
45 |
+
<th scope="row"><?php _e('Custom 404 page','wp-meta-seo') ?></th>
|
46 |
+
<td>
|
47 |
+
<select name="wpms_redirect[wpms_type_404]" class="wpms_type_404" <?php echo ($defaul_settings_404['wpms_redirect_homepage']==1)?"disabled":"" ?>>
|
48 |
+
<?php foreach ($types_404 as $k => $type_404): ?>
|
49 |
+
<option <?php selected($defaul_settings_404['wpms_type_404'], $k) ?> value="<?php echo $k ?>"><?php echo $type_404 ?></option>
|
50 |
+
<?php endforeach; ?>
|
51 |
+
</select>
|
52 |
+
<select name="wpms_redirect[wpms_page_redirected]" class="wpms_page_redirected" <?php echo (($defaul_settings_404['wpms_redirect_homepage']==1) || $defaul_settings_404['wpms_type_404'] != 'custom_page')?"disabled":"" ?>>
|
53 |
+
<option value="none"><?php _e('— Select —','wp-meta-seo') ?></option>
|
54 |
+
<?php foreach ($posts as $post): ?>
|
55 |
+
<option <?php selected($defaul_settings_404['wpms_page_redirected'], $post->ID) ?> value="<?php echo $post->ID ?>"><?php echo $post->post_title ?></option>
|
56 |
+
<?php endforeach; ?>
|
57 |
+
</select>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
</tbody>
|
61 |
+
</table>
|
62 |
+
<div class="button wpms_save_settings404"><?php _e('Save','wp-meta-seo') ?></div>
|
63 |
+
<span class="message_saved"><?php _e('Saved','wp-meta-seo') ?></span>
|
64 |
+
</div>
|
65 |
+
|
66 |
</div>
|
|
|
67 |
</div>
|
68 |
<script type="text/javascript">
|
69 |
jQuery(document).ready(function ($) {
|
70 |
+
jQuery('.wrap_wpms_settings tr label').qtip({
|
71 |
+
content: {
|
72 |
+
attr: 'for'
|
73 |
+
},
|
74 |
+
position: {
|
75 |
+
my: 'bottom left',
|
76 |
+
at: 'top center'
|
77 |
+
},
|
78 |
+
style: {
|
79 |
+
tip: {
|
80 |
+
corner: true,
|
81 |
+
},
|
82 |
+
classes: 'metaseo-qtip qtip-rounded'
|
83 |
+
},
|
84 |
+
show: 'hover',
|
85 |
+
hide: {
|
86 |
+
fixed: true,
|
87 |
+
delay: 10
|
88 |
+
}
|
89 |
+
|
90 |
+
});
|
91 |
+
|
92 |
$('.wpms-tab-header').on('click',function(){
|
93 |
var $this = $(this);
|
94 |
var label = $this.data('label');
|
inc/pages/sitemaps/metaseo-google-sitemap.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap wpms_wrap">
|
2 |
+
<?php
|
3 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/sitemaps/sitemap_menus.php' );
|
4 |
+
?>
|
5 |
+
<form method="post" id="wpms_xmap_form" action="">
|
6 |
+
<input type="hidden" name="action" value="wpms_save_sitemap_settings">
|
7 |
+
<?php
|
8 |
+
//settings_fields( 'MetaSEO Sitemap' );
|
9 |
+
echo '<div class="wpms_source wpms_source_sitemaps">';
|
10 |
+
do_settings_sections('metaseo_settings_sitemap');
|
11 |
+
echo '</div>';
|
12 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/sitemaps/metaseo-source_menu.php' );
|
13 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/sitemaps/metaseo-source_posts.php' );
|
14 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/sitemaps/metaseo-source_pages.php' );
|
15 |
+
echo '<div class="div_wpms_save_sitemaps"><input type="button" class="button button-primary wpms_save_create_sitemaps" value="'.__('Regenerate and save sitemaps','wp-meta-seo').'"><span class="spinner spinner_save_sitemaps"></span></div>';
|
16 |
+
//submit_button();
|
17 |
+
?>
|
18 |
+
</form>
|
19 |
+
</div>
|
inc/pages/sitemaps/metaseo-source_menu.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpms_source wpms_source_menu">
|
2 |
+
<?php
|
3 |
+
$terms = get_terms(array('taxonomy' => 'nav_menu' , 'hide_empty' => true , 'orderby' => 'term_id' , 'order' => 'ASC'));
|
4 |
+
if(!empty($terms)){
|
5 |
+
echo '<div class="div_sitemap_check_all">';
|
6 |
+
echo '<input type="checkbox" class="sitemap_check_all" data-type="menu">';
|
7 |
+
echo __('Check all menus','wp-meta-seo');
|
8 |
+
echo '</div>';
|
9 |
+
|
10 |
+
foreach ($terms as $term){
|
11 |
+
$viewmenu = $metaseo_sitemap->wpms_view_menus($term);
|
12 |
+
}
|
13 |
+
echo '<div class="wrap_sitemap_option">';
|
14 |
+
echo '<input name="_metaseo_settings_sitemap[wpms_check_firstsave]" type="hidden" value="1">';
|
15 |
+
echo $viewmenu;
|
16 |
+
echo '</div>';
|
17 |
+
}
|
18 |
+
?>
|
19 |
+
</div>
|
inc/pages/sitemaps/metaseo-source_pages.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpms_source wpms_source_pages">
|
2 |
+
<div class="div_sitemap_check_all">
|
3 |
+
<input type="checkbox" class="sitemap_check_all" data-type="pages"><?php _e('Check all pages', 'wp-meta-seo'); ?>
|
4 |
+
</div>
|
5 |
+
|
6 |
+
<div class="div_sitemap_check_all">
|
7 |
+
<input type="checkbox" class="sitemap_check_all_posts_in_page" data-type="pages"><?php _e('Check all pages in current page', 'wp-meta-seo'); ?>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<div class="div_sitemap_check_all" style="font-weight: bold;">
|
11 |
+
<?php _e('Public name' , 'wp-meta-seo'); ?>
|
12 |
+
<input type="text" class="public_name_pages" value="<?php echo @$metaseo_sitemap->settings_sitemap['wpms_public_name_pages'] ?>">
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<div class="div_sitemap_check_all" style="font-weight: bold;">
|
16 |
+
<?php _e('Display in column' , 'wp-meta-seo'); ?>
|
17 |
+
<select class="wpms_display_column wpms_display_column_pages">
|
18 |
+
<?php
|
19 |
+
for($i = 1 ; $i <= $metaseo_sitemap->settings_sitemap['wpms_html_sitemap_column'] ; $i++){
|
20 |
+
echo '<option '.(selected($metaseo_sitemap->settings_sitemap['wpms_display_column_pages'], $i)).' value="'.$i.'">'.$metaseo_sitemap->columns[$i].'</option>';
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
</select>
|
24 |
+
</div>
|
25 |
+
<div id="wrap_sitemap_option_pages" class="wrap_sitemap_option">
|
26 |
+
<h3><?php _e('Pages', 'wp-meta-seo') ?></h3>
|
27 |
+
<?php
|
28 |
+
$pages = get_pages();
|
29 |
+
foreach ($pages as $page) {
|
30 |
+
$select_priority = $metaseo_sitemap->wpms_view_select_priority('priority_pages_'.$page->ID,'_metaseo_settings_sitemap[wpms_sitemap_pages][' . $page->ID . '][priority]', @$metaseo_sitemap->settings_sitemap['wpms_sitemap_pages']->{$page->ID}->priority);
|
31 |
+
$select_frequency = $metaseo_sitemap->wpms_view_select_frequency('frequency_pages_'.$page->ID,'_metaseo_settings_sitemap[wpms_sitemap_pages][' . $page->ID . '][frequency]', @$metaseo_sitemap->settings_sitemap['wpms_sitemap_pages']->{$page->ID}->frequency);
|
32 |
+
echo '<div class="wpms_row">';
|
33 |
+
echo '<div style="float:left;line-height:30px">';
|
34 |
+
//echo '<input class="wpms_xmap_pages" name="_metaseo_settings_sitemap[wpms_sitemap_pages][' . $page->ID . '][post_id]" type="hidden" value="0">';
|
35 |
+
if (isset($metaseo_sitemap->settings_sitemap['wpms_sitemap_pages']->{$page->ID}->post_id) && $metaseo_sitemap->settings_sitemap['wpms_sitemap_pages']->{$page->ID}->post_id == $page->ID) {
|
36 |
+
echo '<input class="cb_sitemaps_pages wpms_xmap_pages" name="_metaseo_settings_sitemap[wpms_sitemap_pages][' . $page->ID . '][post_id]" checked type="checkbox" value="' . $page->ID . '">';
|
37 |
+
} else {
|
38 |
+
echo '<input class="cb_sitemaps_pages wpms_xmap_pages" name="_metaseo_settings_sitemap[wpms_sitemap_pages][' . $page->ID . '][post_id]" type="checkbox" value="' . $page->ID . '">';
|
39 |
+
}
|
40 |
+
|
41 |
+
echo $page->post_title;
|
42 |
+
echo '</div>';
|
43 |
+
echo '<div style="margin-left:200px">' . $select_priority . $select_frequency . '</div>';
|
44 |
+
echo '</div>';
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
</div>
|
48 |
+
<div class="holder holder_pages"></div>
|
49 |
+
</div>
|
inc/pages/sitemaps/metaseo-source_posts.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpms_source wpms_source_posts">
|
2 |
+
<div class="div_sitemap_check_all">
|
3 |
+
<input type="checkbox" class="sitemap_check_all" data-type="posts"><?php _e('Check all posts', 'wp-meta-seo'); ?>
|
4 |
+
</div>
|
5 |
+
|
6 |
+
<div class="div_sitemap_check_all">
|
7 |
+
<input type="checkbox" class="sitemap_check_all_posts_in_page" data-type="posts"><?php _e('Check all posts in current page', 'wp-meta-seo'); ?>
|
8 |
+
</div>
|
9 |
+
|
10 |
+
<div class="div_sitemap_check_all" style="font-weight: bold;">
|
11 |
+
<?php _e('Public name' , 'wp-meta-seo'); ?>
|
12 |
+
<input type="text" class="public_name_posts" value="<?php echo @$metaseo_sitemap->settings_sitemap['wpms_public_name_posts'] ?>">
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<div class="div_sitemap_check_all" style="font-weight: bold;">
|
16 |
+
<?php _e('Display in column' , 'wp-meta-seo'); ?>
|
17 |
+
<select class="wpms_display_column wpms_display_column_posts">
|
18 |
+
<?php
|
19 |
+
for($i = 1 ; $i <= $metaseo_sitemap->settings_sitemap['wpms_html_sitemap_column'] ; $i++){
|
20 |
+
echo '<option '.(selected($metaseo_sitemap->settings_sitemap['wpms_display_column_posts'], $i)).' value="'.$i.'">'.$metaseo_sitemap->columns[$i].'</option>';
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
</select>
|
24 |
+
</div>
|
25 |
+
<div id="wrap_sitemap_option_posts" class="wrap_sitemap_option">
|
26 |
+
<?php
|
27 |
+
$posts = $metaseo_sitemap->wpms_get_posts();
|
28 |
+
$check = array();
|
29 |
+
$desclink_category_add = __('Add link to category name' , 'wp-meta-seo');
|
30 |
+
$desclink_category_remove = __('Remove link to category name' , 'wp-meta-seo');
|
31 |
+
foreach ($posts as $key => $post) {
|
32 |
+
$keys = explode('||', $key);
|
33 |
+
if(!in_array($keys[2], $check)){
|
34 |
+
$check[] = $keys[2];
|
35 |
+
echo '<div class="wpms_row"><h1>' . $keys[2] . '</h1></div>';
|
36 |
+
}
|
37 |
+
|
38 |
+
if(in_array($keys[1], $metaseo_sitemap->settings_sitemap['wpms_category_link'])){
|
39 |
+
echo '<div class="wpms_row"><h3><input for="'.$desclink_category_remove.'" type="checkbox" checked class="sitemap_addlink_categories" value="'.$keys[1].'">' . $keys[0] . '</h3></div>';
|
40 |
+
}else{
|
41 |
+
echo '<div class="wpms_row"><h3><input for="'.$desclink_category_add.'" type="checkbox" class="sitemap_addlink_categories" value="'.$keys[1].'">' . $keys[0] . '</h3></div>';
|
42 |
+
}
|
43 |
+
|
44 |
+
echo '<div class="wpms_row wpms_row_check_all_posts"><input type="checkbox" class="sitemap_check_all_posts_categories" data-category="'.$keys[2].$keys[3].'">'.__('Select all' , 'wp-meta-seo').'</div>';
|
45 |
+
foreach ($post as $p) {
|
46 |
+
$category = get_the_terms($p, $keys[2]);
|
47 |
+
if($category[0]->term_id == $keys[1]){
|
48 |
+
$select_priority = $metaseo_sitemap->wpms_view_select_priority('priority_posts_'.$p->ID,'_metaseo_settings_sitemap[wpms_sitemap_posts][' . $p->ID . '][priority]', @$metaseo_sitemap->settings_sitemap['wpms_sitemap_posts']->{$p->ID}->priority);
|
49 |
+
$select_frequency = $metaseo_sitemap->wpms_view_select_frequency('frequency_posts_'.$p->ID,'_metaseo_settings_sitemap[wpms_sitemap_posts][' . $p->ID . '][frequency]', @$metaseo_sitemap->settings_sitemap['wpms_sitemap_posts']->{$p->ID}->frequency);
|
50 |
+
echo '<div class="wpms_row">';
|
51 |
+
echo '<div style="float:left;line-height:30px">';
|
52 |
+
//echo '<input class="wpms_xmap_posts" name="_metaseo_settings_sitemap[wpms_sitemap_posts][' . $p->ID . '][post_id]" type="hidden" value="0">';
|
53 |
+
|
54 |
+
if (isset($metaseo_sitemap->settings_sitemap['wpms_sitemap_posts']->{$p->ID}->post_id) && $metaseo_sitemap->settings_sitemap['wpms_sitemap_posts']->{$p->ID}->post_id == $p->ID) {
|
55 |
+
echo '<input class="cb_sitemaps_posts wpms_xmap_posts '.$keys[2].$keys[3].'" name="_metaseo_settings_sitemap[wpms_sitemap_posts][' . $p->ID . '][post_id]" checked type="checkbox" value="' . $p->ID . '">';
|
56 |
+
} else {
|
57 |
+
echo '<input class="cb_sitemaps_posts wpms_xmap_posts '.$keys[2].$keys[3].'" name="_metaseo_settings_sitemap[wpms_sitemap_posts][' . $p->ID . '][post_id]" type="checkbox" value="' . $p->ID . '">';
|
58 |
+
}
|
59 |
+
|
60 |
+
echo $p->post_title;
|
61 |
+
echo '</div>';
|
62 |
+
echo '<div style="margin-left:200px">' . $select_priority . $select_frequency . '</div>';
|
63 |
+
echo '</div>';
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
</div>
|
69 |
+
<div class="holder holder_posts"></div>
|
70 |
+
</div>
|
inc/pages/sitemaps/sitemap_menus.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h1><?php _e('Sitemap','wp-meta-seo') ?></h1>
|
2 |
+
<h2 class="nav-tab-wrapper">
|
3 |
+
<div class="nav-tab nav-tab-active" data-tab="sitemaps"><?php _e('Sitemaps','wp-meta-seo') ?></div>
|
4 |
+
<div class="nav-tab" data-tab="menu"><?php _e('Source: menu','wp-meta-seo') ?></div>
|
5 |
+
<div class="nav-tab" data-tab="posts"><?php _e('Source: posts','wp-meta-seo') ?></div>
|
6 |
+
<div class="nav-tab" data-tab="pages"><?php _e('Source: pages','wp-meta-seo') ?></div>
|
7 |
+
</h2>
|
js/jPages.js
ADDED
@@ -0,0 +1,574 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jQuery jPages v0.7
|
3 |
+
* Client side pagination with jQuery
|
4 |
+
* http://luis-almeida.github.com/jPages
|
5 |
+
*
|
6 |
+
* Licensed under the MIT license.
|
7 |
+
* Copyright 2012 Luís Almeida
|
8 |
+
* https://github.com/luis-almeida
|
9 |
+
*/
|
10 |
+
|
11 |
+
;(function($, window, document, undefined) {
|
12 |
+
|
13 |
+
var name = "jPages",
|
14 |
+
instance = null,
|
15 |
+
defaults = {
|
16 |
+
containerID: "",
|
17 |
+
first: false,
|
18 |
+
previous: "← previous",
|
19 |
+
next: "next →",
|
20 |
+
last: false,
|
21 |
+
links: "numeric", // blank || title
|
22 |
+
startPage: 1,
|
23 |
+
perPage: 10,
|
24 |
+
midRange: 5,
|
25 |
+
startRange: 1,
|
26 |
+
endRange: 1,
|
27 |
+
keyBrowse: false,
|
28 |
+
scrollBrowse: false,
|
29 |
+
pause: 0,
|
30 |
+
clickStop: false,
|
31 |
+
delay: 50,
|
32 |
+
direction: "forward", // backwards || auto || random ||
|
33 |
+
animation: "", // http://daneden.me/animate/ - any entrance animations
|
34 |
+
fallback: 400,
|
35 |
+
minHeight: true,
|
36 |
+
callback: undefined // function( pages, items ) { }
|
37 |
+
};
|
38 |
+
|
39 |
+
|
40 |
+
function Plugin(element, options) {
|
41 |
+
this.options = $.extend({}, defaults, options);
|
42 |
+
|
43 |
+
this._container = $("#" + this.options.containerID);
|
44 |
+
if (!this._container.length) return;
|
45 |
+
|
46 |
+
this.jQwindow = $(window);
|
47 |
+
this.jQdocument = $(document);
|
48 |
+
|
49 |
+
this._holder = $(element);
|
50 |
+
this._nav = {};
|
51 |
+
|
52 |
+
this._first = $(this.options.first);
|
53 |
+
this._previous = $(this.options.previous);
|
54 |
+
this._next = $(this.options.next);
|
55 |
+
this._last = $(this.options.last);
|
56 |
+
|
57 |
+
/* only visible items! */
|
58 |
+
if($(this._container).hasClass('wrap_sitemap_option')){
|
59 |
+
this._items = this._container.find(".wpms_row");
|
60 |
+
}else if($(this._container).hasClass('wpms_sitemap_posts')){
|
61 |
+
this._items = this._container.find("li,h3,h4").not('.wpms_li_cate');
|
62 |
+
}else{
|
63 |
+
this._items = this._container.find("li");
|
64 |
+
}
|
65 |
+
|
66 |
+
this._itemsShowing = $([]);
|
67 |
+
this._itemsHiding = $([]);
|
68 |
+
|
69 |
+
this._numPages = Math.ceil(this._items.length / this.options.perPage);
|
70 |
+
this._currentPageNum = this.options.startPage;
|
71 |
+
|
72 |
+
this._clicked = false;
|
73 |
+
this._cssAnimSupport = this.getCSSAnimationSupport();
|
74 |
+
|
75 |
+
this.init();
|
76 |
+
}
|
77 |
+
|
78 |
+
Plugin.prototype = {
|
79 |
+
|
80 |
+
constructor : Plugin,
|
81 |
+
|
82 |
+
getCSSAnimationSupport : function() {
|
83 |
+
var animation = false,
|
84 |
+
animationstring = 'animation',
|
85 |
+
keyframeprefix = '',
|
86 |
+
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
|
87 |
+
pfx = '',
|
88 |
+
elm = this._container.get(0);
|
89 |
+
|
90 |
+
if (elm.style.animationName) animation = true;
|
91 |
+
|
92 |
+
if (animation === false) {
|
93 |
+
for (var i = 0; i < domPrefixes.length; i++) {
|
94 |
+
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
95 |
+
pfx = domPrefixes[i];
|
96 |
+
animationstring = pfx + 'Animation';
|
97 |
+
keyframeprefix = '-' + pfx.toLowerCase() + '-';
|
98 |
+
animation = true;
|
99 |
+
break;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
return animation;
|
105 |
+
},
|
106 |
+
|
107 |
+
init : function() {
|
108 |
+
this.setStyles();
|
109 |
+
if(this._items.length > this.options.perPage){
|
110 |
+
this.setNav();
|
111 |
+
}
|
112 |
+
this.paginate(this._currentPageNum);
|
113 |
+
this.setMinHeight();
|
114 |
+
},
|
115 |
+
|
116 |
+
setStyles : function() {
|
117 |
+
var requiredStyles = "<style>" +
|
118 |
+
".jp-invisible { visibility: hidden !important; } " +
|
119 |
+
".jp-hidden { display: none !important; }" +
|
120 |
+
"</style>";
|
121 |
+
|
122 |
+
$(requiredStyles).appendTo("head");
|
123 |
+
|
124 |
+
if (this._cssAnimSupport && this.options.animation.length)
|
125 |
+
this._items.addClass("animated jp-hidden");
|
126 |
+
else this._items.hide().addClass('jp-hidden');
|
127 |
+
|
128 |
+
},
|
129 |
+
|
130 |
+
setNav : function() {
|
131 |
+
var navhtml = this.writeNav();
|
132 |
+
|
133 |
+
this._holder.each(this.bind(function(index, element) {
|
134 |
+
var holder = $(element);
|
135 |
+
holder.html(navhtml);
|
136 |
+
this.cacheNavElements(holder, index);
|
137 |
+
this.bindNavHandlers(index);
|
138 |
+
this.disableNavSelection(element);
|
139 |
+
}, this));
|
140 |
+
|
141 |
+
if (this.options.keyBrowse) this.bindNavKeyBrowse();
|
142 |
+
if (this.options.scrollBrowse) this.bindNavScrollBrowse();
|
143 |
+
},
|
144 |
+
|
145 |
+
writeNav : function() {
|
146 |
+
var i = 1, navhtml;
|
147 |
+
navhtml = this.writeBtn("first") + this.writeBtn("previous");
|
148 |
+
for (; i <= this._numPages; i++) {
|
149 |
+
if (i === 1 && this.options.startRange === 0) navhtml += "<span>...</span>";
|
150 |
+
if (i > this.options.startRange && i <= this._numPages - this.options.endRange)
|
151 |
+
navhtml += "<a href='#' class='jp-hidden'>";
|
152 |
+
else
|
153 |
+
navhtml += "<a>";
|
154 |
+
|
155 |
+
switch (this.options.links) {
|
156 |
+
case "numeric":
|
157 |
+
navhtml += i;
|
158 |
+
break;
|
159 |
+
case "blank":
|
160 |
+
break;
|
161 |
+
case "title":
|
162 |
+
var title = this._items.eq(i - 1).attr("data-title");
|
163 |
+
navhtml += title !== undefined ? title : "";
|
164 |
+
break;
|
165 |
+
}
|
166 |
+
|
167 |
+
navhtml += "</a>";
|
168 |
+
if (i === this.options.startRange || i === this._numPages - this.options.endRange)
|
169 |
+
navhtml += "<span>...</span>";
|
170 |
+
}
|
171 |
+
navhtml += this.writeBtn("next") + this.writeBtn("last") + "</div>";
|
172 |
+
return navhtml;
|
173 |
+
},
|
174 |
+
|
175 |
+
writeBtn : function(which) {
|
176 |
+
|
177 |
+
return this.options[which] !== false && !$(this["_" + which]).length ?
|
178 |
+
"<a class='jp-" + which + "'>" + this.options[which] + "</a>" : "";
|
179 |
+
|
180 |
+
},
|
181 |
+
|
182 |
+
cacheNavElements : function(holder, index) {
|
183 |
+
this._nav[index] = {};
|
184 |
+
this._nav[index].holder = holder;
|
185 |
+
this._nav[index].first = this._first.length ? this._first : this._nav[index].holder.find("a.jp-first");
|
186 |
+
this._nav[index].previous = this._previous.length ? this._previous : this._nav[index].holder.find("a.jp-previous");
|
187 |
+
this._nav[index].next = this._next.length ? this._next : this._nav[index].holder.find("a.jp-next");
|
188 |
+
this._nav[index].last = this._last.length ? this._last : this._nav[index].holder.find("a.jp-last");
|
189 |
+
this._nav[index].fstBreak = this._nav[index].holder.find("span:first");
|
190 |
+
this._nav[index].lstBreak = this._nav[index].holder.find("span:last");
|
191 |
+
this._nav[index].pages = this._nav[index].holder.find("a").not(".jp-first, .jp-previous, .jp-next, .jp-last");
|
192 |
+
this._nav[index].permPages =
|
193 |
+
this._nav[index].pages.slice(0, this.options.startRange)
|
194 |
+
.add(this._nav[index].pages.slice(this._numPages - this.options.endRange, this._numPages));
|
195 |
+
this._nav[index].pagesShowing = $([]);
|
196 |
+
this._nav[index].currentPage = $([]);
|
197 |
+
},
|
198 |
+
|
199 |
+
bindNavHandlers : function(index) {
|
200 |
+
var nav = this._nav[index];
|
201 |
+
|
202 |
+
// default nav
|
203 |
+
nav.holder.bind("click.jPages", this.bind(function(evt) {
|
204 |
+
var newPage = this.getNewPage(nav, $(evt.target));
|
205 |
+
if (this.validNewPage(newPage)) {
|
206 |
+
this._clicked = true;
|
207 |
+
this.paginate(newPage);
|
208 |
+
}
|
209 |
+
evt.preventDefault();
|
210 |
+
}, this));
|
211 |
+
|
212 |
+
// custom first
|
213 |
+
if (this._first.length) {
|
214 |
+
this._first.bind("click.jPages", this.bind(function() {
|
215 |
+
if (this.validNewPage(1)) {
|
216 |
+
this._clicked = true;
|
217 |
+
this.paginate(1);
|
218 |
+
}
|
219 |
+
}, this));
|
220 |
+
}
|
221 |
+
|
222 |
+
// custom previous
|
223 |
+
if (this._previous.length) {
|
224 |
+
this._previous.bind("click.jPages", this.bind(function() {
|
225 |
+
var newPage = this._currentPageNum - 1;
|
226 |
+
if (this.validNewPage(newPage)) {
|
227 |
+
this._clicked = true;
|
228 |
+
this.paginate(newPage);
|
229 |
+
}
|
230 |
+
}, this));
|
231 |
+
}
|
232 |
+
|
233 |
+
// custom next
|
234 |
+
if (this._next.length) {
|
235 |
+
this._next.bind("click.jPages", this.bind(function() {
|
236 |
+
var newPage = this._currentPageNum + 1;
|
237 |
+
if (this.validNewPage(newPage)) {
|
238 |
+
this._clicked = true;
|
239 |
+
this.paginate(newPage);
|
240 |
+
}
|
241 |
+
}, this));
|
242 |
+
}
|
243 |
+
|
244 |
+
// custom last
|
245 |
+
if (this._last.length) {
|
246 |
+
this._last.bind("click.jPages", this.bind(function() {
|
247 |
+
if (this.validNewPage(this._numPages)) {
|
248 |
+
this._clicked = true;
|
249 |
+
this.paginate(this._numPages);
|
250 |
+
}
|
251 |
+
}, this));
|
252 |
+
}
|
253 |
+
|
254 |
+
},
|
255 |
+
|
256 |
+
disableNavSelection : function(element) {
|
257 |
+
if (typeof element.onselectstart != "undefined")
|
258 |
+
element.onselectstart = function() {
|
259 |
+
return false;
|
260 |
+
};
|
261 |
+
else if (typeof element.style.MozUserSelect != "undefined")
|
262 |
+
element.style.MozUserSelect = "none";
|
263 |
+
else
|
264 |
+
element.onmousedown = function() {
|
265 |
+
return false;
|
266 |
+
};
|
267 |
+
},
|
268 |
+
|
269 |
+
bindNavKeyBrowse : function() {
|
270 |
+
this.jQdocument.bind("keydown.jPages", this.bind(function(evt) {
|
271 |
+
var target = evt.target.nodeName.toLowerCase();
|
272 |
+
if (this.elemScrolledIntoView() && target !== "input" && target != "textarea") {
|
273 |
+
var newPage = this._currentPageNum;
|
274 |
+
|
275 |
+
if (evt.which == 37) newPage = this._currentPageNum - 1;
|
276 |
+
if (evt.which == 39) newPage = this._currentPageNum + 1;
|
277 |
+
|
278 |
+
if (this.validNewPage(newPage)) {
|
279 |
+
this._clicked = true;
|
280 |
+
this.paginate(newPage);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}, this));
|
284 |
+
},
|
285 |
+
|
286 |
+
elemScrolledIntoView : function() {
|
287 |
+
var docViewTop, docViewBottom, elemTop, elemBottom;
|
288 |
+
docViewTop = this.jQwindow.scrollTop();
|
289 |
+
docViewBottom = docViewTop + this.jQwindow.height();
|
290 |
+
elemTop = this._container.offset().top;
|
291 |
+
elemBottom = elemTop + this._container.height();
|
292 |
+
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom));
|
293 |
+
|
294 |
+
// comment above and uncomment below if you want keyBrowse to happen
|
295 |
+
// only when container is completely visible in the page
|
296 |
+
/*return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) &&
|
297 |
+
(elemBottom <= docViewBottom) && (elemTop >= docViewTop) );*/
|
298 |
+
},
|
299 |
+
|
300 |
+
bindNavScrollBrowse : function() {
|
301 |
+
this._container.bind("mousewheel.jPages DOMMouseScroll.jPages", this.bind(function(evt) {
|
302 |
+
var newPage = (evt.originalEvent.wheelDelta || -evt.originalEvent.detail) > 0 ?
|
303 |
+
(this._currentPageNum - 1) : (this._currentPageNum + 1);
|
304 |
+
if (this.validNewPage(newPage)) {
|
305 |
+
this._clicked = true;
|
306 |
+
this.paginate(newPage);
|
307 |
+
}
|
308 |
+
evt.preventDefault();
|
309 |
+
return false;
|
310 |
+
}, this));
|
311 |
+
},
|
312 |
+
|
313 |
+
getNewPage : function(nav, target) {
|
314 |
+
if (target.is(nav.currentPage)) return this._currentPageNum;
|
315 |
+
if (target.is(nav.pages)) return nav.pages.index(target) + 1;
|
316 |
+
if (target.is(nav.first)) return 1;
|
317 |
+
if (target.is(nav.last)) return this._numPages;
|
318 |
+
if (target.is(nav.previous)) return nav.pages.index(nav.currentPage);
|
319 |
+
if (target.is(nav.next)) return nav.pages.index(nav.currentPage) + 2;
|
320 |
+
},
|
321 |
+
|
322 |
+
validNewPage : function(newPage) {
|
323 |
+
return newPage !== this._currentPageNum && newPage > 0 && newPage <= this._numPages;
|
324 |
+
},
|
325 |
+
|
326 |
+
paginate : function(page) {
|
327 |
+
var itemRange, pageInterval;
|
328 |
+
itemRange = this.updateItems(page);
|
329 |
+
pageInterval = this.updatePages(page);
|
330 |
+
this._currentPageNum = page;
|
331 |
+
if ($.isFunction(this.options.callback))
|
332 |
+
this.callback(page, itemRange, pageInterval);
|
333 |
+
|
334 |
+
this.updatePause();
|
335 |
+
},
|
336 |
+
|
337 |
+
updateItems : function(page) {
|
338 |
+
var range = this.getItemRange(page);
|
339 |
+
this._itemsHiding = this._itemsShowing;
|
340 |
+
this._itemsShowing = this._items.slice(range.start, range.end);
|
341 |
+
if (this._cssAnimSupport && this.options.animation.length) this.cssAnimations(page);
|
342 |
+
else this.jQAnimations(page);
|
343 |
+
return range;
|
344 |
+
},
|
345 |
+
|
346 |
+
getItemRange : function(page) {
|
347 |
+
var range = {};
|
348 |
+
range.start = (page - 1) * this.options.perPage;
|
349 |
+
range.end = range.start + this.options.perPage;
|
350 |
+
if (range.end > this._items.length) range.end = this._items.length;
|
351 |
+
return range;
|
352 |
+
},
|
353 |
+
|
354 |
+
cssAnimations : function(page) {
|
355 |
+
clearInterval(this._delay);
|
356 |
+
|
357 |
+
this._itemsHiding
|
358 |
+
.removeClass(this.options.animation + " jp-invisible")
|
359 |
+
.addClass("jp-hidden");
|
360 |
+
|
361 |
+
this._itemsShowing
|
362 |
+
.removeClass("jp-hidden")
|
363 |
+
.addClass("jp-invisible");
|
364 |
+
|
365 |
+
this._itemsOriented = this.getDirectedItems(page);
|
366 |
+
this._index = 0;
|
367 |
+
|
368 |
+
this._delay = setInterval(this.bind(function() {
|
369 |
+
if (this._index === this._itemsOriented.length) clearInterval(this._delay);
|
370 |
+
else {
|
371 |
+
this._itemsOriented
|
372 |
+
.eq(this._index)
|
373 |
+
.removeClass("jp-invisible")
|
374 |
+
.addClass(this.options.animation);
|
375 |
+
}
|
376 |
+
this._index = this._index + 1;
|
377 |
+
}, this), this.options.delay);
|
378 |
+
},
|
379 |
+
|
380 |
+
jQAnimations : function(page) {
|
381 |
+
clearInterval(this._delay);
|
382 |
+
this._itemsHiding.addClass("jp-hidden");
|
383 |
+
this._itemsShowing.fadeTo(0, 0).removeClass("jp-hidden");
|
384 |
+
this._itemsOriented = this.getDirectedItems(page);
|
385 |
+
this._index = 0;
|
386 |
+
this._delay = setInterval(this.bind(function() {
|
387 |
+
if (this._index === this._itemsOriented.length) clearInterval(this._delay);
|
388 |
+
else {
|
389 |
+
this._itemsOriented
|
390 |
+
.eq(this._index)
|
391 |
+
.fadeTo(this.options.fallback, 1);
|
392 |
+
}
|
393 |
+
this._index = this._index + 1;
|
394 |
+
}, this), this.options.delay);
|
395 |
+
},
|
396 |
+
|
397 |
+
getDirectedItems : function(page) {
|
398 |
+
var itemsToShow;
|
399 |
+
|
400 |
+
switch (this.options.direction) {
|
401 |
+
case "backwards":
|
402 |
+
itemsToShow = $(this._itemsShowing.get().reverse());
|
403 |
+
break;
|
404 |
+
case "random":
|
405 |
+
itemsToShow = $(this._itemsShowing.get().sort(function() {
|
406 |
+
return (Math.round(Math.random()) - 0.5);
|
407 |
+
}));
|
408 |
+
break;
|
409 |
+
case "auto":
|
410 |
+
itemsToShow = page >= this._currentPageNum ?
|
411 |
+
this._itemsShowing : $(this._itemsShowing.get().reverse());
|
412 |
+
break;
|
413 |
+
default:
|
414 |
+
itemsToShow = this._itemsShowing;
|
415 |
+
}
|
416 |
+
|
417 |
+
return itemsToShow;
|
418 |
+
},
|
419 |
+
|
420 |
+
updatePages : function(page) {
|
421 |
+
var interval, index, nav;
|
422 |
+
interval = this.getInterval(page);
|
423 |
+
for (index in this._nav) {
|
424 |
+
if (this._nav.hasOwnProperty(index)) {
|
425 |
+
nav = this._nav[index];
|
426 |
+
this.updateBtns(nav, page);
|
427 |
+
this.updateCurrentPage(nav, page);
|
428 |
+
this.updatePagesShowing(nav, interval);
|
429 |
+
this.updateBreaks(nav, interval);
|
430 |
+
}
|
431 |
+
}
|
432 |
+
return interval;
|
433 |
+
},
|
434 |
+
|
435 |
+
getInterval : function(page) {
|
436 |
+
var neHalf, upperLimit, start, end;
|
437 |
+
neHalf = Math.ceil(this.options.midRange / 2);
|
438 |
+
upperLimit = this._numPages - this.options.midRange;
|
439 |
+
start = page > neHalf ? Math.max(Math.min(page - neHalf, upperLimit), 0) : 0;
|
440 |
+
end = page > neHalf ?
|
441 |
+
Math.min(page + neHalf - (this.options.midRange % 2 > 0 ? 1 : 0), this._numPages) :
|
442 |
+
Math.min(this.options.midRange, this._numPages);
|
443 |
+
return {start: start,end: end};
|
444 |
+
},
|
445 |
+
|
446 |
+
updateBtns : function(nav, page) {
|
447 |
+
if (page === 1) {
|
448 |
+
nav.first.addClass("jp-disabled");
|
449 |
+
nav.previous.addClass("jp-disabled");
|
450 |
+
}
|
451 |
+
if (page === this._numPages) {
|
452 |
+
nav.next.addClass("jp-disabled");
|
453 |
+
nav.last.addClass("jp-disabled");
|
454 |
+
}
|
455 |
+
if (this._currentPageNum === 1 && page > 1) {
|
456 |
+
nav.first.removeClass("jp-disabled");
|
457 |
+
nav.previous.removeClass("jp-disabled");
|
458 |
+
}
|
459 |
+
if (this._currentPageNum === this._numPages && page < this._numPages) {
|
460 |
+
nav.next.removeClass("jp-disabled");
|
461 |
+
nav.last.removeClass("jp-disabled");
|
462 |
+
}
|
463 |
+
},
|
464 |
+
|
465 |
+
updateCurrentPage : function(nav, page) {
|
466 |
+
nav.currentPage.removeClass("jp-current");
|
467 |
+
nav.currentPage = nav.pages.eq(page - 1).addClass("jp-current");
|
468 |
+
},
|
469 |
+
|
470 |
+
updatePagesShowing : function(nav, interval) {
|
471 |
+
var newRange = nav.pages.slice(interval.start, interval.end).not(nav.permPages);
|
472 |
+
nav.pagesShowing.not(newRange).addClass("jp-hidden");
|
473 |
+
newRange.not(nav.pagesShowing).removeClass("jp-hidden");
|
474 |
+
nav.pagesShowing = newRange;
|
475 |
+
},
|
476 |
+
|
477 |
+
updateBreaks : function(nav, interval) {
|
478 |
+
if (
|
479 |
+
interval.start > this.options.startRange ||
|
480 |
+
(this.options.startRange === 0 && interval.start > 0)
|
481 |
+
) nav.fstBreak.removeClass("jp-hidden");
|
482 |
+
else nav.fstBreak.addClass("jp-hidden");
|
483 |
+
|
484 |
+
if (interval.end < this._numPages - this.options.endRange) nav.lstBreak.removeClass("jp-hidden");
|
485 |
+
else nav.lstBreak.addClass("jp-hidden");
|
486 |
+
},
|
487 |
+
|
488 |
+
callback : function(page, itemRange, pageInterval) {
|
489 |
+
var pages = {
|
490 |
+
current: page,
|
491 |
+
interval: pageInterval,
|
492 |
+
count: this._numPages
|
493 |
+
},
|
494 |
+
items = {
|
495 |
+
showing: this._itemsShowing,
|
496 |
+
oncoming: this._items.slice(itemRange.start + this.options.perPage, itemRange.end + this.options.perPage),
|
497 |
+
range: itemRange,
|
498 |
+
count: this._items.length
|
499 |
+
};
|
500 |
+
|
501 |
+
pages.interval.start = pages.interval.start + 1;
|
502 |
+
items.range.start = items.range.start + 1;
|
503 |
+
this.options.callback(pages, items);
|
504 |
+
},
|
505 |
+
|
506 |
+
updatePause : function() {
|
507 |
+
if (this.options.pause && this._numPages > 1) {
|
508 |
+
clearTimeout(this._pause);
|
509 |
+
if (this.options.clickStop && this._clicked) return;
|
510 |
+
else {
|
511 |
+
this._pause = setTimeout(this.bind(function() {
|
512 |
+
this.paginate(this._currentPageNum !== this._numPages ? this._currentPageNum + 1 : 1);
|
513 |
+
}, this), this.options.pause);
|
514 |
+
}
|
515 |
+
}
|
516 |
+
},
|
517 |
+
|
518 |
+
setMinHeight : function() {
|
519 |
+
if (this.options.minHeight && !this._container.is("table, tbody")) {
|
520 |
+
setTimeout(this.bind(function() {
|
521 |
+
this._container.css({ "min-height": this._container.css("height") });
|
522 |
+
}, this), 1000);
|
523 |
+
}
|
524 |
+
},
|
525 |
+
|
526 |
+
bind : function(fn, me) {
|
527 |
+
return function() {
|
528 |
+
return fn.apply(me, arguments);
|
529 |
+
};
|
530 |
+
},
|
531 |
+
|
532 |
+
destroy : function() {
|
533 |
+
this.jQdocument.unbind("keydown.jPages");
|
534 |
+
this._container.unbind("mousewheel.jPages DOMMouseScroll.jPages");
|
535 |
+
|
536 |
+
if (this.options.minHeight) this._container.css("min-height", "");
|
537 |
+
if (this._cssAnimSupport && this.options.animation.length)
|
538 |
+
this._items.removeClass("animated jp-hidden jp-invisible " + this.options.animation);
|
539 |
+
else this._items.removeClass("jp-hidden").fadeTo(0, 1);
|
540 |
+
this._holder.unbind("click.jPages").empty();
|
541 |
+
}
|
542 |
+
|
543 |
+
};
|
544 |
+
|
545 |
+
$.fn[name] = function(arg) {
|
546 |
+
var type = $.type(arg);
|
547 |
+
|
548 |
+
if (type === "object") {
|
549 |
+
if (this.length && !$.data(this, name)) {
|
550 |
+
instance = new Plugin(this, arg);
|
551 |
+
this.each(function() {
|
552 |
+
$.data(this, name, instance);
|
553 |
+
});
|
554 |
+
}
|
555 |
+
return this;
|
556 |
+
}
|
557 |
+
|
558 |
+
if (type === "string" && arg === "destroy") {
|
559 |
+
instance.destroy();
|
560 |
+
this.each(function() {
|
561 |
+
$.removeData(this, name);
|
562 |
+
});
|
563 |
+
return this;
|
564 |
+
}
|
565 |
+
|
566 |
+
if (type === 'number' && arg % 1 === 0) {
|
567 |
+
if (instance.validNewPage(arg)) instance.paginate(arg);
|
568 |
+
return this;
|
569 |
+
}
|
570 |
+
|
571 |
+
return this;
|
572 |
+
};
|
573 |
+
|
574 |
+
})(jQuery, window, document);
|
js/metaseo_admin.js
CHANGED
@@ -754,7 +754,6 @@ function importMetaData(that, event){
|
|
754 |
if(response.success == true){
|
755 |
element.find('span.spinner-light').fadeOut(500);
|
756 |
jQuery('.metaseo-import-wrn').closest('.error').fadeOut(1500);
|
757 |
-
console.log(location.href);
|
758 |
//Refresh the page to see al changed after import Yoast or AIO data into MetaSEO
|
759 |
if( location.href.search('page=metaseo_content_meta') != -1 ){
|
760 |
location.reload();
|
754 |
if(response.success == true){
|
755 |
element.find('span.spinner-light').fadeOut(500);
|
756 |
jQuery('.metaseo-import-wrn').closest('.error').fadeOut(1500);
|
|
|
757 |
//Refresh the page to see al changed after import Yoast or AIO data into MetaSEO
|
758 |
if( location.href.search('page=metaseo_content_meta') != -1 ){
|
759 |
location.reload();
|
js/metaseo_sitemap.js
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
$(document).ready(function(){
|
3 |
+
$(".holder_posts").jPages({
|
4 |
+
containerID: "wrap_sitemap_option_posts",
|
5 |
+
previous: "←",
|
6 |
+
next: "→",
|
7 |
+
perPage: 100,
|
8 |
+
delay: 20
|
9 |
+
});
|
10 |
+
|
11 |
+
$(".holder_pages").jPages({
|
12 |
+
containerID: "wrap_sitemap_option_pages",
|
13 |
+
previous: "←",
|
14 |
+
next: "→",
|
15 |
+
perPage: 100,
|
16 |
+
delay: 20
|
17 |
+
});
|
18 |
+
|
19 |
+
jQuery('.wpms_source_sitemaps tr label,.wpms_row h3 input').qtip({
|
20 |
+
content: {
|
21 |
+
attr: 'for'
|
22 |
+
},
|
23 |
+
position: {
|
24 |
+
my: 'bottom left',
|
25 |
+
at: 'top center'
|
26 |
+
},
|
27 |
+
style: {
|
28 |
+
tip: {
|
29 |
+
corner: true,
|
30 |
+
},
|
31 |
+
classes: 'metaseo-qtip qtip-rounded'
|
32 |
+
},
|
33 |
+
show: 'hover',
|
34 |
+
hide: {
|
35 |
+
fixed: true,
|
36 |
+
delay: 10
|
37 |
+
}
|
38 |
+
|
39 |
+
});
|
40 |
+
|
41 |
+
$('.wpms_save_create_sitemaps').on('click',function(){
|
42 |
+
wpms_save_create_sitemaps();
|
43 |
+
});
|
44 |
+
|
45 |
+
wpms_save_create_sitemaps = function(){
|
46 |
+
$('.spinner_save_sitemaps').css({'visibility':'visible'}).show();
|
47 |
+
var posts = {} , pages = {} , menus = {} , taxonomies = [] , columns_menu = {} , wpms_category_link = [];
|
48 |
+
$(".wpms_xmap_posts").each(function(i,v){
|
49 |
+
if($(v).is(':checked')){
|
50 |
+
var id = $(v).val();
|
51 |
+
var priority = $('#priority_posts_'+id).val();
|
52 |
+
var frequency = $('#frequency_posts_'+id).val();
|
53 |
+
posts[id] = {'post_id':id , 'priority' : priority , 'frequency' : frequency};
|
54 |
+
}
|
55 |
+
});
|
56 |
+
|
57 |
+
$(".wpms_xmap_pages").each(function(i,v){
|
58 |
+
if($(v).is(':checked')){
|
59 |
+
var id = $(v).val();
|
60 |
+
var priority = $('#priority_pages_'+id).val();
|
61 |
+
var frequency = $('#frequency_pages_'+id).val();
|
62 |
+
pages[id] = {'post_id':id , 'priority' : priority , 'frequency' : frequency};
|
63 |
+
}
|
64 |
+
});
|
65 |
+
|
66 |
+
$(".wpms_xmap_menu").each(function(i,v){
|
67 |
+
if($(v).is(':checked')){
|
68 |
+
var id = $(v).val();
|
69 |
+
var priority = $('#priority_menu_'+id).val();
|
70 |
+
var frequency = $('#frequency_menu_'+id).val();
|
71 |
+
menus[id] = {'menu_id':id , 'priority' : priority , 'frequency' : frequency};
|
72 |
+
}
|
73 |
+
});
|
74 |
+
|
75 |
+
$('.wpms_sitemap_taxonomies').each(function(i,v){
|
76 |
+
if($(v).is(':checked')){
|
77 |
+
taxonomies.push($(v).val());
|
78 |
+
}
|
79 |
+
});
|
80 |
+
|
81 |
+
$('.sitemap_addlink_categories').each(function(i,v){
|
82 |
+
if($(v).is(':checked')){
|
83 |
+
wpms_category_link.push($(v).val());
|
84 |
+
}
|
85 |
+
});
|
86 |
+
|
87 |
+
if($('#wpms_sitemap_author').is(':checked')){
|
88 |
+
var wpms_sitemap_author = 1;
|
89 |
+
}else{
|
90 |
+
var wpms_sitemap_author = 0;
|
91 |
+
}
|
92 |
+
|
93 |
+
if($('#wpms_sitemap_root').is(':checked')){
|
94 |
+
var wpms_sitemap_root = 1;
|
95 |
+
}else{
|
96 |
+
var wpms_sitemap_root = 0;
|
97 |
+
}
|
98 |
+
|
99 |
+
if($('#wpms_sitemap_add').is(':checked')){
|
100 |
+
var wpms_sitemap_add = 1;
|
101 |
+
}else{
|
102 |
+
var wpms_sitemap_add = 0;
|
103 |
+
}
|
104 |
+
|
105 |
+
$('.wpms_display_column_menus').each(function(i,v){
|
106 |
+
var menu_id = $(v).data('menu_id');
|
107 |
+
columns_menu[menu_id] = $(v).val()
|
108 |
+
});
|
109 |
+
|
110 |
+
$.ajax({
|
111 |
+
url : ajaxurl,
|
112 |
+
method : 'POST',
|
113 |
+
dataType : 'json',
|
114 |
+
data : {
|
115 |
+
action : 'wpms_save_sitemap_settings',
|
116 |
+
wpms_sitemap_posts : JSON.stringify(posts),
|
117 |
+
wpms_sitemap_pages : JSON.stringify(pages),
|
118 |
+
wpms_sitemap_menus : JSON.stringify(menus),
|
119 |
+
wpms_html_sitemap_page : $('#wpms_html_sitemap_page').val(),
|
120 |
+
wpms_html_sitemap_column : $('#wpms_html_sitemap_column').val(),
|
121 |
+
wpms_html_sitemap_position : $('#wpms_html_sitemap_position').val(),
|
122 |
+
wpms_check_firstsave : $('#wpms_check_firstsave').val(),
|
123 |
+
wpms_sitemap_author : wpms_sitemap_author,
|
124 |
+
wpms_sitemap_root : wpms_sitemap_root,
|
125 |
+
wpms_sitemap_add : wpms_sitemap_add,
|
126 |
+
wpms_category_link : wpms_category_link,
|
127 |
+
wpms_sitemap_taxonomies : taxonomies,
|
128 |
+
wpms_public_name_posts : $('.public_name_posts').val(),
|
129 |
+
wpms_public_name_pages : $('.public_name_pages').val(),
|
130 |
+
wpms_display_column_menus : JSON.stringify(columns_menu),
|
131 |
+
wpms_display_column_posts : $('.wpms_display_column_posts').val(),
|
132 |
+
wpms_display_column_pages : $('.wpms_display_column_pages').val()
|
133 |
+
},
|
134 |
+
success : function (res){
|
135 |
+
wpms_regen_sitemaps();
|
136 |
+
}
|
137 |
+
});
|
138 |
+
}
|
139 |
+
|
140 |
+
wpms_regen_sitemaps = function(){
|
141 |
+
$.ajax({
|
142 |
+
url : ajaxurl,
|
143 |
+
method : 'POST',
|
144 |
+
dataType : 'json',
|
145 |
+
data : {
|
146 |
+
action : 'wpms_regenerate_sitemaps'
|
147 |
+
},
|
148 |
+
success : function (res){
|
149 |
+
$('.spinner_save_sitemaps').hide();
|
150 |
+
}
|
151 |
+
});
|
152 |
+
}
|
153 |
+
|
154 |
+
var wpms_columns = ['Zezo' , 'One' , 'Two' , 'Three'];
|
155 |
+
$('#wpms_html_sitemap_column').on('change',function(){
|
156 |
+
$('.wpms_display_column').html(null);
|
157 |
+
for (var i=1 ; i<= parseInt($(this).val()) ; i++){
|
158 |
+
$('.wpms_display_column').append('<option value="'+ i +'">'+wpms_columns[i]+'</option>');
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
$('.sitemap_check_all_posts_categories').on('click',function(){
|
163 |
+
var category = $(this).data('category');
|
164 |
+
if($(this).is(':checked')){
|
165 |
+
$('.'+category).prop('checked',true);
|
166 |
+
}else{
|
167 |
+
$('.'+category).prop('checked',false);
|
168 |
+
}
|
169 |
+
});
|
170 |
+
|
171 |
+
$('.sitemap_check_all').on('click',function(){
|
172 |
+
var type = $(this).data('type');
|
173 |
+
if($(this).is(':checked')){
|
174 |
+
$('.cb_sitemaps_'+type).prop('checked',true);
|
175 |
+
}else{
|
176 |
+
$('.cb_sitemaps_'+type).prop('checked',false);
|
177 |
+
}
|
178 |
+
});
|
179 |
+
|
180 |
+
$('.sitemap_check_all_posts_in_page').on('click',function(){
|
181 |
+
var type = $(this).data('type');
|
182 |
+
if($(this).is(':checked')){
|
183 |
+
$('.wpms_row').not('.jp-hidden').find('.cb_sitemaps_'+type).prop('checked',true);
|
184 |
+
}else{
|
185 |
+
$('.wpms_row').not('.jp-hidden').find('.cb_sitemaps_'+type).prop('checked',false);
|
186 |
+
}
|
187 |
+
});
|
188 |
+
|
189 |
+
$('.nav-tab').on('click',function(){
|
190 |
+
var tab = $(this).data('tab');
|
191 |
+
$('.nav-tab').removeClass('nav-tab-active');
|
192 |
+
$(this).addClass('nav-tab-active');
|
193 |
+
$('.wpms_source').hide();
|
194 |
+
$('.wpms_source_'+tab).show();
|
195 |
+
});
|
196 |
+
|
197 |
+
});
|
198 |
+
}(jQuery));
|
js/site-jPages.js
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
$(document).ready(function(){
|
3 |
+
|
4 |
+
$(".holder_sitemaps_pages").jPages({
|
5 |
+
containerID: "sitemap_pages",
|
6 |
+
previous: "←",
|
7 |
+
next: "→",
|
8 |
+
perPage: 50,
|
9 |
+
delay: 20
|
10 |
+
});
|
11 |
+
|
12 |
+
$(".holder_sitemaps_posts").jPages({
|
13 |
+
containerID: "sitemap_posts",
|
14 |
+
previous: "←",
|
15 |
+
next: "→",
|
16 |
+
perPage: 50,
|
17 |
+
delay: 20
|
18 |
+
});
|
19 |
+
|
20 |
+
$.each(wpms_avarible.wpms_display_column_menus , function(i , v){
|
21 |
+
$(".holder_sitemaps_menus_"+i).jPages({
|
22 |
+
containerID: "sitemap_menus_"+i,
|
23 |
+
previous: "←",
|
24 |
+
next: "→",
|
25 |
+
perPage: 50,
|
26 |
+
delay: 20
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
});
|
31 |
+
}(jQuery));
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: JoomUnited
|
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.5.2
|
6 |
-
Stable tag:
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -11,7 +11,7 @@ WP Meta SEO gives you the control over all your meta content and images. Bulk SE
|
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
= WP meta SEO got
|
15 |
|
16 |
* Bulk edit all website meta on a single view
|
17 |
* Edit meta in content with live SEO analysis
|
@@ -19,6 +19,7 @@ WP Meta SEO gives you the control over all your meta content and images. Bulk SE
|
|
19 |
* Bulk edit image file name and meta
|
20 |
* Bulk edit SEO link title
|
21 |
* 404 errors redirect and internal broken link checker
|
|
|
22 |
* Facebook and Twitter social sharing custom elements per content
|
23 |
|
24 |
|
@@ -70,6 +71,13 @@ The redirect manager will help you to fix all types of 404 errors you can encoun
|
|
70 |
* Use the default theme 404 page
|
71 |
* WP Meta SEO 404 page is editable like any other WordPress page
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
**More details here:** http://www.joomunited.com/wordpress-products/wp-meta-seo
|
75 |
|
@@ -115,6 +123,13 @@ The redirect manager will help you to fix all types of 404 errors you can encoun
|
|
115 |
* Follow/Nofollow bulk link edition
|
116 |
* Follow/Nofollow on Wordpress content
|
117 |
* Page title display as content title or SEO meta title
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
= Main plugins from JoomUnited: =
|
120 |
* WP Media Folder: https://www.joomunited.com/wordpress-products/wp-media-folder
|
@@ -127,9 +142,9 @@ The redirect manager will help you to fix all types of 404 errors you can encoun
|
|
127 |
|
128 |
= Support =
|
129 |
|
130 |
-
A
|
131 |
Feel free to ask SEO questions on our forum or here in the support section
|
132 |
-
**
|
133 |
|
134 |
== Installation ==
|
135 |
|
@@ -192,6 +207,13 @@ Because it may helps in some case for SEO, mainly for multilingual website, it h
|
|
192 |
Yes, it may be the case when, for example, you are calling 3rd party plugins in content or using specific page layouts. You have a global option to force validation of SEO criteria.
|
193 |
This manual SEO validation on click on the reload analysis button.
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
== Screenshots ==
|
196 |
|
197 |
1. Main dashboard of the plugin with SEO optimization check
|
@@ -205,6 +227,17 @@ This manual SEO validation on click on the reload analysis button.
|
|
205 |
|
206 |
== Changelog ==
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
= 2.2.1 =
|
209 |
* Update sql sentences to improve query speed
|
210 |
|
@@ -321,10 +354,8 @@ You WON'T lose any SEO content: meta, alt, titles...
|
|
321 |
|
322 |
== Requirements ==
|
323 |
|
324 |
-
= !!NEW in latest & fresh
|
325 |
-
|
326 |
-
You can now manage all you images and compression from the ImageRecycle plugin, menu Media > ImageRecycle.
|
327 |
-
ImageRecycle got a dedicated plugin for WordPress that run the images optimization automatically on your website & PDF. In order to start the optimization process, please install the WordPress plugin. Enjoy!
|
328 |
|
329 |
= SEO vision =
|
330 |
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.5.2
|
6 |
+
Stable tag: 3.0.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
= WP meta SEO got 8 major functionalities: =
|
15 |
|
16 |
* Bulk edit all website meta on a single view
|
17 |
* Edit meta in content with live SEO analysis
|
19 |
* Bulk edit image file name and meta
|
20 |
* Bulk edit SEO link title
|
21 |
* 404 errors redirect and internal broken link checker
|
22 |
+
* Generate XML and HTML sitemaps
|
23 |
* Facebook and Twitter social sharing custom elements per content
|
24 |
|
25 |
|
71 |
* Use the default theme 404 page
|
72 |
* WP Meta SEO 404 page is editable like any other WordPress page
|
73 |
|
74 |
+
= XML sitemap & HTML sitemap =
|
75 |
+
|
76 |
+
* Generate automatically xml sitemap
|
77 |
+
* Generate automatically HTML sitemap
|
78 |
+
* Sitemap source: menu selection (can be any content type), post, category of post, pages, author content
|
79 |
+
* Setup update frequency and priority for each sitemap link
|
80 |
+
|
81 |
|
82 |
**More details here:** http://www.joomunited.com/wordpress-products/wp-meta-seo
|
83 |
|
123 |
* Follow/Nofollow bulk link edition
|
124 |
* Follow/Nofollow on Wordpress content
|
125 |
* Page title display as content title or SEO meta title
|
126 |
+
* Generate automatically xml sitemap
|
127 |
+
* Generate automatically HTML sitemap
|
128 |
+
* Sitemap source: menu selection (can be any content type), post, category of post, pages, author content
|
129 |
+
* Setup update frequency and priority for each sitemap link
|
130 |
+
* Copy and sync a xml sitemap to root for external SEO tool
|
131 |
+
* HTML sitemap display with 3 columns and display position for each type of content
|
132 |
+
* Add link in the robot.txt
|
133 |
|
134 |
= Main plugins from JoomUnited: =
|
135 |
* WP Media Folder: https://www.joomunited.com/wordpress-products/wp-media-folder
|
142 |
|
143 |
= Support =
|
144 |
|
145 |
+
A HTML support document is provided with WP Meta SEO on JoomUnited website
|
146 |
Feel free to ask SEO questions on our forum or here in the support section
|
147 |
+
**Documentation here:** https://www.joomunited.com/documentation/wp-meta-seo-documentation
|
148 |
|
149 |
== Installation ==
|
150 |
|
207 |
Yes, it may be the case when, for example, you are calling 3rd party plugins in content or using specific page layouts. You have a global option to force validation of SEO criteria.
|
208 |
This manual SEO validation on click on the reload analysis button.
|
209 |
|
210 |
+
= How do I submit my sitemap to the Google Search Console? =
|
211 |
+
From the Sitemap section of the plugin, you got a link to the XML sitemap page. Just copy/paste the link in the Google search console.
|
212 |
+
You can also use the link: www.your-website.com/sitemap.xml after checking the option to copy the sitemap to the WordPress install root.
|
213 |
+
|
214 |
+
= Is there a real interest for SEO to display a HTML sitemap? =
|
215 |
+
It could be! if you have a lot of pages that need to be indexed with no specific priority. Our advice is to keep only the main menus of your website in the HTML sitemap.
|
216 |
+
|
217 |
== Screenshots ==
|
218 |
|
219 |
1. Main dashboard of the plugin with SEO optimization check
|
227 |
|
228 |
== Changelog ==
|
229 |
|
230 |
+
= 3.0.0 =
|
231 |
+
* Add XML sitemap feature
|
232 |
+
* Add HTML sitemap feature
|
233 |
+
* Add sitemap source: menus (any content), post, page, category, author
|
234 |
+
* Add HTML sitemap content position in page
|
235 |
+
* Add XML sitemap copy option on root option
|
236 |
+
* Add XML sitemap link in robot.txt option
|
237 |
+
* Add help text for all the sitemap parameters
|
238 |
+
* Add help text for all the global parameters
|
239 |
+
* Add AJAX sitemap regeneration
|
240 |
+
|
241 |
= 2.2.1 =
|
242 |
* Update sql sentences to improve query speed
|
243 |
|
354 |
|
355 |
== Requirements ==
|
356 |
|
357 |
+
= !!NEW in latest & fresh 3.0 version!! =
|
358 |
+
Sitemap feature with XML for the Google Search console and HTML with display option.
|
|
|
|
|
359 |
|
360 |
= SEO vision =
|
361 |
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version:
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
@@ -47,7 +47,7 @@ if (!defined('URL'))
|
|
47 |
define('URL', get_site_url());
|
48 |
|
49 |
if (!defined('WPMSEO_VERSION')) {
|
50 |
-
define('WPMSEO_VERSION', '
|
51 |
}
|
52 |
|
53 |
if (!defined('WPMSEO_FILE'))
|
@@ -59,16 +59,16 @@ register_deactivation_hook(__FILE__, array('WpMetaSeo', 'plugin_deactivation'));
|
|
59 |
|
60 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.wp-metaseo.php' );
|
61 |
add_action('init', array('WpMetaSeo', 'init'));
|
62 |
-
|
|
|
63 |
if (is_admin()) {
|
64 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-content-list-table.php' );
|
65 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-image-list-table.php' );
|
66 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-dashboard.php' );
|
67 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-broken-link-table.php' );
|
68 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-admin.php' );
|
69 |
-
|
70 |
$GLOBALS['metaseo_admin'] = new MetaSeo_Admin;
|
71 |
-
|
72 |
add_filter('wp_prepare_attachment_for_js', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_js'), 10, 2);
|
73 |
add_filter('image_size_names_choose', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_choose'), 10, 1);
|
74 |
add_filter( 'user_contactmethods','metaseo_contactuser', 10, 1 );
|
@@ -86,11 +86,11 @@ if (is_admin()) {
|
|
86 |
add_action('init', 'buffer_start');
|
87 |
add_action('wp_head', 'buffer_end');
|
88 |
|
89 |
-
function buffer_start() { ob_start("
|
90 |
|
91 |
function buffer_end() { ob_end_flush();}
|
92 |
|
93 |
-
function
|
94 |
// modify buffer here, and then return the updated code
|
95 |
global $wp_query;
|
96 |
// get meta title
|
@@ -201,7 +201,7 @@ if (is_admin()) {
|
|
201 |
}
|
202 |
|
203 |
// is front page
|
204 |
-
if(is_front_page()){
|
205 |
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metatitle', true));
|
206 |
$meta_description = $meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
207 |
$page_follow = get_post_meta($mpage_on_front,'_metaseo_metafollow',true);
|
@@ -454,7 +454,6 @@ function metaseo_utf8($obj, $action = 'encode'){
|
|
454 |
}
|
455 |
}
|
456 |
elseif(is_string($el)){
|
457 |
-
//var_dump(mb_detect_encoding($el));
|
458 |
$isASCII = mb_detect_encoding($el, 'ASCII');
|
459 |
if($action === 'encode' && !$isASCII){
|
460 |
$el = mb_convert_encoding($el, "UTF-8", "auto");
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 3.0.0
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
47 |
define('URL', get_site_url());
|
48 |
|
49 |
if (!defined('WPMSEO_VERSION')) {
|
50 |
+
define('WPMSEO_VERSION', '3.0.0');
|
51 |
}
|
52 |
|
53 |
if (!defined('WPMSEO_FILE'))
|
59 |
|
60 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.wp-metaseo.php' );
|
61 |
add_action('init', array('WpMetaSeo', 'init'));
|
62 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-sitemap.php' );
|
63 |
+
$GLOBALS['metaseo_sitemap'] = new MetaSeo_Sitemap;
|
64 |
if (is_admin()) {
|
65 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-content-list-table.php' );
|
66 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-image-list-table.php' );
|
67 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-dashboard.php' );
|
68 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-broken-link-table.php' );
|
69 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-admin.php' );
|
|
|
70 |
$GLOBALS['metaseo_admin'] = new MetaSeo_Admin;
|
71 |
+
|
72 |
add_filter('wp_prepare_attachment_for_js', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_js'), 10, 2);
|
73 |
add_filter('image_size_names_choose', array('MetaSeo_Image_List_Table', 'add_more_attachment_sizes_choose'), 10, 1);
|
74 |
add_filter( 'user_contactmethods','metaseo_contactuser', 10, 1 );
|
86 |
add_action('init', 'buffer_start');
|
87 |
add_action('wp_head', 'buffer_end');
|
88 |
|
89 |
+
function buffer_start() { ob_start("wpms_callback");}
|
90 |
|
91 |
function buffer_end() { ob_end_flush();}
|
92 |
|
93 |
+
function wpms_callback($buffer) {
|
94 |
// modify buffer here, and then return the updated code
|
95 |
global $wp_query;
|
96 |
// get meta title
|
201 |
}
|
202 |
|
203 |
// is front page
|
204 |
+
if(is_front_page() && 'page' == get_option( 'show_on_front' ) && is_page( get_option( 'page_on_front' ) ) ){
|
205 |
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metatitle', true));
|
206 |
$meta_description = $meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
207 |
$page_follow = get_post_meta($mpage_on_front,'_metaseo_metafollow',true);
|
454 |
}
|
455 |
}
|
456 |
elseif(is_string($el)){
|
|
|
457 |
$isASCII = mb_detect_encoding($el, 'ASCII');
|
458 |
if($action === 'encode' && !$isASCII){
|
459 |
$el = mb_convert_encoding($el, "UTF-8", "auto");
|
wpms-sitemap.xsl
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<xsl:stylesheet version="2.0"
|
3 |
+
xmlns:html="http://www.w3.org/TR/REC-html40"
|
4 |
+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
5 |
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
6 |
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
7 |
+
<xsl:template match="/">
|
8 |
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
9 |
+
<head>
|
10 |
+
<title>XML Sitemap</title>
|
11 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
12 |
+
<style type="text/css">
|
13 |
+
body {
|
14 |
+
font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
|
15 |
+
font-size: 13px;
|
16 |
+
}
|
17 |
+
|
18 |
+
#header {
|
19 |
+
text-align: center;
|
20 |
+
padding-top: 14px;
|
21 |
+
padding-bottom: 29px;
|
22 |
+
}
|
23 |
+
|
24 |
+
h1 {
|
25 |
+
font-weight: normal;
|
26 |
+
font-size: 24px;
|
27 |
+
line-height: 20px;
|
28 |
+
color: #333333;
|
29 |
+
}
|
30 |
+
|
31 |
+
h2 {
|
32 |
+
font-weight: normal;
|
33 |
+
font-size: 13px;
|
34 |
+
color: #aaaaaa;
|
35 |
+
line-height: 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
#content {
|
39 |
+
background: #f8f8f8;
|
40 |
+
border-top: 1px solid #dddddd;
|
41 |
+
padding-top: 50px;
|
42 |
+
}
|
43 |
+
|
44 |
+
#content a:visited,
|
45 |
+
#content tr:hover a:visited {
|
46 |
+
color: #68009c;
|
47 |
+
}
|
48 |
+
|
49 |
+
table {
|
50 |
+
margin: 0 auto;
|
51 |
+
text-align: left;
|
52 |
+
}
|
53 |
+
|
54 |
+
tr#table-header:hover {
|
55 |
+
background: none;
|
56 |
+
}
|
57 |
+
|
58 |
+
tr:hover {
|
59 |
+
background: #ebebeb;
|
60 |
+
}
|
61 |
+
|
62 |
+
#content tr:hover a {
|
63 |
+
color: #6e6e6e;
|
64 |
+
}
|
65 |
+
|
66 |
+
td {
|
67 |
+
color: #6e6e6e;
|
68 |
+
font-size: 12px;
|
69 |
+
border-bottom: 1px solid #dddddd;
|
70 |
+
padding: 11px 5px 13px;
|
71 |
+
}
|
72 |
+
|
73 |
+
th {
|
74 |
+
color: #333333;
|
75 |
+
font-size: 12px;
|
76 |
+
border-bottom: 1px solid #dddddd;
|
77 |
+
padding: 5px 50px 17px 5px;
|
78 |
+
}
|
79 |
+
|
80 |
+
#footer {
|
81 |
+
background: #f8f8f8;
|
82 |
+
font-size: 13px;
|
83 |
+
color: #aaaaaa;
|
84 |
+
padding: 54px 0 20px;
|
85 |
+
text-align: center;
|
86 |
+
}
|
87 |
+
|
88 |
+
a {
|
89 |
+
color: #2384c6;
|
90 |
+
}
|
91 |
+
a:hover {
|
92 |
+
color: #6e6e6e;
|
93 |
+
text-decoration: none;
|
94 |
+
}
|
95 |
+
</style>
|
96 |
+
</head>
|
97 |
+
<body>
|
98 |
+
<div id="header">
|
99 |
+
<h1>XML Sitemap</h1>
|
100 |
+
<h2>This is a XML Sitemap which is supposed to be processed by <a href="http://www.google.com">Google search engine</a>.</h2>
|
101 |
+
</div>
|
102 |
+
<div id="content">
|
103 |
+
<table cellpadding="5" cellspacing="0">
|
104 |
+
<tr id="table-header">
|
105 |
+
<th>URL</th>
|
106 |
+
<th>Priority</th>
|
107 |
+
<th>Change Frequency</th>
|
108 |
+
<th>LastChange (GMT)</th>
|
109 |
+
</tr>
|
110 |
+
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
111 |
+
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
112 |
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
113 |
+
<tr>
|
114 |
+
<xsl:if test="position() mod 2 != 1">
|
115 |
+
<xsl:attribute name="class">high</xsl:attribute>
|
116 |
+
</xsl:if>
|
117 |
+
<td>
|
118 |
+
<xsl:variable name="itemURL">
|
119 |
+
<xsl:value-of select="sitemap:loc"/>
|
120 |
+
</xsl:variable>
|
121 |
+
<a href="{$itemURL}">
|
122 |
+
<xsl:value-of select="sitemap:loc"/>
|
123 |
+
</a>
|
124 |
+
</td>
|
125 |
+
<td>
|
126 |
+
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
127 |
+
</td>
|
128 |
+
<td>
|
129 |
+
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
130 |
+
</td>
|
131 |
+
<td>
|
132 |
+
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
</xsl:for-each>
|
136 |
+
</table>
|
137 |
+
</div>
|
138 |
+
<div id="footer">
|
139 |
+
Generated by <a href="https://www.joomunited.com/wordpress-products/wp-meta-seo">WP Meta SEO</a> plugin from <a href="https://www.joomunited.com">JoomUnited</a>
|
140 |
+
</div>
|
141 |
+
</body>
|
142 |
+
</html>
|
143 |
+
</xsl:template>
|
144 |
+
</xsl:stylesheet>
|