wp/wp-includes/SimplePie/Cache/File.php
changeset 16 a86126ab1dd4
parent 0 d970ebf37754
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     3  * SimplePie
     3  * SimplePie
     4  *
     4  *
     5  * A PHP-Based RSS and Atom Feed Framework.
     5  * A PHP-Based RSS and Atom Feed Framework.
     6  * Takes the hard work out of managing a complete RSS/Atom solution.
     6  * Takes the hard work out of managing a complete RSS/Atom solution.
     7  *
     7  *
     8  * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
     8  * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
     9  * All rights reserved.
     9  * All rights reserved.
    10  *
    10  *
    11  * Redistribution and use in source and binary forms, with or without modification, are
    11  * Redistribution and use in source and binary forms, with or without modification, are
    12  * permitted provided that the following conditions are met:
    12  * permitted provided that the following conditions are met:
    13  *
    13  *
    31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    33  * POSSIBILITY OF SUCH DAMAGE.
    33  * POSSIBILITY OF SUCH DAMAGE.
    34  *
    34  *
    35  * @package SimplePie
    35  * @package SimplePie
    36  * @version 1.3.1
    36  * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
    37  * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
       
    38  * @author Ryan Parman
    37  * @author Ryan Parman
    39  * @author Geoffrey Sneddon
    38  * @author Sam Sneddon
    40  * @author Ryan McCue
    39  * @author Ryan McCue
    41  * @link http://simplepie.org/ SimplePie
    40  * @link http://simplepie.org/ SimplePie
    42  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
    41  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
    43  */
    42  */
    44 
    43 
   100 	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
    99 	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
   101 	 * @return bool Successfulness
   100 	 * @return bool Successfulness
   102 	 */
   101 	 */
   103 	public function save($data)
   102 	public function save($data)
   104 	{
   103 	{
   105 		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
   104 		if (file_exists($this->name) && is_writable($this->name) || file_exists($this->location) && is_writable($this->location))
   106 		{
   105 		{
   107 			if ($data instanceof SimplePie)
   106 			if ($data instanceof SimplePie)
   108 			{
   107 			{
   109 				$data = $data->data;
   108 				$data = $data->data;
   110 			}
   109 			}
   134 	 *
   133 	 *
   135 	 * @return int Timestamp
   134 	 * @return int Timestamp
   136 	 */
   135 	 */
   137 	public function mtime()
   136 	public function mtime()
   138 	{
   137 	{
   139 		if (file_exists($this->name))
   138 		return @filemtime($this->name);
   140 		{
       
   141 			return filemtime($this->name);
       
   142 		}
       
   143 		return false;
       
   144 	}
   139 	}
   145 
   140 
   146 	/**
   141 	/**
   147 	 * Set the last modified time to the current time
   142 	 * Set the last modified time to the current time
   148 	 *
   143 	 *
   149 	 * @return bool Success status
   144 	 * @return bool Success status
   150 	 */
   145 	 */
   151 	public function touch()
   146 	public function touch()
   152 	{
   147 	{
   153 		if (file_exists($this->name))
   148 		return @touch($this->name);
   154 		{
       
   155 			return touch($this->name);
       
   156 		}
       
   157 		return false;
       
   158 	}
   149 	}
   159 
   150 
   160 	/**
   151 	/**
   161 	 * Remove the cache
   152 	 * Remove the cache
   162 	 *
   153 	 *