Skip to content

Commit

Permalink
Release v4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 1, 2020
1 parent d35ee91 commit edd88b1
Show file tree
Hide file tree
Showing 218 changed files with 1,219 additions and 3,713 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ This repository holds the distributable version of the framework,
including the user guide. It has been built from the
[development repository](https://github.com/codeigniter4/CodeIgniter4).

**This is pre-release code and should not be used in production sites.**

More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.

The user guide corresponding to this version of the framework can be found
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Kint.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Config;

use Kint\Renderer\Renderer;
use CodeIgniter\Config\BaseConfig;
use Kint\Renderer\Renderer;

class Kint extends BaseConfig
{
Expand Down
17 changes: 8 additions & 9 deletions app/Config/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ class Logger extends BaseConfig
*/
public $threshold = 3;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
| By default, logs are written to WRITEPATH . 'logs/'
| Specify a different destination here, if desired.
*/
public $path = '';

/*
|--------------------------------------------------------------------------
| Date Format for Logs
Expand Down Expand Up @@ -116,6 +107,14 @@ class Logger extends BaseConfig
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0644,

/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],

/**
Expand Down
6 changes: 1 addition & 5 deletions app/Config/Mimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,7 @@ public static function guessExtensionFromType(string $type, ?string $proposed_ex

foreach (static::$mimes as $ext => $types)
{
if (is_string($types) && $types === $type)
{
return $ext;
}
else if (is_array($types) && in_array($type, $types))
if ((is_string($types) && $types === $type) || (is_array($types) && in_array($type, $types)))
{
return $ext;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Config;

// Create a new instance of our RouteCollection class.
$routes = Services::routes(true);
$routes = Services::routes();

// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
Expand Down
1 change: 0 additions & 1 deletion app/Config/Services.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace Config;

use CodeIgniter\Config\Services as CoreServices;
use CodeIgniter\Config\BaseConfig;

require_once SYSTEMPATH . 'Config/Services.php';

Expand Down
10 changes: 5 additions & 5 deletions app/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<?php if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var]))
{
continue;
} ?>
} ?>

<h3>$<?= $var ?></h3>

Expand Down Expand Up @@ -235,7 +235,7 @@
<?php if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var]))
{
continue;
} ?>
} ?>

<?php $empty = false; ?>

Expand Down Expand Up @@ -287,15 +287,15 @@
</tr>
</thead>
<tbody>
<?php foreach ($headers as $name => $value) : ?>
<?php foreach ($headers as $value) : ?>
<?php if (empty($value))
{
continue;
} ?>
} ?>
<?php if (! is_array($value))
{
$value = [$value];
} ?>
} ?>
<?php foreach ($value as $h) : ?>
<tr>
<td><?= esc($h->getName(), 'html') ?></td>
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ext-curl": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"kint-php/kint": "^3.3",
"psr/log": "^1.1",
"laminas/laminas-escaper": "^2.6"
Expand Down
94 changes: 0 additions & 94 deletions contributing.md

This file was deleted.

2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../app/Config/Paths.php';
$pathsPath = realpath(FCPATH . '../app/Config/Paths.php');
// ^^^ Change this if you move your application folder

/*
Expand Down
48 changes: 44 additions & 4 deletions system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

namespace CodeIgniter\API;

use Config\Format;
use CodeIgniter\HTTP\Response;
use Config\Format;

/**
* Response trait.
Expand All @@ -56,7 +56,6 @@
*/
trait ResponseTrait
{

/**
* Allows child classes to override the
* status code that is used in their API.
Expand All @@ -66,6 +65,7 @@ trait ResponseTrait
protected $codes = [
'created' => 201,
'deleted' => 200,
'updated' => 200,
'no_content' => 204,
'invalid_request' => 400,
'unsupported_response_type' => 400,
Expand Down Expand Up @@ -93,6 +93,15 @@ trait ResponseTrait
'not_implemented' => 501,
];

/**
* How to format the response data.
* Either 'json' or 'xml'. If blank will be
* determine through content negotiation.
*
* @var string
*/
protected $format = 'json';

//--------------------------------------------------------------------

/**
Expand Down Expand Up @@ -190,6 +199,19 @@ public function respondDeleted($data = null, string $message = '')
return $this->respond($data, $this->codes['deleted'], $message);
}

/**
* Used after a resource has been successfully updated.
*
* @param mixed $data Data.
* @param string $message Message.
*
* @return mixed
*/
public function respondUpdated($data = null, string $message = '')
{
return $this->respond($data, $this->codes['updated'], $message);
}

//--------------------------------------------------------------------

/**
Expand Down Expand Up @@ -364,9 +386,14 @@ protected function format($data = null)
return $data;
}

// Determine correct response type through content negotiation
$config = new Format();
$format = $this->request->negotiate('media', $config->supportedResponseFormats, false);
$format = "application/$this->format";

// Determine correct response type through content negotiation if not explicitly declared
if (empty($this->format) || ! in_array($this->format, ['json', 'xml']))
{
$format = $this->request->negotiate('media', $config->supportedResponseFormats, false);
}

$this->response->setContentType($format);

Expand All @@ -387,4 +414,17 @@ protected function format($data = null)
return $this->formatter->format($data);
}

/**
* Sets the format the response should be in.
*
* @param string $format
*
* @return $this
*/
public function setResponseFormat(string $format = null)
{
$this->format = strtolower($format);

return $this;
}
}
2 changes: 1 addition & 1 deletion system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public function sanitizeFilename(string $filename): string
// be a path.
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278
// Modified to allow backslash and colons for on Windows machines.
$filename = preg_replace('/[^a-zA-Z0-9\s\/\-\_\.\:\\\\]/', '', $filename);
$filename = preg_replace('/[^0-9\p{L}\s\/\-\_\.\:\\\\]/u', '', $filename);

// Clean up our filename edges.
$filename = trim($filename, '.-_');
Expand Down
6 changes: 5 additions & 1 deletion system/Autoloader/FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ public function findQualifiedNameFromPath(string $path)
// Remove the file extension (.php)
$className = mb_substr($className, 0, -4);

return $className;
// Check if this exists
if (class_exists($className))
{
return $className;
}
}
}

Expand Down
Loading

0 comments on commit edd88b1

Please sign in to comment.