Skip to content

Commit b6f377f

Browse files
committed
update core and bump version
1 parent 986c0ef commit b6f377f

11 files changed

Lines changed: 199 additions & 38 deletions

File tree

typerocket-v5.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: TypeRocket - Andromeda
44
Plugin URI: https://typerocket.com/
55
Description: TypeRocket is a framework that joins refined UI elements and modern programming architecture together.
6-
Version: 5.1.10
6+
Version: 5.1.11
77
Requires at least: 6.0
88
Requires PHP: 7.4
99
Author: TypeRocket
@@ -34,7 +34,7 @@ public function __construct()
3434
return;
3535
}
3636

37-
define('TYPEROCKET_PLUGIN_VERSION', '5.1.10');
37+
define('TYPEROCKET_PLUGIN_VERSION', '5.1.11');
3838
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
3939

4040
if(!defined('TYPEROCKET_ROOT_WP'))

typerocket/composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typerocket/vendor/composer/autoload_classmap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,8 @@
12731273
'TypeRocket\\Utility\\RuntimeCache' => $vendorDir . '/typerocket/core/src/Utility/RuntimeCache.php',
12741274
'TypeRocket\\Utility\\Sanitize' => $vendorDir . '/typerocket/core/src/Utility/Sanitize.php',
12751275
'TypeRocket\\Utility\\Str' => $vendorDir . '/typerocket/core/src/Utility/Str.php',
1276+
'TypeRocket\\Utility\\Traits\\ArrayAccessible' => $vendorDir . '/typerocket/core/src/Utility/Traits/ArrayAccessible.php',
1277+
'TypeRocket\\Utility\\Traits\\ArrayIterable' => $vendorDir . '/typerocket/core/src/Utility/Traits/ArrayIterable.php',
12761278
'TypeRocket\\Utility\\Url' => $vendorDir . '/typerocket/core/src/Utility/Url.php',
12771279
'TypeRocket\\Utility\\Validator' => $vendorDir . '/typerocket/core/src/Utility/Validator.php',
12781280
'TypeRocket\\Utility\\Validators\\CallbackValidator' => $vendorDir . '/typerocket/core/src/Utility/Validators/CallbackValidator.php',

typerocket/vendor/composer/autoload_static.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,8 @@ class ComposerStaticInit1ea299e54fdefaef41f855b3138bc6c1
13811381
'TypeRocket\\Utility\\RuntimeCache' => __DIR__ . '/..' . '/typerocket/core/src/Utility/RuntimeCache.php',
13821382
'TypeRocket\\Utility\\Sanitize' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Sanitize.php',
13831383
'TypeRocket\\Utility\\Str' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Str.php',
1384+
'TypeRocket\\Utility\\Traits\\ArrayAccessible' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Traits/ArrayAccessible.php',
1385+
'TypeRocket\\Utility\\Traits\\ArrayIterable' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Traits/ArrayIterable.php',
13841386
'TypeRocket\\Utility\\Url' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Url.php',
13851387
'TypeRocket\\Utility\\Validator' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Validator.php',
13861388
'TypeRocket\\Utility\\Validators\\CallbackValidator' => __DIR__ . '/..' . '/typerocket/core/src/Utility/Validators/CallbackValidator.php',

