Model.class.php
public function validate( $req = array(), $input = null )
	{

		global $wgRequest;

		if ( !is_array( $req ) ) $req = array( $req );

		if ( $input == null ) {
			$input = $wgRequest->getValues();
		}

		/* Fix: mediawiki pass `title` param and override POST `title` param. fix it */
		if ( isset($_POST['title']) ) {
			$input['title'] = htmlspecialchars( $_POST['title'] );
		}

		foreach ( $input as $param => $value ) {

			#if (is_array($value) && !method_exists($this,'_set'.$param)) continue;

			if ( array_key_exists( $param, $this->properties ) ) {

				/* Validation rules
				*  TODO: make them work
				*/
				switch ( $this->properties[$param] ) {

					case 'int':
						//if (!is_integer($value)) return false;
						break;

					case 'string':
						//if (!is_string($value)) return false;
						break;

				}

				/* Required */
				if ( (empty($value) || $value == '') && array_key_exists( $param, $req ) ) return false;

				$this->$param = $value;

			}

		}

		return true;

	}
public function validate( $req = array(), $input = null )
	{

		global $wgRequest;

		if ( !is_array( $req ) ) $req = array( $req );

		if ( $input == null ) {
			$input = $wgRequest->getValues();
		}

		/* Fix: mediawiki pass `title` param and override POST `title` param. fix it */
		if ( isset($_POST['title']) ) {
			$input['title'] = htmlspecialchars( $_POST['title'] );
		}

		foreach ( $input as $param => $value ) {

			#if (is_array($value) && !method_exists($this,'_set'.$param)) continue;

			if ( array_key_exists( $param, $this->properties ) ) {

				/* Validation rules
				*  TODO: make them work
				*/
				switch ( $this->properties[$param] ) {

					case 'int':
						//if (!is_integer($value)) return false;
						break;

					case 'string':
						//if (!is_string($value)) return false;
						break;

				}

				/* Required */
				if ( (empty($value) || $value == '') && array_key_exists( $param, $req ) ) return false;

				$this->$param = $value;

			}

		}

		return true;

	}
public function validate ( $ req = array ( ) , $ input = null ) { global $ wgRequest ; if ( ! is_array ( $ req ) ) $ req = array ( $ req ) ; if ( $ input == null ) { $ input = $ wgRequest -> getValues ( ) ; } /* Fix: mediawiki pass `title` param and override POST `title` param. fix it */ if ( isset ( $ _POST [ 'title' ] ) ) { $ input [ 'title' ] = htmlspecialchars ( $ _POST [ 'title' ] ) ; } foreach ( $ input as $ param => $ value ) { #if (is_array($value) && !method_exists($this,'_set'.$param)) continue; if ( array_key_exists ( $ param , $ this -> properties ) ) { /* Validation rules
				*  TODO: make them work
				*/ switch ( $ this -> properties [ $ param ] ) { case 'int' : //if (!is_integer($value)) return false; break ; case 'string' : //if (!is_string($value)) return false; break ; } /* Required */ if ( ( empty ( $ value ) || $ value == '' ) && array_key_exists ( $ param , $ req ) ) return false ; $ this -> $ param = $ value ; } } return true ; }
Invalidates model from request
@param null $input
Invalidates model from request