@@ -13,58 +13,58 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class EE_Text_Input_Display_Strategy extends EE_Display_Strategy_Base |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * The html "type" attribute value. default is "text" |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - protected $_type; |
|
| 16 | + /** |
|
| 17 | + * The html "type" attribute value. default is "text" |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + protected $_type; |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param string $type |
|
| 26 | - */ |
|
| 27 | - public function __construct($type = 'text') |
|
| 28 | - { |
|
| 29 | - $this->_type = $type; |
|
| 30 | - parent::__construct(); |
|
| 31 | - } |
|
| 24 | + /** |
|
| 25 | + * @param string $type |
|
| 26 | + */ |
|
| 27 | + public function __construct($type = 'text') |
|
| 28 | + { |
|
| 29 | + $this->_type = $type; |
|
| 30 | + parent::__construct(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Gets the html "type" attribute's value |
|
| 37 | - * @return string |
|
| 38 | - */ |
|
| 39 | - public function get_type() |
|
| 40 | - { |
|
| 41 | - if ($this->_type === 'email' |
|
| 42 | - && ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false) |
|
| 43 | - ) { |
|
| 44 | - return 'text'; |
|
| 45 | - } |
|
| 46 | - return $this->_type; |
|
| 47 | - } |
|
| 35 | + /** |
|
| 36 | + * Gets the html "type" attribute's value |
|
| 37 | + * @return string |
|
| 38 | + */ |
|
| 39 | + public function get_type() |
|
| 40 | + { |
|
| 41 | + if ($this->_type === 'email' |
|
| 42 | + && ! apply_filters('FHEE__EE_Text_Input_Display_Strategy__use_html5_email', false) |
|
| 43 | + ) { |
|
| 44 | + return 'text'; |
|
| 45 | + } |
|
| 46 | + return $this->_type; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * |
|
| 53 | - * @return string of html to display the field |
|
| 54 | - */ |
|
| 55 | - public function display() |
|
| 56 | - { |
|
| 57 | - $input = '<input type="'. $this->get_type() .'"'; |
|
| 58 | - $input .= ' name="' . $this->_input->html_name() . '"'; |
|
| 59 | - $input .= ' id="' . $this->_input->html_id() . '"'; |
|
| 60 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
| 61 | - $input .= ' class="' . $class . '"'; |
|
| 62 | - // add html5 required |
|
| 63 | - $input .= $this->_input->required() ? ' required' : ''; |
|
| 64 | - $input .= ' value="' . $this->_input->raw_value_in_form() . '"'; |
|
| 65 | - $input .= ' style="' . $this->_input->html_style() . '"'; |
|
| 66 | - $input .= $this->_input->other_html_attributes(); |
|
| 67 | - $input .= '/>'; |
|
| 68 | - return $input; |
|
| 69 | - } |
|
| 51 | + /** |
|
| 52 | + * |
|
| 53 | + * @return string of html to display the field |
|
| 54 | + */ |
|
| 55 | + public function display() |
|
| 56 | + { |
|
| 57 | + $input = '<input type="'. $this->get_type() .'"'; |
|
| 58 | + $input .= ' name="' . $this->_input->html_name() . '"'; |
|
| 59 | + $input .= ' id="' . $this->_input->html_id() . '"'; |
|
| 60 | + $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
| 61 | + $input .= ' class="' . $class . '"'; |
|
| 62 | + // add html5 required |
|
| 63 | + $input .= $this->_input->required() ? ' required' : ''; |
|
| 64 | + $input .= ' value="' . $this->_input->raw_value_in_form() . '"'; |
|
| 65 | + $input .= ' style="' . $this->_input->html_style() . '"'; |
|
| 66 | + $input .= $this->_input->other_html_attributes(); |
|
| 67 | + $input .= '/>'; |
|
| 68 | + return $input; |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -15,37 +15,37 @@ |
||
| 15 | 15 | interface FileSubmissionInterface |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @return string |
|
| 20 | - */ |
|
| 21 | - public function getName(); |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public function getType(); |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @return int |
|
| 30 | - */ |
|
| 31 | - public function getSize(); |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 36 | - public function getTmpFile(); |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Should just return the filename. |
|
| 40 | - * @since $VID:$ |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function __toString(); |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @return string |
|
| 47 | - */ |
|
| 48 | - public function getErrorCode(); |
|
| 18 | + /** |
|
| 19 | + * @return string |
|
| 20 | + */ |
|
| 21 | + public function getName(); |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public function getType(); |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @return int |
|
| 30 | + */ |
|
| 31 | + public function getSize(); |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | + public function getTmpFile(); |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Should just return the filename. |
|
| 40 | + * @since $VID:$ |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function __toString(); |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @return string |
|
| 47 | + */ |
|
| 48 | + public function getErrorCode(); |
|
| 49 | 49 | } |
| 50 | 50 | // End of file FileSubmissionInterface.php |
| 51 | 51 | // Location: EventEspresso\core\services\request\files/FileSubmissionInterface.php |
@@ -13,40 +13,40 @@ |
||
| 13 | 13 | class EE_File_Normalization extends EE_Normalization_Strategy_Base |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Keep in mind $value_to_normalize should be a FileSubmissionInterface or null, so this shouldn't really do |
|
| 18 | - * much (other than NOT convert it to a string or something). |
|
| 19 | - * @param string $value_to_normalize |
|
| 20 | - * @return FileSubmissionInterface |
|
| 21 | - */ |
|
| 22 | - public function normalize($value_to_normalize) |
|
| 23 | - { |
|
| 24 | - if ($value_to_normalize instanceof FileSubmissionInterface || is_null($value_to_normalize)) { |
|
| 25 | - return $value_to_normalize; |
|
| 26 | - } else { |
|
| 27 | - throw new EE_Validation_Error( |
|
| 28 | - esc_html__('The file input has an inavlid format.', 'event_espresso') |
|
| 29 | - ); |
|
| 30 | - } |
|
| 31 | - } |
|
| 16 | + /** |
|
| 17 | + * Keep in mind $value_to_normalize should be a FileSubmissionInterface or null, so this shouldn't really do |
|
| 18 | + * much (other than NOT convert it to a string or something). |
|
| 19 | + * @param string $value_to_normalize |
|
| 20 | + * @return FileSubmissionInterface |
|
| 21 | + */ |
|
| 22 | + public function normalize($value_to_normalize) |
|
| 23 | + { |
|
| 24 | + if ($value_to_normalize instanceof FileSubmissionInterface || is_null($value_to_normalize)) { |
|
| 25 | + return $value_to_normalize; |
|
| 26 | + } else { |
|
| 27 | + throw new EE_Validation_Error( |
|
| 28 | + esc_html__('The file input has an inavlid format.', 'event_espresso') |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * This may be called prematurely on submitted data, so we actually don't want to convert it into a string because |
|
| 36 | - * we'll lose all the FileSubmissionInterface data. So prefer to leave it alone. FileSubmissionInterface |
|
| 37 | - * can be cast to a string just fine so it's good as-is. |
|
| 38 | - * |
|
| 39 | - * @param string $normalized_value |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function unnormalize($normalized_value) |
|
| 43 | - { |
|
| 44 | - if ($normalized_value instanceof FileSubmissionInterface || is_null($normalized_value)) { |
|
| 45 | - // Leave it as the object, it can be treated like a string because it |
|
| 46 | - // overrides __toString() |
|
| 47 | - return $normalized_value; |
|
| 48 | - } else { |
|
| 49 | - return (string) $normalized_value; |
|
| 50 | - } |
|
| 51 | - } |
|
| 34 | + /** |
|
| 35 | + * This may be called prematurely on submitted data, so we actually don't want to convert it into a string because |
|
| 36 | + * we'll lose all the FileSubmissionInterface data. So prefer to leave it alone. FileSubmissionInterface |
|
| 37 | + * can be cast to a string just fine so it's good as-is. |
|
| 38 | + * |
|
| 39 | + * @param string $normalized_value |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function unnormalize($normalized_value) |
|
| 43 | + { |
|
| 44 | + if ($normalized_value instanceof FileSubmissionInterface || is_null($normalized_value)) { |
|
| 45 | + // Leave it as the object, it can be treated like a string because it |
|
| 46 | + // overrides __toString() |
|
| 47 | + return $normalized_value; |
|
| 48 | + } else { |
|
| 49 | + return (string) $normalized_value; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | 52 | } |