@@ -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 | ?> |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * ID of the current post. May also be ID of the current View. |
| 105 | - * |
|
| 106 | - * @since 2.0.13 |
|
| 107 | 105 | * |
| 108 | - * @var int |
|
| 106 | + * @since 2.0.13 |
|
| 107 | + * |
|
| 108 | + * @var int |
|
| 109 | 109 | */ |
| 110 | 110 | public $post_id; |
| 111 | 111 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function prevent_maybe_process_form() { |
| 191 | 191 | |
| 192 | - if( ! $this->is_edit_entry_submission() ) { |
|
| 192 | + if( ! $this->is_edit_entry_submission() ) { |
|
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | * When Edit entry view is requested setup the vars |
| 229 | 229 | */ |
| 230 | 230 | private function setup_vars() { |
| 231 | - global $post; |
|
| 231 | + global $post; |
|
| 232 | 232 | |
| 233 | 233 | $gravityview_view = GravityView_View::getInstance(); |
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | $entries = $gravityview_view->getEntries(); |
| 237 | - self::$original_entry = $entries[0]; |
|
| 238 | - $this->entry = $entries[0]; |
|
| 237 | + self::$original_entry = $entries[0]; |
|
| 238 | + $this->entry = $entries[0]; |
|
| 239 | 239 | |
| 240 | 240 | self::$original_form = GFAPI::get_form( $this->entry['form_id'] ); |
| 241 | 241 | $this->form = $gravityview_view->getForm(); |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | GFFormsModel::save_lead( $form, $this->entry ); |
| 382 | 382 | |
| 383 | - // Delete the values for hidden inputs |
|
| 384 | - $this->unset_hidden_field_values(); |
|
| 383 | + // Delete the values for hidden inputs |
|
| 384 | + $this->unset_hidden_field_values(); |
|
| 385 | 385 | |
| 386 | 386 | $this->entry['date_created'] = $date_created; |
| 387 | 387 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | // Perform actions normally performed after updating a lead |
| 395 | 395 | $this->after_update(); |
| 396 | 396 | |
| 397 | - /** |
|
| 397 | + /** |
|
| 398 | 398 | * Must be AFTER after_update()! |
| 399 | 399 | * @see https://github.com/gravityview/GravityView/issues/764 |
| 400 | 400 | */ |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | 404 | * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry |
| 405 | - * @since 2.1 Added $gv_data parameter |
|
| 405 | + * @since 2.1 Added $gv_data parameter |
|
| 406 | 406 | * @param array $form Gravity Forms form array |
| 407 | 407 | * @param string $entry_id Numeric ID of the entry that was updated |
| 408 | 408 | * @param GravityView_Edit_Entry_Render $this This object |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | * @return void |
| 427 | 427 | */ |
| 428 | 428 | private function unset_hidden_field_values() { |
| 429 | - global $wpdb; |
|
| 429 | + global $wpdb; |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - foreach ( $this->entry as $input_id => $field_value ) { |
|
| 453 | + foreach ( $this->entry as $input_id => $field_value ) { |
|
| 454 | 454 | |
| 455 | 455 | if ( ! is_numeric( $input_id ) ) { |
| 456 | 456 | continue; |
@@ -460,8 +460,8 @@ discard block |
||
| 460 | 460 | continue; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - // Reset fields that are or would be hidden |
|
| 464 | - if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) { |
|
| 463 | + // Reset fields that are or would be hidden |
|
| 464 | + if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) { |
|
| 465 | 465 | |
| 466 | 466 | $empty_value = $field->get_value_save_entry( |
| 467 | 467 | is_array( $field->get_entry_inputs() ) ? array() : '', |
@@ -473,16 +473,16 @@ discard block |
||
| 473 | 473 | $empty_value = ''; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id ); |
|
| 476 | + $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id ); |
|
| 477 | 477 | |
| 478 | - GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value ); |
|
| 478 | + GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value ); |
|
| 479 | 479 | |
| 480 | - // Prevent the $_POST values of hidden fields from being used as default values when rendering the form |
|
| 480 | + // Prevent the $_POST values of hidden fields from being used as default values when rendering the form |
|
| 481 | 481 | // after submission |
| 482 | - $post_input_id = 'input_' . str_replace( '.', '_', $input_id ); |
|
| 483 | - $_POST[ $post_input_id ] = ''; |
|
| 484 | - } |
|
| 485 | - } |
|
| 482 | + $post_input_id = 'input_' . str_replace( '.', '_', $input_id ); |
|
| 483 | + $_POST[ $post_input_id ] = ''; |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | |
| 638 | 638 | $form = $this->filter_conditional_logic( $this->form ); |
| 639 | 639 | |
| 640 | - /** @type GF_Field $field */ |
|
| 640 | + /** @type GF_Field $field */ |
|
| 641 | 641 | foreach( $form['fields'] as $k => &$field ) { |
| 642 | 642 | |
| 643 | 643 | /** |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
| 654 | 654 | foreach( $field->inputs as $key => $input ) { |
| 655 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
| 655 | + $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | |
| 693 | 693 | $inputs = $field->get_entry_inputs(); |
| 694 | 694 | if ( is_array( $inputs ) ) { |
| 695 | - foreach ( $inputs as $input ) { |
|
| 695 | + foreach ( $inputs as $input ) { |
|
| 696 | 696 | list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 ); |
| 697 | 697 | |
| 698 | 698 | if ( 'product' === $field->type ) { |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] ); |
| 714 | - } |
|
| 714 | + } |
|
| 715 | 715 | } else { |
| 716 | 716 | // Set to what it previously was if it's not editable |
| 717 | 717 | if ( ! in_array( $field->id, $allowed_fields ) ) { |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
| 758 | 758 | |
| 759 | 759 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
| 760 | - $ary = stripslashes_deep( $ary ); |
|
| 760 | + $ary = stripslashes_deep( $ary ); |
|
| 761 | 761 | $img_url = \GV\Utils::get( $ary, 0 ); |
| 762 | 762 | |
| 763 | 763 | $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | private function maybe_update_post_fields( $form ) { |
| 831 | 831 | |
| 832 | 832 | if( empty( $this->entry['post_id'] ) ) { |
| 833 | - gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
|
| 833 | + gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
|
| 834 | 834 | return; |
| 835 | 835 | } |
| 836 | 836 | |
@@ -865,49 +865,49 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | switch( $field->type ) { |
| 867 | 867 | |
| 868 | - case 'post_title': |
|
| 869 | - $post_title = $value; |
|
| 870 | - if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
|
| 871 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
| 872 | - } |
|
| 873 | - $updated_post->post_title = $post_title; |
|
| 874 | - $updated_post->post_name = $post_title; |
|
| 875 | - unset( $post_title ); |
|
| 876 | - break; |
|
| 877 | - |
|
| 878 | - case 'post_content': |
|
| 879 | - $post_content = $value; |
|
| 880 | - if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
|
| 881 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
| 882 | - } |
|
| 883 | - $updated_post->post_content = $post_content; |
|
| 884 | - unset( $post_content ); |
|
| 885 | - break; |
|
| 886 | - case 'post_excerpt': |
|
| 887 | - $updated_post->post_excerpt = $value; |
|
| 888 | - break; |
|
| 889 | - case 'post_tags': |
|
| 890 | - wp_set_post_tags( $post_id, $value, false ); |
|
| 891 | - break; |
|
| 892 | - case 'post_category': |
|
| 893 | - break; |
|
| 894 | - case 'post_custom_field': |
|
| 868 | + case 'post_title': |
|
| 869 | + $post_title = $value; |
|
| 870 | + if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
|
| 871 | + $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
| 872 | + } |
|
| 873 | + $updated_post->post_title = $post_title; |
|
| 874 | + $updated_post->post_name = $post_title; |
|
| 875 | + unset( $post_title ); |
|
| 876 | + break; |
|
| 877 | + |
|
| 878 | + case 'post_content': |
|
| 879 | + $post_content = $value; |
|
| 880 | + if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
|
| 881 | + $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
| 882 | + } |
|
| 883 | + $updated_post->post_content = $post_content; |
|
| 884 | + unset( $post_content ); |
|
| 885 | + break; |
|
| 886 | + case 'post_excerpt': |
|
| 887 | + $updated_post->post_excerpt = $value; |
|
| 888 | + break; |
|
| 889 | + case 'post_tags': |
|
| 890 | + wp_set_post_tags( $post_id, $value, false ); |
|
| 891 | + break; |
|
| 892 | + case 'post_category': |
|
| 893 | + break; |
|
| 894 | + case 'post_custom_field': |
|
| 895 | 895 | if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) { |
| 896 | 896 | $value = $value[ $field_id ]; |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 900 | - $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
|
| 901 | - } |
|
| 899 | + if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 900 | + $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
|
| 901 | + } |
|
| 902 | 902 | |
| 903 | 903 | $value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry ); |
| 904 | 904 | |
| 905 | - update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
|
| 906 | - break; |
|
| 905 | + update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
|
| 906 | + break; |
|
| 907 | 907 | |
| 908 | - case 'post_image': |
|
| 909 | - $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id ); |
|
| 910 | - break; |
|
| 908 | + case 'post_image': |
|
| 909 | + $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id ); |
|
| 910 | + break; |
|
| 911 | 911 | |
| 912 | 912 | } |
| 913 | 913 | |
@@ -1077,14 +1077,14 @@ discard block |
||
| 1077 | 1077 | ?><h2 class="gv-edit-entry-title"> |
| 1078 | 1078 | <span><?php |
| 1079 | 1079 | |
| 1080 | - /** |
|
| 1081 | - * @filter `gravityview_edit_entry_title` Modify the edit entry title |
|
| 1082 | - * @param string $edit_entry_title Modify the "Edit Entry" title |
|
| 1083 | - * @param GravityView_Edit_Entry_Render $this This object |
|
| 1084 | - */ |
|
| 1085 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
| 1080 | + /** |
|
| 1081 | + * @filter `gravityview_edit_entry_title` Modify the edit entry title |
|
| 1082 | + * @param string $edit_entry_title Modify the "Edit Entry" title |
|
| 1083 | + * @param GravityView_Edit_Entry_Render $this This object |
|
| 1084 | + */ |
|
| 1085 | + $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
| 1086 | 1086 | |
| 1087 | - echo esc_attr( $edit_entry_title ); |
|
| 1087 | + echo esc_attr( $edit_entry_title ); |
|
| 1088 | 1088 | ?></span> |
| 1089 | 1089 | </h2> |
| 1090 | 1090 | |
@@ -1139,13 +1139,13 @@ discard block |
||
| 1139 | 1139 | ); |
| 1140 | 1140 | |
| 1141 | 1141 | /** |
| 1142 | - * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels |
|
| 1143 | - * @since 1.16.3 |
|
| 1144 | - * @param array $labels Default button labels associative array |
|
| 1145 | - * @param array $form The Gravity Forms form |
|
| 1146 | - * @param array $entry The Gravity Forms entry |
|
| 1147 | - * @param int $view_id The current View ID |
|
| 1148 | - */ |
|
| 1142 | + * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels |
|
| 1143 | + * @since 1.16.3 |
|
| 1144 | + * @param array $labels Default button labels associative array |
|
| 1145 | + * @param array $form The Gravity Forms form |
|
| 1146 | + * @param array $entry The Gravity Forms entry |
|
| 1147 | + * @param int $view_id The current View ID |
|
| 1148 | + */ |
|
| 1149 | 1149 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
| 1150 | 1150 | |
| 1151 | 1151 | $this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit']; |
@@ -1182,26 +1182,26 @@ discard block |
||
| 1182 | 1182 | |
| 1183 | 1183 | switch ( $edit_redirect ) { |
| 1184 | 1184 | |
| 1185 | - case '0': |
|
| 1186 | - $redirect_url = $back_link; |
|
| 1187 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' ); |
|
| 1188 | - break; |
|
| 1189 | - |
|
| 1190 | - case '1': |
|
| 1191 | - $redirect_url = $directory_link = GravityView_API::directory_link(); |
|
| 1192 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
| 1193 | - break; |
|
| 1194 | - |
|
| 1195 | - case '2': |
|
| 1196 | - $redirect_url = $edit_redirect_url; |
|
| 1197 | - $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' ); |
|
| 1198 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
| 1199 | - break; |
|
| 1200 | - |
|
| 1201 | - case '': |
|
| 1202 | - default: |
|
| 1203 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' ); |
|
| 1204 | - break; |
|
| 1185 | + case '0': |
|
| 1186 | + $redirect_url = $back_link; |
|
| 1187 | + $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' ); |
|
| 1188 | + break; |
|
| 1189 | + |
|
| 1190 | + case '1': |
|
| 1191 | + $redirect_url = $directory_link = GravityView_API::directory_link(); |
|
| 1192 | + $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
| 1193 | + break; |
|
| 1194 | + |
|
| 1195 | + case '2': |
|
| 1196 | + $redirect_url = $edit_redirect_url; |
|
| 1197 | + $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' ); |
|
| 1198 | + $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
| 1199 | + break; |
|
| 1200 | + |
|
| 1201 | + case '': |
|
| 1202 | + default: |
|
| 1203 | + $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' ); |
|
| 1204 | + break; |
|
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | if ( isset( $redirect_url ) ) { |
@@ -1267,13 +1267,13 @@ discard block |
||
| 1267 | 1267 | ); |
| 1268 | 1268 | |
| 1269 | 1269 | /** |
| 1270 | - * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels |
|
| 1271 | - * @since 1.16.3 |
|
| 1272 | - * @param array $labels Default button labels associative array |
|
| 1273 | - * @param array $form The Gravity Forms form |
|
| 1274 | - * @param array $entry The Gravity Forms entry |
|
| 1275 | - * @param int $view_id The current View ID |
|
| 1276 | - */ |
|
| 1270 | + * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels |
|
| 1271 | + * @since 1.16.3 |
|
| 1272 | + * @param array $labels Default button labels associative array |
|
| 1273 | + * @param array $form The Gravity Forms form |
|
| 1274 | + * @param array $entry The Gravity Forms entry |
|
| 1275 | + * @param int $view_id The current View ID |
|
| 1276 | + */ |
|
| 1277 | 1277 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
| 1278 | 1278 | |
| 1279 | 1279 | GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form; |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | |
| 1320 | 1320 | ob_get_clean(); |
| 1321 | 1321 | |
| 1322 | - remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 ); |
|
| 1322 | + remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 ); |
|
| 1323 | 1323 | remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
| 1324 | 1324 | remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) ); |
| 1325 | 1325 | remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) ); |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | |
| 1380 | 1380 | // for now we don't support Save and Continue feature. |
| 1381 | 1381 | if( ! self::$supports_save_and_continue ) { |
| 1382 | - unset( $form['save'] ); |
|
| 1382 | + unset( $form['save'] ); |
|
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | $form = $this->unselect_default_values( $form ); |
@@ -1406,30 +1406,30 @@ discard block |
||
| 1406 | 1406 | return $field_content; |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | - $message = null; |
|
| 1409 | + $message = null; |
|
| 1410 | 1410 | |
| 1411 | - // First, make sure they have the capability to edit the post. |
|
| 1412 | - if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
| 1411 | + // First, make sure they have the capability to edit the post. |
|
| 1412 | + if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
| 1413 | 1413 | |
| 1414 | - /** |
|
| 1415 | - * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
|
| 1416 | - * @param string $message The existing "You don't have permission..." text |
|
| 1417 | - */ |
|
| 1418 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
| 1414 | + /** |
|
| 1415 | + * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
|
| 1416 | + * @param string $message The existing "You don't have permission..." text |
|
| 1417 | + */ |
|
| 1418 | + $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
| 1419 | 1419 | |
| 1420 | - } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
| 1421 | - /** |
|
| 1422 | - * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
|
| 1423 | - * @param string $message The existing "This field is not editable; the post no longer exists." text |
|
| 1424 | - */ |
|
| 1425 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1426 | - } |
|
| 1420 | + } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
| 1421 | + /** |
|
| 1422 | + * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
|
| 1423 | + * @param string $message The existing "This field is not editable; the post no longer exists." text |
|
| 1424 | + */ |
|
| 1425 | + $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1426 | + } |
|
| 1427 | 1427 | |
| 1428 | - if( $message ) { |
|
| 1429 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1430 | - } |
|
| 1428 | + if( $message ) { |
|
| 1429 | + $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1430 | + } |
|
| 1431 | 1431 | |
| 1432 | - return $field_content; |
|
| 1432 | + return $field_content; |
|
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | 1435 | /** |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | || ! empty( $field_content ) |
| 1458 | 1458 | || in_array( $field->type, array( 'honeypot' ) ) |
| 1459 | 1459 | ) { |
| 1460 | - return $field_content; |
|
| 1460 | + return $field_content; |
|
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | // SET SOME FIELD DEFAULTS TO PREVENT ISSUES |
@@ -1465,24 +1465,24 @@ discard block |
||
| 1465 | 1465 | |
| 1466 | 1466 | $field_value = $this->get_field_value( $field ); |
| 1467 | 1467 | |
| 1468 | - // Prevent any PHP warnings, like undefined index |
|
| 1469 | - ob_start(); |
|
| 1468 | + // Prevent any PHP warnings, like undefined index |
|
| 1469 | + ob_start(); |
|
| 1470 | 1470 | |
| 1471 | - $return = null; |
|
| 1471 | + $return = null; |
|
| 1472 | 1472 | |
| 1473 | 1473 | /** @var GravityView_Field $gv_field */ |
| 1474 | 1474 | if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
| 1475 | 1475 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
| 1476 | 1476 | } else { |
| 1477 | - $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
|
| 1478 | - } |
|
| 1477 | + $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
|
| 1478 | + } |
|
| 1479 | 1479 | |
| 1480 | - // If there was output, it's an error |
|
| 1481 | - $warnings = ob_get_clean(); |
|
| 1480 | + // If there was output, it's an error |
|
| 1481 | + $warnings = ob_get_clean(); |
|
| 1482 | 1482 | |
| 1483 | - if( !empty( $warnings ) ) { |
|
| 1484 | - gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
|
| 1485 | - } |
|
| 1483 | + if( !empty( $warnings ) ) { |
|
| 1484 | + gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
|
| 1485 | + } |
|
| 1486 | 1486 | |
| 1487 | 1487 | return $return; |
| 1488 | 1488 | } |
@@ -1517,8 +1517,8 @@ discard block |
||
| 1517 | 1517 | $input_id = strval( $input['id'] ); |
| 1518 | 1518 | |
| 1519 | 1519 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
| 1520 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1521 | - $allow_pre_populated = false; |
|
| 1520 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1521 | + $allow_pre_populated = false; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | } |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
| 1543 | 1543 | $categories = array(); |
| 1544 | 1544 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
| 1545 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1545 | + $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1546 | 1546 | } |
| 1547 | 1547 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
| 1548 | 1548 | } |
@@ -1552,25 +1552,25 @@ discard block |
||
| 1552 | 1552 | // if value is empty get the default value if defined |
| 1553 | 1553 | $field_value = $field->get_value_default_if_empty( $field_value ); |
| 1554 | 1554 | |
| 1555 | - /** |
|
| 1556 | - * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed |
|
| 1557 | - * @since 1.11 |
|
| 1558 | - * @since 1.20 Added third param |
|
| 1559 | - * @param mixed $field_value field value used to populate the input |
|
| 1560 | - * @param object $field Gravity Forms field object ( Class GF_Field ) |
|
| 1561 | - * @param GravityView_Edit_Entry_Render $this Current object |
|
| 1562 | - */ |
|
| 1563 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this ); |
|
| 1564 | - |
|
| 1565 | - /** |
|
| 1566 | - * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type |
|
| 1567 | - * @since 1.17 |
|
| 1568 | - * @since 1.20 Added third param |
|
| 1569 | - * @param mixed $field_value field value used to populate the input |
|
| 1570 | - * @param GF_Field $field Gravity Forms field object |
|
| 1571 | - * @param GravityView_Edit_Entry_Render $this Current object |
|
| 1572 | - */ |
|
| 1573 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
| 1555 | + /** |
|
| 1556 | + * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed |
|
| 1557 | + * @since 1.11 |
|
| 1558 | + * @since 1.20 Added third param |
|
| 1559 | + * @param mixed $field_value field value used to populate the input |
|
| 1560 | + * @param object $field Gravity Forms field object ( Class GF_Field ) |
|
| 1561 | + * @param GravityView_Edit_Entry_Render $this Current object |
|
| 1562 | + */ |
|
| 1563 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this ); |
|
| 1564 | + |
|
| 1565 | + /** |
|
| 1566 | + * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type |
|
| 1567 | + * @since 1.17 |
|
| 1568 | + * @since 1.20 Added third param |
|
| 1569 | + * @param mixed $field_value field value used to populate the input |
|
| 1570 | + * @param GF_Field $field Gravity Forms field object |
|
| 1571 | + * @param GravityView_Edit_Entry_Render $this Current object |
|
| 1572 | + */ |
|
| 1573 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
| 1574 | 1574 | |
| 1575 | 1575 | return $field_value; |
| 1576 | 1576 | } |
@@ -1597,7 +1597,7 @@ discard block |
||
| 1597 | 1597 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
| 1598 | 1598 | // expects certain field array items to be set. |
| 1599 | 1599 | foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) { |
| 1600 | - $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
|
| 1600 | + $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
|
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | switch( RGFormsModel::get_input_type( $field ) ) { |
@@ -1611,31 +1611,31 @@ discard block |
||
| 1611 | 1611 | */ |
| 1612 | 1612 | case 'fileupload': |
| 1613 | 1613 | |
| 1614 | - // Set the previous value |
|
| 1615 | - $entry = $this->get_entry(); |
|
| 1614 | + // Set the previous value |
|
| 1615 | + $entry = $this->get_entry(); |
|
| 1616 | 1616 | |
| 1617 | - $input_name = 'input_'.$field->id; |
|
| 1618 | - $form_id = $form['id']; |
|
| 1617 | + $input_name = 'input_'.$field->id; |
|
| 1618 | + $form_id = $form['id']; |
|
| 1619 | 1619 | |
| 1620 | - $value = NULL; |
|
| 1620 | + $value = NULL; |
|
| 1621 | 1621 | |
| 1622 | - // Use the previous entry value as the default. |
|
| 1623 | - if( isset( $entry[ $field->id ] ) ) { |
|
| 1624 | - $value = $entry[ $field->id ]; |
|
| 1625 | - } |
|
| 1622 | + // Use the previous entry value as the default. |
|
| 1623 | + if( isset( $entry[ $field->id ] ) ) { |
|
| 1624 | + $value = $entry[ $field->id ]; |
|
| 1625 | + } |
|
| 1626 | 1626 | |
| 1627 | - // If this is a single upload file |
|
| 1628 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 1629 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
| 1630 | - $value = $file_path['url']; |
|
| 1627 | + // If this is a single upload file |
|
| 1628 | + if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 1629 | + $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
| 1630 | + $value = $file_path['url']; |
|
| 1631 | 1631 | |
| 1632 | - } else { |
|
| 1632 | + } else { |
|
| 1633 | 1633 | |
| 1634 | - // Fix PHP warning on line 1498 of form_display.php for post_image fields |
|
| 1635 | - // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
|
| 1636 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
| 1634 | + // Fix PHP warning on line 1498 of form_display.php for post_image fields |
|
| 1635 | + // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
|
| 1636 | + $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
| 1637 | 1637 | |
| 1638 | - } |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | 1640 | if ( \GV\Utils::get( $field, 'multipleFiles' ) ) { |
| 1641 | 1641 | // If there are fresh uploads, process and merge them. |
@@ -1656,17 +1656,17 @@ discard block |
||
| 1656 | 1656 | GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value; |
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | - $this->entry[ $input_name ] = $value; |
|
| 1660 | - $_POST[ $input_name ] = $value; |
|
| 1659 | + $this->entry[ $input_name ] = $value; |
|
| 1660 | + $_POST[ $input_name ] = $value; |
|
| 1661 | 1661 | |
| 1662 | - break; |
|
| 1662 | + break; |
|
| 1663 | 1663 | |
| 1664 | 1664 | case 'number': |
| 1665 | - // Fix "undefined index" issue at line 1286 in form_display.php |
|
| 1666 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
| 1667 | - $_POST['input_'.$field->id ] = NULL; |
|
| 1668 | - } |
|
| 1669 | - break; |
|
| 1665 | + // Fix "undefined index" issue at line 1286 in form_display.php |
|
| 1666 | + if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
| 1667 | + $_POST['input_'.$field->id ] = NULL; |
|
| 1668 | + } |
|
| 1669 | + break; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | } |
@@ -1787,7 +1787,7 @@ discard block |
||
| 1787 | 1787 | |
| 1788 | 1788 | // count uploaded files and existent entry files |
| 1789 | 1789 | $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) + |
| 1790 | - ( is_array( $value ) ? count( $value ) : 0 ); |
|
| 1790 | + ( is_array( $value ) ? count( $value ) : 0 ); |
|
| 1791 | 1791 | |
| 1792 | 1792 | if ( $count_files > $field->maxFiles ) { |
| 1793 | 1793 | $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
@@ -1809,47 +1809,47 @@ discard block |
||
| 1809 | 1809 | |
| 1810 | 1810 | switch ( $field_type ) { |
| 1811 | 1811 | |
| 1812 | - // Captchas don't need to be re-entered. |
|
| 1813 | - case 'captcha': |
|
| 1812 | + // Captchas don't need to be re-entered. |
|
| 1813 | + case 'captcha': |
|
| 1814 | 1814 | |
| 1815 | - // Post Image fields aren't editable, so we un-fail them. |
|
| 1816 | - case 'post_image': |
|
| 1817 | - $field->failed_validation = false; |
|
| 1818 | - unset( $field->validation_message ); |
|
| 1819 | - break; |
|
| 1815 | + // Post Image fields aren't editable, so we un-fail them. |
|
| 1816 | + case 'post_image': |
|
| 1817 | + $field->failed_validation = false; |
|
| 1818 | + unset( $field->validation_message ); |
|
| 1819 | + break; |
|
| 1820 | 1820 | |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | 1823 | // You can't continue inside a switch, so we do it after. |
| 1824 | 1824 | if( empty( $field->failed_validation ) ) { |
| 1825 | - continue; |
|
| 1825 | + continue; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | |
| 1828 | 1828 | // checks if the No Duplicates option is not validating entry against itself, since |
| 1829 | 1829 | // we're editing a stored entry, it would also assume it's a duplicate. |
| 1830 | 1830 | if( !empty( $field->noDuplicates ) ) { |
| 1831 | 1831 | |
| 1832 | - $entry = $this->get_entry(); |
|
| 1832 | + $entry = $this->get_entry(); |
|
| 1833 | 1833 | |
| 1834 | - // If the value of the entry is the same as the stored value |
|
| 1835 | - // Then we can assume it's not a duplicate, it's the same. |
|
| 1836 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1837 | - //if value submitted was not changed, then don't validate |
|
| 1838 | - $field->failed_validation = false; |
|
| 1834 | + // If the value of the entry is the same as the stored value |
|
| 1835 | + // Then we can assume it's not a duplicate, it's the same. |
|
| 1836 | + if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1837 | + //if value submitted was not changed, then don't validate |
|
| 1838 | + $field->failed_validation = false; |
|
| 1839 | 1839 | |
| 1840 | - unset( $field->validation_message ); |
|
| 1840 | + unset( $field->validation_message ); |
|
| 1841 | 1841 | |
| 1842 | - gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) ); |
|
| 1842 | + gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) ); |
|
| 1843 | 1843 | |
| 1844 | - continue; |
|
| 1845 | - } |
|
| 1844 | + continue; |
|
| 1845 | + } |
|
| 1846 | 1846 | } |
| 1847 | 1847 | |
| 1848 | 1848 | // if here then probably we are facing the validation 'At least one field must be filled out' |
| 1849 | 1849 | if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
| 1850 | - unset( $field->validation_message ); |
|
| 1850 | + unset( $field->validation_message ); |
|
| 1851 | 1851 | $field->failed_validation = false; |
| 1852 | - continue; |
|
| 1852 | + continue; |
|
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | $gv_valid = false; |
@@ -1913,8 +1913,8 @@ discard block |
||
| 1913 | 1913 | // Hide fields depending on admin settings |
| 1914 | 1914 | $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
| 1915 | 1915 | |
| 1916 | - // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
|
| 1917 | - $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
|
| 1916 | + // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
|
| 1917 | + $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
|
| 1918 | 1918 | |
| 1919 | 1919 | /** |
| 1920 | 1920 | * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form |
@@ -2005,11 +2005,11 @@ discard block |
||
| 2005 | 2005 | // The edit tab has been configured, so we loop through to configured settings |
| 2006 | 2006 | foreach ( $configured_fields as $configured_field ) { |
| 2007 | 2007 | |
| 2008 | - /** @var GF_Field $field */ |
|
| 2009 | - foreach ( $fields as $field ) { |
|
| 2008 | + /** @var GF_Field $field */ |
|
| 2009 | + foreach ( $fields as $field ) { |
|
| 2010 | 2010 | if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
| 2011 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
| 2012 | - break; |
|
| 2011 | + $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
| 2012 | + break; |
|
| 2013 | 2013 | } |
| 2014 | 2014 | |
| 2015 | 2015 | } |
@@ -2065,28 +2065,28 @@ discard block |
||
| 2065 | 2065 | */ |
| 2066 | 2066 | private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) { |
| 2067 | 2067 | |
| 2068 | - /** |
|
| 2068 | + /** |
|
| 2069 | 2069 | * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true |
| 2070 | - * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
|
| 2071 | - * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
|
| 2072 | - * @since 1.9.1 |
|
| 2073 | - * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
|
| 2074 | - * @param array $form GF Form array |
|
| 2075 | - * @param int $view_id View ID |
|
| 2076 | - */ |
|
| 2077 | - $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
|
| 2078 | - |
|
| 2079 | - if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
| 2070 | + * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
|
| 2071 | + * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
|
| 2072 | + * @since 1.9.1 |
|
| 2073 | + * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
|
| 2074 | + * @param array $form GF Form array |
|
| 2075 | + * @param int $view_id View ID |
|
| 2076 | + */ |
|
| 2077 | + $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
|
| 2078 | + |
|
| 2079 | + if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
| 2080 | 2080 | foreach( $fields as $k => $field ) { |
| 2081 | 2081 | if( $field->adminOnly ) { |
| 2082 | - unset( $fields[ $k ] ); |
|
| 2082 | + unset( $fields[ $k ] ); |
|
| 2083 | 2083 | } |
| 2084 | 2084 | } |
| 2085 | 2085 | return array_values( $fields ); |
| 2086 | 2086 | } |
| 2087 | 2087 | |
| 2088 | - foreach( $fields as &$field ) { |
|
| 2089 | - $field->adminOnly = false; |
|
| 2088 | + foreach( $fields as &$field ) { |
|
| 2089 | + $field->adminOnly = false; |
|
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | 2092 | return $fields; |
@@ -2106,13 +2106,13 @@ discard block |
||
| 2106 | 2106 | */ |
| 2107 | 2107 | private function unselect_default_values( $form ) { |
| 2108 | 2108 | |
| 2109 | - foreach ( $form['fields'] as &$field ) { |
|
| 2109 | + foreach ( $form['fields'] as &$field ) { |
|
| 2110 | 2110 | |
| 2111 | 2111 | if ( empty( $field->choices ) ) { |
| 2112 | - continue; |
|
| 2112 | + continue; |
|
| 2113 | 2113 | } |
| 2114 | 2114 | |
| 2115 | - foreach ( $field->choices as &$choice ) { |
|
| 2115 | + foreach ( $field->choices as &$choice ) { |
|
| 2116 | 2116 | if ( \GV\Utils::get( $choice, 'isSelected' ) ) { |
| 2117 | 2117 | $choice['isSelected'] = false; |
| 2118 | 2118 | } |
@@ -2149,36 +2149,36 @@ discard block |
||
| 2149 | 2149 | |
| 2150 | 2150 | if( 'checkbox' === $field->type ) { |
| 2151 | 2151 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
| 2152 | - $input_id = $input['id']; |
|
| 2153 | - $choice = $field->choices[ $key ]; |
|
| 2154 | - $value = \GV\Utils::get( $this->entry, $input_id ); |
|
| 2155 | - $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
|
| 2156 | - if( $match ) { |
|
| 2157 | - $field->choices[ $key ]['isSelected'] = true; |
|
| 2158 | - } |
|
| 2152 | + $input_id = $input['id']; |
|
| 2153 | + $choice = $field->choices[ $key ]; |
|
| 2154 | + $value = \GV\Utils::get( $this->entry, $input_id ); |
|
| 2155 | + $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
|
| 2156 | + if( $match ) { |
|
| 2157 | + $field->choices[ $key ]['isSelected'] = true; |
|
| 2158 | + } |
|
| 2159 | 2159 | } |
| 2160 | 2160 | } else { |
| 2161 | 2161 | |
| 2162 | 2162 | // We need to run through each field to set the default values |
| 2163 | 2163 | foreach ( $this->entry as $field_id => $field_value ) { |
| 2164 | 2164 | |
| 2165 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 2165 | + if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 2166 | 2166 | |
| 2167 | - if( 'list' === $field->type ) { |
|
| 2168 | - $list_rows = maybe_unserialize( $field_value ); |
|
| 2167 | + if( 'list' === $field->type ) { |
|
| 2168 | + $list_rows = maybe_unserialize( $field_value ); |
|
| 2169 | 2169 | |
| 2170 | - $list_field_value = array(); |
|
| 2171 | - foreach ( (array) $list_rows as $row ) { |
|
| 2172 | - foreach ( (array) $row as $column ) { |
|
| 2173 | - $list_field_value[] = $column; |
|
| 2174 | - } |
|
| 2175 | - } |
|
| 2170 | + $list_field_value = array(); |
|
| 2171 | + foreach ( (array) $list_rows as $row ) { |
|
| 2172 | + foreach ( (array) $row as $column ) { |
|
| 2173 | + $list_field_value[] = $column; |
|
| 2174 | + } |
|
| 2175 | + } |
|
| 2176 | 2176 | |
| 2177 | - $field->defaultValue = serialize( $list_field_value ); |
|
| 2178 | - } else { |
|
| 2179 | - $field->defaultValue = $field_value; |
|
| 2180 | - } |
|
| 2181 | - } |
|
| 2177 | + $field->defaultValue = serialize( $list_field_value ); |
|
| 2178 | + } else { |
|
| 2179 | + $field->defaultValue = $field_value; |
|
| 2180 | + } |
|
| 2181 | + } |
|
| 2182 | 2182 | } |
| 2183 | 2183 | } |
| 2184 | 2184 | } |
@@ -2239,7 +2239,7 @@ discard block |
||
| 2239 | 2239 | foreach ( $form['fields'] as &$field ) { |
| 2240 | 2240 | foreach ( $remove_conditions_rule as $_remove_conditions_r ) { |
| 2241 | 2241 | |
| 2242 | - list( $rule_field_id, $rule_i ) = $_remove_conditions_r; |
|
| 2242 | + list( $rule_field_id, $rule_i ) = $_remove_conditions_r; |
|
| 2243 | 2243 | |
| 2244 | 2244 | if ( $field['id'] == $rule_field_id ) { |
| 2245 | 2245 | unset( $field->conditionalLogic['rules'][ $rule_i ] ); |
@@ -2290,7 +2290,7 @@ discard block |
||
| 2290 | 2290 | return $has_conditional_logic; |
| 2291 | 2291 | } |
| 2292 | 2292 | |
| 2293 | - /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */ |
|
| 2293 | + /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */ |
|
| 2294 | 2294 | return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form ); |
| 2295 | 2295 | } |
| 2296 | 2296 | |
@@ -2357,14 +2357,14 @@ discard block |
||
| 2357 | 2357 | |
| 2358 | 2358 | if( $echo && $error !== true ) { |
| 2359 | 2359 | |
| 2360 | - $error = esc_html( $error ); |
|
| 2360 | + $error = esc_html( $error ); |
|
| 2361 | 2361 | |
| 2362 | - /** |
|
| 2363 | - * @since 1.9 |
|
| 2364 | - */ |
|
| 2365 | - if ( ! empty( $this->entry ) ) { |
|
| 2366 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 2367 | - } |
|
| 2362 | + /** |
|
| 2363 | + * @since 1.9 |
|
| 2364 | + */ |
|
| 2365 | + if ( ! empty( $this->entry ) ) { |
|
| 2366 | + $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 2367 | + } |
|
| 2368 | 2368 | |
| 2369 | 2369 | echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
| 2370 | 2370 | } |
@@ -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 | } |