Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/flow-flo.../libs/cakephp/core/Configur.../Engine
File: PhpConfig.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
[2] Fix | Delete
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
[3] Fix | Delete
*
[4] Fix | Delete
* Licensed under The MIT License
[5] Fix | Delete
* For full copyright and license information, please see the LICENSE.txt
[6] Fix | Delete
* Redistributions of files must retain the above copyright notice.
[7] Fix | Delete
*
[8] Fix | Delete
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
[9] Fix | Delete
* @link https://cakephp.org CakePHP(tm) Project
[10] Fix | Delete
* @since 2.0.0
[11] Fix | Delete
* @license https://opensource.org/licenses/mit-license.php MIT License
[12] Fix | Delete
*/
[13] Fix | Delete
namespace Cake\Core\Configure\Engine;
[14] Fix | Delete
[15] Fix | Delete
use Cake\Core\Configure\ConfigEngineInterface;
[16] Fix | Delete
use Cake\Core\Configure\FileConfigTrait;
[17] Fix | Delete
use Cake\Core\Exception\Exception;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* PHP engine allows Configure to load configuration values from
[21] Fix | Delete
* files containing simple PHP arrays.
[22] Fix | Delete
*
[23] Fix | Delete
* Files compatible with PhpConfig should return an array that
[24] Fix | Delete
* contains all of the configuration data contained in the file.
[25] Fix | Delete
*
[26] Fix | Delete
* An example configuration file would look like::
[27] Fix | Delete
*
[28] Fix | Delete
* ```
[29] Fix | Delete
* <?php
[30] Fix | Delete
* return [
[31] Fix | Delete
* 'debug' => false,
[32] Fix | Delete
* 'Security' => [
[33] Fix | Delete
* 'salt' => 'its-secret'
[34] Fix | Delete
* ],
[35] Fix | Delete
* 'App' => [
[36] Fix | Delete
* 'namespace' => 'App'
[37] Fix | Delete
* ]
[38] Fix | Delete
* ];
[39] Fix | Delete
* ```
[40] Fix | Delete
*
[41] Fix | Delete
* @see \Cake\Core\Configure::load() for how to load custom configuration files.
[42] Fix | Delete
*/
[43] Fix | Delete
class PhpConfig implements ConfigEngineInterface
[44] Fix | Delete
{
[45] Fix | Delete
use FileConfigTrait;
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* File extension.
[49] Fix | Delete
*
[50] Fix | Delete
* @var string
[51] Fix | Delete
*/
[52] Fix | Delete
protected $_extension = '.php';
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* Constructor for PHP Config file reading.
[56] Fix | Delete
*
[57] Fix | Delete
* @param string|null $path The path to read config files from. Defaults to CONFIG.
[58] Fix | Delete
*/
[59] Fix | Delete
public function __construct($path = null)
[60] Fix | Delete
{
[61] Fix | Delete
if ($path === null) {
[62] Fix | Delete
$path = CONFIG;
[63] Fix | Delete
}
[64] Fix | Delete
$this->_path = $path;
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Read a config file and return its contents.
[69] Fix | Delete
*
[70] Fix | Delete
* Files with `.` in the name will be treated as values in plugins. Instead of
[71] Fix | Delete
* reading from the initialized path, plugin keys will be located using Plugin::path().
[72] Fix | Delete
*
[73] Fix | Delete
* Setting a `$config` variable is deprecated. Use `return` instead.
[74] Fix | Delete
*
[75] Fix | Delete
* @param string $key The identifier to read from. If the key has a . it will be treated
[76] Fix | Delete
* as a plugin prefix.
[77] Fix | Delete
* @return array Parsed configuration values.
[78] Fix | Delete
* @throws \Cake\Core\Exception\Exception when files don't exist or they don't contain `$config`.
[79] Fix | Delete
* Or when files contain '..' as this could lead to abusive reads.
[80] Fix | Delete
*/
[81] Fix | Delete
public function read($key)
[82] Fix | Delete
{
[83] Fix | Delete
$file = $this->_getFilePath($key, true);
[84] Fix | Delete
[85] Fix | Delete
$config = null;
[86] Fix | Delete
[87] Fix | Delete
$return = include $file;
[88] Fix | Delete
if (is_array($return)) {
[89] Fix | Delete
return $return;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
if ($config === null) {
[93] Fix | Delete
throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php'));
[94] Fix | Delete
}
[95] Fix | Delete
deprecationWarning(sprintf(
[96] Fix | Delete
'PHP configuration files like "%s" should not set `$config`. Instead return an array.',
[97] Fix | Delete
$key . '.php'
[98] Fix | Delete
));
[99] Fix | Delete
[100] Fix | Delete
return $config;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Converts the provided $data into a string of PHP code that can
[105] Fix | Delete
* be used saved into a file and loaded later.
[106] Fix | Delete
*
[107] Fix | Delete
* @param string $key The identifier to write to. If the key has a . it will be treated
[108] Fix | Delete
* as a plugin prefix.
[109] Fix | Delete
* @param array $data Data to dump.
[110] Fix | Delete
* @return bool Success
[111] Fix | Delete
*/
[112] Fix | Delete
public function dump($key, array $data)
[113] Fix | Delete
{
[114] Fix | Delete
$contents = '<?php' . "\n" . 'return ' . var_export($data, true) . ';';
[115] Fix | Delete
[116] Fix | Delete
$filename = $this->_getFilePath($key);
[117] Fix | Delete
[118] Fix | Delete
return file_put_contents($filename, $contents) > 0;
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function