[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Input; 11 12 use Joomla\CMS\Filter\InputFilter; 13 14 // phpcs:disable PSR1.Files.SideEffects 15 \defined('JPATH_PLATFORM') or die; 16 // phpcs:enable PSR1.Files.SideEffects 17 18 /** 19 * Joomla! Input Cookie Class 20 * 21 * @since 1.7.0 22 * @deprecated 5.0 Use Joomla\Input\Cookie instead 23 */ 24 class Cookie extends Input 25 { 26 /** 27 * Constructor. 28 * 29 * @param array $source Ignored. 30 * @param array $options Array of configuration parameters (Optional) 31 * 32 * @since 1.7.0 33 * @deprecated 5.0 Use Joomla\Input\Cookie instead 34 */ 35 public function __construct(array $source = null, array $options = array()) 36 { 37 if (isset($options['filter'])) { 38 $this->filter = $options['filter']; 39 } else { 40 $this->filter = InputFilter::getInstance(); 41 } 42 43 // Set the data source. 44 $this->data = & $_COOKIE; 45 46 // Set the options for the class. 47 $this->options = $options; 48 } 49 50 /** 51 * Sets a value 52 * 53 * @param string $name Name of the value to set. 54 * @param mixed $value Value to assign to the input. 55 * @param integer $expire The time the cookie expires. This is a Unix timestamp so is in number 56 * of seconds since the epoch. In other words, you'll most likely set this 57 * with the time() function plus the number of seconds before you want it 58 * to expire. Or you might use mktime(). time()+60*60*24*30 will set the 59 * cookie to expire in 30 days. If set to 0, or omitted, the cookie will 60 * expire at the end of the session (when the browser closes). 61 * @param string $path The path on the server in which the cookie will be available on. If set 62 * to '/', the cookie will be available within the entire domain. If set to 63 * '/foo/', the cookie will only be available within the /foo/ directory and 64 * all sub-directories such as /foo/bar/ of domain. The default value is the 65 * current directory that the cookie is being set in. 66 * @param string $domain The domain that the cookie is available to. To make the cookie available 67 * on all subdomains of example.com (including example.com itself) then you'd 68 * set it to '.example.com'. Although some browsers will accept cookies without 69 * the initial ., RFC 2109 requires it to be included. Setting the domain to 70 * 'www.example.com' or '.www.example.com' will make the cookie only available 71 * in the www subdomain. 72 * @param boolean $secure Indicates that the cookie should only be transmitted over a secure HTTPS 73 * connection from the client. When set to TRUE, the cookie will only be set 74 * if a secure connection exists. On the server-side, it's on the programmer 75 * to send this kind of cookie only on secure connection (e.g. with respect 76 * to $_SERVER["HTTPS"]). 77 * @param boolean $httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol. 78 * This means that the cookie won't be accessible by scripting languages, such 79 * as JavaScript. This setting can effectively help to reduce identity theft 80 * through XSS attacks (although it is not supported by all browsers). 81 * 82 * @return void 83 * 84 * @link http://www.ietf.org/rfc/rfc2109.txt 85 * @see setcookie() 86 * @since 1.7.0 87 * @deprecated 5.0 Use Joomla\Input\Cookie instead 88 */ 89 public function set($name, $value, $expire = 0, $path = '', $domain = '', $secure = false, $httpOnly = false) 90 { 91 if (\is_array($value)) { 92 foreach ($value as $key => $val) { 93 setcookie($name . "[$key]", $val, $expire, $path, $domain, $secure, $httpOnly); 94 } 95 } else { 96 setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); 97 } 98 99 $this->data[$name] = $value; 100 } 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |