Plugin Directory

Changeset 3053032


Ignore:
Timestamp:
03/18/2024 03:29:02 AM (2 years ago)
Author:
om4
Message:

Update to version 1.6.0 from GitHub

Location:
cpt-editor
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • cpt-editor/tags/1.6.0/cpt-editor.php

    r2850165 r3053032  
    44Plugin URI: https://om4.io/plugins/custom-post-type-editor/
    55Description: Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface.
    6 Version: 1.5
     6Version: 1.6
    77Author: OM4 Software
    88Author URI: https://om4.io/
     
    1313
    1414/*
    15     Copyright 2012-2023 OM4 (email : plugins@om4.com.au)
     15    Copyright 2012-2023 OM4 (email: plugins@om4.io    web: https://om4.io/)
    1616
    1717    This program is free software; you can redistribute it and/or modify
     
    9595     * Default settings.
    9696     *
    97      * @var array
     97     * @var array{'types':array<string,array<string,string>>}
    9898     */
    9999    protected $settings = array(
     
    119119        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
    120120
    121         $this->installed_version = intval( get_option( $this->option_name ) );
     121        $this->installed_version = absint( get_option( $this->option_name ) );
    122122
    123123        $data = get_option( $this->option_name );
    124124        if ( is_array( $data ) ) {
    125             $this->installed_version = intval( $data['version'] );
     125            $this->installed_version = absint( $data['version'] );
    126126            $this->settings          = $data['settings'];
    127127        }
    128128
    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 );
    131130    }
    132131
    133132    /**
    134133     * Initialise I18n/Localisation.
     134     *
     135     * @return void
    135136     */
    136137    public function load_domain() {
     
    140141    /**
    141142     * Plugin Activation Tasks.
     143     *
     144     * @return void
    142145     */
    143146    public function activate() {
     
    151154    /**
    152155     * Performs any database upgrade tasks if required.
     156     *
     157     * @return void
    153158     */
    154159    public function check_version() {
     
    156161            // Upgrade tasks.
    157162            if ( 0 === $this->installed_version ) {
    158                 $this->installed_version ++;
     163                ++$this->installed_version;
    159164            }
    160165            $this->save_settings();
     
    168173     * original CPT so that we can detect that its been modified.
    169174     *
    170      * @param string       $post_type        Post 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 ) {
    174179        global $wp_post_types;
    175180
     
    221226    /**
    222227     * Set up the Admin Settings menu
     228     *
     229     * @return void
    223230     */
    224231    public function admin_menu() {
     
    243250     * This function checks to see if the user has modified the labels for any of these built-in custom post types,
    244251     * and if so it manually overrides the dashboard menu so that it uses these defined labels.
     252     *
     253     * @return void
    245254     */
    246255    private function override_built_in_custom_post_type_menu_labels() {
     
    324333    /**
    325334     * Admin Page Controller/Handler.
     335     *
     336     * @return void
    326337     */
    327338    public function admin_page() {
     
    331342        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    332343        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();
    337349    }
    338350
     
    340352    /**
    341353     * The Dashboard screen that lists all registered Custom Post Types.
     354     *
     355     * @return void
    342356     */
    343357    private function admin_page_list() {
     
    360374    /**
    361375     * The Dashboard screen that lets the user edit/modify a Custom Post Type.
     376     *
     377     * @return void
    362378     */
    363379    protected function admin_page_edit() {
     
    695711    /**
    696712     * The header for the Dashboard screens.
     713     *
     714     * @return void
    697715     */
    698716    private function admin_page_header() {
     
    730748    /**
    731749     * Link back.
     750     *
     751     * @return void
    732752     */
    733753    private function back_link() {
     
    739759    /**
    740760     * The footer for the Dashboard screens.
     761     *
     762     * @return void
    741763     */
    742764    private function admin_page_footer() {
     
    765787        $num = ( isset( $this->settings['types'][ $post_type ]['labels'] ) && is_array( $this->settings['types'][ $post_type ]['labels'] ) ) ? count( $this->settings['types'][ $post_type ]['labels'] ) : 0;
    766788        if ( isset( $this->settings['types'][ $post_type ]['description'] ) ) {
    767             $num++;
     789            ++$num;
    768790        }
    769791        return $num;
     
    772794    /**
    773795     * Saves the plugin's settings to the database
     796     *
     797     * @return void
    774798     */
    775799    protected function save_settings() {
  • cpt-editor/tags/1.6.0/inc/OM4_CPT_List_Table.php

    r2850165 r3053032  
    3232     * @var OM4_CPT_Editor
    3333     */
    34     private OM4_CPT_Editor $instance;
     34    private $instance;
    3535
    3636    /**
     
    5959    /**
    6060     * Retrieve the list of custom post types
     61     *
     62     * @return void
    6163     */
    6264    public function prepare_items() {
     
    6668                'title'  => $post_type_object->label,
    6769                'name'   => $post_type,
    68                 'status' => $this->instance->number_of_customizations( $post_type ),
     70                'status' => $this->instance->number_of_customizations( (string) $post_type ),
    6971            );
    7072        }
     
    7981     *
    8082     * @inheritdoc
     83     * @return array<string,string>
    8184     */
    8285    public function get_columns() {
     
    9295     * Generates content for a single row's name column.
    9396     *
    94      * @param array $item The current item.
     97     * @param array<string,string> $item The current item.
     98     * @return string
    9599     */
    96100    public function column_name( $item ) {
     
    126130     * Generates content for a single row's status column.
    127131     *
    128      * @param array $item The current item.
     132     * @param array<string,string> $item The current item.
    129133     *
    130134     * @return string|null
     
    137141        }
    138142    }
    139 
    140143}
  • cpt-editor/tags/1.6.0/languages/cpt-editor.pot

    r2850165 r3053032  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"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"
    1313"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"
    1515"X-Domain: cpt-editor\n"
    1616
     
    3535msgstr ""
    3636
    37 #: cpt-editor.php:226
    38 #: cpt-editor.php:227
     37#: cpt-editor.php:233
     38#: cpt-editor.php:234
    3939msgid "Custom Post Types"
    4040msgstr ""
    4141
    42 #: cpt-editor.php:346
     42#: cpt-editor.php:360
    4343msgid "Registered Custom Post Types"
    4444msgstr ""
    4545
    46 #: cpt-editor.php:347
     46#: cpt-editor.php:361
    4747msgid "Below is a list of registered custom post types. These post types are typically registered by WordPress core, WordPress themes or WordPress plugins."
    4848msgstr ""
    4949
    50 #: cpt-editor.php:348
     50#: cpt-editor.php:362
    5151msgid "Click on a post type to view its details."
    5252msgstr ""
    5353
    54 #: cpt-editor.php:375
     54#: cpt-editor.php:391
    5555msgid "Invalid Custom Post Type"
    5656msgstr ""
    5757
    5858#. Translators: %s The name of the custom post type.
    59 #: cpt-editor.php:387
     59#: cpt-editor.php:403
    6060msgid "Edit '%s' Custom Post Type"
    6161msgstr ""
    6262
    63 #: cpt-editor.php:400
     63#: cpt-editor.php:416
    6464msgid "Description:"
    6565msgstr ""
    6666
    67 #: cpt-editor.php:401
     67#: cpt-editor.php:417
    6868msgid "A short descriptive summary of what the post type is."
    6969msgstr ""
    7070
    71 #: cpt-editor.php:403
     71#: cpt-editor.php:419
    7272msgid "Name:"
    7373msgstr ""
    7474
    75 #: cpt-editor.php:404
     75#: cpt-editor.php:420
    7676msgid "General name for the post type, usually plural."
    7777msgstr ""
    7878
    79 #: cpt-editor.php:406
     79#: cpt-editor.php:422
    8080msgid "Singular Name:"
    8181msgstr ""
    8282
    83 #: cpt-editor.php:407
     83#: cpt-editor.php:423
    8484msgid "Name for one object of this post type."
    8585msgstr ""
    8686
    87 #: cpt-editor.php:409
     87#: cpt-editor.php:425
    8888msgid "Add New Item:"
    8989msgstr ""
    9090
    91 #: cpt-editor.php:410
     91#: cpt-editor.php:426
    9292msgid "The add new item text."
    9393msgstr ""
    9494
    95 #: cpt-editor.php:412
     95#: cpt-editor.php:428
    9696msgid "Edit Item:"
    9797msgstr ""
    9898
    99 #: cpt-editor.php:413
     99#: cpt-editor.php:429
    100100msgid "The edit item text."
    101101msgstr ""
    102102
    103 #: cpt-editor.php:415
     103#: cpt-editor.php:431
    104104msgid "New Item:"
    105105msgstr ""
    106106
    107 #: cpt-editor.php:416
     107#: cpt-editor.php:432
    108108msgid "The new item text."
    109109msgstr ""
    110110
    111 #: cpt-editor.php:418
     111#: cpt-editor.php:434
    112112msgid "View Item:"
    113113msgstr ""
    114114
    115 #: cpt-editor.php:419
     115#: cpt-editor.php:435
    116116msgid "The view item text."
    117117msgstr ""
    118118
    119 #: cpt-editor.php:421
    120 #: cpt-editor.php:496
     119#: cpt-editor.php:437
     120#: cpt-editor.php:512
    121121msgid "View Items:"
    122122msgstr ""
    123123
    124 #: cpt-editor.php:422
     124#: cpt-editor.php:438
    125125msgid "The label used in the toolbar on the post listing screen (if this post type supports archives)."
    126126msgstr ""
    127127
    128 #: cpt-editor.php:424
    129 #: cpt-editor.php:499
     128#: cpt-editor.php:440
     129#: cpt-editor.php:515
    130130msgid "Attributes:"
    131131msgstr ""
    132132
    133 #: cpt-editor.php:425
     133#: cpt-editor.php:441
    134134msgid "The label used for the title of the post attributes meta box (used to select post type templates)."
    135135msgstr ""
    136136
    137 #: cpt-editor.php:427
     137#: cpt-editor.php:443
    138138msgid "Search Items:"
    139139msgstr ""
    140140
    141 #: cpt-editor.php:428
     141#: cpt-editor.php:444
    142142msgid "The search items text."
    143143msgstr ""
    144144
    145 #: cpt-editor.php:430
     145#: cpt-editor.php:446
    146146msgid "Not Found:"
    147147msgstr ""
    148148
    149 #: cpt-editor.php:431
     149#: cpt-editor.php:447
    150150msgid "The not found text."
    151151msgstr ""
    152152
    153 #: cpt-editor.php:433
     153#: cpt-editor.php:449
    154154msgid "Not Found in Trash:"
    155155msgstr ""
    156156
    157 #: cpt-editor.php:434
     157#: cpt-editor.php:450
    158158msgid "The not found in trash text."
    159159msgstr ""
    160160
    161 #: cpt-editor.php:436
     161#: cpt-editor.php:452
    162162msgid "Parent Item Colon:"
    163163msgstr ""
    164164
    165 #: cpt-editor.php:437
     165#: cpt-editor.php:453
    166166msgid "The parent item text. Only used for hierarchical post types."
    167167msgstr ""
    168168
    169 #: cpt-editor.php:441
     169#: cpt-editor.php:457
    170170msgid "Menu Name:"
    171171msgstr ""
    172172
    173 #: cpt-editor.php:442
     173#: cpt-editor.php:458
    174174msgid "The text used in the Dashboard's top level menu."
    175175msgstr ""
    176176
    177 #: cpt-editor.php:444
     177#: cpt-editor.php:460
    178178msgid "All Items:"
    179179msgstr ""
    180180
    181 #: cpt-editor.php:445
     181#: cpt-editor.php:461
    182182msgid "The text used in the Dashboard menu's 'all items' submenu item."
    183183msgstr ""
    184184
    185 #: cpt-editor.php:447
     185#: cpt-editor.php:463
    186186msgid "Add New:"
    187187msgstr ""
    188188
    189 #: cpt-editor.php:448
     189#: cpt-editor.php:464
    190190msgid "The text used in the Dashboard menu's 'add new' submenu item."
    191191msgstr ""
    192192
    193 #: cpt-editor.php:450
     193#: cpt-editor.php:466
    194194msgid "Admin Bar Name:"
    195195msgstr ""
    196196
    197 #: cpt-editor.php:451
     197#: cpt-editor.php:467
    198198msgid "The text used in the Admin Bar's 'New' menu."
    199199msgstr ""
    200200
    201 #: cpt-editor.php:458
     201#: cpt-editor.php:474
    202202msgid "Featured Image:"
    203203msgstr ""
    204204
    205 #: cpt-editor.php:459
     205#: cpt-editor.php:475
    206206msgid "Overrides the 'Featured Image' phrase for this post type."
    207207msgstr ""
    208208
    209 #: cpt-editor.php:461
     209#: cpt-editor.php:477
    210210msgid "Set featured Image:"
    211211msgstr ""
    212212
    213 #: cpt-editor.php:462
     213#: cpt-editor.php:478
    214214msgid "Overrides the 'Set featured image' phrase for this post type."
    215215msgstr ""
    216216
    217 #: cpt-editor.php:464
     217#: cpt-editor.php:480
    218218msgid "Remove featured Image:"
    219219msgstr ""
    220220
    221 #: cpt-editor.php:465
     221#: cpt-editor.php:481
    222222msgid "Overrides the 'Remove featured image' phrase for this post type."
    223223msgstr ""
    224224
    225 #: cpt-editor.php:467
     225#: cpt-editor.php:483
    226226msgid "Use as featured Image:"
    227227msgstr ""
    228228
    229 #: cpt-editor.php:468
     229#: cpt-editor.php:484
    230230msgid "Overrides the 'Use as featured image' phrase for this post type."
    231231msgstr ""
    232232
    233 #: cpt-editor.php:475
     233#: cpt-editor.php:491
    234234msgid "Archives:"
    235235msgstr ""
    236236
    237 #: cpt-editor.php:476
     237#: cpt-editor.php:492
    238238msgid "The post type archive label used in nav menus."
    239239msgstr ""
    240240
    241 #: cpt-editor.php:478
     241#: cpt-editor.php:494
    242242msgid "Insert into post:"
    243243msgstr ""
    244244
    245 #: cpt-editor.php:479
     245#: cpt-editor.php:495
    246246msgid "Overrides the 'Insert into post'/'Insert into page' phrase (used when inserting media into a post)."
    247247msgstr ""
    248248
    249 #: cpt-editor.php:481
     249#: cpt-editor.php:497
    250250msgid "Uploaded to this post:"
    251251msgstr ""
    252252
    253 #: cpt-editor.php:482
     253#: cpt-editor.php:498
    254254msgid "Overrides the 'Uploaded to this post'/'Uploaded to this page' phrase (used when viewing media attached to a post)."
    255255msgstr ""
    256256
    257 #: cpt-editor.php:484
     257#: cpt-editor.php:500
    258258msgid "Filter posts list:"
    259259msgstr ""
    260260
    261 #: cpt-editor.php:485
     261#: cpt-editor.php:501
    262262msgid "Screen reader text for the filter links heading on the post type listing screen."
    263263msgstr ""
    264264
    265 #: cpt-editor.php:487
     265#: cpt-editor.php:503
    266266msgid "Posts list navigation:"
    267267msgstr ""
    268268
    269 #: cpt-editor.php:488
     269#: cpt-editor.php:504
    270270msgid "Screen reader text for the pagination heading on the post type listing screen."
    271271msgstr ""
    272272
    273 #: cpt-editor.php:490
     273#: cpt-editor.php:506
    274274msgid "Posts list:"
    275275msgstr ""
    276276
    277 #: cpt-editor.php:491
     277#: cpt-editor.php:507
    278278msgid "Screen reader text for the items list heading on the post type listing screen."
    279279msgstr ""
    280280
    281 #: cpt-editor.php:497
     281#: cpt-editor.php:513
    282282msgid "Label for viewing post type archives."
    283283msgstr ""
    284284
    285 #: cpt-editor.php:500
     285#: cpt-editor.php:516
    286286msgid "Label for the attributes meta box."
    287287msgstr ""
    288288
    289 #: cpt-editor.php:505
     289#: cpt-editor.php:521
    290290msgid "Item Published:"
    291291msgstr ""
    292292
    293 #: cpt-editor.php:506
     293#: cpt-editor.php:522
    294294msgid "Label used when an item is published."
    295295msgstr ""
    296296
    297 #: cpt-editor.php:508
     297#: cpt-editor.php:524
    298298msgid "Item Published Privately:"
    299299msgstr ""
    300300
    301 #: cpt-editor.php:509
     301#: cpt-editor.php:525
    302302msgid "Label used when an item is published with private visibility."
    303303msgstr ""
    304304
    305 #: cpt-editor.php:511
     305#: cpt-editor.php:527
    306306msgid "Item Reverted to Draft:"
    307307msgstr ""
    308308
    309 #: cpt-editor.php:512
     309#: cpt-editor.php:528
    310310msgid "Label used when an item is switched to a draft."
    311311msgstr ""
    312312
    313 #: cpt-editor.php:514
     313#: cpt-editor.php:530
    314314msgid "Item Scheduled:"
    315315msgstr ""
    316316
    317 #: cpt-editor.php:515
     317#: cpt-editor.php:531
    318318msgid "Label used when an item is scheduled for publishing."
    319319msgstr ""
    320320
    321 #: cpt-editor.php:517
     321#: cpt-editor.php:533
    322322msgid "Item Updated:"
    323323msgstr ""
    324324
    325 #: cpt-editor.php:518
     325#: cpt-editor.php:534
    326326msgid "Label used when an item is updated."
    327327msgstr ""
    328328
    329 #: cpt-editor.php:523
     329#: cpt-editor.php:539
    330330msgid "Filter by Date:"
    331331msgstr ""
    332332
    333 #: cpt-editor.php:524
     333#: cpt-editor.php:540
    334334msgid "Label for the date filter in list tables."
    335335msgstr ""
    336336
    337 #: cpt-editor.php:529
     337#: cpt-editor.php:545
    338338msgid "Item Link:"
    339339msgstr ""
    340340
    341 #: cpt-editor.php:530
     341#: cpt-editor.php:546
    342342msgid "Title for a navigation link block variation."
    343343msgstr ""
    344344
    345 #: cpt-editor.php:532
     345#: cpt-editor.php:548
    346346msgid "Item Link Description:"
    347347msgstr ""
    348348
    349 #: cpt-editor.php:533
     349#: cpt-editor.php:549
    350350msgid "Description for a navigation link block variation."
    351351msgstr ""
    352352
    353 #: cpt-editor.php:538
     353#: cpt-editor.php:554
    354354msgid "Insufficient privileges!"
    355355msgstr ""
    356356
    357 #: cpt-editor.php:611
     357#: cpt-editor.php:627
    358358msgid "Custom Post Type updated. Your changes will be visible on your next page load. <a href=\"\">Reload page</a>"
    359359msgstr ""
    360360
    361 #: cpt-editor.php:620
     361#: cpt-editor.php:636
    362362msgid "This screen lets you customize the description and/or labels for this Custom Post Type."
    363363msgstr ""
    364364
    365 #: cpt-editor.php:621
     365#: cpt-editor.php:637
    366366msgid "Customized fields are shown in blue."
    367367msgstr ""
    368368
    369 #: cpt-editor.php:622
     369#: cpt-editor.php:638
    370370msgid "To reset a field to its default, empty its text field. To reset all to their defaults, use the checkbox below:"
    371371msgstr ""
    372372
    373 #: cpt-editor.php:626
     373#: cpt-editor.php:642
    374374msgid "Reset all to their defaults"
    375375msgstr ""
    376376
    377377#. Translators: 1: Label Name. 2: Custom Post Type Name.
    378 #: cpt-editor.php:645
     378#: cpt-editor.php:661
    379379msgid "%1$1s<br />(%2$2s)"
    380380msgstr ""
    381381
    382 #: cpt-editor.php:669
    383 #: cpt-editor.php:671
     382#: cpt-editor.php:685
     383#: cpt-editor.php:687
    384384msgid "[Empty]"
    385385msgstr ""
    386386
    387387#. Translators: 1: Label Description. 2: Label Default.
    388 #: cpt-editor.php:677
     388#: cpt-editor.php:693
    389389msgid "%1$1s Default: %2$2s"
    390390msgstr ""
    391391
    392 #: cpt-editor.php:688
     392#: cpt-editor.php:704
    393393msgid "Save Changes"
    394394msgstr ""
    395395
    396 #: cpt-editor.php:735
     396#: cpt-editor.php:755
    397397msgid "&lArr; Back"
    398398msgstr ""
    399399
    400 #: inc/OM4_CPT_List_Table.php:84
     400#: inc/OM4_CPT_List_Table.php:87
    401401msgid "Custom Post Type"
    402402msgstr ""
    403403
    404 #: inc/OM4_CPT_List_Table.php:85
     404#: inc/OM4_CPT_List_Table.php:88
    405405msgid "Status"
    406406msgstr ""
    407407
    408408#. Translators: %s the URL of the edit page.
    409 #: inc/OM4_CPT_List_Table.php:108
     409#: inc/OM4_CPT_List_Table.php:112
    410410msgid "<a href=\"%s\">Edit</a>"
    411411msgstr ""
    412412
    413 #: inc/OM4_CPT_List_Table.php:134
     413#: inc/OM4_CPT_List_Table.php:138
    414414msgid "Customized"
    415415msgstr ""
    416416
    417 #: inc/OM4_CPT_List_Table.php:136
     417#: inc/OM4_CPT_List_Table.php:140
    418418msgid "Default"
    419419msgstr ""
  • cpt-editor/tags/1.6.0/readme.txt

    r2850165 r3053032  
    22Contributors: jamescollins, om4csaba, om4
    33Tags: custom post type, cpt, post type, label, description, editor
    4 Requires at least: 5.5
    5 Tested up to: 6.1
    6 Stable tag: 1.5
     4Requires at least: 6.0
     5Tested up to: 6.4
     6Stable tag: 1.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    9 Requires PHP: 7.4
    109
    1110Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface.
     
    7675
    7776== Changelog ==
     77
     78= 1.6.0 =
     79* Minimum required WordPress version updated to 6.0.
     80* Mark compatibility with WordPress version 6.4.
    7881
    7982= 1.5.0 =
  • cpt-editor/trunk/cpt-editor.php

    r2850165 r3053032  
    44Plugin URI: https://om4.io/plugins/custom-post-type-editor/
    55Description: Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface.
    6 Version: 1.5
     6Version: 1.6
    77Author: OM4 Software
    88Author URI: https://om4.io/
     
    1313
    1414/*
    15     Copyright 2012-2023 OM4 (email : plugins@om4.com.au)
     15    Copyright 2012-2023 OM4 (email: plugins@om4.io    web: https://om4.io/)
    1616
    1717    This program is free software; you can redistribute it and/or modify
     
    9595     * Default settings.
    9696     *
    97      * @var array
     97     * @var array{'types':array<string,array<string,string>>}
    9898     */
    9999    protected $settings = array(
     
    119119        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
    120120
    121         $this->installed_version = intval( get_option( $this->option_name ) );
     121        $this->installed_version = absint( get_option( $this->option_name ) );
    122122
    123123        $data = get_option( $this->option_name );
    124124        if ( is_array( $data ) ) {
    125             $this->installed_version = intval( $data['version'] );
     125            $this->installed_version = absint( $data['version'] );
    126126            $this->settings          = $data['settings'];
    127127        }
    128128
    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 );
    131130    }
    132131
    133132    /**
    134133     * Initialise I18n/Localisation.
     134     *
     135     * @return void
    135136     */
    136137    public function load_domain() {
     
    140141    /**
    141142     * Plugin Activation Tasks.
     143     *
     144     * @return void
    142145     */
    143146    public function activate() {
     
    151154    /**
    152155     * Performs any database upgrade tasks if required.
     156     *
     157     * @return void
    153158     */
    154159    public function check_version() {
     
    156161            // Upgrade tasks.
    157162            if ( 0 === $this->installed_version ) {
    158                 $this->installed_version ++;
     163                ++$this->installed_version;
    159164            }
    160165            $this->save_settings();
     
    168173     * original CPT so that we can detect that its been modified.
    169174     *
    170      * @param string       $post_type        Post 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 ) {
    174179        global $wp_post_types;
    175180
     
    221226    /**
    222227     * Set up the Admin Settings menu
     228     *
     229     * @return void
    223230     */
    224231    public function admin_menu() {
     
    243250     * This function checks to see if the user has modified the labels for any of these built-in custom post types,
    244251     * and if so it manually overrides the dashboard menu so that it uses these defined labels.
     252     *
     253     * @return void
    245254     */
    246255    private function override_built_in_custom_post_type_menu_labels() {
     
    324333    /**
    325334     * Admin Page Controller/Handler.
     335     *
     336     * @return void
    326337     */
    327338    public function admin_page() {
     
    331342        // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    332343        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();
    337349    }
    338350
     
    340352    /**
    341353     * The Dashboard screen that lists all registered Custom Post Types.
     354     *
     355     * @return void
    342356     */
    343357    private function admin_page_list() {
     
    360374    /**
    361375     * The Dashboard screen that lets the user edit/modify a Custom Post Type.
     376     *
     377     * @return void
    362378     */
    363379    protected function admin_page_edit() {
     
    695711    /**
    696712     * The header for the Dashboard screens.
     713     *
     714     * @return void
    697715     */
    698716    private function admin_page_header() {
     
    730748    /**
    731749     * Link back.
     750     *
     751     * @return void
    732752     */
    733753    private function back_link() {
     
    739759    /**
    740760     * The footer for the Dashboard screens.
     761     *
     762     * @return void
    741763     */
    742764    private function admin_page_footer() {
     
    765787        $num = ( isset( $this->settings['types'][ $post_type ]['labels'] ) && is_array( $this->settings['types'][ $post_type ]['labels'] ) ) ? count( $this->settings['types'][ $post_type ]['labels'] ) : 0;
    766788        if ( isset( $this->settings['types'][ $post_type ]['description'] ) ) {
    767             $num++;
     789            ++$num;
    768790        }
    769791        return $num;
     
    772794    /**
    773795     * Saves the plugin's settings to the database
     796     *
     797     * @return void
    774798     */
    775799    protected function save_settings() {
  • cpt-editor/trunk/inc/OM4_CPT_List_Table.php

    r2850165 r3053032  
    3232     * @var OM4_CPT_Editor
    3333     */
    34     private OM4_CPT_Editor $instance;
     34    private $instance;
    3535
    3636    /**
     
    5959    /**
    6060     * Retrieve the list of custom post types
     61     *
     62     * @return void
    6163     */
    6264    public function prepare_items() {
     
    6668                'title'  => $post_type_object->label,
    6769                'name'   => $post_type,
    68                 'status' => $this->instance->number_of_customizations( $post_type ),
     70                'status' => $this->instance->number_of_customizations( (string) $post_type ),
    6971            );
    7072        }
     
    7981     *
    8082     * @inheritdoc
     83     * @return array<string,string>
    8184     */
    8285    public function get_columns() {
     
    9295     * Generates content for a single row's name column.
    9396     *
    94      * @param array $item The current item.
     97     * @param array<string,string> $item The current item.
     98     * @return string
    9599     */
    96100    public function column_name( $item ) {
     
    126130     * Generates content for a single row's status column.
    127131     *
    128      * @param array $item The current item.
     132     * @param array<string,string> $item The current item.
    129133     *
    130134     * @return string|null
     
    137141        }
    138142    }
    139 
    140143}
  • cpt-editor/trunk/languages/cpt-editor.pot

    r2850165 r3053032  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"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"
    1313"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"
    1515"X-Domain: cpt-editor\n"
    1616
     
    3535msgstr ""
    3636
    37 #: cpt-editor.php:226
    38 #: cpt-editor.php:227
     37#: cpt-editor.php:233
     38#: cpt-editor.php:234
    3939msgid "Custom Post Types"
    4040msgstr ""
    4141
    42 #: cpt-editor.php:346
     42#: cpt-editor.php:360
    4343msgid "Registered Custom Post Types"
    4444msgstr ""
    4545
    46 #: cpt-editor.php:347
     46#: cpt-editor.php:361
    4747msgid "Below is a list of registered custom post types. These post types are typically registered by WordPress core, WordPress themes or WordPress plugins."
    4848msgstr ""
    4949
    50 #: cpt-editor.php:348
     50#: cpt-editor.php:362
    5151msgid "Click on a post type to view its details."
    5252msgstr ""
    5353
    54 #: cpt-editor.php:375
     54#: cpt-editor.php:391
    5555msgid "Invalid Custom Post Type"
    5656msgstr ""
    5757
    5858#. Translators: %s The name of the custom post type.
    59 #: cpt-editor.php:387
     59#: cpt-editor.php:403
    6060msgid "Edit '%s' Custom Post Type"
    6161msgstr ""
    6262
    63 #: cpt-editor.php:400
     63#: cpt-editor.php:416
    6464msgid "Description:"
    6565msgstr ""
    6666
    67 #: cpt-editor.php:401
     67#: cpt-editor.php:417
    6868msgid "A short descriptive summary of what the post type is."
    6969msgstr ""
    7070
    71 #: cpt-editor.php:403
     71#: cpt-editor.php:419
    7272msgid "Name:"
    7373msgstr ""
    7474
    75 #: cpt-editor.php:404
     75#: cpt-editor.php:420
    7676msgid "General name for the post type, usually plural."
    7777msgstr ""
    7878
    79 #: cpt-editor.php:406
     79#: cpt-editor.php:422
    8080msgid "Singular Name:"
    8181msgstr ""
    8282
    83 #: cpt-editor.php:407
     83#: cpt-editor.php:423
    8484msgid "Name for one object of this post type."
    8585msgstr ""
    8686
    87 #: cpt-editor.php:409
     87#: cpt-editor.php:425
    8888msgid "Add New Item:"
    8989msgstr ""
    9090
    91 #: cpt-editor.php:410
     91#: cpt-editor.php:426
    9292msgid "The add new item text."
    9393msgstr ""
    9494
    95 #: cpt-editor.php:412
     95#: cpt-editor.php:428
    9696msgid "Edit Item:"
    9797msgstr ""
    9898
    99 #: cpt-editor.php:413
     99#: cpt-editor.php:429
    100100msgid "The edit item text."
    101101msgstr ""
    102102
    103 #: cpt-editor.php:415
     103#: cpt-editor.php:431
    104104msgid "New Item:"
    105105msgstr ""
    106106
    107 #: cpt-editor.php:416
     107#: cpt-editor.php:432
    108108msgid "The new item text."
    109109msgstr ""
    110110
    111 #: cpt-editor.php:418
     111#: cpt-editor.php:434
    112112msgid "View Item:"
    113113msgstr ""
    114114
    115 #: cpt-editor.php:419
     115#: cpt-editor.php:435
    116116msgid "The view item text."
    117117msgstr ""
    118118
    119 #: cpt-editor.php:421
    120 #: cpt-editor.php:496
     119#: cpt-editor.php:437
     120#: cpt-editor.php:512
    121121msgid "View Items:"
    122122msgstr ""
    123123
    124 #: cpt-editor.php:422
     124#: cpt-editor.php:438
    125125msgid "The label used in the toolbar on the post listing screen (if this post type supports archives)."
    126126msgstr ""
    127127
    128 #: cpt-editor.php:424
    129 #: cpt-editor.php:499
     128#: cpt-editor.php:440
     129#: cpt-editor.php:515
    130130msgid "Attributes:"
    131131msgstr ""
    132132
    133 #: cpt-editor.php:425
     133#: cpt-editor.php:441
    134134msgid "The label used for the title of the post attributes meta box (used to select post type templates)."
    135135msgstr ""
    136136
    137 #: cpt-editor.php:427
     137#: cpt-editor.php:443
    138138msgid "Search Items:"
    139139msgstr ""
    140140
    141 #: cpt-editor.php:428
     141#: cpt-editor.php:444
    142142msgid "The search items text."
    143143msgstr ""
    144144
    145 #: cpt-editor.php:430
     145#: cpt-editor.php:446
    146146msgid "Not Found:"
    147147msgstr ""
    148148
    149 #: cpt-editor.php:431
     149#: cpt-editor.php:447
    150150msgid "The not found text."
    151151msgstr ""
    152152
    153 #: cpt-editor.php:433
     153#: cpt-editor.php:449
    154154msgid "Not Found in Trash:"
    155155msgstr ""
    156156
    157 #: cpt-editor.php:434
     157#: cpt-editor.php:450
    158158msgid "The not found in trash text."
    159159msgstr ""
    160160
    161 #: cpt-editor.php:436
     161#: cpt-editor.php:452
    162162msgid "Parent Item Colon:"
    163163msgstr ""
    164164
    165 #: cpt-editor.php:437
     165#: cpt-editor.php:453
    166166msgid "The parent item text. Only used for hierarchical post types."
    167167msgstr ""
    168168
    169 #: cpt-editor.php:441
     169#: cpt-editor.php:457
    170170msgid "Menu Name:"
    171171msgstr ""
    172172
    173 #: cpt-editor.php:442
     173#: cpt-editor.php:458
    174174msgid "The text used in the Dashboard's top level menu."
    175175msgstr ""
    176176
    177 #: cpt-editor.php:444
     177#: cpt-editor.php:460
    178178msgid "All Items:"
    179179msgstr ""
    180180
    181 #: cpt-editor.php:445
     181#: cpt-editor.php:461
    182182msgid "The text used in the Dashboard menu's 'all items' submenu item."
    183183msgstr ""
    184184
    185 #: cpt-editor.php:447
     185#: cpt-editor.php:463
    186186msgid "Add New:"
    187187msgstr ""
    188188
    189 #: cpt-editor.php:448
     189#: cpt-editor.php:464
    190190msgid "The text used in the Dashboard menu's 'add new' submenu item."
    191191msgstr ""
    192192
    193 #: cpt-editor.php:450
     193#: cpt-editor.php:466
    194194msgid "Admin Bar Name:"
    195195msgstr ""
    196196
    197 #: cpt-editor.php:451
     197#: cpt-editor.php:467
    198198msgid "The text used in the Admin Bar's 'New' menu."
    199199msgstr ""
    200200
    201 #: cpt-editor.php:458
     201#: cpt-editor.php:474
    202202msgid "Featured Image:"
    203203msgstr ""
    204204
    205 #: cpt-editor.php:459
     205#: cpt-editor.php:475
    206206msgid "Overrides the 'Featured Image' phrase for this post type."
    207207msgstr ""
    208208
    209 #: cpt-editor.php:461
     209#: cpt-editor.php:477
    210210msgid "Set featured Image:"
    211211msgstr ""
    212212
    213 #: cpt-editor.php:462
     213#: cpt-editor.php:478
    214214msgid "Overrides the 'Set featured image' phrase for this post type."
    215215msgstr ""
    216216
    217 #: cpt-editor.php:464
     217#: cpt-editor.php:480
    218218msgid "Remove featured Image:"
    219219msgstr ""
    220220
    221 #: cpt-editor.php:465
     221#: cpt-editor.php:481
    222222msgid "Overrides the 'Remove featured image' phrase for this post type."
    223223msgstr ""
    224224
    225 #: cpt-editor.php:467
     225#: cpt-editor.php:483
    226226msgid "Use as featured Image:"
    227227msgstr ""
    228228
    229 #: cpt-editor.php:468
     229#: cpt-editor.php:484
    230230msgid "Overrides the 'Use as featured image' phrase for this post type."
    231231msgstr ""
    232232
    233 #: cpt-editor.php:475
     233#: cpt-editor.php:491
    234234msgid "Archives:"
    235235msgstr ""
    236236
    237 #: cpt-editor.php:476
     237#: cpt-editor.php:492
    238238msgid "The post type archive label used in nav menus."
    239239msgstr ""
    240240
    241 #: cpt-editor.php:478
     241#: cpt-editor.php:494
    242242msgid "Insert into post:"
    243243msgstr ""
    244244
    245 #: cpt-editor.php:479
     245#: cpt-editor.php:495
    246246msgid "Overrides the 'Insert into post'/'Insert into page' phrase (used when inserting media into a post)."
    247247msgstr ""
    248248
    249 #: cpt-editor.php:481
     249#: cpt-editor.php:497
    250250msgid "Uploaded to this post:"
    251251msgstr ""
    252252
    253 #: cpt-editor.php:482
     253#: cpt-editor.php:498
    254254msgid "Overrides the 'Uploaded to this post'/'Uploaded to this page' phrase (used when viewing media attached to a post)."
    255255msgstr ""
    256256
    257 #: cpt-editor.php:484
     257#: cpt-editor.php:500
    258258msgid "Filter posts list:"
    259259msgstr ""
    260260
    261 #: cpt-editor.php:485
     261#: cpt-editor.php:501
    262262msgid "Screen reader text for the filter links heading on the post type listing screen."
    263263msgstr ""
    264264
    265 #: cpt-editor.php:487
     265#: cpt-editor.php:503
    266266msgid "Posts list navigation:"
    267267msgstr ""
    268268
    269 #: cpt-editor.php:488
     269#: cpt-editor.php:504
    270270msgid "Screen reader text for the pagination heading on the post type listing screen."
    271271msgstr ""
    272272
    273 #: cpt-editor.php:490
     273#: cpt-editor.php:506
    274274msgid "Posts list:"
    275275msgstr ""
    276276
    277 #: cpt-editor.php:491
     277#: cpt-editor.php:507
    278278msgid "Screen reader text for the items list heading on the post type listing screen."
    279279msgstr ""
    280280
    281 #: cpt-editor.php:497
     281#: cpt-editor.php:513
    282282msgid "Label for viewing post type archives."
    283283msgstr ""
    284284
    285 #: cpt-editor.php:500
     285#: cpt-editor.php:516
    286286msgid "Label for the attributes meta box."
    287287msgstr ""
    288288
    289 #: cpt-editor.php:505
     289#: cpt-editor.php:521
    290290msgid "Item Published:"
    291291msgstr ""
    292292
    293 #: cpt-editor.php:506
     293#: cpt-editor.php:522
    294294msgid "Label used when an item is published."
    295295msgstr ""
    296296
    297 #: cpt-editor.php:508
     297#: cpt-editor.php:524
    298298msgid "Item Published Privately:"
    299299msgstr ""
    300300
    301 #: cpt-editor.php:509
     301#: cpt-editor.php:525
    302302msgid "Label used when an item is published with private visibility."
    303303msgstr ""
    304304
    305 #: cpt-editor.php:511
     305#: cpt-editor.php:527
    306306msgid "Item Reverted to Draft:"
    307307msgstr ""
    308308
    309 #: cpt-editor.php:512
     309#: cpt-editor.php:528
    310310msgid "Label used when an item is switched to a draft."
    311311msgstr ""
    312312
    313 #: cpt-editor.php:514
     313#: cpt-editor.php:530
    314314msgid "Item Scheduled:"
    315315msgstr ""
    316316
    317 #: cpt-editor.php:515
     317#: cpt-editor.php:531
    318318msgid "Label used when an item is scheduled for publishing."
    319319msgstr ""
    320320
    321 #: cpt-editor.php:517
     321#: cpt-editor.php:533
    322322msgid "Item Updated:"
    323323msgstr ""
    324324
    325 #: cpt-editor.php:518
     325#: cpt-editor.php:534
    326326msgid "Label used when an item is updated."
    327327msgstr ""
    328328
    329 #: cpt-editor.php:523
     329#: cpt-editor.php:539
    330330msgid "Filter by Date:"
    331331msgstr ""
    332332
    333 #: cpt-editor.php:524
     333#: cpt-editor.php:540
    334334msgid "Label for the date filter in list tables."
    335335msgstr ""
    336336
    337 #: cpt-editor.php:529
     337#: cpt-editor.php:545
    338338msgid "Item Link:"
    339339msgstr ""
    340340
    341 #: cpt-editor.php:530
     341#: cpt-editor.php:546
    342342msgid "Title for a navigation link block variation."
    343343msgstr ""
    344344
    345 #: cpt-editor.php:532
     345#: cpt-editor.php:548
    346346msgid "Item Link Description:"
    347347msgstr ""
    348348
    349 #: cpt-editor.php:533
     349#: cpt-editor.php:549
    350350msgid "Description for a navigation link block variation."
    351351msgstr ""
    352352
    353 #: cpt-editor.php:538
     353#: cpt-editor.php:554
    354354msgid "Insufficient privileges!"
    355355msgstr ""
    356356
    357 #: cpt-editor.php:611
     357#: cpt-editor.php:627
    358358msgid "Custom Post Type updated. Your changes will be visible on your next page load. <a href=\"\">Reload page</a>"
    359359msgstr ""
    360360
    361 #: cpt-editor.php:620
     361#: cpt-editor.php:636
    362362msgid "This screen lets you customize the description and/or labels for this Custom Post Type."
    363363msgstr ""
    364364
    365 #: cpt-editor.php:621
     365#: cpt-editor.php:637
    366366msgid "Customized fields are shown in blue."
    367367msgstr ""
    368368
    369 #: cpt-editor.php:622
     369#: cpt-editor.php:638
    370370msgid "To reset a field to its default, empty its text field. To reset all to their defaults, use the checkbox below:"
    371371msgstr ""
    372372
    373 #: cpt-editor.php:626
     373#: cpt-editor.php:642
    374374msgid "Reset all to their defaults"
    375375msgstr ""
    376376
    377377#. Translators: 1: Label Name. 2: Custom Post Type Name.
    378 #: cpt-editor.php:645
     378#: cpt-editor.php:661
    379379msgid "%1$1s<br />(%2$2s)"
    380380msgstr ""
    381381
    382 #: cpt-editor.php:669
    383 #: cpt-editor.php:671
     382#: cpt-editor.php:685
     383#: cpt-editor.php:687
    384384msgid "[Empty]"
    385385msgstr ""
    386386
    387387#. Translators: 1: Label Description. 2: Label Default.
    388 #: cpt-editor.php:677
     388#: cpt-editor.php:693
    389389msgid "%1$1s Default: %2$2s"
    390390msgstr ""
    391391
    392 #: cpt-editor.php:688
     392#: cpt-editor.php:704
    393393msgid "Save Changes"
    394394msgstr ""
    395395
    396 #: cpt-editor.php:735
     396#: cpt-editor.php:755
    397397msgid "&lArr; Back"
    398398msgstr ""
    399399
    400 #: inc/OM4_CPT_List_Table.php:84
     400#: inc/OM4_CPT_List_Table.php:87
    401401msgid "Custom Post Type"
    402402msgstr ""
    403403
    404 #: inc/OM4_CPT_List_Table.php:85
     404#: inc/OM4_CPT_List_Table.php:88
    405405msgid "Status"
    406406msgstr ""
    407407
    408408#. Translators: %s the URL of the edit page.
    409 #: inc/OM4_CPT_List_Table.php:108
     409#: inc/OM4_CPT_List_Table.php:112
    410410msgid "<a href=\"%s\">Edit</a>"
    411411msgstr ""
    412412
    413 #: inc/OM4_CPT_List_Table.php:134
     413#: inc/OM4_CPT_List_Table.php:138
    414414msgid "Customized"
    415415msgstr ""
    416416
    417 #: inc/OM4_CPT_List_Table.php:136
     417#: inc/OM4_CPT_List_Table.php:140
    418418msgid "Default"
    419419msgstr ""
  • cpt-editor/trunk/readme.txt

    r2850165 r3053032  
    22Contributors: jamescollins, om4csaba, om4
    33Tags: custom post type, cpt, post type, label, description, editor
    4 Requires at least: 5.5
    5 Tested up to: 6.1
    6 Stable tag: 1.5
     4Requires at least: 6.0
     5Tested up to: 6.4
     6Stable tag: 1.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    9 Requires PHP: 7.4
    109
    1110Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface.
     
    7675
    7776== Changelog ==
     77
     78= 1.6.0 =
     79* Minimum required WordPress version updated to 6.0.
     80* Mark compatibility with WordPress version 6.4.
    7881
    7982= 1.5.0 =
Note: See TracChangeset for help on using the changeset viewer.