Version Description
- Fix XML menu generation don't handle menu levels
- Fix mailto links are indexed as 404 error in the redirect manager
- Fix a php warning when link editor is activated in editor
- Fix secure code
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.0 to 3.0.1
- css/html_sitemap.css +1 -1
- inc/class.metaseo-broken-link-table.php +59 -48
- inc/class.metaseo-link-list-table.php +1 -1
- inc/class.metaseo-sitemap.php +202 -115
- readme.txt +7 -1
- wp-meta-seo.php +2 -2
css/html_sitemap.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#wpms_sitemap{width:100%; position:relative; clear:both;}
|
2 |
-
#wpms_sitemap div{
|
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;}
|
1 |
#wpms_sitemap{width:100%; position:relative; clear:both;}
|
2 |
+
#wpms_sitemap div{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;}
|
inc/class.metaseo-broken-link-table.php
CHANGED
@@ -407,6 +407,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
407 |
$records = $this->items;
|
408 |
$i = 0;
|
409 |
$alternate = "";
|
|
|
410 |
list( $columns, $hidden ) = $this->get_column_info();
|
411 |
if (!empty($records)) {
|
412 |
foreach ($records as $rec) {
|
@@ -729,7 +730,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
729 |
return $list_link;
|
730 |
}
|
731 |
|
732 |
-
public static function get_result_link( $source_link, $row_action, $source_id, $url, $link_text, $type, $status, $status_type,$meta_title = '',$rel = '') {
|
733 |
$res = array(
|
734 |
'source_link' => $source_link,
|
735 |
'row_action' => $row_action,
|
@@ -752,34 +753,46 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
752 |
$res['follow'] = 1;
|
753 |
}
|
754 |
|
755 |
-
if($
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
760 |
}else{
|
761 |
-
$res['link_final_url'] = $
|
762 |
}
|
763 |
}else{
|
764 |
$res['link_final_url'] = $url;
|
765 |
}
|
766 |
-
}else{
|
767 |
-
$res['link_final_url'] = $url;
|
768 |
}
|
|
|
769 |
|
770 |
return $res;
|
771 |
}
|
772 |
|
773 |
public static function get_urlstatus($url) {
|
774 |
$status = @get_headers($url, 0);
|
|
|
775 |
if (isset($status[0])) {
|
776 |
return $status[0];
|
777 |
} else {
|
778 |
return 'Server Not Found';
|
779 |
}
|
|
|
780 |
}
|
781 |
|
782 |
public static function get_urlstatus_type($status) {
|
|
|
783 |
if (isset($status) && $status != 'Server Not Found') {
|
784 |
if (((int) substr($status, 9, 3) >= 200 && (int) substr($status, 9, 3) <= 204) || (int) substr($status, 9, 3) == 401) {
|
785 |
$type = 'ok';
|
@@ -830,6 +843,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
830 |
if($status == 'approved'){
|
831 |
if (!empty($comment->comment_author_url)) {
|
832 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($comment->comment_author_url));
|
|
|
833 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
834 |
$sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "wpms_links WHERE source_id=%d AND type=%s ", array($comment_ID, 'comment'));
|
835 |
$check = $wpdb->get_var($sql);
|
@@ -840,7 +854,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
840 |
'source_id' => $comment_ID,
|
841 |
'type' => 'comment',
|
842 |
'status_code' => $status,
|
843 |
-
'status_text' =>
|
844 |
'broken_indexed' => 0,
|
845 |
'broken_internal' => 0,
|
846 |
'warning' => 0,
|
@@ -855,7 +869,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
855 |
} else {
|
856 |
$value = array('link_url' => $comment->comment_author_url,
|
857 |
'status_code' => $status,
|
858 |
-
'status_text' =>
|
859 |
'broken_indexed' => 0,
|
860 |
'broken_internal' => 0,
|
861 |
'warning' => 0,
|
@@ -958,20 +972,11 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
958 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus($href);
|
959 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
960 |
$link_text = preg_replace("/<a\s(.+?)>(.+?)<\/a>/is", "$2", $content);
|
961 |
-
$row_action = array(
|
962 |
-
'edit' => '<a href="' . get_edit_post_link($post->ID) . '" title="Edit this item">Edit</a>',
|
963 |
-
'view' => '<a href="' . get_post_permalink($post->ID) . '" title="View “test”" rel="permalink">View</a>'
|
964 |
-
);
|
965 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
966 |
$links_in_content[$href.'url'.$post->ID.$link_text] = MetaSeo_Broken_Link_Table::get_result_link($source_link, $row_action, $post->ID, $href, $link_text, 'url', $status, $status_type,$meta_title,$rel);
|
967 |
}
|
968 |
preg_match_all('/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^>]+?)\2([^<>]*>)/i', $post->post_content, $matches, PREG_PATTERN_ORDER);
|
969 |
foreach (array_unique($matches[0]) as $content) {
|
970 |
-
|
971 |
-
$row_action = array(
|
972 |
-
'edit' => '<a href="' . get_edit_post_link($post->ID) . '" title="Edit this item">Edit</a>',
|
973 |
-
'view' => '<a href="' . get_post_permalink($post->ID) . '" title="View “test”" rel="permalink">View</a>'
|
974 |
-
);
|
975 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
976 |
preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $content, $matches);
|
977 |
$src = $matches[1];
|
@@ -1153,7 +1158,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1153 |
);
|
1154 |
|
1155 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
1156 |
-
$link_a = MetaSeo_Broken_Link_Table::get_result_link($source_link, $row_action, $post->ID, $href, $link_text, 'url', $status, $status_type,$meta_title,$rel);
|
1157 |
MetaSeo_Broken_Link_Table::wpms_insert_link($link_a, $wpdb);
|
1158 |
}
|
1159 |
preg_match_all('/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^>]+?)\2([^<>]*>)/i', $post->post_content, $matches, PREG_PATTERN_ORDER);
|
@@ -1186,6 +1191,8 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1186 |
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "wpms_links WHERE link_url=%s AND type=%s AND source_id=%d ", array($link['link_url'], $link['type'], $link['source_id']));
|
1187 |
$links = $wpdb->get_results($sql);
|
1188 |
if (count($links) == 0) {
|
|
|
|
|
1189 |
$value = array(
|
1190 |
'link_url' => $link['link_url'],
|
1191 |
'link_final_url' => $link['link_final_url'],
|
@@ -1193,7 +1200,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1193 |
'source_id' => $link['source_id'],
|
1194 |
'type' => $link['type'],
|
1195 |
'status_code' => $link['status'],
|
1196 |
-
'status_text' =>
|
1197 |
'broken_indexed' => 0,
|
1198 |
'broken_internal' => 0,
|
1199 |
'warning' => 0,
|
@@ -1283,7 +1290,17 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1283 |
}
|
1284 |
wp_send_json(false);
|
1285 |
}
|
1286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1287 |
public static function wpms_update_link() {
|
1288 |
|
1289 |
if (isset($_POST['link_id'])) {
|
@@ -1293,12 +1310,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1293 |
if (empty($link_detail))
|
1294 |
wp_send_json(false);
|
1295 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($_POST['new_link']));
|
1296 |
-
|
1297 |
-
$status_text = 'Server Not Found';
|
1298 |
-
} else {
|
1299 |
-
$status_text = substr($status, 9);
|
1300 |
-
}
|
1301 |
-
|
1302 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
1303 |
|
1304 |
if ($link_detail->type != '404_automaticaly') {
|
@@ -1313,16 +1325,23 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1313 |
'warning' => 0,
|
1314 |
'dismissed' => 0,
|
1315 |
);
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
if(
|
1320 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
}else{
|
1322 |
-
$value['link_final_url'] = $
|
1323 |
}
|
1324 |
-
}else{
|
1325 |
-
$value['link_final_url'] = $_POST['new_link'];
|
1326 |
}
|
1327 |
|
1328 |
if (!empty($_POST['link_redirect']))
|
@@ -1332,11 +1351,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1332 |
}
|
1333 |
} else {
|
1334 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($_POST['link_redirect']));
|
1335 |
-
|
1336 |
-
$status_text = 'Server Not Found';
|
1337 |
-
} else {
|
1338 |
-
$status_text = substr($status, 9);
|
1339 |
-
}
|
1340 |
|
1341 |
$value = array(
|
1342 |
'link_url_redirect' => ($_POST['link_redirect']),
|
@@ -1795,11 +1810,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1795 |
$link = $wpdb->get_row($sql);
|
1796 |
if (!empty($link)) {
|
1797 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($link->link_url));
|
1798 |
-
|
1799 |
-
$status_text = 'Server Not Found';
|
1800 |
-
} else {
|
1801 |
-
$status_text = substr($status, 9);
|
1802 |
-
}
|
1803 |
|
1804 |
if ($link->type == '404_automaticaly') {
|
1805 |
if (((int) substr($status, 9, 3) >= 301 && (int) substr($status, 9, 3) <= 304) || ((int) substr($status, 9, 3) >= 400 && (int) substr($status, 9, 3) <= 503 && (int) substr($status, 9, 3) != 401) || $status == 'Server Not Found') {
|
@@ -1808,7 +1819,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
|
|
1808 |
$type = array('broken_indexed' => 0, 'broken_internal' => 0);
|
1809 |
}
|
1810 |
} else {
|
1811 |
-
if (((int) substr($status, 9, 3) >=
|
1812 |
$type = array('broken_internal' => 1, 'broken_indexed' => 0);
|
1813 |
} else {
|
1814 |
$type = array('broken_internal' => 0, 'broken_indexed' => 0);
|
407 |
$records = $this->items;
|
408 |
$i = 0;
|
409 |
$alternate = "";
|
410 |
+
|
411 |
list( $columns, $hidden ) = $this->get_column_info();
|
412 |
if (!empty($records)) {
|
413 |
foreach ($records as $rec) {
|
730 |
return $list_link;
|
731 |
}
|
732 |
|
733 |
+
public static function get_result_link( $source_link, $row_action, $source_id, $url, $link_text, $type, $status, $status_type,$meta_title = '',$rel = '' , $postID = 0) {
|
734 |
$res = array(
|
735 |
'source_link' => $source_link,
|
736 |
'row_action' => $row_action,
|
753 |
$res['follow'] = 1;
|
754 |
}
|
755 |
|
756 |
+
if(strpos($url, 'mailto:') !== false){
|
757 |
+
$res['link_final_url'] = $url;
|
758 |
+
}else{
|
759 |
+
if($type == 'url'){
|
760 |
+
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
|
761 |
+
$perlink = get_option('permalink_structure');
|
762 |
+
if(empty($perlink)){
|
763 |
+
$res['link_final_url'] = get_site_url().'/'.$url;
|
764 |
+
}else{
|
765 |
+
if(!empty($postID)){
|
766 |
+
$res['link_final_url'] = get_permalink($postID).$url;
|
767 |
+
}else{
|
768 |
+
$res['link_final_url'] = $perlink.'/'.$url;
|
769 |
+
}
|
770 |
+
}
|
771 |
}else{
|
772 |
+
$res['link_final_url'] = $url;
|
773 |
}
|
774 |
}else{
|
775 |
$res['link_final_url'] = $url;
|
776 |
}
|
|
|
|
|
777 |
}
|
778 |
+
|
779 |
|
780 |
return $res;
|
781 |
}
|
782 |
|
783 |
public static function get_urlstatus($url) {
|
784 |
$status = @get_headers($url, 0);
|
785 |
+
if(strpos($url,'mailto:') !== false) return 'Not checked';
|
786 |
if (isset($status[0])) {
|
787 |
return $status[0];
|
788 |
} else {
|
789 |
return 'Server Not Found';
|
790 |
}
|
791 |
+
|
792 |
}
|
793 |
|
794 |
public static function get_urlstatus_type($status) {
|
795 |
+
if(isset($status) && $status == 'Not checked') return 'ok';
|
796 |
if (isset($status) && $status != 'Server Not Found') {
|
797 |
if (((int) substr($status, 9, 3) >= 200 && (int) substr($status, 9, 3) <= 204) || (int) substr($status, 9, 3) == 401) {
|
798 |
$type = 'ok';
|
843 |
if($status == 'approved'){
|
844 |
if (!empty($comment->comment_author_url)) {
|
845 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($comment->comment_author_url));
|
846 |
+
$status_text = MetaSeo_Broken_Link_Table::wpms_get_status_text($status);
|
847 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
848 |
$sql = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "wpms_links WHERE source_id=%d AND type=%s ", array($comment_ID, 'comment'));
|
849 |
$check = $wpdb->get_var($sql);
|
854 |
'source_id' => $comment_ID,
|
855 |
'type' => 'comment',
|
856 |
'status_code' => $status,
|
857 |
+
'status_text' => $status_text,
|
858 |
'broken_indexed' => 0,
|
859 |
'broken_internal' => 0,
|
860 |
'warning' => 0,
|
869 |
} else {
|
870 |
$value = array('link_url' => $comment->comment_author_url,
|
871 |
'status_code' => $status,
|
872 |
+
'status_text' => $status_text,
|
873 |
'broken_indexed' => 0,
|
874 |
'broken_internal' => 0,
|
875 |
'warning' => 0,
|
972 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus($href);
|
973 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
974 |
$link_text = preg_replace("/<a\s(.+?)>(.+?)<\/a>/is", "$2", $content);
|
|
|
|
|
|
|
|
|
975 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
976 |
$links_in_content[$href.'url'.$post->ID.$link_text] = MetaSeo_Broken_Link_Table::get_result_link($source_link, $row_action, $post->ID, $href, $link_text, 'url', $status, $status_type,$meta_title,$rel);
|
977 |
}
|
978 |
preg_match_all('/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^>]+?)\2([^<>]*>)/i', $post->post_content, $matches, PREG_PATTERN_ORDER);
|
979 |
foreach (array_unique($matches[0]) as $content) {
|
|
|
|
|
|
|
|
|
|
|
980 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
981 |
preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $content, $matches);
|
982 |
$src = $matches[1];
|
1158 |
);
|
1159 |
|
1160 |
$source_link = '<a href="' . get_edit_post_link($post->ID) . '"><b>' . $post->post_title . '</b></a>';
|
1161 |
+
$link_a = MetaSeo_Broken_Link_Table::get_result_link($source_link, $row_action, $post->ID, $href, $link_text, 'url', $status, $status_type,$meta_title,$rel , $post->ID);
|
1162 |
MetaSeo_Broken_Link_Table::wpms_insert_link($link_a, $wpdb);
|
1163 |
}
|
1164 |
preg_match_all('/(<img[\s]+[^>]*src\s*=\s*)([\"\'])([^>]+?)\2([^<>]*>)/i', $post->post_content, $matches, PREG_PATTERN_ORDER);
|
1191 |
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "wpms_links WHERE link_url=%s AND type=%s AND source_id=%d ", array($link['link_url'], $link['type'], $link['source_id']));
|
1192 |
$links = $wpdb->get_results($sql);
|
1193 |
if (count($links) == 0) {
|
1194 |
+
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($link['link_url']));
|
1195 |
+
$status_text = MetaSeo_Broken_Link_Table::wpms_get_status_text($status);
|
1196 |
$value = array(
|
1197 |
'link_url' => $link['link_url'],
|
1198 |
'link_final_url' => $link['link_final_url'],
|
1200 |
'source_id' => $link['source_id'],
|
1201 |
'type' => $link['type'],
|
1202 |
'status_code' => $link['status'],
|
1203 |
+
'status_text' => $status_text,
|
1204 |
'broken_indexed' => 0,
|
1205 |
'broken_internal' => 0,
|
1206 |
'warning' => 0,
|
1290 |
}
|
1291 |
wp_send_json(false);
|
1292 |
}
|
1293 |
+
|
1294 |
+
public static function wpms_get_status_text($status) {
|
1295 |
+
if($status == 'Not checked') return 'Not checked';
|
1296 |
+
if ($status == 'Server Not Found') {
|
1297 |
+
$status_text = 'Server Not Found';
|
1298 |
+
} else {
|
1299 |
+
$status_text = substr($status, 9);
|
1300 |
+
}
|
1301 |
+
return $status_text;
|
1302 |
+
}
|
1303 |
+
|
1304 |
public static function wpms_update_link() {
|
1305 |
|
1306 |
if (isset($_POST['link_id'])) {
|
1310 |
if (empty($link_detail))
|
1311 |
wp_send_json(false);
|
1312 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($_POST['new_link']));
|
1313 |
+
$status_text = MetaSeo_Broken_Link_Table::wpms_get_status_text($status);
|
|
|
|
|
|
|
|
|
|
|
1314 |
$status_type = MetaSeo_Broken_Link_Table::get_urlstatus_type($status);
|
1315 |
|
1316 |
if ($link_detail->type != '404_automaticaly') {
|
1325 |
'warning' => 0,
|
1326 |
'dismissed' => 0,
|
1327 |
);
|
1328 |
+
if(strpos($_POST['new_link'], 'mailto:') !== false){
|
1329 |
+
$value['link_final_url'] = $_POST['new_link'];
|
1330 |
+
}else{
|
1331 |
+
if (!preg_match("~^(?:f|ht)tps?://~i", $_POST['new_link'])) {
|
1332 |
+
$perlink = get_option('permalink_structure');
|
1333 |
+
if(empty($perlink)){
|
1334 |
+
$value['link_final_url'] = get_site_url().'/'.$_POST['new_link'];
|
1335 |
+
}else{
|
1336 |
+
if(!empty($link_detail->source_id)){
|
1337 |
+
$value['link_final_url'] = get_permalink($link_detail->source_id).$_POST['new_link'];
|
1338 |
+
}else{
|
1339 |
+
$value['link_final_url'] = $perlink.'/'.$_POST['new_link'];
|
1340 |
+
}
|
1341 |
+
}
|
1342 |
}else{
|
1343 |
+
$value['link_final_url'] = $_POST['new_link'];
|
1344 |
}
|
|
|
|
|
1345 |
}
|
1346 |
|
1347 |
if (!empty($_POST['link_redirect']))
|
1351 |
}
|
1352 |
} else {
|
1353 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($_POST['link_redirect']));
|
1354 |
+
$status_text = MetaSeo_Broken_Link_Table::wpms_get_status_text($status);
|
|
|
|
|
|
|
|
|
1355 |
|
1356 |
$value = array(
|
1357 |
'link_url_redirect' => ($_POST['link_redirect']),
|
1810 |
$link = $wpdb->get_row($sql);
|
1811 |
if (!empty($link)) {
|
1812 |
$status = MetaSeo_Broken_Link_Table::get_urlstatus(($link->link_url));
|
1813 |
+
$status_text = MetaSeo_Broken_Link_Table::wpms_get_status_text($status);
|
|
|
|
|
|
|
|
|
1814 |
|
1815 |
if ($link->type == '404_automaticaly') {
|
1816 |
if (((int) substr($status, 9, 3) >= 301 && (int) substr($status, 9, 3) <= 304) || ((int) substr($status, 9, 3) >= 400 && (int) substr($status, 9, 3) <= 503 && (int) substr($status, 9, 3) != 401) || $status == 'Server Not Found') {
|
1819 |
$type = array('broken_indexed' => 0, 'broken_internal' => 0);
|
1820 |
}
|
1821 |
} else {
|
1822 |
+
if (((int) substr($status, 9, 3) >= 400 && (int) substr($status, 9, 3) <= 503 && (int) substr($status, 9, 3) != 401) || $status == 'Server Not Found') {
|
1823 |
$type = array('broken_internal' => 1, 'broken_indexed' => 0);
|
1824 |
} else {
|
1825 |
$type = array('broken_internal' => 0, 'broken_indexed' => 0);
|
inc/class.metaseo-link-list-table.php
CHANGED
@@ -450,7 +450,7 @@ class MetaSeo_Link_List_Table extends WP_List_Table {
|
|
450 |
$post = get_post($rec->source_id);
|
451 |
$row_action = array (
|
452 |
'edit' => '<a target="_blank" href="'.get_edit_post_link( $rec->source_id ).'" title="Edit this item">Edit</a>',
|
453 |
-
'view' => '<a target="_blank" href="'.
|
454 |
);
|
455 |
echo '<td class="col_id" colspan="3">';
|
456 |
echo '<a target="_blank" href="'.get_edit_post_link( $rec->source_id ).'">'.$post->post_title.'</a>';
|
450 |
$post = get_post($rec->source_id);
|
451 |
$row_action = array (
|
452 |
'edit' => '<a target="_blank" href="'.get_edit_post_link( $rec->source_id ).'" title="Edit this item">Edit</a>',
|
453 |
+
'view' => '<a target="_blank" href="'.get_permalink( $rec->source_id ).'" title="View “test”" rel="permalink">View</a>'
|
454 |
);
|
455 |
echo '<td class="col_id" colspan="3">';
|
456 |
echo '<a target="_blank" href="'.get_edit_post_link( $rec->source_id ).'">'.$post->post_title.'</a>';
|
inc/class.metaseo-sitemap.php
CHANGED
@@ -6,6 +6,7 @@ class MetaSeo_Sitemap {
|
|
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(
|
@@ -45,6 +46,7 @@ class MetaSeo_Sitemap {
|
|
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
|
@@ -211,6 +213,7 @@ class MetaSeo_Sitemap {
|
|
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 |
}
|
@@ -225,6 +228,7 @@ class MetaSeo_Sitemap {
|
|
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('/')));
|
@@ -237,69 +241,81 @@ class MetaSeo_Sitemap {
|
|
237 |
|
238 |
// menus post custom
|
239 |
$menus = $this->wpms_get_menus_all();
|
240 |
-
$
|
241 |
-
|
242 |
-
|
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 |
-
|
251 |
-
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
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 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
}
|
273 |
}
|
|
|
|
|
274 |
}
|
275 |
}
|
276 |
}
|
277 |
}
|
278 |
|
279 |
// menus category
|
280 |
-
$
|
281 |
-
if (!empty($
|
282 |
-
foreach ($
|
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 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
|
|
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'));
|
@@ -314,20 +330,21 @@ class MetaSeo_Sitemap {
|
|
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 |
-
$
|
325 |
-
if (!empty($
|
326 |
-
foreach ($
|
327 |
-
|
|
|
|
|
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;
|
@@ -351,13 +368,16 @@ class MetaSeo_Sitemap {
|
|
351 |
}
|
352 |
|
353 |
// pages
|
354 |
-
$
|
355 |
-
if (!empty($
|
356 |
-
|
357 |
-
|
|
|
|
|
|
|
358 |
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
359 |
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
360 |
-
|
361 |
$loc->appendChild($xml->createTextNode($permalink));
|
362 |
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
363 |
$now = $val->post_modified;
|
@@ -385,19 +405,23 @@ class MetaSeo_Sitemap {
|
|
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 |
-
|
392 |
-
|
|
|
|
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
|
|
|
|
|
|
|
|
401 |
}
|
402 |
}
|
403 |
}
|
@@ -420,7 +444,7 @@ class MetaSeo_Sitemap {
|
|
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 == '
|
424 |
$permalink = get_category_link($id);
|
425 |
}else{
|
426 |
$permalink = get_permalink($id);
|
@@ -647,7 +671,6 @@ class MetaSeo_Sitemap {
|
|
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 |
|
@@ -714,9 +737,10 @@ class MetaSeo_Sitemap {
|
|
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($
|
720 |
$ids_posts_custom[] = $post_meta_object_id;
|
721 |
}else{
|
722 |
$ids_categories[] = $post_meta_object_id;
|
@@ -726,9 +750,10 @@ class MetaSeo_Sitemap {
|
|
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($
|
732 |
$ids_posts_custom[] = $post_meta_object_id;
|
733 |
}else{
|
734 |
$ids_categories[] = $post_meta_object_id;
|
@@ -802,12 +827,13 @@ class MetaSeo_Sitemap {
|
|
802 |
}
|
803 |
|
804 |
public function wpms_get_posts() {
|
805 |
-
|
806 |
-
if(!empty($taxonomies['nav_menu'])){
|
807 |
-
unset($taxonomies['nav_menu']);
|
808 |
-
}
|
809 |
$posts = array();
|
810 |
-
|
|
|
811 |
$categorys = get_categories(array('hide_empty'=>false,'taxonomy'=>$taxo));
|
812 |
|
813 |
foreach ($categorys as $cat) {
|
@@ -827,7 +853,7 @@ class MetaSeo_Sitemap {
|
|
827 |
$posts[$cat->cat_name.'||'.$cat->cat_ID.'||'.$taxo.'||'.$cat->slug] = $results;
|
828 |
}
|
829 |
}
|
830 |
-
}
|
831 |
|
832 |
return $posts;
|
833 |
}
|
@@ -867,19 +893,34 @@ class MetaSeo_Sitemap {
|
|
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 |
-
|
873 |
-
|
874 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
875 |
}else{
|
876 |
-
$post = get_post($
|
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($
|
882 |
-
$
|
|
|
|
|
|
|
|
|
883 |
$html .= '<a href="'.$permalink.'">'.$title.'</a>';
|
884 |
$html .= '</li>';
|
885 |
}
|
@@ -889,6 +930,28 @@ class MetaSeo_Sitemap {
|
|
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(
|
@@ -918,25 +981,31 @@ class MetaSeo_Sitemap {
|
|
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($
|
929 |
-
$
|
930 |
-
$title = $
|
|
|
|
|
|
|
|
|
931 |
}else{
|
932 |
-
$post = get_post($
|
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{
|
@@ -959,44 +1028,62 @@ class MetaSeo_Sitemap {
|
|
959 |
|
960 |
public function wpms_loop($menuID, $level,$settings_sitemap,$term) {
|
961 |
global $wpdb;
|
962 |
-
$
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
$
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
}else{
|
988 |
-
$
|
|
|
|
|
|
|
|
|
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 |
|
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 |
+
public $level = array();
|
10 |
|
11 |
function __construct() {
|
12 |
$this->settings_sitemap = array(
|
46 |
|
47 |
public function site_metaseo_sitemap_scripts(){
|
48 |
global $post;
|
49 |
+
if(empty($post)) return;
|
50 |
if(!empty($this->settings_sitemap) && $this->settings_sitemap['wpms_html_sitemap_page'] != $post->ID) return;
|
51 |
wp_enqueue_script(
|
52 |
'site-jPages-js', plugins_url('js/site-jPages.js', dirname(__FILE__)), array('jquery'), WPMSEO_VERSION, true
|
213 |
function metaseo_create_sitemap($sitemap_xml_name) {
|
214 |
global $wpdb;
|
215 |
$taxonomies = array();
|
216 |
+
$list_links = array();
|
217 |
foreach ($this->settings_sitemap['wpms_sitemap_taxonomies'] as $val) {
|
218 |
$taxonomies[] = $val;
|
219 |
}
|
228 |
$gglstmp_urlset = $xml->appendChild($xml->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'));
|
229 |
|
230 |
/* add home page */
|
231 |
+
$list_links[] = home_url('/');
|
232 |
$url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
233 |
$loc = $url->appendChild($xml->createElement('loc'));
|
234 |
$loc->appendChild($xml->createTextNode(home_url('/')));
|
241 |
|
242 |
// menus post custom
|
243 |
$menus = $this->wpms_get_menus_all();
|
244 |
+
$res = $menus['posts_custom'];
|
245 |
+
if (!empty($res)) {
|
246 |
+
foreach ($res as $val) {
|
|
|
247 |
$sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_menu_item_object_id' AND meta_value=".$val->ID;
|
248 |
$menu_object = $wpdb->get_results($sql);
|
249 |
if(!empty($menu_object)){
|
250 |
foreach ($menu_object as $menu){
|
251 |
$menu_id = $menu->post_id;
|
252 |
+
$type = get_post_meta($menu_id, '_menu_item_type', true);
|
253 |
$check_type = get_post_meta($menu_id, '_menu_item_object',true);
|
254 |
+
$permalink = $this->wpms_get_permalink_sitemap($check_type,$val->ID);
|
255 |
+
if($permalink != '#'){
|
256 |
+
if(!in_array($permalink, $list_links)){
|
257 |
+
$list_links[] = $permalink;
|
258 |
+
if($type != 'taxonomy'){
|
259 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
260 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
+
|
263 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
264 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
265 |
+
$now = $val->post_modified;
|
266 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
267 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
268 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
269 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
270 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
271 |
+
}else{
|
272 |
+
$changefreq->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->frequency));
|
273 |
+
}
|
274 |
+
|
275 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
276 |
+
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
277 |
+
$priority->appendChild($xml->createTextNode('1.0'));
|
278 |
+
}else{
|
279 |
+
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->priority));
|
280 |
+
}
|
281 |
+
}
|
282 |
}
|
283 |
}
|
284 |
+
|
285 |
+
|
286 |
}
|
287 |
}
|
288 |
}
|
289 |
}
|
290 |
|
291 |
// menus category
|
292 |
+
$res = $menus['categories'];
|
293 |
+
if (!empty($res)) {
|
294 |
+
foreach ($res as $k => $val) {
|
295 |
$sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_menu_item_object_id' AND meta_value=".$val;
|
296 |
$menu_object = $wpdb->get_results($sql);
|
297 |
if(!empty($menu_object)){
|
298 |
foreach ($menu_object as $menu){
|
299 |
+
$menu_id = $menu->post_id;
|
300 |
+
$type = get_post_meta($menu_id, '_menu_item_type', true);
|
301 |
+
$check_type = get_post_meta($menu_id, '_menu_item_object',true);
|
302 |
+
$permalink = get_term_link((int)$val,$check_type);
|
303 |
+
if(empty($permalink)) $permalink = get_permalink($menu_id);
|
304 |
+
if(!in_array($permalink, $list_links)){
|
305 |
+
$list_links[] = $permalink;
|
306 |
+
if($type == 'taxonomy'){
|
307 |
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
308 |
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
|
|
309 |
$loc->appendChild($xml->createTextNode($permalink));
|
310 |
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
311 |
$ps = get_post($menu_id);
|
312 |
+
|
313 |
if(!empty($ps)){
|
314 |
$now = $ps->post_modified;
|
315 |
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
316 |
$lastmod->appendChild($xml->createTextNode($date));
|
317 |
}
|
318 |
+
|
319 |
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
320 |
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
321 |
$changefreq->appendChild($xml->createTextNode('monthly'));
|
330 |
$priority->appendChild($xml->createTextNode(@$this->settings_sitemap['wpms_sitemap_menus']->{$menu_id}->priority));
|
331 |
}
|
332 |
}
|
333 |
+
}
|
334 |
}
|
335 |
}
|
336 |
}
|
337 |
}
|
338 |
|
339 |
// posts
|
340 |
+
$res = $this->wpms_get_posts_sitemap();
|
341 |
+
if (!empty($res)) {
|
342 |
+
foreach ($res as $val) {
|
343 |
+
$permalink = get_permalink($val->ID);
|
344 |
+
if(!in_array($permalink, $list_links)){
|
345 |
+
$list_links[] = $permalink;
|
346 |
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
347 |
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
|
|
348 |
$loc->appendChild($xml->createTextNode($permalink));
|
349 |
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
350 |
$now = $val->post_modified;
|
368 |
}
|
369 |
|
370 |
// pages
|
371 |
+
$res = $this->wpms_get_pages_sitemap();
|
372 |
+
if (!empty($res)) {
|
373 |
+
$page_on_front = get_option( 'page_on_front' );
|
374 |
+
foreach ($res as $val) {
|
375 |
+
$permalink = get_permalink($val->ID);
|
376 |
+
if(!in_array($permalink, $list_links)){
|
377 |
+
$list_links[] = $permalink;
|
378 |
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
379 |
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
380 |
+
|
381 |
$loc->appendChild($xml->createTextNode($permalink));
|
382 |
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
383 |
$now = $val->post_modified;
|
405 |
$terms = get_terms($value, 'hide_empty=1');
|
406 |
if (!empty($terms) && !is_wp_error($terms)) {
|
407 |
foreach ($terms as $term_value) {
|
|
|
|
|
408 |
$permalink = get_term_link((int) $term_value->term_id, $value);
|
409 |
+
if(!in_array($permalink, $list_links)){
|
410 |
+
$list_links[] = $permalink;
|
411 |
+
$gglstmp_url = $gglstmp_urlset->appendChild($xml->createElement('url'));
|
412 |
+
$loc = $gglstmp_url->appendChild($xml->createElement('loc'));
|
413 |
|
414 |
+
$loc->appendChild($xml->createTextNode($permalink));
|
415 |
+
$lastmod = $gglstmp_url->appendChild($xml->createElement('lastmod'));
|
416 |
+
|
417 |
+
$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");
|
418 |
+
$date = date('Y-m-d\TH:i:sP', strtotime($now));
|
419 |
+
$lastmod->appendChild($xml->createTextNode($date));
|
420 |
+
$changefreq = $gglstmp_url->appendChild($xml->createElement('changefreq'));
|
421 |
+
$changefreq->appendChild($xml->createTextNode('monthly'));
|
422 |
+
$priority = $gglstmp_url->appendChild($xml->createElement('priority'));
|
423 |
+
$priority->appendChild($xml->createTextNode(1.0));
|
424 |
+
}
|
425 |
}
|
426 |
}
|
427 |
}
|
444 |
public function wpms_get_permalink_sitemap($type,$id){
|
445 |
if(isset($type) && $type == 'custom'){
|
446 |
$permalink = get_post_meta($id, '_menu_item_url',true);
|
447 |
+
}elseif($type == 'taxonomy'){
|
448 |
$permalink = get_category_link($id);
|
449 |
}else{
|
450 |
$permalink = get_permalink($id);
|
671 |
|
672 |
$check_menu[] = 'sitemap_menus_'.$term->term_id;
|
673 |
$html .= '<div id="sitemap_menus_'.$term->term_id.'" class="wpms_sitemap_menus">';
|
|
|
674 |
$viewmenu = $this->wpms_view_menus_frontend($term , $ids_menu);
|
675 |
$html .= $viewmenu;
|
676 |
|
737 |
$query = new WP_Query($args);
|
738 |
$posts_menu = $query->get_posts();
|
739 |
foreach ($posts_menu as $k => $v){
|
740 |
+
$type = get_post_meta($v->ID, '_menu_item_type', true);
|
741 |
$type_menu = get_post_meta($v->ID, '_menu_item_object', true);
|
742 |
$post_meta_object_id = get_post_meta($v->ID, '_menu_item_object_id',true);
|
743 |
+
if($type != 'taxonomy'){
|
744 |
$ids_posts_custom[] = $post_meta_object_id;
|
745 |
}else{
|
746 |
$ids_categories[] = $post_meta_object_id;
|
750 |
if(!empty($settings_sitemap['wpms_sitemap_menus'])){
|
751 |
foreach ($settings_sitemap['wpms_sitemap_menus'] as $k => $v){
|
752 |
if(!empty($v->menu_id)){
|
753 |
+
$type = get_post_meta($k, '_menu_item_type', true);
|
754 |
$type_menu = get_post_meta($k, '_menu_item_object', true);
|
755 |
$post_meta_object_id = get_post_meta($k, '_menu_item_object_id',true);
|
756 |
+
if($type != 'taxonomy'){
|
757 |
$ids_posts_custom[] = $post_meta_object_id;
|
758 |
}else{
|
759 |
$ids_categories[] = $post_meta_object_id;
|
827 |
}
|
828 |
|
829 |
public function wpms_get_posts() {
|
830 |
+
// $taxonomies = get_taxonomies();
|
831 |
+
// if(!empty($taxonomies['nav_menu'])){
|
832 |
+
// unset($taxonomies['nav_menu']);
|
833 |
+
// }
|
834 |
$posts = array();
|
835 |
+
$taxo = 'category';
|
836 |
+
//foreach ($taxonomies as $taxo){
|
837 |
$categorys = get_categories(array('hide_empty'=>false,'taxonomy'=>$taxo));
|
838 |
|
839 |
foreach ($categorys as $cat) {
|
853 |
$posts[$cat->cat_name.'||'.$cat->cat_ID.'||'.$taxo.'||'.$cat->slug] = $results;
|
854 |
}
|
855 |
}
|
856 |
+
//}
|
857 |
|
858 |
return $posts;
|
859 |
}
|
893 |
$html .= '<h4>' . $term->name . '</h4>';
|
894 |
$html .= '<ul class="wpms_frontend_menus_sitemap">';
|
895 |
foreach ($submenus as $menu) {
|
896 |
+
$type = get_post_meta($menu->ID, '_menu_item_type', true);
|
897 |
$type_menu = get_post_meta($menu->ID, '_menu_item_object', true);
|
898 |
$id_menu = get_post_meta($menu->ID, '_menu_item_object_id', true);
|
899 |
+
$this->level[$menu->ID] = 0;
|
900 |
+
$level = $this->wpms_count_parent($menu->ID);
|
901 |
+
if($type == 'taxonomy'){
|
902 |
+
$post_submenu = get_post($menu->ID);
|
903 |
+
$title = $post_submenu->post_title;
|
904 |
+
if(empty($title)) {
|
905 |
+
$term = get_term($id_menu,$type_menu);
|
906 |
+
$title = $term->name;
|
907 |
+
}
|
908 |
}else{
|
909 |
+
$post = get_post($menu->ID);
|
910 |
$title = $post->post_title;
|
911 |
+
if(empty($title)) {
|
912 |
+
$post_submenu = get_post($id_menu);
|
913 |
+
$title = $post_submenu->post_title;
|
914 |
+
}
|
915 |
}
|
916 |
+
$type = get_post_meta($menu->ID, '_menu_item_type', true);
|
917 |
$check_type = get_post_meta($menu->ID, '_menu_item_object',true);
|
918 |
+
$permalink = $this->wpms_get_permalink_sitemap($type,$id_menu);
|
919 |
+
$margin = $level * 10;
|
920 |
+
$style = '';
|
921 |
+
if($level != 0)
|
922 |
+
$style = 'style="margin-left:'.$margin.'px"';
|
923 |
+
$html .= '<li class="wpms_menu_level_'.$level.'" '.$style.'>';
|
924 |
$html .= '<a href="'.$permalink.'">'.$title.'</a>';
|
925 |
$html .= '</li>';
|
926 |
}
|
930 |
return $html;
|
931 |
}
|
932 |
|
933 |
+
public function wpms_count_parent($menuID) {
|
934 |
+
$parent = get_post_meta($menuID, '_menu_item_menu_item_parent', true);
|
935 |
+
$parent_1 = get_post_meta($parent, '_menu_item_menu_item_parent', true);
|
936 |
+
if(!empty($this->settings_sitemap['wpms_sitemap_menus']->{$parent}) && !empty($parent)){
|
937 |
+
$this->level[$menuID]+=1;
|
938 |
+
$this->loop_parent($parent,$this->level[$menuID],$menuID);
|
939 |
+
}else{
|
940 |
+
$this->loop_parent($parent,$this->level[$menuID],$menuID);
|
941 |
+
}
|
942 |
+
|
943 |
+
return (int)$this->level[$menuID];
|
944 |
+
}
|
945 |
+
|
946 |
+
public function loop_parent($menuID,$level,$menuIDroot) {
|
947 |
+
$parent = get_post_meta($menuID, '_menu_item_menu_item_parent', true);
|
948 |
+
$parent_1 = get_post_meta($parent, '_menu_item_menu_item_parent', true);
|
949 |
+
if((!empty($this->settings_sitemap['wpms_sitemap_menus']->{$parent}) && !empty($parent)) || (!empty($parent_1) && !empty($parent)) ){
|
950 |
+
$this->level[$menuIDroot]+=1;
|
951 |
+
$this->loop_parent($parent,$this->level[$menuIDroot],$menuIDroot);
|
952 |
+
}
|
953 |
+
}
|
954 |
+
|
955 |
public function wpms_view_menus($term) {
|
956 |
$list_submenu_id = get_objects_in_term($term->term_id, 'nav_menu');
|
957 |
$args = array(
|
981 |
|
982 |
}
|
983 |
$this->html .= '</select>';
|
|
|
984 |
foreach ($submenus as $menu) {
|
985 |
$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);
|
986 |
$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);
|
987 |
|
988 |
+
$type = get_post_meta($menu->ID, '_menu_item_type', true);
|
989 |
$type_menu = get_post_meta($menu->ID, '_menu_item_object', true);
|
990 |
$id_menu = get_post_meta($menu->ID, '_menu_item_object_id', true);
|
991 |
+
if($type == 'taxonomy'){
|
992 |
+
$post_submenu = get_post($menu->ID);
|
993 |
+
$title = $post_submenu->post_title;
|
994 |
+
if(empty($title)) {
|
995 |
+
$term = get_term($id_menu,$type_menu);
|
996 |
+
$title = $term->name;
|
997 |
+
}
|
998 |
}else{
|
999 |
+
$post = get_post($menu->ID);
|
1000 |
$title = $post->post_title;
|
1001 |
+
if(empty($title)) {
|
1002 |
+
$post_submenu = get_post($id_menu);
|
1003 |
+
$title = $post_submenu->post_title;
|
1004 |
+
}
|
1005 |
}
|
1006 |
$level = 1;
|
1007 |
$this->html .= '<div class="wpms_row">';
|
1008 |
$this->html .= '<div style="float:left;line-height:30px">';
|
|
|
|
|
1009 |
if(empty($this->settings_sitemap['wpms_check_firstsave'])){
|
1010 |
$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 . '">';
|
1011 |
}else{
|
1028 |
|
1029 |
public function wpms_loop($menuID, $level,$settings_sitemap,$term) {
|
1030 |
global $wpdb;
|
1031 |
+
$args = array(
|
1032 |
+
'post_type' => 'nav_menu_item',
|
1033 |
+
'posts_per_page' => -1,
|
1034 |
+
'meta_key' => '_menu_item_menu_item_parent',
|
1035 |
+
'meta_value' => $menuID,
|
1036 |
+
'orderby' => 'menu_order',
|
1037 |
+
'order' => 'ASC'
|
1038 |
+
);
|
1039 |
+
$query = new WP_Query( $args );
|
1040 |
+
$submenus = $query->get_posts();
|
1041 |
+
if (!empty($submenus)) {
|
1042 |
+
foreach ($submenus as $submenu){
|
1043 |
+
$type = get_post_meta($submenu->ID, '_menu_item_type', true);
|
1044 |
+
$type_menu = get_post_meta($submenu->ID, '_menu_item_object', true);
|
1045 |
+
$post_subid = get_post_meta($submenu->ID, '_menu_item_object_id', true);
|
1046 |
+
if($type == 'taxonomy'){
|
1047 |
+
$post_submenu = get_post($submenu->ID);
|
1048 |
+
$title = $post_submenu->post_title;
|
1049 |
+
if(empty($title)) {
|
1050 |
+
$term = get_term($post_subid,$type_menu);
|
1051 |
+
$title = $term->name;
|
1052 |
+
}
|
1053 |
+
}else{
|
1054 |
+
$post_submenu = get_post($submenu->ID);
|
1055 |
+
$title = $post_submenu->post_title;
|
1056 |
+
if(empty($title)) {
|
1057 |
+
$post_submenu = get_post($post_subid);
|
1058 |
+
$title = $post_submenu->post_title;
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
$space = '';
|
1063 |
+
for ($i = 1; $i <= $level * 3; $i++) {
|
1064 |
+
$space .= ' ';
|
1065 |
+
}
|
1066 |
+
$select_priority = $this->wpms_view_select_priority('priority_menu_'.$submenu->ID,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][priority]' , @$settings_sitemap['wpms_sitemap_menus']->{$submenu->ID}->priority);
|
1067 |
+
$select_frequency = $this->wpms_view_select_frequency('frequency_menu_'.$submenu->ID,'_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->post_id.'][frequency]' , @$settings_sitemap['wpms_sitemap_menus']->{$submenu->ID}->frequency);
|
1068 |
+
|
1069 |
+
if(empty($settings_sitemap['wpms_check_firstsave'])){
|
1070 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->ID.'][menu_id]" type="checkbox" value="' . $submenu->ID . '">';
|
1071 |
}else{
|
1072 |
+
if(isset($settings_sitemap['wpms_sitemap_menus']->{$submenu->ID}->menu_id) && $settings_sitemap['wpms_sitemap_menus']->{$submenu->ID}->menu_id == $submenu->ID){
|
1073 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" checked name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->ID.'][menu_id]" type="checkbox" value="' . $submenu->ID . '">';
|
1074 |
+
}else{
|
1075 |
+
$checkbox = $space . '<input class="cb_sitemaps_menu wpms_xmap_menu nav_menu'.$term->slug.'" name="_metaseo_settings_sitemap[wpms_sitemap_menus]['.$submenu->ID.'][menu_id]" type="checkbox" value="' . $submenu->ID . '">';
|
1076 |
+
}
|
1077 |
}
|
1078 |
+
|
1079 |
+
$this->html .= '<div class="wpms_row">';
|
1080 |
+
$this->html .= '<div style="float:left;line-height:30px">';
|
1081 |
+
$this->html .= $checkbox . $title;
|
1082 |
+
$this->html .= '</div>';
|
1083 |
+
$this->html .= '<div style="margin-left:200px">'.$select_priority.$select_frequency.'</div>';
|
1084 |
+
$this->html .= '</div>';
|
1085 |
+
$this->wpms_loop($submenu->ID, $level + 1,$settings_sitemap,$term);
|
1086 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1087 |
}
|
1088 |
}
|
1089 |
|
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: 3.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -227,6 +227,12 @@ It could be! if you have a lot of pages that need to be indexed with no specific
|
|
227 |
|
228 |
== Changelog ==
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
= 3.0.0 =
|
231 |
* Add XML sitemap feature
|
232 |
* Add HTML sitemap feature
|
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.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
227 |
|
228 |
== Changelog ==
|
229 |
|
230 |
+
= 3.0.1 =
|
231 |
+
* Fix XML menu generation don't handle menu levels
|
232 |
+
* Fix mailto links are indexed as 404 error in the redirect manager
|
233 |
+
* Fix a php warning when link editor is activated in editor
|
234 |
+
* Fix secure code
|
235 |
+
|
236 |
= 3.0.0 =
|
237 |
* Add XML sitemap feature
|
238 |
* Add HTML sitemap feature
|
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: 3.0.
|
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', '3.0.
|
51 |
}
|
52 |
|
53 |
if (!defined('WPMSEO_FILE'))
|
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.1
|
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.1');
|
51 |
}
|
52 |
|
53 |
if (!defined('WPMSEO_FILE'))
|