Version Description
- First public version.
Download this release
Release Info
Developer | mbis |
Plugin | Permalink Manager Lite |
Version | 0.2 |
Comparing to | |
See all releases |
Version 0.2
- LICENSE.txt +339 -0
- README.md +2 -0
- README.txt +85 -0
- css/permalink-manager-admin.css +23 -0
- inc/permalink-manager-helper-functions.php +103 -0
- inc/permalink-manager-screen-options.php +46 -0
- inc/permalink-manager-wp-table.php +184 -0
- js/permalink-manager-admin.js +35 -0
- languages/permalink-manager.pot +216 -0
- permalink-manager.php +483 -0
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
# Permalink-Manager
|
2 |
+
A simple tool that helps managing the slugs for Posts, Pages and Custom Post Types.
|
README.txt
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Permalink Manager ===
|
2 |
+
Contributors: mbis
|
3 |
+
Tags: urls, permalinks, slugs
|
4 |
+
Requires at least: 4.0
|
5 |
+
Tested up to: 4.4
|
6 |
+
Stable tag: 0.2
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Permalink Manager allows you to control and reset the permalinks (slugs) in all your post types.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
It is a really simple plugin that helps managing the permalinks that are used for all your Posts, Pages and other Custom Post Types. To improve the experience of the manager, you can filter the table and display only selected `post type`s or posts/pages/custom post type items with particular `post status`es.
|
15 |
+
|
16 |
+
There are three main functionalities of this plugin:
|
17 |
+
1. You can manually adjust the slugs of selected posts/pages/custom post type items.
|
18 |
+
2. You can replace particular (sub)string that is a part of slug with another (sub)string.
|
19 |
+
3. You can regenerate/reset the slugs for your posts/pages/custom post types. This might be especially useful if your post titles are updated and slugs needs to be recreated.
|
20 |
+
|
21 |
+
= Example =
|
22 |
+
|
23 |
+
If you want to quickly replace a part of slug (eg. `krakow` with another word `gdansk`):
|
24 |
+
`http://example.com/hotels-in-krakow
|
25 |
+
http://example.com/restaurants-in-krakow
|
26 |
+
http://example.com/transport-in-krakow
|
27 |
+
http://example.com/blog/krakow-the-best-city-for-tourists
|
28 |
+
http://example.com/poland/cities/krakow
|
29 |
+
http://example.com/poland/cities/stalowa-wola
|
30 |
+
http://example.com/poland/cities/warszawa
|
31 |
+
http://example.com/poland/cities/poznan`
|
32 |
+
|
33 |
+
If you use the form from `Find and replace` section your URLs will be changed to:
|
34 |
+
|
35 |
+
`http://example.com/hotels-in-gdansk
|
36 |
+
http://example.com/restaurants-in-gdansk
|
37 |
+
http://example.com/transport-in-gdansk
|
38 |
+
http://example.com/blog/gdansk-the-best-city-for-tourists
|
39 |
+
http://example.com/poland/cities/gdansk
|
40 |
+
http://example.com/poland/cities/stalowa-wola
|
41 |
+
http://example.com/poland/cities/warszawa
|
42 |
+
http://example.com/poland/cities/poznan`
|
43 |
+
|
44 |
+
= Upcoming features =
|
45 |
+
|
46 |
+
In the next version of plugin more functionalities will be added:
|
47 |
+
|
48 |
+
* Support for taxonomies
|
49 |
+
* REGEX for `Find and replace` section
|
50 |
+
* Two-step updater, so you can double-check which permalinks will be changed before the change is applied
|
51 |
+
* AJAX support.
|
52 |
+
|
53 |
+
== Installation ==
|
54 |
+
|
55 |
+
Go to `Plugins -> Add New` section from your admin account and search for `Permalink Manager`.
|
56 |
+
|
57 |
+
You can also install this plugin manually:
|
58 |
+
|
59 |
+
1. Download the plugin's ZIP archive and unzip it.
|
60 |
+
2. Copy the unzipped `permalink-manager` folder to the `/wp-content/plugins/` directory.
|
61 |
+
3. Activate the plugin through the 'Plugins' menu in WordPress
|
62 |
+
|
63 |
+
After the plugin is installed you can access its dashboard from this page: `Tools -> Permalink Manager`.
|
64 |
+
|
65 |
+
== Screenshots ==
|
66 |
+
|
67 |
+
1. Main dashboard.
|
68 |
+
2. Find and replace section.
|
69 |
+
3. Regenerate section.
|
70 |
+
|
71 |
+
== Changelog ==
|
72 |
+
|
73 |
+
= 0.2 =
|
74 |
+
* First public version.
|
75 |
+
|
76 |
+
= 0.1 =
|
77 |
+
* A first initial version.
|
78 |
+
|
79 |
+
== Upgrade Notice ==
|
80 |
+
|
81 |
+
= 0.1 =
|
82 |
+
Few bugs & strict standard errors are fixed.
|
83 |
+
|
84 |
+
= 0.1 =
|
85 |
+
A first initial version.
|
css/permalink-manager-admin.css
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Permalink Manager Table CSS
|
3 |
+
*/
|
4 |
+
#permalinks-table-wrap { }
|
5 |
+
|
6 |
+
#permalinks-table-wrap #plugin-name-heading a { color: #959595; font-size: 60%; text-decoration: none; }
|
7 |
+
|
8 |
+
#permalinks-table-wrap .tablenav { margin: 6px 0 15px; }
|
9 |
+
#permalinks-table-wrap .column-post_type { width: 10%; }
|
10 |
+
#permalinks-table-wrap .column-post_permalink { width: 50%; }
|
11 |
+
#permalinks-table-wrap .post_name input { max-width: 100%; }
|
12 |
+
#permalinks-table-wrap .post_permalink a, #permalinks-table-wrap .post_permalink .dashicons { font-size: 13px; color: #aaa; line-height: 1.5em; }
|
13 |
+
|
14 |
+
#permalinks-table-wrap .alert { line-height: 19px; padding: 11px 15px; margin: 15px 0; }
|
15 |
+
#permalinks-table-wrap .alert p { margin-top: 0; }
|
16 |
+
#permalinks-table-wrap .alert p:last-of-type { margin-bottom: 0; }
|
17 |
+
#permalinks-table-wrap .warning { background: #dc3232; color: #fff; }
|
18 |
+
#permalinks-table-wrap .info { background: #f9f9f9; }
|
19 |
+
|
20 |
+
#permalinks-table-wrap #permalink-manager-tabs > div { display: none; }
|
21 |
+
#permalinks-table-wrap #permalink-manager-tabs > div.show { display: block; }
|
22 |
+
|
23 |
+
#permalinks-table-wrap #permalink-manager-tabs td label { display: block; }
|
inc/permalink-manager-helper-functions.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Additional functions used in classes and another subclasses
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Permalink_Manager_Helper_Functions extends Permalink_Manager_Class {
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
parent::construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Display error/info message
|
15 |
+
*/
|
16 |
+
static function display_alert($content, $type) {
|
17 |
+
return sprintf( "<div class='{$type} is-dismissible notice'><p> %s </p></div>", $content );
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Display the permalink in a better way
|
22 |
+
*/
|
23 |
+
static function get_correct_permalink($id, $correct_slug, $highlight = false) {
|
24 |
+
$output = get_permalink($id);
|
25 |
+
|
26 |
+
// Get last part of URI
|
27 |
+
$old_slug = end((explode('/', get_page_uri($id))));
|
28 |
+
$correct_slug = ($highlight) ? "<code>{$correct_slug}</code>" : $correct_slug;
|
29 |
+
$output = Permalink_Manager_Helper_Functions::str_lreplace($old_slug, $correct_slug, $output);
|
30 |
+
|
31 |
+
return $output;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get post_types array
|
36 |
+
*/
|
37 |
+
static function get_post_types_array() {
|
38 |
+
$post_types = get_post_types( array('public' => true), 'objects' );
|
39 |
+
|
40 |
+
$post_types_array = array();
|
41 |
+
foreach ( $post_types as $post_type ) {
|
42 |
+
$post_types_array[$post_type->name] = $post_type->labels->name;
|
43 |
+
}
|
44 |
+
|
45 |
+
return $post_types_array;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Replace last occurence
|
50 |
+
*/
|
51 |
+
static function str_lreplace($search, $replace, $subject) {
|
52 |
+
$pos = strrpos($subject, $search);
|
53 |
+
return ($pos !== false) ? substr_replace($subject, $replace, $pos, strlen($search)) : $subject;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Generate the fields
|
58 |
+
*/
|
59 |
+
static public function generate_option_field($name, $args, $group) {
|
60 |
+
|
61 |
+
// Load values from options if needed
|
62 |
+
//$saved_values = (in_array($group, array('screen-options', 'find-replace'))) ? get_option('permalink-manager') : '';
|
63 |
+
$saved_values = get_option('permalink-manager');
|
64 |
+
|
65 |
+
// Reset $fields variable
|
66 |
+
$fields = '';
|
67 |
+
|
68 |
+
// Load default value
|
69 |
+
$default_value = (isset($args['default'])) ? $args['default'] : '';
|
70 |
+
|
71 |
+
switch($args['type']) {
|
72 |
+
case 'checkbox' :
|
73 |
+
$fields .= '<div class="checkboxes">';
|
74 |
+
foreach($args['choices'] as $value => $label) {
|
75 |
+
$all_checked = (isset($saved_values[$name])) ? $saved_values[$name] : $args['default'];
|
76 |
+
$checked = in_array($value, $all_checked) ? "checked='checked'" : "";
|
77 |
+
$fields .= "<label for='permalink-manager[{$group}][{$name}][]'><input type='checkbox' value='{$value}' name='permalink-manager[{$group}][{$name}][]' {$checked} /> {$label}</label>";
|
78 |
+
}
|
79 |
+
$fields .= '</div>';
|
80 |
+
break;
|
81 |
+
case 'number' :
|
82 |
+
$value = (isset($saved_values[$name])) ? $saved_values[$name] : $default_value;
|
83 |
+
$fields .= "<input type='number' value='{$value}' name='permalink-manager[{$group}][{$name}]' />";
|
84 |
+
break;
|
85 |
+
default :
|
86 |
+
$value = (isset($saved_values[$name])) ? $saved_values[$name] : $default_value;
|
87 |
+
$fields .= "<input type='text' value='{$value}' name='permalink-manager[{$group}][{$name}]' />";
|
88 |
+
}
|
89 |
+
|
90 |
+
// Get all variables into one final variable
|
91 |
+
if(isset($group) && !($group === 'screen-options')) {
|
92 |
+
$output = "<legend>{$args['label']}</legend>";
|
93 |
+
$output .= "<div class='metabox-prefs'><div class='{$name}-container'>{$fields}</div></div>";
|
94 |
+
} else {
|
95 |
+
$output = "<tr><th><label for='permalink-manager[{$name}]'>{$args['label']}</label></th>";
|
96 |
+
$output .= "<td>{$fields}</td>";
|
97 |
+
}
|
98 |
+
|
99 |
+
return $output;
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
inc/permalink-manager-screen-options.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Additional Screen Options that helps to manage the permalinks in the table
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Permalink_Manager_Screen_Options extends Permalink_Manager_Class {
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
|
11 |
+
$admin_page = PERMALINK_MANAGER_MENU_PAGE;
|
12 |
+
add_action( "load-{$admin_page}", array($this, "save_screen_options") );
|
13 |
+
add_filter( "screen_settings", array($this, "add_screen_options") );
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Add scren options
|
19 |
+
*/
|
20 |
+
public function add_screen_options() {
|
21 |
+
|
22 |
+
$button = get_submit_button( __( 'Apply', 'permalink-manager' ), 'primary', 'screen-options-apply', false );
|
23 |
+
$return = "<fieldset>";
|
24 |
+
|
25 |
+
foreach(parent::fields_arrays('screen_options') as $field_name => $field_args) {
|
26 |
+
|
27 |
+
$return .= Permalink_Manager_Helper_Functions::generate_option_field($field_name, $field_args, 'screen-options');
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
$return .= "</fieldset><br class='clear'>{$button}";
|
32 |
+
|
33 |
+
return $return;
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Save fields
|
39 |
+
*/
|
40 |
+
public function save_screen_options() {
|
41 |
+
|
42 |
+
if(isset($_POST['screen-options-apply'])) update_option('permalink-manager', $_POST['permalink-manager']['screen-options']);
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
inc/permalink-manager-wp-table.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if( ! class_exists( 'WP_List_Table' ) ) {
|
3 |
+
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Create a new table class that will extend the WP_List_Table
|
8 |
+
*/
|
9 |
+
class Permalink_Manager_Table extends WP_List_Table {
|
10 |
+
|
11 |
+
public $screen_options_fields;
|
12 |
+
|
13 |
+
function __construct() {
|
14 |
+
global $status, $page;
|
15 |
+
|
16 |
+
parent::__construct(array(
|
17 |
+
'singular' => 'slug',
|
18 |
+
'plural' => 'slugs',
|
19 |
+
'ajax' => true
|
20 |
+
));
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Override the parent columns method. Defines the columns to use in your listing table
|
26 |
+
*/
|
27 |
+
public function get_columns() {
|
28 |
+
$columns = array(
|
29 |
+
//'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
30 |
+
'post_title' => __('Title', 'permalink-manager'),
|
31 |
+
'post_name' => __('Slug', 'permalink-manager'),
|
32 |
+
'post_date_gmt' => __('Date', 'permalink-manager'),
|
33 |
+
'post_permalink' => __('Permalink', 'permalink-manager'),
|
34 |
+
'post_status' => __('Post Status', 'permalink-manager'),
|
35 |
+
'post_type' => __('Post Type', 'permalink-manager')
|
36 |
+
);
|
37 |
+
|
38 |
+
return $columns;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Hidden columns
|
43 |
+
*/
|
44 |
+
public function get_hidden_columns() {
|
45 |
+
return array('post_date_gmt');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Sortable columns
|
50 |
+
*/
|
51 |
+
public function get_sortable_columns() {
|
52 |
+
return array(
|
53 |
+
'post_title' => array('post_title', false),
|
54 |
+
'post_name' => array('post_name', false),
|
55 |
+
'post_status' => array('post_status', false),
|
56 |
+
'post_type' => array('post_type', false),
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Data inside the columns
|
62 |
+
*/
|
63 |
+
public function column_default( $item, $column_name ) {
|
64 |
+
switch( $column_name ) {
|
65 |
+
case 'post_type':
|
66 |
+
$post_type_obj = get_post_type_object( $item[ 'post_type' ] );
|
67 |
+
return "{$post_type_obj->labels->singular_name}<br /><small>({$item[ $column_name ]})</small>";
|
68 |
+
|
69 |
+
case 'post_status':
|
70 |
+
$post_statuses_array = get_post_statuses();
|
71 |
+
return "{$post_statuses_array[$item[ $column_name ]]}<br /><small>({$item[ $column_name ]})</small>";
|
72 |
+
|
73 |
+
case 'post_permalink':
|
74 |
+
return Permalink_Manager_Helper_Functions::get_correct_permalink($item[ 'ID' ], $item[ 'post_name' ], true) . ' <a href="' . Permalink_Manager_Helper_Functions::get_correct_permalink($item[ 'ID' ], $item[ 'post_name' ]) . '" target="_blank"><span class="dashicons dashicons-admin-links"></span></a>';
|
75 |
+
|
76 |
+
case 'post_name':
|
77 |
+
return '<input type="text" name="slug[' . $item[ 'ID' ] . ']" id="slug[' . $item[ 'ID' ] . ']" value="' . $item[ 'post_name' ] . '">';
|
78 |
+
|
79 |
+
case 'post_title':
|
80 |
+
$edit_post = $item[ 'post_title' ] . '<div class="row-actions">';
|
81 |
+
$edit_post .= '<span class="edit"><a target="_blank" href="http://maciejbis.net/wp-admin/post.php?post=' . $item[ 'ID' ] . '&action=edit" title="' . __('Edit', 'permalink-manager') . '">' . __('Edit', 'permalink-manager') . '</a> | </span>';
|
82 |
+
$edit_post .= '<span class="view"><a target="_blank" href="' . Permalink_Manager_Helper_Functions::get_correct_permalink($item[ 'ID' ], $item[ 'post_name' ]) . '" title="' . __('View', 'permalink-manager') . ' ' . $item[ 'post_title' ] . '" rel="permalink">' . __('View', 'permalink-manager') . '</a> | </span>';
|
83 |
+
$edit_post .= '<span class="id">#' . $item[ 'ID' ] . '</span>';
|
84 |
+
$edit_post .= '</div>';
|
85 |
+
return $edit_post;
|
86 |
+
|
87 |
+
default:
|
88 |
+
return $item[ $column_name ];
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Sort the data
|
94 |
+
*/
|
95 |
+
private function sort_data( $a, $b ) {
|
96 |
+
// Set defaults
|
97 |
+
$orderby = 'post_title';
|
98 |
+
$order = 'asc';
|
99 |
+
|
100 |
+
// If orderby is set, use this as the sort column
|
101 |
+
if(!empty($_GET['orderby'])) {
|
102 |
+
$orderby = $_GET['orderby'];
|
103 |
+
}
|
104 |
+
|
105 |
+
// If order is set use this as the order
|
106 |
+
if(!empty($_GET['order'])) {
|
107 |
+
$order = $_GET['order'];
|
108 |
+
}
|
109 |
+
|
110 |
+
$result = strnatcasecmp( $a[$orderby], $b[$orderby] );
|
111 |
+
|
112 |
+
if($order === 'asc') {
|
113 |
+
return $result;
|
114 |
+
}
|
115 |
+
|
116 |
+
return -$result;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* The button that allows to save updated slugs
|
121 |
+
*/
|
122 |
+
function extra_tablenav( $which ) {
|
123 |
+
|
124 |
+
$button_top = __( 'Update all slugs below', 'permalink-manager' );
|
125 |
+
$button_bottom = __( 'Update all slugs above', 'permalink-manager' );
|
126 |
+
|
127 |
+
echo '<div class="alignleft actions">';
|
128 |
+
submit_button( ${"button_$which"}, 'primary', "update_all_slugs[{$which}]", false, array( 'id' => 'doaction', 'value' => 'update_all_slugs' ) );
|
129 |
+
echo '</div>';
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Prepare the items for the table to process
|
134 |
+
*/
|
135 |
+
public function prepare_items($posts_table) {
|
136 |
+
$columns = $this->get_columns();
|
137 |
+
$hidden = $this->get_hidden_columns();
|
138 |
+
$sortable = $this->get_sortable_columns();
|
139 |
+
$currentPage = $this->get_pagenum();
|
140 |
+
|
141 |
+
global $wpdb;
|
142 |
+
|
143 |
+
// Load options and fields
|
144 |
+
$saved_options = get_option('permalink-manager');
|
145 |
+
$screen_options_fields = $this->screen_options_fields;
|
146 |
+
$per_page = isset($saved_options['per_page']) ? $saved_options['per_page'] : $screen_options_fields['per_page']['default'];
|
147 |
+
$post_types_array = isset($saved_options['post_types']) ? $saved_options['post_types'] : $screen_options_fields['post_types']['default'];
|
148 |
+
$post_types = "'" . implode("', '", $post_types_array) . "'";
|
149 |
+
$post_statuses_array = isset($saved_options['post_statuses']) ? $saved_options['post_statuses'] : $screen_options_fields['post_statuses']['default'];
|
150 |
+
$post_statuses = "'" . implode("', '", $post_statuses_array) . "'";
|
151 |
+
|
152 |
+
// Will be used in pagination settings
|
153 |
+
$total_items = $wpdb->get_var("SELECT COUNT(id) FROM $posts_table WHERE post_status IN ($post_statuses) AND post_type IN ($post_types)");
|
154 |
+
|
155 |
+
// SQL query parameters
|
156 |
+
$order = (isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('asc', 'desc'))) ? $_REQUEST['order'] : 'desc';
|
157 |
+
$orderby = (isset($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'ID';
|
158 |
+
$offset = ($currentPage - 1) * $per_page;
|
159 |
+
|
160 |
+
// Grab posts from database
|
161 |
+
$sql_query = "SELECT * FROM $posts_table WHERE post_status IN ($post_statuses) AND post_type IN ($post_types) ORDER BY $orderby $order LIMIT $per_page OFFSET $offset";
|
162 |
+
$data = $wpdb->get_results($sql_query, ARRAY_A);
|
163 |
+
|
164 |
+
// Sort posts and count all posts
|
165 |
+
usort( $data, array( &$this, 'sort_data' ) );
|
166 |
+
|
167 |
+
$this->set_pagination_args( array(
|
168 |
+
'total_items' => $total_items,
|
169 |
+
'per_page' => $per_page
|
170 |
+
));
|
171 |
+
|
172 |
+
$this->_column_headers = array($columns, $hidden, $sortable);
|
173 |
+
$this->items = $data;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* This variable is assigned in permalink-manager.php before prepare_items() function is triggered, see permalinks_table_html() function
|
178 |
+
*/
|
179 |
+
public function set_screen_option_fields($fields) {
|
180 |
+
$this->screen_options_fields = $fields;
|
181 |
+
}
|
182 |
+
|
183 |
+
}
|
184 |
+
?>
|
js/permalink-manager-admin.js
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Tab navigation
|
5 |
+
*/
|
6 |
+
jQuery('#permalink-manager-tabs-nav a').on('click', function(){
|
7 |
+
|
8 |
+
// Disable current active tab in navigation
|
9 |
+
jQuery('#permalink-manager-tabs-nav .nav-tab-active').removeClass('nav-tab-active');
|
10 |
+
jQuery('#permalink-manager-tabs .show').removeClass('show');
|
11 |
+
|
12 |
+
// Get current tab name
|
13 |
+
var tab_to_open = jQuery(this).data("tab");
|
14 |
+
|
15 |
+
// Add "active" class to the clicked tab
|
16 |
+
jQuery(this).addClass('nav-tab-active');
|
17 |
+
jQuery('#permalink-manager-tabs div[data-tab="'+tab_to_open+'"]').addClass('show');
|
18 |
+
|
19 |
+
// Disable native click event
|
20 |
+
return false;
|
21 |
+
});
|
22 |
+
|
23 |
+
/*
|
24 |
+
* "Select all" checkbox
|
25 |
+
*/
|
26 |
+
jQuery('input[value="all"]').on('change', function() {
|
27 |
+
// Uncheck "Select all"
|
28 |
+
jQuery(this).prop('checked', false);
|
29 |
+
|
30 |
+
jQuery(this).parents('.checkboxes').find('input[type="checkbox"]').not(this).each(function() {
|
31 |
+
jQuery(this).prop('checked', true);
|
32 |
+
});
|
33 |
+
});
|
34 |
+
|
35 |
+
});
|
languages/permalink-manager.pot
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Loco Gettext template
|
2 |
+
#, fuzzy
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Permalink Manager\n"
|
6 |
+
"Report-Msgid-Bugs-To: \n"
|
7 |
+
"POT-Creation-Date: Fri Jan 08 2016 20:08:17 GMT+0100 (CET)\n"
|
8 |
+
"POT-Revision-Date: Fri Jan 08 2016 20:08:23 GMT+0100 (CET)\n"
|
9 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10 |
+
"Last-Translator: \n"
|
11 |
+
"Language-Team: \n"
|
12 |
+
"Language: \n"
|
13 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16 |
+
"Content-Transfer-Encoding: 8bit\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-Basepath: .\n"
|
19 |
+
"X-Poedit-SearchPath-0: ..\n"
|
20 |
+
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
|
21 |
+
"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
22 |
+
"_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
|
23 |
+
"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
|
24 |
+
"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
|
25 |
+
"X-Generator: Loco - https://localise.biz/"
|
26 |
+
|
27 |
+
#. Name of the plugin
|
28 |
+
msgid "Permalink Manager"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#. URI of the plugin
|
32 |
+
msgid "http://maciejbis.net"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#. Description of the plugin
|
36 |
+
msgid ""
|
37 |
+
"A simple tool that allows to mass update of slugs that are used to build "
|
38 |
+
"permalinks for Posts, Pages and Custom Post Types."
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#. Author of the plugin
|
42 |
+
msgid "Maciej Bis"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../permalink-manager.php:89
|
46 |
+
msgid "Find & Replace"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../permalink-manager.php:108
|
50 |
+
msgid "Regenerate"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../permalink-manager.php:135
|
54 |
+
msgid "Permalinks"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../permalink-manager.php:137
|
58 |
+
msgid ""
|
59 |
+
"You can disable/enable selected post types from the table below using "
|
60 |
+
"<strong>\"Screen Options\"</strong> (click on the upper-right button to show "
|
61 |
+
"it) section above."
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: ../permalink-manager.php:140
|
65 |
+
msgid "Find and replace"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: ../permalink-manager.php:142 ../permalink-manager.php:147
|
69 |
+
msgid "<strong>You are doing it at your own risk!</strong>"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: ../permalink-manager.php:142
|
73 |
+
msgid ""
|
74 |
+
"A backup of MySQL database before using this tool is highly recommended. The "
|
75 |
+
"search & replace operation might be not revertible!"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: ../permalink-manager.php:145
|
79 |
+
msgid "Regenerate slugs"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: ../permalink-manager.php:147
|
83 |
+
msgid ""
|
84 |
+
"A backup of MySQL database before using this tool is highly recommended. The "
|
85 |
+
"regenerate process of slugs might be not revertible!"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: ../permalink-manager.php:160
|
89 |
+
msgid "by Maciej Bis"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: ../permalink-manager.php:210
|
93 |
+
msgid "Go To Permalink Manager"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: ../permalink-manager.php:226
|
97 |
+
msgid "Post Types"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: ../permalink-manager.php:228 ../permalink-manager.php:257 ../permalink-manager.
|
101 |
+
#: php:273
|
102 |
+
msgid "All Post Types"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: ../permalink-manager.php:232
|
106 |
+
msgid "Post Statuses"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: ../permalink-manager.php:234 ../permalink-manager.php:263 ../permalink-manager.
|
110 |
+
#: php:279
|
111 |
+
msgid "All Post Statuses"
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: ../permalink-manager.php:238
|
115 |
+
msgid "Per page"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: ../permalink-manager.php:247
|
119 |
+
msgid "Find ..."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: ../permalink-manager.php:251
|
123 |
+
msgid "Replace with ..."
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: ../permalink-manager.php:255 ../permalink-manager.php:271
|
127 |
+
msgid "Post Types that should be affected"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: ../permalink-manager.php:261 ../permalink-manager.php:277
|
131 |
+
msgid "Post Statuses that should be affected"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: ../permalink-manager.php:347
|
135 |
+
#, php-format
|
136 |
+
msgid "<strong>\"%1s\"</strong> field is empty!"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: ../permalink-manager.php:418
|
140 |
+
#, php-format
|
141 |
+
msgid "<strong>%d</strong> slug were updated!"
|
142 |
+
msgid_plural "<strong>%d</strong> slugs were updated!"
|
143 |
+
msgstr[0] ""
|
144 |
+
msgstr[1] ""
|
145 |
+
|
146 |
+
#: ../permalink-manager.php:419
|
147 |
+
#, php-format
|
148 |
+
msgid "<a href=\"%s\">Click here</a> to go to the list of updated slugs"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: ../permalink-manager.php:422
|
152 |
+
msgid "<strong>No slugs</strong> were updated!"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: ../permalink-manager.php:435 ../permalink-manager.php:447 ../inc/permalink-
|
156 |
+
#: manager-wp-table.php:30
|
157 |
+
msgid "Title"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: ../permalink-manager.php:436 ../permalink-manager.php:448
|
161 |
+
msgid "Old slug"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: ../permalink-manager.php:437 ../permalink-manager.php:449
|
165 |
+
msgid "New slug"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: ../permalink-manager.php:447
|
169 |
+
msgid "Show more details"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: ../permalink-manager.php:454
|
173 |
+
msgid "List of updated posts"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../inc/permalink-manager-screen-options.php:21
|
177 |
+
msgid "Apply"
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: ../inc/permalink-manager-wp-table.php:31
|
181 |
+
msgid "Slug"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: ../inc/permalink-manager-wp-table.php:32
|
185 |
+
msgid "Date"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: ../inc/permalink-manager-wp-table.php:33
|
189 |
+
msgid "Permalink"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: ../inc/permalink-manager-wp-table.php:34
|
193 |
+
msgid "Post Status"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: ../inc/permalink-manager-wp-table.php:35
|
197 |
+
msgid "Post Type"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../inc/permalink-manager-wp-table.php:81 ../inc/permalink-manager-wp-table.php:
|
201 |
+
#: 81
|
202 |
+
msgid "Edit"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ../inc/permalink-manager-wp-table.php:82 ../inc/permalink-manager-wp-table.php:
|
206 |
+
#: 82
|
207 |
+
msgid "View"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: ../inc/permalink-manager-wp-table.php:124
|
211 |
+
msgid "Update all slugs below"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: ../inc/permalink-manager-wp-table.php:125
|
215 |
+
msgid "Update all slugs above"
|
216 |
+
msgstr ""
|
permalink-manager.php
ADDED
@@ -0,0 +1,483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: Permalink Manager
|
5 |
+
* Plugin URI: http://maciejbis.net/
|
6 |
+
* Description: A simple tool that allows to mass update of slugs that are used to build permalinks for Posts, Pages and Custom Post Types.
|
7 |
+
* Version: 0.2.0
|
8 |
+
* Author: Maciej Bis
|
9 |
+
* Author URI: http://maciejbis.net/
|
10 |
+
* License: GPL-2.0+
|
11 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
12 |
+
* Text Domain: permalink-manager
|
13 |
+
* Domain Path: /languages
|
14 |
+
*/
|
15 |
+
|
16 |
+
// If this file is called directly, abort.
|
17 |
+
if ( ! defined( 'WPINC' ) ) {
|
18 |
+
die;
|
19 |
+
}
|
20 |
+
|
21 |
+
// Define the directories used to load plugin files.
|
22 |
+
define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'permalink-manager' );
|
23 |
+
define( 'PERMALINK_MANAGER_VERSION', '0.2.0' );
|
24 |
+
define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
|
25 |
+
define( 'PERMALINK_MANAGER_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
|
26 |
+
define( 'PERMALINK_MANAGER_WEBSITE', 'http://maciejbis.net' );
|
27 |
+
define( 'PERMALINK_MANAGER_MENU_PAGE', 'tools_page_permalink-manager' );
|
28 |
+
define( 'PERMALINK_MANAGER_OPTIONS_PAGE', PERMALINK_MANAGER_PLUGIN_NAME . '.php' );
|
29 |
+
|
30 |
+
class Permalink_Manager_Class {
|
31 |
+
|
32 |
+
protected $permalink_manager, $admin_page, $permalink_manager_options, $permalink_manager_options_page;
|
33 |
+
|
34 |
+
public function __construct() {
|
35 |
+
|
36 |
+
$this->permalink_manager_options = get_option('permalink-manager');
|
37 |
+
|
38 |
+
add_action( 'plugins_loaded', array($this, 'localize_me') );
|
39 |
+
add_action( 'admin_init', array($this, 'process_forms') );
|
40 |
+
add_action( 'admin_menu', array($this, 'add_menu_page') );
|
41 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugins_page_links') );
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Localize this plugin
|
47 |
+
*/
|
48 |
+
function localize_me() {
|
49 |
+
load_plugin_textdomain( 'permalink-manager', false, PERMALINK_MANAGER_DIR );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Add menu page and load CSS & JS.
|
54 |
+
*/
|
55 |
+
function add_menu_page() {
|
56 |
+
add_management_page( __('Permalink Manager', 'permalink-manager'), __('Permalink Manager', 'permalink-manager'), 'manage_options', PERMALINK_MANAGER_OPTIONS_PAGE, array($this, 'list_slugs_admin_page') );
|
57 |
+
|
58 |
+
// Make sure thata the CSS and JS files are loaded only on plugin admin page.
|
59 |
+
add_action( 'admin_print_scripts-' . PERMALINK_MANAGER_MENU_PAGE, array($this, 'enqueue_styles' ) );
|
60 |
+
add_action( 'admin_print_scripts-' . PERMALINK_MANAGER_MENU_PAGE, array($this, 'enqueue_scripts' ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Display the table with slugs.
|
65 |
+
*/
|
66 |
+
function permalinks_table_html() {
|
67 |
+
global $wpdb;
|
68 |
+
|
69 |
+
$Permalink_Manager_Table = new Permalink_Manager_Table();
|
70 |
+
$Permalink_Manager_Table->set_screen_option_fields($this->fields_arrays('screen_options'));
|
71 |
+
$Permalink_Manager_Table->prepare_items($wpdb->posts);
|
72 |
+
|
73 |
+
?>
|
74 |
+
|
75 |
+
<form id="permalinks-table" method="post">
|
76 |
+
<input type="hidden" name="page" value="<?php echo $_POST['page']; ?>" />
|
77 |
+
<?php echo $Permalink_Manager_Table->display(); ?>
|
78 |
+
</form>
|
79 |
+
<?php
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Mass replace options page.
|
84 |
+
*/
|
85 |
+
function find_and_replace_html() {
|
86 |
+
$button = get_submit_button( __( 'Find & Replace', 'permalink-manager' ), 'primary', 'find-replace-button', false );
|
87 |
+
|
88 |
+
$return = "<form id=\"permalinks-table-find-replace\" method=\"post\">";
|
89 |
+
$return .= "<table class=\"form-table\">";
|
90 |
+
|
91 |
+
foreach($this->fields_arrays('find_replace') as $field_name => $field_args) {
|
92 |
+
$return .= Permalink_Manager_Helper_Functions::generate_option_field($field_name, $field_args, 'find-replace');
|
93 |
+
}
|
94 |
+
|
95 |
+
$return .= "</table>{$button}";
|
96 |
+
$return .= "</form>";
|
97 |
+
|
98 |
+
echo $return;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Reset slugs page.
|
103 |
+
*/
|
104 |
+
function regenerate_slugs_html() {
|
105 |
+
$button = get_submit_button( __( 'Regenerate', 'permalink-manager' ), 'primary', 'regenerate-button', false );
|
106 |
+
|
107 |
+
$return = "<form id=\"permalinks-table-regenerate\" method=\"post\">";
|
108 |
+
$return .= "<table class=\"form-table\">";
|
109 |
+
|
110 |
+
foreach($this->fields_arrays('regenerate') as $field_name => $field_args) {
|
111 |
+
$return .= Permalink_Manager_Helper_Functions::generate_option_field($field_name, $field_args, 'regenerate');
|
112 |
+
}
|
113 |
+
|
114 |
+
$return .= "</table>{$button}";
|
115 |
+
$return .= "</form>";
|
116 |
+
|
117 |
+
echo $return;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Display the plugin dashboard.
|
122 |
+
*/
|
123 |
+
function list_slugs_admin_page() {
|
124 |
+
global $wpdb;
|
125 |
+
|
126 |
+
// Check which tab is active now.
|
127 |
+
$active_tab = ( isset( $_GET[ 'tab' ] ) ) ? $_GET[ 'tab' ] : 'permalinks';
|
128 |
+
|
129 |
+
// Tabs array with assigned functions used to display HTML content.
|
130 |
+
$tabs = array(
|
131 |
+
'permalinks' => array(
|
132 |
+
'name' => __('Permalinks', 'permalink-manager'),
|
133 |
+
'function' => 'permalinks_table_html',
|
134 |
+
'description' => __('You can disable/enable selected post types from the table below using <strong>"Screen Options"</strong> (click on the upper-right button to show it) section above.', 'permalink-manager')
|
135 |
+
),
|
136 |
+
'find_and_replace' => array(
|
137 |
+
'name' => __('Find and replace', 'permalink-manager'),
|
138 |
+
'function' => 'find_and_replace_html',
|
139 |
+
'warning' => (__('<strong>You are doing it at your own risk!</strong>', 'permalink-manager') . '<br />' . __('A backup of MySQL database before using this tool is highly recommended. The search & replace operation might be not revertible!', 'permalink-manager'))
|
140 |
+
),
|
141 |
+
'regenerate_slugs' => array(
|
142 |
+
'name' => __('Regenerate slugs', 'permalink-manager'),
|
143 |
+
'function' => 'regenerate_slugs_html',
|
144 |
+
'warning' => (__('<strong>You are doing it at your own risk!</strong>', 'permalink-manager') . '<br />' . __('A backup of MySQL database before using this tool is highly recommended. The regenerate process of slugs might be not revertible!', 'permalink-manager'))
|
145 |
+
),
|
146 |
+
);
|
147 |
+
|
148 |
+
?>
|
149 |
+
<div id="permalinks-table-wrap" class="wrap">
|
150 |
+
|
151 |
+
<?php
|
152 |
+
// Display alerts and another content if needed
|
153 |
+
echo apply_filters('permalink-manager-before-tabs','');
|
154 |
+
?>
|
155 |
+
|
156 |
+
<div id="icon-themes" class="icon32"></div>
|
157 |
+
<h2 id="plugin-name-heading"><?php _e('Permalink Manager', 'permalink-manager'); ?> <a href="<?php echo PERMALINK_MANAGER_WEBSITE; ?>" target="_blank"><?php _e('by Maciej Bis', 'permalink-manager'); ?></a></h2>
|
158 |
+
|
159 |
+
<h2 id="permalink-manager-tabs-nav" class="nav-tab-wrapper">
|
160 |
+
<?php
|
161 |
+
foreach($tabs as $tab_id => $tab_properties) {
|
162 |
+
$active_class = ($active_tab === $tab_id) ? 'nav-tab-active nav-tab' : 'nav-tab';
|
163 |
+
echo '<a data-tab="' . $tab_id . '" href="' . admin_url('admin.php?page=' . PERMALINK_MANAGER_PLUGIN_NAME . '.php&tab=' . $tab_id) . '" class="' . $active_class . '">' . $tab_properties['name'] . '</a>';
|
164 |
+
} ?>
|
165 |
+
</h2>
|
166 |
+
|
167 |
+
<div id="permalink-manager-tabs">
|
168 |
+
<?php
|
169 |
+
foreach($tabs as $tab_id => $tab_properties) {
|
170 |
+
$active_show = ($active_tab === $tab_id) ? 'show' : '';
|
171 |
+
|
172 |
+
echo '<div data-tab="' . $tab_id . '" id="' . $tab_id . '" class="' . $active_show . '">';
|
173 |
+
echo (isset($tab_properties['description'])) ? "<div class=\"info alert\"><p>{$tab_properties['description']}</p></div>" : "";
|
174 |
+
echo (isset($tab_properties['warning'])) ? "<div class=\"warning alert\"><p>{$tab_properties['warning']}</p></div>" : "";
|
175 |
+
$this->$tab_properties['function']();
|
176 |
+
echo '</div>';
|
177 |
+
} ?>
|
178 |
+
</div>
|
179 |
+
|
180 |
+
<?php
|
181 |
+
// Display alerts and another content if needed
|
182 |
+
echo apply_filters('permalink-manager-after-tabs','');
|
183 |
+
?>
|
184 |
+
|
185 |
+
</div>
|
186 |
+
<?php
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Register the stylesheets for the Dashboard.
|
191 |
+
*/
|
192 |
+
function enqueue_styles() {
|
193 |
+
wp_enqueue_style( PERMALINK_MANAGER_PLUGIN_NAME, PERMALINK_MANAGER_URL . '/css/permalink-manager-admin.css', array(), PERMALINK_MANAGER_VERSION, 'all' );
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Register the JavaScript for the dashboard.
|
198 |
+
*/
|
199 |
+
function enqueue_scripts() {
|
200 |
+
wp_enqueue_script( PERMALINK_MANAGER_PLUGIN_NAME, PERMALINK_MANAGER_URL . '/js/permalink-manager-admin.js', array( 'jquery' ), PERMALINK_MANAGER_VERSION, false );
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Additional links on "Plugins" page
|
205 |
+
*/
|
206 |
+
function plugins_page_links( $links ) {
|
207 |
+
$links[] = '<a href="' . esc_url( get_admin_url(null, "tools.php?page=" . PERMALINK_MANAGER_OPTIONS_PAGE) ) .'">' . __( 'Go To Permalink Manager', 'permalink-manager' ) . '</a>';
|
208 |
+
return $links;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Fields for "Screen Options"
|
213 |
+
*/
|
214 |
+
function fields_arrays($array) {
|
215 |
+
|
216 |
+
// All registered post types array
|
217 |
+
$all_post_types_array = Permalink_Manager_Helper_Functions::get_post_types_array();
|
218 |
+
$all_post_statuses_array = get_post_statuses();
|
219 |
+
|
220 |
+
// Fields for "Screen Options"
|
221 |
+
$screen_options = array(
|
222 |
+
'post_types' => array(
|
223 |
+
'label' => __( 'Post Types', 'permalink-manager' ),
|
224 |
+
'type' => 'checkbox',
|
225 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Types', 'permalink-manager') . '</strong>'), $all_post_types_array),
|
226 |
+
'default' => array('post', 'page')
|
227 |
+
),
|
228 |
+
'post_statuses' => array(
|
229 |
+
'label' => __( 'Post Statuses', 'permalink-manager' ),
|
230 |
+
'type' => 'checkbox',
|
231 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Statuses', 'permalink-manager') . '</strong>'), $all_post_statuses_array),
|
232 |
+
'default' => array('publish')
|
233 |
+
),
|
234 |
+
'per_page' => array(
|
235 |
+
'label' => __( 'Per page', 'permalink-manager' ),
|
236 |
+
'type' => 'number',
|
237 |
+
'default' => 10
|
238 |
+
)
|
239 |
+
);
|
240 |
+
|
241 |
+
// Fields for "Find and replace"
|
242 |
+
$find_replace = array(
|
243 |
+
'old_string' => array(
|
244 |
+
'label' => __( 'Find ...', 'permalink-manager' ),
|
245 |
+
'type' => 'text',
|
246 |
+
),
|
247 |
+
'new_string' => array(
|
248 |
+
'label' => __( 'Replace with ...', 'permalink-manager' ),
|
249 |
+
'type' => 'text',
|
250 |
+
),
|
251 |
+
'post_types' => array(
|
252 |
+
'label' => __( 'Post Types that should be affected', 'permalink-manager' ),
|
253 |
+
'type' => 'checkbox',
|
254 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Types', 'permalink-manager') . '</strong>'), $all_post_types_array),
|
255 |
+
'default' => array('post', 'page')
|
256 |
+
),
|
257 |
+
'post_statuses' => array(
|
258 |
+
'label' => __( 'Post Statuses that should be affected', 'permalink-manager' ),
|
259 |
+
'type' => 'checkbox',
|
260 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Statuses', 'permalink-manager') . '</strong>'), $all_post_statuses_array),
|
261 |
+
'default' => array('publish')
|
262 |
+
)
|
263 |
+
);
|
264 |
+
|
265 |
+
// Fields for "Regenerate slugs"
|
266 |
+
$regenerate = array(
|
267 |
+
'post_types' => array(
|
268 |
+
'label' => __( 'Post Types that should be affected', 'permalink-manager' ),
|
269 |
+
'type' => 'checkbox',
|
270 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Types', 'permalink-manager') . '</strong>'), $all_post_types_array),
|
271 |
+
'default' => array('post', 'page')
|
272 |
+
),
|
273 |
+
'post_statuses' => array(
|
274 |
+
'label' => __( 'Post Statuses that should be affected', 'permalink-manager' ),
|
275 |
+
'type' => 'checkbox',
|
276 |
+
'choices' => array_merge(array('all' => '<strong>' . __('All Post Statuses', 'permalink-manager') . '</strong>'), $all_post_statuses_array),
|
277 |
+
'default' => array('publish')
|
278 |
+
)
|
279 |
+
);
|
280 |
+
|
281 |
+
return isset($array) ? ${$array} : array();
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Check if the provided slug is unique and then update it with SQL query.
|
286 |
+
*/
|
287 |
+
function update_slug_by_id($slug, $id) {
|
288 |
+
global $wpdb;
|
289 |
+
|
290 |
+
// Update slug and make it unique
|
291 |
+
$slug = (empty($slug)) ? sanitize_title(get_the_title($id)) : $slug;
|
292 |
+
$new_slug = wp_unique_post_slug($slug, $id, get_post_status($id), get_post_type($id), null);
|
293 |
+
$wpdb->query("UPDATE $wpdb->posts SET post_name = '$new_slug' WHERE ID = '$id'");
|
294 |
+
|
295 |
+
return $new_slug;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Bulk actions functions
|
300 |
+
*/
|
301 |
+
function process_forms() {
|
302 |
+
global $wpdb;
|
303 |
+
$updated_slugs_count = 0;
|
304 |
+
$updated_array = array();
|
305 |
+
$alert_type = $alert_content = $errors = $main_content = '';
|
306 |
+
|
307 |
+
if (isset($_POST['update_all_slugs'])) {
|
308 |
+
|
309 |
+
$slugs = isset($_POST['slug']) ? $_POST['slug'] : array();
|
310 |
+
|
311 |
+
// Double check if the slugs and ids are stored in arrays
|
312 |
+
if (!is_array($slugs)) $slugs = explode(',', $slugs);
|
313 |
+
|
314 |
+
if (!empty($slugs)) {
|
315 |
+
foreach($slugs as $id => $new_slug) {
|
316 |
+
$this_post = get_post($id);
|
317 |
+
|
318 |
+
// Check if slug was changed
|
319 |
+
if($this_post->post_name != $new_slug) {
|
320 |
+
// Update slugs
|
321 |
+
$this->update_slug_by_id($new_slug, $id);
|
322 |
+
|
323 |
+
$updated_array[] = array('post_title' => get_the_title($id), 'old_slug' => $this_post->post_name, 'new_slug' => $new_slug);
|
324 |
+
$updated_slugs_count++;
|
325 |
+
}
|
326 |
+
|
327 |
+
// Reset slug
|
328 |
+
$slug = '';
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
} else if (isset($_POST['find-replace-button'])) {
|
333 |
+
|
334 |
+
$var['old_string'] = esc_sql($_POST['permalink-manager']['find-replace']['old_string']);
|
335 |
+
$var['new_string'] = esc_sql($_POST['permalink-manager']['find-replace']['new_string']);
|
336 |
+
$post_types_array = ($_POST['permalink-manager']['find-replace']['post_types']);
|
337 |
+
$post_statuses_array = ($_POST['permalink-manager']['find-replace']['post_statuses']);
|
338 |
+
$var['post_types'] = implode("', '", $post_types_array);
|
339 |
+
$var['post_statuses'] = implode("', '", $post_statuses_array);
|
340 |
+
|
341 |
+
// Check if any of variables is not empty
|
342 |
+
$find_replace_fields = $this->fields_arrays('find_replace');
|
343 |
+
foreach($var as $key => $val) {
|
344 |
+
if(empty($val)) $errors .= '<p>' . sprintf( __( '<strong>"%1s"</strong> field is empty!', 'permalink-manager' ), $find_replace_fields[$key]['label'] ) . '</p>';
|
345 |
+
}
|
346 |
+
|
347 |
+
// Save the rows before they are updated to an array
|
348 |
+
$posts_to_update = $wpdb->get_results("SELECT post_title, post_name, ID FROM {$wpdb->posts} WHERE post_status IN ('{$var['post_statuses']}') AND post_name LIKE '%{$var['old_string']}%' AND post_type IN ('{$var['post_types']}')", ARRAY_A);
|
349 |
+
|
350 |
+
// Now if the array is not empty use IDs from each subarray as a key
|
351 |
+
if($posts_to_update && empty($errors)) {
|
352 |
+
foreach ($posts_to_update as $row) {
|
353 |
+
// Get new slug
|
354 |
+
$old_slug = $row['post_name'];
|
355 |
+
$new_slug = str_replace($var['old_string'], $var['new_string'], $old_slug);
|
356 |
+
|
357 |
+
// Update slugs
|
358 |
+
$this->update_slug_by_id($new_slug, $row['ID']);
|
359 |
+
|
360 |
+
$updated_array[] = array('post_title' => $row['post_title'], 'old_slug' => $old_slug, 'new_slug' => $new_slug);
|
361 |
+
$updated_slugs_count++;
|
362 |
+
|
363 |
+
// Reset slug
|
364 |
+
$slug = '';
|
365 |
+
}
|
366 |
+
} else {
|
367 |
+
$alert_type = 'error';
|
368 |
+
$alert_content = $errors;
|
369 |
+
}
|
370 |
+
|
371 |
+
|
372 |
+
} else if (isset($_POST['regenerate-button'])) {
|
373 |
+
|
374 |
+
// Setup needed variables
|
375 |
+
$post_types_array = ($_POST['permalink-manager']['regenerate']['post_types']);
|
376 |
+
$post_statuses_array = ($_POST['permalink-manager']['regenerate']['post_statuses']);
|
377 |
+
|
378 |
+
// Reset query
|
379 |
+
$reset_query = new WP_Query( array( 'post_type' => $post_types_array, 'post_status' => $post_statuses_array, 'posts_per_page' => -1 ) );
|
380 |
+
|
381 |
+
// The Loop
|
382 |
+
if ( $reset_query->have_posts() ) {
|
383 |
+
while ( $reset_query->have_posts() ) {
|
384 |
+
$reset_query->the_post();
|
385 |
+
$this_post = get_post(get_the_ID());
|
386 |
+
|
387 |
+
$correct_slug = sanitize_title(get_the_title());
|
388 |
+
$old_slug = $this_post->post_name;
|
389 |
+
$new_slug = wp_unique_post_slug($correct_slug, get_the_ID(), get_post_status(get_the_ID()), get_post_type(get_the_ID()), null);
|
390 |
+
|
391 |
+
if($old_slug != $new_slug) {
|
392 |
+
$updated_slugs_count++;
|
393 |
+
|
394 |
+
$this->update_slug_by_id($new_slug, get_the_ID());
|
395 |
+
$updated_array[] = array('post_title' => get_the_title(), 'old_slug' => $old_slug, 'new_slug' => $new_slug);
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
// Restore original Post Data
|
401 |
+
wp_reset_postdata();
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Display results
|
407 |
+
*/
|
408 |
+
if((isset($_POST['permalink-manager']) || isset($_POST['update_all_slugs'])) && !(isset($_POST['screen-options-apply']))) {
|
409 |
+
// Display errors or success message
|
410 |
+
add_filter('permalink-manager-before-tabs', function( $arg ) use ( $updated_slugs_count, $alert_content, $alert_type ) {
|
411 |
+
|
412 |
+
// Check how many rows/slugs were affected
|
413 |
+
if($updated_slugs_count > 0) {
|
414 |
+
$alert_type = 'updated';
|
415 |
+
$alert_content = sprintf( _n( '<strong>%d</strong> slug were updated!', '<strong>%d</strong> slugs were updated!', $updated_slugs_count, 'permalink-manager' ), $updated_slugs_count ) . ' ';
|
416 |
+
$alert_content .= sprintf( __( '<a href="%s">Click here</a> to go to the list of updated slugs', 'permalink-manager' ), '#updated-list');
|
417 |
+
} else {
|
418 |
+
$alert_type = 'error';
|
419 |
+
$alert_content = ($alert_content) ? $alert_content : __( '<strong>No slugs</strong> were updated!', 'permalink-manager' );
|
420 |
+
}
|
421 |
+
|
422 |
+
return Permalink_Manager_Helper_Functions::display_alert($alert_content, $alert_type);
|
423 |
+
|
424 |
+
});
|
425 |
+
|
426 |
+
// Display summary after update
|
427 |
+
// Display only if there are any slugs updated
|
428 |
+
if ( $updated_slugs_count > 0 && $updated_array ) {
|
429 |
+
add_filter('permalink-manager-after-tabs', function( $arg ) use ( $alert_content, $alert_type, $errors, $updated_array, $main_content ) {
|
430 |
+
|
431 |
+
$header_footer = '<tr>';
|
432 |
+
$header_footer .= '<th class="column-primary">' . __('Title', 'permalink-manager') . '</th>';
|
433 |
+
$header_footer .= '<th>' . __('Old slug', 'permalink-manager') . '</th>';
|
434 |
+
$header_footer .= '<th>' . __('New slug', 'permalink-manager') . '</th>';
|
435 |
+
$header_footer .= '</tr>';
|
436 |
+
|
437 |
+
$updated_slugs_count = 0;
|
438 |
+
foreach($updated_array as $row) {
|
439 |
+
// Odd/even class
|
440 |
+
$updated_slugs_count++;
|
441 |
+
$alternate_class = ($updated_slugs_count % 2 == 1) ? ' class="alternate"' : '';
|
442 |
+
|
443 |
+
$main_content .= "<tr{$alternate_class}>";
|
444 |
+
$main_content .= '<td class="row-title column-primary" data-colname="' . __('Title', 'permalink-manager') . '">' . $row['post_title'] . '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'permalink-manager') . '</span></button></td>';
|
445 |
+
$main_content .= '<td data-colname="' . __('Old slug', 'permalink-manager') . '">' . $row['old_slug'] . '</td>';
|
446 |
+
$main_content .= '<td data-colname="' . __('New slug', 'permalink-manager') . '">' . $row['new_slug'] . '</td>';
|
447 |
+
$main_content .= '</tr>';
|
448 |
+
}
|
449 |
+
|
450 |
+
// Merge header, footer and content
|
451 |
+
$output = '<h3 id="updated-list">' . __('List of updated posts', 'permalink-manager') . '</h3>';
|
452 |
+
$output .= '<table class="widefat wp-list-table">';
|
453 |
+
$output .= "<thead>{$header_footer}</thead><tbody>{$main_content}</tbody><tfoot>{$header_footer}</tfoot>";
|
454 |
+
$output .= '</table>';
|
455 |
+
|
456 |
+
return $output ;
|
457 |
+
|
458 |
+
});
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
+
}
|
463 |
+
|
464 |
+
/**
|
465 |
+
* Begins execution of the plugin.
|
466 |
+
*/
|
467 |
+
function run_permalink_manager() {
|
468 |
+
|
469 |
+
// Load plugin files.
|
470 |
+
if( is_admin() ) {
|
471 |
+
|
472 |
+
require_once PERMALINK_MANAGER_DIR . '/inc/permalink-manager-wp-table.php';
|
473 |
+
require_once PERMALINK_MANAGER_DIR . '/inc/permalink-manager-screen-options.php';
|
474 |
+
require_once PERMALINK_MANAGER_DIR . '/inc/permalink-manager-helper-functions.php';
|
475 |
+
|
476 |
+
$Permalink_Manager_Class = new Permalink_Manager_Class();
|
477 |
+
$Permalink_Manager_Screen_Options = new Permalink_Manager_Screen_Options();
|
478 |
+
|
479 |
+
}
|
480 |
+
|
481 |
+
}
|
482 |
+
|
483 |
+
run_permalink_manager();
|