'SimplePie_Cache_MySQL'); /** * Don't call the constructor. Please. */ private function __construct() { } /** * Create a new SimplePie_Cache object */ public static function create($location, $filename, $extension) { $type = explode(':', $location, 2); $type = $type[0]; if (!empty(self::$handlers[$type])) { $class = self::$handlers[$type]; return new $class($location, $filename, $extension); } return new SimplePie_Cache_File($location, $filename, $extension); } /** * Register a handler * * @param string $type DSN type to register for * @param string $class Name of handler class. Must implement SimplePie_Cache_Base */ public static function register($type, $class) { self::$handlers[$type] = $class; } /** * Parse a DSN into an array * * @param string $dsn * @return array */ public static function parse_DSN($dsn) { $params = array(); list($params['type'], $options) = explode(':', $dsn, 2); $options = explode(';', $options); // We need a for loop, so that we can splice for ($i = 0; $i < count($options); $i++) { $option = $options[$i]; // If this string ends with a backslash... while (strpos($option, '\\') === (strlen($option) - 1)) { // Remove the backslash $option = substr($option, 0, strlen($option) - 1); // Remove the next item from the array and reindex $next = array_splice($options, $i + 1, 1); // Then append the next one, with the semicolon between $option .= ';' . $next[0]; } list($name, $value) = explode('=', $option, 2); $params[$name] = $value; } return $params; } }