芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/fmd/vendor/tedivm/stash/src/Stash/Driver/FileSystem/NativeEncoder.php
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Stash\Driver\FileSystem; use Stash\Utilities; class NativeEncoder implements EncoderInterface { public function deserialize($path) { if (!file_exists($path)) { return false; } $expiration = null; include($path); if (!isset($loaded)) { return false; } if (!isset($data)) { $data = null; } return array('data' => $data, 'expiration' => $expiration); } public function serialize($key, $data, $expiration = null) { $storeString = ' $value) { $dataString = $this->encode($value); $keyString = "'" . str_replace("'", "\\'", $key) . "'"; $storeString .= PHP_EOL; $storeString .= '/* Child Type: ' . gettype($value) . ' */' . PHP_EOL; $storeString .= "\$data[{$keyString}] = {$dataString};" . PHP_EOL; } } else { $dataString = $this->encode($data); $storeString .= '/* Type: ' . gettype($data) . ' */' . PHP_EOL; $storeString .= "\$data = {$dataString};" . PHP_EOL; } return $storeString; } public function getExtension() { return '.php'; } /** * Finds the method of encoding that has the cheapest decode needs and encodes the data with that method. * * @param string $data * @return string */ protected function encode($data) { switch (Utilities::encoding($data)) { case 'bool': $dataString = (bool) $data ? 'true' : 'false'; break; case 'string': $dataString = sprintf('"%s"', addcslashes($data, "\t\"\$\\")); break; case 'numeric': $dataString = (string) $data; break; default: case 'serialize': $dataString = 'unserialize(base64_decode(\'' . base64_encode(serialize($data)) . '\'))'; break; } return $dataString; } }