Plugin Directory

Changeset 2954735


Ignore:
Timestamp:
08/17/2023 07:44:09 AM (2 years ago)
Author:
andreadegiovine
Message:

4.0.9

Location:
custom-post-types
Files:
43 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • custom-post-types/trunk/custom-post-types.php

    r2948437 r2954735  
    88Text Domain: custom-post-types
    99Domain Path: /languages/
    10 Version: 4.0.8
     10Version: 4.0.9
    1111*/
    1212
     
    4545}
    4646
    47 $custom_post_types = new Core();
     47Core::getInstance();
    4848
    4949do_action('custom_post_types_plugin_loaded');
  • custom-post-types/trunk/includes/classes/AdminPages.php

    r2944690 r2954735  
    2020            $pages = (array)apply_filters(Utils::getHookName('register_admin_pages'), $pagesByUi);
    2121
     22            $pagesByCore = Utils::getUiAdminPagesArgs();
     23
     24            $pages = array_merge($pagesByCore, $pages);
     25
    2226            if (empty($pages)) return;
    2327
    24             foreach ($pages as $page) {
     28            foreach ($pages as $i => $page) {
    2529                $id = !empty($page['id']) && is_string($page['id']) ? $page['id'] : false;
    2630                $parent = !empty($page['parent']) && is_string($page['parent']) ? $page['parent'] : false;
     
    3135                $capability = !empty($page['admin_only']) ? 'administrator' : 'edit_posts';
    3236
     37                $errorInfo = Utils::getRegistrationErrorNoticeInfo($page, 'page');
     38
    3339                if (!$id || !$title) {
    34                     $errorInfo = Utils::getRegistrationErrorNoticeInfo($page, 'page');
    35 
    3640                    add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
    3741                        $args[] = [
     
    4549                        return $args;
    4650                    });
     51                    unset($pages[$i]);
     52                    continue;
     53                }
     54
     55                if(in_array($id, Utils::getAdminPagesBlacklist())){
     56                    add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
     57                        $args[] = [
     58                            'id' => $errorInfo['id'],
     59                            'title' => Utils::getNoticesTitle(),
     60                            'message' => __('Admin page reserved or already registered, try a different "id".', 'custom-post-types') . $errorInfo['details'],
     61                            'type' => 'error',
     62                            'dismissible' => 3,
     63                            'buttons' => false,
     64                        ];
     65                        return $args;
     66                    });
     67                    unset($pages[$i]);
    4768                    continue;
    4869                }
     
    5980
    6081                if (!$registeredAdminPage) {
    61                     $errorInfo = Utils::getRegistrationErrorNoticeInfo($page, 'page');
    62 
    6382                    add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
    6483                        $args[] = [
     
    7291                        return $args;
    7392                    });
     93                    unset($pages[$i]);
    7494                }
    7595            }
  • custom-post-types/trunk/includes/classes/Core.php

    r2948437 r2954735  
    1010{
    1111    /**
     12     * @var
     13     */
     14    private static $instance;
     15
     16    /**
    1217     * @var PostTypes
    1318     */
     
    3439    private $adminNotices;
    3540
    36     public function __construct()
     41    private function __construct()
    3742    {
    3843        // UI
     
    5358
    5459    /**
     60     * @return Core
     61     */
     62    public static function getInstance()
     63    {
     64        // Check is $_instance has been set
     65        if(self::$instance instanceof Core)
     66        {
     67            // Returns the instance
     68            return self::$instance;
     69        }
     70        // Creates sets object to instance
     71        self::$instance = new Core();
     72    }
     73
     74    /**
    5575     * @return PostTypes
    5676     */
     
    122142    private function registerUiPostTypes()
    123143    {
    124         // Register ui post types
    125         add_filter(Utils::getHookName('register_post_types'), function ($args) {
    126             $default_args = [
    127                 'public' => false,
    128                 'publicly_queryable' => false,
    129                 'show_ui' => true,
    130                 'show_in_menu' => true,
    131                 'show_in_rest' => false,
    132                 'query_var' => false,
    133                 'rewrite' => false,
    134                 'capabilities' => [
    135                     'edit_post' => 'update_core',
    136                     'read_post' => 'update_core',
    137                     'delete_post' => 'update_core',
    138                     'edit_posts' => 'update_core',
    139                     'edit_others_posts' => 'update_core',
    140                     'delete_posts' => 'update_core',
    141                     'publish_posts' => 'update_core',
    142                     'read_private_posts' => 'update_core'
    143                 ],
    144                 'has_archive' => false,
    145                 'hierarchical' => false,
    146                 'menu_position' => null,
    147                 'supports' => [''],
    148                 'menu_icon' => 'dashicons-index-card',
    149                 'can_export' => false,
    150             ];
    151             // Create/edit new post type
    152             $args[] = [
    153                 'id' => Utils::getInfo('ui_prefix'),
    154                 'singular' => __('Post type', 'custom-post-types'),
    155                 'plural' => __('Post types', 'custom-post-types'),
    156                 'labels' => [
    157                     'name' => _x('Custom post types', 'Dashboard menu', 'custom-post-types'),
    158                     'singular_name' => __('Post type', 'custom-post-types'),
    159                     'menu_name' => __('Extend / Manage', 'custom-post-types'),
    160                     'name_admin_bar' => __('Post type', 'custom-post-types'),
    161                     'add_new' => __('Add post type', 'custom-post-types'),
    162                     'add_new_item' => __('Add new post type', 'custom-post-types'),
    163                     'new_item' => __('New post type', 'custom-post-types'),
    164                     'edit_item' => __('Edit post type', 'custom-post-types'),
    165                     'view_item' => __('View post type', 'custom-post-types'),
    166                     'item_updated' => __('Post type updated', 'custom-post-types'),
    167                     'all_items' => _x('Post types', 'Dashboard menu', 'custom-post-types'),
    168                     'search_items' => __('Search post type', 'custom-post-types'),
    169                     'not_found' => __('No post type available.', 'custom-post-types'),
    170                     'not_found_in_trash' => __('No post type in the trash.', 'custom-post-types')
    171                 ],
    172                 'args' => array_replace_recursive($default_args, [
    173                     'description' => __('Create and manage custom post types.', 'custom-post-types'),
    174                 ]),
    175                 'columns' => [
    176                     'title' => [
    177                         'label' => __('Plural', 'custom-post-types'),
    178                     ],
    179                     'item_key' => [
    180                         'label' => __('Key', 'custom-post-types'),
    181                         'callback' => function ($post_id) {
    182                             echo get_post_meta($post_id, 'id', true);
    183                         }
    184                     ],
    185                     'item_count' => [
    186                         'label' => __('Count', 'custom-post-types'),
    187                         'callback' => function ($post_id) {
    188                             $key = get_post_meta($post_id, 'id', true);
    189                             if (empty($key) || !(isset(wp_count_posts($key)->publish) ? wp_count_posts($key)->publish : false)) {
    190                                 echo "0";
    191                                 return;
    192                             }
    193                             printf(
    194                                 '<a href="%s" title="%s">%s</a>',
    195                                 admin_url('edit.php?post_type=' . $key),
    196                                 __('View', 'custom-post-types'),
    197                                 wp_count_posts($key)->publish
    198                             );
    199                         }
    200                     ],
    201                     'date' => [],
    202                 ]
    203             ];
    204             // Create/edit new tax
    205             $args[] = [
    206                 'id' => Utils::getInfo('ui_prefix') . '_tax',
    207                 'singular' => __('Taxonomy', 'custom-post-types'),
    208                 'plural' => __('Taxonomies', 'custom-post-types'),
    209                 'labels' => [
    210                     'name' => __('Custom taxonomies', 'custom-post-types'),
    211                     'singular_name' => __('Taxonomy', 'custom-post-types'),
    212                     'menu_name' => __('Taxonomy', 'custom-post-types'),
    213                     'name_admin_bar' => __('Taxonomy', 'custom-post-types'),
    214                     'add_new' => __('Add taxonomy', 'custom-post-types'),
    215                     'add_new_item' => __('Add new taxonomy', 'custom-post-types'),
    216                     'new_item' => __('New taxonomy', 'custom-post-types'),
    217                     'edit_item' => __('Edit taxonomy', 'custom-post-types'),
    218                     'view_item' => __('View taxonomy', 'custom-post-types'),
    219                     'item_updated' => __('Taxonomy updated', 'custom-post-types'),
    220                     'all_items' => __('Taxonomies', 'custom-post-types'),
    221                     'search_items' => __('Search taxonomy', 'custom-post-types'),
    222                     'not_found' => __('No taxonomy available.', 'custom-post-types'),
    223                     'not_found_in_trash' => __('No taxonomy in the trash.', 'custom-post-types')
    224                 ],
    225                 'args' => array_replace_recursive($default_args, [
    226                     'description' => __('Create and manage custom taxonomies.', 'custom-post-types'),
    227                     'show_in_menu' => 'edit.php?post_type=' . Utils::getInfo('ui_prefix')
    228                 ]),
    229                 'columns' => [
    230                     'title' => [
    231                         'label' => __('Plural', 'custom-post-types'),
    232                     ],
    233                     'item_key' => [
    234                         'label' => __('Key', 'custom-post-types'),
    235                         'callback' => function ($post_id) {
    236                             echo get_post_meta($post_id, 'id', true);
    237                         }
    238                     ],
    239                     'item_count' => [
    240                         'label' => __('Count', 'custom-post-types'),
    241                         'callback' => function ($post_id) {
    242                             $key = get_post_meta($post_id, 'id', true);
    243                             if (empty($key) || is_wp_error(wp_count_terms(['taxonomy' => $key]))) {
    244                                 echo "0";
    245                                 return;
    246                             }
    247                             printf(
    248                                 '<a href="%s" title="%s">%s</a>',
    249                                 admin_url('edit-tags.php?taxonomy=' . $key),
    250                                 __('View', 'custom-post-types'),
    251                                 wp_count_terms(['taxonomy' => $key])
    252                             );
    253                         }
    254                     ],
    255                     'used_by' => [
    256                         'label' => __('Assignment', 'custom-post-types'),
    257                         'callback' => function ($post_id) {
    258                             $supports = get_post_meta($post_id, 'supports', true);
    259                             if (empty($supports)) return;
    260                             $output = [];
    261                             foreach ($supports as $post_type) {
    262                                 if (!get_post_type_object($post_type)) continue;
    263                                 $output[] = sprintf(
    264                                     '<a href="%s" title="%s">%s</a>',
    265                                     admin_url('edit.php?post_type=' . $post_type),
    266                                     __('View', 'custom-post-types'),
    267                                     get_post_type_object($post_type)->labels->name
    268                                 );
    269                             }
    270                             echo implode(', ', $output);
    271                         }
    272                     ],
    273                     'date' => [],
    274                 ]
    275             ];
    276             // Create/edit new fieldsgroup
    277             $args[] = [
    278                 'id' => Utils::getInfo('ui_prefix') . '_field',
    279                 'singular' => __('Field group', 'custom-post-types'),
    280                 'plural' => __('Field groups', 'custom-post-types'),
    281                 'labels' => [
    282                     'name' => __('Custom field groups', 'custom-post-types'),
    283                     'singular_name' => __('Field group', 'custom-post-types'),
    284                     'menu_name' => __('Field group', 'custom-post-types'),
    285                     'name_admin_bar' => __('Field group', 'custom-post-types'),
    286                     'add_new' => __('Add field group', 'custom-post-types'),
    287                     'add_new_item' => __('Add new field group', 'custom-post-types'),
    288                     'new_item' => __('New field group', 'custom-post-types'),
    289                     'edit_item' => __('Edit field group', 'custom-post-types'),
    290                     'view_item' => __('View field group', 'custom-post-types'),
    291                     'item_updated' => __('Field group updated', 'custom-post-types'),
    292                     'all_items' => __('Field groups', 'custom-post-types'),
    293                     'search_items' => __('Search field group', 'custom-post-types'),
    294                     'not_found' => __('No field group available.', 'custom-post-types'),
    295                     'not_found_in_trash' => __('No field group in the trash.', 'custom-post-types')
    296                 ],
    297                 'args' => array_replace_recursive($default_args, [
    298                     'description' => __('Create and manage custom field groups.', 'custom-post-types'),
    299                     'show_in_menu' => 'edit.php?post_type=' . Utils::getInfo('ui_prefix'),
    300                     'supports' => ['title']
    301                 ]),
    302                 'columns' => [
    303                     'title' => [
    304                         'label' => __('Name', 'custom-post-types'),
    305                     ],
    306                     'item_count' => [
    307                         'label' => __('Fields', 'custom-post-types') . ' (' . __('Key', 'custom-post-types') . ')',
    308                         'callback' => function ($post_id) {
    309                             $fields = get_post_meta($post_id, 'fields', true);
    310                             if (empty($fields)) return;
    311                             $fields_labels_array = array_map(
    312                                 function ($field) {
    313                                     return $field['label'] . ' (' . $field['key'] . ')';
    314                                 },
    315                                 $fields
    316                             );
    317                             echo implode(', ', $fields_labels_array);
    318                         }
    319                     ],
    320                     'item_position' => [
    321                         'label' => __('Position', 'custom-post-types'),
    322                         'callback' => function ($post_id) {
    323                             $available = [
    324                                 '' => __('NORMAL', 'custom-post-types'),
    325                                 'normal' => __('NORMAL', 'custom-post-types'),
    326                                 'side' => __('SIDEBAR', 'custom-post-types'),
    327                                 'advanced' => __('ADVANCED', 'custom-post-types'),
    328                             ];
    329                             echo $available[get_post_meta($post_id, 'position', true)];
    330                         }
    331                     ],
    332                     'used_by' => [
    333                         'label' => __('Assignment', 'custom-post-types'),
    334                         'callback' => function ($post_id) {
    335                             $supports = get_post_meta($post_id, 'supports', true);
    336                             if (empty($supports)) return;
    337                             $output = [];
    338                             foreach ($supports as $post_type) {
    339                                 $content_type = 'cpt';
    340                                 $content = $post_type;
    341 
    342                                 if (strpos($post_type, '/') !== false) {
    343                                     $content_type = explode('/', $post_type)[0];
    344                                     $content = explode('/', $post_type)[1];
    345                                 }
    346 
    347                                 switch ($content_type) {
    348                                     case 'cpt':
    349                                         if (get_post_type_object($content)) {
    350                                             $output[] = sprintf(
    351                                                 '<a href="%s" title="%s">%s</a>',
    352                                                 admin_url('edit.php?post_type=' . $content),
    353                                                 __('View', 'custom-post-types'),
    354                                                 get_post_type_object($content)->labels->name
    355                                             );
    356                                         }
    357                                         break;
    358                                     case 'tax':
    359                                         if (get_taxonomy($content)) {
    360                                             $output[] = sprintf(
    361                                                 '<a href="%s" title="%s">%s</a>',
    362                                                 admin_url('edit-tags.php?taxonomy=' . $content),
    363                                                 __('View', 'custom-post-types'),
    364                                                 get_taxonomy($content)->labels->name
    365                                             );
    366                                         }
    367                                         break;
    368                                     case 'extra':
    369                                         if ($content == 'users') {
    370                                             $output[] = sprintf(
    371                                                 '<a href="%s" title="%s">%s</a>',
    372                                                 admin_url('users.php'),
    373                                                 __('View', 'custom-post-types'),
    374                                                 __('Users')
    375                                             );
    376                                         }
    377                                         break;
    378                                     case 'options':
    379                                         if (isset(Utils::getSettingsPagesOptions()[$content])) {
    380                                             $pageUrl = !empty(Utils::getSettingsPagesOptions()[$content]['url']) ? admin_url(Utils::getSettingsPagesOptions()[$content]['url']) : menu_page_url($content, false);
    381                                             $output[] = sprintf(
    382                                                 '<a href="%s" title="%s">%s</a>',
    383                                                 $pageUrl,
    384                                                 __('View', 'custom-post-types'),
    385                                                 Utils::getSettingsPagesOptions()[$content]['title']
    386                                             );
    387                                         }
    388                                         break;
    389                                 }
    390                             }
    391                             echo implode(', ', $output);
    392                         }
    393                     ],
    394                     'date' => [],
    395                 ]
    396             ];
    397             return $args;
    398         });
     144        // CustomPostTypes\includes\classes\Utils::getUiPostTypesArgs
    399145
    400146        // Remove quick edit links
     
    490236    private function registerUiPages()
    491237    {
     238        // CustomPostTypes\includes\classes\Utils::getUiAdminPagesArgs
     239
    492240        // Remove new post type menu
    493241        add_action('admin_menu', function () {
     
    496244
    497245        Utils::registerProPages();
    498 
    499         // Add settings page
    500         add_filter(Utils::getHookName('register_admin_pages'), function ($args) {
    501             ob_start();
    502             require_once(Utils::getInfo('path') . 'includes/views/tools.php');
    503             $template = ob_get_clean();
    504 
    505             $args[] = [
    506                 'id' => 'tools',
    507                 'parent' => 'edit.php?post_type=' . Utils::getInfo('ui_prefix'),
    508                 'order' => null,
    509                 'menu_icon' => null,
    510                 'title' => __('Tools & Infos', 'custom-post-types'),
    511                 'content' => $template,
    512                 'admin_only' => true
    513             ];
    514             return $args;
    515         });
    516246    }
    517247
     
    575305
    576306            $installationTime = get_option(Utils::getOptionName('installation_time'), null);
     307
    577308            if ($installationTime && strtotime("+7 day", $installationTime) < time()) {
    578309                // After 7 days notice
     
    584315                    'dismissible' => true,
    585316                    'buttons' => $buttons,
     317                ];
     318            }
     319
     320            if ($installationTime && strtotime("+30 day", $installationTime) < time()) {
     321                // After 30 days notice
     322                $args[] = [
     323                    'id' => 'welcome_notice_400_1',
     324                    'title' => Utils::getNoticesTitle(),
     325                    'message' => __('Wow! More than 30 days of using this amazing plugin. Your support is really important.', 'custom-post-types'),
     326                    'type' => 'success',
     327                    'dismissible' => true,
     328                    'buttons' => $buttons,
     329                ];
     330            }
     331
     332            if (
     333                !Utils::isProVersionActive() &&
     334                $installationTime && strtotime("+3 day", $installationTime) < time()
     335            ) {
     336                $buttons2 = array_reverse($buttons);
     337                unset($buttons2[2]);
     338                $buttons2[0]['cta'] = true;
     339                // PRO
     340                $args[] = [
     341                    'id' => 'welcome_notice_pro',
     342                    'title' => Utils::getNoticesTitle(),
     343                    'message' => '<p style="font-size: 1.3em;">' . __("It's time to PRO, <u>go to the next level</u>:", 'custom-post-types') . '</p><p style="font-size: 1.3em; font-weight: bold;">⚡ Custom templates<br>⚡ Custom admin pages<br>⚡ Custom admin notices<br>⚡ +6 fields types<br>⚡ Export/Import settings</p><p style="font-size: 1.3em;">' . __("now you are ready, one small step, one big change!", 'custom-post-types') . '</p>',
     344                    'type' => 'success',
     345                    'dismissible' => true,
     346                    'buttons' => $buttons2,
    586347                ];
    587348            }
     
    783544            $this->getFieldGroups()->initRegisteredGroups();
    784545            $this->getAdminPages()->initRegisteredPages();
     546        });
     547        add_action('admin_init', function () {
    785548            $this->getAdminNotices()->initRegisteredNotices();
    786549        });
  • custom-post-types/trunk/includes/classes/FieldGroups.php

    r2948437 r2954735  
    955955                [ //id
    956956                    'key' => 'id',
    957                     'label' => __('Key', 'custom-post-types'),
    958                     'info' => __('Taxonomy key.', 'custom-post-types'),
     957                    'label' => __('ID', 'custom-post-types'),
     958                    'info' => __('Taxonomy ID.', 'custom-post-types'),
    959959                    'required' => true,
    960960                    'type' => 'text',
     
    12821282                [ //id
    12831283                    'key' => 'id',
    1284                     'label' => __('Key', 'custom-post-types'),
    1285                     'info' => __('Post type key.', 'custom-post-types'),
     1284                    'label' => __('ID', 'custom-post-types'),
     1285                    'info' => __('Post type ID.', 'custom-post-types'),
    12861286                    'required' => true,
    12871287                    'type' => 'text',
  • custom-post-types/trunk/includes/classes/PostTypes.php

    r2944690 r2954735  
    140140        unset($registeredPostTypes);
    141141
    142         return (array)apply_filters(Utils::getHookName('register_post_types'), $postTypesByUi);
     142        $postTypesByCore = Utils::getUiPostTypesArgs();
     143
     144        $postTypesByPlugin = (array)apply_filters(Utils::getHookName('register_post_types'), $postTypesByUi);
     145
     146        return array_merge($postTypesByCore, $postTypesByPlugin);
    143147    }
    144148
     
    225229            $labels = !empty($postType['labels']) && is_array($postType['labels']) ? $postType['labels'] : [];
    226230
     231            $errorInfo = Utils::getRegistrationErrorNoticeInfo($postType);
     232
    227233            if (!$id || !$singular || !$plural) {
    228                 $errorInfo = Utils::getRegistrationErrorNoticeInfo($postType);
    229 
    230234                add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
    231235                    $args[] = [
     
    243247            }
    244248
     249            if(in_array($id, Utils::getPostTypeBlacklist())){
     250                add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
     251                    $args[] = [
     252                        'id' => $errorInfo['id'],
     253                        'title' => Utils::getNoticesTitle(),
     254                        'message' => __('Post type reserved or already registered, try a different "id".', 'custom-post-types') . $errorInfo['details'],
     255                        'type' => 'error',
     256                        'dismissible' => 3,
     257                        'buttons' => false,
     258                    ];
     259                    return $args;
     260                });
     261                unset($postTypes[$i]);
     262                continue;
     263            }
     264
    245265            $columns = !empty($postType['columns']) && is_array($postType['columns']) ? $postType['columns'] : false;
    246266            if ($columns) {
  • custom-post-types/trunk/includes/classes/Taxonomies.php

    r2944690 r2954735  
    181181            $labels = !empty($taxonomy['labels']) && is_array($taxonomy['labels']) ? $taxonomy['labels'] : [];
    182182
     183            $errorInfo = Utils::getRegistrationErrorNoticeInfo($taxonomy, 'tax');
     184
    183185            if (!$id || !$singular || !$plural) {
    184                 $errorInfo = Utils::getRegistrationErrorNoticeInfo($taxonomy, 'tax');
    185 
    186186                add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
    187187                    $args[] = [
     
    199199            }
    200200
     201            if(in_array($id, Utils::getTaxonomiesBlacklist())){
     202                add_filter(Utils::getHookName('register_notices'), function ($args) use ($errorInfo) {
     203                    $args[] = [
     204                        'id' => $errorInfo['id'],
     205                        'title' => Utils::getNoticesTitle(),
     206                        'message' => __('Taxonomy reserved or already registered, try a different "id".', 'custom-post-types') . $errorInfo['details'],
     207                        'type' => 'error',
     208                        'dismissible' => 3,
     209                        'buttons' => false,
     210                    ];
     211                    return $args;
     212                });
     213                unset($taxonomies[$i]);
     214                continue;
     215            }
     216
    201217            $adminOnly = isset($args['admin_only']) ? $args['admin_only'] : false;
    202218
  • custom-post-types/trunk/includes/classes/Utils.php

    r2948437 r2954735  
    6565    {
    6666        $registered_post_types = get_post_types(['_builtin' => false], 'objects');
    67         $exclude = [
    68             self::getInfo('ui_prefix'),
    69             self::getInfo('ui_prefix') . "_tax",
    70             self::getInfo('ui_prefix') . "_field",
    71             self::getInfo('ui_prefix') . "_template",
    72             self::getInfo('ui_prefix') . "_page",
    73             self::getInfo('ui_prefix') . "_notice"
    74         ];
     67        $exclude = self::getUiPostTypes();
    7568        $post_types = [
    7669            'post' => __('Posts'),
     
    500493        ];
    501494    }
     495
     496    /**
     497     * @return array
     498     */
     499    public static function getUiPostTypes(){
     500        return [
     501            self::getInfo('ui_prefix'),
     502            self::getInfo('ui_prefix') . "_tax",
     503            self::getInfo('ui_prefix') . "_field",
     504            self::getInfo('ui_prefix') . "_template",
     505            self::getInfo('ui_prefix') . "_page",
     506            self::getInfo('ui_prefix') . "_notice"
     507        ];
     508    }
     509
     510    /**
     511     * @return string[]
     512     */
     513    public static function getPostTypeBlacklist(){
     514        $registered = array_keys(get_post_types());
     515        return $registered;
     516    }
     517
     518    /**
     519     * @return array
     520     */
     521    public static function getUiPostTypesArgs() {
     522        $args = [];
     523       
     524        $default_args = [
     525            'public' => false,
     526            'publicly_queryable' => false,
     527            'show_ui' => true,
     528            'show_in_menu' => true,
     529            'show_in_rest' => false,
     530            'query_var' => false,
     531            'rewrite' => false,
     532            'capabilities' => [
     533                'edit_post' => 'update_core',
     534                'read_post' => 'update_core',
     535                'delete_post' => 'update_core',
     536                'edit_posts' => 'update_core',
     537                'edit_others_posts' => 'update_core',
     538                'delete_posts' => 'update_core',
     539                'publish_posts' => 'update_core',
     540                'read_private_posts' => 'update_core'
     541            ],
     542            'has_archive' => false,
     543            'hierarchical' => false,
     544            'menu_position' => null,
     545            'supports' => [''],
     546            'menu_icon' => 'dashicons-index-card',
     547            'can_export' => false,
     548        ];
     549        // Create/edit new post type
     550        $args[] = [
     551            'id' => self::getInfo('ui_prefix'),
     552            'singular' => __('Post type', 'custom-post-types'),
     553            'plural' => __('Post types', 'custom-post-types'),
     554            'labels' => [
     555                'name' => _x('Custom post types', 'Dashboard menu', 'custom-post-types'),
     556                'singular_name' => __('Post type', 'custom-post-types'),
     557                'menu_name' => __('Extend / Manage', 'custom-post-types'),
     558                'name_admin_bar' => __('Post type', 'custom-post-types'),
     559                'add_new' => __('Add post type', 'custom-post-types'),
     560                'add_new_item' => __('Add new post type', 'custom-post-types'),
     561                'new_item' => __('New post type', 'custom-post-types'),
     562                'edit_item' => __('Edit post type', 'custom-post-types'),
     563                'view_item' => __('View post type', 'custom-post-types'),
     564                'item_updated' => __('Post type updated', 'custom-post-types'),
     565                'all_items' => _x('Post types', 'Dashboard menu', 'custom-post-types'),
     566                'search_items' => __('Search post type', 'custom-post-types'),
     567                'not_found' => __('No post type available.', 'custom-post-types'),
     568                'not_found_in_trash' => __('No post type in the trash.', 'custom-post-types')
     569            ],
     570            'args' => array_replace_recursive($default_args, [
     571                'description' => __('Create and manage custom post types.', 'custom-post-types'),
     572            ]),
     573            'columns' => [
     574                'title' => [
     575                    'label' => __('Plural', 'custom-post-types'),
     576                ],
     577                'item_key' => [
     578                    'label' => __('ID', 'custom-post-types'),
     579                    'callback' => function ($post_id) {
     580                        echo get_post_meta($post_id, 'id', true);
     581                    }
     582                ],
     583                'item_count' => [
     584                    'label' => __('Count', 'custom-post-types'),
     585                    'callback' => function ($post_id) {
     586                        $key = get_post_meta($post_id, 'id', true);
     587                        if (empty($key) || !(isset(wp_count_posts($key)->publish) ? wp_count_posts($key)->publish : false)) {
     588                            echo "0";
     589                            return;
     590                        }
     591                        printf(
     592                            '<a href="%s" title="%s">%s</a>',
     593                            admin_url('edit.php?post_type=' . $key),
     594                            __('View', 'custom-post-types'),
     595                            wp_count_posts($key)->publish
     596                        );
     597                    }
     598                ],
     599                'date' => [],
     600            ]
     601        ];
     602        // Create/edit new tax
     603        $args[] = [
     604            'id' => self::getInfo('ui_prefix') . '_tax',
     605            'singular' => __('Taxonomy', 'custom-post-types'),
     606            'plural' => __('Taxonomies', 'custom-post-types'),
     607            'labels' => [
     608                'name' => __('Custom taxonomies', 'custom-post-types'),
     609                'singular_name' => __('Taxonomy', 'custom-post-types'),
     610                'menu_name' => __('Taxonomy', 'custom-post-types'),
     611                'name_admin_bar' => __('Taxonomy', 'custom-post-types'),
     612                'add_new' => __('Add taxonomy', 'custom-post-types'),
     613                'add_new_item' => __('Add new taxonomy', 'custom-post-types'),
     614                'new_item' => __('New taxonomy', 'custom-post-types'),
     615                'edit_item' => __('Edit taxonomy', 'custom-post-types'),
     616                'view_item' => __('View taxonomy', 'custom-post-types'),
     617                'item_updated' => __('Taxonomy updated', 'custom-post-types'),
     618                'all_items' => __('Taxonomies', 'custom-post-types'),
     619                'search_items' => __('Search taxonomy', 'custom-post-types'),
     620                'not_found' => __('No taxonomy available.', 'custom-post-types'),
     621                'not_found_in_trash' => __('No taxonomy in the trash.', 'custom-post-types')
     622            ],
     623            'args' => array_replace_recursive($default_args, [
     624                'description' => __('Create and manage custom taxonomies.', 'custom-post-types'),
     625                'show_in_menu' => 'edit.php?post_type=' . self::getInfo('ui_prefix')
     626            ]),
     627            'columns' => [
     628                'title' => [
     629                    'label' => __('Plural', 'custom-post-types'),
     630                ],
     631                'item_key' => [
     632                    'label' => __('ID', 'custom-post-types'),
     633                    'callback' => function ($post_id) {
     634                        echo get_post_meta($post_id, 'id', true);
     635                    }
     636                ],
     637                'item_count' => [
     638                    'label' => __('Count', 'custom-post-types'),
     639                    'callback' => function ($post_id) {
     640                        $key = get_post_meta($post_id, 'id', true);
     641                        if (empty($key) || is_wp_error(wp_count_terms(['taxonomy' => $key]))) {
     642                            echo "0";
     643                            return;
     644                        }
     645                        printf(
     646                            '<a href="%s" title="%s">%s</a>',
     647                            admin_url('edit-tags.php?taxonomy=' . $key),
     648                            __('View', 'custom-post-types'),
     649                            wp_count_terms(['taxonomy' => $key])
     650                        );
     651                    }
     652                ],
     653                'used_by' => [
     654                    'label' => __('Assignment', 'custom-post-types'),
     655                    'callback' => function ($post_id) {
     656                        $supports = get_post_meta($post_id, 'supports', true);
     657                        if (empty($supports)) return;
     658                        $output = [];
     659                        foreach ($supports as $post_type) {
     660                            if (!get_post_type_object($post_type)) continue;
     661                            $output[] = sprintf(
     662                                '<a href="%s" title="%s">%s</a>',
     663                                admin_url('edit.php?post_type=' . $post_type),
     664                                __('View', 'custom-post-types'),
     665                                get_post_type_object($post_type)->labels->name
     666                            );
     667                        }
     668                        echo implode(', ', $output);
     669                    }
     670                ],
     671                'date' => [],
     672            ]
     673        ];
     674        // Create/edit new fieldsgroup
     675        $args[] = [
     676            'id' => self::getInfo('ui_prefix') . '_field',
     677            'singular' => __('Field group', 'custom-post-types'),
     678            'plural' => __('Field groups', 'custom-post-types'),
     679            'labels' => [
     680                'name' => __('Custom field groups', 'custom-post-types'),
     681                'singular_name' => __('Field group', 'custom-post-types'),
     682                'menu_name' => __('Field group', 'custom-post-types'),
     683                'name_admin_bar' => __('Field group', 'custom-post-types'),
     684                'add_new' => __('Add field group', 'custom-post-types'),
     685                'add_new_item' => __('Add new field group', 'custom-post-types'),
     686                'new_item' => __('New field group', 'custom-post-types'),
     687                'edit_item' => __('Edit field group', 'custom-post-types'),
     688                'view_item' => __('View field group', 'custom-post-types'),
     689                'item_updated' => __('Field group updated', 'custom-post-types'),
     690                'all_items' => __('Field groups', 'custom-post-types'),
     691                'search_items' => __('Search field group', 'custom-post-types'),
     692                'not_found' => __('No field group available.', 'custom-post-types'),
     693                'not_found_in_trash' => __('No field group in the trash.', 'custom-post-types')
     694            ],
     695            'args' => array_replace_recursive($default_args, [
     696                'description' => __('Create and manage custom field groups.', 'custom-post-types'),
     697                'show_in_menu' => 'edit.php?post_type=' . self::getInfo('ui_prefix'),
     698                'supports' => ['title']
     699            ]),
     700            'columns' => [
     701                'title' => [
     702                    'label' => __('Name', 'custom-post-types'),
     703                ],
     704                'item_count' => [
     705                    'label' => __('Fields', 'custom-post-types') . ' (' . __('Key', 'custom-post-types') . ')',
     706                    'callback' => function ($post_id) {
     707                        $fields = get_post_meta($post_id, 'fields', true);
     708                        if (empty($fields)) return;
     709                        $fields_labels_array = array_map(
     710                            function ($field) {
     711                                return $field['label'] . ' (' . $field['key'] . ')';
     712                            },
     713                            $fields
     714                        );
     715                        echo implode(', ', $fields_labels_array);
     716                    }
     717                ],
     718                'item_position' => [
     719                    'label' => __('Position', 'custom-post-types'),
     720                    'callback' => function ($post_id) {
     721                        $available = [
     722                            '' => __('NORMAL', 'custom-post-types'),
     723                            'normal' => __('NORMAL', 'custom-post-types'),
     724                            'side' => __('SIDEBAR', 'custom-post-types'),
     725                            'advanced' => __('ADVANCED', 'custom-post-types'),
     726                        ];
     727                        echo $available[get_post_meta($post_id, 'position', true)];
     728                    }
     729                ],
     730                'used_by' => [
     731                    'label' => __('Assignment', 'custom-post-types'),
     732                    'callback' => function ($post_id) {
     733                        $supports = get_post_meta($post_id, 'supports', true);
     734                        if (empty($supports)) return;
     735                        $output = [];
     736                        foreach ($supports as $post_type) {
     737                            $content_type = 'cpt';
     738                            $content = $post_type;
     739
     740                            if (strpos($post_type, '/') !== false) {
     741                                $content_type = explode('/', $post_type)[0];
     742                                $content = explode('/', $post_type)[1];
     743                            }
     744
     745                            switch ($content_type) {
     746                                case 'cpt':
     747                                    if (get_post_type_object($content)) {
     748                                        $output[] = sprintf(
     749                                            '<a href="%s" title="%s">%s</a>',
     750                                            admin_url('edit.php?post_type=' . $content),
     751                                            __('View', 'custom-post-types'),
     752                                            get_post_type_object($content)->labels->name
     753                                        );
     754                                    }
     755                                    break;
     756                                case 'tax':
     757                                    if (get_taxonomy($content)) {
     758                                        $output[] = sprintf(
     759                                            '<a href="%s" title="%s">%s</a>',
     760                                            admin_url('edit-tags.php?taxonomy=' . $content),
     761                                            __('View', 'custom-post-types'),
     762                                            get_taxonomy($content)->labels->name
     763                                        );
     764                                    }
     765                                    break;
     766                                case 'extra':
     767                                    if ($content == 'users') {
     768                                        $output[] = sprintf(
     769                                            '<a href="%s" title="%s">%s</a>',
     770                                            admin_url('users.php'),
     771                                            __('View', 'custom-post-types'),
     772                                            __('Users')
     773                                        );
     774                                    }
     775                                    break;
     776                                case 'options':
     777                                    if (isset(self::getSettingsPagesOptions()[$content])) {
     778                                        $pageUrl = !empty(self::getSettingsPagesOptions()[$content]['url']) ? admin_url(self::getSettingsPagesOptions()[$content]['url']) : menu_page_url($content, false);
     779                                        $output[] = sprintf(
     780                                            '<a href="%s" title="%s">%s</a>',
     781                                            $pageUrl,
     782                                            __('View', 'custom-post-types'),
     783                                            self::getSettingsPagesOptions()[$content]['title']
     784                                        );
     785                                    }
     786                                    break;
     787                            }
     788                        }
     789                        echo implode(', ', $output);
     790                    }
     791                ],
     792                'date' => [],
     793            ]
     794        ];
     795        return $args;
     796    }
     797
     798    /**
     799     * @return array
     800     */
     801    public static function getUiAdminPagesArgs() {
     802        $args = [];
     803
     804        ob_start();
     805        require_once(self::getInfo('path') . 'includes/views/tools.php');
     806        $template = ob_get_clean();
     807
     808        $args[] = [
     809            'id' => 'tools',
     810            'parent' => 'edit.php?post_type=' . self::getInfo('ui_prefix'),
     811            'order' => null,
     812            'menu_icon' => null,
     813            'title' => __('Tools & Infos', 'custom-post-types'),
     814            'content' => $template,
     815            'admin_only' => true
     816        ];
     817        return $args;
     818    }
     819
     820    /**
     821     * @return string[]
     822     */
     823    public static function getTaxonomiesBlacklist(){
     824        $registered = array_keys(get_taxonomies());
     825        return $registered;
     826    }
     827
     828    /**
     829     * @return string[]
     830     */
     831    public static function getAdminPagesBlacklist(){
     832        global $menu, $submenu;
     833        $registered = [
     834            'custom-post-types',
     835            'custom-post-types-pro',
     836        ];
     837        foreach ($menu as $registeredMenu) {
     838            if(
     839                empty($registeredMenu[2]) || // error
     840                strpos($registeredMenu[2], '.php') !== false || // core page
     841                (!empty($registeredMenu[4]) && $registeredMenu[4] == 'wp-menu-separator') // menu separator
     842            ){
     843                continue;
     844            }
     845            $registered[] = $registeredMenu[2];
     846        }
     847        foreach ($submenu as $registeredSubmenu) {
     848            foreach ($registeredSubmenu as $singleMenu) {
     849                if(
     850                    empty($singleMenu[2]) || // error
     851                    strpos($singleMenu[2], '.php') !== false // core page
     852                ){
     853                    continue;
     854                }
     855                $registered[] = $singleMenu[2];
     856            }
     857        }
     858        return $registered;
     859    }
    502860}
  • custom-post-types/trunk/languages/custom-post-types.pot

    r2948437 r2954735  
    33msgstr ""
    44"Project-Id-Version: Custom post types\n"
    5 "POT-Creation-Date: 2023-08-07 10:22+0200\n"
     5"POT-Creation-Date: 2023-08-16 17:00+0200\n"
    66"PO-Revision-Date: 2023-08-07 10:20+0200\n"
    77"Last-Translator: \n"
     
    3434msgstr ""
    3535
    36 #: includes/classes/AdminPages.php:40
     36#: includes/classes/AdminPages.php:44
    3737msgid "Admin page registration was not successful (\"id\" and \"title\" args are required)."
    3838msgstr ""
    3939
    40 #: includes/classes/AdminPages.php:67
     40#: includes/classes/AdminPages.php:60
     41msgid "Admin page reserved or already registered, try a different \"id\"."
     42msgstr ""
     43
     44#: includes/classes/AdminPages.php:86
    4145msgid "Admin page registration was not successful."
    4246msgstr ""
    4347
    44 #: includes/classes/Core.php:154 includes/classes/Core.php:158
    45 #: includes/classes/Core.php:160 includes/fields/post_rel.php:73
    46 msgid "Post type"
    47 msgstr ""
    48 
    49 #: includes/classes/Core.php:155 includes/classes/Utils.php:179
    50 msgid "Post types"
    51 msgstr ""
    52 
    53 #: includes/classes/Core.php:159
    54 msgid "Extend / Manage"
     48#: includes/classes/Core.php:158 includes/classes/Core.php:159
     49#: includes/classes/Utils.php:564
     50msgid "Post type updated"
     51msgstr ""
     52
     53#: includes/classes/Core.php:160
     54msgid "Post type published"
    5555msgstr ""
    5656
    5757#: includes/classes/Core.php:161
    58 msgid "Add post type"
     58msgid "Post type saved"
    5959msgstr ""
    6060
    6161#: includes/classes/Core.php:162
    62 msgid "Add new post type"
     62msgid "Post type submitted"
    6363msgstr ""
    6464
    6565#: includes/classes/Core.php:163
    66 msgid "New post type"
     66msgid "Post type scheduled"
    6767msgstr ""
    6868
    6969#: includes/classes/Core.php:164
    70 msgid "Edit post type"
    71 msgstr ""
    72 
    73 #: includes/classes/Core.php:165
    74 msgid "View post type"
    75 msgstr ""
    76 
    77 #: includes/classes/Core.php:166 includes/classes/Core.php:412
    78 #: includes/classes/Core.php:413
    79 msgid "Post type updated"
    80 msgstr ""
    81 
    82 #: includes/classes/Core.php:168
    83 msgid "Search post type"
     70msgid "Post type draft updated"
     71msgstr ""
     72
     73#: includes/classes/Core.php:167 includes/classes/Core.php:168
     74#: includes/classes/Utils.php:617
     75msgid "Taxonomy updated"
    8476msgstr ""
    8577
    8678#: includes/classes/Core.php:169
    87 msgid "No post type available."
     79msgid "Taxonomy published"
    8880msgstr ""
    8981
    9082#: includes/classes/Core.php:170
    91 msgid "No post type in the trash."
     83msgid "Taxonomy saved"
     84msgstr ""
     85
     86#: includes/classes/Core.php:171
     87msgid "Taxonomy submitted"
     88msgstr ""
     89
     90#: includes/classes/Core.php:172
     91msgid "Taxonomy scheduled"
    9292msgstr ""
    9393
    9494#: includes/classes/Core.php:173
    95 msgid "Create and manage custom post types."
    96 msgstr ""
    97 
    98 #: includes/classes/Core.php:177 includes/classes/Core.php:231
    99 #: includes/classes/FieldGroups.php:941 includes/classes/FieldGroups.php:1268
    100 msgid "Plural"
    101 msgstr ""
    102 
    103 #: includes/classes/Core.php:180 includes/classes/Core.php:234
    104 #: includes/classes/Core.php:307 includes/classes/FieldGroups.php:646
    105 #: includes/classes/FieldGroups.php:957 includes/classes/FieldGroups.php:1284
    106 msgid "Key"
    107 msgstr ""
    108 
    109 #: includes/classes/Core.php:186 includes/classes/Core.php:240
    110 msgid "Count"
    111 msgstr ""
    112 
    113 #: includes/classes/Core.php:196 includes/classes/Core.php:250
    114 #: includes/classes/Core.php:266 includes/classes/Core.php:353
    115 #: includes/classes/Core.php:363 includes/classes/Core.php:373
    116 #: includes/classes/Core.php:384
    117 msgid "View"
    118 msgstr ""
    119 
    120 #: includes/classes/Core.php:207 includes/classes/Core.php:211
    121 #: includes/classes/Core.php:212 includes/classes/Core.php:213
    122 #: includes/fields/tax_rel.php:73
    123 msgid "Taxonomy"
    124 msgstr ""
    125 
    126 #: includes/classes/Core.php:208 includes/classes/Core.php:220
    127 #: includes/classes/Utils.php:185
    128 msgid "Taxonomies"
    129 msgstr ""
    130 
    131 #: includes/classes/Core.php:210
    132 msgid "Custom taxonomies"
    133 msgstr ""
    134 
    135 #: includes/classes/Core.php:214
    136 msgid "Add taxonomy"
    137 msgstr ""
    138 
    139 #: includes/classes/Core.php:215
    140 msgid "Add new taxonomy"
    141 msgstr ""
    142 
    143 #: includes/classes/Core.php:216
    144 msgid "New taxonomy"
    145 msgstr ""
    146 
    147 #: includes/classes/Core.php:217
    148 msgid "Edit taxonomy"
    149 msgstr ""
    150 
    151 #: includes/classes/Core.php:218
    152 msgid "View taxonomy"
    153 msgstr ""
    154 
    155 #: includes/classes/Core.php:219 includes/classes/Core.php:421
    156 #: includes/classes/Core.php:422
    157 msgid "Taxonomy updated"
    158 msgstr ""
    159 
    160 #: includes/classes/Core.php:221
    161 msgid "Search taxonomy"
    162 msgstr ""
    163 
    164 #: includes/classes/Core.php:222
    165 msgid "No taxonomy available."
    166 msgstr ""
    167 
    168 #: includes/classes/Core.php:223
    169 msgid "No taxonomy in the trash."
    170 msgstr ""
    171 
    172 #: includes/classes/Core.php:226
    173 msgid "Create and manage custom taxonomies."
    174 msgstr ""
    175 
    176 #: includes/classes/Core.php:256 includes/classes/Core.php:333
    177 #: includes/classes/FieldGroups.php:844 includes/classes/FieldGroups.php:989
    178 msgid "Assignment"
    179 msgstr ""
    180 
    181 #: includes/classes/Core.php:279 includes/classes/Core.php:283
    182 #: includes/classes/Core.php:284 includes/classes/Core.php:285
    183 msgid "Field group"
    184 msgstr ""
    185 
    186 #: includes/classes/Core.php:280 includes/classes/Core.php:292
    187 msgid "Field groups"
    188 msgstr ""
    189 
    190 #: includes/classes/Core.php:282
    191 msgid "Custom field groups"
    192 msgstr ""
    193 
    194 #: includes/classes/Core.php:286
    195 msgid "Add field group"
    196 msgstr ""
    197 
    198 #: includes/classes/Core.php:287
    199 msgid "Add new field group"
    200 msgstr ""
    201 
    202 #: includes/classes/Core.php:288
    203 msgid "New field group"
    204 msgstr ""
    205 
    206 #: includes/classes/Core.php:289
    207 msgid "Edit field group"
    208 msgstr ""
    209 
    210 #: includes/classes/Core.php:290
    211 msgid "View field group"
    212 msgstr ""
    213 
    214 #: includes/classes/Core.php:291 includes/classes/Core.php:430
    215 #: includes/classes/Core.php:431
     95msgid "Taxonomy draft updated"
     96msgstr ""
     97
     98#: includes/classes/Core.php:176 includes/classes/Core.php:177
     99#: includes/classes/Utils.php:689
    216100msgid "Field group updated"
    217101msgstr ""
    218102
    219 #: includes/classes/Core.php:293
    220 msgid "Search field group"
    221 msgstr ""
    222 
    223 #: includes/classes/Core.php:294
    224 msgid "No field group available."
    225 msgstr ""
    226 
    227 #: includes/classes/Core.php:295
    228 msgid "No field group in the trash."
    229 msgstr ""
    230 
    231 #: includes/classes/Core.php:298
    232 msgid "Create and manage custom field groups."
    233 msgstr ""
    234 
    235 #: includes/classes/Core.php:304
    236 msgid "Name"
    237 msgstr ""
    238 
    239 #: includes/classes/Core.php:307
    240 msgid "Fields"
    241 msgstr ""
    242 
    243 #: includes/classes/Core.php:321 includes/classes/FieldGroups.php:806
    244 msgid "Position"
    245 msgstr ""
    246 
    247 #: includes/classes/Core.php:324 includes/classes/Core.php:325
    248 #: includes/classes/FieldGroups.php:811 includes/classes/FieldGroups.php:814
    249 msgid "NORMAL"
    250 msgstr ""
    251 
    252 #: includes/classes/Core.php:326 includes/classes/FieldGroups.php:815
    253 msgid "SIDEBAR"
    254 msgstr ""
    255 
    256 #: includes/classes/Core.php:327 includes/classes/FieldGroups.php:816
    257 msgid "ADVANCED"
    258 msgstr ""
    259 
    260 #: includes/classes/Core.php:374 includes/classes/Utils.php:196
    261 msgid "Users"
    262 msgstr ""
    263 
    264 #: includes/classes/Core.php:414
    265 msgid "Post type published"
    266 msgstr ""
    267 
    268 #: includes/classes/Core.php:415
    269 msgid "Post type saved"
    270 msgstr ""
    271 
    272 #: includes/classes/Core.php:416
    273 msgid "Post type submitted"
    274 msgstr ""
    275 
    276 #: includes/classes/Core.php:417
    277 msgid "Post type scheduled"
    278 msgstr ""
    279 
    280 #: includes/classes/Core.php:418
    281 msgid "Post type draft updated"
    282 msgstr ""
    283 
    284 #: includes/classes/Core.php:423
    285 msgid "Taxonomy published"
    286 msgstr ""
    287 
    288 #: includes/classes/Core.php:424
    289 msgid "Taxonomy saved"
    290 msgstr ""
    291 
    292 #: includes/classes/Core.php:425
    293 msgid "Taxonomy submitted"
    294 msgstr ""
    295 
    296 #: includes/classes/Core.php:426
    297 msgid "Taxonomy scheduled"
    298 msgstr ""
    299 
    300 #: includes/classes/Core.php:427
    301 msgid "Taxonomy draft updated"
    302 msgstr ""
    303 
    304 #: includes/classes/Core.php:432
     103#: includes/classes/Core.php:178
    305104msgid "Field group published"
    306105msgstr ""
    307106
    308 #: includes/classes/Core.php:433
     107#: includes/classes/Core.php:179
    309108msgid "Field group saved"
    310109msgstr ""
    311110
    312 #: includes/classes/Core.php:434
     111#: includes/classes/Core.php:180
    313112msgid "Field group submitted"
    314113msgstr ""
    315114
    316 #: includes/classes/Core.php:435
     115#: includes/classes/Core.php:181
    317116msgid "Field group scheduled"
    318117msgstr ""
    319118
    320 #: includes/classes/Core.php:436
     119#: includes/classes/Core.php:182
    321120msgid "Field group draft updated"
    322121msgstr ""
    323122
    324 #: includes/classes/Core.php:439 includes/classes/Core.php:440
     123#: includes/classes/Core.php:185 includes/classes/Core.php:186
    325124msgid "Template updated"
    326125msgstr ""
    327126
    328 #: includes/classes/Core.php:441
     127#: includes/classes/Core.php:187
    329128msgid "Template published"
    330129msgstr ""
    331130
    332 #: includes/classes/Core.php:442
     131#: includes/classes/Core.php:188
    333132msgid "Template saved"
    334133msgstr ""
    335134
    336 #: includes/classes/Core.php:443
     135#: includes/classes/Core.php:189
    337136msgid "Template submitted"
    338137msgstr ""
    339138
    340 #: includes/classes/Core.php:444
     139#: includes/classes/Core.php:190
    341140msgid "Template scheduled"
    342141msgstr ""
    343142
    344 #: includes/classes/Core.php:445
     143#: includes/classes/Core.php:191
    345144msgid "Template draft updated"
    346145msgstr ""
    347146
    348 #: includes/classes/Core.php:448 includes/classes/Core.php:449
     147#: includes/classes/Core.php:194 includes/classes/Core.php:195
    349148msgid "Admin page updated"
    350149msgstr ""
    351150
    352 #: includes/classes/Core.php:450
     151#: includes/classes/Core.php:196
    353152msgid "Admin page published"
    354153msgstr ""
    355154
    356 #: includes/classes/Core.php:451
     155#: includes/classes/Core.php:197
    357156msgid "Admin page saved"
    358157msgstr ""
    359158
    360 #: includes/classes/Core.php:452
     159#: includes/classes/Core.php:198
    361160msgid "Admin page submitted"
    362161msgstr ""
    363162
    364 #: includes/classes/Core.php:453
     163#: includes/classes/Core.php:199
    365164msgid "Admin page scheduled"
    366165msgstr ""
    367166
    368 #: includes/classes/Core.php:454
     167#: includes/classes/Core.php:200
    369168msgid "Admin page draft updated"
    370169msgstr ""
    371170
    372 #: includes/classes/Core.php:510
    373 msgid "Tools & Infos"
    374 msgstr ""
    375 
    376 #: includes/classes/Core.php:542 includes/views/tools.php:88
     171#: includes/classes/Core.php:272 includes/views/tools.php:88
    377172msgid "Write a Review"
    378173msgstr ""
    379174
    380 #: includes/classes/Core.php:548 includes/views/tools.php:83
     175#: includes/classes/Core.php:278 includes/views/tools.php:83
    381176msgid "Make a Donation"
    382177msgstr ""
    383178
    384 #: includes/classes/Core.php:555 includes/classes/Utils.php:405
     179#: includes/classes/Core.php:285 includes/classes/Utils.php:398
    385180#: includes/views/tools.php:77
    386181msgid "Get PRO version"
    387182msgstr ""
    388183
    389 #: includes/classes/Core.php:564
     184#: includes/classes/Core.php:294
    390185msgid "Thanks for using this plugin! Do you want to help us grow to add new features?"
    391186msgstr ""
    392187
    393 #: includes/classes/Core.php:564
     188#: includes/classes/Core.php:294
    394189#, php-format
    395190msgid "The new version %s introduces a lot of new features and improves the core of the plugin.<br>For any problems you can download the previous version %s from the official page of the plugin from WordPress.org (Advanced View > Previous version)."
    396191msgstr ""
    397192
    398 #: includes/classes/Core.php:582
     193#: includes/classes/Core.php:312
    399194msgid "Wow! More than 7 days of using this amazing plugin. Your support is really important."
    400195msgstr ""
    401196
    402 #: includes/classes/Core.php:621
     197#: includes/classes/Core.php:351
    403198msgid "Support"
    404199msgstr ""
    405200
    406 #: includes/classes/Core.php:627
     201#: includes/classes/Core.php:357
    407202msgid "Get PRO"
    408203msgstr ""
    409204
    410 #: includes/classes/Core.php:651 includes/classes/Core.php:665
    411 #: includes/classes/Core.php:685 includes/classes/Core.php:702
     205#: includes/classes/Core.php:381 includes/classes/Core.php:395
     206#: includes/classes/Core.php:415 includes/classes/Core.php:432
    412207msgid "Missing field \"key\"."
    413208msgstr ""
    414209
    415 #: includes/classes/Core.php:688
     210#: includes/classes/Core.php:418
    416211msgid "Missing field \"term-id\"."
    417212msgstr ""
    418213
    419 #: includes/classes/Core.php:705
     214#: includes/classes/Core.php:435
    420215msgid "Missing field \"option-id\"."
    421216msgstr ""
     
    443238#: includes/classes/FieldGroups.php:632
    444239msgid "Label"
     240msgstr ""
     241
     242#: includes/classes/FieldGroups.php:646 includes/classes/Utils.php:705
     243msgid "Key"
    445244msgstr ""
    446245
     
    541340msgstr ""
    542341
     342#: includes/classes/FieldGroups.php:806 includes/classes/Utils.php:719
     343msgid "Position"
     344msgstr ""
     345
    543346#: includes/classes/FieldGroups.php:807
    544347msgid "If set to \"NORMAL\" it will be shown at the bottom of the central column, if \"SIDEBAR\" it will be shown in the sidebar."
    545348msgstr ""
    546349
     350#: includes/classes/FieldGroups.php:811 includes/classes/FieldGroups.php:814
     351#: includes/classes/Utils.php:722 includes/classes/Utils.php:723
     352msgid "NORMAL"
     353msgstr ""
     354
     355#: includes/classes/FieldGroups.php:815 includes/classes/Utils.php:724
     356msgid "SIDEBAR"
     357msgstr ""
     358
     359#: includes/classes/FieldGroups.php:816 includes/classes/Utils.php:725
     360msgid "ADVANCED"
     361msgstr ""
     362
    547363#: includes/classes/FieldGroups.php:828
    548364msgid "Order"
     
    555371#: includes/classes/FieldGroups.php:833
    556372msgid "ex: 10"
     373msgstr ""
     374
     375#: includes/classes/FieldGroups.php:844 includes/classes/FieldGroups.php:989
     376#: includes/classes/Utils.php:654 includes/classes/Utils.php:731
     377msgid "Assignment"
    557378msgstr ""
    558379
     
    595416msgstr ""
    596417
     418#: includes/classes/FieldGroups.php:941 includes/classes/FieldGroups.php:1268
     419#: includes/classes/Utils.php:575 includes/classes/Utils.php:629
     420msgid "Plural"
     421msgstr ""
     422
    597423#: includes/classes/FieldGroups.php:942 includes/classes/FieldGroups.php:1269
    598424msgid "Plural name."
     
    603429msgstr ""
    604430
     431#: includes/classes/FieldGroups.php:957 includes/classes/FieldGroups.php:1284
     432#: includes/classes/Utils.php:578 includes/classes/Utils.php:632
     433msgid "ID"
     434msgstr ""
     435
    605436#: includes/classes/FieldGroups.php:958
    606 msgid "Taxonomy key."
     437msgid "Taxonomy ID."
    607438msgstr ""
    608439
     
    766597
    767598#: includes/classes/FieldGroups.php:1285
    768 msgid "Post type key."
     599msgid "Post type ID."
    769600msgstr ""
    770601
     
    1081912msgstr ""
    1082913
    1083 #: includes/classes/PostTypes.php:234
     914#: includes/classes/PostTypes.php:238
    1084915msgid "Post type registration was not successful (\"id\" \"singular\" and \"plural\" args are required)."
    1085916msgstr ""
    1086917
    1087 #: includes/classes/PostTypes.php:268
     918#: includes/classes/PostTypes.php:254
     919msgid "Post type reserved or already registered, try a different \"id\"."
     920msgstr ""
     921
     922#: includes/classes/PostTypes.php:288
    1088923msgid "Post type registration was not successful."
    1089924msgstr ""
     
    1137972msgstr ""
    1138973
    1139 #: includes/classes/Taxonomies.php:219
     974#: includes/classes/Taxonomies.php:206
     975msgid "Taxonomy reserved or already registered, try a different \"id\"."
     976msgstr ""
     977
     978#: includes/classes/Taxonomies.php:235
    1140979msgid "Taxonomy registration was not successful."
    1141980msgstr ""
    1142981
    1143 #: includes/classes/Utils.php:76 includes/fields/post_rel.php:78
     982#: includes/classes/Utils.php:69 includes/fields/post_rel.php:78
    1144983msgid "Posts"
    1145984msgstr ""
    1146985
    1147 #: includes/classes/Utils.php:77
     986#: includes/classes/Utils.php:70
    1148987msgid "Pages"
    1149988msgstr ""
    1150989
    1151 #: includes/classes/Utils.php:94 includes/fields/tax_rel.php:78
     990#: includes/classes/Utils.php:87 includes/fields/tax_rel.php:78
    1152991msgid "Categories"
    1153992msgstr ""
    1154993
    1155 #: includes/classes/Utils.php:95
     994#: includes/classes/Utils.php:88
    1156995msgid "Tags"
    1157996msgstr ""
    1158997
    1159 #: includes/classes/Utils.php:110 includes/classes/Utils.php:111
    1160 #: includes/classes/Utils.php:112 includes/classes/Utils.php:113
    1161 #: includes/classes/Utils.php:114
     998#: includes/classes/Utils.php:103 includes/classes/Utils.php:104
     999#: includes/classes/Utils.php:105 includes/classes/Utils.php:106
     1000#: includes/classes/Utils.php:107
    11621001msgid "Settings"
    11631002msgstr ""
    11641003
    1165 #: includes/classes/Utils.php:111
     1004#: includes/classes/Utils.php:104
    11661005msgid "Writing"
    11671006msgstr ""
    11681007
    1169 #: includes/classes/Utils.php:112
     1008#: includes/classes/Utils.php:105
    11701009msgid "Reading"
    11711010msgstr ""
    11721011
    1173 #: includes/classes/Utils.php:113
     1012#: includes/classes/Utils.php:106
    11741013msgid "Discussion"
    11751014msgstr ""
    11761015
    1177 #: includes/classes/Utils.php:114
     1016#: includes/classes/Utils.php:107
    11781017msgid "Media"
    11791018msgstr ""
    11801019
    1181 #: includes/classes/Utils.php:191 includes/classes/Utils.php:430
     1020#: includes/classes/Utils.php:172 includes/classes/Utils.php:553
     1021msgid "Post types"
     1022msgstr ""
     1023
     1024#: includes/classes/Utils.php:178 includes/classes/Utils.php:606
     1025#: includes/classes/Utils.php:618
     1026msgid "Taxonomies"
     1027msgstr ""
     1028
     1029#: includes/classes/Utils.php:184 includes/classes/Utils.php:423
    11821030msgid "Admin pages"
    11831031msgstr ""
    11841032
    1185 #: includes/classes/Utils.php:195
     1033#: includes/classes/Utils.php:188
    11861034msgid "Extra"
    11871035msgstr ""
    11881036
    1189 #: includes/classes/Utils.php:279
     1037#: includes/classes/Utils.php:189 includes/classes/Utils.php:772
     1038msgid "Users"
     1039msgstr ""
     1040
     1041#: includes/classes/Utils.php:272
    11901042msgid "Post title"
    11911043msgstr ""
    11921044
    1193 #: includes/classes/Utils.php:280
     1045#: includes/classes/Utils.php:273
    11941046msgid "Post content"
    11951047msgstr ""
    11961048
    1197 #: includes/classes/Utils.php:281
     1049#: includes/classes/Utils.php:274
    11981050msgid "Post excerpt"
    11991051msgstr ""
    12001052
    1201 #: includes/classes/Utils.php:282
     1053#: includes/classes/Utils.php:275
    12021054msgid "Post image"
    12031055msgstr ""
    12041056
    1205 #: includes/classes/Utils.php:283
     1057#: includes/classes/Utils.php:276
    12061058msgid "Post author"
    12071059msgstr ""
    12081060
    1209 #: includes/classes/Utils.php:284
     1061#: includes/classes/Utils.php:277
    12101062msgid "Post date"
    12111063msgstr ""
    12121064
    1213 #: includes/classes/Utils.php:285
     1065#: includes/classes/Utils.php:278
    12141066msgid "Post modified date"
    12151067msgstr ""
    12161068
    1217 #: includes/classes/Utils.php:298
     1069#: includes/classes/Utils.php:291
    12181070msgid "Term name"
    12191071msgstr ""
    12201072
    1221 #: includes/classes/Utils.php:299
     1073#: includes/classes/Utils.php:292
    12221074msgid "Term description"
    12231075msgstr ""
    12241076
    1225 #: includes/classes/Utils.php:368 includes/classes/Utils.php:377
     1077#: includes/classes/Utils.php:361 includes/classes/Utils.php:370
    12261078msgid "Click to copy"
    12271079msgstr ""
    12281080
    1229 #: includes/classes/Utils.php:382 includes/classes/Utils.php:383
     1081#: includes/classes/Utils.php:375 includes/classes/Utils.php:376
    12301082msgid "No shortcodes available"
    12311083msgstr ""
    12321084
    1233 #: includes/classes/Utils.php:400
     1085#: includes/classes/Utils.php:393
    12341086msgid "This feature requires the <u>PRO version</u> and a valid license key."
    12351087msgstr ""
    12361088
    1237 #: includes/classes/Utils.php:421
     1089#: includes/classes/Utils.php:414
    12381090msgid "Templates"
    12391091msgstr ""
    12401092
    1241 #: includes/classes/Utils.php:439
     1093#: includes/classes/Utils.php:432
    12421094msgid "Admin notices"
    12431095msgstr ""
    12441096
    1245 #: includes/classes/Utils.php:466
     1097#: includes/classes/Utils.php:459
    12461098msgid "<strong>Custom post types</strong> notice:"
    12471099msgstr ""
    12481100
    1249 #: includes/classes/Utils.php:484
     1101#: includes/classes/Utils.php:477
    12501102msgid "See registration args"
     1103msgstr ""
     1104
     1105#: includes/classes/Utils.php:552 includes/classes/Utils.php:556
     1106#: includes/classes/Utils.php:558 includes/fields/post_rel.php:73
     1107msgid "Post type"
     1108msgstr ""
     1109
     1110#: includes/classes/Utils.php:557
     1111msgid "Extend / Manage"
     1112msgstr ""
     1113
     1114#: includes/classes/Utils.php:559
     1115msgid "Add post type"
     1116msgstr ""
     1117
     1118#: includes/classes/Utils.php:560
     1119msgid "Add new post type"
     1120msgstr ""
     1121
     1122#: includes/classes/Utils.php:561
     1123msgid "New post type"
     1124msgstr ""
     1125
     1126#: includes/classes/Utils.php:562
     1127msgid "Edit post type"
     1128msgstr ""
     1129
     1130#: includes/classes/Utils.php:563
     1131msgid "View post type"
     1132msgstr ""
     1133
     1134#: includes/classes/Utils.php:566
     1135msgid "Search post type"
     1136msgstr ""
     1137
     1138#: includes/classes/Utils.php:567
     1139msgid "No post type available."
     1140msgstr ""
     1141
     1142#: includes/classes/Utils.php:568
     1143msgid "No post type in the trash."
     1144msgstr ""
     1145
     1146#: includes/classes/Utils.php:571
     1147msgid "Create and manage custom post types."
     1148msgstr ""
     1149
     1150#: includes/classes/Utils.php:584 includes/classes/Utils.php:638
     1151msgid "Count"
     1152msgstr ""
     1153
     1154#: includes/classes/Utils.php:594 includes/classes/Utils.php:648
     1155#: includes/classes/Utils.php:664 includes/classes/Utils.php:751
     1156#: includes/classes/Utils.php:761 includes/classes/Utils.php:771
     1157#: includes/classes/Utils.php:782
     1158msgid "View"
     1159msgstr ""
     1160
     1161#: includes/classes/Utils.php:605 includes/classes/Utils.php:609
     1162#: includes/classes/Utils.php:610 includes/classes/Utils.php:611
     1163#: includes/fields/tax_rel.php:73
     1164msgid "Taxonomy"
     1165msgstr ""
     1166
     1167#: includes/classes/Utils.php:608
     1168msgid "Custom taxonomies"
     1169msgstr ""
     1170
     1171#: includes/classes/Utils.php:612
     1172msgid "Add taxonomy"
     1173msgstr ""
     1174
     1175#: includes/classes/Utils.php:613
     1176msgid "Add new taxonomy"
     1177msgstr ""
     1178
     1179#: includes/classes/Utils.php:614
     1180msgid "New taxonomy"
     1181msgstr ""
     1182
     1183#: includes/classes/Utils.php:615
     1184msgid "Edit taxonomy"
     1185msgstr ""
     1186
     1187#: includes/classes/Utils.php:616
     1188msgid "View taxonomy"
     1189msgstr ""
     1190
     1191#: includes/classes/Utils.php:619
     1192msgid "Search taxonomy"
     1193msgstr ""
     1194
     1195#: includes/classes/Utils.php:620
     1196msgid "No taxonomy available."
     1197msgstr ""
     1198
     1199#: includes/classes/Utils.php:621
     1200msgid "No taxonomy in the trash."
     1201msgstr ""
     1202
     1203#: includes/classes/Utils.php:624
     1204msgid "Create and manage custom taxonomies."
     1205msgstr ""
     1206
     1207#: includes/classes/Utils.php:677 includes/classes/Utils.php:681
     1208#: includes/classes/Utils.php:682 includes/classes/Utils.php:683
     1209msgid "Field group"
     1210msgstr ""
     1211
     1212#: includes/classes/Utils.php:678 includes/classes/Utils.php:690
     1213msgid "Field groups"
     1214msgstr ""
     1215
     1216#: includes/classes/Utils.php:680
     1217msgid "Custom field groups"
     1218msgstr ""
     1219
     1220#: includes/classes/Utils.php:684
     1221msgid "Add field group"
     1222msgstr ""
     1223
     1224#: includes/classes/Utils.php:685
     1225msgid "Add new field group"
     1226msgstr ""
     1227
     1228#: includes/classes/Utils.php:686
     1229msgid "New field group"
     1230msgstr ""
     1231
     1232#: includes/classes/Utils.php:687
     1233msgid "Edit field group"
     1234msgstr ""
     1235
     1236#: includes/classes/Utils.php:688
     1237msgid "View field group"
     1238msgstr ""
     1239
     1240#: includes/classes/Utils.php:691
     1241msgid "Search field group"
     1242msgstr ""
     1243
     1244#: includes/classes/Utils.php:692
     1245msgid "No field group available."
     1246msgstr ""
     1247
     1248#: includes/classes/Utils.php:693
     1249msgid "No field group in the trash."
     1250msgstr ""
     1251
     1252#: includes/classes/Utils.php:696
     1253msgid "Create and manage custom field groups."
     1254msgstr ""
     1255
     1256#: includes/classes/Utils.php:702
     1257msgid "Name"
     1258msgstr ""
     1259
     1260#: includes/classes/Utils.php:705
     1261msgid "Fields"
     1262msgstr ""
     1263
     1264#: includes/classes/Utils.php:813
     1265msgid "Tools & Infos"
    12511266msgstr ""
    12521267
  • custom-post-types/trunk/readme.txt

    r2948437 r2954735  
    44Donate link: https://totalpress.org/donate?utm_source=wordpress_org&utm_medium=plugin_page&utm_campaign=custom_post_types
    55Requires at least: 4.0
    6 Tested up to: 6.2
    7 Stable tag: 4.0.8
     6Tested up to: 6.3
     7Stable tag: 4.0.9
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    206206== Changelog ==
    207207
    208 = 4.0.8 =
    209 *2023-08-07*
     208= 4.0.9 - 2023-08-16 =
     209* Introducing of blacklist for prevent the override of core contents;
     210* Edit "Key" label to "ID";
     211* Introducing Core instance;
     212
     213= 4.0.8 - 2023-08-07 =
    210214* Restore extra/users field groups;
    211215* Improve quality of code;
     
    213217* Add translation template;
    214218
    215 = 4.0.7 =
    216 *2023-07-30*
     219= 4.0.7 - 2023-07-30 =
    217220* Activation/deactivation actions
    218221
    219 = 4.0.6 =
    220 *2023-07-28*
     222= 4.0.6 - 2023-07-28 =
    221223* Performance improvments
    222224
    223 = 4.0.5 =
    224 *2023-06-30*
     225= 4.0.5 - 2023-06-30 =
    225226* Check if attachment.sizes.thumbnail.url exists on file field (@dealespaloit)
    226227
    227 = 4.0.4 =
    228 *2023-06-12*
     228= 4.0.4 - 2023-06-12 =
    229229* Fix file field styles inside repeater field (@dealespaloit)
    230230* Prevent multiple type filter on field output
Note: See TracChangeset for help on using the changeset viewer.