Custom Post Type UI - Version 1.6.0

Version Description

  • TBD =
  • Added: Support for meta_box_cb parameter for register_taxonomy and taxonomies.
  • Added: Dynamically warn about existing slugs.
  • Added: "delete_with_user" support for post types.
  • Added: Filters for post type and taxonomy data right before saving of final data.
  • Added: cptui_get_taxonomy_exists function to check if a provided taxonomy is registered.
  • Added: Required PHP version to readme.txt
  • Added: Filter on taxonomies to be listed as available for association with a post type.
  • Added: Warning indicators to our "Slug changed" and "Slug exists" warnings for post types and taxonomies.
  • Added: Support for "publicly_queryable" parameter for taxonomies.
  • Added: Support for "rest_controller_class" parameters for both post types and taxonomies.
  • Added: Some initial WP-CLI support for importing and exporting CPTUI settings.
  • Added: name_admin_bar support in post type labels.
  • Added: Handling of array versions for "capability_type" field.
  • Updated: Bump minimum WordPress version to 4.7.
  • Updated: Pass the object_type array to cptui_pre_register_taxonomy filter as extra parameter.
  • Updated: Adjusted preserved label handling to aid with plugin performance. Props alex-solovyev
  • Updated: Utilize wp_doing_ajax() function for our AJAX checks.
  • Updated: Clarify what is exported with the Post Types and Taxonomies spots for the Tools section.
  • Updated: Clarify that the listed post types to associate to a CPTUI taxonomy are public post types by default.
  • Updated: Make "Show In Rest" setting default to true for sake of easier Gutenberg integration in the future.
  • Fixed: Only register archive slug if has_archive is set to true.
  • Fixed: Error occurred when attempting to unset post types while editing a taxonomy.
  • Fixed: Prevent errors from non-existant callback functions during post type or taxonomy processing.
  • Fixed: Incorrect use of reserved taxonomy slugs function in a check for reserved post types.
  • Fixed: Make sure "No post type selected" alert trigger from both buttons on the taxonomy settings edit screen.
  • Fixed: Add our stylesheet only on our CPTUI pages. Fixes responsive bug on post editor screen.
  • Fixed: Removed duplicate "label" in taxonomy "get code" section.
Download this release

Release Info

Developer tw2113
Plugin Icon 128x128 Custom Post Type UI
Version 1.6.0
Comparing to
See all releases

Code changes from version 1.5.8 to 1.6.0

LICENSE ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
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
+ {description}
294
+ Copyright (C) {year} {fullname}
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.
340
+
changelog.txt DELETED
@@ -1,182 +0,0 @@
1
- = 1.3.5 - 2016-6-3 =
2
- * Removed undefined index error for publicly_queryable in "Get Code" area. That parameter is targeted for 1.4.0 release.
3
-
4
- = 1.3.4 - 2016-5-4 =
5
- * Fixed: moved WDS-based services "ads" to within the plugin itself. Will not request remote resources.
6
- * Fixed: Better output formatting if WDS/Pluginize "ads" failed to load images.
7
- * Fixed: undefined variable error in cptui.js
8
- * Added: Newsletter subscription form to stay uptodate with Custom Post Type UI &amp; Custom Post Type UI Extended news.
9
- * Added: Support page/FAQ info regarding Pluginize and recent sidebar developments.
10
-
11
- = 1.3.3 - 2016-4-5 =
12
- * Revert Changes for ajax/heartbeat API requests before post type registration. 3rd party or other plugins were breaking because post types were not registered.
13
-
14
- = 1.3.2 - 2016-4-5 =
15
- * Fixed: Logic issue with cptui js files loading where they weren't meant to.
16
- * Fixed: Required markers missing on required post type fields.
17
- * Fixed: Removed excess labels that are not used by WordPress core.
18
- * Added: New contributors to readme file. Welcome John and Ryan.
19
- * Updated: New screenshot from 1.3.0 release. Moved to assets folder so users will no longer download as part of CPTUI.
20
- * Updated: Better prevention of running our code during ajax/heartbeat api requests.
21
-
22
- = 1.3.1 - 2016-3-25 =
23
- * Fixed: Logic issue for default values of `public` parameter for taxonomies added in 1.3.0.
24
-
25
- = 1.3.0 =
26
- * Added: "CPTUI_VERSION" constant and deprecated "CPT_VERSION".
27
- * Added: "Public" parameter for taxonomies
28
- * Added: "View Post Types" and "View Taxonomies" tabs at top of add/edit screens.
29
- * Added: Better prevention of potential duplicate slugs in new post types and taxonomies.
30
- * Added: Current theme's textdomain as output in get code textareas.
31
- * Added: Fill in singular and plural label fields if none provided. WordPress does not auto-fill these.
32
- * Added: For developers: plenty of extra hooks all over for customization needs.
33
- * Added: Javascript-based prevention of spaces and special characters for post type and taxonomy slugs.
34
- * Added: Legend tag support to admin UI class.
35
- * Added: Minified copies of our JavaScript and CSS. Define SCRIPT_DEBUG to true to use non-minified versions.
36
- * Added: New post type and taxonomy labels provided by WordPress 4.3 and 4.4 releases.
37
- * See: https://make.wordpress.org/core/2015/12/11/additional-labels-for-custom-post-types-and-custom-taxonomies/
38
- * Added: Notes to post type and taxonomy edit screens about WordPress core's post types and taxonomies.
39
- * Added: Taxonomy slug update ability with preserved term association.
40
- * Added: Title, Editor, and Featured Image now checked by default for new post types.
41
- * Added: "Show in Quick Edit" taxonomy parameter available in WP 4.2
42
- * Added: Promo spots on add/edit screens for other products from WebDevStudios.
43
- * Fixed: Need to visit permalinks page to flush rewrite rules after creating new post type or taxonomy.
44
- * Fixed: Missing REST API based parameters in "Get Code" output.
45
- * Updated: Increased accessibility coverage.
46
- * Updated: Revised how tabs are added to pages so 3rd party developers can add their own tabs.
47
- * Updated: Improved string consistency in our UI helper notes. Props @GaryJ
48
- * Updated: Tested on WordPress 4.5
49
- * Updated: Cleaned up admin footer area for social links.
50
- * Updated: Moved all localization work to WordPress.org Translation packs
51
-
52
- = 1.2.4 =
53
- * Added: new CPTUI_VERSION constant to match naming of other current constants.
54
- * Added: CPTUI_VERSION constant to cptui.css string for cache busting.
55
-
56
- = 1.2.3 - 2016-01-31 =
57
- * Fixed: copy/paste error with admin css. Props hinaloe.
58
-
59
- = 1.2.2 - 2016-01-30 =
60
- * Fixed: Missing admin menu icon for some browsers.
61
- * Fixed: Undefined index notices for post type screen.
62
-
63
- = 1.2.1 - 2016-01-17 =
64
- * Fixed: Undefined index notices for custom taxonomies and new fields from 1.2.0
65
-
66
- = 1.2.0 - 2016-01-15 =
67
- * Added: Support for show_in_nav_menus parameter for post types.
68
- * Added: Support for taxonomy descriptions.
69
- * Added: Message on listings page if no post types or taxonomies are available.
70
- * Added: Note regarding 'public' parameter not being true by default for WordPress but is for CPTUI.
71
- * Added: Individual post type and taxonomy output for "Get Code" area.
72
- * Added: Fallback values for post type/taxonomy select input and get code area if no plural label provided.
73
- * Added: Support for custom query_var strings for post types.
74
- * Added: Support for show_in_rest and rest_base for post types and taxonomies for the upcoming WordPress REST API.
75
- * Added: Template hierarchy files to listings tables for user reference.
76
- * Added: Form labels in more areas to help with accessibility and usability.
77
- * Added: Fieldset method to Admin UI class for easily adding fieldset output.
78
- * Added: Debugging tab for use with CPTUI support.
79
- * Updated: Minimum version required. Now WordPress 4.2.
80
- * Updated: Heading tags match accessibility changes in WordPress 4.3.
81
- * Updated: Moved page title for some pages above tabs.
82
- * Updated: Textdomain now matches WordPress.org repo slug.
83
- * Updated: Added Visual Composer questions/answers to support section.
84
- * Updated: Added question/answer regarding spaces in post type slugs
85
- * Updated: Changed help icons to a Dashicon help icon.
86
- * Fixed: Support for YARPP plugin.
87
- * Fixed: Prevent potential issues with AJAX requests and our scripts/styles
88
-
89
- = 1.1.3 - 2015-12-23 =
90
- * Bumping WordPress compatibility version only. No other changes involved.
91
-
92
- = 1.1.2 - 2015-08-11 =
93
- * Change export value to plural label for taxonomies.
94
- * Properly select a post type or taxonomy after deleting an existing value.
95
- * Updated screenshots
96
- * Added target="_blank" attribute to one of the inline help links for Menu position. Thanks @JulieKuehl
97
- * Fixed potential XSS issue.
98
-
99
- = 1.1.1 - 2015-06-15 =
100
- * Re-add post type and taxonomy select buttons and only display for non-js users.
101
-
102
- = 1.1.0 - 2015-06-12 =
103
- * Simplified UI with regards to clicking amount.
104
- * Auto selecting of first available post type or taxonomy in Edit tab.
105
- * Switch to post type or taxonomy upon selection within Edit tab.
106
- * Return of a list of CPTUI-registered post types and taxonomies.
107
- * Post type slug update capability.
108
- * Added function reference 3rd party link to support area.
109
- * New hooks in edit screen for custom content display on screen.
110
- * String updates.
111
- * UI field option for custom "Supports" parameters from other plugins. Example: Yet Another Related Posts Plugin.
112
- * Updated help/support section with another reference tool.
113
- * Trim extra spaces potentially left behind in text inputs.
114
- * Rearranged menu listing slightly to remove duplicate naming.
115
- * GitHub repo has GitHub Updater (https://github.com/afragen/github-updater) compatible copy of CPTUI version that is available on WordPress.org
116
-
117
- = 1.0.8 - 2015-05-01 =
118
- * Register taxonomies at a higher priority than post types.
119
-
120
- = 1.0.7 - 2015-04-20 =
121
- * Preventive measures for potential XSS security issues with add_query_arg()
122
-
123
- = 1.0.6 - 2015-04-14 =
124
- * Change priority of post type registration function that was causing rewrite issues for many.
125
- * Fix issues with help text spots not showing up for some post type fields. Props pedro-mendonca.
126
- * Fix logic issue with PHP's empty() function and CPTUI 0.9.x saved settings.
127
-
128
- = 1.0.5 - 2015-03-20 =
129
- * Explicitly set the post type and taxonomy rewrite slugs as the registered slug if no custom ones provided.
130
- * Prevent cptui.js from loading where it is not needed.
131
- * Fixed undefined index notice for post type rewrite_withfront.
132
- * Repopulated labels when none provided and post type or taxonomy mentioned in default label.
133
- * Fix for import/export get code tab and hierarchical taxonomies
134
-
135
- = 1.0.4 - 2015-03-05 =
136
- * Fixed incorrect boolean order for hierarchical taxonomies and default value.
137
- * Fixed missing closing div tags.
138
- * Default menu position to null instead of empty string.
139
- * Undefined index notice cleanup.
140
- * Remove unnecessary hook.
141
-
142
- = 1.0.3 - Unknown =
143
- * Fix logic error regarding string "0" evaluating to false when checked for not empty.
144
- * Fix for taxonomy with_front boolean value not evaluating correctly.
145
- * Fix for taxonomy hierarchical boolean value not evaluating correctly.
146
- * Fix for post type has_archive.
147
- * German translation updates. If you speak/read German, myself and the translator would LOVE to have feedback on this.
148
- * Internationalization string changes after feedback from German translation work.
149
- * Minor issue with link html being stripped from UI field explanation.
150
- * Better apostrophe/single quote support in label fields.
151
-
152
- = 1.0.2 - 2015-02-12 =
153
- * Fix issue with checked checkboxes for post type associations for taxonomies.
154
- * Fix "Get Code" spot related to post type associations for taxonomies.
155
- * Update some text strings after localization feedback.
156
- * Fix typos in textdomain for two spots.
157
- * Updating progressing translation files.
158
- * Fix value for with_front parameter.
159
- * Fix error in boolean type for map_meta_cap.
160
- * Fix missing use of query_var slug if present for taxonomies.
161
-
162
- = 1.0.1 - 2015-02-11 =
163
- * Fix issues with taxonomy transfer and registration.
164
- * Fix issue with taxonomy "show admin column" evaluating to true regardless of setting.
165
- * Prefix our "help" class to prevent conflict with other plugins that use just "help".
166
- * Fix issue with menu position values not being obeyed.
167
- * Fix hook names inside taxonomy update function.
168
- * Fix potentially empty parameter with taxonomies and "Get Code" output.
169
- * Added PHP "undefined index" notice prevention for some parameters.
170
-
171
- = 1.0.0 - 2015-02-09 =
172
- * CPTUI has been given a new UI!
173
- * Separated out post type and taxonomy creation to their own screens.
174
- * Added import/export ability for post type and taxonomy settings.
175
- * Added a Help/Support Screen.
176
- * Added/Updated available parameters for post types and parameters.
177
- * Updated i18n and translation files.
178
- * Added Confirmation prompts before deleting post types and taxonomies.
179
- * Added actions and filters for 3rd party customization.
180
- * Added function that automatically converts 0.8.x and down settings to new setting arrangement.
181
- * Changed how settings are stored so that post types and taxonomies are in named array indexes.
182
- * Bug fixes not mentioned above.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class.cptui_admin_ui.php CHANGED
@@ -6,6 +6,7 @@
6
  * @subpackage AdminUI
7
  * @author WebDevStudios
8
  * @since 1.0.0
 
9
  */
10
 
11
  /**
6
  * @subpackage AdminUI
7
  * @author WebDevStudios
8
  * @since 1.0.0
9
+ * @license GPL-2.0+
10
  */
11
 
12
  /**
classes/class.cptui_debug_info.php CHANGED
@@ -6,6 +6,7 @@
6
  * @subpackage Debugging
7
  * @author WebDevStudios
8
  * @since 1.2.0
 
9
  */
10
 
11
  /**
@@ -145,13 +146,13 @@ class CPTUI_Debug_Info {
145
  echo "\n";
146
  $cptui_post_types = cptui_get_post_type_data();
147
  echo "\t\t" . 'Post Types: ' . "\n";
148
- echo "\t\t" . esc_html( json_encode( $cptui_post_types ) ) . "\n";
149
 
150
  echo "\n\n";
151
 
152
  $cptui_taxonomies = cptui_get_taxonomy_data();
153
  echo "\t\t" . 'Taxonomies: ' . "\n";
154
- echo "\t\t" . esc_html( json_encode( $cptui_taxonomies ) ) . "\n";
155
  echo "\n";
156
 
157
  if ( has_action( 'cptui_custom_debug_info' ) ) {
@@ -229,7 +230,8 @@ class CPTUI_Debug_Info {
229
  * @param string $value Intended email subject.
230
  */
231
  $subject = apply_filters( 'cptui_debug_email_subject', sprintf(
232
- __( 'CPTUI debug information for %s', 'custom-post-type-ui' ),
 
233
  home_url( '/' )
234
  ) );
235
 
6
  * @subpackage Debugging
7
  * @author WebDevStudios
8
  * @since 1.2.0
9
+ * @license GPL-2.0+
10
  */
11
 
12
  /**
146
  echo "\n";
147
  $cptui_post_types = cptui_get_post_type_data();
148
  echo "\t\t" . 'Post Types: ' . "\n";
149
+ echo "\t\t" . json_encode( $cptui_post_types ) . "\n";
150
 
151
  echo "\n\n";
152
 
153
  $cptui_taxonomies = cptui_get_taxonomy_data();
154
  echo "\t\t" . 'Taxonomies: ' . "\n";
155
+ echo "\t\t" . json_encode( $cptui_taxonomies ) . "\n";
156
  echo "\n";
157
 
158
  if ( has_action( 'cptui_custom_debug_info' ) ) {
230
  * @param string $value Intended email subject.
231
  */
232
  $subject = apply_filters( 'cptui_debug_email_subject', sprintf(
233
+ // translators: Placeholder will hold site home_url.
234
+ __( 'Custom Post Type UI debug information for %s', 'custom-post-type-ui' ),
235
  home_url( '/' )
236
  ) );
237
 
css/cptui.css CHANGED
@@ -39,7 +39,7 @@
39
  width: auto;
40
  }
