@@ -9,40 +9,40 @@ |
||
9 | 9 | abstract class EE_Form_Input_Strategy_Base |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * Form Input to display |
|
14 | - * |
|
15 | - * @var EE_Form_Input_Base |
|
16 | - */ |
|
17 | - protected $_input; |
|
12 | + /** |
|
13 | + * Form Input to display |
|
14 | + * |
|
15 | + * @var EE_Form_Input_Base |
|
16 | + */ |
|
17 | + protected $_input; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * The form input on which this strategy is to perform |
|
29 | - * |
|
30 | - * @param EE_Form_Input_Base $form_input |
|
31 | - */ |
|
32 | - public function _construct_finalize(EE_Form_Input_Base $form_input) |
|
33 | - { |
|
34 | - $this->_input = $form_input; |
|
35 | - } |
|
27 | + /** |
|
28 | + * The form input on which this strategy is to perform |
|
29 | + * |
|
30 | + * @param EE_Form_Input_Base $form_input |
|
31 | + */ |
|
32 | + public function _construct_finalize(EE_Form_Input_Base $form_input) |
|
33 | + { |
|
34 | + $this->_input = $form_input; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * Gets this strategy's input |
|
41 | - * |
|
42 | - * @return EE_Form_Input_Base |
|
43 | - */ |
|
44 | - public function get_input() |
|
45 | - { |
|
46 | - return $this->_input; |
|
47 | - } |
|
39 | + /** |
|
40 | + * Gets this strategy's input |
|
41 | + * |
|
42 | + * @return EE_Form_Input_Base |
|
43 | + */ |
|
44 | + public function get_input() |
|
45 | + { |
|
46 | + return $this->_input; |
|
47 | + } |
|
48 | 48 | } |
@@ -12,29 +12,29 @@ |
||
12 | 12 | class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @return string of html to display the input |
|
17 | - */ |
|
18 | - public function display() |
|
19 | - { |
|
20 | - $default_value = $this->_input->get_default(); |
|
21 | - if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | - $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | - } |
|
24 | - $html = $this->_opening_tag('input'); |
|
25 | - $html .= $this->_attributes_string( |
|
26 | - array_merge( |
|
27 | - $this->_standard_attributes_array(), |
|
28 | - array( |
|
29 | - 'type' => 'submit', |
|
30 | - 'value' => $default_value, |
|
31 | - // overwrite the standard id with the backwards compatible one |
|
32 | - 'id' => $this->_input->html_id() . '-submit', |
|
33 | - 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
34 | - ) |
|
35 | - ) |
|
36 | - ); |
|
37 | - $html .= $this->_close_tag(); |
|
38 | - return $html; |
|
39 | - } |
|
15 | + /** |
|
16 | + * @return string of html to display the input |
|
17 | + */ |
|
18 | + public function display() |
|
19 | + { |
|
20 | + $default_value = $this->_input->get_default(); |
|
21 | + if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) { |
|
22 | + $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value); |
|
23 | + } |
|
24 | + $html = $this->_opening_tag('input'); |
|
25 | + $html .= $this->_attributes_string( |
|
26 | + array_merge( |
|
27 | + $this->_standard_attributes_array(), |
|
28 | + array( |
|
29 | + 'type' => 'submit', |
|
30 | + 'value' => $default_value, |
|
31 | + // overwrite the standard id with the backwards compatible one |
|
32 | + 'id' => $this->_input->html_id() . '-submit', |
|
33 | + 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
34 | + ) |
|
35 | + ) |
|
36 | + ); |
|
37 | + $html .= $this->_close_tag(); |
|
38 | + return $html; |
|
39 | + } |
|
40 | 40 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | 'type' => 'submit', |
30 | 30 | 'value' => $default_value, |
31 | 31 | // overwrite the standard id with the backwards compatible one |
32 | - 'id' => $this->_input->html_id() . '-submit', |
|
33 | - 'class' => $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() |
|
32 | + 'id' => $this->_input->html_id().'-submit', |
|
33 | + 'class' => $this->_input->html_class().' '.$this->_input->button_css_attributes() |
|
34 | 34 | ) |
35 | 35 | ) |
36 | 36 | ); |
@@ -11,13 +11,13 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Hidden_Display_Strategy extends EE_Display_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * |
|
16 | - * @return string of html to display the HIDDEN field |
|
17 | - */ |
|
18 | - public function display() |
|
19 | - { |
|
20 | - $input = $this->_input; |
|
21 | - return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>"; |
|
22 | - } |
|
14 | + /** |
|
15 | + * |
|
16 | + * @return string of html to display the HIDDEN field |
|
17 | + */ |
|
18 | + public function display() |
|
19 | + { |
|
20 | + $input = $this->_input; |
|
21 | + return "<input type='hidden' id='{$input->html_id()}' name='{$input->html_name()}' class='{$input->html_class()}' style='{$input->html_style()}' value='{$input->raw_value_in_form()}' {$input->other_html_attributes()}/>"; |
|
22 | + } |
|
23 | 23 | } |
@@ -12,54 +12,54 @@ |
||
12 | 12 | class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * |
|
17 | - * @throws EE_Error |
|
18 | - * @return string of html to display the field |
|
19 | - */ |
|
20 | - public function display() |
|
21 | - { |
|
15 | + /** |
|
16 | + * |
|
17 | + * @throws EE_Error |
|
18 | + * @return string of html to display the field |
|
19 | + */ |
|
20 | + public function display() |
|
21 | + { |
|
22 | 22 | |
23 | - if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
24 | - throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso"))); |
|
25 | - } |
|
23 | + if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
24 | + throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso"))); |
|
25 | + } |
|
26 | 26 | |
27 | - $html = EEH_HTML::nl(0, 'select'); |
|
28 | - $html .= '<select multiple'; |
|
29 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
30 | - $html .= ' name="' . $this->_input->html_name() . '[]"'; |
|
31 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
32 | - $html .= ' class="' . $class . '"'; |
|
33 | - // add html5 required |
|
34 | - $html .= $this->_input->required() ? ' required' : ''; |
|
35 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
36 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
37 | - $html .= '>'; |
|
27 | + $html = EEH_HTML::nl(0, 'select'); |
|
28 | + $html .= '<select multiple'; |
|
29 | + $html .= ' id="' . $this->_input->html_id() . '"'; |
|
30 | + $html .= ' name="' . $this->_input->html_name() . '[]"'; |
|
31 | + $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
32 | + $html .= ' class="' . $class . '"'; |
|
33 | + // add html5 required |
|
34 | + $html .= $this->_input->required() ? ' required' : ''; |
|
35 | + $html .= ' style="' . $this->_input->html_style() . '"'; |
|
36 | + $html .= ' ' . $this->_input->other_html_attributes(); |
|
37 | + $html .= '>'; |
|
38 | 38 | |
39 | - EEH_HTML::indent(1, 'select'); |
|
40 | - if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
41 | - throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
|
42 | - } else { |
|
43 | - $html.=$this->_display_options($this->_input->options()); |
|
44 | - } |
|
39 | + EEH_HTML::indent(1, 'select'); |
|
40 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
41 | + throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
|
42 | + } else { |
|
43 | + $html.=$this->_display_options($this->_input->options()); |
|
44 | + } |
|
45 | 45 | |
46 | - $html.= EEH_HTML::nl(-1, 'select') . "</select>"; |
|
47 | - return $html; |
|
48 | - } |
|
46 | + $html.= EEH_HTML::nl(-1, 'select') . "</select>"; |
|
47 | + return $html; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Checks if that $value is one of the selected ones |
|
54 | - * @param string|int $value unnormalized value option (string) |
|
55 | - * @return boolean |
|
56 | - */ |
|
57 | - protected function _check_if_option_selected($value) |
|
58 | - { |
|
59 | - $selected_options = $this->_input->raw_value(); |
|
60 | - if (empty($selected_options)) { |
|
61 | - return false; |
|
62 | - } |
|
63 | - return in_array($value, $selected_options) ? true : false; |
|
64 | - } |
|
52 | + /** |
|
53 | + * Checks if that $value is one of the selected ones |
|
54 | + * @param string|int $value unnormalized value option (string) |
|
55 | + * @return boolean |
|
56 | + */ |
|
57 | + protected function _check_if_option_selected($value) |
|
58 | + { |
|
59 | + $selected_options = $this->_input->raw_value(); |
|
60 | + if (empty($selected_options)) { |
|
61 | + return false; |
|
62 | + } |
|
63 | + return in_array($value, $selected_options) ? true : false; |
|
64 | + } |
|
65 | 65 | } |
@@ -20,30 +20,30 @@ |
||
20 | 20 | public function display() |
21 | 21 | { |
22 | 22 | |
23 | - if (! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
23 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
24 | 24 | throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso"))); |
25 | 25 | } |
26 | 26 | |
27 | 27 | $html = EEH_HTML::nl(0, 'select'); |
28 | 28 | $html .= '<select multiple'; |
29 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
30 | - $html .= ' name="' . $this->_input->html_name() . '[]"'; |
|
31 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
32 | - $html .= ' class="' . $class . '"'; |
|
29 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
30 | + $html .= ' name="'.$this->_input->html_name().'[]"'; |
|
31 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
32 | + $html .= ' class="'.$class.'"'; |
|
33 | 33 | // add html5 required |
34 | 34 | $html .= $this->_input->required() ? ' required' : ''; |
35 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
36 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
35 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
36 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
37 | 37 | $html .= '>'; |
38 | 38 | |
39 | 39 | EEH_HTML::indent(1, 'select'); |
40 | 40 | if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
41 | 41 | throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
42 | 42 | } else { |
43 | - $html.=$this->_display_options($this->_input->options()); |
|
43 | + $html .= $this->_display_options($this->_input->options()); |
|
44 | 44 | } |
45 | 45 | |
46 | - $html.= EEH_HTML::nl(-1, 'select') . "</select>"; |
|
46 | + $html .= EEH_HTML::nl(-1, 'select')."</select>"; |
|
47 | 47 | return $html; |
48 | 48 | } |
49 | 49 |
@@ -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 | } |
@@ -54,15 +54,15 @@ |
||
54 | 54 | */ |
55 | 55 | public function display() |
56 | 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 . '"'; |
|
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 | 62 | // add html5 required |
63 | 63 | $input .= $this->_input->required() ? ' required' : ''; |
64 | - $input .= ' value="' . $this->_input->raw_value_in_form() . '"'; |
|
65 | - $input .= ' style="' . $this->_input->html_style() . '"'; |
|
64 | + $input .= ' value="'.$this->_input->raw_value_in_form().'"'; |
|
65 | + $input .= ' style="'.$this->_input->html_style().'"'; |
|
66 | 66 | $input .= $this->_input->other_html_attributes(); |
67 | 67 | $input .= '/>'; |
68 | 68 | return $input; |
@@ -11,73 +11,73 @@ |
||
11 | 11 | class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * Its important this media only get enqueued AFTER init, but before the footer... where the |
|
16 | - * rest of our forms JS gets enqueued. Otherwise the JS gets enqueued fine, and loaded on the page fine, |
|
17 | - * but when you upload an image it gets uploaded fine to the server, but it doesn't display and reports an error |
|
18 | - * (also it doesn't show any of the currently existing media in the modal window that pops up when you click the button |
|
19 | - * to select media). |
|
20 | - * Besides that, no special consideration should be required to make the media uploader appear, besides having |
|
21 | - * this input displayed. |
|
22 | - * @deprecated. enqueue_js should be called automatically now |
|
23 | - */ |
|
24 | - public static function enqueue_scripts() |
|
25 | - { |
|
26 | - EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form', 'event_espresso'), '4.9.8.rc.015'); |
|
27 | - wp_enqueue_media(); |
|
28 | - wp_enqueue_script('media-upload'); |
|
29 | - wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
30 | - } |
|
14 | + /** |
|
15 | + * Its important this media only get enqueued AFTER init, but before the footer... where the |
|
16 | + * rest of our forms JS gets enqueued. Otherwise the JS gets enqueued fine, and loaded on the page fine, |
|
17 | + * but when you upload an image it gets uploaded fine to the server, but it doesn't display and reports an error |
|
18 | + * (also it doesn't show any of the currently existing media in the modal window that pops up when you click the button |
|
19 | + * to select media). |
|
20 | + * Besides that, no special consideration should be required to make the media uploader appear, besides having |
|
21 | + * this input displayed. |
|
22 | + * @deprecated. enqueue_js should be called automatically now |
|
23 | + */ |
|
24 | + public static function enqueue_scripts() |
|
25 | + { |
|
26 | + EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form', 'event_espresso'), '4.9.8.rc.015'); |
|
27 | + wp_enqueue_media(); |
|
28 | + wp_enqueue_script('media-upload'); |
|
29 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Enqueues the JS and CSS needed to display this input |
|
34 | - */ |
|
35 | - public function enqueue_js() |
|
36 | - { |
|
37 | - wp_enqueue_media(); |
|
38 | - wp_enqueue_script('media-upload'); |
|
39 | - wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
40 | - parent::enqueue_js(); |
|
41 | - } |
|
32 | + /** |
|
33 | + * Enqueues the JS and CSS needed to display this input |
|
34 | + */ |
|
35 | + public function enqueue_js() |
|
36 | + { |
|
37 | + wp_enqueue_media(); |
|
38 | + wp_enqueue_script('media-upload'); |
|
39 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
40 | + parent::enqueue_js(); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * |
|
47 | - * @return string of html to display the field |
|
48 | - */ |
|
45 | + /** |
|
46 | + * |
|
47 | + * @return string of html to display the field |
|
48 | + */ |
|
49 | 49 | |
50 | - public function display() |
|
51 | - { |
|
52 | - // the actual input |
|
53 | - $input = '<input type="text" size="34" '; |
|
54 | - $input .= 'name="' . $this->_input->html_name() . '" '; |
|
55 | - $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
56 | - $input .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
57 | - $input .= $this->_input->other_html_attributes() . '>'; |
|
58 | - // image uploader |
|
59 | - $uploader = EEH_HTML::link('#', '<img src="' . admin_url('images/media-button-image.gif') . '" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
60 | - // only attempt to show the image if it at least exists |
|
61 | - $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2) . EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
62 | - // html string |
|
63 | - return EEH_HTML::div($input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area'); |
|
64 | - } |
|
50 | + public function display() |
|
51 | + { |
|
52 | + // the actual input |
|
53 | + $input = '<input type="text" size="34" '; |
|
54 | + $input .= 'name="' . $this->_input->html_name() . '" '; |
|
55 | + $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
56 | + $input .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
57 | + $input .= $this->_input->other_html_attributes() . '>'; |
|
58 | + // image uploader |
|
59 | + $uploader = EEH_HTML::link('#', '<img src="' . admin_url('images/media-button-image.gif') . '" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
60 | + // only attempt to show the image if it at least exists |
|
61 | + $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2) . EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
62 | + // html string |
|
63 | + return EEH_HTML::div($input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area'); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Asserts an image actually exists as quickly as possible by sending a HEAD |
|
70 | - * request |
|
71 | - * @param string $src |
|
72 | - * @return boolean |
|
73 | - */ |
|
74 | - protected function src_exists($src) |
|
75 | - { |
|
76 | - $results = wp_remote_head($src); |
|
77 | - if (is_array($results) && ! $results instanceof WP_Error) { |
|
78 | - return strpos($results['headers']['content-type'], "image") !== false; |
|
79 | - } else { |
|
80 | - return false; |
|
81 | - } |
|
82 | - } |
|
68 | + /** |
|
69 | + * Asserts an image actually exists as quickly as possible by sending a HEAD |
|
70 | + * request |
|
71 | + * @param string $src |
|
72 | + * @return boolean |
|
73 | + */ |
|
74 | + protected function src_exists($src) |
|
75 | + { |
|
76 | + $results = wp_remote_head($src); |
|
77 | + if (is_array($results) && ! $results instanceof WP_Error) { |
|
78 | + return strpos($results['headers']['content-type'], "image") !== false; |
|
79 | + } else { |
|
80 | + return false; |
|
81 | + } |
|
82 | + } |
|
83 | 83 | } |
@@ -51,16 +51,16 @@ |
||
51 | 51 | { |
52 | 52 | // the actual input |
53 | 53 | $input = '<input type="text" size="34" '; |
54 | - $input .= 'name="' . $this->_input->html_name() . '" '; |
|
55 | - $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
56 | - $input .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
57 | - $input .= $this->_input->other_html_attributes() . '>'; |
|
54 | + $input .= 'name="'.$this->_input->html_name().'" '; |
|
55 | + $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" '; |
|
56 | + $input .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
57 | + $input .= $this->_input->other_html_attributes().'>'; |
|
58 | 58 | // image uploader |
59 | - $uploader = EEH_HTML::link('#', '<img src="' . admin_url('images/media-button-image.gif') . '" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
59 | + $uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
60 | 60 | // only attempt to show the image if it at least exists |
61 | - $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2) . EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
61 | + $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
62 | 62 | // html string |
63 | - return EEH_HTML::div($input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area'); |
|
63 | + return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 |
@@ -11,236 +11,236 @@ |
||
11 | 11 | { |
12 | 12 | |
13 | 13 | |
14 | - /** |
|
15 | - * @var string $_tag |
|
16 | - */ |
|
17 | - protected $_tag = ''; |
|
14 | + /** |
|
15 | + * @var string $_tag |
|
16 | + */ |
|
17 | + protected $_tag = ''; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * returns HTML and javascript related to the displaying of this input |
|
25 | - * |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - abstract public function display(); |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * returns HTML and javascript related to the displaying of this input |
|
25 | + * |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + abstract public function display(); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars |
|
34 | - * is already there |
|
35 | - * |
|
36 | - * @param string $string - the string being processed |
|
37 | - * @param string $chars - exact string of characters to remove |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - protected function _remove_chars($string = '', $chars = '-') |
|
41 | - { |
|
42 | - $char_length = strlen($chars) * -1; |
|
43 | - // if last three characters of string is " - ", then remove it |
|
44 | - return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string; |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not |
|
51 | - * already there |
|
52 | - * |
|
53 | - * @param string $string - the string being processed |
|
54 | - * @param string $chars - exact string of characters to be added to end of string |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - protected function _append_chars($string = '', $chars = '-') |
|
58 | - { |
|
59 | - return $this->_remove_chars($string, $chars) . $chars; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * Gets the HTML IDs of all the inputs |
|
66 | - * |
|
67 | - * @param bool $add_pound_sign |
|
68 | - * @return array |
|
69 | - */ |
|
70 | - public function get_html_input_ids($add_pound_sign = false) |
|
71 | - { |
|
72 | - return array($this->get_input()->html_id($add_pound_sign)); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Adds js variables for localization to the $other_js_data. These should be put |
|
79 | - * in each form's "other_data" javascript object. |
|
80 | - * |
|
81 | - * @param array $other_js_data |
|
82 | - * @return array |
|
83 | - */ |
|
84 | - public function get_other_js_data($other_js_data = array()) |
|
85 | - { |
|
86 | - return $other_js_data; |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style. |
|
93 | - * This should be called during wp_enqueue_scripts |
|
94 | - */ |
|
95 | - public function enqueue_js() |
|
96 | - { |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * returns string like: '<tag' |
|
103 | - * |
|
104 | - * @param string $tag |
|
105 | - * @return string |
|
106 | - */ |
|
107 | - protected function _opening_tag($tag) |
|
108 | - { |
|
109 | - $this->_tag = $tag; |
|
110 | - return "<{$this->_tag}"; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * returns string like: '</tag> |
|
117 | - * |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - protected function _closing_tag() |
|
121 | - { |
|
122 | - return "</{$this->_tag}>"; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * returns string like: '/>' |
|
129 | - * |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - protected function _close_tag() |
|
133 | - { |
|
134 | - return '/>'; |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * returns an array of standard HTML attributes that get added to nearly all inputs, |
|
141 | - * where string keys represent named attributes like id, class, etc |
|
142 | - * and numeric keys represent single attributes like 'required'. |
|
143 | - * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use |
|
144 | - * it. |
|
145 | - * |
|
146 | - * @return array |
|
147 | - */ |
|
148 | - protected function _standard_attributes_array() |
|
149 | - { |
|
150 | - return array( |
|
151 | - 'name' => $this->_input->html_name(), |
|
152 | - 'id' => $this->_input->html_id(), |
|
153 | - 'class' => $this->_input->html_class(true), |
|
154 | - 0 => array('required', $this->_input->required()), |
|
155 | - 1 => $this->_input->other_html_attributes(), |
|
156 | - 'style' => $this->_input->html_style(), |
|
157 | - ); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * sets the attributes using the incoming array |
|
164 | - * and returns a string of all attributes rendered as valid HTML |
|
165 | - * |
|
166 | - * @param array $attributes |
|
167 | - * @return string |
|
168 | - */ |
|
169 | - protected function _attributes_string($attributes = array()) |
|
170 | - { |
|
171 | - $attributes = apply_filters( |
|
172 | - 'FHEE__EE_Display_Strategy_Base__attributes_string__attributes', |
|
173 | - $attributes, |
|
174 | - $this, |
|
175 | - $this->_input |
|
176 | - ); |
|
177 | - $attributes_string = ''; |
|
178 | - foreach ($attributes as $attribute => $value) { |
|
179 | - if (is_numeric($attribute)) { |
|
180 | - $add = true; |
|
181 | - if (is_array($value)) { |
|
182 | - $attribute = isset($value[0]) ? $value[0] : ''; |
|
183 | - $add = isset($value[1]) ? $value[1] : false; |
|
184 | - } else { |
|
185 | - $attribute = $value; |
|
186 | - } |
|
187 | - $attributes_string .= $this->_single_attribute($attribute, $add); |
|
188 | - } else { |
|
189 | - $attributes_string .= $this->_attribute($attribute, $value); |
|
190 | - } |
|
191 | - } |
|
192 | - return $attributes_string; |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * returns string like: ' attribute="value"' |
|
199 | - * returns an empty string if $value is null |
|
200 | - * |
|
201 | - * @param string $attribute |
|
202 | - * @param string $value |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - protected function _attribute($attribute, $value = '') |
|
206 | - { |
|
207 | - if ($value === null) { |
|
208 | - return ''; |
|
209 | - } |
|
210 | - $value = esc_attr($value); |
|
211 | - return " {$attribute}=\"{$value}\""; |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * returns string like: ' data-attribute="value"' |
|
218 | - * returns an empty string if $value is null |
|
219 | - * |
|
220 | - * @param string $attribute |
|
221 | - * @param string $value |
|
222 | - * @return string |
|
223 | - */ |
|
224 | - protected function _data_attribute($attribute, $value = '') |
|
225 | - { |
|
226 | - if ($value === null) { |
|
227 | - return ''; |
|
228 | - } |
|
229 | - $value = esc_attr($value); |
|
230 | - return " data-{$attribute}=\"{$value}\""; |
|
231 | - } |
|
232 | - |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * returns string like: ' attribute' if $add is true |
|
237 | - * |
|
238 | - * @param string $attribute |
|
239 | - * @param boolean $add |
|
240 | - * @return string |
|
241 | - */ |
|
242 | - protected function _single_attribute($attribute, $add = true) |
|
243 | - { |
|
244 | - return $add ? " {$attribute}" : ''; |
|
245 | - } |
|
32 | + /** |
|
33 | + * _remove_chars - takes an incoming string, and removes the string $chars from the end of it, but only if $chars |
|
34 | + * is already there |
|
35 | + * |
|
36 | + * @param string $string - the string being processed |
|
37 | + * @param string $chars - exact string of characters to remove |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + protected function _remove_chars($string = '', $chars = '-') |
|
41 | + { |
|
42 | + $char_length = strlen($chars) * -1; |
|
43 | + // if last three characters of string is " - ", then remove it |
|
44 | + return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string; |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * _append_chars - takes an incoming string, and adds the string $chars to the end of it, but only if $chars is not |
|
51 | + * already there |
|
52 | + * |
|
53 | + * @param string $string - the string being processed |
|
54 | + * @param string $chars - exact string of characters to be added to end of string |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + protected function _append_chars($string = '', $chars = '-') |
|
58 | + { |
|
59 | + return $this->_remove_chars($string, $chars) . $chars; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * Gets the HTML IDs of all the inputs |
|
66 | + * |
|
67 | + * @param bool $add_pound_sign |
|
68 | + * @return array |
|
69 | + */ |
|
70 | + public function get_html_input_ids($add_pound_sign = false) |
|
71 | + { |
|
72 | + return array($this->get_input()->html_id($add_pound_sign)); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Adds js variables for localization to the $other_js_data. These should be put |
|
79 | + * in each form's "other_data" javascript object. |
|
80 | + * |
|
81 | + * @param array $other_js_data |
|
82 | + * @return array |
|
83 | + */ |
|
84 | + public function get_other_js_data($other_js_data = array()) |
|
85 | + { |
|
86 | + return $other_js_data; |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * Opportunity for this display strategy to call wp_enqueue_script and wp_enqueue_style. |
|
93 | + * This should be called during wp_enqueue_scripts |
|
94 | + */ |
|
95 | + public function enqueue_js() |
|
96 | + { |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * returns string like: '<tag' |
|
103 | + * |
|
104 | + * @param string $tag |
|
105 | + * @return string |
|
106 | + */ |
|
107 | + protected function _opening_tag($tag) |
|
108 | + { |
|
109 | + $this->_tag = $tag; |
|
110 | + return "<{$this->_tag}"; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * returns string like: '</tag> |
|
117 | + * |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + protected function _closing_tag() |
|
121 | + { |
|
122 | + return "</{$this->_tag}>"; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * returns string like: '/>' |
|
129 | + * |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + protected function _close_tag() |
|
133 | + { |
|
134 | + return '/>'; |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * returns an array of standard HTML attributes that get added to nearly all inputs, |
|
141 | + * where string keys represent named attributes like id, class, etc |
|
142 | + * and numeric keys represent single attributes like 'required'. |
|
143 | + * Note: this does not include "value" because many inputs (like dropdowns, textareas, and checkboxes) don't use |
|
144 | + * it. |
|
145 | + * |
|
146 | + * @return array |
|
147 | + */ |
|
148 | + protected function _standard_attributes_array() |
|
149 | + { |
|
150 | + return array( |
|
151 | + 'name' => $this->_input->html_name(), |
|
152 | + 'id' => $this->_input->html_id(), |
|
153 | + 'class' => $this->_input->html_class(true), |
|
154 | + 0 => array('required', $this->_input->required()), |
|
155 | + 1 => $this->_input->other_html_attributes(), |
|
156 | + 'style' => $this->_input->html_style(), |
|
157 | + ); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * sets the attributes using the incoming array |
|
164 | + * and returns a string of all attributes rendered as valid HTML |
|
165 | + * |
|
166 | + * @param array $attributes |
|
167 | + * @return string |
|
168 | + */ |
|
169 | + protected function _attributes_string($attributes = array()) |
|
170 | + { |
|
171 | + $attributes = apply_filters( |
|
172 | + 'FHEE__EE_Display_Strategy_Base__attributes_string__attributes', |
|
173 | + $attributes, |
|
174 | + $this, |
|
175 | + $this->_input |
|
176 | + ); |
|
177 | + $attributes_string = ''; |
|
178 | + foreach ($attributes as $attribute => $value) { |
|
179 | + if (is_numeric($attribute)) { |
|
180 | + $add = true; |
|
181 | + if (is_array($value)) { |
|
182 | + $attribute = isset($value[0]) ? $value[0] : ''; |
|
183 | + $add = isset($value[1]) ? $value[1] : false; |
|
184 | + } else { |
|
185 | + $attribute = $value; |
|
186 | + } |
|
187 | + $attributes_string .= $this->_single_attribute($attribute, $add); |
|
188 | + } else { |
|
189 | + $attributes_string .= $this->_attribute($attribute, $value); |
|
190 | + } |
|
191 | + } |
|
192 | + return $attributes_string; |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * returns string like: ' attribute="value"' |
|
199 | + * returns an empty string if $value is null |
|
200 | + * |
|
201 | + * @param string $attribute |
|
202 | + * @param string $value |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + protected function _attribute($attribute, $value = '') |
|
206 | + { |
|
207 | + if ($value === null) { |
|
208 | + return ''; |
|
209 | + } |
|
210 | + $value = esc_attr($value); |
|
211 | + return " {$attribute}=\"{$value}\""; |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * returns string like: ' data-attribute="value"' |
|
218 | + * returns an empty string if $value is null |
|
219 | + * |
|
220 | + * @param string $attribute |
|
221 | + * @param string $value |
|
222 | + * @return string |
|
223 | + */ |
|
224 | + protected function _data_attribute($attribute, $value = '') |
|
225 | + { |
|
226 | + if ($value === null) { |
|
227 | + return ''; |
|
228 | + } |
|
229 | + $value = esc_attr($value); |
|
230 | + return " data-{$attribute}=\"{$value}\""; |
|
231 | + } |
|
232 | + |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * returns string like: ' attribute' if $add is true |
|
237 | + * |
|
238 | + * @param string $attribute |
|
239 | + * @param boolean $add |
|
240 | + * @return string |
|
241 | + */ |
|
242 | + protected function _single_attribute($attribute, $add = true) |
|
243 | + { |
|
244 | + return $add ? " {$attribute}" : ''; |
|
245 | + } |
|
246 | 246 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | protected function _append_chars($string = '', $chars = '-') |
58 | 58 | { |
59 | - return $this->_remove_chars($string, $chars) . $chars; |
|
59 | + return $this->_remove_chars($string, $chars).$chars; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |
@@ -4,42 +4,42 @@ |
||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | - /** |
|
8 | - * |
|
9 | - * @return string of html to display the field |
|
10 | - */ |
|
11 | - public function display() |
|
12 | - { |
|
13 | - $input = $this->_input; |
|
14 | - $raw_value = maybe_serialize($input->raw_value()); |
|
15 | - if ($input instanceof EE_Text_Area_Input) { |
|
16 | - $rows = $input->get_rows(); |
|
17 | - $cols = $input->get_cols(); |
|
18 | - } else { |
|
19 | - $rows = 4; |
|
20 | - $cols = 20; |
|
21 | - } |
|
22 | - $html = '<textarea'; |
|
23 | - $html .= ' id="' . $input->html_id() . '"'; |
|
24 | - $html .= ' name="' . $input->html_name() . '"'; |
|
25 | - $html .= ' class="' . $input->html_class() . '"' ; |
|
26 | - $html .= ' style="' . $input->html_style() . '"'; |
|
27 | - $html .= $input->other_html_attributes(); |
|
28 | - $html .= ' rows= "' . $rows . '" cols="' . $cols . '">'; |
|
29 | - $html .= esc_textarea($raw_value); |
|
30 | - $html .= '</textarea>'; |
|
31 | - foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
32 | - if ($validation_strategy instanceof EE_Simple_HTML_Validation_Strategy |
|
33 | - || $validation_strategy instanceof EE_Full_HTML_Validation_Strategy |
|
34 | - ) { |
|
35 | - $html .= sprintf( |
|
36 | - __('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'), |
|
37 | - '<p class="ee-question-desc">', |
|
38 | - $validation_strategy->get_list_of_allowed_tags(), |
|
39 | - '</p>' |
|
40 | - ); |
|
41 | - } |
|
42 | - } |
|
43 | - return $html; |
|
44 | - } |
|
7 | + /** |
|
8 | + * |
|
9 | + * @return string of html to display the field |
|
10 | + */ |
|
11 | + public function display() |
|
12 | + { |
|
13 | + $input = $this->_input; |
|
14 | + $raw_value = maybe_serialize($input->raw_value()); |
|
15 | + if ($input instanceof EE_Text_Area_Input) { |
|
16 | + $rows = $input->get_rows(); |
|
17 | + $cols = $input->get_cols(); |
|
18 | + } else { |
|
19 | + $rows = 4; |
|
20 | + $cols = 20; |
|
21 | + } |
|
22 | + $html = '<textarea'; |
|
23 | + $html .= ' id="' . $input->html_id() . '"'; |
|
24 | + $html .= ' name="' . $input->html_name() . '"'; |
|
25 | + $html .= ' class="' . $input->html_class() . '"' ; |
|
26 | + $html .= ' style="' . $input->html_style() . '"'; |
|
27 | + $html .= $input->other_html_attributes(); |
|
28 | + $html .= ' rows= "' . $rows . '" cols="' . $cols . '">'; |
|
29 | + $html .= esc_textarea($raw_value); |
|
30 | + $html .= '</textarea>'; |
|
31 | + foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
|
32 | + if ($validation_strategy instanceof EE_Simple_HTML_Validation_Strategy |
|
33 | + || $validation_strategy instanceof EE_Full_HTML_Validation_Strategy |
|
34 | + ) { |
|
35 | + $html .= sprintf( |
|
36 | + __('%1$s(allowed tags: %2$s)%3$s', 'event_espresso'), |
|
37 | + '<p class="ee-question-desc">', |
|
38 | + $validation_strategy->get_list_of_allowed_tags(), |
|
39 | + '</p>' |
|
40 | + ); |
|
41 | + } |
|
42 | + } |
|
43 | + return $html; |
|
44 | + } |
|
45 | 45 | } |
@@ -20,12 +20,12 @@ |
||
20 | 20 | $cols = 20; |
21 | 21 | } |
22 | 22 | $html = '<textarea'; |
23 | - $html .= ' id="' . $input->html_id() . '"'; |
|
24 | - $html .= ' name="' . $input->html_name() . '"'; |
|
25 | - $html .= ' class="' . $input->html_class() . '"' ; |
|
26 | - $html .= ' style="' . $input->html_style() . '"'; |
|
23 | + $html .= ' id="'.$input->html_id().'"'; |
|
24 | + $html .= ' name="'.$input->html_name().'"'; |
|
25 | + $html .= ' class="'.$input->html_class().'"'; |
|
26 | + $html .= ' style="'.$input->html_style().'"'; |
|
27 | 27 | $html .= $input->other_html_attributes(); |
28 | - $html .= ' rows= "' . $rows . '" cols="' . $cols . '">'; |
|
28 | + $html .= ' rows= "'.$rows.'" cols="'.$cols.'">'; |
|
29 | 29 | $html .= esc_textarea($raw_value); |
30 | 30 | $html .= '</textarea>'; |
31 | 31 | foreach ($this->_input->get_validation_strategies() as $validation_strategy) { |
@@ -14,27 +14,27 @@ discard block |
||
14 | 14 | class EE_Invisible_Recaptcha_Display_Strategy extends EE_Display_Strategy_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @return EE_Form_Input_Base|EE_Invisible_Recaptcha_Input |
|
19 | - */ |
|
20 | - public function input() |
|
21 | - { |
|
22 | - return $this->_input; |
|
23 | - } |
|
17 | + /** |
|
18 | + * @return EE_Form_Input_Base|EE_Invisible_Recaptcha_Input |
|
19 | + */ |
|
20 | + public function input() |
|
21 | + { |
|
22 | + return $this->_input; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * returns HTML and javascript related to the displaying of this input |
|
28 | - * |
|
29 | - * @return string |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws InvalidDataTypeException |
|
32 | - * @throws InvalidArgumentException |
|
33 | - */ |
|
34 | - public function display() |
|
35 | - { |
|
36 | - wp_enqueue_script(EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_GOOGLE_INVISIBLE_RECAPTCHA); |
|
37 | - return <<<EOD |
|
26 | + /** |
|
27 | + * returns HTML and javascript related to the displaying of this input |
|
28 | + * |
|
29 | + * @return string |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws InvalidDataTypeException |
|
32 | + * @throws InvalidArgumentException |
|
33 | + */ |
|
34 | + public function display() |
|
35 | + { |
|
36 | + wp_enqueue_script(EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_GOOGLE_INVISIBLE_RECAPTCHA); |
|
37 | + return <<<EOD |
|
38 | 38 | <div id="g-recaptcha-{$this->input()->recaptchaId()}" |
39 | 39 | class="g-recaptcha" |
40 | 40 | data-sitekey="{$this->input()->siteKey()}" |
@@ -45,5 +45,5 @@ discard block |
||
45 | 45 | > |
46 | 46 | </div> |
47 | 47 | EOD; |
48 | - } |
|
48 | + } |
|
49 | 49 | } |