typerocket/vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,17 +2720,17 @@
27202720
},
27212721
{
27222722
"name": "typerocket/core",
2723-
"version": "v5.1.27",
2724-
"version_normalized": "5.1.27.0",
2723+
"version": "v5.1.30",
2724+
"version_normalized": "5.1.30.0",
27252725
"source": {
27262726
"type": "git",
27272727
"url": "https://github.com/TypeRocket/core.git",
2728-
"reference": "2f75aa26f47d9e9f68fbceb6d7de035e27b5f4ce"
2728+
"reference": "3e1e2f85d459927a7224e681d012ec6eb973dec8"
27292729
},
27302730
"dist": {
27312731
"type": "zip",
2732-
"url": "https://api.github.com/repos/TypeRocket/core/zipball/2f75aa26f47d9e9f68fbceb6d7de035e27b5f4ce",
2733-
"reference": "2f75aa26f47d9e9f68fbceb6d7de035e27b5f4ce",
2732+
"url": "https://api.github.com/repos/TypeRocket/core/zipball/3e1e2f85d459927a7224e681d012ec6eb973dec8",
2733+
"reference": "3e1e2f85d459927a7224e681d012ec6eb973dec8",
27342734
"shasum": ""
27352735
},
27362736
"require": {
@@ -2744,7 +2744,7 @@
27442744
"require-dev": {
27452745
"phpunit/phpunit": "^9.5"
27462746
},
2747-
"time": "2022-08-31T00:33:07+00:00",
2747+
"time": "2022-09-02T14:58:01+00:00",
27482748
"type": "library",
27492749
"installation-source": "dist",
27502750
"autoload": {
@@ -2773,7 +2773,7 @@
27732773
"support": {
27742774
"docs": "https://typerocket.com/docs/v5/",
27752775
"issues": "https://github.com/TypeRocket/core/issues",
2776-
"source": "https://github.com/TypeRocket/core/tree/v5.1.27"
2776+
"source": "https://github.com/TypeRocket/core/tree/v5.1.30"
27772777
},
27782778
"install-path": "../typerocket/core"
27792779
},

typerocket/vendor/composer/installed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'typerocket/typerocket',
44
'pretty_version' => 'dev-main',
55
'version' => 'dev-main',
6-
'reference' => '4cb2cd1aa220a2408f8a65fce1879de29f42cf3d',
6+
'reference' => '16d7b32849959ed21b03dd89cd2b89093f607555',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -368,9 +368,9 @@
368368
'dev_requirement' => true,
369369
),
370370
'typerocket/core' => array(
371-
'pretty_version' => 'v5.1.27',
372-
'version' => '5.1.27.0',
373-
'reference' => '2f75aa26f47d9e9f68fbceb6d7de035e27b5f4ce',
371+
'pretty_version' => 'v5.1.30',
372+
'version' => '5.1.30.0',
373+
'reference' => '3e1e2f85d459927a7224e681d012ec6eb973dec8',
374374
'type' => 'library',
375375
'install_path' => __DIR__ . '/../typerocket/core',
376376
'aliases' => array(),
@@ -379,7 +379,7 @@
379379
'typerocket/typerocket' => array(
380380
'pretty_version' => 'dev-main',
381381
'version' => 'dev-main',
382-
'reference' => '4cb2cd1aa220a2408f8a65fce1879de29f42cf3d',
382+
'reference' => '16d7b32849959ed21b03dd89cd2b89093f607555',
383383
'type' => 'library',
384384
'install_path' => __DIR__ . '/../../',
385385
'aliases' => array(),

typerocket/vendor/typerocket/core/src/Template/View.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,15 @@ public function getComposedEngine()
204204
*/
205205
protected function load($context = null)
206206
{
207-
$view_title = $this->getTitle();
208207
$this->setContext($context);
208+
$view_title = apply_filters('typerocket_view_document_title', $this->getTitle(), $this);
209+
210+
if($view_title)
211+
{
212+
add_filter('pre_get_document_title', function( $title ) use ($view_title) {
213+
return $title === '' ? '' : $view_title;
214+
}, 101);
209215

210-
if($view_title) {
211216
add_filter('document_title_parts', function( $title ) use ($view_title) {
212217
if( is_string($view_title) ) {
213218
$title = [];

typerocket/vendor/typerocket/core/src/Utility/Arr.php

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static function pluck(array $array, $columns, ?string $index = null) : ar
102102
*/
103103
public static function mapDeep(callable $callback, $value)
104104
{
105-
return map_deep($value, $callback);
105+
return Data::mapDeep($callback, $value);
106106
}
107107

108108
/**
@@ -257,15 +257,26 @@ public static function get($array, $needle, $default = null)
257257
*/
258258
public static function has($array, $needle)
259259
{
260-
$search = is_array($needle) ? $needle : explode('.', $needle);
260+
$needles = (array) $needle;
261+
$main = $array;
261262

262-
foreach ($search as $index) {
263-
if(is_array($array) && array_key_exists($index, $array)) {
264-
$array = $array[$index];
265-
}
266-
else {
267-
return false;
263+
foreach ($needles as $n) {
264+
265+
$search = is_array($n) ? $n : explode('.', $n);
266+
267+
foreach ($search as $index) {
268+
if(is_array($array) && array_key_exists($index, $array)) {
269+
$array = $array[$index];
270+
}
271+
elseif($array instanceof \ArrayAccess && $array->offsetExists($index)) {
272+
$array = $array[$index];
273+
}
274+
else {
275+
return false;
276+
}
268277
}
278+
279+
$array = $main;
269280
}
270281

271282
return true;
@@ -431,4 +442,61 @@ public static function keysExist(array $keys, array $array)
431442
{
432443
return !array_diff_key(array_flip($keys), $array);
433444
}
445+
446+
/**
447+
* Exists
448+
*
449+
* @param \ArrayAccess|array $array
450+
* @param string|int $key
451+
* @return bool
452+
*/
453+
public static function exists($array, $key) : bool
454+
{
455+
if (is_float($key)) {
456+
$key = (string) $key;
457+
}
458+
459+
if($array instanceof \ArrayAccess) {
460+
return $array->offsetExists($key);
461+
}
462+
463+
return array_key_exists($key, $array);
464+
}
465+
466+
/**
467+
* First Item
468+
*
469+
* @param array|\ArrayObject $array
470+
* @return mixed|null
471+
*/
472+
public static function first($array, $callback = null, $default = null)
473+
{
474+
if(is_callable($callback))
475+
{
476+
foreach ($array as $key => $value) {
477+
if($callback($value, $key) === true) {
478+
return $value;
479+
}
480+
}
481+
}
482+
else
483+
{
484+
foreach ($array as $item) {
485+
return $item;
486+
}
487+
}
488+
489+
return $default;
490+
}
491+
492+
/**
493+
* Last Item
494+
*
495+
* @param array|\ArrayObject $array
496+
* @return mixed|null
497+
*/
498+
public static function last($array, $callback = null, $default = null)
499+
{
500+
return static::first(array_reverse((array) $array, true), $callback, $default);
501+
}
434502
}

typerocket/vendor/typerocket/core/src/Utility/Data.php

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,66 @@
11
<?php
22
namespace TypeRocket\Utility;
33

4+
use TypeRocket\Core\Resolver;
5+
46
class Data
57
{
68
/**
79
* Nil
810
*
9-
* @param array|object $data
11+
* @param array|object $value
1012
* @return Nil
1113
*/
12-
public static function nil($data)
14+
public static function nil($value)
15+
{
16+
if($value instanceof Nil) {
17+
return new Nil($value->get());
18+
}
19+
20+
return new Nil($value);
21+
}
22+
23+
/**
24+
* Map Deep
25+
*
26+
* Maps a function to all non-iterable elements of an array or an object. This
27+
* is similar to `array_walk_recursive()` but acts upon objects too.
28+
*
29+
* @param callable $callback The function to map onto $value.
30+
* @param mixed $value The array, object, or scalar.
31+
*
32+
* @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
33+
*/
34+
public static function mapDeep(callable $callback, $value)
35+
{
36+
return map_deep($value, $callback);
37+
}
38+
39+
/**
40+
* Map
41+
*
42+
* Maps a function to a value. When an array or object is
43+
* given it iterates over the indexes or properties.
44+
*
45+
* @param callable $callback The function to map onto $value.
46+
* @param mixed $value The array, object, or scalar.
47+
*
48+
* @return mixed The value with the callback applied.
49+
*/
50+
public static function map(callable $callback, $value)
1351
{
14-
return new Nil($data);
52+
if ( is_array( $value ) ) {
53+
$value = array_map( $callback, $value );
54+
} elseif ( is_object( $value ) ) {
55+
$object_vars = get_object_vars( $value );
56+
foreach ( $object_vars as $property_name => $property_value ) {
57+
$value->$property_name = call_user_func( $callback, $property_value );
58+
}
59+
} else {
60+
$value = call_user_func( $callback, $value );
61+
}
62+
63+
return $value;
1564
}
1665

1766
/**

typerocket/vendor/typerocket/core/src/Utility/File.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,13 @@ public function readFirstLine()
235235
return null;
236236
}
237237

238-
return $line = fgets(fopen($this->file, 'r'));
238+
if($fp = fopen($this->file, 'r')) {
239+
$line = fgets($fp);
240+
fclose($fp);
241+
return $line;
242+
}
243+
244+
return '';
239245
}
240246

241247
/**
@@ -366,18 +372,31 @@ public function getReplacmentTemplateContent($tags = [], $replacements = [])
366372
public function download( $url )
367373
{
368374
if( ! $this->existing ) {
369-
return file_put_contents( $this->file , fopen( $url , 'r') );
375+
376+
if($fp = fopen( $url , 'r')) {
377+
$content = file_put_contents( $this->file , $fp);
378+
fclose($fp);
379+
380+
return $content;
381+
}
370382
}
371383

372384
return false;
373385
}
374386

375387
/**
376-
* @return mixed
388+
* @return string|false
377389
*/
378390
public function mimeType()
379391
{
380-
return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file);
392+
if($fi = finfo_open(FILEINFO_MIME_TYPE)) {
393+
$info = finfo_file($fi, $this->file);
394+
finfo_close($fi);
395+
396+
return $info;
397+
}
398+
399+
return false;
381400
}
382401

383402
/**

0 commit comments

Comments
 (0)