src/pages/MediaPage.php
public function validate() {

		$parent = $this->getParent();

		// The URL segment will conflict with a year/month/day/media format when numeric.

		if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) {

			// Customise a validation error message.

			if(is_numeric($this->URLSegment)) {
				$message = '"URL Segment" must not be numeric!';
			}
			else if(!($parent instanceof MediaHolder)) {
				$message = 'The parent needs to be a published media holder!';
			}
			else {
				$message = "The media holder type doesn't match this!";
			}
			$error = new HTTPResponse_Exception($message, 403);
			$error->getResponse()->addHeader('X-Status', rawurlencode($message));

			// Allow extension customisation.

			$this->extend('validateMediaPage', $error);
			throw $error;
		}
		return parent::validate();
	}
public function validate() {

		$parent = $this->getParent();

		// The URL segment will conflict with a year/month/day/media format when numeric.

		if(is_numeric($this->URLSegment) || !($parent instanceof MediaHolder) || ($this->MediaTypeID && ($parent->MediaTypeID != $this->MediaTypeID))) {

			// Customise a validation error message.

			if(is_numeric($this->URLSegment)) {
				$message = '"URL Segment" must not be numeric!';
			}
			else if(!($parent instanceof MediaHolder)) {
				$message = 'The parent needs to be a published media holder!';
			}
			else {
				$message = "The media holder type doesn't match this!";
			}
			$error = new HTTPResponse_Exception($message, 403);
			$error->getResponse()->addHeader('X-Status', rawurlencode($message));

			// Allow extension customisation.

			$this->extend('validateMediaPage', $error);
			throw $error;
		}
		return parent::validate();
	}
public function validate ( ) { $ parent = $ this -> getParent ( ) ; // The URL segment will conflict with a year/month/day/media format when numeric. if ( is_numeric ( $ this -> URLSegment ) || ! ( $ parent instanceof MediaHolder ) || ( $ this -> MediaTypeID && ( $ parent -> MediaTypeID != $ this -> MediaTypeID ) ) ) { // Customise a validation error message. if ( is_numeric ( $ this -> URLSegment ) ) { $ message = '"URL Segment" must not be numeric!' ; } else if ( ! ( $ parent instanceof MediaHolder ) ) { $ message = 'The parent needs to be a published media holder!' ; } else { $ message = "The media holder type doesn't match this!" ; } $ error = new HTTPResponse_Exception ( $ message , 403 ) ; $ error -> getResponse ( ) -> addHeader ( 'X-Status' , rawurlencode ( $ message ) ) ; // Allow extension customisation. $ this -> extend ( 'validateMediaPage' , $ error ) ; throw $ error ; } return parent :: validate ( ) ; }
Confirm that the current page is valid.
Confirm that the current page is valid .