41
 
42
- .cptui-table td.outter {
43
  vertical-align: top;
44
  width: 50%;
45
  }
@@ -63,15 +63,19 @@
63
  margin-top: 15px;
64
  }
65
 
66
- .cptui-table #slugchanged {
67
  color: red;
68
  font-weight: bold;
69
  }
70
 
71
- .cptui-table #slugchanged.hidemessage {
72
  display: none;
73
  }
74
 
 
 
 
 
75
  .cptui-support #support .question {
76
  font-size: 18px;
77
  font-weight: bold;
@@ -377,7 +381,7 @@ fieldset .cptui-help {
377
  min-width: 463px;
378
  }
379
 
380
- @media screen and (min-width: 768px) {
381
  .cptui-badge {
382
  padding-top: 142px;
383
  height: 50px;
@@ -408,4 +412,11 @@ fieldset .cptui-help {
408
  .wdspromos-about p:nth-child(4) {
409
  padding-right: 5px;
410
  }
 
 
 
 
 
 
 
411
  }
39
  width: auto;
40
  }
41
 
42
+ .cptui-table td.outer {
43
  vertical-align: top;
44
  width: 50%;
45
  }
63
  margin-top: 15px;
64
  }
65
 
66
+ .cptui-table #slugchanged, .cptui-table #slugexists {
67
  color: red;
68
  font-weight: bold;
69
  }
70
 
71
+ .cptui-table #slugchanged.hidemessage, .cptui-table #slugexists.hidemessage {
72
  display: none;
73
  }
74
 
75
+ .cpt-ui_page_cptui_tools .cptui-table .outer p {
76
+ padding: 0 4px;
77
+ }
78
+
79
  .cptui-support #support .question {
80
  font-size: 18px;
81
  font-weight: bold;
381
  min-width: 463px;
382
  }
383
 
384
+ @media screen and (min-width: 769px) {
385
  .cptui-badge {
386
  padding-top: 142px;
387
  height: 50px;
412
  .wdspromos-about p:nth-child(4) {
413
  padding-right: 5px;
414
  }
415
+ .cptui-table td.outer {
416
+ width: 100%;
417
+ }
418
+ #cptui-audit-textarea,
419
+ #cptui_debug_info_email {
420
+ width: 100%;
421
+ }
422
  }
