Skip to content

Commit

Permalink
update typerocket core and bump version 5.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindees committed Sep 3, 2022
1 parent 8af26d7 commit 5cf5784
Show file tree
Hide file tree
Showing 15 changed files with 318 additions and 47 deletions.
4 changes: 2 additions & 2 deletions typerocket-v5.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: TypeRocket - Andromeda
Plugin URI: https://typerocket.com/
Description: TypeRocket is a framework that joins refined UI elements and modern programming architecture together.
Version: 5.1.11
Version: 5.1.12
Requires at least: 6.0
Requires PHP: 7.4
Author: TypeRocket
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct()
return;
}

define('TYPEROCKET_PLUGIN_VERSION', '5.1.11');
define('TYPEROCKET_PLUGIN_VERSION', '5.1.12');
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);

if(!defined('TYPEROCKET_ROOT_WP'))
Expand Down
12 changes: 6 additions & 6 deletions typerocket/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions typerocket/vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@
'TypeRocket\\Database\\ResultsPostMeta' => $vendorDir . '/typerocket/core/src/Database/ResultsPostMeta.php',
'TypeRocket\\Database\\ResultsTermMeta' => $vendorDir . '/typerocket/core/src/Database/ResultsTermMeta.php',
'TypeRocket\\Database\\ResultsUserMeta' => $vendorDir . '/typerocket/core/src/Database/ResultsUserMeta.php',
'TypeRocket\\Database\\SqlRaw' => $vendorDir . '/typerocket/core/src/Database/SqlRaw.php',
'TypeRocket\\Database\\SqlRunner' => $vendorDir . '/typerocket/core/src/Database/SqlRunner.php',
'TypeRocket\\Elements\\BaseFields' => $vendorDir . '/typerocket/core/src/Elements/BaseFields.php',
'TypeRocket\\Elements\\BaseForm' => $vendorDir . '/typerocket/core/src/Elements/BaseForm.php',
Expand Down
1 change: 1 addition & 0 deletions typerocket/vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ class ComposerStaticInit1ea299e54fdefaef41f855b3138bc6c1
'TypeRocket\\Database\\ResultsPostMeta' => __DIR__ . '/..' . '/typerocket/core/src/Database/ResultsPostMeta.php',
'TypeRocket\\Database\\ResultsTermMeta' => __DIR__ . '/..' . '/typerocket/core/src/Database/ResultsTermMeta.php',
'TypeRocket\\Database\\ResultsUserMeta' => __DIR__ . '/..' . '/typerocket/core/src/Database/ResultsUserMeta.php',
'TypeRocket\\Database\\SqlRaw' => __DIR__ . '/..' . '/typerocket/core/src/Database/SqlRaw.php',
'TypeRocket\\Database\\SqlRunner' => __DIR__ . '/..' . '/typerocket/core/src/Database/SqlRunner.php',
'TypeRocket\\Elements\\BaseFields' => __DIR__ . '/..' . '/typerocket/core/src/Elements/BaseFields.php',
'TypeRocket\\Elements\\BaseForm' => __DIR__ . '/..' . '/typerocket/core/src/Elements/BaseForm.php',
Expand Down
14 changes: 7 additions & 7 deletions typerocket/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2720,17 +2720,17 @@
},
{
"name": "typerocket/core",
"version": "v5.1.30",
"version_normalized": "5.1.30.0",
"version": "v5.1.36",
"version_normalized": "5.1.36.0",
"source": {
"type": "git",
"url": "https://github.com/TypeRocket/core.git",
"reference": "3e1e2f85d459927a7224e681d012ec6eb973dec8"
"reference": "c589a9710285ada75dabcd5f123ae45935583697"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TypeRocket/core/zipball/3e1e2f85d459927a7224e681d012ec6eb973dec8",
"reference": "3e1e2f85d459927a7224e681d012ec6eb973dec8",
"url": "https://api.github.com/repos/TypeRocket/core/zipball/c589a9710285ada75dabcd5f123ae45935583697",
"reference": "c589a9710285ada75dabcd5f123ae45935583697",
"shasum": ""
},
"require": {
Expand All @@ -2744,7 +2744,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"time": "2022-09-02T14:58:01+00:00",
"time": "2022-09-03T00:23:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -2773,7 +2773,7 @@
"support": {
"docs": "https://typerocket.com/docs/v5/",
"issues": "https://github.com/TypeRocket/core/issues",
"source": "https://github.com/TypeRocket/core/tree/v5.1.30"
"source": "https://github.com/TypeRocket/core/tree/v5.1.36"
},
"install-path": "../typerocket/core"
},
Expand Down
10 changes: 5 additions & 5 deletions typerocket/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'typerocket/typerocket',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '16d7b32849959ed21b03dd89cd2b89093f607555',
'reference' => '8af26d78efedd20566140445c9d388c3834a0913',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -368,9 +368,9 @@
'dev_requirement' => true,
),
'typerocket/core' => array(
'pretty_version' => 'v5.1.30',
'version' => '5.1.30.0',
'reference' => '3e1e2f85d459927a7224e681d012ec6eb973dec8',
'pretty_version' => 'v5.1.36',
'version' => '5.1.36.0',
'reference' => 'c589a9710285ada75dabcd5f123ae45935583697',
'type' => 'library',
'install_path' => __DIR__ . '/../typerocket/core',
'aliases' => array(),
Expand All @@ -379,7 +379,7 @@
'typerocket/typerocket' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '16d7b32849959ed21b03dd89cd2b89093f607555',
'reference' => '8af26d78efedd20566140445c9d388c3834a0913',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down
4 changes: 4 additions & 0 deletions typerocket/vendor/typerocket/core/src/Database/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ protected function compileTable()
*/
protected function tickSqlName($column)
{
if($column instanceof SqlRaw) {
return $column;
}

$c = preg_replace($this->columnPattern, '', $column);

if(!Str::contains('`', $column)) {
Expand Down
38 changes: 38 additions & 0 deletions typerocket/vendor/typerocket/core/src/Database/SqlRaw.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace TypeRocket\Database;

class SqlRaw
{
protected string $sql = '';

/**
* SQL Raw constructor.
*
* @param string $sql
*/
public function __construct(string $sql)
{
$this->sql = $sql;
}

/**
* To String
*
* @return string|null
*/
public function __toString()
{
return $this->sql;
}

/**
* @param mixed ...$args
*
* @return static
*/
public static function new(...$args)
{
return new static(...$args);
}
}
48 changes: 48 additions & 0 deletions typerocket/vendor/typerocket/core/src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,54 @@ public function count($column = null)
return $this->query->count($column);
}

/**
* Sum
*
* @param string $column
*
* @return array|bool|false|int|null|object
*/
public function sum( $column )
{
return $this->query->sum($column);
}

/**
* Min
*
* @param string $column
*
* @return array|bool|false|int|null|object
*/
public function min( $column )
{
return $this->query->min($column);
}

/**
* Max
*
* @param string $column
*
* @return array|bool|false|int|null|object
*/
public function max( $column )
{
return $this->query->max($column);
}

/**
* Average
*
* @param string $column
*
* @return array|bool|false|int|null|object
*/
public function avg( $column )
{
return $this->query->avg($column);
}

/**
* Select only specific columns
*
Expand Down
10 changes: 10 additions & 0 deletions typerocket/vendor/typerocket/core/src/Models/WPUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ public function posts( $modelClass = WPPost::class )
return $this->hasMany( $modelClass, 'post_author');
}

/**
* @param $capability
*
* @return Model|WPUser
*/
public function whereCapabilityLike($capability)
{
return $this->whereMeta( 'wp_capabilities', 'like', '%:"'.$capability.'";%' );
}

/**
* Find WP_User Instance
*
Expand Down
57 changes: 56 additions & 1 deletion typerocket/vendor/typerocket/core/src/Utility/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@

class Data
{
/**
* Return the default value of the given value.
*
* @param mixed $value
* @param null|array $args
*
* @return mixed
* @throws \ReflectionException
*/
public static function value($value, ?array $args = null)
{
return $value instanceof \Closure ? (new Resolver)->resolveCallable($value, $args) : $value;
}

/**
* Nil
*
Expand Down Expand Up @@ -110,7 +124,7 @@ public static function emptyOrBlankRecursive($value) : bool
/**
* Dots Walk
*
* Traverse array with dot notation.
* Traverse array with dot notation with wilds (*).
*
* @param string|array $dots dot notation key.next.final
* @param array|object $array an array to traverse
Expand Down Expand Up @@ -140,6 +154,47 @@ public static function walk($dots, $array, $default = null)
return $array;
}

/**
* Get
*
* Get value using dot notation without wilds (*).
*
* @param object|array $data an array to traverse
* @param string|array $dots dot notation key.next.final or array of dots
* @param mixed|null $default
*
* @return mixed
*/
public static function get($data, $dots, $default = null)
{
$dots = (array) $dots;
$index = count($dots) > 1;
$return = null;

foreach ($dots as $dot) {
$traverse = explode('.', $dot);
$search = $data;

foreach ($traverse as $step) {
$v = is_object($search) ? ($search->$step ?? null) : ($search[$step] ?? null);

if ( !isset($v) && ! is_string($search) ) {
$search = $default;
break;
}
$search = $v ?? $default;
}

if($index) {
$return[$dot] = $search;
} else {
$return = $search;
}
}

return $return;
}

/**
* Index Data by Unique Value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function new($folder = 'app')
public function get($key, $default = null)
{
try {
return $this->getData($this->getFile($key)) ?? Value::get($default);
return $this->getData($this->getFile($key)) ?? Data::value($default);
} catch (\Exception $e) {
return null;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public function getOtherwisePut($key, $default, $time = 9999999999)

if(!$data) {
try {
$data = Value::get($default);
$data = Data::value($default);
$this->put($key, $data, $time);
} catch (\ReflectionException $e) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getOtherwisePut($key, $default = null, $namespace = null)
return $value;
}

return $this->add($key, Value::get($default), $namespace);
return $this->add($key, Data::value($default), $namespace);
}

/**
Expand Down
Loading

0 comments on commit 5cf5784

Please sign in to comment.