wp/wp-includes/SimplePie/Restriction.php
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 16 a86126ab1dd4
permissions -rw-r--r--
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * SimplePie
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * A PHP-Based RSS and Atom Feed Framework.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * Takes the hard work out of managing a complete RSS/Atom solution.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     8
 * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * All rights reserved.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * Redistribution and use in source and binary forms, with or without modification, are
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 * permitted provided that the following conditions are met:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
 * 	* Redistributions of source code must retain the above copyright notice, this list of
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 * 	  conditions and the following disclaimer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * 	  of conditions and the following disclaimer in the documentation and/or other materials
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 * 	  provided with the distribution.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 * 	  to endorse or promote products derived from this software without specific prior
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
 * 	  written permission.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
 * POSSIBILITY OF SUCH DAMAGE.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 * @package SimplePie
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    36
 * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 * @author Ryan Parman
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    38
 * @author Sam Sneddon
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
 * @author Ryan McCue
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
 * @link http://simplepie.org/ SimplePie
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
 * Handles `<media:restriction>` as defined in Media RSS
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
 * Used by {@see SimplePie_Enclosure::get_restriction()} and {@see SimplePie_Enclosure::get_restrictions()}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 * This class can be overloaded with {@see SimplePie::set_restriction_class()}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 * @package SimplePie
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 * @subpackage API
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
class SimplePie_Restriction
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
	 * Relationship ('allow'/'deny')
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
	 * @var string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
	 * @see get_relationship()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	var $relationship;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
	 * Type of restriction
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
	 * @var string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
	 * @see get_type()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
	var $type;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
	 * Restricted values
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
	 * @var string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	 * @see get_value()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
	var $value;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
	 * Constructor, used to input the data
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
	 * For documentation on all the parameters, see the corresponding
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	 * properties and their accessors
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
	public function __construct($relationship = null, $type = null, $value = null)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
	{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
		$this->relationship = $relationship;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
		$this->type = $type;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
		$this->value = $value;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
	 * String-ified version
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
	 * @return string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
	public function __toString()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
	{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
		// There is no $this->data here
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
		return md5(serialize($this));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
	 * Get the relationship
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
	 * @return string|null Either 'allow' or 'deny'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
	public function get_relationship()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
	{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
		if ($this->relationship !== null)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
		{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
			return $this->relationship;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   115
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   116
		return null;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
	 * Get the type
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
	 * @return string|null
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
	public function get_type()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
	{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
		if ($this->type !== null)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
		{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
			return $this->type;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   130
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   131
		return null;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
	 * Get the list of restricted things
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
	 * @return string|null
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
	public function get_value()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
	{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
		if ($this->value !== null)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
		{
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
			return $this->value;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
		}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   145
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   146
		return null;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
}