css/cptui.min.css CHANGED
@@ -1 +1 @@
1
- .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outter{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage{display:none}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical;width:100%}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-section fieldset{border:1px solid #ccc;display:block;margin-bottom:30px;padding:10px;overflow:hidden}.js .cptui-section fieldset.toggledclosed{height:1px}.cptui-section legend{border:1px solid #ccc;border-bottom:0;font-size:14px;font-weight:700;padding:5px}.cptui-spacer{display:block;margin-top:25px}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos #mc_embed_signup{background:#fff;border:1px solid #ccc;clear:left;margin-bottom:10px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:768px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}}
1
+ .posttypesui,.taxonomiesui{width:calc(100% - 300px)}.posttypesui .cptui-section:first-child,.taxonomiesui .cptui-section:first-child{margin-top:30px}.posttypesui .postbox-container,.taxonomiesui .postbox-container{width:100%}.posttypesui .postbox .toggle-indicator:before,.taxonomiesui .postbox .toggle-indicator:before{content:"\f142";display:inline-block;font:normal 20px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.posttypesui .postbox.closed .handlediv .toggle-indicator:before,.taxonomiesui .postbox.closed .handlediv .toggle-indicator:before{content:"\f140"}.posttypesui .postbox .hndle,.taxonomiesui .postbox .hndle{cursor:pointer}.posttypesui .required,.taxonomiesui .required{color:red}.cptui-table #excerpt{display:inline-block;height:16px;margin:12px 4px 12px 0;width:auto}.cptui-table td.outer{vertical-align:top;width:50%}.cptui-edit .cptui-table textarea,.cptui-new .cptui-table textarea,.cptui-table input[type=text]{width:75%}.cptui-table .question:hover{cursor:pointer}.cptui-table th p{font-weight:400;font-size:12px}.cptui-table .cptui-slug-details{margin-top:15px}.cptui-table #slugchanged,.cptui-table #slugexists{color:red;font-weight:700}.cptui-table #slugchanged.hidemessage,.cptui-table #slugexists.hidemessage{display:none}.cpt-ui_page_cptui_tools .cptui-table .outer p{padding:0 4px}.cptui-support #support .question{font-size:18px;font-weight:700}.cptui-support #support .question:before{content:"\f139";display:inline-block;font:normal 25px/1 dashicons;margin-left:-25px;position:absolute;-webkit-font-smoothing:antialiased}.cptui-support #support .question.active:before{content:"\f140"}.cptui-support #support .answer{margin:10px 0 0 20px}.cptui-support #support ol li{list-style:none}.cptui-support #support li{position:relative}.cptui-field-description{font-style:italic}#cptui_select_post_type,#cptui_select_taxonomy{margin-top:15px}.cptui_post_import,.cptui_tax_import{height:200px;margin-bottom:10px;resize:vertical;width:100%}.cptui_post_type_get_code,.cptui_tax_get_code{height:300px;resize:vertical;width:100%}.about-wrap .cptui-feature{overflow:visible!important;*zoom:1}.about-wrap .cptui-feature:after,.about-wrap .cptui-feature:before{content:" ";display:table}.about-wrap .cptui-feature:after{clear:both}.about-wrap h3+.cptui-feature{margin-top:0}.about-wrap .changelog h2{text-align:center}.about-wrap .feature-rest div{width:50%!important;padding-right:100px;box-sizing:border-box;margin:0!important}.about-wrap .feature-rest div.last-feature{padding-left:100px;padding-right:0}.about-wrap .feature-rest div.icon{width:0!important;padding:0;margin:0}.about-wrap .feature-rest div.icon:before{font-weight:400;width:100%;font-size:170px;line-height:125px;color:#9c5d90;display:inline-block;position:relative;text-align:center;speak:none;margin:0 0 0 -100px;content:"\e01d";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.rtl .about-wrap .feature-rest div{padding-left:100px}.rtl .about-wrap .feature-rest div.last-feature{padding-right:100px;padding-left:0}.rtl .about-wrap .feature-rest div.icon:before{margin:0 -100px 0 0}.about-wrap .about-integrations{background:#fff;margin:20px 0;padding:1px 20px 10px}.about-wrap .changelog h4{line-height:1.4}.about-wrap .cptui-about-text{margin-bottom:1em!important}.about-wrap .cptui-badge{position:absolute;top:0;right:0}#togglelabels{display:none}.js #togglelabels{display:inline-block}.cptui-help{color:#424242;margin-left:4px;opacity:.5;text-decoration:none;width:16px}fieldset .cptui-help{position:relative;top:4px}.cptui-help:hover{color:#0074a2;opacity:1}.cptui-help:focus{box-shadow:none}#toplevel_page_cptui_main_menu img{height:20px;margin-top:-2px;width:20px}.visuallyhidden{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.cptui-section fieldset{border:1px solid #ccc;display:block;margin-bottom:30px;padding:10px;overflow:hidden}.js .cptui-section fieldset.toggledclosed{height:1px}.cptui-section legend{border:1px solid #ccc;border-bottom:0;font-size:14px;font-weight:700;padding:5px}.cptui-spacer{display:block;margin-top:25px}.wdspromos{float:right;margin-left:20px;margin-top:10px;width:275px}.wdspromos #mc_embed_signup{background:#fff;border:1px solid #ccc;clear:left;margin-bottom:10px}.wdspromos-about{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-align:start;align-items:flex-start;margin:20px 0}.wdspromos-about a:first-child,.wdspromos-about a:nth-child(2),.wdspromos-about a:nth-child(3){-ms-flex-order:0;order:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:auto;-ms-grid-row-align:auto;align-self:auto}.wdspromos-about p{padding:0 5px}.wdspromos-about p:first-child{padding-left:0}.wdspromos-about p:nth-child(4){padding-right:0}.no-js #cptui_choose_icon{display:none}.cptui-listings th{font-weight:700}.cptui-listings .post-type-listing th{width:16.66667%}.cptui-listings .taxonomy-listing th{width:20%}#poststuff{min-width:463px}@media screen and (min-width:769px){.cptui-badge{padding-top:142px;height:50px;width:173px;color:#fafafa;font-weight:700;font-size:14px;text-align:center;margin:0 -5px;background:url(../images/cptui-icon-173x173.png) no-repeat}}@media screen and (max-width:768px){.cptui-table #description{width:100%}.wdspromos-about{-ms-flex-wrap:wrap;flex-wrap:wrap}.wdspromos-about p{margin:5px auto}.wdspromos-about p:first-child{padding-left:5px}.wdspromos-about p:nth-child(4){padding-right:5px}#cptui-audit-textarea,#cptui_debug_info_email,.cptui-table td.outer{width:100%}}
css/cptui.scss CHANGED
@@ -1,4 +1,4 @@
1
- $min-tablet: "screen and (min-width: 768px)";
2
  $max-tablet: "screen and (max-width: 768px)";
3
 
4
  .posttypesui, .taxonomiesui {
@@ -35,7 +35,7 @@ $max-tablet: "screen and (max-width: 768px)";
35
  margin: 12px 4px 12px 0;
36
  width: auto;
37
  }
38
- td.outter {
39
  vertical-align: top;
40
  width: 50%;
41
  }
@@ -55,7 +55,7 @@ $max-tablet: "screen and (max-width: 768px)";
55
  margin-top: 15px;
56
  }
57
 
58
- #slugchanged {
59
  color: red;
60
  font-weight: bold;
61
  &.hidemessage {
@@ -63,6 +63,15 @@ $max-tablet: "screen and (max-width: 768px)";
63
  }
64
  }
65
  }
 
 
 
 
 
 
 
 
 
66
 
67
  .cptui-support #support {
68
  .question {
@@ -330,15 +339,14 @@ $max-tablet: "screen and (max-width: 768px)";
330
  -ms-flex-item-align: auto;
331
  align-self: auto;
332
  }
333
-
334
  p {
335
- padding: 0 5px;
336
- &:nth-child(1) {
337
- padding-left: 0px;
338
- }
339
- &:nth-child(4) {
340
- padding-right: 0px;
341
- }
342
  }
343
  }
344
  .no-js {
@@ -381,9 +389,9 @@ $max-tablet: "screen and (max-width: 768px)";
381
 
382
  @media #{$max-tablet} {
383
  .cptui-table {
384
- #description {
385
- width: 100%;
386
- }
387
  }
388
  .wdspromos-about {
389
  flex-wrap: wrap;
@@ -397,4 +405,13 @@ $max-tablet: "screen and (max-width: 768px)";
397
  }
398
  }
399
  }
 
 
 
 
 
 
 
 
 
400
  }
1
+ $min-tablet: "screen and (min-width: 769px)";
2
  $max-tablet: "screen and (max-width: 768px)";
3
 
4
  .posttypesui, .taxonomiesui {
35
  margin: 12px 4px 12px 0;
36
  width: auto;
37
  }
38
+ td.outer {
39
  vertical-align: top;
40
  width: 50%;
41
  }
55
  margin-top: 15px;
56
  }
57
 
58
+ #slugchanged, #slugexists {
59
  color: red;
60
  font-weight: bold;
61
  &.hidemessage {
63
  }
64
  }
65
  }
66
+ .cpt-ui_page_cptui_tools {
67
+ .cptui-table {
68
+ .outer {
69
+ p {
70
+ padding: 0 4px;
71
+ }
72
+ }
73
+ }
74
+ }
75
 
76
  .cptui-support #support {
77
  .question {
339
  -ms-flex-item-align: auto;
340
  align-self: auto;
341
  }
 
342
  p {
343
+ padding: 0 5px;
344
+ &:nth-child(1) {
345
+ padding-left: 0px;
346
+ }
347
+ &:nth-child(4) {
348
+ padding-right: 0px;
349
+ }
350
  }
351
  }
352
  .no-js {
389
 
390
  @media #{$max-tablet} {
391
  .cptui-table {
392
+ #description {
393
+ width: 100%;
394
+ }
395
  }
