wp/wp-includes/SimplePie/Category.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 
    55 class SimplePie_Category
    54 class SimplePie_Category
    56 {
    55 {
    57 	/**
    56 	/**
    58 	 * Category identifier
    57 	 * Category identifier
    59 	 *
    58 	 *
    60 	 * @var string
    59 	 * @var string|null
    61 	 * @see get_term
    60 	 * @see get_term
    62 	 */
    61 	 */
    63 	var $term;
    62 	var $term;
    64 
    63 
    65 	/**
    64 	/**
    66 	 * Categorization scheme identifier
    65 	 * Categorization scheme identifier
    67 	 *
    66 	 *
    68 	 * @var string
    67 	 * @var string|null
    69 	 * @see get_scheme()
    68 	 * @see get_scheme()
    70 	 */
    69 	 */
    71 	var $scheme;
    70 	var $scheme;
    72 
    71 
    73 	/**
    72 	/**
    74 	 * Human readable label
    73 	 * Human readable label
    75 	 *
    74 	 *
    76 	 * @var string
    75 	 * @var string|null
    77 	 * @see get_label()
    76 	 * @see get_label()
    78 	 */
    77 	 */
    79 	var $label;
    78 	var $label;
    80 
    79 
    81 	/**
    80 	/**
       
    81 	 * Category type
       
    82 	 * 
       
    83 	 * category for <category>
       
    84 	 * subject for <dc:subject>
       
    85 	 *
       
    86 	 * @var string|null
       
    87 	 * @see get_type()
       
    88 	 */
       
    89 	var $type;
       
    90 
       
    91 	/**
    82 	 * Constructor, used to input the data
    92 	 * Constructor, used to input the data
    83 	 *
    93 	 *
    84 	 * @param string $term
    94 	 * @param string|null $term
    85 	 * @param string $scheme
    95 	 * @param string|null $scheme
    86 	 * @param string $label
    96 	 * @param string|null $label
       
    97 	 * @param string|null $type
    87 	 */
    98 	 */
    88 	public function __construct($term = null, $scheme = null, $label = null)
    99 	public function __construct($term = null, $scheme = null, $label = null, $type = null)
    89 	{
   100 	{
    90 		$this->term = $term;
   101 		$this->term = $term;
    91 		$this->scheme = $scheme;
   102 		$this->scheme = $scheme;
    92 		$this->label = $label;
   103 		$this->label = $label;
       
   104 		$this->type = $type;
    93 	}
   105 	}
    94 
   106 
    95 	/**
   107 	/**
    96 	 * String-ified version
   108 	 * String-ified version
    97 	 *
   109 	 *
   108 	 *
   120 	 *
   109 	 * @return string|null
   121 	 * @return string|null
   110 	 */
   122 	 */
   111 	public function get_term()
   123 	public function get_term()
   112 	{
   124 	{
   113 		if ($this->term !== null)
   125 		return $this->term;
   114 		{
       
   115 			return $this->term;
       
   116 		}
       
   117 		else
       
   118 		{
       
   119 			return null;
       
   120 		}
       
   121 	}
   126 	}
   122 
   127 
   123 	/**
   128 	/**
   124 	 * Get the categorization scheme identifier
   129 	 * Get the categorization scheme identifier
   125 	 *
   130 	 *
   126 	 * @return string|null
   131 	 * @return string|null
   127 	 */
   132 	 */
   128 	public function get_scheme()
   133 	public function get_scheme()
   129 	{
   134 	{
   130 		if ($this->scheme !== null)
   135 		return $this->scheme;
   131 		{
       
   132 			return $this->scheme;
       
   133 		}
       
   134 		else
       
   135 		{
       
   136 			return null;
       
   137 		}
       
   138 	}
   136 	}
   139 
   137 
   140 	/**
   138 	/**
   141 	 * Get the human readable label
   139 	 * Get the human readable label
   142 	 *
   140 	 *
       
   141 	 * @param bool $strict
   143 	 * @return string|null
   142 	 * @return string|null
   144 	 */
   143 	 */
   145 	public function get_label()
   144 	public function get_label($strict = false)
   146 	{
   145 	{
   147 		if ($this->label !== null)
   146 		if ($this->label === null && $strict !== true)
   148 		{
       
   149 			return $this->label;
       
   150 		}
       
   151 		else
       
   152 		{
   147 		{
   153 			return $this->get_term();
   148 			return $this->get_term();
   154 		}
   149 		}
       
   150 		return $this->label;
       
   151 	}
       
   152 
       
   153 	/**
       
   154 	 * Get the category type
       
   155 	 *
       
   156 	 * @return string|null
       
   157 	 */
       
   158 	public function get_type()
       
   159 	{
       
   160 		return $this->type;
   155 	}
   161 	}
   156 }
   162 }
   157 
   163