Plugin Directory

Changeset 2402883


Ignore:
Timestamp:
10/20/2020 01:53:26 AM (5 years ago)
Author:
kevindees
Message:

Update to version 5.0.2 from GitHub

Location:
typerocket-ui
Files:
34 edited
1 copied

Legend:

Unmodified
Added
Removed
  • typerocket-ui/tags/5.0.2/readme.txt

    r2402747 r2402883  
    55Requires PHP: 7.2.5
    66Tested up to: 5.5.1
    7 Stable Tag: 5.0.0
     7Stable Tag: 5.0.2
    88License: GPLv2 or later
    99
     
    3333== Changelog ==
    3434
    35 = 5.0 =
     35= 5.0.2 =
     36
     37* Fix deploy script.
     38
     39= 5.0.1 =
     40
     41* Require plural names.
     42* Allow overriding of existing post types like post and page.
     43* Bug fixes.
     44
     45= 5.0.0 =
    3646
    3747* Custom Post Type, Taxonomies, and Meta Box UI
  • typerocket-ui/tags/5.0.2/typerocket-ui.php

    r2402747 r2402883  
    44Plugin URI: https://typerocket.com/ui/
    55Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes.
    6 Version: 5.0.0
     6Version: 5.0.2
    77Requires PHP: 7.2
    88Author: TypeRocket
     
    5757        define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
    5858        define('TYPEROCKET_CORE_CONFIG_PATH', __DIR__ . '/typerocket/config' );
    59         define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
    6059        define('TYPEROCKET_ROOT_WP', ABSPATH);
    6160
     61        define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
    6262        define('TYPEROCKET_AUTOLOAD_APP', [
    6363            'prefix' => TYPEROCKET_APP_NAMESPACE . '\\',
  • typerocket-ui/tags/5.0.2/typerocket/composer.lock

    r2402747 r2402883  
    386386            "name": "typerocket/core",
    387387            "version": "dev-main",
    388             "dist": {
    389                 "type": "zip",
    390                 "url": "https://typerocket.repo.packagist.com/robojuice/dists/typerocket/core/dev-main/f6755087ab761752d429d0b4e1ada06450565dc9.zip",
    391                 "reference": "f6755087ab761752d429d0b4e1ada06450565dc9",
    392                 "mirrors": [
    393                     {
    394                         "url": "https://typerocket.repo.packagist.com/robojuice/dists/%package%/%version%/r%reference%.%type%",
    395                         "preferred": true
    396                     }
    397                 ]
     388            "source": {
     389                "type": "git",
     390                "url": "https://github.com/TypeRocket/core.git",
     391                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"
     392            },
     393            "dist": {
     394                "type": "zip",
     395                "url": "https://api.github.com/repos/TypeRocket/core/zipball/88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     396                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     397                "shasum": ""
    398398            },
    399399            "require": {
     
    412412                }
    413413            },
    414             "notification-url": "https://typerocket.repo.packagist.com/robojuice/downloads/",
     414            "notification-url": "https://packagist.org/downloads/",
    415415            "license": [
    416416                "GPL-3.0-or-later"
     
    432432            "support": {
    433433                "docs": "https://typerocket.com/docs/v5/",
    434                 "source": "https://github.com/TypeRocket/core/tree/v5.0.2",
    435                 "issues": "https://github.com/TypeRocket/core/issues"
    436             },
    437             "time": "2020-10-15T18:59:31+00:00"
     434                "issues": "https://github.com/TypeRocket/core/issues",
     435                "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
     436            },
     437            "time": "2020-10-20T01:01:39+00:00"
    438438        }
    439439    ],
  • typerocket-ui/tags/5.0.2/typerocket/galaxy

    r2402747 r2402883  
    33if( php_sapi_name() !== 'cli' )
    44    die("Meant to be run from command line" . PHP_EOL);
     5
     6define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
     7define('TYPEROCKET_AUTOLOAD_APP', [
     8    'prefix' => TYPEROCKET_APP_NAMESPACE . '\\',
     9    'folder' => __DIR__ . '/app/',
     10]);
    511
    612define('WPMU_PLUGIN_URL', '/mu-plugins');
  • typerocket-ui/tags/5.0.2/typerocket/vendor/composer/InstalledVersions.php

    r2402747 r2402883  
    2020    array (
    2121    ),
    22     'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     22    'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    2323    'name' => 'typerocket/typerocket',
    2424  ),
     
    8585        0 => '9999999-dev',
    8686      ),
    87       'reference' => 'f6755087ab761752d429d0b4e1ada06450565dc9',
     87      'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
    8888    ),
    8989    'typerocket/typerocket' =>
     
    9494      array (
    9595      ),
    96       'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     96      'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    9797    ),
    9898  ),
  • typerocket-ui/tags/5.0.2/typerocket/vendor/composer/installed.json

    r2402747 r2402883  
    396396            "version": "dev-main",
    397397            "version_normalized": "dev-main",
    398             "dist": {
    399                 "type": "zip",
    400                 "url": "https://typerocket.repo.packagist.com/robojuice/dists/typerocket/core/dev-main/f6755087ab761752d429d0b4e1ada06450565dc9.zip",
    401                 "reference": "f6755087ab761752d429d0b4e1ada06450565dc9",
    402                 "mirrors": [
    403                     {
    404                         "url": "https://typerocket.repo.packagist.com/robojuice/dists/%package%/%version%/r%reference%.%type%",
    405                         "preferred": true
    406                     }
    407                 ]
     398            "source": {
     399                "type": "git",
     400                "url": "https://github.com/TypeRocket/core.git",
     401                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"
     402            },
     403            "dist": {
     404                "type": "zip",
     405                "url": "https://api.github.com/repos/TypeRocket/core/zipball/88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     406                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     407                "shasum": ""
    408408            },
    409409            "require": {
     
    415415                "phpunit/phpunit": "7.4.*"
    416416            },
    417             "time": "2020-10-15T18:59:31+00:00",
     417            "time": "2020-10-20T01:01:39+00:00",
    418418            "default-branch": true,
    419419            "type": "library",
     
    424424                }
    425425            },
    426             "notification-url": "https://typerocket.repo.packagist.com/robojuice/downloads/",
     426            "notification-url": "https://packagist.org/downloads/",
    427427            "license": [
    428428                "GPL-3.0-or-later"
     
    444444            "support": {
    445445                "docs": "https://typerocket.com/docs/v5/",
    446                 "source": "https://github.com/TypeRocket/core/tree/main",
    447                 "issues": "https://github.com/TypeRocket/core/issues"
     446                "issues": "https://github.com/TypeRocket/core/issues",
     447                "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
    448448            },
    449449            "install-path": "../typerocket/core"
  • typerocket-ui/tags/5.0.2/typerocket/vendor/composer/installed.php

    r2402747 r2402883  
    77    array (
    88    ),
    9     'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     9    'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    1010    'name' => 'typerocket/typerocket',
    1111  ),
     
    2020        0 => '9999999-dev',
    2121      ),
    22       'reference' => 'f6755087ab761752d429d0b4e1ada06450565dc9',
     22      'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
    2323    ),
    2424    'typerocket/typerocket' =>
     
    2929      array (
    3030      ),
    31       'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     31      'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    3232    ),
    3333  ),
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php

    r2402747 r2402883  
    8989            $results = array_map(function($value) use ($params) {
    9090                return [
    91                     'title' => Search::getSearchTitle($value, ['id' => 'post_type', 'registered' => $params['post_type']]),
     91                    'title' => Search::getSearchTitle($value, ['id' => 'post_type', 'registered' => $params['post_type'] ?? 'post']),
    9292                    'id' => $value->ID,
    9393                    'url' => get_permalink($value->ID),
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php

    r2402747 r2402883  
    183183    public static function componentTemplate($component, $group, $classes = '')
    184184    {
    185         $group = $component->form();
    186185        ?>
    187186        <div data-tr-component="<?php echo $component->uuid(); ?>" class="builder-field-group builder-type-<?php echo esc_attr($component->registeredAs()); ?> builder-group-<?php echo esc_attr($group); ?> <?php echo $classes; ?>">
    188187            <div class="tr-component-inputs tr-builder-inputs">
    189188                <?php
    190 
    191189                echo "<h3>{$component->feature('nameable')}</h3>";
    192190                $component->fields();
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php

    r2402747 r2402883  
    445445        $i = $nested ? 1 : 0;
    446446        $group = $name ?? $group; // This is to help with migration from v4/v1 to v5
     447        $name = $group;
    447448        $len = count($builder_data);
    448449
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php

    r2402747 r2402883  
    8282    {
    8383        foreach ($taxonomies as $tax) {
    84             if(!isset($tax['singular']) || !isset($tax['plural'])) {
     84            if(empty($tax['singular']) || empty($tax['plural']) || empty($tax['taxonomy_id'])) {
    8585                continue;
    8686            }
     
    8888            $singular = esc_html(trim($tax['singular']) ?: null);
    8989            $plural = esc_html(trim($tax['plural']) ?: null);
     90            $request_tax_id = trim($tax['taxonomy_id']) ?: null;
    9091
    9192            if($singular) {
    92                 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural);
     93                $t = \TypeRocket\Register\Taxonomy::add($singular, $plural, null, $request_tax_id);
    9394
    9495                if(isset($tax['taxonomy_id']) && trim($tax['taxonomy_id']) ) {
     
    152153    {
    153154        foreach ($boxes as $box) {
    154             if (!isset($box['meta_box_title']) || !isset($box['meta_box_id'])) {
     155            if (empty($box['meta_box_title']) || empty($box['meta_box_id'])) {
    155156                continue;
    156157            }
    157158
    158159            $title = esc_html(trim($box['meta_box_title']) ?: null);
    159             $id = esc_html(trim($box['meta_box_id']) ?: null);
    160 
    161             if($title) {
    162                 $mb = \TypeRocket\Register\MetaBox::add($title, []);
    163 
    164                 if($id) {
    165                     $mb->setId($id);
    166                 }
     160            $id = trim($box['meta_box_id']) ?: null;
     161
     162            if($title && $id) {
     163                $mb = \TypeRocket\Register\MetaBox::add($title, null, [], $id);
    167164
    168165                if(!empty($box['gutenberg'])) {
     
    210207    {
    211208        foreach ($types as $type) {
    212             if(!isset($type['singular']) || !isset($type['plural'])) {
     209            if(empty($type['singular']) || empty($type['plural']) || empty($type['post_type_id'])) {
    213210                continue;
    214211            }
     
    216213            $singular = esc_html(trim($type['singular']) ?: null);
    217214            $plural = esc_html(trim($type['plural']) ?: null);
    218 
    219             if($singular) {
    220                 $pt = \TypeRocket\Register\PostType::add($singular, $plural);
    221 
    222                 if(isset($type['post_type_id']) && trim($type['post_type_id']) ) {
    223                     $pt->setId($type['post_type_id']);
    224                 }
     215            $request_pt_id = trim($type['post_type_id']);
     216
     217            if($singular && $request_pt_id) {
     218                $pt = \TypeRocket\Register\PostType::add($singular, $plural, null, $request_pt_id);
    225219
    226220                if(isset($type['slug']) && trim($type['slug'])) {
     
    398392        $validator = Validator::new([
    399393            static::OPTION . '.post_types.?.singular' => 'required',
     394            static::OPTION . '.post_types.?.plural' => 'required',
    400395            static::OPTION . '.post_types.?.post_type_id' => 'max:20|required|key',
    401396            static::OPTION . '.taxonomies.?.singular' => 'required',
     397            static::OPTION . '.taxonomies.?.plural' => 'required',
    402398            static::OPTION . '.taxonomies.?.taxonomy_id' => 'max:32|required|key',
    403399            static::OPTION . '.meta_boxes.?.meta_box_title' => 'required',
     
    405401        ], $fields)->setErrorMessages([
    406402            static::OPTION . '.post_types.\d+.singular:required' => _x('Post type singular name {error}', 'required'),
     403            static::OPTION . '.post_types.\d+.plural:required' => _x('Post type plural name {error}', 'required'),
    407404            static::OPTION . '.post_types.\d+.post_type_id:max' => _x('Post type ID {error}', 'max'),
    408405            static::OPTION . '.post_types.\d+.post_type_id:required' => _x('Post type ID {error}', 'required'),
    409406            static::OPTION . '.post_types.\d+.post_type_id:key' => _x('Post type ID {error}', 'key'),
    410407            static::OPTION . '.taxonomies.\d+.singular:required' => __('Taxonomy singular name {error}'),
     408            static::OPTION . '.taxonomies.\d+.plural:required' => __('Taxonomy plural name {error}'),
    411409            static::OPTION . '.taxonomies.\d+.taxonomy_id:max' => _x('Taxonomy ID {error}', 'max'),
    412410            static::OPTION . '.taxonomies.\d+.taxonomy_id:required' => _x('Taxonomy ID {error}', 'required'),
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/MetaBox.php

    r2402747 r2402883  
    2121     * @param null|string|array $screen
    2222     * @param array $settings
    23      */
    24     public function __construct( $name, $screen = null, array $settings = [])
     23     * @param string|null $id
     24     */
     25    public function __construct( $name, $screen = null, array $settings = [], $id = null)
    2526    {
    2627        $this->label = $this->id = $name;
    27         $this->id    = Sanitize::underscore( $this->id );
     28        $this->setId($id ?? $this->id);
    2829
    2930        if ( ! empty( $screen )) {
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/PostType.php

    r2402747 r2402883  
    4343     * @param string|array|null $plural plural name or settings array override
    4444     * @param array|null $settings args override and extend
    45      */
    46     public function __construct( $singular, $plural = null, $settings = null )
     45     * @param string|null $id post type ID
     46     */
     47    public function __construct( $singular, $plural = null, $settings = null, $id = null )
    4748    {
    4849        $singularLower = strtolower( trim($singular) );
     50        $id = $id ?? $singularLower;
    4951
    5052        if(is_array($plural) && is_null($settings)) {
    5153            $settings = $plural;
    5254            $plural = null;
    53         } elseif(is_null($settings)) {
     55        }
     56
     57        if(is_null($settings)) {
    5458            $settings = [];
    5559        }
    5660
    57         if(is_null($plural)) {
    58             $plural = strtolower(Inflect::pluralize($singular));
    59         }
    60 
    61         $this->existing = get_post_type_object($singularLower);
     61        if(empty($plural)) {
     62            $plural = trim(strtolower(Inflect::pluralize($singular)));
     63        }
     64
     65        $labelSingular = $singular;
     66        $labelPlural = $plural;
     67        $keep_case = false;
     68
     69        if(!empty($settings['labeled'])) {
     70            $labelSingular = $settings['labeled'][0] ?? $labelSingular;
     71            $labelPlural = $settings['labeled'][1] ?? $labelPlural;
     72            $keep_case = $settings['labeled'][2] ?? $keep_case;
     73            unset($settings['labeled']);
     74        }
     75
     76        if(empty($settings['labeled'])) {
     77            $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
     78        }
     79
     80        $this->existing = get_post_type_object($id);
    6281
    6382        if($this->existing) {
    6483            $this->id = $this->existing->name;
    65             $this->args = (array) $this->existing;
     84            $args = (array) $this->existing;
    6685
    6786            $singular = Sanitize::underscore( $singular );
     
    7493                    'controller' => null
    7594                ];
    76             $this->args['supports'] = array_keys(get_all_post_type_supports($this->id));
    77             $this->args = array_merge($this->args, $settings);
     95            $args['supports'] = array_keys(get_all_post_type_supports($this->id));
     96            $this->args = array_merge($args, $this->args, $settings);
    7897
    7998            return $this;
    80         }
    81 
    82         $labelSingular = $singular;
    83         $labelPlural = $plural;
    84         $keep_case = false;
    85 
    86         if(!empty($settings['labeled'])) {
    87             $labelSingular = $settings['labeled'][0] ?? $labelSingular;
    88             $labelPlural = $settings['labeled'][1] ?? $labelPlural;
    89             $keep_case = $settings['labeled'][2] ?? $keep_case;
    90             unset($settings['labeled']);
    91         }
    92 
    93         if(empty($settings['labeled'])) {
    94             $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
    9599        }
    96100
     
    105109        ];
    106110
    107         $this->setId(! $this->id ? $singular : $this->id);
     111        $this->setId( $this->id ?: ($id ?? $singular) );
    108112
    109113        if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) :
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/Registrable.php

    r2402747 r2402883  
    1111    protected $maxIdLength = 10000;
    1212    protected $args = [];
     13    protected $blocked = false;
    1314    protected $reservedNames = [
    1415        'attachment',
     
    206207            $exception = sprintf(__('You can not register a post type or taxonomy using the WordPress reserved name "%s".', 'typerocket-domain'),  $this->id);
    207208            Notice::admin(['type' => 'error', 'message' => $exception]);
    208 
     209            $this->blocked = true;
    209210            return true;
    210211        }
    211212
    212213        return false;
     214    }
     215
     216    /**
     217     * @return bool
     218     */
     219    public function isBlocked()
     220    {
     221        return $this->blocked;
    213222    }
    214223
     
    244253    public function addToRegistry()
    245254    {
    246         Registry::addRegistrable($this);
     255        if(!$this->blocked) {
     256            Registry::addRegistrable($this);
     257        }
    247258
    248259        return $this;
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php

    r2402747 r2402883  
    2929     *
    3030     * @param string $singular singular name is required
    31      * @param string $plural plural name
    32      * @param array $settings args override and extend
    33      */
    34     public function __construct( $singular, $plural = null, $settings = [])
     31     * @param string|null $plural plural name
     32     * @param array|null $settings args override and extend
     33     * @param string|null $id taxonomy ID
     34     */
     35    public function __construct( $singular, $plural = null, $settings = null, $id = null)
    3536    {
    3637        $lowerSingular = strtolower( trim($singular) );
    37 
    38         if (is_null( $plural )) {
    39             $plural = Inflect::pluralize($singular);
    40             $existing = get_taxonomy( strtolower($lowerSingular) );
    41 
    42             if($existing) {
    43                 $this->existing = $existing;
    44 
    45                 $singular = Sanitize::underscore( $singular );
    46                 $plural  = Sanitize::underscore( $plural );
    47 
    48                 $this->id = $this->existing->name;
    49                 $this->resource = Registry::getTaxonomyResource($this->id) ?? [
     38        $id = $id ?? $lowerSingular;
     39
     40        if(is_array($plural) && is_null($settings)) {
     41            $settings = $plural;
     42            $plural = null;
     43        }
     44
     45        if(is_null($settings)) {
     46            $settings = [];
     47        }
     48
     49        if(empty($plural)) {
     50            $plural = trim(strtolower(Inflect::pluralize($singular)));
     51        }
     52
     53        $labelSingular = $singular;
     54        $labelPlural = $plural;
     55        $keep_case = false;
     56
     57        if(!empty($settings['labeled'])) {
     58            $labelSingular = $settings['labeled'][0] ?? $labelSingular;
     59            $labelPlural = $settings['labeled'][1] ?? $labelPlural;
     60            $keep_case = $settings['labeled'][2] ?? $keep_case;
     61            unset($settings['labeled']);
     62        }
     63
     64        if(empty($settings['labeled'])) {
     65            $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
     66        }
     67
     68        $existing = get_taxonomy( $id );
     69
     70        if ($existing) {
     71            $this->existing = $existing;
     72
     73            $singular = Sanitize::underscore( $singular );
     74            $plural  = Sanitize::underscore( $plural );
     75
     76            $this->id = $this->existing->name;
     77            $args = (array) $this->existing;
     78            $this->resource = Registry::getTaxonomyResource($this->id) ?? [
    5079                    'singular' => $singular,
    5180                    'plural' => $plural,
     
    5382                    'controller' => null
    5483                ];
    55                 $this->postTypes = $this->existing->object_type;
    56                 $this->args = array_merge($this->args, (array) $this->existing, $settings);
    57 
    58                 return $this;
    59             }
    60         }
    61 
    62         $this->applyQuickLabels($singular, $plural);
     84            $this->postTypes = $this->existing->object_type;
     85            $this->args = array_merge($args, $this->args, $settings);
     86
     87            return $this;
     88        }
    6389
    6490        // setup object for later use
     
    7399        ];
    74100
    75         $this->setId(! $this->id ? $singular : $this->id);
     101        $this->setId($this->id ?: ($id ?? $singular));
    76102
    77103        if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) :
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Template/View.php

    r2402747 r2402883  
    234234     * @param string $key
    235235     * @param int $time cache forever by default
     236     * @param string $folder
    236237     *
    237238     * @return string|null
    238239     */
    239     public function cache($key, $time = 9999999999)
    240     {
    241         return PersistentCache::new()->getOtherwisePut($key, function() {
     240    public function cache($key, $time = 9999999999, $folder = 'app')
     241    {
     242        return PersistentCache::new($folder)->getOtherwisePut($key, function() {
    242243            return $this->toString();
    243244        }, $time);
  • typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Utility/File.php

    r2402747 r2402883  
    5858
    5959        if($content) {
    60             file_put_contents($this->file, $content);
    61         }
    62 
    63         $this->existing = true;
     60            $name = basename($this->file);
     61            $dir = substr($this->file, 0, -strlen($name));
     62
     63            if (!is_dir($dir)) {
     64                mkdir($dir);
     65            }
     66
     67            $this->existing = (bool) file_put_contents($this->file, $content);
     68        }
    6469
    6570        return $this;
  • typerocket-ui/trunk/readme.txt

    r2402747 r2402883  
    55Requires PHP: 7.2.5
    66Tested up to: 5.5.1
    7 Stable Tag: 5.0.0
     7Stable Tag: 5.0.2
    88License: GPLv2 or later
    99
     
    3333== Changelog ==
    3434
    35 = 5.0 =
     35= 5.0.2 =
     36
     37* Fix deploy script.
     38
     39= 5.0.1 =
     40
     41* Require plural names.
     42* Allow overriding of existing post types like post and page.
     43* Bug fixes.
     44
     45= 5.0.0 =
    3646
    3747* Custom Post Type, Taxonomies, and Meta Box UI
  • typerocket-ui/trunk/typerocket-ui.php

    r2402747 r2402883  
    44Plugin URI: https://typerocket.com/ui/
    55Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes.
    6 Version: 5.0.0
     6Version: 5.0.2
    77Requires PHP: 7.2
    88Author: TypeRocket
     
    5757        define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
    5858        define('TYPEROCKET_CORE_CONFIG_PATH', __DIR__ . '/typerocket/config' );
    59         define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
    6059        define('TYPEROCKET_ROOT_WP', ABSPATH);
    6160
     61        define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
    6262        define('TYPEROCKET_AUTOLOAD_APP', [
    6363            'prefix' => TYPEROCKET_APP_NAMESPACE . '\\',
  • typerocket-ui/trunk/typerocket/composer.lock

    r2402747 r2402883  
    386386            "name": "typerocket/core",
    387387            "version": "dev-main",
    388             "dist": {
    389                 "type": "zip",
    390                 "url": "https://typerocket.repo.packagist.com/robojuice/dists/typerocket/core/dev-main/f6755087ab761752d429d0b4e1ada06450565dc9.zip",
    391                 "reference": "f6755087ab761752d429d0b4e1ada06450565dc9",
    392                 "mirrors": [
    393                     {
    394                         "url": "https://typerocket.repo.packagist.com/robojuice/dists/%package%/%version%/r%reference%.%type%",
    395                         "preferred": true
    396                     }
    397                 ]
     388            "source": {
     389                "type": "git",
     390                "url": "https://github.com/TypeRocket/core.git",
     391                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"
     392            },
     393            "dist": {
     394                "type": "zip",
     395                "url": "https://api.github.com/repos/TypeRocket/core/zipball/88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     396                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     397                "shasum": ""
    398398            },
    399399            "require": {
     
    412412                }
    413413            },
    414             "notification-url": "https://typerocket.repo.packagist.com/robojuice/downloads/",
     414            "notification-url": "https://packagist.org/downloads/",
    415415            "license": [
    416416                "GPL-3.0-or-later"
     
    432432            "support": {
    433433                "docs": "https://typerocket.com/docs/v5/",
    434                 "source": "https://github.com/TypeRocket/core/tree/v5.0.2",
    435                 "issues": "https://github.com/TypeRocket/core/issues"
    436             },
    437             "time": "2020-10-15T18:59:31+00:00"
     434                "issues": "https://github.com/TypeRocket/core/issues",
     435                "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
     436            },
     437            "time": "2020-10-20T01:01:39+00:00"
    438438        }
    439439    ],
  • typerocket-ui/trunk/typerocket/galaxy

    r2402747 r2402883  
    33if( php_sapi_name() !== 'cli' )
    44    die("Meant to be run from command line" . PHP_EOL);
     5
     6define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');
     7define('TYPEROCKET_AUTOLOAD_APP', [
     8    'prefix' => TYPEROCKET_APP_NAMESPACE . '\\',
     9    'folder' => __DIR__ . '/app/',
     10]);
    511
    612define('WPMU_PLUGIN_URL', '/mu-plugins');
  • typerocket-ui/trunk/typerocket/vendor/composer/InstalledVersions.php

    r2402747 r2402883  
    2020    array (
    2121    ),
    22     'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     22    'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    2323    'name' => 'typerocket/typerocket',
    2424  ),
     
    8585        0 => '9999999-dev',
    8686      ),
    87       'reference' => 'f6755087ab761752d429d0b4e1ada06450565dc9',
     87      'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
    8888    ),
    8989    'typerocket/typerocket' =>
     
    9494      array (
    9595      ),
    96       'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     96      'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    9797    ),
    9898  ),
  • typerocket-ui/trunk/typerocket/vendor/composer/installed.json

    r2402747 r2402883  
    396396            "version": "dev-main",
    397397            "version_normalized": "dev-main",
    398             "dist": {
    399                 "type": "zip",
    400                 "url": "https://typerocket.repo.packagist.com/robojuice/dists/typerocket/core/dev-main/f6755087ab761752d429d0b4e1ada06450565dc9.zip",
    401                 "reference": "f6755087ab761752d429d0b4e1ada06450565dc9",
    402                 "mirrors": [
    403                     {
    404                         "url": "https://typerocket.repo.packagist.com/robojuice/dists/%package%/%version%/r%reference%.%type%",
    405                         "preferred": true
    406                     }
    407                 ]
     398            "source": {
     399                "type": "git",
     400                "url": "https://github.com/TypeRocket/core.git",
     401                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"
     402            },
     403            "dist": {
     404                "type": "zip",
     405                "url": "https://api.github.com/repos/TypeRocket/core/zipball/88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     406                "reference": "88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",
     407                "shasum": ""
    408408            },
    409409            "require": {
     
    415415                "phpunit/phpunit": "7.4.*"
    416416            },
    417             "time": "2020-10-15T18:59:31+00:00",
     417            "time": "2020-10-20T01:01:39+00:00",
    418418            "default-branch": true,
    419419            "type": "library",
     
    424424                }
    425425            },
    426             "notification-url": "https://typerocket.repo.packagist.com/robojuice/downloads/",
     426            "notification-url": "https://packagist.org/downloads/",
    427427            "license": [
    428428                "GPL-3.0-or-later"
     
    444444            "support": {
    445445                "docs": "https://typerocket.com/docs/v5/",
    446                 "source": "https://github.com/TypeRocket/core/tree/main",
    447                 "issues": "https://github.com/TypeRocket/core/issues"
     446                "issues": "https://github.com/TypeRocket/core/issues",
     447                "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
    448448            },
    449449            "install-path": "../typerocket/core"
  • typerocket-ui/trunk/typerocket/vendor/composer/installed.php

    r2402747 r2402883  
    77    array (
    88    ),
    9     'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     9    'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    1010    'name' => 'typerocket/typerocket',
    1111  ),
     
    2020        0 => '9999999-dev',
    2121      ),
    22       'reference' => 'f6755087ab761752d429d0b4e1ada06450565dc9',
     22      'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
    2323    ),
    2424    'typerocket/typerocket' =>
     
    2929      array (
    3030      ),
    31       'reference' => 'ef8255ee7c28ae03247307f2094ac40e625c0427',
     31      'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
    3232    ),
    3333  ),
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php

    r2402747 r2402883  
    8989            $results = array_map(function($value) use ($params) {
    9090                return [
    91                     'title' => Search::getSearchTitle($value, ['id' => 'post_type', 'registered' => $params['post_type']]),
     91                    'title' => Search::getSearchTitle($value, ['id' => 'post_type', 'registered' => $params['post_type'] ?? 'post']),
    9292                    'id' => $value->ID,
    9393                    'url' => get_permalink($value->ID),
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php

    r2402747 r2402883  
    183183    public static function componentTemplate($component, $group, $classes = '')
    184184    {
    185         $group = $component->form();
    186185        ?>
    187186        <div data-tr-component="<?php echo $component->uuid(); ?>" class="builder-field-group builder-type-<?php echo esc_attr($component->registeredAs()); ?> builder-group-<?php echo esc_attr($group); ?> <?php echo $classes; ?>">
    188187            <div class="tr-component-inputs tr-builder-inputs">
    189188                <?php
    190 
    191189                echo "<h3>{$component->feature('nameable')}</h3>";
    192190                $component->fields();
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php

    r2402747 r2402883  
    445445        $i = $nested ? 1 : 0;
    446446        $group = $name ?? $group; // This is to help with migration from v4/v1 to v5
     447        $name = $group;
    447448        $len = count($builder_data);
    448449
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php

    r2402747 r2402883  
    8282    {
    8383        foreach ($taxonomies as $tax) {
    84             if(!isset($tax['singular']) || !isset($tax['plural'])) {
     84            if(empty($tax['singular']) || empty($tax['plural']) || empty($tax['taxonomy_id'])) {
    8585                continue;
    8686            }
     
    8888            $singular = esc_html(trim($tax['singular']) ?: null);
    8989            $plural = esc_html(trim($tax['plural']) ?: null);
     90            $request_tax_id = trim($tax['taxonomy_id']) ?: null;
    9091
    9192            if($singular) {
    92                 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural);
     93                $t = \TypeRocket\Register\Taxonomy::add($singular, $plural, null, $request_tax_id);
    9394
    9495                if(isset($tax['taxonomy_id']) && trim($tax['taxonomy_id']) ) {
     
    152153    {
    153154        foreach ($boxes as $box) {
    154             if (!isset($box['meta_box_title']) || !isset($box['meta_box_id'])) {
     155            if (empty($box['meta_box_title']) || empty($box['meta_box_id'])) {
    155156                continue;
    156157            }
    157158
    158159            $title = esc_html(trim($box['meta_box_title']) ?: null);
    159             $id = esc_html(trim($box['meta_box_id']) ?: null);
    160 
    161             if($title) {
    162                 $mb = \TypeRocket\Register\MetaBox::add($title, []);
    163 
    164                 if($id) {
    165                     $mb->setId($id);
    166                 }
     160            $id = trim($box['meta_box_id']) ?: null;
     161
     162            if($title && $id) {
     163                $mb = \TypeRocket\Register\MetaBox::add($title, null, [], $id);
    167164
    168165                if(!empty($box['gutenberg'])) {
     
    210207    {
    211208        foreach ($types as $type) {
    212             if(!isset($type['singular']) || !isset($type['plural'])) {
     209            if(empty($type['singular']) || empty($type['plural']) || empty($type['post_type_id'])) {
    213210                continue;
    214211            }
     
    216213            $singular = esc_html(trim($type['singular']) ?: null);
    217214            $plural = esc_html(trim($type['plural']) ?: null);
    218 
    219             if($singular) {
    220                 $pt = \TypeRocket\Register\PostType::add($singular, $plural);
    221 
    222                 if(isset($type['post_type_id']) && trim($type['post_type_id']) ) {
    223                     $pt->setId($type['post_type_id']);
    224                 }
     215            $request_pt_id = trim($type['post_type_id']);
     216
     217            if($singular && $request_pt_id) {
     218                $pt = \TypeRocket\Register\PostType::add($singular, $plural, null, $request_pt_id);
    225219
    226220                if(isset($type['slug']) && trim($type['slug'])) {
     
    398392        $validator = Validator::new([
    399393            static::OPTION . '.post_types.?.singular' => 'required',
     394            static::OPTION . '.post_types.?.plural' => 'required',
    400395            static::OPTION . '.post_types.?.post_type_id' => 'max:20|required|key',
    401396            static::OPTION . '.taxonomies.?.singular' => 'required',
     397            static::OPTION . '.taxonomies.?.plural' => 'required',
    402398            static::OPTION . '.taxonomies.?.taxonomy_id' => 'max:32|required|key',
    403399            static::OPTION . '.meta_boxes.?.meta_box_title' => 'required',
     
    405401        ], $fields)->setErrorMessages([
    406402            static::OPTION . '.post_types.\d+.singular:required' => _x('Post type singular name {error}', 'required'),
     403            static::OPTION . '.post_types.\d+.plural:required' => _x('Post type plural name {error}', 'required'),
    407404            static::OPTION . '.post_types.\d+.post_type_id:max' => _x('Post type ID {error}', 'max'),
    408405            static::OPTION . '.post_types.\d+.post_type_id:required' => _x('Post type ID {error}', 'required'),
    409406            static::OPTION . '.post_types.\d+.post_type_id:key' => _x('Post type ID {error}', 'key'),
    410407            static::OPTION . '.taxonomies.\d+.singular:required' => __('Taxonomy singular name {error}'),
     408            static::OPTION . '.taxonomies.\d+.plural:required' => __('Taxonomy plural name {error}'),
    411409            static::OPTION . '.taxonomies.\d+.taxonomy_id:max' => _x('Taxonomy ID {error}', 'max'),
    412410            static::OPTION . '.taxonomies.\d+.taxonomy_id:required' => _x('Taxonomy ID {error}', 'required'),
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/MetaBox.php

    r2402747 r2402883  
    2121     * @param null|string|array $screen
    2222     * @param array $settings
    23      */
    24     public function __construct( $name, $screen = null, array $settings = [])
     23     * @param string|null $id
     24     */
     25    public function __construct( $name, $screen = null, array $settings = [], $id = null)
    2526    {
    2627        $this->label = $this->id = $name;
    27         $this->id    = Sanitize::underscore( $this->id );
     28        $this->setId($id ?? $this->id);
    2829
    2930        if ( ! empty( $screen )) {
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/PostType.php

    r2402747 r2402883  
    4343     * @param string|array|null $plural plural name or settings array override
    4444     * @param array|null $settings args override and extend
    45      */
    46     public function __construct( $singular, $plural = null, $settings = null )
     45     * @param string|null $id post type ID
     46     */
     47    public function __construct( $singular, $plural = null, $settings = null, $id = null )
    4748    {
    4849        $singularLower = strtolower( trim($singular) );
     50        $id = $id ?? $singularLower;
    4951
    5052        if(is_array($plural) && is_null($settings)) {
    5153            $settings = $plural;
    5254            $plural = null;
    53         } elseif(is_null($settings)) {
     55        }
     56
     57        if(is_null($settings)) {
    5458            $settings = [];
    5559        }
    5660
    57         if(is_null($plural)) {
    58             $plural = strtolower(Inflect::pluralize($singular));
    59         }
    60 
    61         $this->existing = get_post_type_object($singularLower);
     61        if(empty($plural)) {
     62            $plural = trim(strtolower(Inflect::pluralize($singular)));
     63        }
     64
     65        $labelSingular = $singular;
     66        $labelPlural = $plural;
     67        $keep_case = false;
     68
     69        if(!empty($settings['labeled'])) {
     70            $labelSingular = $settings['labeled'][0] ?? $labelSingular;
     71            $labelPlural = $settings['labeled'][1] ?? $labelPlural;
     72            $keep_case = $settings['labeled'][2] ?? $keep_case;
     73            unset($settings['labeled']);
     74        }
     75
     76        if(empty($settings['labeled'])) {
     77            $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
     78        }
     79
     80        $this->existing = get_post_type_object($id);
    6281
    6382        if($this->existing) {
    6483            $this->id = $this->existing->name;
    65             $this->args = (array) $this->existing;
     84            $args = (array) $this->existing;
    6685
    6786            $singular = Sanitize::underscore( $singular );
     
    7493                    'controller' => null
    7594                ];
    76             $this->args['supports'] = array_keys(get_all_post_type_supports($this->id));
    77             $this->args = array_merge($this->args, $settings);
     95            $args['supports'] = array_keys(get_all_post_type_supports($this->id));
     96            $this->args = array_merge($args, $this->args, $settings);
    7897
    7998            return $this;
    80         }
    81 
    82         $labelSingular = $singular;
    83         $labelPlural = $plural;
    84         $keep_case = false;
    85 
    86         if(!empty($settings['labeled'])) {
    87             $labelSingular = $settings['labeled'][0] ?? $labelSingular;
    88             $labelPlural = $settings['labeled'][1] ?? $labelPlural;
    89             $keep_case = $settings['labeled'][2] ?? $keep_case;
    90             unset($settings['labeled']);
    91         }
    92 
    93         if(empty($settings['labeled'])) {
    94             $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
    9599        }
    96100
     
    105109        ];
    106110
    107         $this->setId(! $this->id ? $singular : $this->id);
     111        $this->setId( $this->id ?: ($id ?? $singular) );
    108112
    109113        if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) :
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php

    r2402747 r2402883  
    1111    protected $maxIdLength = 10000;
    1212    protected $args = [];
     13    protected $blocked = false;
    1314    protected $reservedNames = [
    1415        'attachment',
     
    206207            $exception = sprintf(__('You can not register a post type or taxonomy using the WordPress reserved name "%s".', 'typerocket-domain'),  $this->id);
    207208            Notice::admin(['type' => 'error', 'message' => $exception]);
    208 
     209            $this->blocked = true;
    209210            return true;
    210211        }
    211212
    212213        return false;
     214    }
     215
     216    /**
     217     * @return bool
     218     */
     219    public function isBlocked()
     220    {
     221        return $this->blocked;
    213222    }
    214223
     
    244253    public function addToRegistry()
    245254    {
    246         Registry::addRegistrable($this);
     255        if(!$this->blocked) {
     256            Registry::addRegistrable($this);
     257        }
    247258
    248259        return $this;
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php

    r2402747 r2402883  
    2929     *
    3030     * @param string $singular singular name is required
    31      * @param string $plural plural name
    32      * @param array $settings args override and extend
    33      */
    34     public function __construct( $singular, $plural = null, $settings = [])
     31     * @param string|null $plural plural name
     32     * @param array|null $settings args override and extend
     33     * @param string|null $id taxonomy ID
     34     */
     35    public function __construct( $singular, $plural = null, $settings = null, $id = null)
    3536    {
    3637        $lowerSingular = strtolower( trim($singular) );
    37 
    38         if (is_null( $plural )) {
    39             $plural = Inflect::pluralize($singular);
    40             $existing = get_taxonomy( strtolower($lowerSingular) );
    41 
    42             if($existing) {
    43                 $this->existing = $existing;
    44 
    45                 $singular = Sanitize::underscore( $singular );
    46                 $plural  = Sanitize::underscore( $plural );
    47 
    48                 $this->id = $this->existing->name;
    49                 $this->resource = Registry::getTaxonomyResource($this->id) ?? [
     38        $id = $id ?? $lowerSingular;
     39
     40        if(is_array($plural) && is_null($settings)) {
     41            $settings = $plural;
     42            $plural = null;
     43        }
     44
     45        if(is_null($settings)) {
     46            $settings = [];
     47        }
     48
     49        if(empty($plural)) {
     50            $plural = trim(strtolower(Inflect::pluralize($singular)));
     51        }
     52
     53        $labelSingular = $singular;
     54        $labelPlural = $plural;
     55        $keep_case = false;
     56
     57        if(!empty($settings['labeled'])) {
     58            $labelSingular = $settings['labeled'][0] ?? $labelSingular;
     59            $labelPlural = $settings['labeled'][1] ?? $labelPlural;
     60            $keep_case = $settings['labeled'][2] ?? $keep_case;
     61            unset($settings['labeled']);
     62        }
     63
     64        if(empty($settings['labeled'])) {
     65            $this->applyQuickLabels($labelSingular, $labelPlural, $keep_case);
     66        }
     67
     68        $existing = get_taxonomy( $id );
     69
     70        if ($existing) {
     71            $this->existing = $existing;
     72
     73            $singular = Sanitize::underscore( $singular );
     74            $plural  = Sanitize::underscore( $plural );
     75
     76            $this->id = $this->existing->name;
     77            $args = (array) $this->existing;
     78            $this->resource = Registry::getTaxonomyResource($this->id) ?? [
    5079                    'singular' => $singular,
    5180                    'plural' => $plural,
     
    5382                    'controller' => null
    5483                ];
    55                 $this->postTypes = $this->existing->object_type;
    56                 $this->args = array_merge($this->args, (array) $this->existing, $settings);
    57 
    58                 return $this;
    59             }
    60         }
    61 
    62         $this->applyQuickLabels($singular, $plural);
     84            $this->postTypes = $this->existing->object_type;
     85            $this->args = array_merge($args, $this->args, $settings);
     86
     87            return $this;
     88        }
    6389
    6490        // setup object for later use
     
    7399        ];
    74100
    75         $this->setId(! $this->id ? $singular : $this->id);
     101        $this->setId($this->id ?: ($id ?? $singular));
    76102
    77103        if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) :
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Template/View.php

    r2402747 r2402883  
    234234     * @param string $key
    235235     * @param int $time cache forever by default
     236     * @param string $folder
    236237     *
    237238     * @return string|null
    238239     */
    239     public function cache($key, $time = 9999999999)
    240     {
    241         return PersistentCache::new()->getOtherwisePut($key, function() {
     240    public function cache($key, $time = 9999999999, $folder = 'app')
     241    {
     242        return PersistentCache::new($folder)->getOtherwisePut($key, function() {
    242243            return $this->toString();
    243244        }, $time);
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Utility/File.php

    r2402747 r2402883  
    5858
    5959        if($content) {
    60             file_put_contents($this->file, $content);
    61         }
    62 
    63         $this->existing = true;
     60            $name = basename($this->file);
     61            $dir = substr($this->file, 0, -strlen($name));
     62
     63            if (!is_dir($dir)) {
     64                mkdir($dir);
     65            }
     66
     67            $this->existing = (bool) file_put_contents($this->file, $content);
     68        }
    6469
    6570        return $this;
Note: See TracChangeset for help on using the changeset viewer.