396
  .wdspromos-about {
397
  flex-wrap: wrap;
405
  }
406
  }
407
  }
408
+ .cptui-table {
409
+ td.outer {
410
+ width: 100%;
411
+ }
412
+ }
413
+ #cptui-audit-textarea,
414
+ #cptui_debug_info_email {
415
+ width: 100%;
416
+ }
417
  }
custom-post-type-ui.php CHANGED
@@ -1,859 +1,959 @@
1
- <?php
2
- /**
3
- * Custom Post Type UI.
4
- *
5
- * For all your post type and taxonomy needs.
6
- *
7
- * @package CPTUI
8
- * @subpackage Loader
9
- * @author WebDevStudios
10
- * @since 0.1.0.0
11
- */
12
-
13
- /*
14
- Plugin Name: Custom Post Type UI
15
- Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
- Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
- Author: WebDevStudios
18
- Version: 1.5.8
19
- Author URI: https://webdevstudios.com/
20
- Text Domain: custom-post-type-ui
21
- Domain Path: /languages
22
- License: GPLv2
23
- */
24
-
25
- // Exit if accessed directly.
26
- if ( ! defined( 'ABSPATH' ) ) {
27
- exit;
28
- }
29
-
30
- define( 'CPT_VERSION', '1.5.8' ); // Left for legacy purposes.
31
- define( 'CPTUI_VERSION', '1.5.8' );
32
- define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
-
34
- /**
35
- * Load our Admin UI class that powers our form inputs.
36
- *
37
- * @since 1.0.0
38
- *
39
- * @internal
40
- */
41
- function cptui_load_ui_class() {
42
- require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_admin_ui.php' );
43
- require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_debug_info.php' );
44
- }
45
- add_action( 'init', 'cptui_load_ui_class' );
46
-
47
- /**
48
- * Set a transient used for redirection upon activation.
49
- *
50
- * @since 1.4.0
51
- */
52
- function cptui_activation_redirect() {
53
- // Bail if activating from network, or bulk.
54
- if ( is_network_admin() ) {
55
- return;
56
- }
57
-
58
- // Add the transient to redirect.
59
- set_transient( 'cptui_activation_redirect', true, 30 );
60
- }
61
- add_action( 'activate_' . plugin_basename( __FILE__ ), 'cptui_activation_redirect' );
62
-
63
- /**
64
- * Redirect user to CPTUI about page upon plugin activation.
65
- *
66
- * @since 1.4.0
67
- */
68
- function cptui_make_activation_redirect() {
69
-
70
- if ( ! get_transient( 'cptui_activation_redirect' ) ) {
71
- return;
72
- }
73
-
74
- delete_transient( 'cptui_activation_redirect' );
75
-
76
- // Bail if activating from network, or bulk.
77
- if ( is_network_admin() ) {
78
- return;
79
- }
80
-
81
- if ( ! cptui_is_new_install() ) {
82
- return;
83
- }
84
-
85
- // Redirect to CPTUI about page.
86
- wp_safe_redirect(
87
- add_query_arg(
88
- array( 'page' => 'cptui_main_menu' ),
89
- cptui_admin_url( 'admin.php?page=cptui_main_menu' )
90
- )
91
- );
92
- }
93
- add_action( 'admin_init', 'cptui_make_activation_redirect', 1 );
94
-
95
- /**
96
- * Flush our rewrite rules on deactivation.
97
- *
98
- * @since 0.8.0
99
- *
100
- * @internal
101
- */
102
- function cptui_deactivation() {
103
- flush_rewrite_rules();
104
- }
105
- register_deactivation_hook( __FILE__, 'cptui_deactivation' );
106
-
107
- /**
108
- * Register our text domain.
109
- *
110
- * @since 0.8.0
111
- *
112
- * @internal
113
- */
114
- function cptui_load_textdomain() {
115
- load_plugin_textdomain( 'custom-post-type-ui' );
116
- }
117
- add_action( 'plugins_loaded', 'cptui_load_textdomain' );
118
-
119
- /**
120
- * Load our main menu.
121
- *
122
- * Submenu items added in version 1.1.0
123
- *
124
- * @since 0.1.0
125
- *
126
- * @internal
127
- */
128
- function cptui_plugin_menu() {
129
-
130
- /**
131
- * Filters the required capability to manage CPTUI settings.
132
- *
133
- * @since 1.3.0
134
- *
135
- * @param string $value Capability required.
136
- */
137
- $capability = apply_filters( 'cptui_required_capabilities', 'manage_options' );
138
- $parent_slug = 'cptui_main_menu';
139
-
140
- add_menu_page( __( 'Custom Post Types', 'custom-post-type-ui' ), __( 'CPT UI', 'custom-post-type-ui' ), $capability, $parent_slug, 'cptui_settings', cptui_menu_icon() );
141
- add_submenu_page( $parent_slug, __( 'Add/Edit Post Types', 'custom-post-type-ui' ), __( 'Add/Edit Post Types', 'custom-post-type-ui' ), $capability, 'cptui_manage_post_types', 'cptui_manage_post_types' );
142
- add_submenu_page( $parent_slug, __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), $capability, 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
143
- add_submenu_page( $parent_slug, __( 'Registered Types and Taxes', 'custom-post-type-ui' ), __( 'Registered Types/Taxes', 'custom-post-type-ui' ), $capability, 'cptui_listings', 'cptui_listings' );
144
- add_submenu_page( $parent_slug, __( 'Custom Post Type UI Tools', 'custom-post-type-ui' ), __( 'Tools', 'custom-post-type-ui' ), $capability, 'cptui_tools', 'cptui_tools' );
145
- add_submenu_page( $parent_slug, __( 'Help/Support', 'custom-post-type-ui' ), __( 'Help/Support', 'custom-post-type-ui' ), $capability, 'cptui_support', 'cptui_support' );
146
-
147
- /**
148
- * Fires after the default submenu pages.
149
- *
150
- * @since 1.3.0
151
- *
152
- * @param string $value Parent slug for Custom Post Type UI menu.
153
- * @param string $capability Capability required to manage CPTUI settings.
154
- */
155
- do_action( 'cptui_extra_menu_items', $parent_slug, $capability );
156
-
157
- // Remove the default one so we can add our customized version.
158
- remove_submenu_page( $parent_slug, 'cptui_main_menu' );
159
- add_submenu_page( $parent_slug, __( 'About CPT UI', 'custom-post-type-ui' ), __( 'About CPT UI', 'custom-post-type-ui' ), $capability, 'cptui_main_menu', 'cptui_settings' );
160
- }
161
- add_action( 'admin_menu', 'cptui_plugin_menu' );
162
-
163
- /**
164
- * Fire our CPTUI Loaded hook.
165
- *
166
- * @since 1.3.0
167
- *
168
- * @internal Use `cptui_loaded` hook.
169
- */
170
- function cptui_loaded() {
171
-
172
- /**
173
- * Fires upon plugins_loaded WordPress hook.
174
- *
175
- * CPTUI loads its required files on this hook.
176
- *
177
- * @since 1.3.0
178
- */
179
- do_action( 'cptui_loaded' );
180
- }
181
- add_action( 'plugins_loaded', 'cptui_loaded' );
182
-
183
- /**
184
- * Load our submenus.
185
- *
186
- * @since 1.0.0
187
- *
188
- * @internal
189
- */
190
- function cptui_create_submenus() {
191
- require_once( plugin_dir_path( __FILE__ ) . 'inc/about.php' );
192
- require_once( plugin_dir_path( __FILE__ ) . 'inc/utility.php' );
193
- require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
194
- require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
195
- require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
196
- require_once( plugin_dir_path( __FILE__ ) . 'inc/tools.php' );
197
- require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
198
- }
199
- add_action( 'cptui_loaded', 'cptui_create_submenus' );
200
-
201
- /**
202
- * Fire our CPTUI init hook.
203
- *
204
- * @since 1.3.0
205
- *
206
- * @internal Use `cptui_init` hook.
207
- */
208
- function cptui_init() {
209
-
210
- /**
211
- * Fires upon init WordPress hook.
212
- *
213
- * @since 1.3.0
214
- */
215
- do_action( 'cptui_init' );
216
- }
217
- add_action( 'init', 'cptui_init' );
218
-
219
- /**
220
- * Enqueue CPTUI admin styles.
221
- *
222
- * @since 1.0.0
223
- *
224
- * @internal
225
- */
226
- function cptui_add_styles() {
227
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
228
- return;
229
- }
230
-
231
- $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
232
- wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery', 'postbox' ), CPTUI_VERSION, true );
233
- wp_enqueue_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
234
- }
235
- add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
236
-
237
- /**
238
- * Register our users' custom post types.
239
- *
240
- * @since 0.5.0
241
- *
242
- * @internal
243
- */
244
- function cptui_create_custom_post_types() {
245
- $cpts = get_option( 'cptui_post_types' );
246
-
247
- if ( empty( $cpts ) ) {
248
- return;
249
- }
250
-
251
- /**
252
- * Fires before the start of the post type registrations.
253
- *
254
- * @since 1.3.0
255
- *
256
- * @param array $cpts Array of post types to register.
257
- */
258
- do_action( 'cptui_pre_register_post_types', $cpts );
259
-
260
- if ( is_array( $cpts ) ) {
261
- foreach ( $cpts as $post_type ) {
262
- cptui_register_single_post_type( $post_type );
263
- }
264
- }
265
-
266
- /**
267
- * Fires after the completion of the post type registrations.
268
- *
269
- * @since 1.3.0
270
- *
271
- * @param array $cpts Array of post types registered.
272
- */
273
- do_action( 'cptui_post_register_post_types', $cpts );
274
- }
275
- add_action( 'init', 'cptui_create_custom_post_types', 10 ); // Leave on standard init for legacy purposes.
276
-
277
- /**
278
- * Helper function to register the actual post_type.
279
- *
280
- * @since 1.0.0
281
- *
282
- * @internal
283
- *
284
- * @param array $post_type Post type array to register. Optional.
285
- * @return null Result of register_post_type.
286
- */
287
- function cptui_register_single_post_type( $post_type = array() ) {
288
-
289
- /**
290
- * Filters the map_meta_cap value.
291
- *
292
- * @since 1.0.0
293
- *
294
- * @param bool $value True.
295
- * @param string $name Post type name being registered.
296
- * @param array $post_type All parameters for post type registration.
297
- */
298
- $post_type['map_meta_cap'] = apply_filters( 'cptui_map_meta_cap', true, $post_type['name'], $post_type );
299
-
300
- /**
301
- * Filters custom supports parameters for 3rd party plugins.
302
- *
303
- * @since 1.0.0
304
- *
305
- * @param array $value Empty array to add supports keys to.
306
- * @param string $name Post type slug being registered.
307
- * @param array $post_type Array of post type arguments to be registered.
308
- */
309
- $user_supports_params = apply_filters( 'cptui_user_supports_params', array(), $post_type['name'], $post_type );
310
-
311
- if ( is_array( $user_supports_params ) && ! empty( $user_supports_params ) ) {
312
- if ( is_array( $post_type['supports'] ) ) {
313
- $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
314
- } else {
315
- $post_type['supports'] = array( $user_supports_params );
316
- }
317
- }
318
-
319
- $yarpp = false; // Prevent notices.
320
- if ( ! empty( $post_type['custom_supports'] ) ) {
321
- $custom = explode( ',', $post_type['custom_supports'] );
322
- foreach ( $custom as $part ) {
323
- // We'll handle YARPP separately.
324
- if ( in_array( $part, array( 'YARPP', 'yarpp' ) ) ) {
325
- $yarpp = true;
326
- continue;
327
- }
328
- $post_type['supports'][] = trim( $part );
329
- }
330
- }
331
-
332
- if ( in_array( 'none', $post_type['supports'] ) ) {
333
- $post_type['supports'] = false;
334
- }
335
-
336
- $labels = array(
337
- 'name' => $post_type['label'],
338
- 'singular_name' => $post_type['singular_label'],
339
- );
340
-
341
- $preserved = cptui_get_preserved_keys( 'post_types' );
342
- foreach ( $post_type['labels'] as $key => $label ) {
343
-
344
- if ( ! empty( $label ) ) {
345
- if ( 'parent' === $key ) {
346
- $labels['parent_item_colon'] = $label;
347
- } else {
348
- $labels[ $key ] = $label;
349
- }
350
- } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
351
- $labels[ $key ] = cptui_get_preserved_label( 'post_types', $key, $post_type['label'], $post_type['singular_label'] );
352
- }
353
- }
354
-
355
- $has_archive = get_disp_boolean( $post_type['has_archive'] );
356
- if ( ! empty( $post_type['has_archive_string'] ) ) {
357
- $has_archive = $post_type['has_archive_string'];
358
- }
359
-
360
- $show_in_menu = get_disp_boolean( $post_type['show_in_menu'] );
361
- if ( ! empty( $post_type['show_in_menu_string'] ) ) {
362
- $show_in_menu = $post_type['show_in_menu_string'];
363
- }
364
-
365
- $rewrite = get_disp_boolean( $post_type['rewrite'] );
366
- if ( false !== $rewrite ) {
367
- // Core converts to an empty array anyway, so safe to leave this instead of passing in boolean true.
368
- $rewrite = array();
369
- $rewrite['slug'] = ( ! empty( $post_type['rewrite_slug'] ) ) ? $post_type['rewrite_slug'] : $post_type['name'];
370
-
371
- $rewrite['with_front'] = true; // Default value.
372
- if ( isset( $post_type['rewrite_withfront'] ) ) {
373
- $rewrite['with_front'] = ( 'false' === disp_boolean( $post_type['rewrite_withfront'] ) ) ? false : true;
374
- }
375
- }
376
-
377
- $menu_icon = ( ! empty( $post_type['menu_icon'] ) ) ? $post_type['menu_icon'] : null;
378
-
379
- if ( in_array( $post_type['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
380
- $post_type['query_var'] = get_disp_boolean( $post_type['query_var'] );
381
- }
382
- if ( ! empty( $post_type['query_var_slug'] ) ) {
383
- $post_type['query_var'] = $post_type['query_var_slug'];
384
- }
385
-
386
- $menu_position = null;
387
- if ( ! empty( $post_type['menu_position'] ) ) {
388
- $menu_position = (int) $post_type['menu_position'];
389
- }
390
-
391
- $public = get_disp_boolean( $post_type['public'] );
392
- if ( ! empty( $post_type['exclude_from_search'] ) ) {
393
- $exclude_from_search = get_disp_boolean( $post_type['exclude_from_search'] );
394
- } else {
395
- $exclude_from_search = ( false === $public ) ? true : false;
396
- }
397
-
398
- $queryable = ( ! empty( $post_type['publicly_queryable'] ) && isset( $post_type['publicly_queryable'] ) ) ? get_disp_boolean( $post_type['publicly_queryable'] ) : $public;
399
-
400
- if ( empty( $post_type['show_in_nav_menus'] ) ) {
401
- // Defaults to value of public.
402
- $post_type['show_in_nav_menus'] = $public;
403
- }
404
-
405
- if ( empty( $post_type['show_in_rest'] ) ) {
406
- $post_type['show_in_rest'] = false;
407
- }
408
-
409
- $rest_base = null;
410
- if ( ! empty( $post_type['rest_base'] ) ) {
411
- $rest_base = $post_type['rest_base'];
412
- }
413
-
414
- $args = array(
415
- 'labels' => $labels,
416
- 'description' => $post_type['description'],
417
- 'public' => get_disp_boolean( $post_type['public'] ),
418
- 'publicly_queryable' => $queryable,
419
- 'show_ui' => get_disp_boolean( $post_type['show_ui'] ),
420
- 'show_in_nav_menus' => get_disp_boolean( $post_type['show_in_nav_menus'] ),
421
- 'has_archive' => $has_archive,
422
- 'show_in_menu' => $show_in_menu,
423
- 'show_in_rest' => get_disp_boolean( $post_type['show_in_rest'] ),
424
- 'rest_base' => $rest_base,
425
- 'exclude_from_search' => $exclude_from_search,
426
- 'capability_type' => $post_type['capability_type'],
427
- 'map_meta_cap' => $post_type['map_meta_cap'],
428
- 'hierarchical' => get_disp_boolean( $post_type['hierarchical'] ),
429
- 'rewrite' => $rewrite,
430
- 'menu_position' => $menu_position,
431
- 'menu_icon' => $menu_icon,
432
- 'query_var' => $post_type['query_var'],
433
- 'supports' => $post_type['supports'],
434
- 'taxonomies' => $post_type['taxonomies'],
435
- );
436
-
437
- if ( true === $yarpp ) {
438
- $args['yarpp_support'] = $yarpp;
439
- }
440
-
441
- /**
442
- * Filters the arguments used for a post type right before registering.
443
- *
444
- * @since 1.0.0
445
- * @since 1.3.0 Added original passed in values array
446
- *
447
- * @param array $args Array of arguments to use for registering post type.
448
- * @param string $value Post type slug to be registered.
449
- * @param array $post_type Original passed in values for post type.
450
- */
451
- $args = apply_filters( 'cptui_pre_register_post_type', $args, $post_type['name'], $post_type );
452
-
453
- return register_post_type( $post_type['name'], $args );
454
- }
455
-
456
- /**
457
- * Register our users' custom taxonomies.
458
- *
459
- * @since 0.5.0
460
- *
461
- * @internal
462
- */
463
- function cptui_create_custom_taxonomies() {
464
- $taxes = get_option( 'cptui_taxonomies' );
465
-
466
- if ( empty( $taxes ) ) {
467
- return;
468
- }
469
-
470
- /**
471
- * Fires before the start of the taxonomy registrations.
472
- *
473
- * @since 1.3.0
474
- *
475
- * @param array $taxes Array of taxonomies to register.
476
- */
477
- do_action( 'cptui_pre_register_taxonomies', $taxes );
478
-
479
- if ( is_array( $taxes ) ) {
480
- foreach ( $taxes as $tax ) {
481
- cptui_register_single_taxonomy( $tax );
482
- }
483
- }
484
-
485
- /**
486
- * Fires after the completion of the taxonomy registrations.
487
- *
488
- * @since 1.3.0
489
- *
490
- * @param array $taxes Array of taxonomies registered.
491
- */
492
- do_action( 'cptui_post_register_taxonomies', $taxes );
493
- }
494
- add_action( 'init', 'cptui_create_custom_taxonomies', 9 ); // Leave on standard init for legacy purposes.
495
-
496
- /**
497
- * Helper function to register the actual taxonomy.
498
- *
499
- * @since 1.0.0
500
- *
501
- * @internal
502
- *
503
- * @param array $taxonomy Taxonomy array to register. Optional.
504
- * @return null Result of register_taxonomy.
505
- */
506
- function cptui_register_single_taxonomy( $taxonomy = array() ) {
507
-
508
- $labels = array(
509
- 'name' => $taxonomy['label'],
510
- 'singular_name' => $taxonomy['singular_label'],
511
- );
512
-
513
- $description = '';
514
- if ( ! empty( $taxonomy['description'] ) ) {
515
- $description = $taxonomy['description'];
516
- }
517
-
518
- $preserved = cptui_get_preserved_keys( 'taxonomies' );
519
- foreach ( $taxonomy['labels'] as $key => $label ) {
520
-
521
- if ( ! empty( $label ) ) {
522
- $labels[ $key ] = $label;
523
- } elseif ( empty( $label ) && in_array( $key, $preserved ) ) {
524
- $labels[ $key ] = cptui_get_preserved_label( 'taxonomies', $key, $taxonomy['label'], $taxonomy['singular_label'] );
525
- }
526
- }
527
-
528
- $rewrite = get_disp_boolean( $taxonomy['rewrite'] );
529
- if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
530
- $rewrite = array();
531
- $rewrite['slug'] = ( ! empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
532
- $rewrite['with_front'] = true;
533
- if ( isset( $taxonomy['rewrite_withfront'] ) ) {
534
- $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
535
- }
536
- $rewrite['hierarchical'] = false;
537
- if ( isset( $taxonomy['rewrite_hierarchical'] ) ) {
538
- $rewrite['hierarchical'] = ( 'true' === disp_boolean( $taxonomy['rewrite_hierarchical'] ) ) ? true : false;
539
- }
540
- }
541
-
542
- if ( in_array( $taxonomy['query_var'], array( 'true', 'false', '0', '1' ) ) ) {
543
- $taxonomy['query_var'] = get_disp_boolean( $taxonomy['query_var'] );
544
- }
545
- if ( true === $taxonomy['query_var'] && ! empty( $taxonomy['query_var_slug'] ) ) {
546
- $taxonomy['query_var'] = $taxonomy['query_var_slug'];
547
- }
548
-
549
- $public = ( ! empty( $taxonomy['public'] ) && false === get_disp_boolean( $taxonomy['public'] ) ) ? false : true;
550
-
551
- $show_admin_column = ( ! empty( $taxonomy['show_admin_column'] ) && false !== get_disp_boolean( $taxonomy['show_admin_column'] ) ) ? true : false;
552
-
553
- $show_in_menu = ( ! empty( $taxonomy['show_in_menu'] ) && false !== get_disp_boolean( $taxonomy['show_in_menu'] ) ) ? true : false;
554
-
555
- if ( empty( $taxonomy['show_in_menu'] ) ) {
556
- $show_in_menu = get_disp_boolean( $taxonomy['show_ui'] );
557
- }
558
-
559
- $show_in_nav_menus = ( ! empty( $taxonomy['show_in_nav_menus'] ) && false !== get_disp_boolean( $taxonomy['show_in_nav_menus'] ) ) ? true : false;
560
- if ( empty( $taxonomy['show_in_nav_menus'] ) ) {
561
- $show_in_nav_menus = $public;
562
- }
563
-
564
- $show_in_rest = ( ! empty( $taxonomy['show_in_rest'] ) && false !== get_disp_boolean( $taxonomy['show_in_rest'] ) ) ? true : false;
565
-
566
- $show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
567
-
568
- $rest_base = null;
569
- if ( ! empty( $taxonomy['rest_base'] ) ) {
570
- $rest_base = $taxonomy['rest_base'];
571
- }
572
-
573
- $args = array(
574
- 'labels' => $labels,
575
- 'label' => $taxonomy['label'],
576
- 'description' => $description,
577
- 'public' => $public,
578
- 'hierarchical' => get_disp_boolean( $taxonomy['hierarchical'] ),
579
- 'show_ui' => get_disp_boolean( $taxonomy['show_ui'] ),
580
- 'show_in_menu' => $show_in_menu,
581
- 'show_in_nav_menus' => $show_in_nav_menus,
582
- 'query_var' => $taxonomy['query_var'],
583
- 'rewrite' => $rewrite,
584
- 'show_admin_column' => $show_admin_column,
585
- 'show_in_rest' => $show_in_rest,
586
- 'rest_base' => $rest_base,
587
- 'show_in_quick_edit' => $show_in_quick_edit,
588
- );
589
-
590
- $object_type = ( ! empty( $taxonomy['object_types'] ) ) ? $taxonomy['object_types'] : '';
591
-
592
- /**
593
- * Filters the arguments used for a taxonomy right before registering.
594
- *
595
- * @since 1.0.0
596
- * @since 1.3.0 Added original passed in values array
597
- *
598
- * @param array $args Array of arguments to use for registering taxonomy.
599
- * @param string $value Taxonomy slug to be registered.
600
- * @param array $taxonomy Original passed in values for taxonomy.
601
- */
602
- $args = apply_filters( 'cptui_pre_register_taxonomy', $args, $taxonomy['name'], $taxonomy );
603
-
604
- return register_taxonomy( $taxonomy['name'], $object_type, $args );
605
- }
606
-
607
- /**
608
- * Construct and output tab navigation.
609
- *
610
- * @since 1.0.0
611
- *
612
- * @param string $page Whether it's the CPT or Taxonomy page. Optional. Default "post_types".
613
- */
614
- function cptui_settings_tab_menu( $page = 'post_types' ) {
615
-
616
- /**
617
- * Filters the tabs to render on a given page.
618
- *
619
- * @since 1.3.0
620
- *
621
- * @param array $value Array of tabs to render.
622
- * @param string $page Current page being displayed.
623
- */
624
- $tabs = (array) apply_filters( 'cptui_get_tabs', array(), $page );
625
-
626
- if ( ! empty( $tabs['page_title'] ) ) {
627
- printf(
628
- '<h1>%s</h1><h2 class="nav-tab-wrapper">',
629
- $tabs['page_title']
630
- );
631
- }
632
-
633
- foreach ( $tabs['tabs'] as $tab ) {
634
- printf(
635
- '<a class="%s" href="%s" aria-selected="%s">%s</a>',
636
- implode( ' ', $tab['classes'] ),
637
- $tab['url'],
638
- $tab['aria-selected'],
639
- $tab['text']
640
- );
641
- }
642
-
643
- echo '</h2>';
644
- }
645
-
646
- /**
647
- * Convert our old settings to the new options keys.
648
- *
649
- * These are left with standard get_option/update_option function calls for legacy and pending update purposes.
650
- *
651
- * @since 1.0.0
652
- *
653
- * @internal
654
- *
655
- * @return bool Whether or not options were successfully updated.
656
- */
657
- function cptui_convert_settings() {
658
-
659
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
660
- return;
661
- }
662
-
663
- $retval = '';
664
-
665
- if ( false === get_option( 'cptui_post_types' ) && ( $post_types = get_option( 'cpt_custom_post_types' ) ) ) {
666
-
667
- $new_post_types = array();
668
- foreach ( $post_types as $type ) {
669
- $new_post_types[ $type['name'] ] = $type; // This one assigns the # indexes. Named arrays are our friend.
670
- $new_post_types[ $type['name'] ]['supports'] = ( ! empty( $type[0] ) ) ? $type[0] : array(); // Especially for multidimensional arrays.
671
- $new_post_types[ $type['name'] ]['taxonomies'] = ( ! empty( $type[1] ) ) ? $type[1] : array();
672
- $new_post_types[ $type['name'] ]['labels'] = ( ! empty( $type[2] ) ) ? $type[2] : array();
673
- unset(
674
- $new_post_types[ $type['name'] ][0],
675
- $new_post_types[ $type['name'] ][1],
676
- $new_post_types[ $type['name'] ][2]
677
- ); // Remove our previous indexed versions.
678
- }
679
-
680
- $retval = update_option( 'cptui_post_types', $new_post_types );
681
- }
682
-
683
- if ( false === get_option( 'cptui_taxonomies' ) && ( $taxonomies = get_option( 'cpt_custom_tax_types' ) ) ) {
684
-
685
- $new_taxonomies = array();
686
- foreach ( $taxonomies as $tax ) {
687
- $new_taxonomies[ $tax['name'] ] = $tax; // Yep, still our friend.
688
- $new_taxonomies[ $tax['name'] ]['labels'] = $tax[0]; // Taxonomies are the only thing with
689
- $new_taxonomies[ $tax['name'] ]['object_types'] = $tax[1]; // "tax" in the name that I like.
690
- unset(
691
- $new_taxonomies[ $tax['name'] ][0],
692
- $new_taxonomies[ $tax['name'] ][1]
693
- );
694
- }
695
-
696
- $retval = update_option( 'cptui_taxonomies', $new_taxonomies );
697
- }
698
-
699
- if ( ! empty( $retval ) ) {
700
- flush_rewrite_rules();
701
- }
702
-
703
- return $retval;
704
- }
705
- add_action( 'admin_init', 'cptui_convert_settings' );
706
-
707
- /**
708
- * Return a notice based on conditions.
709
- *
710
- * @since 1.0.0
711
- *
712
- * @param string $action The type of action that occurred. Optional. Default empty string.
713
- * @param string $object_type Whether it's from a post type or taxonomy. Optional. Default empty string.
714
- * @param bool $success Whether the action succeeded or not. Optional. Default true.
715
- * @param string $custom Custom message if necessary. Optional. Default empty string.
716
- * @return bool|string false on no message, else HTML div with our notice message.
717
- */
718
- function cptui_admin_notices( $action = '', $object_type = '', $success = true, $custom = '' ) {
719
-
720
- $class = array();
721
- $class[] = ( $success ) ? 'updated' : 'error';
722
- $class[] = 'notice is-dismissible';
723
- $object_type = esc_attr( $object_type );
724
-
725
- $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>';
726
- $message = '';
727
-
728
- $messagewrapend = '</p></div>';
729
-
730
- if ( 'add' == $action ) {
731
- if ( $success ) {
732
- $message .= sprintf( __( '%s has been successfully added', 'custom-post-type-ui' ), $object_type );
733
- } else {
734
- $message .= sprintf( __( '%s has failed to be added', 'custom-post-type-ui' ), $object_type );
735
- }
736
- } elseif ( 'update' == $action ) {
737
- if ( $success ) {
738
- $message .= sprintf( __( '%s has been successfully updated', 'custom-post-type-ui' ), $object_type );
739
- } else {
740
- $message .= sprintf( __( '%s has failed to be updated', 'custom-post-type-ui' ), $object_type );
741
- }
742
- } elseif ( 'delete' == $action ) {
743
- if ( $success ) {
744
- $message .= sprintf( __( '%s has been successfully deleted', 'custom-post-type-ui' ), $object_type );
745
- } else {
746
- $message .= sprintf( __( '%s has failed to be deleted', 'custom-post-type-ui' ), $object_type );
747
- }
748
- } elseif ( 'import' == $action ) {
749
- if ( $success ) {
750
- $message .= sprintf( __( '%s has been successfully imported', 'custom-post-type-ui' ), $object_type );
751
- } else {
752
- $message .= sprintf( __( '%s has failed to be imported', 'custom-post-type-ui' ), $object_type );
753
- }
754
- } elseif ( 'error' == $action ) {
755
- if ( ! empty( $custom ) ) {
756
- $message = $custom;
757
- }
758
- }
759
-
760
- if ( $message ) {
761
-
762
- /**
763
- * Filters the custom admin notice for CPTUI.
764
- *
765
- * @since 1.0.0
766
- *
767
- * @param string $value Complete HTML output for notice.
768
- * @param string $action Action whose message is being generated.
769
- * @param string $message The message to be displayed.
770
- * @param string $messagewrapstart Beginning wrap HTML.
771
- * @param string $messagewrapend Ending wrap HTML.
772
- */
773
- return apply_filters( 'cptui_admin_notice', $messagewrapstart . $message . $messagewrapend, $action, $message, $messagewrapstart, $messagewrapend );
774
- }
775
-
776
- return false;
777
- }
778
-
779
- /**
780
- * Return array of keys needing preserved.
781
- *
782
- * @since 1.0.5
783
- *
784
- * @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
785
- * @return array Array of keys needing preservered for the requested type.
786
- */
787
- function cptui_get_preserved_keys( $type = '' ) {
788
-
789
- $preserved_labels = array(
790
- 'post_types' => array(
791
- 'add_new_item',
792
- 'edit_item',
793
- 'new_item',
794
- 'view_item',
795
- 'all_items',
796
- 'search_items',
797
- 'not_found',
798
- 'not_found_in_trash',
799
- ),
800
- 'taxonomies' => array(
801
- 'search_items',
802
- 'popular_items',
803
- 'all_items',
804
- 'parent_item',
805
- 'parent_item_colon',
806
- 'edit_item',
807
- 'update_item',
808
- 'add_new_item',
809
- 'new_item_name',
810
- 'separate_items_with_commas',
811
- 'add_or_remove_items',
812
- 'choose_from_most_used',
813
- ),
814
- );
815
- return ( ! empty( $type ) ) ? $preserved_labels[ $type ] : array();
816
- }
817
-
818
- /**
819
- * Return label for the requested type and label key.
820
- *
821
- * @since 1.0.5
822
- *
823
- * @param string $type Type to return. Either 'post_types' or 'taxonomies'. Optional. Default empty string.
824
- * @param string $key Requested label key. Optional. Default empty string.
825
- * @param string $plural Plural verbiage for the requested label and type. Optional. Default empty string.
826
- * @param string $singular Singular verbiage for the requested label and type. Optional. Default empty string.
827
- * @return string Internationalized default label.
828
- */
829
- function cptui_get_preserved_label( $type = '', $key = '', $plural = '', $singular = '' ) {
830
-
831
- $preserved_labels = array(
832
- 'post_types' => array(
833
- 'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
834
- 'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
835
- 'new_item' => sprintf( __( 'New %s', 'custom-post-type-ui' ), $singular ),
836
- 'view_item' => sprintf( __( 'View %s', 'custom-post-type-ui' ), $singular ),
837
- 'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
838
- 'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
839
- 'not_found' => sprintf( __( 'No %s found.', 'custom-post-type-ui' ), $plural ),
840
- 'not_found_in_trash' => sprintf( __( 'No %s found in trash.', 'custom-post-type-ui' ), $plural ),
841
- ),
842
- 'taxonomies' => array(
843
- 'search_items' => sprintf( __( 'Search %s', 'custom-post-type-ui' ), $plural ),
844
- 'popular_items' => sprintf( __( 'Popular %s', 'custom-post-type-ui' ), $plural ),
845
- 'all_items' => sprintf( __( 'All %s', 'custom-post-type-ui' ), $plural ),
846
- 'parent_item' => sprintf( __( 'Parent %s', 'custom-post-type-ui' ), $singular ),
847
- 'parent_item_colon' => sprintf( __( 'Parent %s:', 'custom-post-type-ui' ), $singular ),
848
- 'edit_item' => sprintf( __( 'Edit %s', 'custom-post-type-ui' ), $singular ),
849
- 'update_item' => sprintf( __( 'Update %s', 'custom-post-type-ui' ), $singular ),
850
- 'add_new_item' => sprintf( __( 'Add new %s', 'custom-post-type-ui' ), $singular ),
851
- 'new_item_name' => sprintf( __( 'New %s name', 'custom-post-type-ui' ), $singular ),
852
- 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'custom-post-type-ui' ), $plural ),
853
- 'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'custom-post-type-ui' ), $plural ),
854
- 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'custom-post-type-ui' ), $plural ),
855
- ),
856
- );
857
-
858
- return $preserved_labels[ $type ][ $key ];
859
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Custom Post Type UI.
4
+ *
5
+ * For all your post type and taxonomy needs.
6
+ *
7
+ * @package CPTUI
8
+ * @subpackage Loader
9
+ * @author WebDevStudios
10
+ * @since 0.1.0.0
11
+ * @license GPL-2.0+
12
+ */
13
+
14
+ /*
15
+ Plugin Name: Custom Post Type UI
16
+ Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
+ Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
+ Author: WebDevStudios
19
+ Version: 1.6.0
20
+ Author URI: https://webdevstudios.com/
21
+ Text Domain: custom-post-type-ui
22
+ Domain Path: /languages
23
+ License: GPL-2.0+
24
+ */
25
+
26
+ // Exit if accessed directly.
27
+ if ( ! defined( 'ABSPATH' ) ) {
28
+ exit;
29
+ }
30
+
31
+ define( 'CPT_VERSION', '1.6.0' ); // Left for legacy purposes.
32
+ define( 'CPTUI_VERSION', '1.6.0' );
33
+ define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
34
+
35
+ /**
36
+ * Load our Admin UI class that powers our form inputs.
37
+ *
38
+ * @since 1.0.0
39
+ *
40
+ * @internal
41
+ */
42
+ function cptui_load_ui_class() {
43
+ require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_admin_ui.php' );
44
+ require_once( plugin_dir_path( __FILE__ ) . 'classes/class.cptui_debug_info.php' );
45
+ }
46
+ add_action( 'init', 'cptui_load_ui_class' );
47
+
48
+ /**
49
+ * Set a transient used for redirection upon activation.
50
+ *
51
+ * @since 1.4.0
52
+ */
53
+ function cptui_activation_redirect() {
54
+ // Bail if activating from network, or bulk.
55
+ if ( is_network_admin() ) {
56
+ return;
57
+ }
58
+
59
+ // Add the transient to redirect.
60
+ set_transient( 'cptui_activation_redirect', true, 30 );
61
+ }
62
+ add_action( 'activate_' . plugin_basename( __FILE__ ), 'cptui_activation_redirect' );
63
+
64
+ /**
65
+ * Redirect user to CPTUI about page upon plugin activation.
66
+ *
67
+ * @since 1.4.0
68
+ */
69
+ function cptui_make_activation_redirect() {
70
+
71
+ if ( ! get_transient( 'cptui_activation_redirect' ) ) {
72
+ return;
73
+ }
74
+
75
+ delete_transient( 'cptui_activation_redirect' );
76
+
77
+ // Bail if activating from network, or bulk.
78
+ if ( is_network_admin() ) {
79
+ return;
80
+ }
81
+
82
+ if ( ! cptui_is_new_install() ) {
83
+ return;
84
+ }
85
+
86
+ // Redirect to CPTUI about page.
87
+ wp_safe_redirect(
88
+ add_query_arg(
89
+ array( 'page' => 'cptui_main_menu' ),
90
+ cptui_admin_url( 'admin.php?page=cptui_main_menu' )
91
+ )
92
+ );
93
+ }
94
+ add_action( 'admin_init', 'cptui_make_activation_redirect', 1 );
95
+
96
+ /**
97
+ * Flush our rewrite rules on deactivation.
98
+ *
99
+ * @since 0.8.0
100
+ *
101
+ * @internal
102
+ */
103
+ function cptui_deactivation() {
104
+ flush_rewrite_rules();
105
+ }
106
+ register_deactivation_hook( __FILE__, 'cptui_deactivation' );
107
+
108
+ /**
109
+ * Register our text domain.
110
+ *
111
+ * @since 0.8.0
112
+ *
113
+ * @internal
114
+ */
115
+ function cptui_load_textdomain() {
116
+ load_plugin_textdomain( 'custom-post-type-ui' );
117
+ }
118
+ add_action( 'plugins_loaded', 'cptui_load_textdomain' );
119
+
120
+ /**
121
+ * Load our main menu.
122
+ *
123
+ * Submenu items added in version 1.1.0
124
+ *
125
+ * @since 0.1.0
126
+ *
127
+ * @internal
128
+ */
129
+ function cptui_plugin_menu() {
130
+
131
+ /**
132
+ * Filters the required capability to manage CPTUI settings.
133
+ *
134
+ * @since 1.3.0
135
+ *
136
+ * @param string $value Capability required.
137
+ */
138
+ $capability = apply_filters( 'cptui_required_capabilities', 'manage_options' );
139
+ $parent_slug = 'cptui_main_menu';
140
+
141
+ add_menu_page( __( 'Custom Post Types', 'custom-post-type-ui' ), __( 'CPT UI', 'custom-post-type-ui' ), $capability, $parent_slug, 'cptui_settings', cptui_menu_icon() );
142
+ add_submenu_page( $parent_slug, __( 'Add/Edit Post Types', 'custom-post-type-ui' ), __( 'Add/Edit Post Types', 'custom-post-type-ui' ), $capability, 'cptui_manage_post_types', 'cptui_manage_post_types' );
143
+ add_submenu_page( $parent_slug, __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), __( 'Add/Edit Taxonomies', 'custom-post-type-ui' ), $capability, 'cptui_manage_taxonomies', 'cptui_manage_taxonomies' );
144
+ add_submenu_page( $parent_slug, __( 'Registered Types and Taxes', 'custom-post-type-ui' ), __( 'Registered Types/Taxes', 'custom-post-type-ui' ), $capability, 'cptui_listings', 'cptui_listings' );
145
+ add_submenu_page( $parent_slug, __( 'Custom Post Type UI Tools', 'custom-post-type-ui' ), __( 'Tools', 'custom-post-type-ui' ), $capability, 'cptui_tools', 'cptui_tools' );
146
+ add_submenu_page( $parent_slug, __( 'Help/Support', 'custom-post-type-ui' ), __( 'Help/Support', 'custom-post-type-ui' ), $capability, 'cptui_support', 'cptui_support' );
147
+
148
+ /**
149
+ * Fires after the default submenu pages.
150
+ *
151
+ * @since 1.3.0
152
+ *
153
+ * @param string $value Parent slug for Custom Post Type UI menu.
154
+ * @param string $capability Capability required to manage CPTUI settings.
155
+ */
156
+ do_action( 'cptui_extra_menu_items', $parent_slug, $capability );
157
+
158
+ // Remove the default one so we can add our customized version.
159
+ remove_submenu_page( $parent_slug, 'cptui_main_menu' );
160
+ add_submenu_page( $parent_slug, __( 'About CPT UI', 'custom-post-type-ui' ), __( 'About CPT UI', 'custom-post-type-ui' ), $capability, 'cptui_main_menu', 'cptui_settings' );
161
+ }
162
+ add_action( 'admin_menu', 'cptui_plugin_menu' );
163
+
164
+ /**
165
+ * Fire our CPTUI Loaded hook.
166
+ *
167
+ * @since 1.3.0
168
+ *
169
+ * @internal Use `cptui_loaded` hook.
170
+ */
171
+ function cptui_loaded() {
172
+
173
+ /**
174
+ * Fires upon plugins_loaded WordPress hook.
175
+ *
176
+ * CPTUI loads its required files on this hook.
177
+ *
178
+ * @since 1.3.0
179
+ */
180
+ do_action( 'cptui_loaded' );
181
+ }
182
+ add_action( 'plugins_loaded', 'cptui_loaded' );
183
+
184
+ /**
185
+ * Load our submenus.
186
+ *
187
+ * @since 1.0.0
188
+ *
189
+ * @internal
190
+ */
191
+ function cptui_create_submenus() {
192
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/about.php' );
193
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/utility.php' );
194
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/post-types.php' );
195
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/taxonomies.php' );
196
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/listings.php' );
197
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/tools.php' );
198
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/support.php' );
199
+
200
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
201
+ require_once( plugin_dir_path( __FILE__ ) . 'inc/wp-cli.php' );
202
+ }
203
+ }
204
+ add_action( 'cptui_loaded', 'cptui_create_submenus' );
205
+
206
+ /**
207
+ * Fire our CPTUI init hook.
208
+ *
209
+ * @since 1.3.0
210
+ *
211
+ * @internal Use `cptui_init` hook.
212
+ */
213
+ function cptui_init() {
214
+
215
+ /**
216
+ * Fires upon init WordPress hook.
217
+ *
218
+ * @since 1.3.0
219
+ */
220
+ do_action( 'cptui_init' );
221
+ }
222
+ add_action( 'init', 'cptui_init' );
223
+
224
+ /**
225
+ * Enqueue CPTUI admin styles.
226
+ *
227
+ * @since 1.0.0
228
+ *
229
+ * @internal
230
+ */
231
+ function cptui_add_styles() {
232
+ if ( wp_doing_ajax() ) {
233
+ return;
234
+ }
235
+
236
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
237
+ wp_register_script( 'cptui', plugins_url( "js/cptui{$min}.js", __FILE__ ), array( 'jquery', 'postbox' ), CPTUI_VERSION, true );
238
+ wp_register_style( 'cptui-css', plugins_url( "css/cptui{$min}.css", __FILE__ ), array(), CPTUI_VERSION );
239
+ }
240
+ add_action( 'admin_enqueue_scripts', 'cptui_add_styles' );
241
+
242
+ /**
243
+ * Register our users' custom post types.
244
+ *
245
+ * @since 0.5.0
246
+ *
247
+ * @internal
248
+ */
249
+ function cptui_create_custom_post_types() {
250
+ $cpts = get_option( 'cptui_post_types' );
251
+
252
+ if ( empty( $cpts ) ) {
253
+ return;
254
+ }
255
+
256
+ /**
257
+ * Fires before the start of the post type registrations.
258
+ *
259
+ * @since 1.3.0
260
+ *
261
+ * @param array $cpts Array of post types to register.
262
+ */
263
+ do_action( 'cptui_pre_register_post_types', $cpts );
264
+
265
+ if ( is_array( $cpts ) ) {
266
+ foreach ( $cpts as $post_type ) {
267
+ cptui_register_single_post_type( $post_type );
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Fires after the completion of the post type registrations.
273
+ *
274
+ * @since 1.3.0
275
+ *
276
+ * @param array $cpts Array of post types registered.
277
+ */
278
+ do_action( 'cptui_post_register_post_types', $cpts );
279
+ }
280
+ add_action( 'init', 'cptui_create_custom_post_types', 10 ); // Leave on standard init for legacy purposes.
281
+
282
+ /**
283
+ * Helper function to register the actual post_type.
284
+ *
285
+ * @since 1.0.0
286
+ *
287
+ * @internal
288
+ *
289
+ * @param array $post_type Post type array to register. Optional.
290
+ * @return null Result of register_post_type.
291
+ */
292
+ function cptui_register_single_post_type( $post_type = array() ) {
293
+
294
+ /**
295
+ * Filters the map_meta_cap value.
296
+ *
297
+ * @since 1.0.0
298
+ *
299
+ * @param bool $value True.
300
+ * @param string $name Post type name being registered.
301
+ * @param array $post_type All parameters for post type registration.
302
+ */
303
+ $post_type['map_meta_cap'] = apply_filters( 'cptui_map_meta_cap', true, $post_type['name'], $post_type );
304
+
305
+ if ( empty( $post_type['supports'] ) ) {
306
+ $post_type['supports'] = array();
307
+ }
308
+
309
+ /**
310
+ * Filters custom supports parameters for 3rd party plugins.
311
+ *
312
+ * @since 1.0.0
313
+ *
314
+ * @param array $value Empty array to add supports keys to.
315
+ * @param string $name Post type slug being registered.
316
+ * @param array $post_type Array of post type arguments to be registered.
317
+ */
318
+ $user_supports_params = apply_filters( 'cptui_user_supports_params', array(), $post_type['name'], $post_type );
319
+
320
+ if ( is_array( $user_supports_params ) && ! empty( $user_supports_params ) ) {
321
+ if ( is_array( $post_type['supports'] ) ) {
322
+ $post_type['supports'] = array_merge( $post_type['supports'], $user_supports_params );
323
+ } else {
324
+ $post_type['supports'] = array( $user_supports_params );
325
+ }
326
+ }
327
+
328
+ $yarpp = false; // Prevent notices.
329
+ if ( ! empty( $post_type['custom_supports'] ) ) {
330
+ $custom = explode( ',', $post_type['custom_supports'] );
331
+ foreach ( $custom as $part ) {
332
+ // We'll handle YARPP separately.
333
+ if ( in_array( $part, array( 'YARPP', 'yarpp' ) ) ) {
334
+ $yarpp = true;
335
+ continue;
336
+ }
337
+ $post_type['supports'][] = trim( $part );
338
+ }
339
+ }
340
+
341
+ if ( isset( $post_type['supports'] ) && is_array( $post_type['supports'] ) && in_array( 'none', $post_type['supports'] ) ) {
342
+ $post_type['supports'] = false;
343
+ }
344
+
345
+ $labels = array(
346
+ 'name' => $post_type['label'],
347
+ 'singular_name' => $post_type['singular_label'],
348
+ );
349
+
350
+ $preserved = cptui_get_preserved_keys( 'post_types' );
351
+ $preserved_labels = cptui_get_preserved_labels();
352
+ foreach ( $post_type['labels'] as $key => $label ) {
353
+
354
+ if ( ! empty( $label ) ) {
355
+ if ( 'parent' === $key ) {
356
+ $labels['parent_item_colon'] = $label;
357
+ } else {