@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | // autoload-classmap.php @generated by Strauss |
4 | 4 | |
5 | -$trustedlogin = dirname(__FILE__); |
|
5 | +$trustedlogin = dirname( __FILE__ ); |
|
6 | 6 | |
7 | 7 | return array( |
8 | 8 | 'GravityView\Psr\Log\LoggerAwareTrait' => $trustedlogin . '/psr/log/Psr/Log/LoggerAwareTrait.php', |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | |
153 | 153 | add_filter( 'gravityview/sortable/field_blocklist', array( $this, '_filter_sortable_fields' ), 1 ); |
154 | 154 | |
155 | - if( $this->entry_meta_key ) { |
|
155 | + if ( $this->entry_meta_key ) { |
|
156 | 156 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
157 | 157 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
158 | 158 | } |
159 | 159 | |
160 | - if( $this->_custom_merge_tag ) { |
|
160 | + if ( $this->_custom_merge_tag ) { |
|
161 | 161 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
162 | 162 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
163 | 163 | } |
164 | 164 | |
165 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
165 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
166 | 166 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
167 | 167 | } |
168 | 168 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * Auto-assign label from Gravity Forms label, if exists |
171 | 171 | * @since 1.20 |
172 | 172 | */ |
173 | - if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
173 | + if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
174 | 174 | $this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
175 | 175 | } |
176 | 176 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | 'type' => $this->name |
217 | 217 | ); |
218 | 218 | |
219 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
219 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
220 | 220 | |
221 | 221 | return $fields; |
222 | 222 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
238 | 238 | |
239 | - if( $this->name === $field['field'] && '' === $label ) { |
|
239 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
240 | 240 | $label = esc_html( $this->default_search_label ); |
241 | 241 | } |
242 | 242 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
259 | 259 | */ |
260 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
260 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
261 | 261 | |
262 | 262 | // Is there is field merge tag? Strip whitespace off the ned, too. |
263 | 263 | preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | */ |
291 | 291 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
292 | 292 | |
293 | - foreach( $matches as $match ) { |
|
293 | + foreach ( $matches as $match ) { |
|
294 | 294 | |
295 | - $full_tag = $match[0]; |
|
295 | + $full_tag = $match[ 0 ]; |
|
296 | 296 | |
297 | 297 | // Strip the Merge Tags |
298 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
298 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
299 | 299 | |
300 | 300 | // Replace the value from the entry, if exists |
301 | - if( isset( $entry[ $tag ] ) ) { |
|
301 | + if ( isset( $entry[ $tag ] ) ) { |
|
302 | 302 | |
303 | 303 | $value = $entry[ $tag ]; |
304 | 304 | |
305 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
305 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
306 | 306 | $value = $this->get_content( $value ); |
307 | 307 | } |
308 | 308 | |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function _filter_sortable_fields( $not_sortable ) { |
377 | 377 | |
378 | - if( ! $this->is_sortable ) { |
|
379 | - $not_sortable[] = $this->name; |
|
378 | + if ( ! $this->is_sortable ) { |
|
379 | + $not_sortable[ ] = $this->name; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | return $not_sortable; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function add_entry_meta( $entry_meta ) { |
395 | 395 | |
396 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
396 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
397 | 397 | |
398 | 398 | $added_meta = array( |
399 | 399 | 'label' => $this->label, |
@@ -402,13 +402,13 @@ discard block |
||
402 | 402 | ); |
403 | 403 | |
404 | 404 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
405 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
405 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
406 | 406 | } |
407 | 407 | |
408 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
408 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
409 | 409 | |
410 | 410 | } else { |
411 | - gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta["{$this->entry_meta_key}"] ) ); |
|
411 | + gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta[ "{$this->entry_meta_key}" ] ) ); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | return $entry_meta; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | 'date_display' => array( |
444 | 444 | 'type' => 'text', |
445 | 445 | 'label' => __( 'Override Date Format', 'gravityview' ), |
446 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
446 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ), |
|
447 | 447 | /** |
448 | 448 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
449 | 449 | * @param null|string $date_format Date Format (default: null) |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | |
480 | 480 | $options = $this->field_support_options(); |
481 | 481 | |
482 | - if( isset( $options[ $key ] ) ) { |
|
482 | + if ( isset( $options[ $key ] ) ) { |
|
483 | 483 | $field_options[ $key ] = $options[ $key ]; |
484 | 484 | } |
485 | 485 | |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | $connected_form = \GV\Utils::_POST( 'form_id' ); |
544 | 544 | |
545 | 545 | // Otherwise, get the Form ID from the Post page |
546 | - if( empty( $connected_form ) ) { |
|
546 | + if ( empty( $connected_form ) ) { |
|
547 | 547 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
548 | 548 | } |
549 | 549 | |
550 | - if( empty( $connected_form ) ) { |
|
550 | + if ( empty( $connected_form ) ) { |
|
551 | 551 | gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) ); |
552 | 552 | return false; |
553 | 553 | } |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private static function disable_show_only_approved_entries( $gravityview ) { |
60 | 60 | |
61 | - if ( ! isset( $_GET['disable_setting'] ) || ! wp_verify_nonce( $_GET['gv-setting'], 'setting' ) ) { |
|
61 | + if ( ! isset( $_GET[ 'disable_setting' ] ) || ! wp_verify_nonce( $_GET[ 'gv-setting' ], 'setting' ) ) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | 65 | $settings = $gravityview->view->settings->all(); |
66 | 66 | |
67 | - $settings['show_only_approved'] = 0; |
|
67 | + $settings[ 'show_only_approved' ] = 0; |
|
68 | 68 | |
69 | - $updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings', $settings ); |
|
69 | + $updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings', $settings ); |
|
70 | 70 | |
71 | 71 | if ( ! $updated ) { |
72 | 72 | gravityview()->log->error( 'Could not update View settings => Show only approved' ); |
@@ -273,8 +273,7 @@ discard block |
||
273 | 273 | $tab = __( 'Edit Entry', 'gravityview' ); |
274 | 274 | $context = 'edit'; |
275 | 275 | break; |
276 | - case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ): |
|
277 | - $tab = __( 'Single Entry', 'gravityview' ); |
|
276 | + case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' ); |
|
278 | 277 | $context = 'single'; |
279 | 278 | break; |
280 | 279 | default: |
@@ -296,7 +295,7 @@ discard block |
||
296 | 295 | $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
297 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
298 | 297 | |
299 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
300 | 299 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
301 | 300 | |
302 | 301 | echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID ); |
@@ -322,11 +321,11 @@ discard block |
||
322 | 321 | |
323 | 322 | $post_types = get_post_types(); |
324 | 323 | |
325 | - foreach( $post_types as $post_type ) { |
|
324 | + foreach ( $post_types as $post_type ) { |
|
326 | 325 | $post_type_rewrite = get_post_type_object( $post_type )->rewrite; |
327 | 326 | |
328 | 327 | if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) { |
329 | - $reserved_slugs[] = $slug; |
|
328 | + $reserved_slugs[ ] = $slug; |
|
330 | 329 | } |
331 | 330 | } |
332 | 331 |
@@ -213,7 +213,7 @@ |
||
213 | 213 | |
214 | 214 | <p class="gv-notice-admin-message"><em>{admin_message}</em></p> |
215 | 215 | </div> |
216 | -EOD; |
|
216 | +eod; |
|
217 | 217 | |
218 | 218 | $notice_title = _n( |
219 | 219 | esc_html__( 'There is an unapproved entry that is not being shown.', 'gravityview' ), |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
75 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
76 | 76 | |
77 | 77 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
78 | 78 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
79 | - )); |
|
79 | + ) ); |
|
80 | 80 | |
81 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
81 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | function widget( $args, $instance ) { |
94 | 94 | |
95 | 95 | // Don't have the Customizer render too soon. |
96 | - if( empty( $instance['view_id'] ) ) { |
|
96 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
105 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
104 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
105 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
106 | 106 | |
107 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
107 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
108 | 108 | |
109 | - echo $args['before_widget']; |
|
109 | + echo $args[ 'before_widget' ]; |
|
110 | 110 | |
111 | - if ( !empty( $title ) ) { |
|
112 | - echo $args['before_title'] . $title . $args['after_title']; |
|
111 | + if ( ! empty( $title ) ) { |
|
112 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
131 | 131 | |
132 | - echo $args['after_widget']; |
|
132 | + echo $args[ 'after_widget' ]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function get_output( $instance ) { |
145 | 145 | |
146 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
146 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
147 | 147 | |
148 | 148 | $form = gravityview_get_form( $form_id ); |
149 | 149 | |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * @since 1.6.1 |
154 | 154 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
155 | 155 | */ |
156 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
156 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Generate list output |
160 | 160 | * @since 1.7.2 |
161 | 161 | */ |
162 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget', null, $instance['view_id'] ); |
|
162 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget', null, $instance[ 'view_id' ] ); |
|
163 | 163 | |
164 | 164 | $output = $List->get_output(); |
165 | 165 | |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private function get_entries( $instance, $form_id ) { |
186 | 186 | |
187 | - $view = \GV\View::by_id( $instance['view_id'] ); |
|
187 | + $view = \GV\View::by_id( $instance[ 'view_id' ] ); |
|
188 | 188 | |
189 | - $limit = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
189 | + $limit = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
190 | 190 | |
191 | 191 | $view->settings->set( 'page_size', $limit ); |
192 | 192 | |
@@ -209,23 +209,23 @@ discard block |
||
209 | 209 | $instance = $new_instance; |
210 | 210 | |
211 | 211 | // Force positive number |
212 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
212 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
213 | 213 | |
214 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
214 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
215 | 215 | |
216 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
216 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
217 | 217 | |
218 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
218 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
219 | 219 | |
220 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
220 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
221 | 221 | |
222 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true ); |
|
222 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true ); |
|
223 | 223 | |
224 | 224 | //check if post_id is a valid post with embedded View |
225 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
225 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
226 | 226 | |
227 | 227 | // Share that the widget isn't brand new |
228 | - $instance['updated'] = 1; |
|
228 | + $instance[ 'updated' ] = 1; |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | |
248 | 248 | // Set up some default widget settings. |
249 | 249 | $defaults = array( |
250 | - 'title' => __('Recent Entries', 'gravityview'), |
|
250 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
251 | 251 | 'view_id' => NULL, |
252 | 252 | 'post_id' => NULL, |
253 | 253 | 'limit' => 10, |
254 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
254 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
255 | 255 | 'after_link' => '' |
256 | 256 | ); |
257 | 257 | |
258 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
258 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
259 | 259 | |
260 | 260 | ?> |
261 | 261 | |
262 | 262 | <!-- Title --> |
263 | 263 | <p> |
264 | 264 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
265 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
265 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
266 | 266 | </p> |
267 | 267 | |
268 | 268 | <!-- Download --> |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $views = get_posts( $args ); |
276 | 276 | |
277 | 277 | // If there are no views set up yet, we get outta here. |
278 | - if( empty( $views ) ) { |
|
278 | + if ( empty( $views ) ) { |
|
279 | 279 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
280 | 280 | return; |
281 | 281 | } |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | * Display errors generated for invalid embed IDs |
288 | 288 | * @see GravityView_View_Data::is_valid_embed_id |
289 | 289 | */ |
290 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
290 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
291 | 291 | ?> |
292 | 292 | <div class="error inline hide-on-view-change"> |
293 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
293 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
294 | 294 | </div> |
295 | 295 | <?php |
296 | 296 | unset ( $error ); |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | ?> |
299 | 299 | |
300 | 300 | <p> |
301 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
301 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
302 | 302 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
303 | 303 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
304 | 304 | <?php |
305 | 305 | |
306 | - foreach( $views as $view ) { |
|
307 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
308 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
306 | + foreach ( $views as $view ) { |
|
307 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
308 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | ?> |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | * Display errors generated for invalid embed IDs |
318 | 318 | * @see GravityView_View_Data::is_valid_embed_id |
319 | 319 | */ |
320 | - if( !empty( $instance['error_post_id'] ) ) { |
|
320 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
321 | 321 | ?> |
322 | 322 | <div class="error inline"> |
323 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
323 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
324 | 324 | </div> |
325 | 325 | <?php |
326 | 326 | unset ( $error ); |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | ?> |
329 | 329 | |
330 | 330 | <p> |
331 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
332 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
331 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
332 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
333 | 333 | <span class="howto gv-howto"><?php |
334 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
335 | - echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
334 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
335 | + echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
336 | 336 | ?></span> |
337 | 337 | </p> |
338 | 338 | |
@@ -340,21 +340,21 @@ discard block |
||
340 | 340 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
341 | 341 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
342 | 342 | </label> |
343 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
343 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
344 | 344 | </p> |
345 | 345 | |
346 | 346 | <p> |
347 | 347 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
348 | 348 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
349 | 349 | </label> |
350 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
350 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
351 | 351 | </p> |
352 | 352 | |
353 | 353 | <p> |
354 | 354 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
355 | 355 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
356 | 356 | </label> |
357 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
357 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
358 | 358 | </p> |
359 | 359 | |
360 | 360 | <?php |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
365 | 365 | * @param array $instance Current widget instance |
366 | 366 | */ |
367 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
367 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
368 | 368 | |
369 | 369 | ?> |
370 | 370 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // Don't show unless a View ID has been set. |
60 | - if( empty( $instance['view_id'] ) ) { |
|
60 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
61 | 61 | |
62 | 62 | gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) ); |
63 | 63 | |
@@ -70,22 +70,22 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | /** This filter is documented in wp-includes/default-widgets.php */ |
73 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
73 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
74 | 74 | |
75 | - echo $args['before_widget']; |
|
75 | + echo $args[ 'before_widget' ]; |
|
76 | 76 | |
77 | 77 | if ( $title ) { |
78 | - echo $args['before_title'] . $title . $args['after_title']; |
|
78 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // @todo Add to the widget configuration form |
82 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
82 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
83 | 83 | |
84 | - $instance['context'] = 'wp_widget'; |
|
84 | + $instance[ 'context' ] = 'wp_widget'; |
|
85 | 85 | |
86 | 86 | // form |
87 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
88 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
87 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
88 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
89 | 89 | |
90 | 90 | // We don't want to overwrite existing context, etc. |
91 | 91 | $previous_view = GravityView_View::getInstance(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | new GravityView_View( $previous_view ); |
103 | 103 | |
104 | - echo $args['after_widget']; |
|
104 | + echo $args[ 'after_widget' ]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -111,27 +111,27 @@ discard block |
||
111 | 111 | |
112 | 112 | $instance = $old_instance; |
113 | 113 | |
114 | - if( $this->is_preview() ) { |
|
114 | + if ( $this->is_preview() ) { |
|
115 | 115 | //Oh! Sorry but still not fully compatible with customizer |
116 | 116 | return $instance; |
117 | 117 | } |
118 | 118 | |
119 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
119 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
120 | 120 | |
121 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
122 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
123 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
124 | - $instance['post_id'] = $new_instance['post_id']; |
|
125 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
126 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
121 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
122 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
123 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
124 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
125 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
126 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
127 | 127 | |
128 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true ); |
|
128 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true ); |
|
129 | 129 | |
130 | 130 | //check if post_id is a valid post with embedded View |
131 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
131 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
132 | 132 | |
133 | 133 | // Share that the widget isn't brand new |
134 | - $instance['updated'] = 1; |
|
134 | + $instance[ 'updated' ] = 1; |
|
135 | 135 | |
136 | 136 | return $instance; |
137 | 137 | } |
@@ -142,28 +142,28 @@ discard block |
||
142 | 142 | public function form( $instance ) { |
143 | 143 | |
144 | 144 | // @todo Make compatible with Customizer |
145 | - if( $this->is_preview() ) { |
|
145 | + if ( $this->is_preview() ) { |
|
146 | 146 | |
147 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
147 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
148 | 148 | |
149 | 149 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
150 | 150 | |
151 | 151 | return; |
152 | 152 | } |
153 | 153 | |
154 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
154 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
155 | 155 | |
156 | - $title = $instance['title']; |
|
157 | - $view_id = $instance['view_id']; |
|
158 | - $post_id = $instance['post_id']; |
|
159 | - $search_fields = $instance['search_fields']; |
|
160 | - $search_clear = $instance['search_clear']; |
|
161 | - $search_mode = $instance['search_mode']; |
|
156 | + $title = $instance[ 'title' ]; |
|
157 | + $view_id = $instance[ 'view_id' ]; |
|
158 | + $post_id = $instance[ 'post_id' ]; |
|
159 | + $search_fields = $instance[ 'search_fields' ]; |
|
160 | + $search_clear = $instance[ 'search_clear' ]; |
|
161 | + $search_mode = $instance[ 'search_mode' ]; |
|
162 | 162 | |
163 | 163 | $views = GVCommon::get_all_views(); |
164 | 164 | |
165 | 165 | // If there are no views set up yet, we get outta here. |
166 | - if( empty( $views ) ) { ?> |
|
166 | + if ( empty( $views ) ) { ?> |
|
167 | 167 | <div id="select_gravityview_view"> |
168 | 168 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
169 | 169 | </div> |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | } |
172 | 172 | ?> |
173 | 173 | |
174 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
174 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
175 | 175 | |
176 | 176 | <?php |
177 | 177 | /** |
178 | 178 | * Display errors generated for invalid embed IDs |
179 | 179 | * @see GravityView_View_Data::is_valid_embed_id |
180 | 180 | */ |
181 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
181 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
182 | 182 | ?> |
183 | 183 | <div class="error inline hide-on-view-change"> |
184 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
184 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | unset ( $error ); |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | |
191 | 191 | <p> |
192 | 192 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
193 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
193 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
194 | 194 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
195 | 195 | <?php |
196 | - foreach( $views as $view_option ) { |
|
197 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
198 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
196 | + foreach ( $views as $view_option ) { |
|
197 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
198 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | </select> |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | * Display errors generated for invalid embed IDs |
208 | 208 | * @see GravityView_View_Data::is_valid_embed_id |
209 | 209 | */ |
210 | - if( !empty( $instance['error_post_id'] ) ) { |
|
210 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
211 | 211 | ?> |
212 | 212 | <div class="error inline"> |
213 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
213 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
214 | 214 | </div> |
215 | 215 | <?php |
216 | 216 | unset ( $error ); |
@@ -218,40 +218,40 @@ discard block |
||
218 | 218 | ?> |
219 | 219 | |
220 | 220 | <p> |
221 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
222 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
221 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
222 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
223 | 223 | <span class="howto gv-howto"><?php |
224 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
225 | - echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
224 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
225 | + echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
226 | 226 | ?></span> |
227 | 227 | </p> |
228 | 228 | |
229 | 229 | <p> |
230 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
231 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
232 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
230 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
231 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
232 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
233 | 233 | </p> |
234 | 234 | |
235 | 235 | <p> |
236 | 236 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
237 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
238 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
237 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
238 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
239 | 239 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
240 | 240 | </label> |
241 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
242 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
241 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
242 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
243 | 243 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
244 | 244 | </label> |
245 | - <span class="howto gv-howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
245 | + <span class="howto gv-howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
246 | 246 | </p> |
247 | 247 | |
248 | 248 | <hr /> |
249 | 249 | |
250 | 250 | <?php // @todo: move style to CSS ?> |
251 | 251 | <div style="margin-bottom: 1em;"> |
252 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
253 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
254 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
252 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
253 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
254 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
255 | 255 | </div> |
256 | 256 | |
257 | 257 | </div> |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
27 | 27 | |
28 | - unset ( $field_options['search_filter'] ); |
|
28 | + unset ( $field_options[ 'search_filter' ] ); |
|
29 | 29 | |
30 | - if( 'edit' === $context ) { |
|
30 | + if ( 'edit' === $context ) { |
|
31 | 31 | return $field_options; |
32 | 32 | } |
33 | 33 | |
34 | - $this->add_field_support('link_to_post', $field_options ); |
|
34 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
35 | 35 | |
36 | 36 | // @since 1.5.4 |
37 | - $this->add_field_support('dynamic_data', $field_options ); |
|
37 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
38 | 38 | |
39 | 39 | return $field_options; |
40 | 40 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $url = $title = $caption = $description = ''; |
62 | 62 | |
63 | 63 | // If there's a |:| match, process. Otherwise, empty array! |
64 | - if( preg_match( '/\|\:\|/', $value ) ) { |
|
64 | + if ( preg_match( '/\|\:\|/', $value ) ) { |
|
65 | 65 | list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false ); |
66 | 66 | } |
67 | 67 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field = null ) { |
92 | 92 | |
93 | - $id = (int) $field->id; |
|
94 | - $form_id = $form['id']; |
|
93 | + $id = (int)$field->id; |
|
94 | + $form_id = $form[ 'id' ]; |
|
95 | 95 | $input_name = "input_{$id}"; |
96 | 96 | $field_id = sprintf( 'input_%d_%d', $form_id, $id ); |
97 | 97 | $img_name = null; |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | // Convert |:| to associative array |
100 | 100 | $img_array = self::explode_value( $value ); |
101 | 101 | |
102 | - if( ! empty( $img_array['url'] ) ) { |
|
102 | + if ( ! empty( $img_array[ 'url' ] ) ) { |
|
103 | 103 | |
104 | - $img_name = basename( $img_array['url'] ); |
|
104 | + $img_name = basename( $img_array[ 'url' ] ); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden |
108 | 108 | * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code |
109 | 109 | * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code |
110 | 110 | */ |
111 | - if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
111 | + if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
112 | 112 | GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name; |
113 | 113 | } |
114 | 114 | } |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * @hack |
138 | 138 | */ |
139 | 139 | if ( null !== $img_name ) { |
140 | - $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) ); |
|
141 | - $gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output ); |
|
140 | + $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) ); |
|
141 | + $gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $gf_post_image_field_output; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | |
27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
28 | 28 | |
29 | - unset( $field_options['show_as_link'] ); |
|
29 | + unset( $field_options[ 'show_as_link' ] ); |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $this->add_field_support('dynamic_data', $field_options ); |
|
35 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
36 | 36 | |
37 | 37 | return $field_options; |
38 | 38 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field = null ) { |
51 | 51 | |
52 | - $id = (int) $field->id; |
|
52 | + $id = (int)$field->id; |
|
53 | 53 | $input_name = "input_{$id}"; |
54 | 54 | $class = esc_attr( $field->size ); |
55 | 55 | $tabindex = $field->get_tabindex(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $gv_bulk_action = false; |
56 | 56 | |
57 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
57 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
58 | 58 | $bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' ); |
59 | 59 | } else { |
60 | 60 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
65 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', self::$bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
65 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', self::$bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
66 | 66 | $gv_bulk_action = $bulk_action; |
67 | 67 | } |
68 | 68 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // gforms_entry_list is the nonce that confirms we're on the right page |
88 | 88 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
89 | - if ( ! ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) ) { |
|
89 | + if ( ! ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) ) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | // All entries are set to be updated, not just the visible ones |
109 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
109 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
110 | 110 | |
111 | 111 | // Convert the current entry search into GF-formatted search criteria |
112 | 112 | $search = array( |
113 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
114 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
115 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
113 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
114 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
115 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } else { |
124 | 124 | |
125 | 125 | // Changed from 'lead' to 'entry' in 2.0 |
126 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
126 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
136 | 136 | |
137 | 137 | switch ( $approved_status ) { |
138 | - case self::$bulk_action_prefixes['approve']: |
|
138 | + case self::$bulk_action_prefixes[ 'approve' ]: |
|
139 | 139 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
140 | 140 | self::$bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
141 | 141 | break; |
142 | - case self::$bulk_action_prefixes['unapprove']: |
|
142 | + case self::$bulk_action_prefixes[ 'unapprove' ]: |
|
143 | 143 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
144 | 144 | self::$bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
145 | 145 | break; |
146 | - case self::$bulk_action_prefixes['disapprove']: |
|
146 | + case self::$bulk_action_prefixes[ 'disapprove' ]: |
|
147 | 147 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
148 | 148 | self::$bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
149 | 149 | break; |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | $bulk_actions = array( |
166 | 166 | 'GravityView' => array( |
167 | 167 | array( |
168 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
169 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['approve'], $form_id ), |
|
168 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
169 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'approve' ], $form_id ), |
|
170 | 170 | ), |
171 | 171 | array( |
172 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
173 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['disapprove'], $form_id ), |
|
172 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
173 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
174 | 174 | ), |
175 | 175 | array( |
176 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
177 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['unapprove'], $form_id ), |
|
176 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
177 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
178 | 178 | ), |
179 | 179 | ), |
180 | 180 | ); |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | // Sanitize the values, just to be sure. |
192 | 192 | foreach ( $bulk_actions as $key => $group ) { |
193 | 193 | |
194 | - if( empty( $group ) ) { |
|
194 | + if ( empty( $group ) ) { |
|
195 | 195 | continue; |
196 | 196 | } |
197 | 197 | |
198 | 198 | foreach ( $group as $i => $action ) { |
199 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
200 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
199 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
200 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | */ |
48 | 48 | $atts = apply_filters( 'gravityview/shortcodes/gventry/atts', $atts ); |
49 | 49 | |
50 | - $view = \GV\View::by_id( $atts['view_id'] ); |
|
50 | + $view = \GV\View::by_id( $atts[ 'view_id' ] ); |
|
51 | 51 | |
52 | 52 | if ( ! $view ) { |
53 | - gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts['view_id'] ) ); |
|
53 | + gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
54 | 54 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', null, null, $atts ); |
55 | 55 | } |
56 | 56 | |
57 | - $entry_id = ! empty( $atts['entry_id'] ) ? $atts['entry_id'] : $atts['id']; |
|
57 | + $entry_id = ! empty( $atts[ 'entry_id' ] ) ? $atts[ 'entry_id' ] : $atts[ 'id' ]; |
|
58 | 58 | |
59 | - switch( $entry_id ): |
|
59 | + switch ( $entry_id ): |
|
60 | 60 | case 'last': |
61 | 61 | if ( class_exists( '\GF_Query' ) ) { |
62 | 62 | /** |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
66 | 66 | */ |
67 | 67 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
68 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
68 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
69 | 69 | /** |
70 | 70 | * Reverse existing sorts. |
71 | 71 | */ |
72 | - $sort = &$parameters['sorting']; |
|
73 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
72 | + $sort = &$parameters[ 'sorting' ]; |
|
73 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
74 | 74 | } else { |
75 | 75 | /** |
76 | 76 | * Otherwise, sort by date_created. |
77 | 77 | */ |
78 | - $parameters['sorting'] = array( |
|
78 | + $parameters[ 'sorting' ] = array( |
|
79 | 79 | 'key' => 'id', |
80 | 80 | 'direction' => 'ASC', |
81 | 81 | 'is_numeric' => true |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | /** If a sort already exists, reverse it. */ |
92 | 92 | if ( $sort = end( $entries->sorts ) ) { |
93 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
93 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
94 | 94 | } else { |
95 | 95 | /** Otherwise, sort by date_created */ |
96 | 96 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | break; |
109 | 109 | default: |
110 | 110 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
111 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
111 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
112 | 112 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, null, $atts ); |
113 | 113 | } |
114 | 114 | endswitch; |
115 | 115 | |
116 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
116 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
117 | 117 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
118 | 118 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
119 | 119 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return apply_filters( 'gravityview/shortcodes/gventry/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
124 | 124 | } |
125 | 125 | |
126 | - if ( ! $view->form ) { |
|
126 | + if ( ! $view->form ) { |
|
127 | 127 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
128 | 128 | |
129 | 129 | /** |
@@ -146,50 +146,50 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | /** Unapproved entries. */ |
149 | - if ( $entry['status'] != 'active' ) { |
|
149 | + if ( $entry[ 'status' ] != 'active' ) { |
|
150 | 150 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
151 | 151 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
152 | 152 | } |
153 | 153 | |
154 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
154 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
155 | 155 | |
156 | 156 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
157 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
157 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
158 | 158 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
159 | 159 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | if ( \GV\Utils::get( $_GET, 'edit' ) && \GV\Utils::get( $_GET, 'gvid' ) ) { |
164 | - $atts['edit'] = 1; |
|
164 | + $atts[ 'edit' ] = 1; |
|
165 | 165 | } |
166 | 166 | |
167 | - if ( $atts['edit'] ) { |
|
167 | + if ( $atts[ 'edit' ] ) { |
|
168 | 168 | /** |
169 | 169 | * Based on code in our unit-tests. |
170 | 170 | * Mocks old context, etc. |
171 | 171 | */ |
172 | 172 | $loader = \GravityView_Edit_Entry::getInstance(); |
173 | - $render = $loader->instances['render']; |
|
173 | + $render = $loader->instances[ 'render' ]; |
|
174 | 174 | |
175 | 175 | add_filter( 'gravityview/is_single_entry', '__return_true' ); |
176 | 176 | |
177 | - $form = \GFAPI::get_form( $entry['form_id'] ); |
|
177 | + $form = \GFAPI::get_form( $entry[ 'form_id' ] ); |
|
178 | 178 | |
179 | 179 | $data = \GravityView_View_Data::getInstance( $view ); |
180 | 180 | $template = \GravityView_View::getInstance( array( |
181 | 181 | 'form' => $form, |
182 | - 'form_id' => $form['id'], |
|
182 | + 'form_id' => $form[ 'id' ], |
|
183 | 183 | 'view_id' => $view->ID, |
184 | 184 | 'entries' => array( $entry ), |
185 | 185 | 'atts' => \GVCommon::get_template_settings( $view->ID ), |
186 | 186 | ) ); |
187 | 187 | |
188 | - $_GET['edit'] = wp_create_nonce( |
|
189 | - \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form['id'], $entry['id'] ) |
|
188 | + $_GET[ 'edit' ] = wp_create_nonce( |
|
189 | + \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form[ 'id' ], $entry[ 'id' ] ) |
|
190 | 190 | ); |
191 | 191 | |
192 | - add_filter( 'gravityview/edit_entry/success', $callback = function ( $message, $_view_id, $_entry, $back_link, $redirect_url ) use ( $view, $entry, $atts ) { |
|
192 | + add_filter( 'gravityview/edit_entry/success', $callback = function( $message, $_view_id, $_entry, $back_link, $redirect_url ) use ( $view, $entry, $atts ) { |
|
193 | 193 | /** |
194 | 194 | * @filter `gravityview/shortcodes/gventry/edit/success` Modify the edit entry success message in [gventry]. |
195 | 195 | * |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | return apply_filters( 'gravityview/shortcodes/gventry/edit/success', $message, $view, $entry, $atts, $back_link, $redirect_url ); |
206 | 206 | }, 10, 5 ); |
207 | 207 | |
208 | - ob_start() && $render->init( $data, \GV\GF_Entry::by_id( $entry['id'] ), $view ); |
|
208 | + ob_start() && $render->init( $data, \GV\GF_Entry::by_id( $entry[ 'id' ] ), $view ); |
|
209 | 209 | $output = ob_get_clean(); // Render :) |
210 | 210 | |
211 | 211 | remove_filter( 'gravityview/is_single_entry', '__return_true' ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $renderer = new \GV\Entry_Renderer(); |
218 | 218 | |
219 | 219 | $request = new \GV\Mock_Request(); |
220 | - $request->returns['is_entry'] = $entry; |
|
220 | + $request->returns[ 'is_entry' ] = $entry; |
|
221 | 221 | |
222 | 222 | $output = $renderer->render( $entry, $view, $request ); |
223 | 223 |