/** * @param $table_column * @param $nice_name * @param $nullable * @param null $default_value * @param null $timezone * @param null $date_format * @param null $time_format * @param null $pretty_date_format * @param null $pretty_time_format */ public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone = NULL, $date_format = NULL, $time_format = NULL, $pretty_date_format = NULL, $pretty_time_format = NULL) { parent::__construct($table_column, $nice_name, $nullable, $default_value); $this->_date_format = empty($date_format) ? get_option('date_format') : $date_format; $this->_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_date_format); $this->_time_format = empty($time_format) ? get_option('time_format') : $time_format; $this->set_timezone($timezone); $this->_pretty_date_format = empty($pretty_date_format) ? get_option('date_format') : $pretty_date_format; $this->_pretty_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_pretty_date_format); $this->_pretty_time_format = empty($pretty_time_format) ? get_option('time_format') : $pretty_time_format; }
/** * Gets the 'normal' column named for fields * @param EE_Model_Field_Base $field * @return string */ protected function _get_column_name_for_field(EE_Model_Field_Base $field) { return $field->get_nicename() . "[" . $field->get_name() . "]"; }
/** * * @param mixed $value * @param EE_Model_Field_Base|string $field_obj if string it should be a wpdb data type like '%d' * @throws EE_Error * @return false|null|string */ private function _wpdb_prepare_using_field($value, $field_obj) { /** @type WPDB $wpdb */ global $wpdb; if ($field_obj instanceof EE_Model_Field_Base) { return $wpdb->prepare($field_obj->get_wpdb_data_type(), $this->_prepare_value_for_use_in_db($value, $field_obj)); } else { //$field_obj should really just be a data type if (!in_array($field_obj, $this->_valid_wpdb_data_types)) { throw new EE_Error(sprintf(__("%s is not a valid wpdb datatype. Valid ones are %s", "event_espresso"), $field_obj, implode(",", $this->_valid_wpdb_data_types))); } return $wpdb->prepare($field_obj, $value); } }
/** * In form inputs, we should have called htmlentities and addslashes on form inputs, * so we need to undo that on setting of these fields * @param string $value_inputted_for_field_on_model_object * @return string */ function prepare_for_set($value_inputted_for_field_on_model_object) { return stripslashes(html_entity_decode(parent::prepare_for_set($value_inputted_for_field_on_model_object), ENT_QUOTES, 'UTF-8')); }
/** * @param string $table_column * @param string $nice_name * @param bool $nullable * @param string $default_value * @param string $timezone_string * @param string $date_format * @param string $time_format * @param string $pretty_date_format * @param string $pretty_time_format */ public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') { $this->_date_format = !empty($date_format) ? $date_format : get_option('date_format'); $this->_time_format = !empty($time_format) ? $time_format : get_option('time_format'); $this->_pretty_date_format = !empty($pretty_date_format) ? $pretty_date_format : get_option('date_format'); $this->_pretty_time_format = !empty($pretty_time_format) ? $pretty_time_format : get_option('time_format'); parent::__construct($table_column, $nice_name, $nullable, $default_value); EE_Registry::instance()->load_helper('DTT_Helper'); $this->set_timezone($timezone_string); }
/** * Gets the 'normal' column named for fields * @param EE_Model_Field_Base $field * @return string */ public static function get_column_name_for_field(EE_Model_Field_Base $field) { return $field->get_nicename() . "[" . $field->get_name() . "]"; }
/** * * @param string $table_column name fo column for field * @param string $nicename should eb internationalized with __('blah','event_espresso') * @param boolean $nullable * @param mixed $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul dbe a string * @param string $model_name eg 'Event','Answer','Term', etc. Basically its the model class's name without the "EEM_" */ function __construct($table_column, $nicename, $nullable, $default_value, $model_name) { $this->_model_name = $model_name; parent::__construct($table_column, $nicename, $nullable, $default_value); }