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/clone/wp-conte.../plugins/flow-flo.../libs/cakephp/core
File: App.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 1.2.0
[11] Fix | Delete
* @license https://opensource.org/licenses/mit-license.php MIT License
[12] Fix | Delete
*/
[13] Fix | Delete
namespace Cake\Core;
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* App is responsible for resource location, and path management.
[17] Fix | Delete
*
[18] Fix | Delete
* ### Adding paths
[19] Fix | Delete
*
[20] Fix | Delete
* Additional paths for Templates and Plugins are configured with Configure now. See config/app.php for an
[21] Fix | Delete
* example. The `App.paths.plugins` and `App.paths.templates` variables are used to configure paths for plugins
[22] Fix | Delete
* and templates respectively. All class based resources should be mapped using your application's autoloader.
[23] Fix | Delete
*
[24] Fix | Delete
* ### Inspecting loaded paths
[25] Fix | Delete
*
[26] Fix | Delete
* You can inspect the currently loaded paths using `App::path('Controller')` for example to see loaded
[27] Fix | Delete
* controller paths.
[28] Fix | Delete
*
[29] Fix | Delete
* It is also possible to inspect paths for plugin classes, for instance, to get
[30] Fix | Delete
* the path to a plugin's helpers you would call `App::path('View/Helper', 'MyPlugin')`
[31] Fix | Delete
*
[32] Fix | Delete
* ### Locating plugins
[33] Fix | Delete
*
[34] Fix | Delete
* Plugins can be located with App as well. Using Plugin::path('DebugKit') for example, will
[35] Fix | Delete
* give you the full path to the DebugKit plugin.
[36] Fix | Delete
*
[37] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/app.html
[38] Fix | Delete
*/
[39] Fix | Delete
class App
[40] Fix | Delete
{
[41] Fix | Delete
/**
[42] Fix | Delete
* Return the class name namespaced. This method checks if the class is defined on the
[43] Fix | Delete
* application/plugin, otherwise try to load from the CakePHP core
[44] Fix | Delete
*
[45] Fix | Delete
* @param string $class Class name
[46] Fix | Delete
* @param string $type Type of class
[47] Fix | Delete
* @param string $suffix Class name suffix
[48] Fix | Delete
* @return string|false False if the class is not found or namespaced class name
[49] Fix | Delete
*/
[50] Fix | Delete
public static function className($class, $type = '', $suffix = '')
[51] Fix | Delete
{
[52] Fix | Delete
if (strpos($class, '\\') !== false) {
[53] Fix | Delete
return $class;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
list($plugin, $name) = pluginSplit($class);
[57] Fix | Delete
$base = $plugin ?: Configure::read('App.namespace');
[58] Fix | Delete
$base = str_replace('/', '\\', rtrim($base, '\\'));
[59] Fix | Delete
$fullname = '\\' . str_replace('/', '\\', $type . '\\' . $name) . $suffix;
[60] Fix | Delete
[61] Fix | Delete
if (static::_classExistsInBase($fullname, $base)) {
[62] Fix | Delete
return $base . $fullname;
[63] Fix | Delete
}
[64] Fix | Delete
if ($plugin) {
[65] Fix | Delete
return false;
[66] Fix | Delete
}
[67] Fix | Delete
if (static::_classExistsInBase($fullname, 'Cake')) {
[68] Fix | Delete
return 'Cake' . $fullname;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
return false;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
/**
[75] Fix | Delete
* Returns the plugin split name of a class
[76] Fix | Delete
*
[77] Fix | Delete
* Examples:
[78] Fix | Delete
*
[79] Fix | Delete
* ```
[80] Fix | Delete
* App::shortName(
[81] Fix | Delete
* 'SomeVendor\SomePlugin\Controller\Component\TestComponent',
[82] Fix | Delete
* 'Controller/Component',
[83] Fix | Delete
* 'Component'
[84] Fix | Delete
* )
[85] Fix | Delete
* ```
[86] Fix | Delete
*
[87] Fix | Delete
* Returns: SomeVendor/SomePlugin.Test
[88] Fix | Delete
*
[89] Fix | Delete
* ```
[90] Fix | Delete
* App::shortName(
[91] Fix | Delete
* 'SomeVendor\SomePlugin\Controller\Component\Subfolder\TestComponent',
[92] Fix | Delete
* 'Controller/Component',
[93] Fix | Delete
* 'Component'
[94] Fix | Delete
* )
[95] Fix | Delete
* ```
[96] Fix | Delete
*
[97] Fix | Delete
* Returns: SomeVendor/SomePlugin.Subfolder/Test
[98] Fix | Delete
*
[99] Fix | Delete
* ```
[100] Fix | Delete
* App::shortName(
[101] Fix | Delete
* 'Cake\Controller\Component\AuthComponent',
[102] Fix | Delete
* 'Controller/Component',
[103] Fix | Delete
* 'Component'
[104] Fix | Delete
* )
[105] Fix | Delete
* ```
[106] Fix | Delete
*
[107] Fix | Delete
* Returns: Auth
[108] Fix | Delete
*
[109] Fix | Delete
* @param string $class Class name
[110] Fix | Delete
* @param string $type Type of class
[111] Fix | Delete
* @param string $suffix Class name suffix
[112] Fix | Delete
* @return string Plugin split name of class
[113] Fix | Delete
*/
[114] Fix | Delete
public static function shortName($class, $type, $suffix = '')
[115] Fix | Delete
{
[116] Fix | Delete
$class = str_replace('\\', '/', $class);
[117] Fix | Delete
$type = '/' . $type . '/';
[118] Fix | Delete
[119] Fix | Delete
$pos = strrpos($class, $type);
[120] Fix | Delete
$pluginName = substr($class, 0, $pos);
[121] Fix | Delete
$name = substr($class, $pos + strlen($type));
[122] Fix | Delete
[123] Fix | Delete
if ($suffix) {
[124] Fix | Delete
$name = substr($name, 0, -strlen($suffix));
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
$nonPluginNamespaces = [
[128] Fix | Delete
'Cake',
[129] Fix | Delete
str_replace('\\', '/', Configure::read('App.namespace')),
[130] Fix | Delete
];
[131] Fix | Delete
if (in_array($pluginName, $nonPluginNamespaces)) {
[132] Fix | Delete
return $name;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
return $pluginName . '.' . $name;
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
/**
[139] Fix | Delete
* _classExistsInBase
[140] Fix | Delete
*
[141] Fix | Delete
* Test isolation wrapper
[142] Fix | Delete
*
[143] Fix | Delete
* @param string $name Class name.
[144] Fix | Delete
* @param string $namespace Namespace.
[145] Fix | Delete
* @return bool
[146] Fix | Delete
*/
[147] Fix | Delete
protected static function _classExistsInBase($name, $namespace)
[148] Fix | Delete
{
[149] Fix | Delete
return class_exists($namespace . $name);
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* Used to read information stored path
[154] Fix | Delete
*
[155] Fix | Delete
* Usage:
[156] Fix | Delete
*
[157] Fix | Delete
* ```
[158] Fix | Delete
* App::path('Plugin');
[159] Fix | Delete
* ```
[160] Fix | Delete
*
[161] Fix | Delete
* Will return the configured paths for plugins. This is a simpler way to access
[162] Fix | Delete
* the `App.paths.plugins` configure variable.
[163] Fix | Delete
*
[164] Fix | Delete
* ```
[165] Fix | Delete
* App::path('Model/Datasource', 'MyPlugin');
[166] Fix | Delete
* ```
[167] Fix | Delete
*
[168] Fix | Delete
* Will return the path for datasources under the 'MyPlugin' plugin.
[169] Fix | Delete
*
[170] Fix | Delete
* @param string $type type of path
[171] Fix | Delete
* @param string|null $plugin name of plugin
[172] Fix | Delete
* @return string[]
[173] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/app.html#finding-paths-to-namespaces
[174] Fix | Delete
*/
[175] Fix | Delete
public static function path($type, $plugin = null)
[176] Fix | Delete
{
[177] Fix | Delete
if ($type === 'Plugin') {
[178] Fix | Delete
return (array)Configure::read('App.paths.plugins');
[179] Fix | Delete
}
[180] Fix | Delete
if (empty($plugin) && $type === 'Locale') {
[181] Fix | Delete
return (array)Configure::read('App.paths.locales');
[182] Fix | Delete
}
[183] Fix | Delete
if (empty($plugin) && $type === 'Template') {
[184] Fix | Delete
return (array)Configure::read('App.paths.templates');
[185] Fix | Delete
}
[186] Fix | Delete
if (!empty($plugin)) {
[187] Fix | Delete
return [Plugin::classPath($plugin) . $type . DIRECTORY_SEPARATOR];
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
return [APP . $type . DIRECTORY_SEPARATOR];
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Returns the full path to a package inside the CakePHP core
[195] Fix | Delete
*
[196] Fix | Delete
* Usage:
[197] Fix | Delete
*
[198] Fix | Delete
* ```
[199] Fix | Delete
* App::core('Cache/Engine');
[200] Fix | Delete
* ```
[201] Fix | Delete
*
[202] Fix | Delete
* Will return the full path to the cache engines package.
[203] Fix | Delete
*
[204] Fix | Delete
* @param string $type Package type.
[205] Fix | Delete
* @return string[] Full path to package
[206] Fix | Delete
*/
[207] Fix | Delete
public static function core($type)
[208] Fix | Delete
{
[209] Fix | Delete
return [CAKE . str_replace('/', DIRECTORY_SEPARATOR, $type) . DIRECTORY_SEPARATOR];
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function