Changeset 3053032
- Timestamp:
- 03/18/2024 03:29:02 AM (2 years ago)
- Location:
- cpt-editor
- Files:
-
- 8 edited
- 1 copied
-
tags/1.6.0 (copied) (copied from cpt-editor/trunk)
-
tags/1.6.0/cpt-editor.php (modified) (19 diffs)
-
tags/1.6.0/inc/OM4_CPT_List_Table.php (modified) (7 diffs)
-
tags/1.6.0/languages/cpt-editor.pot (modified) (2 diffs)
-
tags/1.6.0/readme.txt (modified) (2 diffs)
-
trunk/cpt-editor.php (modified) (19 diffs)
-
trunk/inc/OM4_CPT_List_Table.php (modified) (7 diffs)
-
trunk/languages/cpt-editor.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cpt-editor/tags/1.6.0/cpt-editor.php
r2850165 r3053032 4 4 Plugin URI: https://om4.io/plugins/custom-post-type-editor/ 5 5 Description: Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. 6 Version: 1. 56 Version: 1.6 7 7 Author: OM4 Software 8 8 Author URI: https://om4.io/ … … 13 13 14 14 /* 15 Copyright 2012-2023 OM4 (email : plugins@om4.com.au)15 Copyright 2012-2023 OM4 (email: plugins@om4.io web: https://om4.io/) 16 16 17 17 This program is free software; you can redistribute it and/or modify … … 95 95 * Default settings. 96 96 * 97 * @var array 97 * @var array{'types':array<string,array<string,string>>} 98 98 */ 99 99 protected $settings = array( … … 119 119 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 120 120 121 $this->installed_version = intval( get_option( $this->option_name ) );121 $this->installed_version = absint( get_option( $this->option_name ) ); 122 122 123 123 $data = get_option( $this->option_name ); 124 124 if ( is_array( $data ) ) { 125 $this->installed_version = intval( $data['version'] );125 $this->installed_version = absint( $data['version'] ); 126 126 $this->settings = $data['settings']; 127 127 } 128 128 129 add_action( 'registered_post_type', array( $this, 'post_type_registered' ), 10, 2 ); 130 129 add_action( 'registered_post_type', array( $this, 'post_type_registered' ), 10 ); 131 130 } 132 131 133 132 /** 134 133 * Initialise I18n/Localisation. 134 * 135 * @return void 135 136 */ 136 137 public function load_domain() { … … 140 141 /** 141 142 * Plugin Activation Tasks. 143 * 144 * @return void 142 145 */ 143 146 public function activate() { … … 151 154 /** 152 155 * Performs any database upgrade tasks if required. 156 * 157 * @return void 153 158 */ 154 159 public function check_version() { … … 156 161 // Upgrade tasks. 157 162 if ( 0 === $this->installed_version ) { 158 $this->installed_version ++;163 ++$this->installed_version; 159 164 } 160 165 $this->save_settings(); … … 168 173 * original CPT so that we can detect that its been modified. 169 174 * 170 * @param string $post_typePost type.171 * @ param WP_Post_Type $post_type_object Arguments used to register the post type.172 */ 173 public function post_type_registered( $post_type , $post_type_object) {175 * @param string $post_type Post type. 176 * @return void 177 */ 178 public function post_type_registered( $post_type ) { 174 179 global $wp_post_types; 175 180 … … 221 226 /** 222 227 * Set up the Admin Settings menu 228 * 229 * @return void 223 230 */ 224 231 public function admin_menu() { … … 243 250 * This function checks to see if the user has modified the labels for any of these built-in custom post types, 244 251 * and if so it manually overrides the dashboard menu so that it uses these defined labels. 252 * 253 * @return void 245 254 */ 246 255 private function override_built_in_custom_post_type_menu_labels() { … … 324 333 /** 325 334 * Admin Page Controller/Handler. 335 * 336 * @return void 326 337 */ 327 338 public function admin_page() { … … 331 342 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 332 343 if ( ! isset( $_GET['action'] ) ) { 333 return $this->admin_page_list(); 334 } 335 336 return $this->admin_page_edit(); 344 $this->admin_page_list(); 345 return; 346 } 347 348 $this->admin_page_edit(); 337 349 } 338 350 … … 340 352 /** 341 353 * The Dashboard screen that lists all registered Custom Post Types. 354 * 355 * @return void 342 356 */ 343 357 private function admin_page_list() { … … 360 374 /** 361 375 * The Dashboard screen that lets the user edit/modify a Custom Post Type. 376 * 377 * @return void 362 378 */ 363 379 protected function admin_page_edit() { … … 695 711 /** 696 712 * The header for the Dashboard screens. 713 * 714 * @return void 697 715 */ 698 716 private function admin_page_header() { … … 730 748 /** 731 749 * Link back. 750 * 751 * @return void 732 752 */ 733 753 private function back_link() { … … 739 759 /** 740 760 * The footer for the Dashboard screens. 761 * 762 * @return void 741 763 */ 742 764 private function admin_page_footer() { … … 765 787 $num = ( isset( $this->settings['types'][ $post_type ]['labels'] ) && is_array( $this->settings['types'][ $post_type ]['labels'] ) ) ? count( $this->settings['types'][ $post_type ]['labels'] ) : 0; 766 788 if ( isset( $this->settings['types'][ $post_type ]['description'] ) ) { 767 $num++;789 ++$num; 768 790 } 769 791 return $num; … … 772 794 /** 773 795 * Saves the plugin's settings to the database 796 * 797 * @return void 774 798 */ 775 799 protected function save_settings() { -
cpt-editor/tags/1.6.0/inc/OM4_CPT_List_Table.php
r2850165 r3053032 32 32 * @var OM4_CPT_Editor 33 33 */ 34 private OM4_CPT_Editor$instance;34 private $instance; 35 35 36 36 /** … … 59 59 /** 60 60 * Retrieve the list of custom post types 61 * 62 * @return void 61 63 */ 62 64 public function prepare_items() { … … 66 68 'title' => $post_type_object->label, 67 69 'name' => $post_type, 68 'status' => $this->instance->number_of_customizations( $post_type ),70 'status' => $this->instance->number_of_customizations( (string) $post_type ), 69 71 ); 70 72 } … … 79 81 * 80 82 * @inheritdoc 83 * @return array<string,string> 81 84 */ 82 85 public function get_columns() { … … 92 95 * Generates content for a single row's name column. 93 96 * 94 * @param array $item The current item. 97 * @param array<string,string> $item The current item. 98 * @return string 95 99 */ 96 100 public function column_name( $item ) { … … 126 130 * Generates content for a single row's status column. 127 131 * 128 * @param array $item The current item.132 * @param array<string,string> $item The current item. 129 133 * 130 134 * @return string|null … … 137 141 } 138 142 } 139 140 143 } -
cpt-editor/tags/1.6.0/languages/cpt-editor.pot
r2850165 r3053032 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023- 01-18T01:50:43+00:00\n"12 "POT-Creation-Date: 2023-11-14T02:01:41+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 7.1\n"14 "X-Generator: WP-CLI 2.9.0\n" 15 15 "X-Domain: cpt-editor\n" 16 16 … … 35 35 msgstr "" 36 36 37 #: cpt-editor.php:2 2638 #: cpt-editor.php:2 2737 #: cpt-editor.php:233 38 #: cpt-editor.php:234 39 39 msgid "Custom Post Types" 40 40 msgstr "" 41 41 42 #: cpt-editor.php:3 4642 #: cpt-editor.php:360 43 43 msgid "Registered Custom Post Types" 44 44 msgstr "" 45 45 46 #: cpt-editor.php:3 4746 #: cpt-editor.php:361 47 47 msgid "Below is a list of registered custom post types. These post types are typically registered by WordPress core, WordPress themes or WordPress plugins." 48 48 msgstr "" 49 49 50 #: cpt-editor.php:3 4850 #: cpt-editor.php:362 51 51 msgid "Click on a post type to view its details." 52 52 msgstr "" 53 53 54 #: cpt-editor.php:3 7554 #: cpt-editor.php:391 55 55 msgid "Invalid Custom Post Type" 56 56 msgstr "" 57 57 58 58 #. Translators: %s The name of the custom post type. 59 #: cpt-editor.php: 38759 #: cpt-editor.php:403 60 60 msgid "Edit '%s' Custom Post Type" 61 61 msgstr "" 62 62 63 #: cpt-editor.php:4 0063 #: cpt-editor.php:416 64 64 msgid "Description:" 65 65 msgstr "" 66 66 67 #: cpt-editor.php:4 0167 #: cpt-editor.php:417 68 68 msgid "A short descriptive summary of what the post type is." 69 69 msgstr "" 70 70 71 #: cpt-editor.php:4 0371 #: cpt-editor.php:419 72 72 msgid "Name:" 73 73 msgstr "" 74 74 75 #: cpt-editor.php:4 0475 #: cpt-editor.php:420 76 76 msgid "General name for the post type, usually plural." 77 77 msgstr "" 78 78 79 #: cpt-editor.php:4 0679 #: cpt-editor.php:422 80 80 msgid "Singular Name:" 81 81 msgstr "" 82 82 83 #: cpt-editor.php:4 0783 #: cpt-editor.php:423 84 84 msgid "Name for one object of this post type." 85 85 msgstr "" 86 86 87 #: cpt-editor.php:4 0987 #: cpt-editor.php:425 88 88 msgid "Add New Item:" 89 89 msgstr "" 90 90 91 #: cpt-editor.php:4 1091 #: cpt-editor.php:426 92 92 msgid "The add new item text." 93 93 msgstr "" 94 94 95 #: cpt-editor.php:4 1295 #: cpt-editor.php:428 96 96 msgid "Edit Item:" 97 97 msgstr "" 98 98 99 #: cpt-editor.php:4 1399 #: cpt-editor.php:429 100 100 msgid "The edit item text." 101 101 msgstr "" 102 102 103 #: cpt-editor.php:4 15103 #: cpt-editor.php:431 104 104 msgid "New Item:" 105 105 msgstr "" 106 106 107 #: cpt-editor.php:4 16107 #: cpt-editor.php:432 108 108 msgid "The new item text." 109 109 msgstr "" 110 110 111 #: cpt-editor.php:4 18111 #: cpt-editor.php:434 112 112 msgid "View Item:" 113 113 msgstr "" 114 114 115 #: cpt-editor.php:4 19115 #: cpt-editor.php:435 116 116 msgid "The view item text." 117 117 msgstr "" 118 118 119 #: cpt-editor.php:4 21120 #: cpt-editor.php: 496119 #: cpt-editor.php:437 120 #: cpt-editor.php:512 121 121 msgid "View Items:" 122 122 msgstr "" 123 123 124 #: cpt-editor.php:4 22124 #: cpt-editor.php:438 125 125 msgid "The label used in the toolbar on the post listing screen (if this post type supports archives)." 126 126 msgstr "" 127 127 128 #: cpt-editor.php:4 24129 #: cpt-editor.php: 499128 #: cpt-editor.php:440 129 #: cpt-editor.php:515 130 130 msgid "Attributes:" 131 131 msgstr "" 132 132 133 #: cpt-editor.php:4 25133 #: cpt-editor.php:441 134 134 msgid "The label used for the title of the post attributes meta box (used to select post type templates)." 135 135 msgstr "" 136 136 137 #: cpt-editor.php:4 27137 #: cpt-editor.php:443 138 138 msgid "Search Items:" 139 139 msgstr "" 140 140 141 #: cpt-editor.php:4 28141 #: cpt-editor.php:444 142 142 msgid "The search items text." 143 143 msgstr "" 144 144 145 #: cpt-editor.php:4 30145 #: cpt-editor.php:446 146 146 msgid "Not Found:" 147 147 msgstr "" 148 148 149 #: cpt-editor.php:4 31149 #: cpt-editor.php:447 150 150 msgid "The not found text." 151 151 msgstr "" 152 152 153 #: cpt-editor.php:4 33153 #: cpt-editor.php:449 154 154 msgid "Not Found in Trash:" 155 155 msgstr "" 156 156 157 #: cpt-editor.php:4 34157 #: cpt-editor.php:450 158 158 msgid "The not found in trash text." 159 159 msgstr "" 160 160 161 #: cpt-editor.php:4 36161 #: cpt-editor.php:452 162 162 msgid "Parent Item Colon:" 163 163 msgstr "" 164 164 165 #: cpt-editor.php:4 37165 #: cpt-editor.php:453 166 166 msgid "The parent item text. Only used for hierarchical post types." 167 167 msgstr "" 168 168 169 #: cpt-editor.php:4 41169 #: cpt-editor.php:457 170 170 msgid "Menu Name:" 171 171 msgstr "" 172 172 173 #: cpt-editor.php:4 42173 #: cpt-editor.php:458 174 174 msgid "The text used in the Dashboard's top level menu." 175 175 msgstr "" 176 176 177 #: cpt-editor.php:4 44177 #: cpt-editor.php:460 178 178 msgid "All Items:" 179 179 msgstr "" 180 180 181 #: cpt-editor.php:4 45181 #: cpt-editor.php:461 182 182 msgid "The text used in the Dashboard menu's 'all items' submenu item." 183 183 msgstr "" 184 184 185 #: cpt-editor.php:4 47185 #: cpt-editor.php:463 186 186 msgid "Add New:" 187 187 msgstr "" 188 188 189 #: cpt-editor.php:4 48189 #: cpt-editor.php:464 190 190 msgid "The text used in the Dashboard menu's 'add new' submenu item." 191 191 msgstr "" 192 192 193 #: cpt-editor.php:4 50193 #: cpt-editor.php:466 194 194 msgid "Admin Bar Name:" 195 195 msgstr "" 196 196 197 #: cpt-editor.php:4 51197 #: cpt-editor.php:467 198 198 msgid "The text used in the Admin Bar's 'New' menu." 199 199 msgstr "" 200 200 201 #: cpt-editor.php:4 58201 #: cpt-editor.php:474 202 202 msgid "Featured Image:" 203 203 msgstr "" 204 204 205 #: cpt-editor.php:4 59205 #: cpt-editor.php:475 206 206 msgid "Overrides the 'Featured Image' phrase for this post type." 207 207 msgstr "" 208 208 209 #: cpt-editor.php:4 61209 #: cpt-editor.php:477 210 210 msgid "Set featured Image:" 211 211 msgstr "" 212 212 213 #: cpt-editor.php:4 62213 #: cpt-editor.php:478 214 214 msgid "Overrides the 'Set featured image' phrase for this post type." 215 215 msgstr "" 216 216 217 #: cpt-editor.php:4 64217 #: cpt-editor.php:480 218 218 msgid "Remove featured Image:" 219 219 msgstr "" 220 220 221 #: cpt-editor.php:4 65221 #: cpt-editor.php:481 222 222 msgid "Overrides the 'Remove featured image' phrase for this post type." 223 223 msgstr "" 224 224 225 #: cpt-editor.php:4 67225 #: cpt-editor.php:483 226 226 msgid "Use as featured Image:" 227 227 msgstr "" 228 228 229 #: cpt-editor.php:4 68229 #: cpt-editor.php:484 230 230 msgid "Overrides the 'Use as featured image' phrase for this post type." 231 231 msgstr "" 232 232 233 #: cpt-editor.php:4 75233 #: cpt-editor.php:491 234 234 msgid "Archives:" 235 235 msgstr "" 236 236 237 #: cpt-editor.php:4 76237 #: cpt-editor.php:492 238 238 msgid "The post type archive label used in nav menus." 239 239 msgstr "" 240 240 241 #: cpt-editor.php:4 78241 #: cpt-editor.php:494 242 242 msgid "Insert into post:" 243 243 msgstr "" 244 244 245 #: cpt-editor.php:4 79245 #: cpt-editor.php:495 246 246 msgid "Overrides the 'Insert into post'/'Insert into page' phrase (used when inserting media into a post)." 247 247 msgstr "" 248 248 249 #: cpt-editor.php:4 81249 #: cpt-editor.php:497 250 250 msgid "Uploaded to this post:" 251 251 msgstr "" 252 252 253 #: cpt-editor.php:4 82253 #: cpt-editor.php:498 254 254 msgid "Overrides the 'Uploaded to this post'/'Uploaded to this page' phrase (used when viewing media attached to a post)." 255 255 msgstr "" 256 256 257 #: cpt-editor.php: 484257 #: cpt-editor.php:500 258 258 msgid "Filter posts list:" 259 259 msgstr "" 260 260 261 #: cpt-editor.php: 485261 #: cpt-editor.php:501 262 262 msgid "Screen reader text for the filter links heading on the post type listing screen." 263 263 msgstr "" 264 264 265 #: cpt-editor.php: 487265 #: cpt-editor.php:503 266 266 msgid "Posts list navigation:" 267 267 msgstr "" 268 268 269 #: cpt-editor.php: 488269 #: cpt-editor.php:504 270 270 msgid "Screen reader text for the pagination heading on the post type listing screen." 271 271 msgstr "" 272 272 273 #: cpt-editor.php: 490273 #: cpt-editor.php:506 274 274 msgid "Posts list:" 275 275 msgstr "" 276 276 277 #: cpt-editor.php: 491277 #: cpt-editor.php:507 278 278 msgid "Screen reader text for the items list heading on the post type listing screen." 279 279 msgstr "" 280 280 281 #: cpt-editor.php: 497281 #: cpt-editor.php:513 282 282 msgid "Label for viewing post type archives." 283 283 msgstr "" 284 284 285 #: cpt-editor.php:5 00285 #: cpt-editor.php:516 286 286 msgid "Label for the attributes meta box." 287 287 msgstr "" 288 288 289 #: cpt-editor.php:5 05289 #: cpt-editor.php:521 290 290 msgid "Item Published:" 291 291 msgstr "" 292 292 293 #: cpt-editor.php:5 06293 #: cpt-editor.php:522 294 294 msgid "Label used when an item is published." 295 295 msgstr "" 296 296 297 #: cpt-editor.php:5 08297 #: cpt-editor.php:524 298 298 msgid "Item Published Privately:" 299 299 msgstr "" 300 300 301 #: cpt-editor.php:5 09301 #: cpt-editor.php:525 302 302 msgid "Label used when an item is published with private visibility." 303 303 msgstr "" 304 304 305 #: cpt-editor.php:5 11305 #: cpt-editor.php:527 306 306 msgid "Item Reverted to Draft:" 307 307 msgstr "" 308 308 309 #: cpt-editor.php:5 12309 #: cpt-editor.php:528 310 310 msgid "Label used when an item is switched to a draft." 311 311 msgstr "" 312 312 313 #: cpt-editor.php:5 14313 #: cpt-editor.php:530 314 314 msgid "Item Scheduled:" 315 315 msgstr "" 316 316 317 #: cpt-editor.php:5 15317 #: cpt-editor.php:531 318 318 msgid "Label used when an item is scheduled for publishing." 319 319 msgstr "" 320 320 321 #: cpt-editor.php:5 17321 #: cpt-editor.php:533 322 322 msgid "Item Updated:" 323 323 msgstr "" 324 324 325 #: cpt-editor.php:5 18325 #: cpt-editor.php:534 326 326 msgid "Label used when an item is updated." 327 327 msgstr "" 328 328 329 #: cpt-editor.php:5 23329 #: cpt-editor.php:539 330 330 msgid "Filter by Date:" 331 331 msgstr "" 332 332 333 #: cpt-editor.php:5 24333 #: cpt-editor.php:540 334 334 msgid "Label for the date filter in list tables." 335 335 msgstr "" 336 336 337 #: cpt-editor.php:5 29337 #: cpt-editor.php:545 338 338 msgid "Item Link:" 339 339 msgstr "" 340 340 341 #: cpt-editor.php:5 30341 #: cpt-editor.php:546 342 342 msgid "Title for a navigation link block variation." 343 343 msgstr "" 344 344 345 #: cpt-editor.php:5 32345 #: cpt-editor.php:548 346 346 msgid "Item Link Description:" 347 347 msgstr "" 348 348 349 #: cpt-editor.php:5 33349 #: cpt-editor.php:549 350 350 msgid "Description for a navigation link block variation." 351 351 msgstr "" 352 352 353 #: cpt-editor.php:5 38353 #: cpt-editor.php:554 354 354 msgid "Insufficient privileges!" 355 355 msgstr "" 356 356 357 #: cpt-editor.php:6 11357 #: cpt-editor.php:627 358 358 msgid "Custom Post Type updated. Your changes will be visible on your next page load. <a href=\"\">Reload page</a>" 359 359 msgstr "" 360 360 361 #: cpt-editor.php:6 20361 #: cpt-editor.php:636 362 362 msgid "This screen lets you customize the description and/or labels for this Custom Post Type." 363 363 msgstr "" 364 364 365 #: cpt-editor.php:6 21365 #: cpt-editor.php:637 366 366 msgid "Customized fields are shown in blue." 367 367 msgstr "" 368 368 369 #: cpt-editor.php:6 22369 #: cpt-editor.php:638 370 370 msgid "To reset a field to its default, empty its text field. To reset all to their defaults, use the checkbox below:" 371 371 msgstr "" 372 372 373 #: cpt-editor.php:6 26373 #: cpt-editor.php:642 374 374 msgid "Reset all to their defaults" 375 375 msgstr "" 376 376 377 377 #. Translators: 1: Label Name. 2: Custom Post Type Name. 378 #: cpt-editor.php:6 45378 #: cpt-editor.php:661 379 379 msgid "%1$1s<br />(%2$2s)" 380 380 msgstr "" 381 381 382 #: cpt-editor.php:6 69383 #: cpt-editor.php:6 71382 #: cpt-editor.php:685 383 #: cpt-editor.php:687 384 384 msgid "[Empty]" 385 385 msgstr "" 386 386 387 387 #. Translators: 1: Label Description. 2: Label Default. 388 #: cpt-editor.php:6 77388 #: cpt-editor.php:693 389 389 msgid "%1$1s Default: %2$2s" 390 390 msgstr "" 391 391 392 #: cpt-editor.php: 688392 #: cpt-editor.php:704 393 393 msgid "Save Changes" 394 394 msgstr "" 395 395 396 #: cpt-editor.php:7 35396 #: cpt-editor.php:755 397 397 msgid "⇐ Back" 398 398 msgstr "" 399 399 400 #: inc/OM4_CPT_List_Table.php:8 4400 #: inc/OM4_CPT_List_Table.php:87 401 401 msgid "Custom Post Type" 402 402 msgstr "" 403 403 404 #: inc/OM4_CPT_List_Table.php:8 5404 #: inc/OM4_CPT_List_Table.php:88 405 405 msgid "Status" 406 406 msgstr "" 407 407 408 408 #. Translators: %s the URL of the edit page. 409 #: inc/OM4_CPT_List_Table.php:1 08409 #: inc/OM4_CPT_List_Table.php:112 410 410 msgid "<a href=\"%s\">Edit</a>" 411 411 msgstr "" 412 412 413 #: inc/OM4_CPT_List_Table.php:13 4413 #: inc/OM4_CPT_List_Table.php:138 414 414 msgid "Customized" 415 415 msgstr "" 416 416 417 #: inc/OM4_CPT_List_Table.php:1 36417 #: inc/OM4_CPT_List_Table.php:140 418 418 msgid "Default" 419 419 msgstr "" -
cpt-editor/tags/1.6.0/readme.txt
r2850165 r3053032 2 2 Contributors: jamescollins, om4csaba, om4 3 3 Tags: custom post type, cpt, post type, label, description, editor 4 Requires at least: 5.55 Tested up to: 6. 16 Stable tag: 1. 54 Requires at least: 6.0 5 Tested up to: 6.4 6 Stable tag: 1.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Requires PHP: 7.410 9 11 10 Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. … … 76 75 77 76 == Changelog == 77 78 = 1.6.0 = 79 * Minimum required WordPress version updated to 6.0. 80 * Mark compatibility with WordPress version 6.4. 78 81 79 82 = 1.5.0 = -
cpt-editor/trunk/cpt-editor.php
r2850165 r3053032 4 4 Plugin URI: https://om4.io/plugins/custom-post-type-editor/ 5 5 Description: Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. 6 Version: 1. 56 Version: 1.6 7 7 Author: OM4 Software 8 8 Author URI: https://om4.io/ … … 13 13 14 14 /* 15 Copyright 2012-2023 OM4 (email : plugins@om4.com.au)15 Copyright 2012-2023 OM4 (email: plugins@om4.io web: https://om4.io/) 16 16 17 17 This program is free software; you can redistribute it and/or modify … … 95 95 * Default settings. 96 96 * 97 * @var array 97 * @var array{'types':array<string,array<string,string>>} 98 98 */ 99 99 protected $settings = array( … … 119 119 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 120 120 121 $this->installed_version = intval( get_option( $this->option_name ) );121 $this->installed_version = absint( get_option( $this->option_name ) ); 122 122 123 123 $data = get_option( $this->option_name ); 124 124 if ( is_array( $data ) ) { 125 $this->installed_version = intval( $data['version'] );125 $this->installed_version = absint( $data['version'] ); 126 126 $this->settings = $data['settings']; 127 127 } 128 128 129 add_action( 'registered_post_type', array( $this, 'post_type_registered' ), 10, 2 ); 130 129 add_action( 'registered_post_type', array( $this, 'post_type_registered' ), 10 ); 131 130 } 132 131 133 132 /** 134 133 * Initialise I18n/Localisation. 134 * 135 * @return void 135 136 */ 136 137 public function load_domain() { … … 140 141 /** 141 142 * Plugin Activation Tasks. 143 * 144 * @return void 142 145 */ 143 146 public function activate() { … … 151 154 /** 152 155 * Performs any database upgrade tasks if required. 156 * 157 * @return void 153 158 */ 154 159 public function check_version() { … … 156 161 // Upgrade tasks. 157 162 if ( 0 === $this->installed_version ) { 158 $this->installed_version ++;163 ++$this->installed_version; 159 164 } 160 165 $this->save_settings(); … … 168 173 * original CPT so that we can detect that its been modified. 169 174 * 170 * @param string $post_typePost type.171 * @ param WP_Post_Type $post_type_object Arguments used to register the post type.172 */ 173 public function post_type_registered( $post_type , $post_type_object) {175 * @param string $post_type Post type. 176 * @return void 177 */ 178 public function post_type_registered( $post_type ) { 174 179 global $wp_post_types; 175 180 … … 221 226 /** 222 227 * Set up the Admin Settings menu 228 * 229 * @return void 223 230 */ 224 231 public function admin_menu() { … … 243 250 * This function checks to see if the user has modified the labels for any of these built-in custom post types, 244 251 * and if so it manually overrides the dashboard menu so that it uses these defined labels. 252 * 253 * @return void 245 254 */ 246 255 private function override_built_in_custom_post_type_menu_labels() { … … 324 333 /** 325 334 * Admin Page Controller/Handler. 335 * 336 * @return void 326 337 */ 327 338 public function admin_page() { … … 331 342 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 332 343 if ( ! isset( $_GET['action'] ) ) { 333 return $this->admin_page_list(); 334 } 335 336 return $this->admin_page_edit(); 344 $this->admin_page_list(); 345 return; 346 } 347 348 $this->admin_page_edit(); 337 349 } 338 350 … … 340 352 /** 341 353 * The Dashboard screen that lists all registered Custom Post Types. 354 * 355 * @return void 342 356 */ 343 357 private function admin_page_list() { … … 360 374 /** 361 375 * The Dashboard screen that lets the user edit/modify a Custom Post Type. 376 * 377 * @return void 362 378 */ 363 379 protected function admin_page_edit() { … … 695 711 /** 696 712 * The header for the Dashboard screens. 713 * 714 * @return void 697 715 */ 698 716 private function admin_page_header() { … … 730 748 /** 731 749 * Link back. 750 * 751 * @return void 732 752 */ 733 753 private function back_link() { … … 739 759 /** 740 760 * The footer for the Dashboard screens. 761 * 762 * @return void 741 763 */ 742 764 private function admin_page_footer() { … … 765 787 $num = ( isset( $this->settings['types'][ $post_type ]['labels'] ) && is_array( $this->settings['types'][ $post_type ]['labels'] ) ) ? count( $this->settings['types'][ $post_type ]['labels'] ) : 0; 766 788 if ( isset( $this->settings['types'][ $post_type ]['description'] ) ) { 767 $num++;789 ++$num; 768 790 } 769 791 return $num; … … 772 794 /** 773 795 * Saves the plugin's settings to the database 796 * 797 * @return void 774 798 */ 775 799 protected function save_settings() { -
cpt-editor/trunk/inc/OM4_CPT_List_Table.php
r2850165 r3053032 32 32 * @var OM4_CPT_Editor 33 33 */ 34 private OM4_CPT_Editor$instance;34 private $instance; 35 35 36 36 /** … … 59 59 /** 60 60 * Retrieve the list of custom post types 61 * 62 * @return void 61 63 */ 62 64 public function prepare_items() { … … 66 68 'title' => $post_type_object->label, 67 69 'name' => $post_type, 68 'status' => $this->instance->number_of_customizations( $post_type ),70 'status' => $this->instance->number_of_customizations( (string) $post_type ), 69 71 ); 70 72 } … … 79 81 * 80 82 * @inheritdoc 83 * @return array<string,string> 81 84 */ 82 85 public function get_columns() { … … 92 95 * Generates content for a single row's name column. 93 96 * 94 * @param array $item The current item. 97 * @param array<string,string> $item The current item. 98 * @return string 95 99 */ 96 100 public function column_name( $item ) { … … 126 130 * Generates content for a single row's status column. 127 131 * 128 * @param array $item The current item.132 * @param array<string,string> $item The current item. 129 133 * 130 134 * @return string|null … … 137 141 } 138 142 } 139 140 143 } -
cpt-editor/trunk/languages/cpt-editor.pot
r2850165 r3053032 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023- 01-18T01:50:43+00:00\n"12 "POT-Creation-Date: 2023-11-14T02:01:41+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 7.1\n"14 "X-Generator: WP-CLI 2.9.0\n" 15 15 "X-Domain: cpt-editor\n" 16 16 … … 35 35 msgstr "" 36 36 37 #: cpt-editor.php:2 2638 #: cpt-editor.php:2 2737 #: cpt-editor.php:233 38 #: cpt-editor.php:234 39 39 msgid "Custom Post Types" 40 40 msgstr "" 41 41 42 #: cpt-editor.php:3 4642 #: cpt-editor.php:360 43 43 msgid "Registered Custom Post Types" 44 44 msgstr "" 45 45 46 #: cpt-editor.php:3 4746 #: cpt-editor.php:361 47 47 msgid "Below is a list of registered custom post types. These post types are typically registered by WordPress core, WordPress themes or WordPress plugins." 48 48 msgstr "" 49 49 50 #: cpt-editor.php:3 4850 #: cpt-editor.php:362 51 51 msgid "Click on a post type to view its details." 52 52 msgstr "" 53 53 54 #: cpt-editor.php:3 7554 #: cpt-editor.php:391 55 55 msgid "Invalid Custom Post Type" 56 56 msgstr "" 57 57 58 58 #. Translators: %s The name of the custom post type. 59 #: cpt-editor.php: 38759 #: cpt-editor.php:403 60 60 msgid "Edit '%s' Custom Post Type" 61 61 msgstr "" 62 62 63 #: cpt-editor.php:4 0063 #: cpt-editor.php:416 64 64 msgid "Description:" 65 65 msgstr "" 66 66 67 #: cpt-editor.php:4 0167 #: cpt-editor.php:417 68 68 msgid "A short descriptive summary of what the post type is." 69 69 msgstr "" 70 70 71 #: cpt-editor.php:4 0371 #: cpt-editor.php:419 72 72 msgid "Name:" 73 73 msgstr "" 74 74 75 #: cpt-editor.php:4 0475 #: cpt-editor.php:420 76 76 msgid "General name for the post type, usually plural." 77 77 msgstr "" 78 78 79 #: cpt-editor.php:4 0679 #: cpt-editor.php:422 80 80 msgid "Singular Name:" 81 81 msgstr "" 82 82 83 #: cpt-editor.php:4 0783 #: cpt-editor.php:423 84 84 msgid "Name for one object of this post type." 85 85 msgstr "" 86 86 87 #: cpt-editor.php:4 0987 #: cpt-editor.php:425 88 88 msgid "Add New Item:" 89 89 msgstr "" 90 90 91 #: cpt-editor.php:4 1091 #: cpt-editor.php:426 92 92 msgid "The add new item text." 93 93 msgstr "" 94 94 95 #: cpt-editor.php:4 1295 #: cpt-editor.php:428 96 96 msgid "Edit Item:" 97 97 msgstr "" 98 98 99 #: cpt-editor.php:4 1399 #: cpt-editor.php:429 100 100 msgid "The edit item text." 101 101 msgstr "" 102 102 103 #: cpt-editor.php:4 15103 #: cpt-editor.php:431 104 104 msgid "New Item:" 105 105 msgstr "" 106 106 107 #: cpt-editor.php:4 16107 #: cpt-editor.php:432 108 108 msgid "The new item text." 109 109 msgstr "" 110 110 111 #: cpt-editor.php:4 18111 #: cpt-editor.php:434 112 112 msgid "View Item:" 113 113 msgstr "" 114 114 115 #: cpt-editor.php:4 19115 #: cpt-editor.php:435 116 116 msgid "The view item text." 117 117 msgstr "" 118 118 119 #: cpt-editor.php:4 21120 #: cpt-editor.php: 496119 #: cpt-editor.php:437 120 #: cpt-editor.php:512 121 121 msgid "View Items:" 122 122 msgstr "" 123 123 124 #: cpt-editor.php:4 22124 #: cpt-editor.php:438 125 125 msgid "The label used in the toolbar on the post listing screen (if this post type supports archives)." 126 126 msgstr "" 127 127 128 #: cpt-editor.php:4 24129 #: cpt-editor.php: 499128 #: cpt-editor.php:440 129 #: cpt-editor.php:515 130 130 msgid "Attributes:" 131 131 msgstr "" 132 132 133 #: cpt-editor.php:4 25133 #: cpt-editor.php:441 134 134 msgid "The label used for the title of the post attributes meta box (used to select post type templates)." 135 135 msgstr "" 136 136 137 #: cpt-editor.php:4 27137 #: cpt-editor.php:443 138 138 msgid "Search Items:" 139 139 msgstr "" 140 140 141 #: cpt-editor.php:4 28141 #: cpt-editor.php:444 142 142 msgid "The search items text." 143 143 msgstr "" 144 144 145 #: cpt-editor.php:4 30145 #: cpt-editor.php:446 146 146 msgid "Not Found:" 147 147 msgstr "" 148 148 149 #: cpt-editor.php:4 31149 #: cpt-editor.php:447 150 150 msgid "The not found text." 151 151 msgstr "" 152 152 153 #: cpt-editor.php:4 33153 #: cpt-editor.php:449 154 154 msgid "Not Found in Trash:" 155 155 msgstr "" 156 156 157 #: cpt-editor.php:4 34157 #: cpt-editor.php:450 158 158 msgid "The not found in trash text." 159 159 msgstr "" 160 160 161 #: cpt-editor.php:4 36161 #: cpt-editor.php:452 162 162 msgid "Parent Item Colon:" 163 163 msgstr "" 164 164 165 #: cpt-editor.php:4 37165 #: cpt-editor.php:453 166 166 msgid "The parent item text. Only used for hierarchical post types." 167 167 msgstr "" 168 168 169 #: cpt-editor.php:4 41169 #: cpt-editor.php:457 170 170 msgid "Menu Name:" 171 171 msgstr "" 172 172 173 #: cpt-editor.php:4 42173 #: cpt-editor.php:458 174 174 msgid "The text used in the Dashboard's top level menu." 175 175 msgstr "" 176 176 177 #: cpt-editor.php:4 44177 #: cpt-editor.php:460 178 178 msgid "All Items:" 179 179 msgstr "" 180 180 181 #: cpt-editor.php:4 45181 #: cpt-editor.php:461 182 182 msgid "The text used in the Dashboard menu's 'all items' submenu item." 183 183 msgstr "" 184 184 185 #: cpt-editor.php:4 47185 #: cpt-editor.php:463 186 186 msgid "Add New:" 187 187 msgstr "" 188 188 189 #: cpt-editor.php:4 48189 #: cpt-editor.php:464 190 190 msgid "The text used in the Dashboard menu's 'add new' submenu item." 191 191 msgstr "" 192 192 193 #: cpt-editor.php:4 50193 #: cpt-editor.php:466 194 194 msgid "Admin Bar Name:" 195 195 msgstr "" 196 196 197 #: cpt-editor.php:4 51197 #: cpt-editor.php:467 198 198 msgid "The text used in the Admin Bar's 'New' menu." 199 199 msgstr "" 200 200 201 #: cpt-editor.php:4 58201 #: cpt-editor.php:474 202 202 msgid "Featured Image:" 203 203 msgstr "" 204 204 205 #: cpt-editor.php:4 59205 #: cpt-editor.php:475 206 206 msgid "Overrides the 'Featured Image' phrase for this post type." 207 207 msgstr "" 208 208 209 #: cpt-editor.php:4 61209 #: cpt-editor.php:477 210 210 msgid "Set featured Image:" 211 211 msgstr "" 212 212 213 #: cpt-editor.php:4 62213 #: cpt-editor.php:478 214 214 msgid "Overrides the 'Set featured image' phrase for this post type." 215 215 msgstr "" 216 216 217 #: cpt-editor.php:4 64217 #: cpt-editor.php:480 218 218 msgid "Remove featured Image:" 219 219 msgstr "" 220 220 221 #: cpt-editor.php:4 65221 #: cpt-editor.php:481 222 222 msgid "Overrides the 'Remove featured image' phrase for this post type." 223 223 msgstr "" 224 224 225 #: cpt-editor.php:4 67225 #: cpt-editor.php:483 226 226 msgid "Use as featured Image:" 227 227 msgstr "" 228 228 229 #: cpt-editor.php:4 68229 #: cpt-editor.php:484 230 230 msgid "Overrides the 'Use as featured image' phrase for this post type." 231 231 msgstr "" 232 232 233 #: cpt-editor.php:4 75233 #: cpt-editor.php:491 234 234 msgid "Archives:" 235 235 msgstr "" 236 236 237 #: cpt-editor.php:4 76237 #: cpt-editor.php:492 238 238 msgid "The post type archive label used in nav menus." 239 239 msgstr "" 240 240 241 #: cpt-editor.php:4 78241 #: cpt-editor.php:494 242 242 msgid "Insert into post:" 243 243 msgstr "" 244 244 245 #: cpt-editor.php:4 79245 #: cpt-editor.php:495 246 246 msgid "Overrides the 'Insert into post'/'Insert into page' phrase (used when inserting media into a post)." 247 247 msgstr "" 248 248 249 #: cpt-editor.php:4 81249 #: cpt-editor.php:497 250 250 msgid "Uploaded to this post:" 251 251 msgstr "" 252 252 253 #: cpt-editor.php:4 82253 #: cpt-editor.php:498 254 254 msgid "Overrides the 'Uploaded to this post'/'Uploaded to this page' phrase (used when viewing media attached to a post)." 255 255 msgstr "" 256 256 257 #: cpt-editor.php: 484257 #: cpt-editor.php:500 258 258 msgid "Filter posts list:" 259 259 msgstr "" 260 260 261 #: cpt-editor.php: 485261 #: cpt-editor.php:501 262 262 msgid "Screen reader text for the filter links heading on the post type listing screen." 263 263 msgstr "" 264 264 265 #: cpt-editor.php: 487265 #: cpt-editor.php:503 266 266 msgid "Posts list navigation:" 267 267 msgstr "" 268 268 269 #: cpt-editor.php: 488269 #: cpt-editor.php:504 270 270 msgid "Screen reader text for the pagination heading on the post type listing screen." 271 271 msgstr "" 272 272 273 #: cpt-editor.php: 490273 #: cpt-editor.php:506 274 274 msgid "Posts list:" 275 275 msgstr "" 276 276 277 #: cpt-editor.php: 491277 #: cpt-editor.php:507 278 278 msgid "Screen reader text for the items list heading on the post type listing screen." 279 279 msgstr "" 280 280 281 #: cpt-editor.php: 497281 #: cpt-editor.php:513 282 282 msgid "Label for viewing post type archives." 283 283 msgstr "" 284 284 285 #: cpt-editor.php:5 00285 #: cpt-editor.php:516 286 286 msgid "Label for the attributes meta box." 287 287 msgstr "" 288 288 289 #: cpt-editor.php:5 05289 #: cpt-editor.php:521 290 290 msgid "Item Published:" 291 291 msgstr "" 292 292 293 #: cpt-editor.php:5 06293 #: cpt-editor.php:522 294 294 msgid "Label used when an item is published." 295 295 msgstr "" 296 296 297 #: cpt-editor.php:5 08297 #: cpt-editor.php:524 298 298 msgid "Item Published Privately:" 299 299 msgstr "" 300 300 301 #: cpt-editor.php:5 09301 #: cpt-editor.php:525 302 302 msgid "Label used when an item is published with private visibility." 303 303 msgstr "" 304 304 305 #: cpt-editor.php:5 11305 #: cpt-editor.php:527 306 306 msgid "Item Reverted to Draft:" 307 307 msgstr "" 308 308 309 #: cpt-editor.php:5 12309 #: cpt-editor.php:528 310 310 msgid "Label used when an item is switched to a draft." 311 311 msgstr "" 312 312 313 #: cpt-editor.php:5 14313 #: cpt-editor.php:530 314 314 msgid "Item Scheduled:" 315 315 msgstr "" 316 316 317 #: cpt-editor.php:5 15317 #: cpt-editor.php:531 318 318 msgid "Label used when an item is scheduled for publishing." 319 319 msgstr "" 320 320 321 #: cpt-editor.php:5 17321 #: cpt-editor.php:533 322 322 msgid "Item Updated:" 323 323 msgstr "" 324 324 325 #: cpt-editor.php:5 18325 #: cpt-editor.php:534 326 326 msgid "Label used when an item is updated." 327 327 msgstr "" 328 328 329 #: cpt-editor.php:5 23329 #: cpt-editor.php:539 330 330 msgid "Filter by Date:" 331 331 msgstr "" 332 332 333 #: cpt-editor.php:5 24333 #: cpt-editor.php:540 334 334 msgid "Label for the date filter in list tables." 335 335 msgstr "" 336 336 337 #: cpt-editor.php:5 29337 #: cpt-editor.php:545 338 338 msgid "Item Link:" 339 339 msgstr "" 340 340 341 #: cpt-editor.php:5 30341 #: cpt-editor.php:546 342 342 msgid "Title for a navigation link block variation." 343 343 msgstr "" 344 344 345 #: cpt-editor.php:5 32345 #: cpt-editor.php:548 346 346 msgid "Item Link Description:" 347 347 msgstr "" 348 348 349 #: cpt-editor.php:5 33349 #: cpt-editor.php:549 350 350 msgid "Description for a navigation link block variation." 351 351 msgstr "" 352 352 353 #: cpt-editor.php:5 38353 #: cpt-editor.php:554 354 354 msgid "Insufficient privileges!" 355 355 msgstr "" 356 356 357 #: cpt-editor.php:6 11357 #: cpt-editor.php:627 358 358 msgid "Custom Post Type updated. Your changes will be visible on your next page load. <a href=\"\">Reload page</a>" 359 359 msgstr "" 360 360 361 #: cpt-editor.php:6 20361 #: cpt-editor.php:636 362 362 msgid "This screen lets you customize the description and/or labels for this Custom Post Type." 363 363 msgstr "" 364 364 365 #: cpt-editor.php:6 21365 #: cpt-editor.php:637 366 366 msgid "Customized fields are shown in blue." 367 367 msgstr "" 368 368 369 #: cpt-editor.php:6 22369 #: cpt-editor.php:638 370 370 msgid "To reset a field to its default, empty its text field. To reset all to their defaults, use the checkbox below:" 371 371 msgstr "" 372 372 373 #: cpt-editor.php:6 26373 #: cpt-editor.php:642 374 374 msgid "Reset all to their defaults" 375 375 msgstr "" 376 376 377 377 #. Translators: 1: Label Name. 2: Custom Post Type Name. 378 #: cpt-editor.php:6 45378 #: cpt-editor.php:661 379 379 msgid "%1$1s<br />(%2$2s)" 380 380 msgstr "" 381 381 382 #: cpt-editor.php:6 69383 #: cpt-editor.php:6 71382 #: cpt-editor.php:685 383 #: cpt-editor.php:687 384 384 msgid "[Empty]" 385 385 msgstr "" 386 386 387 387 #. Translators: 1: Label Description. 2: Label Default. 388 #: cpt-editor.php:6 77388 #: cpt-editor.php:693 389 389 msgid "%1$1s Default: %2$2s" 390 390 msgstr "" 391 391 392 #: cpt-editor.php: 688392 #: cpt-editor.php:704 393 393 msgid "Save Changes" 394 394 msgstr "" 395 395 396 #: cpt-editor.php:7 35396 #: cpt-editor.php:755 397 397 msgid "⇐ Back" 398 398 msgstr "" 399 399 400 #: inc/OM4_CPT_List_Table.php:8 4400 #: inc/OM4_CPT_List_Table.php:87 401 401 msgid "Custom Post Type" 402 402 msgstr "" 403 403 404 #: inc/OM4_CPT_List_Table.php:8 5404 #: inc/OM4_CPT_List_Table.php:88 405 405 msgid "Status" 406 406 msgstr "" 407 407 408 408 #. Translators: %s the URL of the edit page. 409 #: inc/OM4_CPT_List_Table.php:1 08409 #: inc/OM4_CPT_List_Table.php:112 410 410 msgid "<a href=\"%s\">Edit</a>" 411 411 msgstr "" 412 412 413 #: inc/OM4_CPT_List_Table.php:13 4413 #: inc/OM4_CPT_List_Table.php:138 414 414 msgid "Customized" 415 415 msgstr "" 416 416 417 #: inc/OM4_CPT_List_Table.php:1 36417 #: inc/OM4_CPT_List_Table.php:140 418 418 msgid "Default" 419 419 msgstr "" -
cpt-editor/trunk/readme.txt
r2850165 r3053032 2 2 Contributors: jamescollins, om4csaba, om4 3 3 Tags: custom post type, cpt, post type, label, description, editor 4 Requires at least: 5.55 Tested up to: 6. 16 Stable tag: 1. 54 Requires at least: 6.0 5 Tested up to: 6.4 6 Stable tag: 1.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 Requires PHP: 7.410 9 11 10 Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. … … 76 75 77 76 == Changelog == 77 78 = 1.6.0 = 79 * Minimum required WordPress version updated to 6.0. 80 * Mark compatibility with WordPress version 6.4. 78 81 79 82 = 1.5.0 =
Note: See TracChangeset
for help on using the changeset viewer.