Fieldmanager_Field::_unauthorized_access PHP Method

_unauthorized_access() public method

Die violently. If self::$debug is true, throw an exception.
public _unauthorized_access ( string $debug_message = '' ) : void
$debug_message string
return void e.g. return _you_ into a void.
    public function _unauthorized_access($debug_message = '')
    {
        if (self::$debug) {
            throw new FM_Exception(esc_html($debug_message));
        } else {
            wp_die(esc_html__("Sorry, you're not supposed to do that...", 'fieldmanager'));
        }
    }

Usage Example

 /**
  * Check if the nonce is valid. Returns false if the nonce is missing and
  * throws an exception if it's invalid. If all goes well, returns true.
  *
  * @return boolean
  */
 protected function is_valid_nonce()
 {
     if (empty($_POST['fieldmanager-' . $this->fm->name . '-nonce'])) {
         return false;
     }
     if (!wp_verify_nonce($_POST['fieldmanager-' . $this->fm->name . '-nonce'], 'fieldmanager-save-' . $this->fm->name)) {
         $this->fm->_unauthorized_access(__('Nonce validation failed', 'fieldmanager'));
     }
     return true;
 }
All Usage Examples Of Fieldmanager_Field::_unauthorized_access