/** * Constructor * * @param string $message * @param int $code Status code, defaults to 500 */ public function __construct($message = null, $code = 500) { if (empty($message)) { $message = 'Please copy "' . Plugin::configPath('FrankFoerster/Bitly') . 'bitly.example.php" to "' . CONFIG . 'bitly.php".'; } parent::__construct($message, $code); }
/** * Get file path * * @param string $key The identifier to write to. If the key has a . it will be treated * as a plugin prefix. * @param bool $checkExists Whether to check if file exists. Defaults to false. * @return string Full file path * @throws \Cake\Core\Exception\Exception When files don't exist or when * files contain '..' as this could lead to abusive reads. */ protected function _getFilePath($key, $checkExists = false) { if (strpos($key, '..') !== false) { throw new Exception('Cannot load/dump configuration files with ../ in them.'); } list($plugin, $key) = pluginSplit($key); if ($plugin) { $file = Plugin::configPath($plugin) . $key; } else { $file = $this->_path . $key; } $file .= $this->_extension; if ($checkExists && !is_file($file)) { throw new Exception(sprintf('Could not load configuration file: %s', $file)); } return $file; }
/** * Get file path * * @param string $key The identifier to write to. If the key has a . it will be treated * as a plugin prefix. * @return string Full file path */ protected function _getFilePath($key) { if (substr($key, -8) === '.ini.php') { $key = substr($key, 0, -8); list($plugin, $key) = pluginSplit($key); $key .= '.ini.php'; } else { if (substr($key, -4) === '.ini') { $key = substr($key, 0, -4); } list($plugin, $key) = pluginSplit($key); $key .= '.ini'; } if ($plugin) { $file = Plugin::configPath($plugin) . $key; } else { $file = $this->_path . $key; } return $file; }