Version Description
(Nov 16, 2017) = * Added option to change title in html sitemap * Urlfix when no permalink setting is set * Minor style changes
Download this release
Release Info
Developer | Webbjocke |
Plugin | Simple Wp Sitemap |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.9 to 1.2.0
- css/html.css +6 -7
- css/simple-wp-sitemap-admin.css +62 -40
- css/xml.css +2 -2
- languages/index.php +1 -0
- languages/simple-wp-sitemap.pot +64 -56
- readme.txt +7 -2
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- simple-wp-sitemap.php +10 -10
- simpleWpMapAdmin.php +106 -184
- simpleWpMapBuilder.php +47 -53
- simpleWpMapOptions.php +27 -38
css/html.css
CHANGED
@@ -18,7 +18,7 @@ body{
|
|
18 |
}
|
19 |
h1{
|
20 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
21 |
-
margin: 0 0.1%
|
22 |
word-wrap: break-word;
|
23 |
}
|
24 |
a{
|
@@ -59,7 +59,7 @@ li:nth-child(2n){
|
|
59 |
.header{
|
60 |
overflow: auto;
|
61 |
clear: left;
|
62 |
-
padding:
|
63 |
border-bottom: 5px solid #f1f1f1;
|
64 |
font-size: 1.2em;
|
65 |
width: 99.8%;
|
@@ -89,7 +89,7 @@ h1 a:hover{
|
|
89 |
background: none;
|
90 |
opacity: 0.6;
|
91 |
}
|
92 |
-
@media
|
93 |
body{
|
94 |
font-size: 12px;
|
95 |
}
|
@@ -114,18 +114,17 @@ h1 a:hover{
|
|
114 |
padding: 0 7px 4px 7px;
|
115 |
}
|
116 |
.header{
|
117 |
-
padding: 5px 7px;
|
118 |
width: auto;
|
119 |
}
|
120 |
.header-date{
|
121 |
-
|
122 |
-
clear: left;
|
123 |
}
|
124 |
#attr{
|
125 |
padding-right: 7px;
|
126 |
}
|
127 |
}
|
128 |
-
@media
|
129 |
body{
|
130 |
font-size: 11px;
|
131 |
}
|
18 |
}
|
19 |
h1{
|
20 |
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
21 |
+
margin: 0 0.1% 15px 0.1%;
|
22 |
word-wrap: break-word;
|
23 |
}
|
24 |
a{
|
59 |
.header{
|
60 |
overflow: auto;
|
61 |
clear: left;
|
62 |
+
padding: 15px 0.1% 7px 0.1%;
|
63 |
border-bottom: 5px solid #f1f1f1;
|
64 |
font-size: 1.2em;
|
65 |
width: 99.8%;
|
89 |
background: none;
|
90 |
opacity: 0.6;
|
91 |
}
|
92 |
+
@media (max-width: 960px){
|
93 |
body{
|
94 |
font-size: 12px;
|
95 |
}
|
114 |
padding: 0 7px 4px 7px;
|
115 |
}
|
116 |
.header{
|
117 |
+
padding: 13px 7px 5px 7px;
|
118 |
width: auto;
|
119 |
}
|
120 |
.header-date{
|
121 |
+
display: none;
|
|
|
122 |
}
|
123 |
#attr{
|
124 |
padding-right: 7px;
|
125 |
}
|
126 |
}
|
127 |
+
@media (max-width: 500px){
|
128 |
body{
|
129 |
font-size: 11px;
|
130 |
}
|
css/simple-wp-sitemap-admin.css
CHANGED
@@ -6,66 +6,90 @@
|
|
6 |
background: #fff;
|
7 |
margin: 0;
|
8 |
float: left;
|
|
|
9 |
}
|
10 |
#sitemap-settings li{
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
#sitemap-settings a{
|
14 |
-
|
15 |
padding: 10px 0;
|
16 |
-
width: 100px;
|
17 |
margin: 0;
|
18 |
color: inherit;
|
19 |
text-decoration: none;
|
20 |
text-align: center;
|
21 |
-
border: 1px solid #f1f1f1;
|
22 |
transition: all 0.3s;
|
23 |
}
|
24 |
-
#sitemap-settings
|
25 |
cursor: pointer;
|
26 |
-
background: #ffffe0;
|
27 |
border-color: #c0c0c0;
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
box-shadow: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
-
|
|
|
|
|
|
|
32 |
vertical-align: baseline;
|
33 |
}
|
34 |
#simple-wp-sitemap-h2{
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
}
|
39 |
#simple-wp-sitemap-h2 img{
|
40 |
-
|
41 |
}
|
42 |
#simple-wp-sitemap-h2 span{
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
-
.table-hidden{
|
47 |
-
display: none;
|
48 |
}
|
49 |
.button-secondary{
|
50 |
transition: all 0.3s;
|
51 |
}
|
52 |
-
.button-secondary:hover{
|
53 |
-
background: #ffffe0 !important;
|
54 |
-
}
|
55 |
-
#sitemap-display-order{
|
56 |
-
margin: 0;
|
57 |
-
}
|
58 |
#sitemap-display-order li{
|
59 |
margin: 0;
|
60 |
padding: 8px;
|
61 |
max-width: 250px;
|
62 |
position: relative;
|
63 |
-
border-top: 1px solid #
|
64 |
-
border-left: 1px solid #
|
65 |
-
border-right: 1px solid #
|
66 |
}
|
67 |
#sitemap-display-order li:last-child{
|
68 |
-
|
69 |
}
|
70 |
#sitemap-display-order input.swp-name{
|
71 |
max-width: 160px;
|
@@ -73,7 +97,7 @@
|
|
73 |
#sitemap-display-order span{
|
74 |
position: absolute;
|
75 |
top: 10px;
|
76 |
-
transition:
|
77 |
border-left: 18px solid transparent;
|
78 |
border-right: 18px solid transparent;
|
79 |
top: 50%;
|
@@ -83,33 +107,31 @@
|
|
83 |
}
|
84 |
.sitemap-down{
|
85 |
right: 45px;
|
86 |
-
|
87 |
}
|
88 |
.sitemap-up{
|
89 |
right: 5px;
|
90 |
-
|
91 |
}
|
92 |
.sitemap-down:hover{
|
93 |
cursor: pointer;
|
94 |
-
border-top-color: #
|
95 |
}
|
96 |
.sitemap-up:hover{
|
97 |
cursor: pointer;
|
98 |
-
border-bottom-color: #
|
99 |
}
|
100 |
.simple-wp-sitemap-includes{
|
101 |
padding: 0 20px;
|
102 |
margin: 0;
|
103 |
list-style-type: disc;
|
104 |
}
|
105 |
-
@media
|
106 |
-
#simple-wp-sitemap-form tr{
|
107 |
-
margin: 10px;
|
108 |
-
display: block;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
@media screen and (max-width: 440px){
|
112 |
#sitemap-settings, #sitemap-settings a{
|
113 |
-
width: 100%;
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
}
|
6 |
background: #fff;
|
7 |
margin: 0;
|
8 |
float: left;
|
9 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
10 |
}
|
11 |
#sitemap-settings li{
|
12 |
+
float: left;
|
13 |
+
margin: 0;
|
14 |
+
border-top: 1px solid #e5e5e5;
|
15 |
+
border-left: 1px solid #e5e5e5;
|
16 |
+
}
|
17 |
+
#sitemap-settings li:last-child{
|
18 |
+
border-right: 1px solid #e5e5e5;
|
19 |
}
|
20 |
#sitemap-settings a{
|
21 |
+
display: inline-block;
|
22 |
padding: 10px 0;
|
23 |
+
min-width: 100px;
|
24 |
margin: 0;
|
25 |
color: inherit;
|
26 |
text-decoration: none;
|
27 |
text-align: center;
|
|
|
28 |
transition: all 0.3s;
|
29 |
}
|
30 |
+
#sitemap-settings li:hover, #sitemap-settings li.ui-state-active{
|
31 |
cursor: pointer;
|
|
|
32 |
border-color: #c0c0c0;
|
33 |
+
}
|
34 |
+
#sitemap-settings li:hover + li, #sitemap-settings li.ui-state-active + li{
|
35 |
+
border-left-color: #c0c0c0;
|
36 |
+
}
|
37 |
+
#sitemap-settings a:hover, #sitemap-settings .ui-state-active a{
|
38 |
+
background: #e0f1da;
|
39 |
box-shadow: none;
|
40 |
+
outline: none;
|
41 |
+
}
|
42 |
+
.sitemap-table{
|
43 |
+
background: #fff;
|
44 |
+
max-width: 1080px;
|
45 |
+
padding: 15px;
|
46 |
+
border: 1px solid #e5e5e5;
|
47 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
48 |
+
box-sizing: border-box;
|
49 |
+
clear: both;
|
50 |
+
}
|
51 |
+
.sitemap-table h3{
|
52 |
+
font-size: 1.1em;
|
53 |
+
}
|
54 |
+
.sitemap-section{
|
55 |
+
border-top: 1px solid #e5e5e5;
|
56 |
+
padding-top: 25px;
|
57 |
+
}
|
58 |
+
.sitemap-table > p, .sitemap-table > ul, .sitemap-table > div, .sitemap-table h3{
|
59 |
+
margin-bottom: 25px;
|
60 |
}
|
61 |
+
.sitemap-table > :last-child {
|
62 |
+
margin-bottom: 10px;
|
63 |
+
}
|
64 |
+
#simple_wp_order_by{
|
65 |
vertical-align: baseline;
|
66 |
}
|
67 |
#simple-wp-sitemap-h2{
|
68 |
+
float: left;
|
69 |
+
width: 100%;
|
70 |
+
margin-bottom: 10px;
|
71 |
}
|
72 |
#simple-wp-sitemap-h2 img{
|
73 |
+
float: left;
|
74 |
}
|
75 |
#simple-wp-sitemap-h2 span{
|
76 |
+
float: left;
|
77 |
+
padding: 5px 0 0 10px;
|
|
|
|
|
|
|
78 |
}
|
79 |
.button-secondary{
|
80 |
transition: all 0.3s;
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
#sitemap-display-order li{
|
83 |
margin: 0;
|
84 |
padding: 8px;
|
85 |
max-width: 250px;
|
86 |
position: relative;
|
87 |
+
border-top: 1px solid #e5e5e5;
|
88 |
+
border-left: 1px solid #e5e5e5;
|
89 |
+
border-right: 1px solid #e5e5e5;
|
90 |
}
|
91 |
#sitemap-display-order li:last-child{
|
92 |
+
border-bottom: 1px solid #e5e5e5;
|
93 |
}
|
94 |
#sitemap-display-order input.swp-name{
|
95 |
max-width: 160px;
|
97 |
#sitemap-display-order span{
|
98 |
position: absolute;
|
99 |
top: 10px;
|
100 |
+
transition: all 0.3s;
|
101 |
border-left: 18px solid transparent;
|
102 |
border-right: 18px solid transparent;
|
103 |
top: 50%;
|
107 |
}
|
108 |
.sitemap-down{
|
109 |
right: 45px;
|
110 |
+
border-top: 25px solid #d3d3d3;
|
111 |
}
|
112 |
.sitemap-up{
|
113 |
right: 5px;
|
114 |
+
border-bottom: 25px solid #d3d3d3;
|
115 |
}
|
116 |
.sitemap-down:hover{
|
117 |
cursor: pointer;
|
118 |
+
border-top-color: #ff8080;
|
119 |
}
|
120 |
.sitemap-up:hover{
|
121 |
cursor: pointer;
|
122 |
+
border-bottom-color: #7ebe7e;
|
123 |
}
|
124 |
.simple-wp-sitemap-includes{
|
125 |
padding: 0 20px;
|
126 |
margin: 0;
|
127 |
list-style-type: disc;
|
128 |
}
|
129 |
+
@media (max-width: 440px){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
#sitemap-settings, #sitemap-settings a{
|
131 |
+
min-width: 100%;
|
132 |
+
}
|
133 |
+
#sitemap-settings li, #sitemap-settings li:last-child{
|
134 |
+
width: 33.33%;
|
135 |
+
box-sizing: border-box;
|
136 |
}
|
137 |
}
|
css/xml.css
CHANGED
@@ -25,7 +25,7 @@ loc{
|
|
25 |
lastmod{
|
26 |
float: right;
|
27 |
}
|
28 |
-
@media
|
29 |
urlset{
|
30 |
font-size: 12px;
|
31 |
}
|
@@ -35,7 +35,7 @@ lastmod{
|
|
35 |
float: left;
|
36 |
}
|
37 |
}
|
38 |
-
@media
|
39 |
urlset{
|
40 |
zoom: 2;
|
41 |
}
|
25 |
lastmod{
|
26 |
float: right;
|
27 |
}
|
28 |
+
@media (max-width: 960px){
|
29 |
urlset{
|
30 |
font-size: 12px;
|
31 |
}
|
35 |
float: left;
|
36 |
}
|
37 |
}
|
38 |
+
@media (max-device-width: 500px){
|
39 |
urlset{
|
40 |
zoom: 2;
|
41 |
}
|
languages/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Simple Wp Sitemap
|
languages/simple-wp-sitemap.pot
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
msgid ""
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: Simple Wp Sitemap\n"
|
7 |
-
"POT-Creation-Date: 2017-
|
8 |
"PO-Revision-Date: \n"
|
9 |
"Last-Translator: Webbjocke <mail@webbjocke.com>\n"
|
10 |
"Language-Team: Webbjocke <mail@webbjocke.com>\n"
|
@@ -13,9 +13,9 @@ msgstr ""
|
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
-
"X-Generator: Poedit
|
17 |
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
-
"X-Poedit-KeywordsList: _e;__;esc_attr_e;_n;_n:1,2\n"
|
19 |
"X-Poedit-Basepath: ..\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
|
@@ -23,6 +23,10 @@ msgstr ""
|
|
23 |
msgid "Settings"
|
24 |
msgstr ""
|
25 |
|
|
|
|
|
|
|
|
|
26 |
#: simpleWpMapAdmin.php:11
|
27 |
msgid "Simple Wp Sitemap logo"
|
28 |
msgstr ""
|
@@ -67,176 +71,180 @@ msgstr ""
|
|
67 |
msgid "Premium"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: simpleWpMapAdmin.php:
|
71 |
msgid "Add pages"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: simpleWpMapAdmin.php:
|
75 |
-
|
|
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: simpleWpMapAdmin.php:
|
79 |
msgid "Block pages"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: simpleWpMapAdmin.php:
|
83 |
msgid "Add pages you want to block from showing up in the sitemaps. Same as above, just paste every link on a new row. (Tip: copy paste links from one of your sitemaps to get correct urls)."
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: simpleWpMapAdmin.php:
|
87 |
msgid "Extra sitemap includes"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: simpleWpMapAdmin.php:
|
91 |
msgid "Check if you want to include categories, tags and/or author pages in the sitemaps."
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: simpleWpMapAdmin.php:
|
95 |
msgid "Include categories"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: simpleWpMapAdmin.php:
|
99 |
msgid "Include tags"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: simpleWpMapAdmin.php:
|
103 |
msgid "Include authors"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: simpleWpMapAdmin.php:
|
107 |
msgid "Html sitemap"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: simpleWpMapAdmin.php:
|
111 |
msgid "Enable or disable your html sitemap. This will not effect your xml sitemap."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: simpleWpMapAdmin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
msgid "Enable"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: simpleWpMapAdmin.php:
|
119 |
msgid "Disable"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: simpleWpMapAdmin.php:
|
123 |
msgid "Disable and set to 404"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: simpleWpMapAdmin.php:
|
127 |
msgid "Like the plugin?"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: simpleWpMapAdmin.php:
|
131 |
msgid "Show your support by rating the plugin at wordpress.org, and/or by adding an attribution link to the sitemap.html file :)"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: simpleWpMapAdmin.php:
|
135 |
msgid "Add \"Generated by Simple Wp Sitemap\" link at bottom of sitemap.html"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: simpleWpMapAdmin.php:
|
139 |
-
msgid "
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: simpleWpMapAdmin.php:
|
143 |
-
msgid "
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: simpleWpMapAdmin.php:
|
147 |
-
msgid "
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: simpleWpMapAdmin.php:
|
151 |
-
msgid "
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: simpleWpMapAdmin.php:
|
155 |
msgid "Last updated text:"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: simpleWpMapAdmin.php:
|
159 |
msgid "Last updated"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: simpleWpMapAdmin.php:
|
163 |
msgid "Sort posts and pages:"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: simpleWpMapAdmin.php:
|
167 |
msgid "Posted date"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: simpleWpMapAdmin.php:
|
171 |
msgid "Last updated date"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: simpleWpMapAdmin.php:
|
175 |
msgid "Alphabetical"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: simpleWpMapAdmin.php:
|
179 |
msgid "Random"
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: simpleWpMapAdmin.php:
|
183 |
msgid "Comments"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: simpleWpMapAdmin.php:
|
187 |
msgid "Parents"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: simpleWpMapAdmin.php:
|
191 |
msgid "Restore default order"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: simpleWpMapAdmin.php:
|
195 |
msgid "Simple Wp Sitemap Premium"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: simpleWpMapAdmin.php:
|
199 |
msgid "There's a premium version of Simple Wp Sitemap available which includes:"
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: simpleWpMapAdmin.php:
|
203 |
msgid "Split sitemaps"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: simpleWpMapAdmin.php:
|
207 |
msgid "Image sitemaps"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: simpleWpMapAdmin.php:
|
211 |
msgid "Display with shortcode"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: simpleWpMapAdmin.php:
|
215 |
msgid "Exclude directories"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: simpleWpMapAdmin.php:
|
219 |
msgid "And much more!"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: simpleWpMapAdmin.php:
|
223 |
-
|
224 |
-
msgid "Available at: <a target=\"_blank\" href=\"%s\">webbjocke.com/downloads/simple-wp-sitemap-premium</a>"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: simpleWpMapAdmin.php:
|
228 |
msgid "Save Changes"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: simpleWpMapAdmin.php:
|
232 |
msgid "(If you have a caching plugin, you might have to clear cache before changes will be shown in the sitemaps)"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: simpleWpMapBuilder.php:
|
236 |
-
msgid "Html Sitemap"
|
237 |
-
msgstr ""
|
238 |
-
|
239 |
-
#: simpleWpMapBuilder.php:214
|
240 |
msgid "Generated by: Simple Wp Sitemap"
|
241 |
msgstr ""
|
242 |
|
4 |
msgid ""
|
5 |
msgstr ""
|
6 |
"Project-Id-Version: Simple Wp Sitemap\n"
|
7 |
+
"POT-Creation-Date: 2017-11-16 16:48+0100\n"
|
8 |
"PO-Revision-Date: \n"
|
9 |
"Last-Translator: Webbjocke <mail@webbjocke.com>\n"
|
10 |
"Language-Team: Webbjocke <mail@webbjocke.com>\n"
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
+
"X-Generator: Poedit 2.0.4\n"
|
17 |
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-KeywordsList: _e;__;esc_attr_e;esc_html__;_n;_n:1,2\n"
|
19 |
"X-Poedit-Basepath: ..\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
|
23 |
msgid "Settings"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: simple-wp-sitemap.php:88
|
27 |
+
msgid "Simple Wp Sitemap"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
#: simpleWpMapAdmin.php:11
|
31 |
msgid "Simple Wp Sitemap logo"
|
32 |
msgstr ""
|
71 |
msgid "Premium"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: simpleWpMapAdmin.php:38
|
75 |
msgid "Add pages"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: simpleWpMapAdmin.php:41
|
79 |
+
#, php-format
|
80 |
+
msgid "Add pages to the sitemaps in addition to your normal WordPress ones. Just paste \"full\" urls in the textarea like: %s. Each link on a new row (this will affect both your xml and html sitemap)."
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: simpleWpMapAdmin.php:48
|
84 |
msgid "Block pages"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: simpleWpMapAdmin.php:49
|
88 |
msgid "Add pages you want to block from showing up in the sitemaps. Same as above, just paste every link on a new row. (Tip: copy paste links from one of your sitemaps to get correct urls)."
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: simpleWpMapAdmin.php:53
|
92 |
msgid "Extra sitemap includes"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: simpleWpMapAdmin.php:54
|
96 |
msgid "Check if you want to include categories, tags and/or author pages in the sitemaps."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: simpleWpMapAdmin.php:57
|
100 |
msgid "Include categories"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: simpleWpMapAdmin.php:58
|
104 |
msgid "Include tags"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: simpleWpMapAdmin.php:59
|
108 |
msgid "Include authors"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: simpleWpMapAdmin.php:62
|
112 |
msgid "Html sitemap"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: simpleWpMapAdmin.php:63
|
116 |
msgid "Enable or disable your html sitemap. This will not effect your xml sitemap."
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: simpleWpMapAdmin.php:66
|
120 |
+
msgid "Title in html sitemap"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: simpleWpMapAdmin.php:67 simpleWpMapBuilder.php:154
|
124 |
+
msgid "Html Sitemap"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: simpleWpMapAdmin.php:72
|
128 |
msgid "Enable"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: simpleWpMapAdmin.php:72
|
132 |
msgid "Disable"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: simpleWpMapAdmin.php:72
|
136 |
msgid "Disable and set to 404"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: simpleWpMapAdmin.php:78
|
140 |
msgid "Like the plugin?"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: simpleWpMapAdmin.php:79
|
144 |
msgid "Show your support by rating the plugin at wordpress.org, and/or by adding an attribution link to the sitemap.html file :)"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: simpleWpMapAdmin.php:81
|
148 |
msgid "Add \"Generated by Simple Wp Sitemap\" link at bottom of sitemap.html"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: simpleWpMapAdmin.php:87
|
152 |
+
msgid "Display order and titles"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: simpleWpMapAdmin.php:88
|
156 |
+
msgid "If you want to change the display order in your sitemaps, click the arrows to move sections up or down. They will be displayed as ordered below (highest up is displayed first and lowest down last)"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: simpleWpMapAdmin.php:97
|
160 |
+
msgid "Move down"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: simpleWpMapAdmin.php:98
|
164 |
+
msgid "Move up"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: simpleWpMapAdmin.php:105
|
168 |
msgid "Last updated text:"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: simpleWpMapAdmin.php:106 simpleWpMapBuilder.php:76
|
172 |
msgid "Last updated"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: simpleWpMapAdmin.php:110
|
176 |
msgid "Sort posts and pages:"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: simpleWpMapAdmin.php:112
|
180 |
msgid "Posted date"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: simpleWpMapAdmin.php:112
|
184 |
msgid "Last updated date"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: simpleWpMapAdmin.php:112
|
188 |
msgid "Alphabetical"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: simpleWpMapAdmin.php:112
|
192 |
msgid "Random"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: simpleWpMapAdmin.php:112
|
196 |
msgid "Comments"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: simpleWpMapAdmin.php:112
|
200 |
msgid "Parents"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: simpleWpMapAdmin.php:118
|
204 |
msgid "Restore default order"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: simpleWpMapAdmin.php:124 simpleWpMapAdmin.php:135
|
208 |
msgid "Simple Wp Sitemap Premium"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: simpleWpMapAdmin.php:125
|
212 |
msgid "There's a premium version of Simple Wp Sitemap available which includes:"
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: simpleWpMapAdmin.php:128
|
216 |
msgid "Split sitemaps"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: simpleWpMapAdmin.php:129
|
220 |
msgid "Image sitemaps"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: simpleWpMapAdmin.php:130
|
224 |
msgid "Display with shortcode"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: simpleWpMapAdmin.php:131
|
228 |
msgid "Exclude directories"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: simpleWpMapAdmin.php:132
|
232 |
msgid "And much more!"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: simpleWpMapAdmin.php:135
|
236 |
+
msgid "Available at:"
|
|
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: simpleWpMapAdmin.php:139
|
240 |
msgid "Save Changes"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: simpleWpMapAdmin.php:141
|
244 |
msgid "(If you have a caching plugin, you might have to clear cache before changes will be shown in the sitemaps)"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: simpleWpMapBuilder.php:208
|
|
|
|
|
|
|
|
|
248 |
msgid "Generated by: Simple Wp Sitemap"
|
249 |
msgstr ""
|
250 |
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ License: GPLv3
|
|
5 |
License URI: http://www.gnu.org/licenses/gpl.html
|
6 |
Tags: sitemap, site map, sitemap.xml, xml sitemap, html sitemap, simple sitemap, seo sitemap, google sitemap, sitemap.html, sitemap plugin, wordpress sitemap
|
7 |
Requires at least: 4.0
|
8 |
-
Tested up to: 4.
|
9 |
-
Stable tag: 1.
|
10 |
|
11 |
An easy sitemap plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you don't have to!
|
12 |
|
@@ -82,6 +82,11 @@ When you deactivate the plugin they get removed automatically.
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
|
|
85 |
= 1.1.9 (Jun 9, 2017) =
|
86 |
* Added more sort options
|
87 |
* New screenshots
|
5 |
License URI: http://www.gnu.org/licenses/gpl.html
|
6 |
Tags: sitemap, site map, sitemap.xml, xml sitemap, html sitemap, simple sitemap, seo sitemap, google sitemap, sitemap.html, sitemap plugin, wordpress sitemap
|
7 |
Requires at least: 4.0
|
8 |
+
Tested up to: 4.9
|
9 |
+
Stable tag: 1.2.0
|
10 |
|
11 |
An easy sitemap plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you don't have to!
|
12 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 1.2.0 (Nov 16, 2017) =
|
86 |
+
* Added option to change title in html sitemap
|
87 |
+
* Urlfix when no permalink setting is set
|
88 |
+
* Minor style changes
|
89 |
+
|
90 |
= 1.1.9 (Jun 9, 2017) =
|
91 |
* Added more sort options
|
92 |
* New screenshots
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
simple-wp-sitemap.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Simple Wp Sitemap
|
5 |
* Plugin URI: https://www.webbjocke.com/simple-wp-sitemap/
|
6 |
* Description: An easy sitemap plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you don't have to!
|
7 |
-
* Version: 1.
|
8 |
* Author: Webbjocke
|
9 |
* Author URI: https://www.webbjocke.com/
|
10 |
* License: GPLv3
|
@@ -75,7 +75,7 @@ class SimpleWpSitemap {
|
|
75 |
|
76 |
// Loads plugins text domain
|
77 |
public static function loadTextDomain () {
|
78 |
-
load_plugin_textdomain('simple-wp-sitemap', false, basename(dirname(
|
79 |
}
|
80 |
|
81 |
// Adds a link to settings from the plugins page
|
@@ -85,7 +85,7 @@ class SimpleWpSitemap {
|
|
85 |
|
86 |
// Sets the option menu for admins and enqueues scripts n styles
|
87 |
public static function sitemapAdminSetup () {
|
88 |
-
add_options_page('Simple Wp Sitemap', 'Simple Wp Sitemap', 'manage_options', 'simpleWpSitemapSettings', array(__CLASS__, 'sitemapAdminArea'));
|
89 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'sitemapScriptsAndStyles'));
|
90 |
add_action('admin_init', array(__CLASS__, 'updateCheck'));
|
91 |
}
|
@@ -96,13 +96,13 @@ class SimpleWpSitemap {
|
|
96 |
add_rewrite_rule('sitemap\.html$', 'index.php?thesimplewpsitemap=html', 'top');
|
97 |
}
|
98 |
|
99 |
-
//
|
100 |
public static function addSitemapQuery ($vars) {
|
101 |
$vars[] = 'thesimplewpsitemap';
|
102 |
return $vars;
|
103 |
}
|
104 |
|
105 |
-
// Generates the content
|
106 |
public static function generateSitemapContent () {
|
107 |
global $wp_query;
|
108 |
|
@@ -129,12 +129,12 @@ class SimpleWpSitemap {
|
|
129 |
}
|
130 |
}
|
131 |
|
132 |
-
//
|
133 |
public static function sitemapScriptsAndStyles ($page) {
|
134 |
if ($page === 'settings_page_simpleWpSitemapSettings') {
|
135 |
wp_enqueue_script('jquery-ui-tabs');
|
136 |
-
wp_enqueue_style('simple-wp-sitemap-admin-css', esc_url(plugin_dir_url(
|
137 |
-
wp_enqueue_script('simple-wp-sitemap-admin-js', esc_url(plugin_dir_url(
|
138 |
}
|
139 |
}
|
140 |
|
@@ -144,14 +144,14 @@ class SimpleWpSitemap {
|
|
144 |
require_once 'simpleWpMapOptions.php';
|
145 |
$ops = new SimpleWpMapOptions();
|
146 |
|
147 |
-
if (isset($_POST['simple_wp_other_urls'], $_POST['simple_wp_block_urls'], $_POST['simple_wp_home_n'], $_POST['simple_wp_posts_n'], $_POST['simple_wp_pages_n'], $_POST['simple_wp_other_n'], $_POST['simple_wp_categories_n'], $_POST['simple_wp_tags_n'], $_POST['simple_wp_authors_n'], $_POST['simple_wp_last_updated'], $_POST['simple_wp_block_html'], $_POST['simple_wp_order_by'])) {
|
148 |
$order = $ops->getDefaultOrder();
|
149 |
|
150 |
foreach ($order as $key => $val) {
|
151 |
$arr = explode('-|-', $_POST['simple_wp_' . $key . '_n']);
|
152 |
$order[$key] = array('i' => $arr[0], 'title' => isset($arr[1]) ? $arr[1] : $key);
|
153 |
}
|
154 |
-
$ops->setOptions($_POST['simple_wp_other_urls'], $_POST['simple_wp_block_urls'],
|
155 |
}
|
156 |
require_once 'simpleWpMapAdmin.php';
|
157 |
}
|
4 |
* Plugin Name: Simple Wp Sitemap
|
5 |
* Plugin URI: https://www.webbjocke.com/simple-wp-sitemap/
|
6 |
* Description: An easy sitemap plugin that adds both an xml and an html sitemap to your site, which updates and maintains themselves so you don't have to!
|
7 |
+
* Version: 1.2.0
|
8 |
* Author: Webbjocke
|
9 |
* Author URI: https://www.webbjocke.com/
|
10 |
* License: GPLv3
|
75 |
|
76 |
// Loads plugins text domain
|
77 |
public static function loadTextDomain () {
|
78 |
+
load_plugin_textdomain('simple-wp-sitemap', false, basename(dirname(__FILE__)) . '/languages/');
|
79 |
}
|
80 |
|
81 |
// Adds a link to settings from the plugins page
|
85 |
|
86 |
// Sets the option menu for admins and enqueues scripts n styles
|
87 |
public static function sitemapAdminSetup () {
|
88 |
+
add_options_page(__('Simple Wp Sitemap', 'simple-wp-sitemap'), __('Simple Wp Sitemap', 'simple-wp-sitemap'), 'manage_options', 'simpleWpSitemapSettings', array(__CLASS__, 'sitemapAdminArea'));
|
89 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'sitemapScriptsAndStyles'));
|
90 |
add_action('admin_init', array(__CLASS__, 'updateCheck'));
|
91 |
}
|
96 |
add_rewrite_rule('sitemap\.html$', 'index.php?thesimplewpsitemap=html', 'top');
|
97 |
}
|
98 |
|
99 |
+
// Adds custom query
|
100 |
public static function addSitemapQuery ($vars) {
|
101 |
$vars[] = 'thesimplewpsitemap';
|
102 |
return $vars;
|
103 |
}
|
104 |
|
105 |
+
// Generates the content if sitemap request
|
106 |
public static function generateSitemapContent () {
|
107 |
global $wp_query;
|
108 |
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
// Adds custom scripts and styles to the plugins customization page in admin area
|
133 |
public static function sitemapScriptsAndStyles ($page) {
|
134 |
if ($page === 'settings_page_simpleWpSitemapSettings') {
|
135 |
wp_enqueue_script('jquery-ui-tabs');
|
136 |
+
wp_enqueue_style('simple-wp-sitemap-admin-css', esc_url(plugin_dir_url(__FILE__) . 'css/simple-wp-sitemap-admin.css'), array(), false);
|
137 |
+
wp_enqueue_script('simple-wp-sitemap-admin-js', esc_url(plugin_dir_url(__FILE__) . 'js/simple-wp-sitemap-admin.js'), array('jquery'), false, true);
|
138 |
}
|
139 |
}
|
140 |
|
144 |
require_once 'simpleWpMapOptions.php';
|
145 |
$ops = new SimpleWpMapOptions();
|
146 |
|
147 |
+
if (isset($_POST['simple_wp_other_urls'], $_POST['simple_wp_block_urls'], $_POST['simple_wp_home_n'], $_POST['simple_wp_posts_n'], $_POST['simple_wp_pages_n'], $_POST['simple_wp_other_n'], $_POST['simple_wp_categories_n'], $_POST['simple_wp_tags_n'], $_POST['simple_wp_authors_n'], $_POST['simple_wp_last_updated'], $_POST['simple_wp_block_html'], $_POST['simple_wp_order_by'], $_POST['simple_wp_sitemap_title'])) {
|
148 |
$order = $ops->getDefaultOrder();
|
149 |
|
150 |
foreach ($order as $key => $val) {
|
151 |
$arr = explode('-|-', $_POST['simple_wp_' . $key . '_n']);
|
152 |
$order[$key] = array('i' => $arr[0], 'title' => isset($arr[1]) ? $arr[1] : $key);
|
153 |
}
|
154 |
+
$ops->setOptions($_POST['simple_wp_other_urls'], $_POST['simple_wp_block_urls'], isset($_POST['simple_wp_attr_link']) ? 1 : 0, isset($_POST['simple_wp_disp_categories']) ? 1 : 0, isset($_POST['simple_wp_disp_tags']) ? 1 : 0, isset($_POST['simple_wp_disp_authors']) ? 1 : 0, $order, $_POST['simple_wp_last_updated'], $_POST['simple_wp_block_html'], $_POST['simple_wp_order_by'], $_POST['simple_wp_sitemap_title']);
|
155 |
}
|
156 |
require_once 'simpleWpMapAdmin.php';
|
157 |
}
|
simpleWpMapAdmin.php
CHANGED
@@ -25,199 +25,121 @@
|
|
25 |
|
26 |
<noscript><?php _e('(Please enable javascript to edit options)', 'simple-wp-sitemap'); ?></noscript>
|
27 |
|
28 |
-
<form method="post" action="<?php
|
29 |
|
30 |
<ul id="sitemap-settings">
|
31 |
-
<li><a href="#sitemap-
|
32 |
-
<li><a href="#sitemap-
|
33 |
<li><a href="#sitemap-premium"><?php _e('Premium', 'simple-wp-sitemap'); ?></a></li>
|
34 |
</ul>
|
35 |
|
36 |
-
<
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
<
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
<
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
<
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
<
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
</
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
<
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
<
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
<table id="sitemap-advanced" class="widefat form-table">
|
139 |
-
<tr>
|
140 |
-
<td>
|
141 |
-
<b><?php _e('Display order and titles', 'simple-wp-sitemap'); ?></b>
|
142 |
-
</td>
|
143 |
-
</tr>
|
144 |
-
<tr>
|
145 |
-
<td>
|
146 |
-
<?php _e('If you want to change the display order in your sitemaps, click the arrows to move sections up or down. They will be displayed as ordered below (highest up is displayed first and lowest down last)', 'simple-wp-sitemap'); ?>
|
147 |
-
</td>
|
148 |
-
</tr>
|
149 |
-
<tr>
|
150 |
-
<td>
|
151 |
-
<ul id="sitemap-display-order">
|
152 |
-
<?php if (!($orderArray = $ops->checkOrder(get_option('simple_wp_disp_sitemap_order')))) {
|
153 |
-
$orderArray = $ops->getDefaultOrder();
|
154 |
-
}
|
155 |
-
foreach ($orderArray as $key => $val) {
|
156 |
-
printf(
|
157 |
-
'<li><input type="text" class="swp-name" data-name="%1$s" value="%2$s"><span class="sitemap-down" title="move down"></span><span class="sitemap-up" title="move up"></span>' .
|
158 |
-
'<input type="hidden" name="simple_wp_%1$s_n" value="%3$d"></li>',
|
159 |
-
esc_attr($key), esc_attr($val['title']), esc_attr($val['i'])
|
160 |
-
);
|
161 |
-
} ?>
|
162 |
-
</ul>
|
163 |
-
</td>
|
164 |
-
</tr>
|
165 |
-
<tr>
|
166 |
-
<td>
|
167 |
-
<b><?php _e('Last updated text:', 'simple-wp-sitemap'); ?></b>
|
168 |
-
<input type="text" name="simple_wp_last_updated" placeholder="<?php esc_attr_e('Last updated', 'simple-wp-sitemap'); ?>" value="<?php echo esc_attr(get_option('simple_wp_last_updated')); ?>" id="simple_wp_last_updated">
|
169 |
-
</td>
|
170 |
-
</tr>
|
171 |
-
<tr>
|
172 |
-
<td>
|
173 |
-
<b><?php _e('Sort posts and pages:', 'simple-wp-sitemap'); ?></b>
|
174 |
-
<select id="simple_wp_order_by" name="simple_wp_order_by">
|
175 |
-
<?php foreach (array('' => __('Posted date', 'simple-wp-sitemap'), 'modified' => __('Last updated date', 'simple-wp-sitemap'), 'name' => __('Alphabetical', 'simple-wp-sitemap'), 'rand' => __('Random', 'simple-wp-sitemap'), 'comment_count' => __('Comments', 'simple-wp-sitemap'), 'parent' => __('Parents', 'simple-wp-sitemap')) as $key => $val) { ?>
|
176 |
-
<option value="<?php echo $key; ?>" <?php selected(get_option('simple_wp_order_by'), $key); ?>><?php echo $val; ?></option>
|
177 |
-
<?php } ?>
|
178 |
-
</select>
|
179 |
-
</td>
|
180 |
-
</tr>
|
181 |
-
<tr>
|
182 |
-
<td>
|
183 |
-
<input type="button" id="sitemap-defaults" class="button-secondary" value="<?php esc_attr_e('Restore default order', 'simple-wp-sitemap'); ?>">
|
184 |
-
</td>
|
185 |
-
</tr>
|
186 |
-
</table><!-- sitemap-advanced -->
|
187 |
-
|
188 |
-
<table id="sitemap-premium" class="widefat form-table">
|
189 |
-
<tr>
|
190 |
-
<td>
|
191 |
-
<b><?php _e('Simple Wp Sitemap Premium', 'simple-wp-sitemap'); ?></b>
|
192 |
-
</td>
|
193 |
-
</tr>
|
194 |
-
<tr>
|
195 |
-
<td>
|
196 |
-
<?php _e('There\'s a premium version of Simple Wp Sitemap available which includes:', 'simple-wp-sitemap'); ?>
|
197 |
-
</td>
|
198 |
-
</tr>
|
199 |
-
<tr>
|
200 |
-
<td>
|
201 |
-
<ul class="simple-wp-sitemap-includes">
|
202 |
-
<li><?php _e('Split sitemaps', 'simple-wp-sitemap'); ?></li>
|
203 |
-
<li><?php _e('Image sitemaps', 'simple-wp-sitemap'); ?></li>
|
204 |
-
<li><?php _e('Display with shortcode', 'simple-wp-sitemap'); ?></li>
|
205 |
-
<li><?php _e('Exclude directories', 'simple-wp-sitemap'); ?></li>
|
206 |
-
<li><?php _e('And much more!', 'simple-wp-sitemap'); ?></li>
|
207 |
-
</ul>
|
208 |
-
</td>
|
209 |
-
</tr>
|
210 |
-
<tr>
|
211 |
-
<td>
|
212 |
-
<?php printf(__('Available at: <a target="_blank" href="%s">webbjocke.com/downloads/simple-wp-sitemap-premium</a>', 'simple-wp-sitemap'), esc_url('https://www.webbjocke.com/downloads/simple-wp-sitemap-premium/')); ?>
|
213 |
-
</td>
|
214 |
-
</tr>
|
215 |
-
</table><!-- sitemap-premium -->
|
216 |
|
217 |
<p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes', 'simple-wp-sitemap'); ?>"></p>
|
218 |
|
219 |
<p><i><?php _e('(If you have a caching plugin, you might have to clear cache before changes will be shown in the sitemaps)', 'simple-wp-sitemap'); ?></i></p>
|
220 |
|
221 |
-
</form
|
222 |
|
223 |
</div><!-- wrap -->
|
25 |
|
26 |
<noscript><?php _e('(Please enable javascript to edit options)', 'simple-wp-sitemap'); ?></noscript>
|
27 |
|
28 |
+
<form method="post" action="<?php echo esc_url(admin_url('options-general.php?page=simpleWpSitemapSettings')); ?>" id="simple-wp-sitemap-form">
|
29 |
|
30 |
<ul id="sitemap-settings">
|
31 |
+
<li><a href="#sitemap-general"><?php _e('General', 'simple-wp-sitemap'); ?></a></li>
|
32 |
+
<li><a href="#sitemap-order"><?php _e('Order', 'simple-wp-sitemap'); ?></a></li>
|
33 |
<li><a href="#sitemap-premium"><?php _e('Premium', 'simple-wp-sitemap'); ?></a></li>
|
34 |
</ul>
|
35 |
|
36 |
+
<div id="sitemap-general" class="sitemap-table">
|
37 |
+
|
38 |
+
<h3><?php _e('Add pages', 'simple-wp-sitemap'); ?></h3>
|
39 |
+
<p>
|
40 |
+
<?php printf(
|
41 |
+
__('Add pages to the sitemaps in addition to your normal WordPress ones. Just paste "full" urls in the textarea like: %s. Each link on a new row (this will affect both your xml and html sitemap).', 'simple-wp-sitemap'),
|
42 |
+
sprintf('<b>%s</b>', esc_url('http://www.example.com/a-page/'))
|
43 |
+
); ?>
|
44 |
+
</p>
|
45 |
+
|
46 |
+
<p><textarea rows="7" name="simple_wp_other_urls" placeholder="<?php echo esc_url('http://www.example.com/a-page/'); ?>" class="large-text code" id="swsp-add-pages-textarea"><?php $ops->printUrls('simple_wp_other_urls'); ?></textarea></p>
|
47 |
+
|
48 |
+
<h3 class="sitemap-section"><?php _e('Block pages', 'simple-wp-sitemap'); ?></h3>
|
49 |
+
<p><?php _e('Add pages you want to block from showing up in the sitemaps. Same as above, just paste every link on a new row. (Tip: copy paste links from one of your sitemaps to get correct urls).', 'simple-wp-sitemap'); ?></p>
|
50 |
+
|
51 |
+
<p><textarea rows="7" name="simple_wp_block_urls" placeholder="<?php echo esc_url('http://www.example.com/block-this-page/'); ?>" class="large-text code"><?php $ops->printUrls('simple_wp_block_urls'); ?></textarea></p>
|
52 |
+
|
53 |
+
<h3 class="sitemap-section"><?php _e('Extra sitemap includes', 'simple-wp-sitemap'); ?></h3>
|
54 |
+
<p><?php _e('Check if you want to include categories, tags and/or author pages in the sitemaps.', 'simple-wp-sitemap'); ?></p>
|
55 |
+
|
56 |
+
<div>
|
57 |
+
<p><input type="checkbox" name="simple_wp_disp_categories" id="simple_wp_cat" <?php checked(get_option('simple_wp_disp_categories')); ?>><label for="simple_wp_cat"> <?php _e('Include categories', 'simple-wp-sitemap'); ?></label></p>
|
58 |
+
<p><input type="checkbox" name="simple_wp_disp_tags" id="simple_wp_tags" <?php checked(get_option('simple_wp_disp_tags')); ?>><label for="simple_wp_tags"> <?php _e('Include tags', 'simple-wp-sitemap'); ?></label></p>
|
59 |
+
<p><input type="checkbox" name="simple_wp_disp_authors" id="simple_wp_authors" <?php checked(get_option('simple_wp_disp_authors')); ?>><label for="simple_wp_authors"> <?php _e('Include authors', 'simple-wp-sitemap'); ?></label></p>
|
60 |
+
</div>
|
61 |
+
|
62 |
+
<h3 class="sitemap-section"><?php _e('Html sitemap', 'simple-wp-sitemap'); ?></h3>
|
63 |
+
<p><?php _e('Enable or disable your html sitemap. This will not effect your xml sitemap.', 'simple-wp-sitemap'); ?></p>
|
64 |
+
|
65 |
+
<div>
|
66 |
+
<?php _e('Title in html sitemap', 'simple-wp-sitemap'); ?>:
|
67 |
+
<input type="text" name="simple_wp_sitemap_title" placeholder="<?php echo esc_attr(get_bloginfo('name') . ' ' . __('Html Sitemap', 'simple-wp-sitemap')); ?>" value="<?php echo esc_attr(get_option('simple_wp_sitemap_title')); ?>">
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<div>
|
71 |
+
<select name="simple_wp_block_html" id="simple_wp_block_html">
|
72 |
+
<?php foreach (array('' => __('Enable', 'simple-wp-sitemap'), '1' => __('Disable', 'simple-wp-sitemap'), '404' => __('Disable and set to 404', 'simple-wp-sitemap')) as $key => $val) { ?>
|
73 |
+
<option value="<?php echo $key; ?>" <?php selected(get_option('simple_wp_block_html'), $key); ?>><?php echo $val; ?></option>
|
74 |
+
<?php } ?>
|
75 |
+
</select>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<h3 class="sitemap-section"><?php _e('Like the plugin?', 'simple-wp-sitemap'); ?></h3>
|
79 |
+
<p><?php _e('Show your support by rating the plugin at wordpress.org, and/or by adding an attribution link to the sitemap.html file :)', 'simple-wp-sitemap'); ?></p>
|
80 |
+
|
81 |
+
<p><input type="checkbox" name="simple_wp_attr_link" id="simple_wp_check" <?php checked(get_option('simple_wp_attr_link')); ?>><label for="simple_wp_check"> <?php _e('Add "Generated by Simple Wp Sitemap" link at bottom of sitemap.html', 'simple-wp-sitemap'); ?></label></p>
|
82 |
+
|
83 |
+
</div><!-- sitemap-general -->
|
84 |
+
|
85 |
+
<div id="sitemap-order" class="sitemap-table">
|
86 |
+
|
87 |
+
<h3><?php _e('Display order and titles', 'simple-wp-sitemap'); ?></h3>
|
88 |
+
<p><?php _e('If you want to change the display order in your sitemaps, click the arrows to move sections up or down. They will be displayed as ordered below (highest up is displayed first and lowest down last)', 'simple-wp-sitemap'); ?></p>
|
89 |
+
|
90 |
+
<ul id="sitemap-display-order">
|
91 |
+
<?php if (!($orderArray = $ops->checkOrder(get_option('simple_wp_disp_sitemap_order')))) {
|
92 |
+
$orderArray = $ops->getDefaultOrder();
|
93 |
+
}
|
94 |
+
foreach ($orderArray as $key => $val) { ?>
|
95 |
+
<li>
|
96 |
+
<input type="text" class="swp-name" data-name="<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($val['title']); ?>">
|
97 |
+
<span class="sitemap-down" title="<?php esc_attr_e('Move down', 'simple-wp-sitemap'); ?>"></span>
|
98 |
+
<span class="sitemap-up" title="<?php esc_attr_e('Move up', 'simple-wp-sitemap'); ?>"></span>
|
99 |
+
<input type="hidden" name="simple_wp_<?php echo esc_attr($key); ?>_n" value="<?php echo esc_attr($val['i']); ?>">
|
100 |
+
</li>
|
101 |
+
<?php } ?>
|
102 |
+
</ul>
|
103 |
+
|
104 |
+
<div>
|
105 |
+
<b><?php _e('Last updated text:', 'simple-wp-sitemap'); ?></b>
|
106 |
+
<input type="text" name="simple_wp_last_updated" placeholder="<?php esc_attr_e('Last updated', 'simple-wp-sitemap'); ?>" value="<?php echo esc_attr(get_option('simple_wp_last_updated')); ?>" id="simple_wp_last_updated">
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<div>
|
110 |
+
<b><?php _e('Sort posts and pages:', 'simple-wp-sitemap'); ?></b>
|
111 |
+
<select id="simple_wp_order_by" name="simple_wp_order_by">
|
112 |
+
<?php foreach (array('' => __('Posted date', 'simple-wp-sitemap'), 'modified' => __('Last updated date', 'simple-wp-sitemap'), 'name' => __('Alphabetical', 'simple-wp-sitemap'), 'rand' => __('Random', 'simple-wp-sitemap'), 'comment_count' => __('Comments', 'simple-wp-sitemap'), 'parent' => __('Parents', 'simple-wp-sitemap')) as $key => $val) { ?>
|
113 |
+
<option value="<?php echo $key; ?>" <?php selected(get_option('simple_wp_order_by'), $key); ?>><?php echo $val; ?></option>
|
114 |
+
<?php } ?>
|
115 |
+
</select>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<p><input type="button" id="sitemap-defaults" class="button-secondary" value="<?php esc_attr_e('Restore default order', 'simple-wp-sitemap'); ?>"></p>
|
119 |
+
|
120 |
+
</div><!-- sitemap-order -->
|
121 |
+
|
122 |
+
<div id="sitemap-premium" class="sitemap-table">
|
123 |
+
|
124 |
+
<h3><?php _e('Simple Wp Sitemap Premium', 'simple-wp-sitemap'); ?></h3>
|
125 |
+
<p><?php _e('There\'s a premium version of Simple Wp Sitemap available which includes:', 'simple-wp-sitemap'); ?></p>
|
126 |
+
|
127 |
+
<ul class="simple-wp-sitemap-includes">
|
128 |
+
<li><?php _e('Split sitemaps', 'simple-wp-sitemap'); ?></li>
|
129 |
+
<li><?php _e('Image sitemaps', 'simple-wp-sitemap'); ?></li>
|
130 |
+
<li><?php _e('Display with shortcode', 'simple-wp-sitemap'); ?></li>
|
131 |
+
<li><?php _e('Exclude directories', 'simple-wp-sitemap'); ?></li>
|
132 |
+
<li><?php _e('And much more!', 'simple-wp-sitemap'); ?></li>
|
133 |
+
</ul>
|
134 |
+
|
135 |
+
<p><?php _e('Available at:', 'simple-wp-sitemap'); ?> <a target="_blank" rel="noopener" href="<?php echo esc_url('https://www.webbjocke.com/downloads/simple-wp-sitemap-premium/'); ?>"><?php _e('Simple Wp Sitemap Premium', 'simple-wp-sitemap'); ?></a></p>
|
136 |
+
|
137 |
+
</div><!-- sitemap-premium -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
<p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes', 'simple-wp-sitemap'); ?>"></p>
|
140 |
|
141 |
<p><i><?php _e('(If you have a caching plugin, you might have to clear cache before changes will be shown in the sitemaps)', 'simple-wp-sitemap'); ?></i></p>
|
142 |
|
143 |
+
</form><!-- simple-wp-sitemap-form -->
|
144 |
|
145 |
</div><!-- wrap -->
|
simpleWpMapBuilder.php
CHANGED
@@ -10,21 +10,21 @@ class SimpleWpMapBuilder {
|
|
10 |
private $html = false;
|
11 |
private $posts = '';
|
12 |
private $pages = '';
|
|
|
13 |
private $blockedUrls = null;
|
14 |
-
private $url;
|
15 |
private $tags;
|
16 |
-
private $other;
|
17 |
-
private $homeUrl;
|
18 |
private $authors;
|
19 |
private $orderby;
|
20 |
private $pattern;
|
|
|
|
|
21 |
private $categories;
|
22 |
private $lastUpdated;
|
23 |
|
24 |
// Constructor
|
25 |
public function __construct () {
|
26 |
$this->homeUrl = esc_url(home_url('/'));
|
27 |
-
$this->
|
28 |
$this->categories = get_option('simple_wp_disp_categories') ? array(0 => 0) : false;
|
29 |
$this->tags = get_option('simple_wp_disp_tags') ? array(0 => 0) : false;
|
30 |
$this->authors = get_option('simple_wp_disp_authors') ? array(0 => 0) : false;
|
@@ -36,7 +36,7 @@ class SimpleWpMapBuilder {
|
|
36 |
public function generateSitemap ($type) {
|
37 |
if ($type === 'xml' || $type === 'html') {
|
38 |
$this->$type = true;
|
39 |
-
$this->pattern =
|
40 |
$this->getOtherPages();
|
41 |
$this->setUpBlockedUrls();
|
42 |
$this->setLastUpdated();
|
@@ -45,20 +45,20 @@ class SimpleWpMapBuilder {
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
// Gets custom urls
|
49 |
public function getOtherPages () {
|
50 |
-
$xml = array();
|
51 |
if ($others = get_option('simple_wp_other_urls')) {
|
52 |
if ($this->orderby === 'modified') {
|
53 |
uasort($others, array($this, 'sortDate'));
|
54 |
}
|
|
|
55 |
foreach ($others as $other) {
|
56 |
if ($other && is_array($other)) {
|
57 |
$xml[] = $this->getXml(esc_url($other['url']), date($this->pattern, is_int($other['date']) ? $other['date'] : strtotime($other['date'])));
|
58 |
}
|
59 |
}
|
|
|
60 |
}
|
61 |
-
$this->other = $this->sortToString($xml);
|
62 |
}
|
63 |
|
64 |
// Sets up blocked urls into an array
|
@@ -73,48 +73,46 @@ class SimpleWpMapBuilder {
|
|
73 |
|
74 |
// Sets the "last updated" text
|
75 |
public function setLastUpdated () {
|
76 |
-
$this->lastUpdated = ($updated = get_option('simple_wp_last_updated')) ?
|
77 |
}
|
78 |
|
79 |
-
//
|
80 |
public function isBlockedUrl($url) {
|
81 |
return $this->blockedUrls && isset($this->blockedUrls[$url]);
|
82 |
}
|
83 |
|
84 |
// Returns xml or html
|
85 |
-
public function getXml ($
|
86 |
-
return $this->xml ? "<url>\n\t<loc>$
|
87 |
}
|
88 |
|
89 |
-
//
|
90 |
public function generateContent () {
|
91 |
$q = new WP_Query(array(
|
92 |
'post_type' => 'any',
|
93 |
'post_status' => 'publish',
|
94 |
-
'posts_per_page' => 50000,
|
95 |
'has_password' => false,
|
96 |
'orderby' => $this->orderby ? ($this->orderby === 'parent' ? array('type' => 'DESC', 'parent' => 'DESC') : sanitize_text_field($this->orderby)) : 'date',
|
97 |
'order' => $this->orderby === 'name' ? 'ASC' : 'DESC'
|
98 |
));
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
$q->the_post();
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
|
112 |
-
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
}
|
118 |
}
|
119 |
}
|
120 |
}
|
@@ -123,15 +121,15 @@ class SimpleWpMapBuilder {
|
|
123 |
|
124 |
// Gets a posts categories, tags and author, and compares for last modified date
|
125 |
public function getCategoriesTagsAndAuthor ($date) {
|
126 |
-
if ($this->categories && ($
|
127 |
-
foreach ($
|
128 |
if (!isset($this->categories[($id = $category->term_id)]) || $this->categories[$id] < $date) {
|
129 |
$this->categories[$id] = $date;
|
130 |
}
|
131 |
}
|
132 |
}
|
133 |
-
if ($this->tags && ($
|
134 |
-
foreach ($
|
135 |
if (!isset($this->tags[($id = $tag->term_id)]) || $this->tags[$id] < $date) {
|
136 |
$this->tags[$id] = $date;
|
137 |
}
|
@@ -144,22 +142,22 @@ class SimpleWpMapBuilder {
|
|
144 |
}
|
145 |
}
|
146 |
|
147 |
-
// Prints
|
148 |
public function printOutput () {
|
149 |
if ($this->xml) {
|
150 |
-
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/css\" href=\"", $this->
|
151 |
$this->sortAndPrintSections();
|
152 |
echo '</urlset>';
|
153 |
|
154 |
} else {
|
155 |
-
$
|
156 |
-
echo '<!doctype html><html lang="', get_locale(), '"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>', $
|
157 |
$this->sortAndPrintSections();
|
158 |
echo '</div></body></html>';
|
159 |
}
|
160 |
}
|
161 |
|
162 |
-
//
|
163 |
public function sortAndPrintSections () {
|
164 |
$orderArray = get_option('simple_wp_disp_sitemap_order');
|
165 |
|
@@ -177,22 +175,18 @@ class SimpleWpMapBuilder {
|
|
177 |
}
|
178 |
|
179 |
// Prints a sections xml/html
|
180 |
-
public function printSection ($arr, $
|
181 |
-
if ($this->$
|
182 |
-
$xml = $this->$
|
183 |
-
unset($this->$
|
184 |
|
185 |
-
if (in_array($
|
186 |
$urls = array();
|
187 |
foreach ($xml as $id => $date) {
|
188 |
if ($date) {
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
default: $link = esc_url(get_author_posts_url($id)); // Authors
|
193 |
-
}
|
194 |
-
if (!$this->isBlockedUrl($link)) {
|
195 |
-
$urls[] = $this->getXml($link, $date);
|
196 |
}
|
197 |
}
|
198 |
}
|
@@ -208,23 +202,23 @@ class SimpleWpMapBuilder {
|
|
208 |
}
|
209 |
}
|
210 |
|
211 |
-
// Displays attribution link if
|
212 |
public function attributionLink () {
|
213 |
if ($this->html && get_option('simple_wp_attr_link')) {
|
214 |
-
echo '<p id="attr"><a id="attr-a" href="', esc_url('https://www.webbjocke.com/simple-wp-sitemap/'), '" target="_blank">',
|
215 |
}
|
216 |
}
|
217 |
|
218 |
// Sorts or shuffles array and returns as string
|
219 |
public function sortToString ($urls) {
|
220 |
switch ($this->orderby) {
|
221 |
-
case 'name':
|
222 |
case 'rand': shuffle($urls); break;
|
223 |
}
|
224 |
return implode('', $urls);
|
225 |
}
|
226 |
|
227 |
-
// Sort function for
|
228 |
public function sortDate ($a, $b) {
|
229 |
return $b['date'] - $a['date'];
|
230 |
}
|
10 |
private $html = false;
|
11 |
private $posts = '';
|
12 |
private $pages = '';
|
13 |
+
private $other = false;
|
14 |
private $blockedUrls = null;
|
|
|
15 |
private $tags;
|
|
|
|
|
16 |
private $authors;
|
17 |
private $orderby;
|
18 |
private $pattern;
|
19 |
+
private $homeUrl;
|
20 |
+
private $pluginUrl;
|
21 |
private $categories;
|
22 |
private $lastUpdated;
|
23 |
|
24 |
// Constructor
|
25 |
public function __construct () {
|
26 |
$this->homeUrl = esc_url(home_url('/'));
|
27 |
+
$this->pluginUrl = esc_url(plugin_dir_url(__FILE__));
|
28 |
$this->categories = get_option('simple_wp_disp_categories') ? array(0 => 0) : false;
|
29 |
$this->tags = get_option('simple_wp_disp_tags') ? array(0 => 0) : false;
|
30 |
$this->authors = get_option('simple_wp_disp_authors') ? array(0 => 0) : false;
|
36 |
public function generateSitemap ($type) {
|
37 |
if ($type === 'xml' || $type === 'html') {
|
38 |
$this->$type = true;
|
39 |
+
$this->pattern = $this->xml ? 'Y-m-d\TH:i:sP' : 'Y-m-d H:i';
|
40 |
$this->getOtherPages();
|
41 |
$this->setUpBlockedUrls();
|
42 |
$this->setLastUpdated();
|
45 |
}
|
46 |
}
|
47 |
|
48 |
+
// Gets custom urls
|
49 |
public function getOtherPages () {
|
|
|
50 |
if ($others = get_option('simple_wp_other_urls')) {
|
51 |
if ($this->orderby === 'modified') {
|
52 |
uasort($others, array($this, 'sortDate'));
|
53 |
}
|
54 |
+
$xml = array();
|
55 |
foreach ($others as $other) {
|
56 |
if ($other && is_array($other)) {
|
57 |
$xml[] = $this->getXml(esc_url($other['url']), date($this->pattern, is_int($other['date']) ? $other['date'] : strtotime($other['date'])));
|
58 |
}
|
59 |
}
|
60 |
+
$this->other = $this->sortToString($xml);
|
61 |
}
|
|
|
62 |
}
|
63 |
|
64 |
// Sets up blocked urls into an array
|
73 |
|
74 |
// Sets the "last updated" text
|
75 |
public function setLastUpdated () {
|
76 |
+
$this->lastUpdated = esc_html(($updated = get_option('simple_wp_last_updated')) ? $updated : __('Last updated', 'simple-wp-sitemap'));
|
77 |
}
|
78 |
|
79 |
+
// Checks if blocked url that shouldn't be displayed
|
80 |
public function isBlockedUrl($url) {
|
81 |
return $this->blockedUrls && isset($this->blockedUrls[$url]);
|
82 |
}
|
83 |
|
84 |
// Returns xml or html
|
85 |
+
public function getXml ($url, $date) {
|
86 |
+
return $this->xml ? "<url>\n\t<loc>$url</loc>\n\t<lastmod>$date</lastmod>\n</url>\n" : "<li><a href=\"$url\"><span class=\"link\">$url</span><span class=\"date\">$date</span></a></li>";
|
87 |
}
|
88 |
|
89 |
+
// Generates the sitemaps content
|
90 |
public function generateContent () {
|
91 |
$q = new WP_Query(array(
|
92 |
'post_type' => 'any',
|
93 |
'post_status' => 'publish',
|
94 |
+
'posts_per_page' => 50000, // limit 50k posts
|
95 |
'has_password' => false,
|
96 |
'orderby' => $this->orderby ? ($this->orderby === 'parent' ? array('type' => 'DESC', 'parent' => 'DESC') : sanitize_text_field($this->orderby)) : 'date',
|
97 |
'order' => $this->orderby === 'name' ? 'ASC' : 'DESC'
|
98 |
));
|
99 |
|
100 |
+
while ($q->have_posts()) {
|
101 |
+
$q->the_post();
|
|
|
102 |
|
103 |
+
$url = esc_url(get_permalink());
|
104 |
+
$date = get_the_modified_date($this->pattern);
|
105 |
+
$this->getCategoriesTagsAndAuthor($date);
|
106 |
|
107 |
+
if (!$this->isBlockedUrl($url)) {
|
108 |
+
if (!$this->home && $url === $this->homeUrl) {
|
109 |
+
$this->home = $this->getXml($url, $date);
|
110 |
|
111 |
+
} elseif (get_post_type() === 'page') {
|
112 |
+
$this->pages .= $this->getXml($url, $date);
|
113 |
|
114 |
+
} else { // posts (also all custom post types are added here)
|
115 |
+
$this->posts .= $this->getXml($url, $date);
|
|
|
116 |
}
|
117 |
}
|
118 |
}
|
121 |
|
122 |
// Gets a posts categories, tags and author, and compares for last modified date
|
123 |
public function getCategoriesTagsAndAuthor ($date) {
|
124 |
+
if ($this->categories && ($categories = get_the_category())) {
|
125 |
+
foreach ($categories as $category) {
|
126 |
if (!isset($this->categories[($id = $category->term_id)]) || $this->categories[$id] < $date) {
|
127 |
$this->categories[$id] = $date;
|
128 |
}
|
129 |
}
|
130 |
}
|
131 |
+
if ($this->tags && ($tags = get_the_tags())) {
|
132 |
+
foreach ($tags as $tag) {
|
133 |
if (!isset($this->tags[($id = $tag->term_id)]) || $this->tags[$id] < $date) {
|
134 |
$this->tags[$id] = $date;
|
135 |
}
|
142 |
}
|
143 |
}
|
144 |
|
145 |
+
// Prints sitemap xml or html output
|
146 |
public function printOutput () {
|
147 |
if ($this->xml) {
|
148 |
+
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/css\" href=\"", $this->pluginUrl, "css/xml.css\"?>\n<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n\thttp://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
|
149 |
$this->sortAndPrintSections();
|
150 |
echo '</urlset>';
|
151 |
|
152 |
} else {
|
153 |
+
$title = esc_html(get_option('simple_wp_sitemap_title'));
|
154 |
+
echo '<!doctype html><html lang="', get_locale(), '"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>', $title ? $title : esc_html(get_bloginfo('name') . ' ' . __('Html Sitemap', 'simple-wp-sitemap')), '</title><link rel="stylesheet" href="', $this->pluginUrl, 'css/html.css"></head><body><div id="wrapper"><h1>', $title ? $title : sprintf('<a href="%s">%s</a> %s', $this->homeUrl, esc_html(get_bloginfo('name')), esc_html__('Html Sitemap', 'simple-wp-sitemap')), '</h1>';
|
155 |
$this->sortAndPrintSections();
|
156 |
echo '</div></body></html>';
|
157 |
}
|
158 |
}
|
159 |
|
160 |
+
// Prints sections after sort order
|
161 |
public function sortAndPrintSections () {
|
162 |
$orderArray = get_option('simple_wp_disp_sitemap_order');
|
163 |
|
175 |
}
|
176 |
|
177 |
// Prints a sections xml/html
|
178 |
+
public function printSection ($arr, $type) {
|
179 |
+
if ($this->$type) {
|
180 |
+
$xml = $this->$type;
|
181 |
+
unset($this->$type);
|
182 |
|
183 |
+
if (in_array($type, array('categories', 'tags', 'authors'))) { // Categories, tags or authors
|
184 |
$urls = array();
|
185 |
foreach ($xml as $id => $date) {
|
186 |
if ($date) {
|
187 |
+
$url = esc_url($type === 'tags' ? get_tag_link($id) : ($type === 'categories' ? get_category_link($id) : get_author_posts_url($id)));
|
188 |
+
if (!$this->isBlockedUrl($url)) {
|
189 |
+
$urls[] = $this->getXml($url, $date);
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
}
|
192 |
}
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
// Displays attribution link if option is checked
|
206 |
public function attributionLink () {
|
207 |
if ($this->html && get_option('simple_wp_attr_link')) {
|
208 |
+
echo '<p id="attr"><a id="attr-a" href="', esc_url('https://www.webbjocke.com/simple-wp-sitemap/'), '" target="_blank" rel="noopener">', esc_html__('Generated by: Simple Wp Sitemap', 'simple-wp-sitemap'), '</a></p>';
|
209 |
}
|
210 |
}
|
211 |
|
212 |
// Sorts or shuffles array and returns as string
|
213 |
public function sortToString ($urls) {
|
214 |
switch ($this->orderby) {
|
215 |
+
case 'name': natcasesort($urls); break;
|
216 |
case 'rand': shuffle($urls); break;
|
217 |
}
|
218 |
return implode('', $urls);
|
219 |
}
|
220 |
|
221 |
+
// Sort function for last modified date
|
222 |
public function sortDate ($a, $b) {
|
223 |
return $b['date'] - $a['date'];
|
224 |
}
|
simpleWpMapOptions.php
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
class SimpleWpMapOptions {
|
8 |
|
9 |
// Returns a sitemap url
|
10 |
-
public function getSitemapUrl ($
|
11 |
-
return esc_url(
|
12 |
}
|
13 |
|
14 |
// Returns default order option
|
@@ -17,7 +17,7 @@ class SimpleWpMapOptions {
|
|
17 |
}
|
18 |
|
19 |
// Updates all options
|
20 |
-
public function setOptions ($otherUrls, $blockUrls, $attrLink, $categories, $tags, $authors, $orderArray, $lastUpdated, $blockHtml, $orderby) {
|
21 |
@date_default_timezone_set(get_option('timezone_string'));
|
22 |
update_option('simple_wp_other_urls', $this->addUrls($otherUrls, get_option('simple_wp_other_urls')));
|
23 |
update_option('simple_wp_block_urls', $this->addUrls($blockUrls));
|
@@ -28,61 +28,52 @@ class SimpleWpMapOptions {
|
|
28 |
update_option('simple_wp_block_html', sanitize_text_field($blockHtml));
|
29 |
update_option('simple_wp_last_updated', sanitize_text_field(stripslashes($lastUpdated)));
|
30 |
update_option('simple_wp_order_by', sanitize_text_field($orderby));
|
|
|
31 |
|
32 |
if (($orderArray = $this->checkOrder($orderArray)) && uasort($orderArray, array($this, 'sortArr'))) { // sort the array here
|
33 |
update_option('simple_wp_disp_sitemap_order', $orderArray);
|
34 |
}
|
35 |
}
|
36 |
|
37 |
-
// Prints admin form submit url
|
38 |
-
public function printSubmitUrl () {
|
39 |
-
echo esc_url(admin_url('options-general.php?page=simpleWpSitemapSettings'));
|
40 |
-
}
|
41 |
-
|
42 |
// Prints urls in textarea
|
43 |
public function printUrls ($opt) {
|
44 |
-
$urls = get_option($opt)
|
45 |
-
|
46 |
-
|
47 |
-
foreach ($urls as $sArr) {
|
48 |
-
echo esc_url($sArr['url']) . "\n";
|
49 |
}
|
50 |
}
|
51 |
}
|
52 |
|
53 |
-
// Adds new urls to
|
54 |
public function addUrls ($urls, $oldUrls = null) {
|
55 |
-
$
|
56 |
-
$urls = trim($urls);
|
57 |
-
|
58 |
-
if ($urls) {
|
59 |
-
$urls = explode("\n", $urls);
|
60 |
|
|
|
61 |
foreach ($urls as $url){
|
62 |
if ($url = esc_url(trim($url))) {
|
63 |
$isOld = false;
|
64 |
if ($oldUrls && is_array($oldUrls)) {
|
65 |
foreach ($oldUrls as $oldUrl) {
|
66 |
if ($oldUrl['url'] === $url && !$isOld) {
|
67 |
-
array_push($
|
68 |
$isOld = true;
|
69 |
}
|
70 |
}
|
71 |
}
|
72 |
if (!$isOld && strlen($url) < 2000) {
|
73 |
-
array_push($
|
74 |
}
|
75 |
}
|
76 |
}
|
77 |
}
|
78 |
-
return $
|
79 |
}
|
80 |
|
81 |
// Checks if orderArray is valid
|
82 |
public function checkOrder ($orderArray) {
|
83 |
if (is_array($orderArray)) {
|
84 |
-
foreach ($orderArray as $
|
85 |
-
if (!is_array($
|
86 |
return false;
|
87 |
}
|
88 |
}
|
@@ -91,32 +82,30 @@ class SimpleWpMapOptions {
|
|
91 |
return false;
|
92 |
}
|
93 |
|
94 |
-
// Sort function for
|
95 |
public function sortArr ($a, $b) {
|
96 |
return $a['i'] - $b['i'];
|
97 |
}
|
98 |
|
99 |
-
// Deletes old or current sitemap files and
|
100 |
public function migrateFromOld () {
|
101 |
if (function_exists('get_home_path')) {
|
102 |
-
|
103 |
-
$path = sprintf('%ssitemap.', get_home_path());
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
}
|
111 |
}
|
112 |
|
113 |
if ($order = get_option('simple_wp_disp_sitemap_order')) {
|
114 |
foreach ($order as $key => $val) {
|
115 |
-
if (is_array($val)) {
|
116 |
-
|
|
|
117 |
}
|
118 |
-
$order[lcfirst($key)] = array('title' => $key, 'i' => $val);
|
119 |
-
unset($order[$key]);
|
120 |
}
|
121 |
} else {
|
122 |
$order = $this->getDefaultOrder();
|
7 |
class SimpleWpMapOptions {
|
8 |
|
9 |
// Returns a sitemap url
|
10 |
+
public function getSitemapUrl ($type) {
|
11 |
+
return esc_url(home_url('/') . (get_option('permalink_structure') ? 'sitemap.' : '?thesimplewpsitemap=') . $type);
|
12 |
}
|
13 |
|
14 |
// Returns default order option
|
17 |
}
|
18 |
|
19 |
// Updates all options
|
20 |
+
public function setOptions ($otherUrls, $blockUrls, $attrLink, $categories, $tags, $authors, $orderArray, $lastUpdated, $blockHtml, $orderby, $title) {
|
21 |
@date_default_timezone_set(get_option('timezone_string'));
|
22 |
update_option('simple_wp_other_urls', $this->addUrls($otherUrls, get_option('simple_wp_other_urls')));
|
23 |
update_option('simple_wp_block_urls', $this->addUrls($blockUrls));
|
28 |
update_option('simple_wp_block_html', sanitize_text_field($blockHtml));
|
29 |
update_option('simple_wp_last_updated', sanitize_text_field(stripslashes($lastUpdated)));
|
30 |
update_option('simple_wp_order_by', sanitize_text_field($orderby));
|
31 |
+
update_option('simple_wp_sitemap_title', sanitize_text_field(stripslashes($title)));
|
32 |
|
33 |
if (($orderArray = $this->checkOrder($orderArray)) && uasort($orderArray, array($this, 'sortArr'))) { // sort the array here
|
34 |
update_option('simple_wp_disp_sitemap_order', $orderArray);
|
35 |
}
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
// Prints urls in textarea
|
39 |
public function printUrls ($opt) {
|
40 |
+
if (is_array($urls = get_option($opt))) {
|
41 |
+
foreach ($urls as $url) {
|
42 |
+
echo esc_url($url['url']), "\n";
|
|
|
|
|
43 |
}
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
// Adds new urls to add and block pages
|
48 |
public function addUrls ($urls, $oldUrls = null) {
|
49 |
+
$newUrls = array();
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
if ($urls = explode("\n", trim($urls))) {
|
52 |
foreach ($urls as $url){
|
53 |
if ($url = esc_url(trim($url))) {
|
54 |
$isOld = false;
|
55 |
if ($oldUrls && is_array($oldUrls)) {
|
56 |
foreach ($oldUrls as $oldUrl) {
|
57 |
if ($oldUrl['url'] === $url && !$isOld) {
|
58 |
+
array_push($newUrls, $oldUrl);
|
59 |
$isOld = true;
|
60 |
}
|
61 |
}
|
62 |
}
|
63 |
if (!$isOld && strlen($url) < 2000) {
|
64 |
+
array_push($newUrls, array('url' => $url, 'date' => time()));
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
}
|
69 |
+
return $newUrls;
|
70 |
}
|
71 |
|
72 |
// Checks if orderArray is valid
|
73 |
public function checkOrder ($orderArray) {
|
74 |
if (is_array($orderArray)) {
|
75 |
+
foreach ($orderArray as $key => $val) {
|
76 |
+
if (!is_array($val) || !preg_match('/^[1-7]{1}$/', $val['i']) || (!($orderArray[$key]['title'] = sanitize_text_field(stripslashes($val['title']))))) {
|
77 |
return false;
|
78 |
}
|
79 |
}
|
82 |
return false;
|
83 |
}
|
84 |
|
85 |
+
// Sort function for order option
|
86 |
public function sortArr ($a, $b) {
|
87 |
return $a['i'] - $b['i'];
|
88 |
}
|
89 |
|
90 |
+
// Deletes old or current sitemap files and fixes order option for older plugin versions
|
91 |
public function migrateFromOld () {
|
92 |
if (function_exists('get_home_path')) {
|
93 |
+
$path = get_home_path() . 'sitemap.';
|
|
|
94 |
|
95 |
+
if (file_exists($path . 'xml')) {
|
96 |
+
unlink($path . 'xml');
|
97 |
+
}
|
98 |
+
if (file_exists($path . 'html') && !get_option('simple_wp_block_html')) {
|
99 |
+
unlink($path . 'html');
|
100 |
+
}
|
101 |
}
|
102 |
|
103 |
if ($order = get_option('simple_wp_disp_sitemap_order')) {
|
104 |
foreach ($order as $key => $val) {
|
105 |
+
if (!is_array($val)) {
|
106 |
+
unset($order[$key]);
|
107 |
+
$order[lcfirst($key)] = array('title' => $key, 'i' => $val);
|
108 |
}
|
|
|
|
|
109 |
}
|
110 |
} else {
|
111 |
$order = $this->getDefaultOrder();
|