mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 17:56:22 +02:00
Some code cleanup
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
1. [](#improved)
|
||||
* Improved error detection for broken Flex Objects
|
||||
* Removed apc and xcache support, made apc alias of apcu
|
||||
1. [](#bugfix)
|
||||
* Fixed non-namespaced exceptions in scheduler
|
||||
|
||||
# v1.6.0-rc.1
|
||||
@@ -15,11 +16,10 @@
|
||||
* Improved `$page->forms()` call, added `$page->addForms()`
|
||||
* Made `FormFlashFile` more robust against deleted files
|
||||
* Updated languages from crowdin
|
||||
1. [](#bugfix)
|
||||
* Fixed a bug in `FormFlashFile::moveTo()` not deleting the old file
|
||||
* Fixed `FlexMediaTrait::getMedia()` trying to include uploaded but already moved media
|
||||
* Fixed `ImageMedium` constructor warning when file does not exist
|
||||
* Fixed bad host header in PSR-7 (if using 'php -S localhost:8000 system/router.php')
|
||||
* Fixed bad host header in PSR-7 (if using `php -S localhost:8000 system/router.php`)
|
||||
|
||||
# v1.6.0-beta.8
|
||||
## 01/25/2019
|
||||
|
||||
@@ -50,17 +50,8 @@ class Errors
|
||||
break;
|
||||
}
|
||||
|
||||
if (method_exists('Whoops\Util\Misc', 'isAjaxRequest')) { //Whoops 2.0
|
||||
if (Whoops\Util\Misc::isAjaxRequest() || $jsonRequest) {
|
||||
$whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
|
||||
}
|
||||
} elseif (function_exists('Whoops\isAjaxRequest')) { //Whoops 2.0.0-alpha
|
||||
if (Whoops\isAjaxRequest() || $jsonRequest) {
|
||||
$whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
|
||||
}
|
||||
} else { //Whoops 1.x
|
||||
$json_page = new Whoops\Handler\JsonResponseHandler;
|
||||
$json_page->onlyForAjaxRequests(true);
|
||||
if (Whoops\Util\Misc::isAjaxRequest() || $jsonRequest) {
|
||||
$whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
|
||||
}
|
||||
|
||||
if (isset($config['log']) && $config['log']) {
|
||||
|
||||
@@ -15,13 +15,7 @@ abstract class AbstractCollection extends Iterator
|
||||
{
|
||||
public function toJson()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
foreach ($this->items as $name => $package) {
|
||||
$items[$name] = $package->toArray();
|
||||
}
|
||||
|
||||
return json_encode($items);
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
|
||||
@@ -212,13 +212,10 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn
|
||||
public function safeEmailFilter($str)
|
||||
{
|
||||
$email = '';
|
||||
for ( $i = 0, $len = strlen( $str ); $i < $len; $i++ ) {
|
||||
$j = mt_rand( 0, 1);
|
||||
if ( $j === 0 ) {
|
||||
$email .= '&#' . ord( $str[$i] ) . ';';
|
||||
} elseif ( $j === 1 ) {
|
||||
$email .= $str[$i];
|
||||
}
|
||||
for ($i = 0, $len = strlen($str); $i < $len; $i++) {
|
||||
$j = random_int(0, 1);
|
||||
|
||||
$email .= $j === 0 ? '&#' . ord($str[$i]) . ';' : $str[$i];
|
||||
}
|
||||
|
||||
return str_replace('@', '@', $email);
|
||||
@@ -498,7 +495,7 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn
|
||||
$now = time();
|
||||
|
||||
// check if unix timestamp
|
||||
if ((string)(int)$date == $date) {
|
||||
if ((string)(int)$date === (string)$date) {
|
||||
$unix_date = $date;
|
||||
} else {
|
||||
$unix_date = strtotime($date);
|
||||
|
||||
@@ -150,20 +150,20 @@ class DirectInstallCommand extends ConsoleCommand
|
||||
$blueprint = GPM::getBlueprints($extracted);
|
||||
if ($blueprint) {
|
||||
if (isset($blueprint['dependencies'])) {
|
||||
$depencencies = [];
|
||||
$dependencies = [];
|
||||
foreach ($blueprint['dependencies'] as $dependency) {
|
||||
if (is_array($dependency)){
|
||||
if (isset($dependency['name'])) {
|
||||
$depencencies[] = $dependency['name'];
|
||||
$dependencies[] = $dependency['name'];
|
||||
}
|
||||
if (isset($dependency['github'])) {
|
||||
$depencencies[] = $dependency['github'];
|
||||
$dependencies[] = $dependency['github'];
|
||||
}
|
||||
} else {
|
||||
$depencencies[] = $dependency;
|
||||
$dependencies[] = $dependency;
|
||||
}
|
||||
}
|
||||
$this->output->writeln(' |- Dependencies found... <cyan>[' . implode(',', $depencencies) . ']</cyan>');
|
||||
$this->output->writeln(' |- Dependencies found... <cyan>[' . implode(',', $dependencies) . ']</cyan>');
|
||||
|
||||
$question = new ConfirmationQuestion(" | '- Dependencies will not be satisfied. Continue ? [y|N] ", false);
|
||||
$answer = $this->all_yes ? true : $helper->ask($this->input, $this->output, $question);
|
||||
|
||||
Reference in New Issue
Block a user