Helper::get_var( string $name, bool|string $type = false, bool|string $sanitize = false )

Get a variable from POST or GET.


Parameters

$name

(string) (Required) The variable name.

$type

(bool|string) (Optional) The variable type (POST, GET).

Default value: false

$sanitize

(bool|string) (Optional) A function name that will be sued for sanitization.

Default value: false


Return

(bool|mixed) The variable value.


Source

File: includes/libs/helper.class.php

	public static function get_var( $name, $type = false, $sanitize = false ) {
		$result = false;

		switch( $type ){
			case 'POST':
				$result = isset( $_POST[ $name ] ) ? $_POST[ $name ] : false;
				break;
			case 'GET':
				$result = isset( $_GET[ $name ] ) ? $_GET[ $name ] : false;
				break;
			default:
				if( isset( $_GET[ $name ] ) ){
					$result = $_GET[ $name ];
				}elseif ( isset( $_POST[ $name ] ) ){
					$result = $_POST[ $name ];
				}
				break;
		}

		if( $sanitize ){
			$result = call_user_func( $sanitize, $result );
		}

		return $result;
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!