@@ -14,27 +14,27 @@ |
||
14 | 14 | class EE_Admin_File_Uploader_Input extends EE_Form_Input_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param array $input_settings |
|
19 | - * @throws InvalidArgumentException |
|
20 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
21 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
22 | - */ |
|
23 | - public function __construct($input_settings = array()) |
|
24 | - { |
|
25 | - $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
26 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
27 | - $this->_add_validation_strategy( |
|
28 | - LoaderFactory::getLoader()->getNew( |
|
29 | - 'EE_URL_Validation_Strategy', |
|
30 | - array( |
|
31 | - isset($input_settings['validation_error_message']) |
|
32 | - ? $input_settings['validation_error_message'] |
|
33 | - : null, |
|
34 | - false |
|
35 | - ) |
|
36 | - ) |
|
37 | - ); |
|
38 | - parent::__construct($input_settings); |
|
39 | - } |
|
17 | + /** |
|
18 | + * @param array $input_settings |
|
19 | + * @throws InvalidArgumentException |
|
20 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
21 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
22 | + */ |
|
23 | + public function __construct($input_settings = array()) |
|
24 | + { |
|
25 | + $this->_set_display_strategy(new EE_Admin_File_Uploader_Display_Strategy()); |
|
26 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
27 | + $this->_add_validation_strategy( |
|
28 | + LoaderFactory::getLoader()->getNew( |
|
29 | + 'EE_URL_Validation_Strategy', |
|
30 | + array( |
|
31 | + isset($input_settings['validation_error_message']) |
|
32 | + ? $input_settings['validation_error_message'] |
|
33 | + : null, |
|
34 | + false |
|
35 | + ) |
|
36 | + ) |
|
37 | + ); |
|
38 | + parent::__construct($input_settings); |
|
39 | + } |
|
40 | 40 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | public function column_id($item) |
83 | 83 | { |
84 | 84 | $content = $item->get('term_id'); |
85 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
85 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->get_first_related('Term')->get( |
|
86 | 86 | 'name' |
87 | - ) . '</span>'; |
|
87 | + ).'</span>'; |
|
88 | 88 | return $content; |
89 | 89 | } |
90 | 90 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
106 | 106 | |
107 | 107 | $actions = array( |
108 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
108 | + 'edit' => '<a href="'.$edit_link.'" aria-label="'.esc_attr__( |
|
109 | 109 | 'Edit Category', |
110 | 110 | 'event_espresso' |
111 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
111 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
112 | 112 | ); |
113 | 113 | |
114 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
114 | + $actions['delete'] = '<a href="'.$delete_link.'" aria-label="'.esc_attr__( |
|
115 | 115 | 'Delete Category', |
116 | 116 | 'event_espresso' |
117 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
117 | + ).'">'.esc_html__('Delete', 'event_espresso').'</a>'; |
|
118 | 118 | |
119 | 119 | $actions['view'] = sprintf( |
120 | 120 | '<a href="%s" aria-label="%s">%s</a>', |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | esc_html__('View', 'event_espresso') |
130 | 130 | ); |
131 | 131 | |
132 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
132 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get( |
|
133 | 133 | 'name' |
134 | - ) . '</a></strong>'; |
|
134 | + ).'</a></strong>'; |
|
135 | 135 | $content .= $this->row_actions($actions); |
136 | 136 | return $content; |
137 | 137 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | public function column_shortcode($item) |
141 | 141 | { |
142 | - $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
142 | + $content = '[ESPRESSO_EVENTS category_slug='.$item->get_first_related('Term')->get('slug').']'; |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
152 | 152 | ); |
153 | 153 | $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
154 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
154 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
155 | 155 | return $content; |
156 | 156 | } |
157 | 157 | } |
@@ -16,142 +16,142 @@ |
||
16 | 16 | class Event_Categories_Admin_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | 18 | |
19 | - public function __construct($admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - protected function _setup_data() |
|
26 | - { |
|
27 | - $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
28 | - $this->_all_data_count = EEM_Term_Taxonomy::instance()->count( |
|
29 | - array(array('taxonomy' => 'espresso_event_categories')) |
|
30 | - ); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - protected function _set_properties() |
|
35 | - { |
|
36 | - $this->_wp_list_args = array( |
|
37 | - 'singular' => esc_html__('event category', 'event_espresso'), |
|
38 | - 'plural' => esc_html__('event categories', 'event_espresso'), |
|
39 | - 'ajax' => true, // for now, |
|
40 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
41 | - ); |
|
42 | - |
|
43 | - $this->_columns = array( |
|
44 | - 'cb' => '<input type="checkbox" />', |
|
45 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
46 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
47 | - 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
48 | - 'count' => esc_html__('Events', 'event_espresso'), |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_sortable_columns = array( |
|
52 | - 'id' => array('Term.term_id' => true), |
|
53 | - 'name' => array('Term.slug' => false), |
|
54 | - 'count' => array('term_count' => false), |
|
55 | - ); |
|
56 | - |
|
57 | - $this->_primary_column = 'id'; |
|
58 | - |
|
59 | - $this->_hidden_columns = array(); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - // not needed |
|
64 | - protected function _get_table_filters() |
|
65 | - { |
|
66 | - return array(); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _add_view_counts() |
|
71 | - { |
|
72 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - public function column_cb($item) |
|
77 | - { |
|
78 | - return sprintf('<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - public function column_id($item) |
|
83 | - { |
|
84 | - $content = $item->get('term_id'); |
|
85 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
86 | - 'name' |
|
87 | - ) . '</span>'; |
|
88 | - return $content; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - public function column_name($item) |
|
93 | - { |
|
94 | - $edit_query_args = array( |
|
95 | - 'action' => 'edit_category', |
|
96 | - 'EVT_CAT_ID' => $item->get('term_id'), |
|
97 | - ); |
|
98 | - |
|
99 | - $delete_query_args = array( |
|
100 | - 'action' => 'delete_category', |
|
101 | - 'EVT_CAT_ID' => $item->get('term_id'), |
|
102 | - ); |
|
103 | - |
|
104 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
105 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
|
106 | - |
|
107 | - $actions = array( |
|
108 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
109 | - 'Edit Category', |
|
110 | - 'event_espresso' |
|
111 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
112 | - ); |
|
113 | - |
|
114 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
115 | - 'Delete Category', |
|
116 | - 'event_espresso' |
|
117 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
118 | - |
|
119 | - $actions['view'] = sprintf( |
|
120 | - '<a href="%s" aria-label="%s">%s</a>', |
|
121 | - get_term_link($item->get('term_id')), |
|
122 | - esc_attr( |
|
123 | - sprintf( |
|
124 | - /* translators: %s: event category name */ |
|
125 | - esc_html__('View “%s” archive', 'event_espresso'), |
|
126 | - $item->get_first_related('Term')->get('name') |
|
127 | - ) |
|
128 | - ), |
|
129 | - esc_html__('View', 'event_espresso') |
|
130 | - ); |
|
131 | - |
|
132 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
133 | - 'name' |
|
134 | - ) . '</a></strong>'; |
|
135 | - $content .= $this->row_actions($actions); |
|
136 | - return $content; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - public function column_shortcode($item) |
|
141 | - { |
|
142 | - $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
143 | - return $content; |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - public function column_count($item) |
|
148 | - { |
|
149 | - $e_args = array( |
|
150 | - 'action' => 'default', |
|
151 | - 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
|
152 | - ); |
|
153 | - $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
|
154 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
155 | - return $content; |
|
156 | - } |
|
19 | + public function __construct($admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + protected function _setup_data() |
|
26 | + { |
|
27 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
28 | + $this->_all_data_count = EEM_Term_Taxonomy::instance()->count( |
|
29 | + array(array('taxonomy' => 'espresso_event_categories')) |
|
30 | + ); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + protected function _set_properties() |
|
35 | + { |
|
36 | + $this->_wp_list_args = array( |
|
37 | + 'singular' => esc_html__('event category', 'event_espresso'), |
|
38 | + 'plural' => esc_html__('event categories', 'event_espresso'), |
|
39 | + 'ajax' => true, // for now, |
|
40 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
41 | + ); |
|
42 | + |
|
43 | + $this->_columns = array( |
|
44 | + 'cb' => '<input type="checkbox" />', |
|
45 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
46 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
47 | + 'shortcode' => esc_html__('Shortcode', 'event_espresso'), |
|
48 | + 'count' => esc_html__('Events', 'event_espresso'), |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_sortable_columns = array( |
|
52 | + 'id' => array('Term.term_id' => true), |
|
53 | + 'name' => array('Term.slug' => false), |
|
54 | + 'count' => array('term_count' => false), |
|
55 | + ); |
|
56 | + |
|
57 | + $this->_primary_column = 'id'; |
|
58 | + |
|
59 | + $this->_hidden_columns = array(); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + // not needed |
|
64 | + protected function _get_table_filters() |
|
65 | + { |
|
66 | + return array(); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _add_view_counts() |
|
71 | + { |
|
72 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + public function column_cb($item) |
|
77 | + { |
|
78 | + return sprintf('<input type="checkbox" name="EVT_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + public function column_id($item) |
|
83 | + { |
|
84 | + $content = $item->get('term_id'); |
|
85 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
86 | + 'name' |
|
87 | + ) . '</span>'; |
|
88 | + return $content; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + public function column_name($item) |
|
93 | + { |
|
94 | + $edit_query_args = array( |
|
95 | + 'action' => 'edit_category', |
|
96 | + 'EVT_CAT_ID' => $item->get('term_id'), |
|
97 | + ); |
|
98 | + |
|
99 | + $delete_query_args = array( |
|
100 | + 'action' => 'delete_category', |
|
101 | + 'EVT_CAT_ID' => $item->get('term_id'), |
|
102 | + ); |
|
103 | + |
|
104 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
105 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EVENTS_ADMIN_URL); |
|
106 | + |
|
107 | + $actions = array( |
|
108 | + 'edit' => '<a href="' . $edit_link . '" aria-label="' . esc_attr__( |
|
109 | + 'Edit Category', |
|
110 | + 'event_espresso' |
|
111 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
112 | + ); |
|
113 | + |
|
114 | + $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . esc_attr__( |
|
115 | + 'Delete Category', |
|
116 | + 'event_espresso' |
|
117 | + ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
118 | + |
|
119 | + $actions['view'] = sprintf( |
|
120 | + '<a href="%s" aria-label="%s">%s</a>', |
|
121 | + get_term_link($item->get('term_id')), |
|
122 | + esc_attr( |
|
123 | + sprintf( |
|
124 | + /* translators: %s: event category name */ |
|
125 | + esc_html__('View “%s” archive', 'event_espresso'), |
|
126 | + $item->get_first_related('Term')->get('name') |
|
127 | + ) |
|
128 | + ), |
|
129 | + esc_html__('View', 'event_espresso') |
|
130 | + ); |
|
131 | + |
|
132 | + $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
133 | + 'name' |
|
134 | + ) . '</a></strong>'; |
|
135 | + $content .= $this->row_actions($actions); |
|
136 | + return $content; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + public function column_shortcode($item) |
|
141 | + { |
|
142 | + $content = '[ESPRESSO_EVENTS category_slug=' . $item->get_first_related('Term')->get('slug') . ']'; |
|
143 | + return $content; |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + public function column_count($item) |
|
148 | + { |
|
149 | + $e_args = array( |
|
150 | + 'action' => 'default', |
|
151 | + 'EVT_CAT' => $item->get_first_related('Term')->ID(), |
|
152 | + ); |
|
153 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EVENTS_ADMIN_URL); |
|
154 | + $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
155 | + return $content; |
|
156 | + } |
|
157 | 157 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <p><?php |
3 | - printf( |
|
4 | - esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), |
|
5 | - '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">', |
|
6 | - '</a>' |
|
7 | - ); ?></p> |
|
3 | + printf( |
|
4 | + esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), |
|
5 | + '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">', |
|
6 | + '</a>' |
|
7 | + ); ?></p> |
|
8 | 8 | </div> |
9 | 9 | \ No newline at end of file |
@@ -1,93 +1,93 @@ |
||
1 | 1 | <div class="padding"> |
2 | 2 | <?php esc_html_e( |
3 | - 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', |
|
4 | - 'event_espresso' |
|
5 | - ); ?> |
|
3 | + 'If you want to integrate with Event Espresso or participate in building code, then you are in the right place. The following resources can help you get started.', |
|
4 | + 'event_espresso' |
|
5 | + ); ?> |
|
6 | 6 | <h2><?php esc_html_e('Developer Resources', 'event_espresso'); ?></h2> |
7 | 7 | <ul> |
8 | 8 | <li> |
9 | 9 | <?php printf( |
10 | - esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), |
|
11 | - '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank" rel="noopener noreferrer">', |
|
12 | - '</a>' |
|
13 | - ); ?></li> |
|
10 | + esc_html__('%1$sEvent Espresso 4 Developer Documentation%2$s', 'event_espresso'), |
|
11 | + '<a href="https://github.com/eventespresso/event-espresso-core/tree/master/docs#getting-started-with-the-ee-developer-docs" target="_blank" rel="noopener noreferrer">', |
|
12 | + '</a>' |
|
13 | + ); ?></li> |
|
14 | 14 | <li> |
15 | 15 | <?php printf( |
16 | - esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), |
|
17 | - '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
18 | - '</a>' |
|
19 | - ); ?></li> |
|
16 | + esc_html__('%1$sEvent Espresso 4 Developer News%2$s', 'event_espresso'), |
|
17 | + '<a href="http://developer.eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
18 | + '</a>' |
|
19 | + ); ?></li> |
|
20 | 20 | <li> |
21 | 21 | <?php printf( |
22 | - esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), |
|
23 | - '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
24 | - '</a>', |
|
25 | - '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' |
|
26 | - ); ?></li> |
|
22 | + esc_html__('%1$sApply%2$s to be listed as an %3$sEvent Espresso Professional%2$s', 'event_espresso'), |
|
23 | + '<a href="https://eventespresso.com/developers/event-espresso-pros-application/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
24 | + '</a>', |
|
25 | + '<a href="https://eventespresso.com/developers/event-espresso-pros/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">' |
|
26 | + ); ?></li> |
|
27 | 27 | </ul> |
28 | 28 | |
29 | 29 | <h2><?php esc_html_e('Event Espresso 4 Articles for Developers', 'event_espresso'); ?></h2> |
30 | 30 | <ul> |
31 | 31 | <li> |
32 | 32 | <?php printf( |
33 | - esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), |
|
34 | - '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
35 | - '</a>' |
|
36 | - ); ?></li> |
|
33 | + esc_html__('%1$sCustom Post Types Usage%2$s', 'event_espresso'), |
|
34 | + '<a href="https://eventespresso.com/2014/02/epsresso-brewery-custom-post-types-event-espresso/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
35 | + '</a>' |
|
36 | + ); ?></li> |
|
37 | 37 | <li> |
38 | 38 | <?php printf( |
39 | - esc_html__('%1$sTheme Development%2$s', 'event_espresso'), |
|
40 | - '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
41 | - '</a>' |
|
42 | - ); ?></li> |
|
39 | + esc_html__('%1$sTheme Development%2$s', 'event_espresso'), |
|
40 | + '<a href="https://eventespresso.com/2014/02/developers-corner-theming-event-espresso-4/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
41 | + '</a>' |
|
42 | + ); ?></li> |
|
43 | 43 | <li> |
44 | 44 | <?php printf( |
45 | - esc_html__('%1$sCapability System%2$s', 'event_espresso'), |
|
46 | - '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
47 | - '</a>' |
|
48 | - ); ?></li> |
|
45 | + esc_html__('%1$sCapability System%2$s', 'event_espresso'), |
|
46 | + '<a href="http://developer.eventespresso.com/docs/ee-capability-system-overview/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
47 | + '</a>' |
|
48 | + ); ?></li> |
|
49 | 49 | <li> |
50 | 50 | <?php printf( |
51 | - esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), |
|
52 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank" rel="noopener noreferrer">', |
|
53 | - '</a>' |
|
54 | - ); ?></li> |
|
51 | + esc_html__('%1$sPayment Method Development%2$s', 'event_espresso'), |
|
52 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/L--Payment-Methods-and-Gateways/creating-a-payment-method.md" target="_blank" rel="noopener noreferrer">', |
|
53 | + '</a>' |
|
54 | + ); ?></li> |
|
55 | 55 | <li> |
56 | 56 | <?php printf( |
57 | - esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), |
|
58 | - '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
59 | - '</a>' |
|
60 | - ); ?></li> |
|
57 | + esc_html__('%1$sMessages System in Event Espresso 4%2$s', 'event_espresso'), |
|
58 | + '<a href="https://eventespresso.com/2014/03/messages-systemyour-tool-getting-word/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
59 | + '</a>' |
|
60 | + ); ?></li> |
|
61 | 61 | <li> |
62 | 62 | <?php printf( |
63 | - esc_html__( |
|
64 | - '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
68 | - '</a>' |
|
69 | - ); ?></li> |
|
63 | + esc_html__( |
|
64 | + '%1$sDatabase Model System%2$s (used for interfacing with EE4 data via WordPress plugins and server side querying)', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + '<a href="http://developer.eventespresso.com/docs/using-ee4-model-objects/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=ee_support_page&utm_content=developers_tab" target="_blank">', |
|
68 | + '</a>' |
|
69 | + ); ?></li> |
|
70 | 70 | </ul> |
71 | 71 | |
72 | 72 | <h2><?php esc_html_e('REST API Resources', 'event_espresso'); ?></h2> |
73 | 73 | <ul> |
74 | 74 | <li> |
75 | 75 | <?php printf( |
76 | - esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), |
|
77 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank" rel="noopener noreferrer">', |
|
78 | - '</a>' |
|
79 | - ); ?></li> |
|
76 | + esc_html__('%1$sREST API: Introduction%2$s', 'event_espresso'), |
|
77 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-introduction.md" target="_blank" rel="noopener noreferrer">', |
|
78 | + '</a>' |
|
79 | + ); ?></li> |
|
80 | 80 | <li> |
81 | 81 | <?php printf( |
82 | - esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), |
|
83 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank" rel="noopener noreferrer">', |
|
84 | - '</a>' |
|
85 | - ); ?></li> |
|
82 | + esc_html__('%1$sREST API: Reading Data%2$s', 'event_espresso'), |
|
83 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/C--REST-API/ee4-rest-api-reading-data.md" target="_blank" rel="noopener noreferrer">', |
|
84 | + '</a>' |
|
85 | + ); ?></li> |
|
86 | 86 | <li> |
87 | 87 | <?php printf( |
88 | - esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), |
|
89 | - '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank" rel="noopener noreferrer">', |
|
90 | - '</a>' |
|
91 | - ); ?></li> |
|
88 | + esc_html__('%1$sBuilding an EE4 Add-on Using the REST API%2$s', 'event_espresso'), |
|
89 | + '<a href="https://github.com/eventespresso/event-espresso-core/blob/master/docs/T--Tutorials/building-an-ee4-addon-that-uses-angular-js-and-the-ee4-json-rest-api.md" target="_blank" rel="noopener noreferrer">', |
|
90 | + '</a>' |
|
91 | + ); ?></li> |
|
92 | 92 | </ul> |
93 | 93 | </div> |
94 | 94 | \ No newline at end of file |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getType() |
95 | 95 | { |
96 | - if (!$this->type) { |
|
96 | + if ( ! $this->type) { |
|
97 | 97 | $this->type = $this->determineType(); |
98 | 98 | } |
99 | 99 | return $this->type; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function determineType() |
107 | 107 | { |
108 | - if (!$this->getTmpFile()) { |
|
108 | + if ( ! $this->getTmpFile()) { |
|
109 | 109 | return ''; |
110 | 110 | } |
111 | 111 | $finfo = new finfo(FILEINFO_MIME_TYPE); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getExtension() |
121 | 121 | { |
122 | - if (!$this->extension) { |
|
122 | + if ( ! $this->extension) { |
|
123 | 123 | $this->extension = $this->determineExtension(); |
124 | 124 | } |
125 | 125 | return $this->extension; |
@@ -19,164 +19,164 @@ |
||
19 | 19 | */ |
20 | 20 | class FileSubmission implements FileSubmissionInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * @var string original name on the client machine |
|
24 | - */ |
|
25 | - protected $name; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var string mime type |
|
29 | - */ |
|
30 | - protected $type; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string file extension |
|
34 | - */ |
|
35 | - protected $extension; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var int in bytes |
|
39 | - */ |
|
40 | - protected $size; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var string local filepath to the temporary file |
|
44 | - */ |
|
45 | - protected $tmp_file; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var int one of UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE or other values |
|
49 | - * although those aren't expected. |
|
50 | - */ |
|
51 | - protected $error_code; |
|
52 | - |
|
53 | - /** |
|
54 | - * FileSubmission constructor. |
|
55 | - * @param $name |
|
56 | - * @param $tmp_file |
|
57 | - * @param $size |
|
58 | - * @param null $error_code |
|
59 | - * @throws InvalidArgumentException |
|
60 | - */ |
|
61 | - public function __construct($name, $tmp_file, $size, $error_code = null) |
|
62 | - { |
|
63 | - $this->name = basename($name); |
|
64 | - $scheme = parse_url($tmp_file, PHP_URL_SCHEME); |
|
65 | - if (in_array($scheme, ['http', 'https'])) { |
|
66 | - // Wait a minute- just local filepaths please, no URL schemes allowed! |
|
67 | - throw new InvalidArgumentException( |
|
68 | - sprintf( |
|
69 | - // @codingStandardsIgnoreStart |
|
70 | - esc_html__('The scheme ("%1$s") on the temporary file ("%2$s") indicates is located elsewhere, that’s not ok!', 'event_espresso'), |
|
71 | - // @codingStandardsIgnoreEnd |
|
72 | - $scheme, |
|
73 | - $tmp_file |
|
74 | - ) |
|
75 | - ); |
|
76 | - } |
|
77 | - $this->tmp_file = (string) $tmp_file; |
|
78 | - $this->size = (int) $size; |
|
79 | - $this->error_code = (int) $error_code; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function getName() |
|
86 | - { |
|
87 | - return $this->name; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Gets the file's mime type |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function getType() |
|
95 | - { |
|
96 | - if (!$this->type) { |
|
97 | - $this->type = $this->determineType(); |
|
98 | - } |
|
99 | - return $this->type; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @since 4.9.80.p |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - protected function determineType() |
|
107 | - { |
|
108 | - if (!$this->getTmpFile()) { |
|
109 | - return ''; |
|
110 | - } |
|
111 | - $finfo = new finfo(FILEINFO_MIME_TYPE); |
|
112 | - return $finfo->file($this->getTmpFile()); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Gets the file's extension. |
|
117 | - * @since 4.9.80.p |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - public function getExtension() |
|
121 | - { |
|
122 | - if (!$this->extension) { |
|
123 | - $this->extension = $this->determineExtension(); |
|
124 | - } |
|
125 | - return $this->extension; |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * Determine's the file's extension given the temporary file. |
|
130 | - * @since 4.9.80.p |
|
131 | - * @return string |
|
132 | - */ |
|
133 | - protected function determineExtension() |
|
134 | - { |
|
135 | - $position_of_period = strrpos($this->getName(), '.'); |
|
136 | - if ($position_of_period === false) { |
|
137 | - return ''; |
|
138 | - } |
|
139 | - return mb_substr( |
|
140 | - $this->getName(), |
|
141 | - $position_of_period + 1 |
|
142 | - ); |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Gets the size of the file |
|
147 | - * @return int |
|
148 | - */ |
|
149 | - public function getSize() |
|
150 | - { |
|
151 | - return $this->size; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Gets the path to the temporary file which was uploaded. |
|
156 | - * @return string |
|
157 | - */ |
|
158 | - public function getTmpFile() |
|
159 | - { |
|
160 | - return $this->tmp_file; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * @since 4.9.80.p |
|
165 | - * @return string |
|
166 | - */ |
|
167 | - public function __toString() |
|
168 | - { |
|
169 | - return $this->getName(); |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * Gets the error code PHP reported for the file upload. |
|
174 | - * @return string |
|
175 | - */ |
|
176 | - public function getErrorCode() |
|
177 | - { |
|
178 | - return $this->error_code; |
|
179 | - } |
|
22 | + /** |
|
23 | + * @var string original name on the client machine |
|
24 | + */ |
|
25 | + protected $name; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var string mime type |
|
29 | + */ |
|
30 | + protected $type; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string file extension |
|
34 | + */ |
|
35 | + protected $extension; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var int in bytes |
|
39 | + */ |
|
40 | + protected $size; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var string local filepath to the temporary file |
|
44 | + */ |
|
45 | + protected $tmp_file; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var int one of UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE or other values |
|
49 | + * although those aren't expected. |
|
50 | + */ |
|
51 | + protected $error_code; |
|
52 | + |
|
53 | + /** |
|
54 | + * FileSubmission constructor. |
|
55 | + * @param $name |
|
56 | + * @param $tmp_file |
|
57 | + * @param $size |
|
58 | + * @param null $error_code |
|
59 | + * @throws InvalidArgumentException |
|
60 | + */ |
|
61 | + public function __construct($name, $tmp_file, $size, $error_code = null) |
|
62 | + { |
|
63 | + $this->name = basename($name); |
|
64 | + $scheme = parse_url($tmp_file, PHP_URL_SCHEME); |
|
65 | + if (in_array($scheme, ['http', 'https'])) { |
|
66 | + // Wait a minute- just local filepaths please, no URL schemes allowed! |
|
67 | + throw new InvalidArgumentException( |
|
68 | + sprintf( |
|
69 | + // @codingStandardsIgnoreStart |
|
70 | + esc_html__('The scheme ("%1$s") on the temporary file ("%2$s") indicates is located elsewhere, that’s not ok!', 'event_espresso'), |
|
71 | + // @codingStandardsIgnoreEnd |
|
72 | + $scheme, |
|
73 | + $tmp_file |
|
74 | + ) |
|
75 | + ); |
|
76 | + } |
|
77 | + $this->tmp_file = (string) $tmp_file; |
|
78 | + $this->size = (int) $size; |
|
79 | + $this->error_code = (int) $error_code; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function getName() |
|
86 | + { |
|
87 | + return $this->name; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Gets the file's mime type |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function getType() |
|
95 | + { |
|
96 | + if (!$this->type) { |
|
97 | + $this->type = $this->determineType(); |
|
98 | + } |
|
99 | + return $this->type; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @since 4.9.80.p |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + protected function determineType() |
|
107 | + { |
|
108 | + if (!$this->getTmpFile()) { |
|
109 | + return ''; |
|
110 | + } |
|
111 | + $finfo = new finfo(FILEINFO_MIME_TYPE); |
|
112 | + return $finfo->file($this->getTmpFile()); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Gets the file's extension. |
|
117 | + * @since 4.9.80.p |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + public function getExtension() |
|
121 | + { |
|
122 | + if (!$this->extension) { |
|
123 | + $this->extension = $this->determineExtension(); |
|
124 | + } |
|
125 | + return $this->extension; |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * Determine's the file's extension given the temporary file. |
|
130 | + * @since 4.9.80.p |
|
131 | + * @return string |
|
132 | + */ |
|
133 | + protected function determineExtension() |
|
134 | + { |
|
135 | + $position_of_period = strrpos($this->getName(), '.'); |
|
136 | + if ($position_of_period === false) { |
|
137 | + return ''; |
|
138 | + } |
|
139 | + return mb_substr( |
|
140 | + $this->getName(), |
|
141 | + $position_of_period + 1 |
|
142 | + ); |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Gets the size of the file |
|
147 | + * @return int |
|
148 | + */ |
|
149 | + public function getSize() |
|
150 | + { |
|
151 | + return $this->size; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Gets the path to the temporary file which was uploaded. |
|
156 | + * @return string |
|
157 | + */ |
|
158 | + public function getTmpFile() |
|
159 | + { |
|
160 | + return $this->tmp_file; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * @since 4.9.80.p |
|
165 | + * @return string |
|
166 | + */ |
|
167 | + public function __toString() |
|
168 | + { |
|
169 | + return $this->getName(); |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * Gets the error code PHP reported for the file upload. |
|
174 | + * @return string |
|
175 | + */ |
|
176 | + public function getErrorCode() |
|
177 | + { |
|
178 | + return $this->error_code; |
|
179 | + } |
|
180 | 180 | } |
181 | 181 | // End of file FileSubmission.php |
182 | 182 | // Location: EventEspresso\core\services\request\files/FileSubmission.php |
@@ -15,80 +15,80 @@ |
||
15 | 15 | class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Arguments that will be passed into the select2 javascript constructor |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $_select2_js_args = array(); |
|
18 | + /** |
|
19 | + * Arguments that will be passed into the select2 javascript constructor |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $_select2_js_args = array(); |
|
23 | 23 | |
24 | - /** |
|
25 | - * |
|
26 | - * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
|
27 | - * to pass into the select2 js/html input. See https://select2.github.io |
|
28 | - */ |
|
29 | - public function __construct($select2_js_args = array()) |
|
30 | - { |
|
31 | - $this->_select2_js_args = $select2_js_args; |
|
32 | - parent::__construct(); |
|
33 | - } |
|
24 | + /** |
|
25 | + * |
|
26 | + * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
|
27 | + * to pass into the select2 js/html input. See https://select2.github.io |
|
28 | + */ |
|
29 | + public function __construct($select2_js_args = array()) |
|
30 | + { |
|
31 | + $this->_select2_js_args = $select2_js_args; |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * enqueues the select2 initializing js (which depends on the select2 js) and |
|
37 | - * the select2 css |
|
38 | - */ |
|
39 | - public function enqueue_js() |
|
40 | - { |
|
41 | - // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
|
42 | - // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
|
43 | - wp_deregister_script('select2'); |
|
44 | - wp_deregister_style('select2'); |
|
45 | - wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
46 | - wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
47 | - wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
48 | - wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
49 | - } |
|
35 | + /** |
|
36 | + * enqueues the select2 initializing js (which depends on the select2 js) and |
|
37 | + * the select2 css |
|
38 | + */ |
|
39 | + public function enqueue_js() |
|
40 | + { |
|
41 | + // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
|
42 | + // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
|
43 | + wp_deregister_script('select2'); |
|
44 | + wp_deregister_style('select2'); |
|
45 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
46 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
47 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
48 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Gets the javascript args which will be localized and passed into the select2 js/html input |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function get_js_args() |
|
56 | - { |
|
57 | - return $this->_select2_js_args; |
|
58 | - } |
|
51 | + /** |
|
52 | + * Gets the javascript args which will be localized and passed into the select2 js/html input |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function get_js_args() |
|
56 | + { |
|
57 | + return $this->_select2_js_args; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Sets the exact js args which will be passed into the select2 js/html input |
|
62 | - * @param array $js_args |
|
63 | - */ |
|
64 | - public function set_js_args($js_args) |
|
65 | - { |
|
66 | - $this->_select2_js_args = $js_args; |
|
67 | - } |
|
60 | + /** |
|
61 | + * Sets the exact js args which will be passed into the select2 js/html input |
|
62 | + * @param array $js_args |
|
63 | + */ |
|
64 | + public function set_js_args($js_args) |
|
65 | + { |
|
66 | + $this->_select2_js_args = $js_args; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Adds select2 data for localization |
|
71 | - * @param array $other_js_data |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function get_other_js_data($other_js_data = array()) |
|
75 | - { |
|
76 | - $other_js_data = parent::get_other_js_data($other_js_data); |
|
77 | - if (! isset($other_js_data['select2s'])) { |
|
78 | - $other_js_data['select2s'] = array(); |
|
79 | - } |
|
80 | - $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
81 | - return $other_js_data; |
|
82 | - } |
|
69 | + /** |
|
70 | + * Adds select2 data for localization |
|
71 | + * @param array $other_js_data |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function get_other_js_data($other_js_data = array()) |
|
75 | + { |
|
76 | + $other_js_data = parent::get_other_js_data($other_js_data); |
|
77 | + if (! isset($other_js_data['select2s'])) { |
|
78 | + $other_js_data['select2s'] = array(); |
|
79 | + } |
|
80 | + $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
81 | + return $other_js_data; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Overrides standard attributes array to add the CSS class "ee-select2" |
|
86 | - * @return array |
|
87 | - */ |
|
88 | - protected function _standard_attributes_array() |
|
89 | - { |
|
90 | - $standard_attributes = parent::_standard_attributes_array(); |
|
91 | - $standard_attributes['class'] .= ' ee-select2'; |
|
92 | - return $standard_attributes; |
|
93 | - } |
|
84 | + /** |
|
85 | + * Overrides standard attributes array to add the CSS class "ee-select2" |
|
86 | + * @return array |
|
87 | + */ |
|
88 | + protected function _standard_attributes_array() |
|
89 | + { |
|
90 | + $standard_attributes = parent::_standard_attributes_array(); |
|
91 | + $standard_attributes['class'] .= ' ee-select2'; |
|
92 | + return $standard_attributes; |
|
93 | + } |
|
94 | 94 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
43 | 43 | wp_deregister_script('select2'); |
44 | 44 | wp_deregister_style('select2'); |
45 | - wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
46 | - wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
47 | - wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
48 | - wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
45 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
46 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
47 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true); |
|
48 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | public function get_other_js_data($other_js_data = array()) |
75 | 75 | { |
76 | 76 | $other_js_data = parent::get_other_js_data($other_js_data); |
77 | - if (! isset($other_js_data['select2s'])) { |
|
77 | + if ( ! isset($other_js_data['select2s'])) { |
|
78 | 78 | $other_js_data['select2s'] = array(); |
79 | 79 | } |
80 | - $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
80 | + $other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args(); |
|
81 | 81 | return $other_js_data; |
82 | 82 | } |
83 | 83 |
@@ -10,11 +10,11 @@ |
||
10 | 10 | */ |
11 | 11 | class EE_File_Input_Display_Strategy extends EE_Text_Input_Display_Strategy |
12 | 12 | { |
13 | - /** |
|
14 | - * Override's parent to just set the type. May someday support other arguments. |
|
15 | - */ |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - parent::__construct('file'); |
|
19 | - } |
|
13 | + /** |
|
14 | + * Override's parent to just set the type. May someday support other arguments. |
|
15 | + */ |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + parent::__construct('file'); |
|
19 | + } |
|
20 | 20 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
56 | 56 | implode(', ', $this->allowed_file_extensions) |
57 | 57 | ), |
58 | - '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
58 | + '~.*\.('.implode('|', $this->allowed_file_extensions).')$~' |
|
59 | 59 | ) |
60 | 60 | ); |
61 | 61 | parent::__construct($options); |
@@ -19,86 +19,86 @@ |
||
19 | 19 | */ |
20 | 20 | class EE_File_Input extends EE_Form_Input_Base |
21 | 21 | { |
22 | - /** |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - protected $allowed_file_extensions; |
|
22 | + /** |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + protected $allowed_file_extensions; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @var array |
|
29 | - */ |
|
30 | - protected $allowed_mime_types; |
|
27 | + /** |
|
28 | + * @var array |
|
29 | + */ |
|
30 | + protected $allowed_mime_types; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param array $options |
|
34 | - * @throws InvalidArgumentException |
|
35 | - */ |
|
36 | - public function __construct($options = array()) |
|
37 | - { |
|
38 | - if (isset($options['allowed_file_extensions'])) { |
|
39 | - $this->allowed_file_extensions = (array) $options['allowed_file_extensions']; |
|
40 | - } else { |
|
41 | - $this->allowed_file_extensions = ['csv']; |
|
42 | - } |
|
43 | - if (isset($options['allowed_mime_types'])) { |
|
44 | - $this->allowed_mime_types = (array) $options['allowed_file_extensions']; |
|
45 | - } else { |
|
46 | - $this->allowed_mime_types = ['text/csv']; |
|
47 | - } |
|
32 | + /** |
|
33 | + * @param array $options |
|
34 | + * @throws InvalidArgumentException |
|
35 | + */ |
|
36 | + public function __construct($options = array()) |
|
37 | + { |
|
38 | + if (isset($options['allowed_file_extensions'])) { |
|
39 | + $this->allowed_file_extensions = (array) $options['allowed_file_extensions']; |
|
40 | + } else { |
|
41 | + $this->allowed_file_extensions = ['csv']; |
|
42 | + } |
|
43 | + if (isset($options['allowed_mime_types'])) { |
|
44 | + $this->allowed_mime_types = (array) $options['allowed_file_extensions']; |
|
45 | + } else { |
|
46 | + $this->allowed_mime_types = ['text/csv']; |
|
47 | + } |
|
48 | 48 | |
49 | - $this->_set_display_strategy(new EE_File_Input_Display_Strategy()); |
|
50 | - $this->_set_normalization_strategy(new EE_File_Normalization()); |
|
51 | - $this->add_validation_strategy( |
|
52 | - new EE_Text_Validation_Strategy( |
|
53 | - sprintf( |
|
54 | - // translators: %1$s is a list of allowed file extensions. |
|
55 | - esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
|
56 | - implode(', ', $this->allowed_file_extensions) |
|
57 | - ), |
|
58 | - '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
59 | - ) |
|
60 | - ); |
|
61 | - parent::__construct($options); |
|
49 | + $this->_set_display_strategy(new EE_File_Input_Display_Strategy()); |
|
50 | + $this->_set_normalization_strategy(new EE_File_Normalization()); |
|
51 | + $this->add_validation_strategy( |
|
52 | + new EE_Text_Validation_Strategy( |
|
53 | + sprintf( |
|
54 | + // translators: %1$s is a list of allowed file extensions. |
|
55 | + esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
|
56 | + implode(', ', $this->allowed_file_extensions) |
|
57 | + ), |
|
58 | + '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
59 | + ) |
|
60 | + ); |
|
61 | + parent::__construct($options); |
|
62 | 62 | |
63 | 63 | // It would be great to add this HTML attribute, but jQuery validate chokes on it. |
64 | - $this->set_other_html_attributes( |
|
65 | - $this->other_html_attributes() |
|
66 | - . ' extension="' |
|
67 | - . implode( |
|
68 | - ',', |
|
69 | - $this->allowed_file_extensions |
|
70 | - ) |
|
71 | - . '"' |
|
72 | - ); |
|
73 | - } |
|
64 | + $this->set_other_html_attributes( |
|
65 | + $this->other_html_attributes() |
|
66 | + . ' extension="' |
|
67 | + . implode( |
|
68 | + ',', |
|
69 | + $this->allowed_file_extensions |
|
70 | + ) |
|
71 | + . '"' |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for |
|
77 | - * this input. |
|
78 | - * @since 4.9.80.p |
|
79 | - * @param array $req_data |
|
80 | - * @return FileSubmissionInterface |
|
81 | - * @throws InvalidArgumentException |
|
82 | - * @throws InvalidDataTypeException |
|
83 | - * @throws InvalidInterfaceException |
|
84 | - */ |
|
85 | - public function find_form_data_for_this_section($req_data) |
|
86 | - { |
|
87 | - // ignore $req_data. Files are in the files data handler. |
|
88 | - $fileDataHandler = LoaderFactory::getLoader()->getShared( |
|
89 | - 'EventEspresso\core\services\request\files\FilesDataHandler' |
|
90 | - ); |
|
91 | - return $fileDataHandler->getFileObject($this->html_name()); |
|
92 | - } |
|
75 | + /** |
|
76 | + * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for |
|
77 | + * this input. |
|
78 | + * @since 4.9.80.p |
|
79 | + * @param array $req_data |
|
80 | + * @return FileSubmissionInterface |
|
81 | + * @throws InvalidArgumentException |
|
82 | + * @throws InvalidDataTypeException |
|
83 | + * @throws InvalidInterfaceException |
|
84 | + */ |
|
85 | + public function find_form_data_for_this_section($req_data) |
|
86 | + { |
|
87 | + // ignore $req_data. Files are in the files data handler. |
|
88 | + $fileDataHandler = LoaderFactory::getLoader()->getShared( |
|
89 | + 'EventEspresso\core\services\request\files\FilesDataHandler' |
|
90 | + ); |
|
91 | + return $fileDataHandler->getFileObject($this->html_name()); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Don't transform the file submission object into a string, thanks. |
|
96 | - * |
|
97 | - * @param string $value |
|
98 | - * @return null|string |
|
99 | - */ |
|
100 | - protected function _sanitize($value) |
|
101 | - { |
|
102 | - return $value; |
|
103 | - } |
|
94 | + /** |
|
95 | + * Don't transform the file submission object into a string, thanks. |
|
96 | + * |
|
97 | + * @param string $value |
|
98 | + * @return null|string |
|
99 | + */ |
|
100 | + protected function _sanitize($value) |
|
101 | + { |
|
102 | + return $value; |
|
103 | + } |
|
104 | 104 | } |
@@ -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 invalid 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 invalid 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 | } |