From 408ba97ce558de765546d2923f3f29a30e1fad21 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 5 Apr 2017 22:18:14 -0500 Subject: [PATCH] Progress: more work on path libary, fix problems with some return values Did a small amount of grunt work in setting up the path class. I noticed that I had, in a good number of cases, forgot to include the 'new' reserved word when returning c_base_return_false(). --- common/base/classes/base_html.php | 18 +- common/base/classes/base_http.php | 8 +- common/base/classes/base_http_status.php | 2 +- common/base/classes/base_path.php | 800 +++++++++++++++++++++++++++++-- common/theme/classes/theme_form.php | 10 +- 5 files changed, 788 insertions(+), 50 deletions(-) diff --git a/common/base/classes/base_html.php b/common/base/classes/base_html.php index 51da35c..c5fafad 100644 --- a/common/base/classes/base_html.php +++ b/common/base/classes/base_html.php @@ -106,7 +106,7 @@ class c_base_html extends c_base_return { */ public function get_id() { if (!is_int($this->id)) { - return c_base_return_false(); + return new c_base_return_false(); } return c_base_return_int::s_new($this->id); @@ -1166,7 +1166,7 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_XML_SPACE: case c_base_markup_attributes::ATTRIBUTE_ZOOM_AND_PAN: if (!is_string($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -1206,7 +1206,7 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_NOW: case c_base_markup_attributes::ATTRIBUTE_ARIA_VALUE_TEXT: if (!is_string($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -1236,7 +1236,7 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_SORTED: case c_base_markup_attributes::ATTRIBUTE_SPELLCHECK: if (!is_bool($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -1245,14 +1245,14 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_ENCODING_TYPE: case c_base_markup_attributes::ATTRIBUTE_TYPE: if (!$this->pr_validate_value_mime_type($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; case c_base_markup_attributes::ATTRIBUTE_ACCEPT_CHARACTER_SET: case c_base_markup_attributes::ATTRIBUTE_CHARACTER_SET: if (!$this->pr_validate_value_character_set($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -1296,19 +1296,19 @@ class c_base_html extends c_base_return { case c_base_markup_attributes::ATTRIBUTE_Y_1: case c_base_markup_attributes::ATTRIBUTE_Y_2: if (!is_int($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; case c_base_markup_attributes::ATTRIBUTE_CLASS: if (!is_array($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; case c_base_markup_attributes::ATTRIBUTE_FORM_METHOD: if (!$this->pr_validate_value_http_method($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; diff --git a/common/base/classes/base_http.php b/common/base/classes/base_http.php index aeb97b9..c3841f2 100644 --- a/common/base/classes/base_http.php +++ b/common/base/classes/base_http.php @@ -4682,7 +4682,7 @@ class c_base_http extends c_base_rfc_string { if ($this->content_is_file) { if (empty($this->content)) { unset($encoding); - return c_base_return_false(); + return new c_base_return_false(); } if (is_null($max_filesize)) { @@ -4704,7 +4704,7 @@ class c_base_http extends c_base_rfc_string { if (empty($content)) { unset($encoding); unset($content); - return c_base_return_false(); + return new c_base_return_false(); } $this->p_encode_content($content, $encoding, $compression, TRUE); @@ -4736,7 +4736,7 @@ class c_base_http extends c_base_rfc_string { if (empty($content) || $content_length >= $max_filesize) { unset($encoding); unset($content); - return c_base_return_false(); + return new c_base_return_false(); } unset($content_length); @@ -7777,7 +7777,7 @@ class c_base_http extends c_base_rfc_string { } } - if (isset($_SERVER) && is_array($_SERVER) && !empty($_SERVER)) { + if (isset($_SERVER['REQUEST_TIME_FLOAT']) && is_float($_SERVER['REQUEST_TIME_FLOAT'])) { // find and process potentially useful additional environment variables. if (array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { $this->request_time = $_SERVER['REQUEST_TIME_FLOAT']; diff --git a/common/base/classes/base_http_status.php b/common/base/classes/base_http_status.php index ccaeb9c..f39c89f 100644 --- a/common/base/classes/base_http_status.php +++ b/common/base/classes/base_http_status.php @@ -362,7 +362,7 @@ class c_base_http_status { // invalid will not be processed because it is invalid. default: - return c_base_return_false(); + return new c_base_return_false(); } return c_base_return_string::s_new($string); diff --git a/common/base/classes/base_path.php b/common/base/classes/base_path.php index 4e71177..08c64d8 100644 --- a/common/base/classes/base_path.php +++ b/common/base/classes/base_path.php @@ -6,7 +6,7 @@ * For performance reasons, hard-coded paths are preferred and should not be stored in the database. * For dynamic reasons, dynamic paths are stored in the database and should not be hardcoded. * - * This is open-source, it is far too easy to modify source codde and add explicit paths. + * This is open-source, it is far too easy to modify source code and add explicit paths. * The gains in performance and resources are generally worth it. * * The preferred design is to provide dynamic hard-coded paths whose variable parts reference known data (such as request ids). @@ -150,30 +150,75 @@ class c_base_path extends c_base_return_string { * * @param string $field_path * The URL path assigned to this field. + * An empty string is assigned on parameter error. * @param string $name_machine * The machine name of the path. + * This is not assigned on parameter error. * @param string $name_human * The human-friendly name of the path. + * This is not assigned on parameter error. * @param bool $is_dynamic * (optional) When TRUE this designates that the path includes dynamic parts. * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * Default setting is assigned on parameter error. * @param bool $is_private * (optional) When TRUE, path is considered private and requires specific access privileges. * When FALSE, the path is accessible without any access privileges. + * Default setting is assigned on parameter error. * - * @return c_base_markup_tag|c_base_return_status - * A newly created tag is returned on success. - * FALSE with the error bit set is returned on error. + * @return c_base_markup_tag + * Always returns the newly created tag. + * Error bit is set on error. */ public static function s_create_content($field_path, $name_machine, $name_human, $is_dynamic = TRUE, $is_private = TRUE) { $path = new __CLASS__(); - // @todo: write functions and handle return values. - $path->set_value($field_path); - $path->set_name_machine($name_machine); - $path->set_name_human($name_human); - - // @todo: .. + // store all errors on return. + $errors = array(); + + if (is_string($field_path)) { + $path->set_value($field_path); + } + else { + $path->set_value(''); + } + + if (is_string($name_machine)) { + $path->set_name_machine($name_machine); + } + + if (is_string($name_human)) { + $path->set_name_human($name_human); + } + + if (is_bool($is_dynamic)) { + $path->set_is_dynamic($is_dynamic); + } + else { + $path->set_is_dynamic(TRUE); + } + + if (is_bool($is_private)) { + $path->set_is_private($is_private); + } + else { + $path->set_is_private(TRUE); + } + + if (isset($_SERVER['REQUEST_TIME_FLOAT']) && is_float($_SERVER['REQUEST_TIME_FLOAT'])) { + $path->set_date_created($_SERVER['REQUEST_TIME_FLOAT']); + $path->set_date_changed($_SERVER['REQUEST_TIME_FLOAT']); + } + elseif (isset($_SERVER['REQUEST_TIME']) && is_float($_SERVER['REQUEST_TIME'])) { + $path->set_date_created($_SERVER['REQUEST_TIME']); + $path->set_date_changed($_SERVER['REQUEST_TIME']); + } + else { + $time = (int) microtime(TRUE); + $path->set_date_created($time); + $path->set_date_changed($time); + unset($time); + } return $path; } @@ -181,20 +226,25 @@ class c_base_path extends c_base_return_string { /** * Create an alias path. * + * Defaults are silently forced on invalid parameters. + * * @param string $field_path * The URL path assigned to this field. + * An empty string is assigned on parameter error. * @param string $name_machine * The machine name of the path. + * This is not assigned on parameter error. * @param string $name_human * The human-friendly name of the path. - * @param string $field_destination - * The url this content pretends to be. + * This is not assigned on parameter error. * @param bool $is_dynamic * (optional) When TRUE this designates that the path includes dynamic parts. * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * Default setting is assigned on parameter error. * @param bool $is_private * (optional) When TRUE, path is considered private and requires specific access privileges. * When FALSE, the path is accessible without any access privileges. + * Default setting is assigned on parameter error. * * @return c_base_markup_tag|c_base_return_status * A newly created tag is returned on success. @@ -203,13 +253,56 @@ class c_base_path extends c_base_return_string { public static function s_create_alias($field_path, $name_machine, $name_human, $field_destination, $is_dynamic = TRUE, $is_private = TRUE) { $path = new __CLASS__(); - // @todo: write functions and handle return values. - $path->set_value($field_path); - $path->set_name_machine($name_machine); - $path->set_name_human($name_human); - $path->set_field_destination($field_destination); - - // @todo: .. + // store all errors on return. + $errors = array(); + + if (is_string($field_path)) { + $path->set_value($field_path); + } + else { + $path->set_value(''); + } + + if (is_string($name_machine)) { + $path->set_name_machine($name_machine); + } + + if (is_string($name_human)) { + $path->set_name_human($name_human); + } + + if (is_string($field_destination)) { + $path->set_field_destination($field_destination); + } + + if (is_bool($is_dynamic)) { + $path->set_is_dynamic($is_dynamic); + } + else { + $path->set_is_dynamic(TRUE); + } + + if (is_bool($is_private)) { + $path->set_is_private($is_private); + } + else { + $path->set_is_private(TRUE); + } + + if (isset($_SERVER['REQUEST_TIME_FLOAT']) && is_float($_SERVER['REQUEST_TIME_FLOAT'])) { + $path->set_date_created($_SERVER['REQUEST_TIME_FLOAT']); + $path->set_date_changed($_SERVER['REQUEST_TIME_FLOAT']); + } + elseif (isset($_SERVER['REQUEST_TIME']) && is_float($_SERVER['REQUEST_TIME'])) { + $path->set_date_created($_SERVER['REQUEST_TIME']); + $path->set_date_changed($_SERVER['REQUEST_TIME']); + } + else { + $time = microtime(TRUE); + $path->set_date_created($time); + $path->set_date_changed($time); + unset($time); + } return $path; } @@ -217,44 +310,689 @@ class c_base_path extends c_base_return_string { /** * Create a redirect path. * + * Defaults are silently forced on invalid parameters. + * * @param string $field_path * The URL path assigned to this field. + * An empty string is assigned on parameter error. * @param string $name_machine * The machine name of the path. + * This is not assigned on parameter error. * @param string $name_human * The human-friendly name of the path. - * @param string $field_destination - * The url to redirect to. - * @param string $field_destination + * This is not assigned on parameter error. + * @param string field_destination + * + * @param int $field_response_code * The redirect response code. * Should be a 3xx url code. * Usually one of: * - 300 (Multiple Choices): * - 301 (Moved Permanently): * - 303 (See Other): + * This is not assigned on parameter error. * @param bool $is_dynamic * (optional) When TRUE this designates that the path includes dynamic parts. * When FALSE, there is no interpretation on the url and path is treated exactly as is. + * Default setting is assigned on parameter error. * @param bool $is_private * (optional) When TRUE, path is considered private and requires specific access privileges. * When FALSE, the path is accessible without any access privileges. + * Default setting is assigned on parameter error. * * @return c_base_markup_tag|c_base_return_status * A newly created tag is returned on success. * FALSE with the error bit set is returned on error. */ - public static function s_create_content($field_path, $name_machine, $name_human, $field_destination, $field_response_code, $is_dynamic = TRUE, $is_private = TRUE) { + public static function s_create_redirect($field_path, $name_machine, $name_human, $field_destination, $field_response_code, $is_dynamic = TRUE, $is_private = TRUE) { $path = new __CLASS__(); - // @todo: write functions and handle return values. - $path->set_value($field_path); - $path->set_name_machine($name_machine); - $path->set_name_human($name_human); - $path->set_field_destination($field_destination); - $path->set_field_response_code($field_response_code); - - // @todo: .. + // store all errors on return. + $errors = array(); + + if (is_string($field_path)) { + $path->set_value($field_path); + } + else { + $path->set_value(''); + } + + if (is_string($name_machine)) { + $path->set_name_machine($name_machine); + } + + if (is_string($name_human)) { + $path->set_name_human($name_human); + } + + if (is_string($field_destination)) { + $path->set_field_destination($field_destination); + } + + if (is_int($field_response_code)) { + $path->set_response_code($field_response_code); + } + + if (is_bool($is_dynamic)) { + $path->set_is_dynamic($is_dynamic); + } + else { + $path->set_is_dynamic(TRUE); + } + + if (is_bool($is_private)) { + $path->set_is_private($is_private); + } + else { + $path->set_is_private(TRUE); + } + + if (isset($_SERVER['REQUEST_TIME_FLOAT']) && is_float($_SERVER['REQUEST_TIME_FLOAT'])) { + $path->set_date_created($_SERVER['REQUEST_TIME_FLOAT']); + $path->set_date_changed($_SERVER['REQUEST_TIME_FLOAT']); + } + else { + $time = (int) microtime(TRUE); + $path->set_date_created($time); + $path->set_date_changed($time); + unset($time); + } return $path; } + + /** + * Assigns the machine name setting. + * + * @param int $id + * The machine name associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_id($id) { + if (!is_int($id)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'id', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id = $id; + return new c_base_return_true(); + } + + /** + * Assigns the machine name setting. + * + * @param int $id_group + * The machine name associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_id_group($id_group) { + if (!is_int($id_group)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'id_group', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->id_group = $id_group; + return new c_base_return_true(); + } + + /** + * Assigns the machine name setting. + * + * @param string $name_machine + * The machine name associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_name_machine($name_machine) { + if (!is_string($name_machine)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'name_machine', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->name_machine = $name_machine; + return new c_base_return_true(); + } + + /** + * Assigns the human name setting. + * + * @param string $name_human + * The human name associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_name_human($name_human) { + if (!is_string($name_human)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'name_human', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->name_human = $name_human; + return new c_base_return_true(); + } + + /** + * Assigns the is content boolean setting. + * + * @param bool $is_content + * The is content boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_content($is_content) { + if (!is_bool($is_content)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_content', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_content = $is_content; + return new c_base_return_true(); + } + + /** + * Assigns the is alias boolean setting. + * + * @param bool $is_alias + * The is alias boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_alias($is_alias) { + if (!is_bool($is_alias)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_alias', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_alias = $is_alias; + return new c_base_return_true(); + } + + /** + * Assigns the is redirect boolean setting. + * + * @param bool $is_redirect + * The is redirect boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_redirect($is_redirect) { + if (!is_bool($is_redirect)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_redirect', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_redirect = $is_redirect; + return new c_base_return_true(); + } + + /** + * Assigns the is coded boolean setting. + * + * @param bool $is_coded + * The is coded boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_coded($is_coded) { + if (!is_bool($is_coded)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_coded', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_coded = $is_coded; + return new c_base_return_true(); + } + + /** + * Assigns the is dynamic boolean setting. + * + * @param bool $is_dynamic + * The is dynamic boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_dynamic($is_dynamic) { + if (!is_bool($is_dynamic)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_dynamic', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_dynamic = $is_dynamic; + return new c_base_return_true(); + } + + /** + * Assigns the is user boolean name setting. + * + * @param bool $is_user + * The is user boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_user($is_user) { + if (!is_bool($is_user)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_user', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_user = $is_user; + return new c_base_return_true(); + } + + /** + * Assigns the is private boolean setting. + * + * @param bool $is_private + * The is private boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_private($is_private) { + if (!is_bool($is_private)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_private', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_private = $is_private; + return new c_base_return_true(); + } + + /** + * Assigns the is locked boolean setting. + * + * @param bool $is_locked + * The is locked boolean associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_is_locked($is_locked) { + if (!is_bool($is_locked)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'is_locked', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->is_locked = $is_locked; + return new c_base_return_true(); + } + + /** + * Assigns the destination field setting. + * + * @param string $field_destination + * The destination field associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_field_destination($field_destination) { + if (!is_string($field_destination)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'field_destination', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->field_destination = $field_destination; + return new c_base_return_true(); + } + + /** + * Assigns the response code field setting. + * + * @param int $field_response_code + * The response code field associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_field_response_code($field_response_code) { + if (!is_int($field_response_code)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'field_response_code', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->field_response_code = $field_response_code; + return new c_base_return_true(); + } + + /** + * Assigns the date created setting. + * + * @param float $date_created + * The date created associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_date_created($date_created) { + if (!is_float($date_created) && !is_int($date_created)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'date_created', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_created = (float) $date_created; + return new c_base_return_true(); + } + + /** + * Assigns the date changed setting. + * + * @param float $date_changed + * The date changed associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_date_changed($date_changed) { + if (!is_float($date_changed) && !is_int($date_changed)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'date_changed', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_changed = (float) $date_changed; + return new c_base_return_true(); + } + + /** + * Assigns the date locked setting. + * + * @param float $date_locked + * The date locked associated with the path. + * + * @return c_base_return_status + * TRUE on success, FALSE otherwise. + */ + public function set_date_locked($date_locked) { + if (!is_float($date_locked) && !is_int($date_locked)) { + $error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'date_locked', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->date_locked = (float) $date_locked; + return new c_base_return_true(); + } + + /** + * Gets the id setting. + * + * @return c_base_return_int|c_base_return_null + * ID on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_id() { + if (!is_int($this->id)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->id); + } + + /** + * Gets the ID group setting. + * + * @return c_base_return_int|c_base_return_null + * ID group on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_id_group() { + if (!is_string($this->id_group)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->id_group); + } + + /** + * Gets the machine name setting. + * + * @return c_base_return_string|c_base_return_null + * Machine name on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_name_machine() { + if (!is_string($this->name_machine)) { + return new c_base_return_null(); + } + + return c_base_return_string::s_new($this->name_machine); + } + + /** + * Gets the human name setting. + * + * @return c_base_return_string|c_base_return_null + * Human name boolean on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_name_human() { + if (!is_string($this->name_human)) { + return new c_base_return_null(); + } + + return c_base_return_string::s_new($this->name_human); + } + + /** + * Gets the is content boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is content on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_content() { + if (!is_bool($this->is_content)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_content); + } + + /** + * Gets the is alias boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is alias on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_alias() { + if (!is_bool($this->is_alias)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_alias); + } + + /** + * Gets the is redirect boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is redirect on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_redirect() { + if (!is_bool($this->is_redirect)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_redirect); + } + + /** + * Gets the is coded boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is coded on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_coded() { + if (!is_bool($this->is_coded)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_coded); + } + + /** + * Gets the is dynamic boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is dynamic on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_dynamic() { + if (!is_bool($this->is_dynamic)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_dynamic); + } + + /** + * Gets the is user boolean name setting. + * + * @return c_base_return_bool|c_base_return_null + * Is user on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_user() { + if (!is_bool($this->is_user)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_user); + } + + /** + * Gets the is private boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is private on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_private() { + if (!is_bool($this->is_private)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_private); + } + + /** + * Gets the is locked boolean setting. + * + * @return c_base_return_bool|c_base_return_null + * Is locked on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_is_locked() { + if (!is_bool($this->is_locked)) { + return new c_base_return_null(); + } + + return c_base_return_bool::s_new($this->is_locked); + } + + /** + * Gets the destination field setting. + * + * @return c_base_return_string|c_base_return_null + * Destination field on success. + * NULL is returned if the value is not assigned. + * Error bit is set on error. + */ + public function get_field_destination() { + if (!is_string($this->field_destination)) { + return new c_base_return_null(); + } + + return c_base_return_string::s_new($this->field_destination); + } + + /** + * Gets the response code field setting. + * + * @return c_base_return_int|c_base_return_null + * Response code on success. + * NULL is returned if date is not assigned. + * Error bit is set on error. + */ + public function get_field_response_code() { + if (!is_int($this->field_response_code)) { + return new c_base_return_null(); + } + + return c_base_return_int::s_new($this->field_response_code); + } + + /** + * Gets the date created setting. + * + * @return c_base_return_float|c_base_return_null + * Date created on success. + * NULL is returned if date is not assigned. + * Error bit is set on error. + */ + public function get_date_created() { + if (!is_float($this->date_created)) { + return new c_base_return_false(); + } + + return c_base_return_float::s_new($this->date_created); + } + + /** + * Gets the date changed setting. + * + * @return c_base_return_float|c_base_return_null + * Date changed on success. + * NULL is returned if date is not assigned. + * Error bit is set on error. + */ + public function get_date_changed() { + if (!is_float($this->date_changed)) { + return new c_base_return_null(); + } + + return c_base_return_float::s_new($this->date_changed); + } + + /** + * Gets the date locked setting. + * + * @return c_base_return_float|c_base_return_null + * Date locked on success. + * NULL is returned if date is not assigned. + * Error bit is set on error. + */ + public function get_date_locked() { + if (!is_float($this->date_locked)) { + return new c_base_return_null(); + } + + return c_base_return_float::s_new($this->date_locked); + } } diff --git a/common/theme/classes/theme_form.php b/common/theme/classes/theme_form.php index 8491b19..c1cce81 100644 --- a/common/theme/classes/theme_form.php +++ b/common/theme/classes/theme_form.php @@ -246,7 +246,7 @@ class c_theme_form_tag extends c_base_markup_tag { case self::ATTRIBUTE_WRAP: case self::ATTRIBUTE_VALUE: if (!is_string($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -258,14 +258,14 @@ class c_theme_form_tag extends c_base_markup_tag { case self::ATTRIBUTE_DISABLED: case self::ATTRIBUTE_MULTIPLE: if (!is_bool($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; case self::ATTRIBUTE_ACCEPT: case self::ATTRIBUTE_FORM_ENCODE_TYPE: if (!$this->pr_validate_value_mime_type($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; @@ -274,13 +274,13 @@ class c_theme_form_tag extends c_base_markup_tag { case self::ATTRIBUTE_MAXIMUM_LENGTH: case self::ATTRIBUTE_MINIMUM: if (!is_int($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; case self::ATTRIBUTE_FORM_METHOD: if (!$this->pr_validate_value_http_method($value)) { - return c_base_return_false(); + return new c_base_return_false(); } break; -- 1.8.3.1