feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
This commit is contained in:
21
wp-content/plugins/kadence-blocks/vendor/vendor-prefixed/stellarwp/superglobals/LICENSE
vendored
Normal file
21
wp-content/plugins/kadence-blocks/vendor/vendor-prefixed/stellarwp/superglobals/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 StellarWP
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
166
wp-content/plugins/kadence-blocks/vendor/vendor-prefixed/stellarwp/superglobals/README.md
vendored
Normal file
166
wp-content/plugins/kadence-blocks/vendor/vendor-prefixed/stellarwp/superglobals/README.md
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
# StellarWP SuperGlobals
|
||||
|
||||
[](https://github.com/stellarwp/superglobals/actions?query=branch%3Amain) [](https://github.com/stellarwp/superglobals/actions/workflows/static-analysis.yml)
|
||||
|
||||
|
||||
A library that handles access to superglobals.
|
||||
|
||||
Why create a library for this? WordPress .org does not like plugins to directly access superglobals, so this library was created to handle this
|
||||
in a consistent and safe way and can be included as a composer dependency.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Installation](#installation)
|
||||
* [Usage](#usage)
|
||||
* [`SuperGlobals::get_get_var( $var, $default = null )`](#superglobalsget_get_var-var-default--null-)
|
||||
* [`SuperGlobals::get_post_var( $var, $default = null )`](#superglobalsget_post_var-var-default--null-)
|
||||
* [`SuperGlobals::get_raw_superglobal( string $superglobal )`](#superglobalsget_raw_superglobal-string-superglobal-)
|
||||
* [`SuperGlobals::get_sanitized_superglobal( string $superglobal )`](#superglobalsget_sanitized_superglobal-string-superglobal-)
|
||||
* [`SuperGlobals::get_server_var( $var, $default = null )`](#superglobalsget_server_var-var-default--null-)
|
||||
* [`SuperGlobals::get_var( $var, $default = null )`](#superglobalsget_var-var-default--null-)
|
||||
* [`SuperGlobals::sanitize_deep( &$value )`](#superglobalssanitize_deep-value-)
|
||||
|
||||
## Installation
|
||||
|
||||
It's recommended that you install SuperGlobals as a project dependency via [Composer](https://getcomposer.org/):
|
||||
|
||||
```bash
|
||||
composer require stellarwp/superglobals
|
||||
```
|
||||
|
||||
> We _actually_ recommend that this library gets included in your project using [Strauss](https://github.com/BrianHenryIE/strauss).
|
||||
>
|
||||
> Luckily, adding Strauss to your `composer.json` is only slightly more complicated than adding a typical dependency, so checkout our [strauss docs](https://github.com/stellarwp/global-docs/blob/main/docs/strauss-setup.md).
|
||||
|
||||
**An important note on namespaces:**
|
||||
|
||||
> The docs will in this repo all use `StellarWP\SuperGlobals` as the base namespace, however, if you are using [Strauss](#strauss)
|
||||
> to prefix namespaces in your project, you will need to adapt the namespaces accordingly. (Example: `Boom\Shakalaka\StellarWP\SuperGlobals`)
|
||||
|
||||
## Usage
|
||||
|
||||
### `SuperGlobals::get_get_var( $var, $default = null )`
|
||||
|
||||
Get a `$_GET` value and recursively sanitize it using `SuperGlobals::sanitize_deep()`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_GET['post_id']
|
||||
$var = SuperGlobals::get_get_var( 'post_id' );
|
||||
|
||||
// Provide a default value if the variable is not set.
|
||||
$var = SuperGlobals::get_get_var( 'post_id', 12 );
|
||||
```
|
||||
|
||||
### `SuperGlobals::get_post_var( $var, $default = null )`
|
||||
|
||||
Get a `$_POST` value and recursively sanitize it using `SuperGlobals::sanitize_deep()`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_POST['post_id']
|
||||
$var = SuperGlobals::get_post_var( 'post_id' );
|
||||
|
||||
// Provide a default value if the variable is not set.
|
||||
$var = SuperGlobals::get_post_var( 'post_id', 12 );
|
||||
```
|
||||
|
||||
### `SuperGlobals::get_raw_superglobal( string $superglobal )`
|
||||
|
||||
Gets the requested superglobal variable. Options are `ENV`, `GET`, `POST`, `REQUEST`, or `SERVER`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_ENV
|
||||
$env = SuperGlobals::get_raw_superglobal( 'ENV' );
|
||||
|
||||
// Get $_GET
|
||||
$get = SuperGlobals::get_raw_superglobal( 'GET' );
|
||||
|
||||
// Get $_POST
|
||||
$post = SuperGlobals::get_raw_superglobal( 'POST' );
|
||||
|
||||
// Get $_REQUEST
|
||||
$request = SuperGlobals::get_raw_superglobal( 'REQUEST' );
|
||||
|
||||
// Get $_SERVER
|
||||
$server = SuperGlobals::get_raw_superglobal( 'SERVER' );
|
||||
```
|
||||
|
||||
### `SuperGlobals::get_sanitized_superglobal( string $superglobal )`
|
||||
|
||||
Gets the requested superglobal variable, sanitized. Options are `ENV`, `GET`, `POST`, `REQUEST`, or `SERVER`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_ENV
|
||||
$env = SuperGlobals::get_sanitized_superglobal( 'ENV' );
|
||||
|
||||
// Get $_GET
|
||||
$get = SuperGlobals::get_sanitized_superglobal( 'GET' );
|
||||
|
||||
// Get $_POST
|
||||
$post = SuperGlobals::get_sanitized_superglobal( 'POST' );
|
||||
|
||||
// Get $_REQUEST
|
||||
$request = SuperGlobals::get_sanitized_superglobal( 'REQUEST' );
|
||||
|
||||
// Get $_SERVER
|
||||
$server = SuperGlobals::get_sanitized_superglobal( 'SERVER' );
|
||||
```
|
||||
|
||||
### `SuperGlobals::get_server_var( $var, $default = null )`
|
||||
|
||||
Get a `$_SERVER` value and recursively sanitize it using `SuperGlobals::sanitize_deep()`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_SERVER['REQUEST_URI']
|
||||
$var = SuperGlobals::get_server_var( 'REQUEST_URI' );
|
||||
|
||||
// Provide a default value if the variable is not set.
|
||||
$var = SuperGlobals::get_server_var( 'REQUEST_URI', 'http://example.com' );
|
||||
```
|
||||
|
||||
### `SuperGlobals::get_var( $var, $default = null )`
|
||||
|
||||
Gets a value from `$_REQUEST`, `$_POST`, or `$_GET` and recursively sanitizes it using `SuperGlobals::sanitize_deep()`.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
// Get $_REQUEST['post_id'] or $_POST['post_id'] or $_GET['post_id'], wherever it lives
|
||||
$var = SuperGlobals::get_var( 'post_id' );
|
||||
|
||||
// Provide a default value if the variable is not set.
|
||||
$var = SuperGlobals::get_var( 'post_id', 12 );
|
||||
```
|
||||
|
||||
### `SuperGlobals::sanitize_deep( &$value )`
|
||||
|
||||
Sanitizes a value recursively using appropriate sanitization functions depending on the type of the value.
|
||||
|
||||
#### Example
|
||||
|
||||
```php
|
||||
use StellarWP\SuperGlobals\SuperGlobals;
|
||||
|
||||
$var = SuperGlobals::sanitize_deep( $some_var );
|
||||
```
|
||||
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\StellarWP\SuperGlobals;
|
||||
|
||||
use KadenceWP\KadenceBlocks\StellarWP\Arrays\Arr;
|
||||
|
||||
class SuperGlobals {
|
||||
/**
|
||||
* Grab sanitized _SERVER variable.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see Arr::get()
|
||||
*
|
||||
* @param string|array $var
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_server_var( $var, $default = null ) {
|
||||
$data = [];
|
||||
|
||||
// Prevent a slew of warnings every time we call this.
|
||||
if ( ! empty( $_SERVER ) ) {
|
||||
$data[] = (array) $_SERVER;
|
||||
}
|
||||
|
||||
if ( empty( $data ) ) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$unsafe = Arr::get_in_any( $data, $var, $default );
|
||||
return static::sanitize_deep( $unsafe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value from `$_GET`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see Arr::get()
|
||||
*
|
||||
* @param string $var
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_get_var( string $var, $default = null ) {
|
||||
$unsafe = Arr::get( (array) $_GET, $var, $default );
|
||||
return static::sanitize_deep( $unsafe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value from `$_POST`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see Arr::get()
|
||||
*
|
||||
* @param string $var
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_post_var( string $var, $default = null ) {
|
||||
$unsafe = Arr::get( (array) $_POST, $var, $default );
|
||||
return static::sanitize_deep( $unsafe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value from `$_ENV`.
|
||||
*
|
||||
* @since 1.3.0
|
||||
*
|
||||
* @see Arr::get()
|
||||
*
|
||||
* @param string $var
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_env_var( string $var, $default = null ) {
|
||||
$unsafe = Arr::get( (array) $_ENV, $var, $default );
|
||||
return static::sanitize_deep( $unsafe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the requested superglobal variable.
|
||||
*
|
||||
* @param string $superglobal A superglobal, such as 'COOKIE', 'ENV', 'GET', 'POST', 'REQUEST', or 'SERVER'.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_raw_superglobal( string $superglobal ) {
|
||||
$superglobal = strtoupper( $superglobal );
|
||||
|
||||
switch ( $superglobal ) {
|
||||
case '_COOKIE':
|
||||
case 'COOKIE':
|
||||
$var = $_COOKIE;
|
||||
break;
|
||||
case '_ENV':
|
||||
case 'ENV':
|
||||
$var = $_ENV;
|
||||
break;
|
||||
case '_GET':
|
||||
case 'GET':
|
||||
$var = $_GET;
|
||||
break;
|
||||
case '_POST':
|
||||
case 'POST':
|
||||
$var = $_POST;
|
||||
break;
|
||||
case '_REQUEST':
|
||||
case 'REQUEST':
|
||||
$var = $_REQUEST;
|
||||
break;
|
||||
case '_SERVER':
|
||||
case 'SERVER':
|
||||
$var = $_SERVER;
|
||||
break;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the requested superglobal variable, sanitized.
|
||||
*
|
||||
* @param string $superglobal A superglobal, such as 'COOKIE', 'ENV', 'GET', 'POST', 'REQUEST', or 'SERVER'.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_sanitized_superglobal( string $superglobal ) {
|
||||
$var = static::get_raw_superglobal( $superglobal );
|
||||
return static::sanitize_deep( $var );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if the requested variable is set either as a post field or as a URL
|
||||
* param and returns the value if so.
|
||||
*
|
||||
* Post data takes priority over fields passed in the URL query. If the field is not
|
||||
* set then $default (null unless a different value is specified) will be returned.
|
||||
*
|
||||
* The variable being tested for can be an array if you wish to find a nested value.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see Arr::get()
|
||||
*
|
||||
* @param string|array $var
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_var( $var, $default = null ) {
|
||||
$requests = [];
|
||||
|
||||
// Prevent a slew of warnings every time we call this.
|
||||
if ( ! empty( $_REQUEST ) ) {
|
||||
$requests[] = (array) $_REQUEST;
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST ) ) {
|
||||
$requests[] = (array) $_POST;
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET ) ) {
|
||||
$requests[] = (array) $_GET;
|
||||
}
|
||||
|
||||
if ( empty( $requests ) ) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$unsafe = Arr::get_in_any( $requests, $var, $default );
|
||||
return static::sanitize_deep( $unsafe );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a value according to its type.
|
||||
*
|
||||
* The function will recursively sanitize array values.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param mixed $value The value, or values, to sanitize.
|
||||
*
|
||||
* @return mixed|null Either the sanitized version of the value, or `null` if the value is not a string, number or
|
||||
* array.
|
||||
*/
|
||||
public static function sanitize_deep( &$value ) {
|
||||
if ( is_bool( $value ) ) {
|
||||
return $value;
|
||||
}
|
||||
if ( is_string( $value ) ) {
|
||||
$value = htmlspecialchars( $value );
|
||||
return $value;
|
||||
}
|
||||
if ( is_int( $value ) ) {
|
||||
$value = filter_var( $value, FILTER_VALIDATE_INT );
|
||||
return $value;
|
||||
}
|
||||
if ( is_float( $value ) ) {
|
||||
$value = filter_var( $value, FILTER_VALIDATE_FLOAT );
|
||||
return $value;
|
||||
}
|
||||
if ( is_array( $value ) ) {
|
||||
array_walk( $value, [ __CLASS__, 'sanitize_deep' ] );
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user