Version Description
Download this release
Release Info
Developer | FolioVision |
Plugin | FV Top Level Categories |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.7
- languages/fv_tlc-pl_PL.mo +0 -0
- languages/fv_tlc-pl_PL.po +65 -0
- languages/fv_tlc-pt_PT.mo +0 -0
- languages/fv_tlc-pt_PT.po +49 -0
- languages/fv_tlc-sk_SK.po +50 -50
- readme.txt +6 -1
- top-level-cats.php +434 -422
languages/fv_tlc-pl_PL.mo
ADDED
Binary file
|
languages/fv_tlc-pl_PL.po
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: FV-topl-level-categories\n"
|
4 |
+
"POT-Creation-Date: 2015-05-01 00:15+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-05-01 00:30+0100\n"
|
6 |
+
"Last-Translator: Maciej Gryniuk <maciejka45@gmail.com>\n"
|
7 |
+
"Language-Team: Maciej Gryniuk <maciejka45@gmail.com>\n"
|
8 |
+
"Language: pl_PL\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.8beta1\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
|
15 |
+
"|| n%100>=20) ? 1 : 2);\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;_n\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
|
19 |
+
#: top-level-cats.php:3
|
20 |
+
msgid "FV Top Level Categories"
|
21 |
+
msgstr "FV Kategorie najwyższego poziomu"
|
22 |
+
|
23 |
+
#: top-level-cats.php:5
|
24 |
+
msgid ""
|
25 |
+
"Removes the prefix from the URL for a category. For instance, if your old "
|
26 |
+
"category link was <code>/category/catname</code> it will now be <code>/"
|
27 |
+
"catname</code>"
|
28 |
+
msgstr ""
|
29 |
+
"Usuwa prefiks kategorii z adresu URL. Przykładowo, jeżeli Twój stary link do "
|
30 |
+
"kategorii wyglądał tak: <code>/category/nazwakategorii</code>, teraz będzie "
|
31 |
+
"taki: <code>/nazwakategorii</code>"
|
32 |
+
|
33 |
+
#: top-level-cats.php:380
|
34 |
+
msgid "Adjust categories in your post URLs"
|
35 |
+
msgstr "Dostosuj kategorie w adresach URL wpisów"
|
36 |
+
|
37 |
+
#: top-level-cats.php:388
|
38 |
+
msgid "Only use top-level categories in URLs."
|
39 |
+
msgstr "Używaj w adresach URL tylko kategorii najwyższego poziomu."
|
40 |
+
|
41 |
+
#: top-level-cats.php:396
|
42 |
+
msgid "Only allow following categories in URLs:"
|
43 |
+
msgstr "Dozwól jedynie następujące kategorie w adresach URL:"
|
44 |
+
|
45 |
+
#: top-level-cats.php:403
|
46 |
+
msgid "Save Changes"
|
47 |
+
msgstr "Zapisz zmiany"
|
48 |
+
|
49 |
+
#: top-level-cats.php:407
|
50 |
+
msgid ""
|
51 |
+
"Are you having any problems or questions? Use our <a target=\"_blank\" href="
|
52 |
+
"\"http://foliovision.com/support/fv-top-level-categories/\">support forums</"
|
53 |
+
"a>."
|
54 |
+
msgstr ""
|
55 |
+
"Doświadczasz jakiś problemów lub masz pytania? Skorzytaj z naszego <a target="
|
56 |
+
"\"_blank\" href=\"http://foliovision.com/support/fv-top-level-categories/"
|
57 |
+
"\">forum wsparcia</a>."
|
58 |
+
|
59 |
+
#: top-level-cats.php:412
|
60 |
+
msgid ""
|
61 |
+
"Since you are not using %category% in your post permalinks, there is nothing "
|
62 |
+
"to adjust."
|
63 |
+
msgstr ""
|
64 |
+
"Ponieważ nie używasz %category% w bezpośrednich odnośnikach wpisów, nie "
|
65 |
+
"musisz nic dostosowywać."
|
languages/fv_tlc-pt_PT.mo
ADDED
Binary file
|
languages/fv_tlc-pt_PT.po
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: FV-topl-level-categories\n"
|
4 |
+
"POT-Creation-Date: 2015-05-11 09:35-0000\n"
|
5 |
+
"PO-Revision-Date: 2015-05-11 09:44-0000\n"
|
6 |
+
"Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"Language: pt_PT\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.7.6\n"
|
13 |
+
"X-Poedit-Basepath: ..\n"
|
14 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: .\n"
|
18 |
+
|
19 |
+
#: ../top-level-cats.php:270 ../top-level-cats.php:368
|
20 |
+
msgid "FV Top Level Categories"
|
21 |
+
msgstr "FV Top Level Categories"
|
22 |
+
|
23 |
+
#: ../top-level-cats.php:380
|
24 |
+
msgid "Adjust categories in your post URLs"
|
25 |
+
msgstr "Ajustar categorias nos URL dos seus artigos"
|
26 |
+
|
27 |
+
#: ../top-level-cats.php:388
|
28 |
+
msgid "Only use top-level categories in URLs."
|
29 |
+
msgstr "Utilizar apenas as categorias de topo nos URLs."
|
30 |
+
|
31 |
+
#: ../top-level-cats.php:396
|
32 |
+
msgid "Only allow following categories in URLs:"
|
33 |
+
msgstr "Apenas permitir as seguintes categorias nos URLs:"
|
34 |
+
|
35 |
+
#: ../top-level-cats.php:403
|
36 |
+
msgid "Save Changes"
|
37 |
+
msgstr "Guardar alterações"
|
38 |
+
|
39 |
+
#: ../top-level-cats.php:407
|
40 |
+
msgid "Are you having any problems or questions? Use our <a target=\"_blank\" href=\"http://foliovision.com/support/fv-top-level-categories/\">support forums</a>."
|
41 |
+
msgstr "Tem algum problema ou alguma dúvida? Utilize os nossos <a target=\"_blank\" href=\"http://foliovision.com/support/fv-top-level-categories/\">fóruns de suporte</a>."
|
42 |
+
|
43 |
+
#: ../top-level-cats.php:412
|
44 |
+
msgid "Since you are not using %category% in your post permalinks, there is nothing to adjust."
|
45 |
+
msgstr "Como não está a utilizar %category% nas ligações permanentes dos seus artigos, não há nada para ser ajustado."
|
46 |
+
|
47 |
+
#: ../top-level-cats.php:428
|
48 |
+
msgid "Settings"
|
49 |
+
msgstr "Definições"
|
languages/fv_tlc-sk_SK.po
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: FV-topl-level-categories\n"
|
4 |
-
"POT-Creation-Date: 2014-09-19 11:37+0100\n"
|
5 |
-
"PO-Revision-Date: 2014-09-19 11:49+0100\n"
|
6 |
-
"Last-Translator: \n"
|
7 |
-
"Language-Team: \n"
|
8 |
-
"Language: sk_SK\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.6.9\n"
|
13 |
-
"X-Poedit-Basepath: .\n"
|
14 |
-
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;_n\n"
|
16 |
-
"X-Poedit-SearchPath-0: ..\n"
|
17 |
-
|
18 |
-
#: ../top-level-cats.php:374
|
19 |
-
msgid "Adjust categories in your post URLs"
|
20 |
-
msgstr "Nastavenie kategórií v URL adresách postov"
|
21 |
-
|
22 |
-
#: ../top-level-cats.php:382
|
23 |
-
msgid "Only use top-level
|
24 |
-
msgstr "Použiť iba hlavné kategórie v adresách URL."
|
25 |
-
|
26 |
-
#: ../top-level-cats.php:390
|
27 |
-
msgid "Only allow following categories in URLs:"
|
28 |
-
msgstr "V URL adresách povoliť iba nasledujúce kategórie:"
|
29 |
-
|
30 |
-
#: ../top-level-cats.php:397
|
31 |
-
msgid "Save Changes"
|
32 |
-
msgstr "Uložiť zmeny"
|
33 |
-
|
34 |
-
#: ../top-level-cats.php:401
|
35 |
-
msgid ""
|
36 |
-
"Are you having any problems or questions? Use our <a target=\"_blank\" href="
|
37 |
-
"\"http://foliovision.com/support/fv-top-level-categories/\">support forums</"
|
38 |
-
"a>."
|
39 |
-
msgstr ""
|
40 |
-
"Máte nejaké problémy alebo otázky? Použite naše <a target=\"_blank\" href="
|
41 |
-
"\"http://foliovision.com/support/fv-top-level-categories/\">forúm podpory</"
|
42 |
-
"a>."
|
43 |
-
|
44 |
-
#: ../top-level-cats.php:406
|
45 |
-
msgid ""
|
46 |
-
"Since you are not using %category% in your post permalinks, there is nothing "
|
47 |
-
"to adjust."
|
48 |
-
msgstr ""
|
49 |
-
"Keďže vo svojích post permalinkoch nepoužívate %category% nie je tu nič čo "
|
50 |
-
"by ste mohli nastaviť."
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: FV-topl-level-categories\n"
|
4 |
+
"POT-Creation-Date: 2014-09-19 11:37+0100\n"
|
5 |
+
"PO-Revision-Date: 2014-09-19 11:49+0100\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"Language: sk_SK\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.6.9\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;_n\n"
|
16 |
+
"X-Poedit-SearchPath-0: ..\n"
|
17 |
+
|
18 |
+
#: ../top-level-cats.php:374
|
19 |
+
msgid "Adjust categories in your post URLs"
|
20 |
+
msgstr "Nastavenie kategórií v URL adresách postov"
|
21 |
+
|
22 |
+
#: ../top-level-cats.php:382
|
23 |
+
msgid "Only use top-level categories in URLs."
|
24 |
+
msgstr "Použiť iba hlavné kategórie v adresách URL."
|
25 |
+
|
26 |
+
#: ../top-level-cats.php:390
|
27 |
+
msgid "Only allow following categories in URLs:"
|
28 |
+
msgstr "V URL adresách povoliť iba nasledujúce kategórie:"
|
29 |
+
|
30 |
+
#: ../top-level-cats.php:397
|
31 |
+
msgid "Save Changes"
|
32 |
+
msgstr "Uložiť zmeny"
|
33 |
+
|
34 |
+
#: ../top-level-cats.php:401
|
35 |
+
msgid ""
|
36 |
+
"Are you having any problems or questions? Use our <a target=\"_blank\" href="
|
37 |
+
"\"http://foliovision.com/support/fv-top-level-categories/\">support forums</"
|
38 |
+
"a>."
|
39 |
+
msgstr ""
|
40 |
+
"Máte nejaké problémy alebo otázky? Použite naše <a target=\"_blank\" href="
|
41 |
+
"\"http://foliovision.com/support/fv-top-level-categories/\">forúm podpory</"
|
42 |
+
"a>."
|
43 |
+
|
44 |
+
#: ../top-level-cats.php:406
|
45 |
+
msgid ""
|
46 |
+
"Since you are not using %category% in your post permalinks, there is nothing "
|
47 |
+
"to adjust."
|
48 |
+
msgstr ""
|
49 |
+
"Keďže vo svojích post permalinkoch nepoužívate %category% nie je tu nič čo "
|
50 |
+
"by ste mohli nastaviť."
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: FolioVision
|
|
3 |
Donate link: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.2.1
|
6 |
-
Tested up to: 4.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
This is a fix of Top Level Categories plugin for Wordpress 3.1. and above.
|
@@ -45,6 +45,11 @@ Make sure your categories have unique slugs - watch out for pages with the same
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
|
|
|
|
48 |
= Version 1.6 - September 19th, 2014 =
|
49 |
* Adding support for translations ( Slovak language added )
|
50 |
|
3 |
Donate link: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.2.1
|
6 |
+
Tested up to: 4.2.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
This is a fix of Top Level Categories plugin for Wordpress 3.1. and above.
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= Version 1.7- May 12th, 2014 =
|
49 |
+
|
50 |
+
* Added Polish translation - thanks to maciejka45@gmail.com
|
51 |
+
* Added Portuguese translation - thanks to Pedro Mendonça
|
52 |
+
|
53 |
= Version 1.6 - September 19th, 2014 =
|
54 |
* Adding support for translations ( Slovak language added )
|
55 |
|
top-level-cats.php
CHANGED
@@ -1,422 +1,434 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: FV Top Level Categories
|
4 |
-
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
-
Description: Removes the prefix from the URL for a category. For instance, if your old category link was <code>/category/catname</code> it will now be <code>/catname</code>
|
6 |
-
Version: 1.
|
7 |
-
Author: Foliovision
|
8 |
-
Author URI: http://foliovision.com/
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
add_action('
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
$category_rewrite['('.$category_nicename.')/?$'] = 'index.php?category_name=$matches[1]';
|
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 |
-
wp_redirect( $real_permalink, 301 );
|
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 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
$
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
var $
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
return
|
280 |
-
}
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
return
|
292 |
-
}
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
return
|
312 |
-
}
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
return
|
324 |
-
}
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
$options
|
340 |
-
|
341 |
-
$options['category-allow
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
<
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
<?php
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: FV Top Level Categories
|
4 |
+
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
+
Description: Removes the prefix from the URL for a category. For instance, if your old category link was <code>/category/catname</code> it will now be <code>/catname</code>
|
6 |
+
Version: 1.7
|
7 |
+
Author: Foliovision
|
8 |
+
Author URI: http://foliovision.com/
|
9 |
+
Text Domain: fv_tlc
|
10 |
+
Domain Path: /languages/
|
11 |
+
*/
|
12 |
+
|
13 |
+
register_activation_hook(__FILE__,'fv_top_level_categories_refresh_rules');
|
14 |
+
|
15 |
+
add_action('created_category','fv_top_level_categories_refresh_rules');
|
16 |
+
add_action('edited_category','fv_top_level_categories_refresh_rules');
|
17 |
+
add_action('delete_category','fv_top_level_categories_refresh_rules');
|
18 |
+
|
19 |
+
function fv_top_level_categories_refresh_rules() {
|
20 |
+
add_option('fv_top_level_categories_rewrite_rules_flush', 'true');
|
21 |
+
}
|
22 |
+
register_deactivation_hook(__FILE__,'fv_top_level_categories_deactivate');
|
23 |
+
|
24 |
+
function fv_top_level_categories_deactivate() {
|
25 |
+
remove_filter('category_rewrite_rules', 'fv_top_level_categories_refresh_rules'); // We don't want to insert our custom rules again
|
26 |
+
delete_option('fv_top_level_categories_rewrite_rules_flush');
|
27 |
+
}
|
28 |
+
|
29 |
+
// Remove category base
|
30 |
+
add_action('init', 'fv_top_level_categories_permastruct');
|
31 |
+
function fv_top_level_categories_permastruct() {
|
32 |
+
global $wp_rewrite;
|
33 |
+
$wp_rewrite->extra_permastructs['category'][0] = '%category%';
|
34 |
+
|
35 |
+
if (get_option('fv_top_level_categories_rewrite_rules_flush') == 'true') {
|
36 |
+
flush_rewrite_rules();
|
37 |
+
delete_option('fv_top_level_categories_rewrite_rules_flush');
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
// Add our custom category rewrite rules
|
42 |
+
add_filter('category_rewrite_rules', 'fv_top_level_categories_rewrite_rules');
|
43 |
+
function fv_top_level_categories_rewrite_rules($category_rewrite) {
|
44 |
+
//var_dump($category_rewrite); // For Debugging
|
45 |
+
|
46 |
+
/// First we need to get full URLs of our pages
|
47 |
+
$pages = get_pages( 'number=0' );
|
48 |
+
$pages_urls = array();
|
49 |
+
foreach( $pages AS $pages_item ) {
|
50 |
+
$pages_urls[] = trim( str_replace( get_bloginfo( 'url' ), '', get_permalink( $pages_item->ID ) ), '/' );
|
51 |
+
}
|
52 |
+
///
|
53 |
+
|
54 |
+
$category_rewrite=array();
|
55 |
+
$categories=get_categories(array('hide_empty'=>false));
|
56 |
+
foreach($categories as $category) {
|
57 |
+
$category_nicename = $category->slug;
|
58 |
+
if ( $category->parent == $category->cat_ID ) // recursive recursion
|
59 |
+
$category->parent = 0;
|
60 |
+
elseif ($category->parent != 0 )
|
61 |
+
$category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
|
62 |
+
|
63 |
+
/// Let's check if any of the category full URLs matches any of the pages
|
64 |
+
if( in_array( $category_nicename, $pages_urls ) ) {
|
65 |
+
continue;
|
66 |
+
}
|
67 |
+
///
|
68 |
+
|
69 |
+
|
70 |
+
$category_rewrite['('.$category_nicename.')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
|
71 |
+
$category_rewrite['('.$category_nicename.')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
|
72 |
+
$category_rewrite['('.$category_nicename.')/?$'] = 'index.php?category_name=$matches[1]';
|
73 |
+
}
|
74 |
+
// Redirect support from Old Category Base
|
75 |
+
global $wp_rewrite;
|
76 |
+
$old_category_base = get_option('category_base') ? get_option('category_base') : 'category';
|
77 |
+
$old_category_base = trim($old_category_base, '/');
|
78 |
+
$category_rewrite[$old_category_base.'/(.*)$'] = 'index.php?category_redirect=$matches[1]';
|
79 |
+
|
80 |
+
//var_dump($category_rewrite); // For Debugging
|
81 |
+
return $category_rewrite;
|
82 |
+
}
|
83 |
+
|
84 |
+
//Redirect to TL parent categ, if "Only use top-level categories in URLs." is on
|
85 |
+
add_filter('template_redirect', 'fv_top_level_categories_tlc_redirect', 999, 2);
|
86 |
+
function fv_top_level_categories_tlc_redirect( $link ) {
|
87 |
+
if( FV_Top_Level_Cats::is_top_level_only() && is_single() ) {
|
88 |
+
global $wp_query;
|
89 |
+
$requested_url = is_ssl() ? 'https://' : 'http://';
|
90 |
+
$requested_url .= $_SERVER['HTTP_HOST'];
|
91 |
+
$requested_url .= $_SERVER['REQUEST_URI'];
|
92 |
+
|
93 |
+
$real_permalink = get_permalink($wp_query->queried_object_id);
|
94 |
+
|
95 |
+
if( FALSE === stripos($requested_url, $real_permalink) ) {
|
96 |
+
|
97 |
+
$bMached = preg_match('~/([^/:]+/?)$~',$real_permalink, $end_of_permalink);
|
98 |
+
if( $bMached && preg_match('~'.$end_of_permalink[1].'(.+)$~', $requested_url, $end_of_url) )
|
99 |
+
wp_redirect( $real_permalink . $end_of_url[1], 301 );
|
100 |
+
else
|
101 |
+
wp_redirect( $real_permalink, 301 );
|
102 |
+
die();
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return $link;
|
107 |
+
}
|
108 |
+
|
109 |
+
// Add 'category_redirect' query variable
|
110 |
+
add_filter('query_vars', 'fv_top_level_categories_query_vars');
|
111 |
+
function fv_top_level_categories_query_vars($public_query_vars) {
|
112 |
+
$public_query_vars[] = 'category_redirect';
|
113 |
+
return $public_query_vars;
|
114 |
+
}
|
115 |
+
|
116 |
+
// Redirect if 'category_redirect' is set
|
117 |
+
add_filter('request', 'fv_top_level_categories_request');
|
118 |
+
function fv_top_level_categories_request($query_vars) {
|
119 |
+
//print_r($query_vars); // For Debugging
|
120 |
+
if(isset($query_vars['category_redirect'])) {
|
121 |
+
$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' );
|
122 |
+
status_header(301);
|
123 |
+
header("Location: $catlink");
|
124 |
+
exit();
|
125 |
+
}
|
126 |
+
return $query_vars;
|
127 |
+
}
|
128 |
+
|
129 |
+
add_filter('category_link', 'top_level_cats_remove_cat_base');
|
130 |
+
function top_level_cats_remove_cat_base($link) {
|
131 |
+
$category_base = get_option('category_base');
|
132 |
+
|
133 |
+
// WP uses "category/" as the default
|
134 |
+
if ($category_base == '')
|
135 |
+
$category_base = 'category';
|
136 |
+
|
137 |
+
// Remove initial slash, if there is one (we remove the trailing slash in the regex replacement and don't want to end up short a slash)
|
138 |
+
if (substr($category_base, 0, 1) == '/')
|
139 |
+
$category_base = substr($category_base, 1);
|
140 |
+
|
141 |
+
$category_base .= '/';
|
142 |
+
|
143 |
+
return preg_replace('|' . $category_base . '|', '', $link, 1);
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
|
149 |
+
function fv_top_level_cats_post_link_category_top_level_only( $cat ) {
|
150 |
+
if( !FV_Top_Level_Cats::is_category_permalinks() ) {
|
151 |
+
return $cat;
|
152 |
+
}
|
153 |
+
|
154 |
+
while( FV_Top_Level_Cats::is_top_level_only() && $cat->parent != 0 ) {
|
155 |
+
$cat = get_term_by( 'id', $cat->parent, 'category' );
|
156 |
+
}
|
157 |
+
|
158 |
+
return $cat;
|
159 |
+
}
|
160 |
+
add_filter( 'post_link_category', 'fv_top_level_cats_post_link_category_top_level_only', 201, 3 );
|
161 |
+
|
162 |
+
|
163 |
+
|
164 |
+
|
165 |
+
function fv_top_level_cats_post_link_category_restrict( $cat ) {
|
166 |
+
if( !FV_Top_Level_Cats::is_category_permalinks() || !FV_Top_Level_Cats::is_category_restriction() ) {
|
167 |
+
return $cat;
|
168 |
+
}
|
169 |
+
|
170 |
+
$aArgs = func_get_args();
|
171 |
+
|
172 |
+
$aAllowedCats = FV_Top_Level_Cats::get_allowed_cats();
|
173 |
+
if( !count($aAllowedCats) ) {
|
174 |
+
return $cat;
|
175 |
+
}
|
176 |
+
|
177 |
+
// check if the main category is allowed
|
178 |
+
if( in_array( $cat->term_id, $aAllowedCats ) ) {
|
179 |
+
return $cat;
|
180 |
+
}
|
181 |
+
|
182 |
+
// check if any of the other categories is allowed!
|
183 |
+
$isOk = false;
|
184 |
+
foreach( $aArgs[1] AS $objCat ) {
|
185 |
+
if( in_array( $objCat->term_id, $aAllowedCats ) ) {
|
186 |
+
$isOk = true;
|
187 |
+
$cat = $objCat;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
// check if any of the parent categories is allowed
|
192 |
+
if( !$isOk ) {
|
193 |
+
foreach( $aArgs[1] AS $objCat ) {
|
194 |
+
while( $objCat->parent != 0 ) {
|
195 |
+
$objCat = get_term_by( 'id', $objCat->parent, 'category' );
|
196 |
+
}
|
197 |
+
if( in_array( $objCat->term_id, $aAllowedCats ) ) {
|
198 |
+
$isOk = true;
|
199 |
+
$cat = $objCat;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
return $cat;
|
205 |
+
}
|
206 |
+
add_filter( 'post_link_category', 'fv_top_level_cats_post_link_category_restrict', 200, 3 );
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
function fv_top_level_category_filter( $aCategories ) {
|
212 |
+
if( class_exists('FV_Top_Level_Cats') && method_exists('FV_Top_Level_Cats','get_allowed_cats') ) {
|
213 |
+
|
214 |
+
$aAllowedCats = FV_Top_Level_Cats::get_allowed_cats();
|
215 |
+
if( !count($aAllowedCats) ) {
|
216 |
+
return $aCategories;
|
217 |
+
}
|
218 |
+
|
219 |
+
// check if the main category is allowed
|
220 |
+
foreach( $aCategories AS $objCat ) {
|
221 |
+
if( in_array( $objCat->term_id, $aAllowedCats ) ) {
|
222 |
+
return array($objCat);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
foreach( $aCategories AS $objCat ) {
|
227 |
+
while( $objCat->parent != 0 ) {
|
228 |
+
$objCat = get_term_by( 'id', $objCat->parent, 'category' );
|
229 |
+
}
|
230 |
+
if( in_array( $objCat->term_id, $aAllowedCats ) ) {
|
231 |
+
return array($objCat);
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
return $aCategories;
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
|
242 |
+
function fv_top_level_category( $separator = '', $parents = '', $post_id = false ) {
|
243 |
+
add_filter( 'get_the_categories', 'fv_top_level_category_filter' );
|
244 |
+
the_category( $separator, $parents, $post_id );
|
245 |
+
remove_filter( 'get_the_categories', 'fv_top_level_category_filter' );
|
246 |
+
}
|
247 |
+
add_action( 'fv_top_level_category', 'fv_top_level_category', 10, 3 );
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
|
252 |
+
class FV_Top_Level_Cats {
|
253 |
+
|
254 |
+
var $enabled;
|
255 |
+
var $default_form_code;
|
256 |
+
var $default_form_css;
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
public function __construct() {
|
262 |
+
add_action( 'admin_menu', array($this, 'admin_menu') );
|
263 |
+
add_action('init',array($this,'load_languages'));
|
264 |
+
}
|
265 |
+
|
266 |
+
|
267 |
+
|
268 |
+
|
269 |
+
function admin_menu() {
|
270 |
+
add_options_page( __('FV Top Level Categories','fv_tlc'), __('FV Top Level Categories','fv_tlc'), 'manage_options', 'fv_top_level_cats', array($this, 'options_panel') );
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
public static function get_allowed_cats() {
|
277 |
+
$options = get_option( 'fv_top_level_cats' );
|
278 |
+
if( isset($options['category-allow']) ) {
|
279 |
+
return $options['category-allow'];
|
280 |
+
} else {
|
281 |
+
return false;
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
public static function is_category_permalinks() {
|
289 |
+
$sPermalinks = get_option( 'permalink_structure' );
|
290 |
+
if( stripos($sPermalinks, '%category%/') !== false ) {
|
291 |
+
return true;
|
292 |
+
} else {
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
function load_languages(){
|
301 |
+
// Localization
|
302 |
+
load_plugin_textdomain('fv_tlc', false, dirname(plugin_basename(__FILE__)) . "/languages");
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
|
307 |
+
|
308 |
+
public static function is_top_level_only() {
|
309 |
+
$options = get_option( 'fv_top_level_cats' );
|
310 |
+
if( isset($options['top-level-only']) && $options['top-level-only'] ) {
|
311 |
+
return true;
|
312 |
+
} else {
|
313 |
+
return false;
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
|
319 |
+
|
320 |
+
public static function is_category_restriction() {
|
321 |
+
$options = get_option( 'fv_top_level_cats' );
|
322 |
+
if( isset($options['category-allow-enabled']) && $options['category-allow-enabled'] ) {
|
323 |
+
return true;
|
324 |
+
} else {
|
325 |
+
return false;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
|
331 |
+
|
332 |
+
function options_panel() {
|
333 |
+
|
334 |
+
if (!empty($_POST)) :
|
335 |
+
|
336 |
+
check_admin_referer('fv_top_level_cats');
|
337 |
+
|
338 |
+
if( isset($_POST['fv_top_level_cats_submit'] ) ) :
|
339 |
+
$options = get_option( 'fv_top_level_cats', array() );
|
340 |
+
|
341 |
+
$options['category-allow'] = $_POST['post_category'];
|
342 |
+
$options['top-level-only'] = ( $_POST['top-level-only'] ) ? true : false;
|
343 |
+
$options['category-allow-enabled'] = ( $_POST['category-allow-enabled'] ) ? true : false;
|
344 |
+
|
345 |
+
update_option( 'fv_top_level_cats', $options );
|
346 |
+
?>
|
347 |
+
<div id="message" class="updated fade">
|
348 |
+
<p>
|
349 |
+
<strong>
|
350 |
+
Settings saved
|
351 |
+
</strong>
|
352 |
+
</p>
|
353 |
+
</div>
|
354 |
+
<?php
|
355 |
+
endif; // fv_top_level_cats_submit
|
356 |
+
|
357 |
+
endif;
|
358 |
+
|
359 |
+
$options = get_option( 'fv_top_level_cats' );
|
360 |
+
?>
|
361 |
+
|
362 |
+
<div class="wrap">
|
363 |
+
<div style="position: absolute; right: 20px; margin-top: 5px">
|
364 |
+
<a href="http://foliovision.com/wordpress/plugins/fv-top-level-categories" target="_blank" title="Documentation"><img alt="visit foliovision" src="http://foliovision.com/shared/fv-logo.png" /></a>
|
365 |
+
</div>
|
366 |
+
<div>
|
367 |
+
<div id="icon-options-general" class="icon32"><br /></div>
|
368 |
+
<h2><?php _e('FV Top Level Categories','fv_tlc'); ?></h2>
|
369 |
+
</div>
|
370 |
+
|
371 |
+
<?php if( $this->is_category_permalinks() ) : ?>
|
372 |
+
<style>
|
373 |
+
#category-allow ul.children { margin-left: 20px; }
|
374 |
+
</style>
|
375 |
+
<form method="post" action="">
|
376 |
+
<?php wp_nonce_field('fv_top_level_cats') ?>
|
377 |
+
<div id="poststuff" class="ui-sortable">
|
378 |
+
<div class="postbox">
|
379 |
+
<h3>
|
380 |
+
<?php _e('Adjust categories in your post URLs','fv_tlc') ?>
|
381 |
+
</h3>
|
382 |
+
<div class="inside">
|
383 |
+
<table class="form-table">
|
384 |
+
<tr>
|
385 |
+
<td>
|
386 |
+
<label for="top-level-only">
|
387 |
+
<input type="checkbox" name="top-level-only" id="top-level-only" value="1" <?php if( $options['top-level-only'] ) echo 'checked="checked"'; ?> />
|
388 |
+
<?php _e('Only use top-level categories in URLs.','fv_tlc') ; ?>
|
389 |
+
</label>
|
390 |
+
</td>
|
391 |
+
</tr>
|
392 |
+
<tr>
|
393 |
+
<td>
|
394 |
+
<label for="category-allow-enabled">
|
395 |
+
<input type="checkbox" name="category-allow-enabled" id="category-allow-enabled" value="1" <?php if( $options['category-allow-enabled'] ) echo 'checked="checked"'; ?> />
|
396 |
+
<?php _e('Only allow following categories in URLs:','fv_tlc' );?>
|
397 |
+
</label>
|
398 |
+
<blockquote><ul id="category-allow"><?php wp_category_checklist( 0, 0, $options['category-allow'], false, null, false ); ?></ul></blockquote>
|
399 |
+
</td>
|
400 |
+
</tr>
|
401 |
+
</table>
|
402 |
+
<p>
|
403 |
+
<input type="submit" name="fv_top_level_cats_submit" class="button-primary" value="<?php _e('Save Changes','fv_tlc'); ?>" />
|
404 |
+
</p>
|
405 |
+
</div>
|
406 |
+
</div>
|
407 |
+
<p><?php _e('Are you having any problems or questions? Use our <a target="_blank" href="http://foliovision.com/support/fv-top-level-categories/">support forums</a>.','fv_tlc'); ?></p>
|
408 |
+
</div>
|
409 |
+
|
410 |
+
</form>
|
411 |
+
<?php else : ?>
|
412 |
+
<p><?php _e('Since you are not using %category% in your post permalinks, there is nothing to adjust.','fv_tlc'); ?></p>
|
413 |
+
<?php endif; ?>
|
414 |
+
|
415 |
+
</div>
|
416 |
+
|
417 |
+
|
418 |
+
<?php
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
$FV_Top_Level_Cats = new FV_Top_Level_Cats;
|
425 |
+
|
426 |
+
// Add settings link on plugin page
|
427 |
+
function fv_top_level_categories_settings_link($links) {
|
428 |
+
$settings_link = '<a href="options-general.php?page=fv_top_level_cats.php">' . __('Settings','fv_tlc') . '</a>';
|
429 |
+
array_unshift($links, $settings_link);
|
430 |
+
return $links;
|
431 |
+
}
|
432 |
+
|
433 |
+
$plugin = plugin_basename(__FILE__);
|
434 |
+
add_filter("plugin_action_links_$plugin", 'fv_top_level_categories_settings_link' );
|