Changeset 2402883
- Timestamp:
- 10/20/2020 01:53:26 AM (5 years ago)
- Location:
- typerocket-ui
- Files:
-
- 34 edited
- 1 copied
-
tags/5.0.2 (copied) (copied from typerocket-ui/trunk)
-
tags/5.0.2/readme.txt (modified) (2 diffs)
-
tags/5.0.2/typerocket-ui.php (modified) (2 diffs)
-
tags/5.0.2/typerocket/composer.lock (modified) (3 diffs)
-
tags/5.0.2/typerocket/galaxy (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
tags/5.0.2/typerocket/vendor/composer/installed.json (modified) (4 diffs)
-
tags/5.0.2/typerocket/vendor/composer/installed.php (modified) (3 diffs)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php (modified) (7 diffs)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/MetaBox.php (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/PostType.php (modified) (3 diffs)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/Registrable.php (modified) (3 diffs)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php (modified) (3 diffs)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Template/View.php (modified) (1 diff)
-
tags/5.0.2/typerocket/vendor/typerocket/core/src/Utility/File.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/typerocket-ui.php (modified) (2 diffs)
-
trunk/typerocket/composer.lock (modified) (3 diffs)
-
trunk/typerocket/galaxy (modified) (1 diff)
-
trunk/typerocket/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
trunk/typerocket/vendor/composer/installed.json (modified) (4 diffs)
-
trunk/typerocket/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php (modified) (7 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Register/MetaBox.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Register/PostType.php (modified) (3 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php (modified) (3 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php (modified) (3 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Template/View.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Utility/File.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
typerocket-ui/tags/5.0.2/readme.txt
r2402747 r2402883 5 5 Requires PHP: 7.2.5 6 6 Tested up to: 5.5.1 7 Stable Tag: 5.0. 07 Stable Tag: 5.0.2 8 8 License: GPLv2 or later 9 9 … … 33 33 == Changelog == 34 34 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 = 36 46 37 47 * Custom Post Type, Taxonomies, and Meta Box UI -
typerocket-ui/tags/5.0.2/typerocket-ui.php
r2402747 r2402883 4 4 Plugin URI: https://typerocket.com/ui/ 5 5 Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes. 6 Version: 5.0. 06 Version: 5.0.2 7 7 Requires PHP: 7.2 8 8 Author: TypeRocket … … 57 57 define('TYPEROCKET_PLUGIN_INSTALL', __DIR__); 58 58 define('TYPEROCKET_CORE_CONFIG_PATH', __DIR__ . '/typerocket/config' ); 59 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');60 59 define('TYPEROCKET_ROOT_WP', ABSPATH); 61 60 61 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin'); 62 62 define('TYPEROCKET_AUTOLOAD_APP', [ 63 63 'prefix' => TYPEROCKET_APP_NAMESPACE . '\\', -
typerocket-ui/tags/5.0.2/typerocket/composer.lock
r2402747 r2402883 386 386 "name": "typerocket/core", 387 387 "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": true396 }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": "" 398 398 }, 399 399 "require": { … … 412 412 } 413 413 }, 414 "notification-url": "https:// typerocket.repo.packagist.com/robojuice/downloads/",414 "notification-url": "https://packagist.org/downloads/", 415 415 "license": [ 416 416 "GPL-3.0-or-later" … … 432 432 "support": { 433 433 "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" 438 438 } 439 439 ], -
typerocket-ui/tags/5.0.2/typerocket/galaxy
r2402747 r2402883 3 3 if( php_sapi_name() !== 'cli' ) 4 4 die("Meant to be run from command line" . PHP_EOL); 5 6 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin'); 7 define('TYPEROCKET_AUTOLOAD_APP', [ 8 'prefix' => TYPEROCKET_APP_NAMESPACE . '\\', 9 'folder' => __DIR__ . '/app/', 10 ]); 5 11 6 12 define('WPMU_PLUGIN_URL', '/mu-plugins'); -
typerocket-ui/tags/5.0.2/typerocket/vendor/composer/InstalledVersions.php
r2402747 r2402883 20 20 array ( 21 21 ), 22 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',22 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 23 23 'name' => 'typerocket/typerocket', 24 24 ), … … 85 85 0 => '9999999-dev', 86 86 ), 87 'reference' => ' f6755087ab761752d429d0b4e1ada06450565dc9',87 'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d', 88 88 ), 89 89 'typerocket/typerocket' => … … 94 94 array ( 95 95 ), 96 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',96 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 97 97 ), 98 98 ), -
typerocket-ui/tags/5.0.2/typerocket/vendor/composer/installed.json
r2402747 r2402883 396 396 "version": "dev-main", 397 397 "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": true406 }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": "" 408 408 }, 409 409 "require": { … … 415 415 "phpunit/phpunit": "7.4.*" 416 416 }, 417 "time": "2020-10- 15T18:59:31+00:00",417 "time": "2020-10-20T01:01:39+00:00", 418 418 "default-branch": true, 419 419 "type": "library", … … 424 424 } 425 425 }, 426 "notification-url": "https:// typerocket.repo.packagist.com/robojuice/downloads/",426 "notification-url": "https://packagist.org/downloads/", 427 427 "license": [ 428 428 "GPL-3.0-or-later" … … 444 444 "support": { 445 445 "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" 448 448 }, 449 449 "install-path": "../typerocket/core" -
typerocket-ui/tags/5.0.2/typerocket/vendor/composer/installed.php
r2402747 r2402883 7 7 array ( 8 8 ), 9 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',9 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 10 10 'name' => 'typerocket/typerocket', 11 11 ), … … 20 20 0 => '9999999-dev', 21 21 ), 22 'reference' => ' f6755087ab761752d429d0b4e1ada06450565dc9',22 'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d', 23 23 ), 24 24 'typerocket/typerocket' => … … 29 29 array ( 30 30 ), 31 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',31 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 32 32 ), 33 33 ), -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php
r2402747 r2402883 89 89 $results = array_map(function($value) use ($params) { 90 90 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']), 92 92 'id' => $value->ID, 93 93 'url' => get_permalink($value->ID), -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php
r2402747 r2402883 183 183 public static function componentTemplate($component, $group, $classes = '') 184 184 { 185 $group = $component->form();186 185 ?> 187 186 <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; ?>"> 188 187 <div class="tr-component-inputs tr-builder-inputs"> 189 188 <?php 190 191 189 echo "<h3>{$component->feature('nameable')}</h3>"; 192 190 $component->fields(); -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php
r2402747 r2402883 445 445 $i = $nested ? 1 : 0; 446 446 $group = $name ?? $group; // This is to help with migration from v4/v1 to v5 447 $name = $group; 447 448 $len = count($builder_data); 448 449 -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php
r2402747 r2402883 82 82 { 83 83 foreach ($taxonomies as $tax) { 84 if( !isset($tax['singular']) || !isset($tax['plural'])) {84 if(empty($tax['singular']) || empty($tax['plural']) || empty($tax['taxonomy_id'])) { 85 85 continue; 86 86 } … … 88 88 $singular = esc_html(trim($tax['singular']) ?: null); 89 89 $plural = esc_html(trim($tax['plural']) ?: null); 90 $request_tax_id = trim($tax['taxonomy_id']) ?: null; 90 91 91 92 if($singular) { 92 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural );93 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural, null, $request_tax_id); 93 94 94 95 if(isset($tax['taxonomy_id']) && trim($tax['taxonomy_id']) ) { … … 152 153 { 153 154 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'])) { 155 156 continue; 156 157 } 157 158 158 159 $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); 167 164 168 165 if(!empty($box['gutenberg'])) { … … 210 207 { 211 208 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'])) { 213 210 continue; 214 211 } … … 216 213 $singular = esc_html(trim($type['singular']) ?: null); 217 214 $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); 225 219 226 220 if(isset($type['slug']) && trim($type['slug'])) { … … 398 392 $validator = Validator::new([ 399 393 static::OPTION . '.post_types.?.singular' => 'required', 394 static::OPTION . '.post_types.?.plural' => 'required', 400 395 static::OPTION . '.post_types.?.post_type_id' => 'max:20|required|key', 401 396 static::OPTION . '.taxonomies.?.singular' => 'required', 397 static::OPTION . '.taxonomies.?.plural' => 'required', 402 398 static::OPTION . '.taxonomies.?.taxonomy_id' => 'max:32|required|key', 403 399 static::OPTION . '.meta_boxes.?.meta_box_title' => 'required', … … 405 401 ], $fields)->setErrorMessages([ 406 402 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'), 407 404 static::OPTION . '.post_types.\d+.post_type_id:max' => _x('Post type ID {error}', 'max'), 408 405 static::OPTION . '.post_types.\d+.post_type_id:required' => _x('Post type ID {error}', 'required'), 409 406 static::OPTION . '.post_types.\d+.post_type_id:key' => _x('Post type ID {error}', 'key'), 410 407 static::OPTION . '.taxonomies.\d+.singular:required' => __('Taxonomy singular name {error}'), 408 static::OPTION . '.taxonomies.\d+.plural:required' => __('Taxonomy plural name {error}'), 411 409 static::OPTION . '.taxonomies.\d+.taxonomy_id:max' => _x('Taxonomy ID {error}', 'max'), 412 410 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 21 21 * @param null|string|array $screen 22 22 * @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) 25 26 { 26 27 $this->label = $this->id = $name; 27 $this-> id = Sanitize::underscore( $this->id);28 $this->setId($id ?? $this->id); 28 29 29 30 if ( ! empty( $screen )) { -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/PostType.php
r2402747 r2402883 43 43 * @param string|array|null $plural plural name or settings array override 44 44 * @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 ) 47 48 { 48 49 $singularLower = strtolower( trim($singular) ); 50 $id = $id ?? $singularLower; 49 51 50 52 if(is_array($plural) && is_null($settings)) { 51 53 $settings = $plural; 52 54 $plural = null; 53 } elseif(is_null($settings)) { 55 } 56 57 if(is_null($settings)) { 54 58 $settings = []; 55 59 } 56 60 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); 62 81 63 82 if($this->existing) { 64 83 $this->id = $this->existing->name; 65 $ this->args = (array) $this->existing;84 $args = (array) $this->existing; 66 85 67 86 $singular = Sanitize::underscore( $singular ); … … 74 93 'controller' => null 75 94 ]; 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); 78 97 79 98 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);95 99 } 96 100 … … 105 109 ]; 106 110 107 $this->setId( ! $this->id ? $singular : $this->id);111 $this->setId( $this->id ?: ($id ?? $singular) ); 108 112 109 113 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 11 11 protected $maxIdLength = 10000; 12 12 protected $args = []; 13 protected $blocked = false; 13 14 protected $reservedNames = [ 14 15 'attachment', … … 206 207 $exception = sprintf(__('You can not register a post type or taxonomy using the WordPress reserved name "%s".', 'typerocket-domain'), $this->id); 207 208 Notice::admin(['type' => 'error', 'message' => $exception]); 208 209 $this->blocked = true; 209 210 return true; 210 211 } 211 212 212 213 return false; 214 } 215 216 /** 217 * @return bool 218 */ 219 public function isBlocked() 220 { 221 return $this->blocked; 213 222 } 214 223 … … 244 253 public function addToRegistry() 245 254 { 246 Registry::addRegistrable($this); 255 if(!$this->blocked) { 256 Registry::addRegistrable($this); 257 } 247 258 248 259 return $this; -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php
r2402747 r2402883 29 29 * 30 30 * @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) 35 36 { 36 37 $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) ?? [ 50 79 'singular' => $singular, 51 80 'plural' => $plural, … … 53 82 'controller' => null 54 83 ]; 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 } 63 89 64 90 // setup object for later use … … 73 99 ]; 74 100 75 $this->setId( ! $this->id ? $singular : $this->id);101 $this->setId($this->id ?: ($id ?? $singular)); 76 102 77 103 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 234 234 * @param string $key 235 235 * @param int $time cache forever by default 236 * @param string $folder 236 237 * 237 238 * @return string|null 238 239 */ 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() { 242 243 return $this->toString(); 243 244 }, $time); -
typerocket-ui/tags/5.0.2/typerocket/vendor/typerocket/core/src/Utility/File.php
r2402747 r2402883 58 58 59 59 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 } 64 69 65 70 return $this; -
typerocket-ui/trunk/readme.txt
r2402747 r2402883 5 5 Requires PHP: 7.2.5 6 6 Tested up to: 5.5.1 7 Stable Tag: 5.0. 07 Stable Tag: 5.0.2 8 8 License: GPLv2 or later 9 9 … … 33 33 == Changelog == 34 34 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 = 36 46 37 47 * Custom Post Type, Taxonomies, and Meta Box UI -
typerocket-ui/trunk/typerocket-ui.php
r2402747 r2402883 4 4 Plugin URI: https://typerocket.com/ui/ 5 5 Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes. 6 Version: 5.0. 06 Version: 5.0.2 7 7 Requires PHP: 7.2 8 8 Author: TypeRocket … … 57 57 define('TYPEROCKET_PLUGIN_INSTALL', __DIR__); 58 58 define('TYPEROCKET_CORE_CONFIG_PATH', __DIR__ . '/typerocket/config' ); 59 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin');60 59 define('TYPEROCKET_ROOT_WP', ABSPATH); 61 60 61 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin'); 62 62 define('TYPEROCKET_AUTOLOAD_APP', [ 63 63 'prefix' => TYPEROCKET_APP_NAMESPACE . '\\', -
typerocket-ui/trunk/typerocket/composer.lock
r2402747 r2402883 386 386 "name": "typerocket/core", 387 387 "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": true396 }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": "" 398 398 }, 399 399 "require": { … … 412 412 } 413 413 }, 414 "notification-url": "https:// typerocket.repo.packagist.com/robojuice/downloads/",414 "notification-url": "https://packagist.org/downloads/", 415 415 "license": [ 416 416 "GPL-3.0-or-later" … … 432 432 "support": { 433 433 "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" 438 438 } 439 439 ], -
typerocket-ui/trunk/typerocket/galaxy
r2402747 r2402883 3 3 if( php_sapi_name() !== 'cli' ) 4 4 die("Meant to be run from command line" . PHP_EOL); 5 6 define('TYPEROCKET_APP_NAMESPACE', 'TypeRocketUIPlugin'); 7 define('TYPEROCKET_AUTOLOAD_APP', [ 8 'prefix' => TYPEROCKET_APP_NAMESPACE . '\\', 9 'folder' => __DIR__ . '/app/', 10 ]); 5 11 6 12 define('WPMU_PLUGIN_URL', '/mu-plugins'); -
typerocket-ui/trunk/typerocket/vendor/composer/InstalledVersions.php
r2402747 r2402883 20 20 array ( 21 21 ), 22 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',22 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 23 23 'name' => 'typerocket/typerocket', 24 24 ), … … 85 85 0 => '9999999-dev', 86 86 ), 87 'reference' => ' f6755087ab761752d429d0b4e1ada06450565dc9',87 'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d', 88 88 ), 89 89 'typerocket/typerocket' => … … 94 94 array ( 95 95 ), 96 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',96 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 97 97 ), 98 98 ), -
typerocket-ui/trunk/typerocket/vendor/composer/installed.json
r2402747 r2402883 396 396 "version": "dev-main", 397 397 "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": true406 }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": "" 408 408 }, 409 409 "require": { … … 415 415 "phpunit/phpunit": "7.4.*" 416 416 }, 417 "time": "2020-10- 15T18:59:31+00:00",417 "time": "2020-10-20T01:01:39+00:00", 418 418 "default-branch": true, 419 419 "type": "library", … … 424 424 } 425 425 }, 426 "notification-url": "https:// typerocket.repo.packagist.com/robojuice/downloads/",426 "notification-url": "https://packagist.org/downloads/", 427 427 "license": [ 428 428 "GPL-3.0-or-later" … … 444 444 "support": { 445 445 "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" 448 448 }, 449 449 "install-path": "../typerocket/core" -
typerocket-ui/trunk/typerocket/vendor/composer/installed.php
r2402747 r2402883 7 7 array ( 8 8 ), 9 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',9 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 10 10 'name' => 'typerocket/typerocket', 11 11 ), … … 20 20 0 => '9999999-dev', 21 21 ), 22 'reference' => ' f6755087ab761752d429d0b4e1ada06450565dc9',22 'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d', 23 23 ), 24 24 'typerocket/typerocket' => … … 29 29 array ( 30 30 ), 31 'reference' => ' ef8255ee7c28ae03247307f2094ac40e625c0427',31 'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b', 32 32 ), 33 33 ), -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Controllers/FieldsController.php
r2402747 r2402883 89 89 $results = array_map(function($value) use ($params) { 90 90 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']), 92 92 'id' => $value->ID, 93 93 'url' => get_permalink($value->ID), -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Builder.php
r2402747 r2402883 183 183 public static function componentTemplate($component, $group, $classes = '') 184 184 { 185 $group = $component->form();186 185 ?> 187 186 <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; ?>"> 188 187 <div class="tr-component-inputs tr-builder-inputs"> 189 188 <?php 190 191 189 echo "<h3>{$component->feature('nameable')}</h3>"; 192 190 $component->fields(); -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Elements/Fields/Matrix.php
r2402747 r2402883 445 445 $i = $nested ? 1 : 0; 446 446 $group = $name ?? $group; // This is to help with migration from v4/v1 to v5 447 $name = $group; 447 448 $len = count($builder_data); 448 449 -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php
r2402747 r2402883 82 82 { 83 83 foreach ($taxonomies as $tax) { 84 if( !isset($tax['singular']) || !isset($tax['plural'])) {84 if(empty($tax['singular']) || empty($tax['plural']) || empty($tax['taxonomy_id'])) { 85 85 continue; 86 86 } … … 88 88 $singular = esc_html(trim($tax['singular']) ?: null); 89 89 $plural = esc_html(trim($tax['plural']) ?: null); 90 $request_tax_id = trim($tax['taxonomy_id']) ?: null; 90 91 91 92 if($singular) { 92 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural );93 $t = \TypeRocket\Register\Taxonomy::add($singular, $plural, null, $request_tax_id); 93 94 94 95 if(isset($tax['taxonomy_id']) && trim($tax['taxonomy_id']) ) { … … 152 153 { 153 154 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'])) { 155 156 continue; 156 157 } 157 158 158 159 $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); 167 164 168 165 if(!empty($box['gutenberg'])) { … … 210 207 { 211 208 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'])) { 213 210 continue; 214 211 } … … 216 213 $singular = esc_html(trim($type['singular']) ?: null); 217 214 $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); 225 219 226 220 if(isset($type['slug']) && trim($type['slug'])) { … … 398 392 $validator = Validator::new([ 399 393 static::OPTION . '.post_types.?.singular' => 'required', 394 static::OPTION . '.post_types.?.plural' => 'required', 400 395 static::OPTION . '.post_types.?.post_type_id' => 'max:20|required|key', 401 396 static::OPTION . '.taxonomies.?.singular' => 'required', 397 static::OPTION . '.taxonomies.?.plural' => 'required', 402 398 static::OPTION . '.taxonomies.?.taxonomy_id' => 'max:32|required|key', 403 399 static::OPTION . '.meta_boxes.?.meta_box_title' => 'required', … … 405 401 ], $fields)->setErrorMessages([ 406 402 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'), 407 404 static::OPTION . '.post_types.\d+.post_type_id:max' => _x('Post type ID {error}', 'max'), 408 405 static::OPTION . '.post_types.\d+.post_type_id:required' => _x('Post type ID {error}', 'required'), 409 406 static::OPTION . '.post_types.\d+.post_type_id:key' => _x('Post type ID {error}', 'key'), 410 407 static::OPTION . '.taxonomies.\d+.singular:required' => __('Taxonomy singular name {error}'), 408 static::OPTION . '.taxonomies.\d+.plural:required' => __('Taxonomy plural name {error}'), 411 409 static::OPTION . '.taxonomies.\d+.taxonomy_id:max' => _x('Taxonomy ID {error}', 'max'), 412 410 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 21 21 * @param null|string|array $screen 22 22 * @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) 25 26 { 26 27 $this->label = $this->id = $name; 27 $this-> id = Sanitize::underscore( $this->id);28 $this->setId($id ?? $this->id); 28 29 29 30 if ( ! empty( $screen )) { -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/PostType.php
r2402747 r2402883 43 43 * @param string|array|null $plural plural name or settings array override 44 44 * @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 ) 47 48 { 48 49 $singularLower = strtolower( trim($singular) ); 50 $id = $id ?? $singularLower; 49 51 50 52 if(is_array($plural) && is_null($settings)) { 51 53 $settings = $plural; 52 54 $plural = null; 53 } elseif(is_null($settings)) { 55 } 56 57 if(is_null($settings)) { 54 58 $settings = []; 55 59 } 56 60 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); 62 81 63 82 if($this->existing) { 64 83 $this->id = $this->existing->name; 65 $ this->args = (array) $this->existing;84 $args = (array) $this->existing; 66 85 67 86 $singular = Sanitize::underscore( $singular ); … … 74 93 'controller' => null 75 94 ]; 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); 78 97 79 98 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);95 99 } 96 100 … … 105 109 ]; 106 110 107 $this->setId( ! $this->id ? $singular : $this->id);111 $this->setId( $this->id ?: ($id ?? $singular) ); 108 112 109 113 if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) : -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php
r2402747 r2402883 11 11 protected $maxIdLength = 10000; 12 12 protected $args = []; 13 protected $blocked = false; 13 14 protected $reservedNames = [ 14 15 'attachment', … … 206 207 $exception = sprintf(__('You can not register a post type or taxonomy using the WordPress reserved name "%s".', 'typerocket-domain'), $this->id); 207 208 Notice::admin(['type' => 'error', 'message' => $exception]); 208 209 $this->blocked = true; 209 210 return true; 210 211 } 211 212 212 213 return false; 214 } 215 216 /** 217 * @return bool 218 */ 219 public function isBlocked() 220 { 221 return $this->blocked; 213 222 } 214 223 … … 244 253 public function addToRegistry() 245 254 { 246 Registry::addRegistrable($this); 255 if(!$this->blocked) { 256 Registry::addRegistrable($this); 257 } 247 258 248 259 return $this; -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Taxonomy.php
r2402747 r2402883 29 29 * 30 30 * @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) 35 36 { 36 37 $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) ?? [ 50 79 'singular' => $singular, 51 80 'plural' => $plural, … … 53 82 'controller' => null 54 83 ]; 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 } 63 89 64 90 // setup object for later use … … 73 99 ]; 74 100 75 $this->setId( ! $this->id ? $singular : $this->id);101 $this->setId($this->id ?: ($id ?? $singular)); 76 102 77 103 if (array_key_exists( 'capabilities', $settings ) && $settings['capabilities'] === true) : -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Template/View.php
r2402747 r2402883 234 234 * @param string $key 235 235 * @param int $time cache forever by default 236 * @param string $folder 236 237 * 237 238 * @return string|null 238 239 */ 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() { 242 243 return $this->toString(); 243 244 }, $time); -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Utility/File.php
r2402747 r2402883 58 58 59 59 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 } 64 69 65 70 return $this;
Note: See TracChangeset
for help on using the changeset viewer.