@@ -21,96 +21,96 @@ |
||
21 | 21 | class RegisterCustomTaxonomies |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
26 | - */ |
|
27 | - public $custom_taxonomies; |
|
24 | + /** |
|
25 | + * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
26 | + */ |
|
27 | + public $custom_taxonomies; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * RegisterCustomTaxonomies constructor. |
|
32 | - * |
|
33 | - * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
34 | - */ |
|
35 | - public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
36 | - { |
|
37 | - $this->custom_taxonomies = $custom_taxonomies; |
|
38 | - } |
|
30 | + /** |
|
31 | + * RegisterCustomTaxonomies constructor. |
|
32 | + * |
|
33 | + * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
34 | + */ |
|
35 | + public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
36 | + { |
|
37 | + $this->custom_taxonomies = $custom_taxonomies; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @return void |
|
43 | - * @throws DomainException |
|
44 | - */ |
|
45 | - public function registerCustomTaxonomies() |
|
46 | - { |
|
47 | - $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
48 | - foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
49 | - $this->registerCustomTaxonomy( |
|
50 | - $taxonomy, |
|
51 | - $tax['singular_name'], |
|
52 | - $tax['plural_name'], |
|
53 | - $tax['args'] |
|
54 | - ); |
|
55 | - } |
|
56 | - } |
|
41 | + /** |
|
42 | + * @return void |
|
43 | + * @throws DomainException |
|
44 | + */ |
|
45 | + public function registerCustomTaxonomies() |
|
46 | + { |
|
47 | + $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
48 | + foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
49 | + $this->registerCustomTaxonomy( |
|
50 | + $taxonomy, |
|
51 | + $tax['singular_name'], |
|
52 | + $tax['plural_name'], |
|
53 | + $tax['args'] |
|
54 | + ); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Registers a custom taxonomy. Should be called before registering custom post types, |
|
61 | - * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
62 | - * |
|
63 | - * @param string $taxonomy_name , eg 'books' |
|
64 | - * @param string $singular_name internationalized singular name |
|
65 | - * @param string $plural_name internationalized plural name |
|
66 | - * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
67 | - * @throws DomainException |
|
68 | - */ |
|
69 | - public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
70 | - { |
|
71 | - $result = register_taxonomy( |
|
72 | - $taxonomy_name, |
|
73 | - null, |
|
74 | - $this->prepareArguments( |
|
75 | - $singular_name, |
|
76 | - $plural_name, |
|
77 | - $override_arguments |
|
78 | - ) |
|
79 | - ); |
|
80 | - if ($result instanceof WP_Error) { |
|
81 | - throw new DomainException($result->get_error_message()); |
|
82 | - } |
|
83 | - } |
|
59 | + /** |
|
60 | + * Registers a custom taxonomy. Should be called before registering custom post types, |
|
61 | + * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
62 | + * |
|
63 | + * @param string $taxonomy_name , eg 'books' |
|
64 | + * @param string $singular_name internationalized singular name |
|
65 | + * @param string $plural_name internationalized plural name |
|
66 | + * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
67 | + * @throws DomainException |
|
68 | + */ |
|
69 | + public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
70 | + { |
|
71 | + $result = register_taxonomy( |
|
72 | + $taxonomy_name, |
|
73 | + null, |
|
74 | + $this->prepareArguments( |
|
75 | + $singular_name, |
|
76 | + $plural_name, |
|
77 | + $override_arguments |
|
78 | + ) |
|
79 | + ); |
|
80 | + if ($result instanceof WP_Error) { |
|
81 | + throw new DomainException($result->get_error_message()); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @param string $singular_name |
|
88 | - * @param string $plural_name |
|
89 | - * @param array $override_arguments |
|
90 | - * @since $VID:$ |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - protected function prepareArguments($singular_name, $plural_name, array $override_arguments){ |
|
94 | - $arguments = array( |
|
95 | - 'hierarchical' => true, |
|
96 | - 'labels' => array( |
|
97 | - 'name' => $plural_name, |
|
98 | - 'singular_name' => $singular_name, |
|
99 | - ), |
|
100 | - 'show_ui' => true, |
|
101 | - 'show_ee_ui' => true, |
|
102 | - 'show_admin_column' => true, |
|
103 | - 'query_var' => true, |
|
104 | - 'show_in_nav_menus' => false, |
|
105 | - 'map_meta_cap' => true |
|
106 | - ); |
|
107 | - if ($override_arguments) { |
|
108 | - if (isset($override_args['labels'])) { |
|
109 | - $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
110 | - $arguments['labels'] = $labels; |
|
111 | - } |
|
112 | - $arguments = array_merge($arguments, $override_arguments); |
|
113 | - } |
|
114 | - return $arguments; |
|
115 | - } |
|
86 | + /** |
|
87 | + * @param string $singular_name |
|
88 | + * @param string $plural_name |
|
89 | + * @param array $override_arguments |
|
90 | + * @since $VID:$ |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + protected function prepareArguments($singular_name, $plural_name, array $override_arguments){ |
|
94 | + $arguments = array( |
|
95 | + 'hierarchical' => true, |
|
96 | + 'labels' => array( |
|
97 | + 'name' => $plural_name, |
|
98 | + 'singular_name' => $singular_name, |
|
99 | + ), |
|
100 | + 'show_ui' => true, |
|
101 | + 'show_ee_ui' => true, |
|
102 | + 'show_admin_column' => true, |
|
103 | + 'query_var' => true, |
|
104 | + 'show_in_nav_menus' => false, |
|
105 | + 'map_meta_cap' => true |
|
106 | + ); |
|
107 | + if ($override_arguments) { |
|
108 | + if (isset($override_args['labels'])) { |
|
109 | + $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
110 | + $arguments['labels'] = $labels; |
|
111 | + } |
|
112 | + $arguments = array_merge($arguments, $override_arguments); |
|
113 | + } |
|
114 | + return $arguments; |
|
115 | + } |
|
116 | 116 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @since $VID:$ |
91 | 91 | * @return array |
92 | 92 | */ |
93 | - protected function prepareArguments($singular_name, $plural_name, array $override_arguments){ |
|
93 | + protected function prepareArguments($singular_name, $plural_name, array $override_arguments) { |
|
94 | 94 | $arguments = array( |
95 | 95 | 'hierarchical' => true, |
96 | 96 | 'labels' => array( |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ); |
107 | 107 | if ($override_arguments) { |
108 | 108 | if (isset($override_args['labels'])) { |
109 | - $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
109 | + $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
110 | 110 | $arguments['labels'] = $labels; |
111 | 111 | } |
112 | 112 | $arguments = array_merge($arguments, $override_arguments); |
@@ -22,240 +22,240 @@ |
||
22 | 22 | class RegisterCustomPostTypes |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var CustomPostTypeDefinitions $custom_post_types |
|
27 | - */ |
|
28 | - public $custom_post_types; |
|
25 | + /** |
|
26 | + * @var CustomPostTypeDefinitions $custom_post_types |
|
27 | + */ |
|
28 | + public $custom_post_types; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @var WP_Post_Type[] $wp_post_types |
|
32 | - */ |
|
33 | - public $wp_post_types = array(); |
|
30 | + /** |
|
31 | + * @var WP_Post_Type[] $wp_post_types |
|
32 | + */ |
|
33 | + public $wp_post_types = array(); |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * RegisterCustomPostTypes constructor. |
|
38 | - * |
|
39 | - * @param CustomPostTypeDefinitions $custom_post_types |
|
40 | - */ |
|
41 | - public function __construct(CustomPostTypeDefinitions $custom_post_types) |
|
42 | - { |
|
43 | - $this->custom_post_types = $custom_post_types; |
|
44 | - } |
|
36 | + /** |
|
37 | + * RegisterCustomPostTypes constructor. |
|
38 | + * |
|
39 | + * @param CustomPostTypeDefinitions $custom_post_types |
|
40 | + */ |
|
41 | + public function __construct(CustomPostTypeDefinitions $custom_post_types) |
|
42 | + { |
|
43 | + $this->custom_post_types = $custom_post_types; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @return WP_Post_Type[] |
|
49 | - */ |
|
50 | - public function getRegisteredCustomPostTypes() |
|
51 | - { |
|
52 | - return $this->wp_post_types; |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return WP_Post_Type[] |
|
49 | + */ |
|
50 | + public function getRegisteredCustomPostTypes() |
|
51 | + { |
|
52 | + return $this->wp_post_types; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @return void |
|
58 | - * @throws DomainException |
|
59 | - */ |
|
60 | - public function registerCustomPostTypes() |
|
61 | - { |
|
62 | - $custom_post_types = $this->custom_post_types->getDefinitions(); |
|
63 | - foreach ($custom_post_types as $custom_post_type => $CPT) { |
|
64 | - $this->wp_post_types[ $custom_post_type ] = $this->registerCustomPostType( |
|
65 | - $custom_post_type, |
|
66 | - $CPT['singular_name'], |
|
67 | - $CPT['plural_name'], |
|
68 | - $CPT['singular_slug'], |
|
69 | - $CPT['plural_slug'], |
|
70 | - $CPT['args'] |
|
71 | - ); |
|
72 | - } |
|
73 | - } |
|
56 | + /** |
|
57 | + * @return void |
|
58 | + * @throws DomainException |
|
59 | + */ |
|
60 | + public function registerCustomPostTypes() |
|
61 | + { |
|
62 | + $custom_post_types = $this->custom_post_types->getDefinitions(); |
|
63 | + foreach ($custom_post_types as $custom_post_type => $CPT) { |
|
64 | + $this->wp_post_types[ $custom_post_type ] = $this->registerCustomPostType( |
|
65 | + $custom_post_type, |
|
66 | + $CPT['singular_name'], |
|
67 | + $CPT['plural_name'], |
|
68 | + $CPT['singular_slug'], |
|
69 | + $CPT['plural_slug'], |
|
70 | + $CPT['args'] |
|
71 | + ); |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Registers a new custom post type. Sets default settings given only the following params. |
|
78 | - * Returns the registered post type object, or an error object. |
|
79 | - * |
|
80 | - * @param string $post_type the actual post type name |
|
81 | - * IMPORTANT: |
|
82 | - * this must match what the slug is for admin pages related to this CPT |
|
83 | - * Also any models must use this slug as well |
|
84 | - * @param string $singular_name a pre-internationalized string for the singular name of the objects |
|
85 | - * @param string $plural_name a pre-internationalized string for the plural name of the objects |
|
86 | - * @param string $singular_slug |
|
87 | - * @param string $plural_slug |
|
88 | - * @param array $override_arguments exactly like $args as described in |
|
89 | - * http://codex.wordpress.org/Function_Reference/register_post_type |
|
90 | - * @return WP_Post_Type|WP_Error |
|
91 | - * @throws DomainException |
|
92 | - */ |
|
93 | - public function registerCustomPostType( |
|
94 | - $post_type, |
|
95 | - $singular_name, |
|
96 | - $plural_name, |
|
97 | - $singular_slug = '', |
|
98 | - $plural_slug = '', |
|
99 | - array $override_arguments = array() |
|
100 | - ) { |
|
101 | - $wp_post_type = register_post_type( |
|
102 | - $post_type, |
|
103 | - $this->prepareArguments( |
|
104 | - $post_type, |
|
105 | - $singular_name, |
|
106 | - $plural_name, |
|
107 | - $singular_slug, |
|
108 | - $plural_slug, |
|
109 | - $override_arguments |
|
110 | - ) |
|
111 | - ); |
|
112 | - if ($wp_post_type instanceof WP_Error) { |
|
113 | - throw new DomainException($wp_post_type->get_error_message()); |
|
114 | - } |
|
115 | - return $wp_post_type; |
|
116 | - } |
|
76 | + /** |
|
77 | + * Registers a new custom post type. Sets default settings given only the following params. |
|
78 | + * Returns the registered post type object, or an error object. |
|
79 | + * |
|
80 | + * @param string $post_type the actual post type name |
|
81 | + * IMPORTANT: |
|
82 | + * this must match what the slug is for admin pages related to this CPT |
|
83 | + * Also any models must use this slug as well |
|
84 | + * @param string $singular_name a pre-internationalized string for the singular name of the objects |
|
85 | + * @param string $plural_name a pre-internationalized string for the plural name of the objects |
|
86 | + * @param string $singular_slug |
|
87 | + * @param string $plural_slug |
|
88 | + * @param array $override_arguments exactly like $args as described in |
|
89 | + * http://codex.wordpress.org/Function_Reference/register_post_type |
|
90 | + * @return WP_Post_Type|WP_Error |
|
91 | + * @throws DomainException |
|
92 | + */ |
|
93 | + public function registerCustomPostType( |
|
94 | + $post_type, |
|
95 | + $singular_name, |
|
96 | + $plural_name, |
|
97 | + $singular_slug = '', |
|
98 | + $plural_slug = '', |
|
99 | + array $override_arguments = array() |
|
100 | + ) { |
|
101 | + $wp_post_type = register_post_type( |
|
102 | + $post_type, |
|
103 | + $this->prepareArguments( |
|
104 | + $post_type, |
|
105 | + $singular_name, |
|
106 | + $plural_name, |
|
107 | + $singular_slug, |
|
108 | + $plural_slug, |
|
109 | + $override_arguments |
|
110 | + ) |
|
111 | + ); |
|
112 | + if ($wp_post_type instanceof WP_Error) { |
|
113 | + throw new DomainException($wp_post_type->get_error_message()); |
|
114 | + } |
|
115 | + return $wp_post_type; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | - /** |
|
120 | - * @param string $post_type the actual post type name |
|
121 | - * @param string $singular_name a pre-internationalized string for the singular name of the objects |
|
122 | - * @param string $plural_name a pre-internationalized string for the plural name of the objects |
|
123 | - * @param string $singular_slug |
|
124 | - * @param string $plural_slug |
|
125 | - * @param array $override_arguments The default values set in this function will be overridden |
|
126 | - * by whatever you set in $override_arguments |
|
127 | - * @return array |
|
128 | - */ |
|
129 | - protected function prepareArguments( |
|
130 | - $post_type, |
|
131 | - $singular_name, |
|
132 | - $plural_name, |
|
133 | - $singular_slug, |
|
134 | - $plural_slug, |
|
135 | - array $override_arguments = array() |
|
136 | - ) { |
|
137 | - // verify plural slug and singular slug, if they aren't we'll use $singular_name and $plural_name |
|
138 | - $singular_slug = ! empty($singular_slug) ? $singular_slug : $singular_name; |
|
139 | - $plural_slug = ! empty($plural_slug) ? $plural_slug : $plural_name; |
|
140 | - $labels = $this->getLabels( |
|
141 | - $singular_name, |
|
142 | - $plural_name, |
|
143 | - $singular_slug, |
|
144 | - $plural_slug |
|
145 | - ); |
|
146 | - // note the page_templates arg in the supports index is something specific to EE. |
|
147 | - // WordPress doesn't actually have that in their register_post_type api. |
|
148 | - $arguments = $this->getDefaultArguments($labels, $post_type, $plural_slug); |
|
149 | - if ($override_arguments) { |
|
150 | - if (isset($override_arguments['labels'])) { |
|
151 | - $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
152 | - } |
|
153 | - $arguments = array_merge($arguments, $override_arguments); |
|
154 | - $arguments['labels'] = $labels; |
|
155 | - } |
|
156 | - return $arguments; |
|
157 | - } |
|
119 | + /** |
|
120 | + * @param string $post_type the actual post type name |
|
121 | + * @param string $singular_name a pre-internationalized string for the singular name of the objects |
|
122 | + * @param string $plural_name a pre-internationalized string for the plural name of the objects |
|
123 | + * @param string $singular_slug |
|
124 | + * @param string $plural_slug |
|
125 | + * @param array $override_arguments The default values set in this function will be overridden |
|
126 | + * by whatever you set in $override_arguments |
|
127 | + * @return array |
|
128 | + */ |
|
129 | + protected function prepareArguments( |
|
130 | + $post_type, |
|
131 | + $singular_name, |
|
132 | + $plural_name, |
|
133 | + $singular_slug, |
|
134 | + $plural_slug, |
|
135 | + array $override_arguments = array() |
|
136 | + ) { |
|
137 | + // verify plural slug and singular slug, if they aren't we'll use $singular_name and $plural_name |
|
138 | + $singular_slug = ! empty($singular_slug) ? $singular_slug : $singular_name; |
|
139 | + $plural_slug = ! empty($plural_slug) ? $plural_slug : $plural_name; |
|
140 | + $labels = $this->getLabels( |
|
141 | + $singular_name, |
|
142 | + $plural_name, |
|
143 | + $singular_slug, |
|
144 | + $plural_slug |
|
145 | + ); |
|
146 | + // note the page_templates arg in the supports index is something specific to EE. |
|
147 | + // WordPress doesn't actually have that in their register_post_type api. |
|
148 | + $arguments = $this->getDefaultArguments($labels, $post_type, $plural_slug); |
|
149 | + if ($override_arguments) { |
|
150 | + if (isset($override_arguments['labels'])) { |
|
151 | + $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
152 | + } |
|
153 | + $arguments = array_merge($arguments, $override_arguments); |
|
154 | + $arguments['labels'] = $labels; |
|
155 | + } |
|
156 | + return $arguments; |
|
157 | + } |
|
158 | 158 | |
159 | 159 | |
160 | - /** |
|
161 | - * @param string $singular_name |
|
162 | - * @param string $plural_name |
|
163 | - * @param string $singular_slug |
|
164 | - * @param string $plural_slug |
|
165 | - * @return array |
|
166 | - */ |
|
167 | - private function getLabels($singular_name, $plural_name, $singular_slug, $plural_slug) |
|
168 | - { |
|
169 | - return array( |
|
170 | - 'name' => $plural_name, |
|
171 | - 'singular_name' => $singular_name, |
|
172 | - 'singular_slug' => $singular_slug, |
|
173 | - 'plural_slug' => $plural_slug, |
|
174 | - 'add_new' => sprintf( |
|
175 | - esc_html_x('Add %s', 'Add Event', 'event_espresso'), |
|
176 | - $singular_name |
|
177 | - ), |
|
178 | - 'add_new_item' => sprintf( |
|
179 | - esc_html_x('Add New %s', 'Add New Event', 'event_espresso'), |
|
180 | - $singular_name |
|
181 | - ), |
|
182 | - 'edit_item' => sprintf( |
|
183 | - esc_html_x('Edit %s', 'Edit Event', 'event_espresso'), |
|
184 | - $singular_name |
|
185 | - ), |
|
186 | - 'new_item' => sprintf( |
|
187 | - esc_html_x('New %s', 'New Event', 'event_espresso'), |
|
188 | - $singular_name |
|
189 | - ), |
|
190 | - 'all_items' => sprintf( |
|
191 | - esc_html_x('All %s', 'All Events', 'event_espresso'), |
|
192 | - $plural_name |
|
193 | - ), |
|
194 | - 'view_item' => sprintf( |
|
195 | - esc_html_x('View %s', 'View Event', 'event_espresso'), |
|
196 | - $singular_name |
|
197 | - ), |
|
198 | - 'search_items' => sprintf( |
|
199 | - esc_html_x('Search %s', 'Search Events', 'event_espresso'), |
|
200 | - $plural_name |
|
201 | - ), |
|
202 | - 'not_found' => sprintf( |
|
203 | - esc_html_x('No %s found', 'No Events found', 'event_espresso'), |
|
204 | - $plural_name |
|
205 | - ), |
|
206 | - 'not_found_in_trash' => sprintf( |
|
207 | - esc_html_x('No %s found in Trash', 'No Events found in Trash', 'event_espresso'), |
|
208 | - $plural_name |
|
209 | - ), |
|
210 | - 'parent_item_colon' => '', |
|
211 | - 'menu_name' => $plural_name, |
|
212 | - ); |
|
213 | - } |
|
160 | + /** |
|
161 | + * @param string $singular_name |
|
162 | + * @param string $plural_name |
|
163 | + * @param string $singular_slug |
|
164 | + * @param string $plural_slug |
|
165 | + * @return array |
|
166 | + */ |
|
167 | + private function getLabels($singular_name, $plural_name, $singular_slug, $plural_slug) |
|
168 | + { |
|
169 | + return array( |
|
170 | + 'name' => $plural_name, |
|
171 | + 'singular_name' => $singular_name, |
|
172 | + 'singular_slug' => $singular_slug, |
|
173 | + 'plural_slug' => $plural_slug, |
|
174 | + 'add_new' => sprintf( |
|
175 | + esc_html_x('Add %s', 'Add Event', 'event_espresso'), |
|
176 | + $singular_name |
|
177 | + ), |
|
178 | + 'add_new_item' => sprintf( |
|
179 | + esc_html_x('Add New %s', 'Add New Event', 'event_espresso'), |
|
180 | + $singular_name |
|
181 | + ), |
|
182 | + 'edit_item' => sprintf( |
|
183 | + esc_html_x('Edit %s', 'Edit Event', 'event_espresso'), |
|
184 | + $singular_name |
|
185 | + ), |
|
186 | + 'new_item' => sprintf( |
|
187 | + esc_html_x('New %s', 'New Event', 'event_espresso'), |
|
188 | + $singular_name |
|
189 | + ), |
|
190 | + 'all_items' => sprintf( |
|
191 | + esc_html_x('All %s', 'All Events', 'event_espresso'), |
|
192 | + $plural_name |
|
193 | + ), |
|
194 | + 'view_item' => sprintf( |
|
195 | + esc_html_x('View %s', 'View Event', 'event_espresso'), |
|
196 | + $singular_name |
|
197 | + ), |
|
198 | + 'search_items' => sprintf( |
|
199 | + esc_html_x('Search %s', 'Search Events', 'event_espresso'), |
|
200 | + $plural_name |
|
201 | + ), |
|
202 | + 'not_found' => sprintf( |
|
203 | + esc_html_x('No %s found', 'No Events found', 'event_espresso'), |
|
204 | + $plural_name |
|
205 | + ), |
|
206 | + 'not_found_in_trash' => sprintf( |
|
207 | + esc_html_x('No %s found in Trash', 'No Events found in Trash', 'event_espresso'), |
|
208 | + $plural_name |
|
209 | + ), |
|
210 | + 'parent_item_colon' => '', |
|
211 | + 'menu_name' => $plural_name, |
|
212 | + ); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | - /** |
|
217 | - * @param array $labels |
|
218 | - * @param string $post_type |
|
219 | - * @param string $plural_slug |
|
220 | - * @return array |
|
221 | - */ |
|
222 | - private function getDefaultArguments(array $labels, $post_type, $plural_slug) |
|
223 | - { |
|
224 | - return array( |
|
225 | - 'labels' => $labels, |
|
226 | - 'public' => true, |
|
227 | - 'publicly_queryable' => true, |
|
228 | - 'show_ui' => false, |
|
229 | - 'show_ee_ui' => true, |
|
230 | - 'show_in_menu' => false, |
|
231 | - 'show_in_nav_menus' => false, |
|
232 | - 'query_var' => true, |
|
233 | - 'rewrite' => apply_filters( |
|
234 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_RegisterCustomPostTypes__getDefaultArguments__rewrite', |
|
235 | - // legacy filter applied for now, |
|
236 | - // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
237 | - apply_filters( |
|
238 | - 'FHEE__EE_Register_CPTs__register_CPT__rewrite', |
|
239 | - array('slug' => $plural_slug), |
|
240 | - $post_type |
|
241 | - ), |
|
242 | - $post_type, |
|
243 | - $plural_slug |
|
244 | - ), |
|
245 | - 'capability_type' => 'post', |
|
246 | - 'map_meta_cap' => true, |
|
247 | - 'has_archive' => true, |
|
248 | - 'hierarchical' => false, |
|
249 | - 'menu_position' => null, |
|
250 | - 'supports' => array( |
|
251 | - 'title', |
|
252 | - 'editor', |
|
253 | - 'author', |
|
254 | - 'thumbnail', |
|
255 | - 'excerpt', |
|
256 | - 'custom-fields', |
|
257 | - 'comments', |
|
258 | - ), |
|
259 | - ); |
|
260 | - } |
|
216 | + /** |
|
217 | + * @param array $labels |
|
218 | + * @param string $post_type |
|
219 | + * @param string $plural_slug |
|
220 | + * @return array |
|
221 | + */ |
|
222 | + private function getDefaultArguments(array $labels, $post_type, $plural_slug) |
|
223 | + { |
|
224 | + return array( |
|
225 | + 'labels' => $labels, |
|
226 | + 'public' => true, |
|
227 | + 'publicly_queryable' => true, |
|
228 | + 'show_ui' => false, |
|
229 | + 'show_ee_ui' => true, |
|
230 | + 'show_in_menu' => false, |
|
231 | + 'show_in_nav_menus' => false, |
|
232 | + 'query_var' => true, |
|
233 | + 'rewrite' => apply_filters( |
|
234 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_RegisterCustomPostTypes__getDefaultArguments__rewrite', |
|
235 | + // legacy filter applied for now, |
|
236 | + // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
237 | + apply_filters( |
|
238 | + 'FHEE__EE_Register_CPTs__register_CPT__rewrite', |
|
239 | + array('slug' => $plural_slug), |
|
240 | + $post_type |
|
241 | + ), |
|
242 | + $post_type, |
|
243 | + $plural_slug |
|
244 | + ), |
|
245 | + 'capability_type' => 'post', |
|
246 | + 'map_meta_cap' => true, |
|
247 | + 'has_archive' => true, |
|
248 | + 'hierarchical' => false, |
|
249 | + 'menu_position' => null, |
|
250 | + 'supports' => array( |
|
251 | + 'title', |
|
252 | + 'editor', |
|
253 | + 'author', |
|
254 | + 'thumbnail', |
|
255 | + 'excerpt', |
|
256 | + 'custom-fields', |
|
257 | + 'comments', |
|
258 | + ), |
|
259 | + ); |
|
260 | + } |
|
261 | 261 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | $custom_post_types = $this->custom_post_types->getDefinitions(); |
63 | 63 | foreach ($custom_post_types as $custom_post_type => $CPT) { |
64 | - $this->wp_post_types[ $custom_post_type ] = $this->registerCustomPostType( |
|
64 | + $this->wp_post_types[$custom_post_type] = $this->registerCustomPostType( |
|
65 | 65 | $custom_post_type, |
66 | 66 | $CPT['singular_name'], |
67 | 67 | $CPT['plural_name'], |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | |
64 | 64 | } else { |
65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | - /** |
|
68 | - * espresso_minimum_php_version_error |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | + /** |
|
68 | + * espresso_minimum_php_version_error |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.027'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.62.rc.027'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |