@@ -45,13 +45,13 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | $field_options['link_phone'] = array( |
48 | - 'type' => 'checkbox', |
|
49 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
50 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
51 | - 'value' => true, |
|
52 | - 'group' => 'display', |
|
53 | - 'priority' => 100, |
|
54 | - ); |
|
48 | + 'type' => 'checkbox', |
|
49 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
50 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
51 | + 'value' => true, |
|
52 | + 'group' => 'display', |
|
53 | + 'priority' => 100, |
|
54 | + ); |
|
55 | 55 | |
56 | 56 | return $field_options; |
57 | 57 | } |
@@ -10,42 +10,42 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if ( ! defined( 'WPINC' ) ) { |
13 | - die; |
|
13 | + die; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
17 | 17 | class GravityView_Edit_Entry_Admin { |
18 | 18 | |
19 | - protected $loader; |
|
19 | + protected $loader; |
|
20 | 20 | |
21 | - function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | - $this->loader = $loader; |
|
23 | - } |
|
21 | + function __construct( GravityView_Edit_Entry $loader ) { |
|
22 | + $this->loader = $loader; |
|
23 | + } |
|
24 | 24 | |
25 | - function load() { |
|
25 | + function load() { |
|
26 | 26 | |
27 | - if( !is_admin() ) { |
|
28 | - return; |
|
29 | - } |
|
27 | + if( !is_admin() ) { |
|
28 | + return; |
|
29 | + } |
|
30 | 30 | |
31 | - // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
31 | + // Add Edit Link as a default field, outside those set in the Gravity Form form |
|
32 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
33 | 33 | |
34 | - // For the Edit Entry Link, you don't want visible to all users. |
|
35 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
34 | + // For the Edit Entry Link, you don't want visible to all users. |
|
35 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
36 | 36 | |
37 | - // Modify the field options based on the name of the field type |
|
38 | - add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
37 | + // Modify the field options based on the name of the field type |
|
38 | + add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
|
39 | 39 | |
40 | - // add tooltips |
|
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
40 | + // add tooltips |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
42 | 42 | |
43 | - // custom fields' options for zone EDIT |
|
44 | - add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
43 | + // custom fields' options for zone EDIT |
|
44 | + add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
|
45 | 45 | |
46 | - // Add Edit Entry settings to View Settings |
|
47 | - add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | - } |
|
46 | + // Add Edit Entry settings to View Settings |
|
47 | + add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) ); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Render Edit Entry View metabox settings |
@@ -73,109 +73,109 @@ discard block |
||
73 | 73 | GravityView_Render_Settings::render_setting_row( 'action_label_cancel', $current_settings ); |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
78 | - * @param array $entry_default_fields Existing fields |
|
79 | - * @param string|array $form form_ID or form object |
|
80 | - * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
81 | - */ |
|
82 | - function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
83 | - |
|
84 | - if( $zone !== 'edit' ) { |
|
85 | - |
|
86 | - $entry_default_fields['edit_link'] = array( |
|
87 | - 'label' => __('Link to Edit Entry', 'gravityview'), |
|
88 | - 'type' => 'edit_link', |
|
89 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
90 | - 'icon' => 'dashicons-welcome-write-blog', |
|
91 | - ); |
|
92 | - |
|
93 | - } |
|
94 | - |
|
95 | - return $entry_default_fields; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Change wording for the Edit context to read Entry Creator |
|
100 | - * |
|
101 | - * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
102 | - * @param string $field_type Type of field options to render (`field` or `widget`) |
|
103 | - * @param string $template_id Table slug |
|
104 | - * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
105 | - * @param string $context What context are we in? Example: `single` or `directory` |
|
106 | - * @param string $input_type (textarea, list, select, etc.) |
|
107 | - * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
108 | - */ |
|
109 | - function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
110 | - |
|
111 | - $caps = $visibility_caps; |
|
112 | - |
|
113 | - // If we're configuring fields in the edit context, we want a limited selection |
|
114 | - if( $context === 'edit' ) { |
|
115 | - |
|
116 | - // Remove other built-in caps. |
|
117 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
118 | - |
|
119 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
120 | - } |
|
121 | - |
|
122 | - return $caps; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Add "Edit Link Text" setting to the edit_link field settings |
|
127 | - * |
|
128 | - * @param array $field_options |
|
129 | - * @param string $template_id |
|
130 | - * @param string $field_id |
|
131 | - * @param string $context |
|
132 | - * @param string $input_type |
|
133 | - * |
|
134 | - * @return array $field_options, with "Edit Link Text" field option |
|
135 | - */ |
|
136 | - function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
137 | - |
|
138 | - // Always a link, never a filter |
|
139 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
140 | - |
|
141 | - // Edit Entry link should only appear to visitors capable of editing entries |
|
142 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
143 | - |
|
144 | - $add_option['edit_link'] = array( |
|
145 | - 'type' => 'text', |
|
146 | - 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
147 | - 'desc' => NULL, |
|
148 | - 'value' => __('Edit Entry', 'gravityview'), |
|
149 | - 'merge_tags' => true, |
|
150 | - ); |
|
151 | - |
|
152 | - $add_option['new_window'] = array( |
|
153 | - 'type' => 'checkbox', |
|
154 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
155 | - 'value' => false, |
|
156 | - 'group' => 'display', |
|
157 | - 'priority' => 1300, |
|
158 | - ); |
|
159 | - |
|
160 | - return array_merge( $add_option, $field_options ); |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Add tooltips |
|
165 | - * @param array $tooltips Existing tooltips |
|
166 | - * @return array Modified tooltips |
|
167 | - */ |
|
168 | - function tooltips( $tooltips ) { |
|
169 | - |
|
170 | - $return = $tooltips; |
|
171 | - |
|
172 | - $return['allow_edit_cap'] = array( |
|
173 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
174 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
175 | - ); |
|
176 | - |
|
177 | - return $return; |
|
178 | - } |
|
76 | + /** |
|
77 | + * Add Edit Link as a default field, outside those set in the Gravity Form form |
|
78 | + * @param array $entry_default_fields Existing fields |
|
79 | + * @param string|array $form form_ID or form object |
|
80 | + * @param string $zone Either 'single', 'directory', 'header', 'footer' |
|
81 | + */ |
|
82 | + function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
|
83 | + |
|
84 | + if( $zone !== 'edit' ) { |
|
85 | + |
|
86 | + $entry_default_fields['edit_link'] = array( |
|
87 | + 'label' => __('Link to Edit Entry', 'gravityview'), |
|
88 | + 'type' => 'edit_link', |
|
89 | + 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
90 | + 'icon' => 'dashicons-welcome-write-blog', |
|
91 | + ); |
|
92 | + |
|
93 | + } |
|
94 | + |
|
95 | + return $entry_default_fields; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Change wording for the Edit context to read Entry Creator |
|
100 | + * |
|
101 | + * @param array $visibility_caps Array of capabilities to display in field dropdown. |
|
102 | + * @param string $field_type Type of field options to render (`field` or `widget`) |
|
103 | + * @param string $template_id Table slug |
|
104 | + * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
|
105 | + * @param string $context What context are we in? Example: `single` or `directory` |
|
106 | + * @param string $input_type (textarea, list, select, etc.) |
|
107 | + * @return array Array of field options with `label`, `value`, `type`, `default` keys |
|
108 | + */ |
|
109 | + function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
110 | + |
|
111 | + $caps = $visibility_caps; |
|
112 | + |
|
113 | + // If we're configuring fields in the edit context, we want a limited selection |
|
114 | + if( $context === 'edit' ) { |
|
115 | + |
|
116 | + // Remove other built-in caps. |
|
117 | + unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
118 | + |
|
119 | + $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
120 | + } |
|
121 | + |
|
122 | + return $caps; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Add "Edit Link Text" setting to the edit_link field settings |
|
127 | + * |
|
128 | + * @param array $field_options |
|
129 | + * @param string $template_id |
|
130 | + * @param string $field_id |
|
131 | + * @param string $context |
|
132 | + * @param string $input_type |
|
133 | + * |
|
134 | + * @return array $field_options, with "Edit Link Text" field option |
|
135 | + */ |
|
136 | + function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
137 | + |
|
138 | + // Always a link, never a filter |
|
139 | + unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
140 | + |
|
141 | + // Edit Entry link should only appear to visitors capable of editing entries |
|
142 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
143 | + |
|
144 | + $add_option['edit_link'] = array( |
|
145 | + 'type' => 'text', |
|
146 | + 'label' => __( 'Edit Link Text', 'gravityview' ), |
|
147 | + 'desc' => NULL, |
|
148 | + 'value' => __('Edit Entry', 'gravityview'), |
|
149 | + 'merge_tags' => true, |
|
150 | + ); |
|
151 | + |
|
152 | + $add_option['new_window'] = array( |
|
153 | + 'type' => 'checkbox', |
|
154 | + 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
155 | + 'value' => false, |
|
156 | + 'group' => 'display', |
|
157 | + 'priority' => 1300, |
|
158 | + ); |
|
159 | + |
|
160 | + return array_merge( $add_option, $field_options ); |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Add tooltips |
|
165 | + * @param array $tooltips Existing tooltips |
|
166 | + * @return array Modified tooltips |
|
167 | + */ |
|
168 | + function tooltips( $tooltips ) { |
|
169 | + |
|
170 | + $return = $tooltips; |
|
171 | + |
|
172 | + $return['allow_edit_cap'] = array( |
|
173 | + 'title' => __('Limiting Edit Access', 'gravityview'), |
|
174 | + 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
175 | + ); |
|
176 | + |
|
177 | + return $return; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | /** |
181 | 181 | * Add "Edit Link Text" setting to the edit_link field settings |
@@ -191,28 +191,28 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
193 | 193 | |
194 | - // We only want to modify the settings for the edit context |
|
195 | - if( 'edit' !== $context ) { |
|
196 | - return $field_options; |
|
197 | - } |
|
198 | - |
|
199 | - // Entry field is only for logged in users |
|
200 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
201 | - |
|
202 | - $add_options = array( |
|
203 | - 'allow_edit_cap' => array( |
|
204 | - 'type' => 'select', |
|
205 | - 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
206 | - 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
207 | - 'tooltip' => 'allow_edit_cap', |
|
208 | - 'class' => 'widefat', |
|
209 | - 'value' => 'read', // Default: entry creator |
|
210 | - 'group' => 'visibility', |
|
211 | - ), |
|
212 | - ); |
|
213 | - |
|
214 | - return array_merge( $field_options, $add_options ); |
|
215 | - } |
|
194 | + // We only want to modify the settings for the edit context |
|
195 | + if( 'edit' !== $context ) { |
|
196 | + return $field_options; |
|
197 | + } |
|
198 | + |
|
199 | + // Entry field is only for logged in users |
|
200 | + unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
201 | + |
|
202 | + $add_options = array( |
|
203 | + 'allow_edit_cap' => array( |
|
204 | + 'type' => 'select', |
|
205 | + 'label' => __( 'Make field editable to:', 'gravityview' ), |
|
206 | + 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
207 | + 'tooltip' => 'allow_edit_cap', |
|
208 | + 'class' => 'widefat', |
|
209 | + 'value' => 'read', // Default: entry creator |
|
210 | + 'group' => 'visibility', |
|
211 | + ), |
|
212 | + ); |
|
213 | + |
|
214 | + return array_merge( $field_options, $add_options ); |
|
215 | + } |
|
216 | 216 | |
217 | 217 | |
218 | 218 | } // end class |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | <div id="publishing-action"> |
21 | 21 | <?php |
22 | 22 | |
23 | - /** |
|
24 | - * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
25 | - * @since 1.11.1 |
|
26 | - * @since 2.11 The cancel link now uses history.back() so the $back_link URL matters less. |
|
27 | - * @param string $back_link Existing URL of the Cancel link |
|
28 | - * @param array $form The Gravity Forms form |
|
29 | - * @param array $entry The Gravity Forms entry |
|
30 | - * @param int $view_id The current View ID |
|
31 | - */ |
|
32 | - $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
23 | + /** |
|
24 | + * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
25 | + * @since 1.11.1 |
|
26 | + * @since 2.11 The cancel link now uses history.back() so the $back_link URL matters less. |
|
27 | + * @param string $back_link Existing URL of the Cancel link |
|
28 | + * @param array $form The Gravity Forms form |
|
29 | + * @param array $entry The Gravity Forms entry |
|
30 | + * @param int $view_id The current View ID |
|
31 | + */ |
|
32 | + $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container. |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @used-by GravityView_Delete_Entry::add_delete_button() |
85 | 85 | * |
86 | 86 | * @since 1.5.1 |
87 | - * @since 2.0.13 Added $post_id |
|
87 | + * @since 2.0.13 Added $post_id |
|
88 | 88 | * @param array $form The Gravity Forms form |
89 | 89 | * @param array $entry The Gravity Forms entry |
90 | 90 | * @param int $view_id The current View ID |
91 | - * @param int $post_id The current Post ID |
|
91 | + * @param int $post_id The current Post ID |
|
92 | 92 | */ |
93 | 93 | do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id ); |
94 | 94 | ?> |
@@ -17,118 +17,118 @@ |
||
17 | 17 | */ |
18 | 18 | abstract class AbstractLogger implements LoggerInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * System is unusable. |
|
22 | - * |
|
23 | - * @param string $message |
|
24 | - * @param mixed[] $context |
|
25 | - * |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function emergency($message, array $context = array()) |
|
29 | - { |
|
30 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
31 | - } |
|
20 | + /** |
|
21 | + * System is unusable. |
|
22 | + * |
|
23 | + * @param string $message |
|
24 | + * @param mixed[] $context |
|
25 | + * |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function emergency($message, array $context = array()) |
|
29 | + { |
|
30 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Action must be taken immediately. |
|
35 | - * |
|
36 | - * Example: Entire website down, database unavailable, etc. This should |
|
37 | - * trigger the SMS alerts and wake you up. |
|
38 | - * |
|
39 | - * @param string $message |
|
40 | - * @param mixed[] $context |
|
41 | - * |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function alert($message, array $context = array()) |
|
45 | - { |
|
46 | - $this->log(LogLevel::ALERT, $message, $context); |
|
47 | - } |
|
33 | + /** |
|
34 | + * Action must be taken immediately. |
|
35 | + * |
|
36 | + * Example: Entire website down, database unavailable, etc. This should |
|
37 | + * trigger the SMS alerts and wake you up. |
|
38 | + * |
|
39 | + * @param string $message |
|
40 | + * @param mixed[] $context |
|
41 | + * |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function alert($message, array $context = array()) |
|
45 | + { |
|
46 | + $this->log(LogLevel::ALERT, $message, $context); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Critical conditions. |
|
51 | - * |
|
52 | - * Example: Application component unavailable, unexpected exception. |
|
53 | - * |
|
54 | - * @param string $message |
|
55 | - * @param mixed[] $context |
|
56 | - * |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function critical($message, array $context = array()) |
|
60 | - { |
|
61 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
62 | - } |
|
49 | + /** |
|
50 | + * Critical conditions. |
|
51 | + * |
|
52 | + * Example: Application component unavailable, unexpected exception. |
|
53 | + * |
|
54 | + * @param string $message |
|
55 | + * @param mixed[] $context |
|
56 | + * |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function critical($message, array $context = array()) |
|
60 | + { |
|
61 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Runtime errors that do not require immediate action but should typically |
|
66 | - * be logged and monitored. |
|
67 | - * |
|
68 | - * @param string $message |
|
69 | - * @param mixed[] $context |
|
70 | - * |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function error($message, array $context = array()) |
|
74 | - { |
|
75 | - $this->log(LogLevel::ERROR, $message, $context); |
|
76 | - } |
|
64 | + /** |
|
65 | + * Runtime errors that do not require immediate action but should typically |
|
66 | + * be logged and monitored. |
|
67 | + * |
|
68 | + * @param string $message |
|
69 | + * @param mixed[] $context |
|
70 | + * |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function error($message, array $context = array()) |
|
74 | + { |
|
75 | + $this->log(LogLevel::ERROR, $message, $context); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Exceptional occurrences that are not errors. |
|
80 | - * |
|
81 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
82 | - * that are not necessarily wrong. |
|
83 | - * |
|
84 | - * @param string $message |
|
85 | - * @param mixed[] $context |
|
86 | - * |
|
87 | - * @return void |
|
88 | - */ |
|
89 | - public function warning($message, array $context = array()) |
|
90 | - { |
|
91 | - $this->log(LogLevel::WARNING, $message, $context); |
|
92 | - } |
|
78 | + /** |
|
79 | + * Exceptional occurrences that are not errors. |
|
80 | + * |
|
81 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
82 | + * that are not necessarily wrong. |
|
83 | + * |
|
84 | + * @param string $message |
|
85 | + * @param mixed[] $context |
|
86 | + * |
|
87 | + * @return void |
|
88 | + */ |
|
89 | + public function warning($message, array $context = array()) |
|
90 | + { |
|
91 | + $this->log(LogLevel::WARNING, $message, $context); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Normal but significant events. |
|
96 | - * |
|
97 | - * @param string $message |
|
98 | - * @param mixed[] $context |
|
99 | - * |
|
100 | - * @return void |
|
101 | - */ |
|
102 | - public function notice($message, array $context = array()) |
|
103 | - { |
|
104 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
105 | - } |
|
94 | + /** |
|
95 | + * Normal but significant events. |
|
96 | + * |
|
97 | + * @param string $message |
|
98 | + * @param mixed[] $context |
|
99 | + * |
|
100 | + * @return void |
|
101 | + */ |
|
102 | + public function notice($message, array $context = array()) |
|
103 | + { |
|
104 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Interesting events. |
|
109 | - * |
|
110 | - * Example: User logs in, SQL logs. |
|
111 | - * |
|
112 | - * @param string $message |
|
113 | - * @param mixed[] $context |
|
114 | - * |
|
115 | - * @return void |
|
116 | - */ |
|
117 | - public function info($message, array $context = array()) |
|
118 | - { |
|
119 | - $this->log(LogLevel::INFO, $message, $context); |
|
120 | - } |
|
107 | + /** |
|
108 | + * Interesting events. |
|
109 | + * |
|
110 | + * Example: User logs in, SQL logs. |
|
111 | + * |
|
112 | + * @param string $message |
|
113 | + * @param mixed[] $context |
|
114 | + * |
|
115 | + * @return void |
|
116 | + */ |
|
117 | + public function info($message, array $context = array()) |
|
118 | + { |
|
119 | + $this->log(LogLevel::INFO, $message, $context); |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * Detailed debug information. |
|
124 | - * |
|
125 | - * @param string $message |
|
126 | - * @param mixed[] $context |
|
127 | - * |
|
128 | - * @return void |
|
129 | - */ |
|
130 | - public function debug($message, array $context = array()) |
|
131 | - { |
|
132 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
133 | - } |
|
122 | + /** |
|
123 | + * Detailed debug information. |
|
124 | + * |
|
125 | + * @param string $message |
|
126 | + * @param mixed[] $context |
|
127 | + * |
|
128 | + * @return void |
|
129 | + */ |
|
130 | + public function debug($message, array $context = array()) |
|
131 | + { |
|
132 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
133 | + } |
|
134 | 134 | } |
@@ -13,20 +13,20 @@ |
||
13 | 13 | */ |
14 | 14 | trait LoggerAwareTrait |
15 | 15 | { |
16 | - /** |
|
17 | - * The logger instance. |
|
18 | - * |
|
19 | - * @var LoggerInterface|null |
|
20 | - */ |
|
21 | - protected $logger; |
|
16 | + /** |
|
17 | + * The logger instance. |
|
18 | + * |
|
19 | + * @var LoggerInterface|null |
|
20 | + */ |
|
21 | + protected $logger; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Sets a logger. |
|
25 | - * |
|
26 | - * @param LoggerInterface $logger |
|
27 | - */ |
|
28 | - public function setLogger(LoggerInterface $logger) |
|
29 | - { |
|
30 | - $this->logger = $logger; |
|
31 | - } |
|
23 | + /** |
|
24 | + * Sets a logger. |
|
25 | + * |
|
26 | + * @param LoggerInterface $logger |
|
27 | + */ |
|
28 | + public function setLogger(LoggerInterface $logger) |
|
29 | + { |
|
30 | + $this->logger = $logger; |
|
31 | + } |
|
32 | 32 | } |
@@ -13,12 +13,12 @@ |
||
13 | 13 | */ |
14 | 14 | interface LoggerAwareInterface |
15 | 15 | { |
16 | - /** |
|
17 | - * Sets a logger instance on the object. |
|
18 | - * |
|
19 | - * @param LoggerInterface $logger |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function setLogger(LoggerInterface $logger); |
|
16 | + /** |
|
17 | + * Sets a logger instance on the object. |
|
18 | + * |
|
19 | + * @param LoggerInterface $logger |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function setLogger(LoggerInterface $logger); |
|
24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
13 | 13 | */ |
14 | 14 | class LogLevel |
15 | 15 | { |
16 | - const EMERGENCY = 'emergency'; |
|
17 | - const ALERT = 'alert'; |
|
18 | - const CRITICAL = 'critical'; |
|
19 | - const ERROR = 'error'; |
|
20 | - const WARNING = 'warning'; |
|
21 | - const NOTICE = 'notice'; |
|
22 | - const INFO = 'info'; |
|
23 | - const DEBUG = 'debug'; |
|
16 | + const EMERGENCY = 'emergency'; |
|
17 | + const ALERT = 'alert'; |
|
18 | + const CRITICAL = 'critical'; |
|
19 | + const ERROR = 'error'; |
|
20 | + const WARNING = 'warning'; |
|
21 | + const NOTICE = 'notice'; |
|
22 | + const INFO = 'info'; |
|
23 | + const DEBUG = 'debug'; |
|
24 | 24 | } |
@@ -18,19 +18,19 @@ |
||
18 | 18 | */ |
19 | 19 | class NullLogger extends AbstractLogger |
20 | 20 | { |
21 | - /** |
|
22 | - * Logs with an arbitrary level. |
|
23 | - * |
|
24 | - * @param mixed $level |
|
25 | - * @param string $message |
|
26 | - * @param array $context |
|
27 | - * |
|
28 | - * @return void |
|
29 | - * |
|
30 | - * @throws \GravityView\Psr\Log\InvalidArgumentException |
|
31 | - */ |
|
32 | - public function log($level, $message, array $context = array()) |
|
33 | - { |
|
34 | - // noop |
|
35 | - } |
|
21 | + /** |
|
22 | + * Logs with an arbitrary level. |
|
23 | + * |
|
24 | + * @param mixed $level |
|
25 | + * @param string $message |
|
26 | + * @param array $context |
|
27 | + * |
|
28 | + * @return void |
|
29 | + * |
|
30 | + * @throws \GravityView\Psr\Log\InvalidArgumentException |
|
31 | + */ |
|
32 | + public function log($level, $message, array $context = array()) |
|
33 | + { |
|
34 | + // noop |
|
35 | + } |
|
36 | 36 | } |
@@ -18,131 +18,131 @@ |
||
18 | 18 | */ |
19 | 19 | trait LoggerTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * System is unusable. |
|
23 | - * |
|
24 | - * @param string $message |
|
25 | - * @param array $context |
|
26 | - * |
|
27 | - * @return void |
|
28 | - */ |
|
29 | - public function emergency($message, array $context = array()) |
|
30 | - { |
|
31 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
32 | - } |
|
21 | + /** |
|
22 | + * System is unusable. |
|
23 | + * |
|
24 | + * @param string $message |
|
25 | + * @param array $context |
|
26 | + * |
|
27 | + * @return void |
|
28 | + */ |
|
29 | + public function emergency($message, array $context = array()) |
|
30 | + { |
|
31 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Action must be taken immediately. |
|
36 | - * |
|
37 | - * Example: Entire website down, database unavailable, etc. This should |
|
38 | - * trigger the SMS alerts and wake you up. |
|
39 | - * |
|
40 | - * @param string $message |
|
41 | - * @param array $context |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function alert($message, array $context = array()) |
|
46 | - { |
|
47 | - $this->log(LogLevel::ALERT, $message, $context); |
|
48 | - } |
|
34 | + /** |
|
35 | + * Action must be taken immediately. |
|
36 | + * |
|
37 | + * Example: Entire website down, database unavailable, etc. This should |
|
38 | + * trigger the SMS alerts and wake you up. |
|
39 | + * |
|
40 | + * @param string $message |
|
41 | + * @param array $context |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function alert($message, array $context = array()) |
|
46 | + { |
|
47 | + $this->log(LogLevel::ALERT, $message, $context); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Critical conditions. |
|
52 | - * |
|
53 | - * Example: Application component unavailable, unexpected exception. |
|
54 | - * |
|
55 | - * @param string $message |
|
56 | - * @param array $context |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function critical($message, array $context = array()) |
|
61 | - { |
|
62 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
63 | - } |
|
50 | + /** |
|
51 | + * Critical conditions. |
|
52 | + * |
|
53 | + * Example: Application component unavailable, unexpected exception. |
|
54 | + * |
|
55 | + * @param string $message |
|
56 | + * @param array $context |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function critical($message, array $context = array()) |
|
61 | + { |
|
62 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Runtime errors that do not require immediate action but should typically |
|
67 | - * be logged and monitored. |
|
68 | - * |
|
69 | - * @param string $message |
|
70 | - * @param array $context |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - public function error($message, array $context = array()) |
|
75 | - { |
|
76 | - $this->log(LogLevel::ERROR, $message, $context); |
|
77 | - } |
|
65 | + /** |
|
66 | + * Runtime errors that do not require immediate action but should typically |
|
67 | + * be logged and monitored. |
|
68 | + * |
|
69 | + * @param string $message |
|
70 | + * @param array $context |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + public function error($message, array $context = array()) |
|
75 | + { |
|
76 | + $this->log(LogLevel::ERROR, $message, $context); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Exceptional occurrences that are not errors. |
|
81 | - * |
|
82 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
83 | - * that are not necessarily wrong. |
|
84 | - * |
|
85 | - * @param string $message |
|
86 | - * @param array $context |
|
87 | - * |
|
88 | - * @return void |
|
89 | - */ |
|
90 | - public function warning($message, array $context = array()) |
|
91 | - { |
|
92 | - $this->log(LogLevel::WARNING, $message, $context); |
|
93 | - } |
|
79 | + /** |
|
80 | + * Exceptional occurrences that are not errors. |
|
81 | + * |
|
82 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
83 | + * that are not necessarily wrong. |
|
84 | + * |
|
85 | + * @param string $message |
|
86 | + * @param array $context |
|
87 | + * |
|
88 | + * @return void |
|
89 | + */ |
|
90 | + public function warning($message, array $context = array()) |
|
91 | + { |
|
92 | + $this->log(LogLevel::WARNING, $message, $context); |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Normal but significant events. |
|
97 | - * |
|
98 | - * @param string $message |
|
99 | - * @param array $context |
|
100 | - * |
|
101 | - * @return void |
|
102 | - */ |
|
103 | - public function notice($message, array $context = array()) |
|
104 | - { |
|
105 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
106 | - } |
|
95 | + /** |
|
96 | + * Normal but significant events. |
|
97 | + * |
|
98 | + * @param string $message |
|
99 | + * @param array $context |
|
100 | + * |
|
101 | + * @return void |
|
102 | + */ |
|
103 | + public function notice($message, array $context = array()) |
|
104 | + { |
|
105 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Interesting events. |
|
110 | - * |
|
111 | - * Example: User logs in, SQL logs. |
|
112 | - * |
|
113 | - * @param string $message |
|
114 | - * @param array $context |
|
115 | - * |
|
116 | - * @return void |
|
117 | - */ |
|
118 | - public function info($message, array $context = array()) |
|
119 | - { |
|
120 | - $this->log(LogLevel::INFO, $message, $context); |
|
121 | - } |
|
108 | + /** |
|
109 | + * Interesting events. |
|
110 | + * |
|
111 | + * Example: User logs in, SQL logs. |
|
112 | + * |
|
113 | + * @param string $message |
|
114 | + * @param array $context |
|
115 | + * |
|
116 | + * @return void |
|
117 | + */ |
|
118 | + public function info($message, array $context = array()) |
|
119 | + { |
|
120 | + $this->log(LogLevel::INFO, $message, $context); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Detailed debug information. |
|
125 | - * |
|
126 | - * @param string $message |
|
127 | - * @param array $context |
|
128 | - * |
|
129 | - * @return void |
|
130 | - */ |
|
131 | - public function debug($message, array $context = array()) |
|
132 | - { |
|
133 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
134 | - } |
|
123 | + /** |
|
124 | + * Detailed debug information. |
|
125 | + * |
|
126 | + * @param string $message |
|
127 | + * @param array $context |
|
128 | + * |
|
129 | + * @return void |
|
130 | + */ |
|
131 | + public function debug($message, array $context = array()) |
|
132 | + { |
|
133 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Logs with an arbitrary level. |
|
138 | - * |
|
139 | - * @param mixed $level |
|
140 | - * @param string $message |
|
141 | - * @param array $context |
|
142 | - * |
|
143 | - * @return void |
|
144 | - * |
|
145 | - * @throws \GravityView\Psr\Log\InvalidArgumentException |
|
146 | - */ |
|
147 | - abstract public function log($level, $message, array $context = array()); |
|
136 | + /** |
|
137 | + * Logs with an arbitrary level. |
|
138 | + * |
|
139 | + * @param mixed $level |
|
140 | + * @param string $message |
|
141 | + * @param array $context |
|
142 | + * |
|
143 | + * @return void |
|
144 | + * |
|
145 | + * @throws \GravityView\Psr\Log\InvalidArgumentException |
|
146 | + */ |
|
147 | + abstract public function log($level, $message, array $context = array()); |
|
148 | 148 | } |