Edit File by line
/home/barbar84/public_h.../wp-inclu.../SimplePi...
File: Cache.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* SimplePie
[2] Fix | Delete
*
[3] Fix | Delete
* A PHP-Based RSS and Atom Feed Framework.
[4] Fix | Delete
* Takes the hard work out of managing a complete RSS/Atom solution.
[5] Fix | Delete
*
[6] Fix | Delete
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
[7] Fix | Delete
* All rights reserved.
[8] Fix | Delete
*
[9] Fix | Delete
* Redistribution and use in source and binary forms, with or without modification, are
[10] Fix | Delete
* permitted provided that the following conditions are met:
[11] Fix | Delete
*
[12] Fix | Delete
* * Redistributions of source code must retain the above copyright notice, this list of
[13] Fix | Delete
* conditions and the following disclaimer.
[14] Fix | Delete
*
[15] Fix | Delete
* * Redistributions in binary form must reproduce the above copyright notice, this list
[16] Fix | Delete
* of conditions and the following disclaimer in the documentation and/or other materials
[17] Fix | Delete
* provided with the distribution.
[18] Fix | Delete
*
[19] Fix | Delete
* * Neither the name of the SimplePie Team nor the names of its contributors may be used
[20] Fix | Delete
* to endorse or promote products derived from this software without specific prior
[21] Fix | Delete
* written permission.
[22] Fix | Delete
*
[23] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
[24] Fix | Delete
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
[25] Fix | Delete
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
[26] Fix | Delete
* AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
[27] Fix | Delete
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
[28] Fix | Delete
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[29] Fix | Delete
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
[30] Fix | Delete
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
[31] Fix | Delete
* POSSIBILITY OF SUCH DAMAGE.
[32] Fix | Delete
*
[33] Fix | Delete
* @package SimplePie
[34] Fix | Delete
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
[35] Fix | Delete
* @author Ryan Parman
[36] Fix | Delete
* @author Sam Sneddon
[37] Fix | Delete
* @author Ryan McCue
[38] Fix | Delete
* @link http://simplepie.org/ SimplePie
[39] Fix | Delete
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
[40] Fix | Delete
*/
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Used to create cache objects
[44] Fix | Delete
*
[45] Fix | Delete
* This class can be overloaded with {@see SimplePie::set_cache_class()},
[46] Fix | Delete
* although the preferred way is to create your own handler
[47] Fix | Delete
* via {@see register()}
[48] Fix | Delete
*
[49] Fix | Delete
* @package SimplePie
[50] Fix | Delete
* @subpackage Caching
[51] Fix | Delete
*/
[52] Fix | Delete
class SimplePie_Cache
[53] Fix | Delete
{
[54] Fix | Delete
/**
[55] Fix | Delete
* Cache handler classes
[56] Fix | Delete
*
[57] Fix | Delete
* These receive 3 parameters to their constructor, as documented in
[58] Fix | Delete
* {@see register()}
[59] Fix | Delete
* @var array
[60] Fix | Delete
*/
[61] Fix | Delete
protected static $handlers = array(
[62] Fix | Delete
'mysql' => 'SimplePie_Cache_MySQL',
[63] Fix | Delete
'memcache' => 'SimplePie_Cache_Memcache',
[64] Fix | Delete
'memcached' => 'SimplePie_Cache_Memcached',
[65] Fix | Delete
'redis' => 'SimplePie_Cache_Redis'
[66] Fix | Delete
);
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Don't call the constructor. Please.
[70] Fix | Delete
*/
[71] Fix | Delete
private function __construct() { }
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Create a new SimplePie_Cache object
[75] Fix | Delete
*
[76] Fix | Delete
* @param string $location URL location (scheme is used to determine handler)
[77] Fix | Delete
* @param string $filename Unique identifier for cache object
[78] Fix | Delete
* @param string $extension 'spi' or 'spc'
[79] Fix | Delete
* @return SimplePie_Cache_Base Type of object depends on scheme of `$location`
[80] Fix | Delete
*/
[81] Fix | Delete
public static function get_handler($location, $filename, $extension)
[82] Fix | Delete
{
[83] Fix | Delete
$type = explode(':', $location, 2);
[84] Fix | Delete
$type = $type[0];
[85] Fix | Delete
if (!empty(self::$handlers[$type]))
[86] Fix | Delete
{
[87] Fix | Delete
$class = self::$handlers[$type];
[88] Fix | Delete
return new $class($location, $filename, $extension);
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
return new SimplePie_Cache_File($location, $filename, $extension);
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* Create a new SimplePie_Cache object
[96] Fix | Delete
*
[97] Fix | Delete
* @deprecated Use {@see get_handler} instead
[98] Fix | Delete
*/
[99] Fix | Delete
public function create($location, $filename, $extension)
[100] Fix | Delete
{
[101] Fix | Delete
trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED);
[102] Fix | Delete
return self::get_handler($location, $filename, $extension);
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Register a handler
[107] Fix | Delete
*
[108] Fix | Delete
* @param string $type DSN type to register for
[109] Fix | Delete
* @param string $class Name of handler class. Must implement SimplePie_Cache_Base
[110] Fix | Delete
*/
[111] Fix | Delete
public static function register($type, $class)
[112] Fix | Delete
{
[113] Fix | Delete
self::$handlers[$type] = $class;
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Parse a URL into an array
[118] Fix | Delete
*
[119] Fix | Delete
* @param string $url
[120] Fix | Delete
* @return array
[121] Fix | Delete
*/
[122] Fix | Delete
public static function parse_URL($url)
[123] Fix | Delete
{
[124] Fix | Delete
$params = parse_url($url);
[125] Fix | Delete
$params['extras'] = array();
[126] Fix | Delete
if (isset($params['query']))
[127] Fix | Delete
{
[128] Fix | Delete
parse_str($params['query'], $params['extras']);
[129] Fix | Delete
}
[130] Fix | Delete
return $params;
[131] Fix | Delete
}
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function