@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function load() { |
26 | 26 | |
27 | - if( !is_admin() ) { |
|
27 | + if ( ! is_admin() ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
39 | 39 | |
40 | 40 | // add tooltips |
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
|
42 | 42 | |
43 | 43 | // custom fields' options for zone EDIT |
44 | 44 | add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
79 | 79 | |
80 | - if( $zone !== 'edit' ) { |
|
80 | + if ( $zone !== 'edit' ) { |
|
81 | 81 | |
82 | - $entry_default_fields['edit_link'] = array( |
|
83 | - 'label' => __('Link to Edit Entry', 'gravityview'), |
|
82 | + $entry_default_fields[ 'edit_link' ] = array( |
|
83 | + 'label' => __( 'Link to Edit Entry', 'gravityview' ), |
|
84 | 84 | 'type' => 'edit_link', |
85 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
85 | + 'desc' => __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ), |
|
86 | 86 | 'icon' => 'dashicons-welcome-write-blog', |
87 | 87 | ); |
88 | 88 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | $caps = $visibility_caps; |
108 | 108 | |
109 | 109 | // If we're configuring fields in the edit context, we want a limited selection |
110 | - if( $context === 'edit' ) { |
|
110 | + if ( $context === 'edit' ) { |
|
111 | 111 | |
112 | 112 | // Remove other built-in caps. |
113 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
113 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
114 | 114 | |
115 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
115 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $caps; |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
133 | 133 | |
134 | 134 | // Always a link, never a filter |
135 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
135 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
136 | 136 | |
137 | 137 | // Edit Entry link should only appear to visitors capable of editing entries |
138 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
138 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
139 | 139 | |
140 | - $add_option['edit_link'] = array( |
|
140 | + $add_option[ 'edit_link' ] = array( |
|
141 | 141 | 'type' => 'text', |
142 | 142 | 'label' => __( 'Edit Link Text', 'gravityview' ), |
143 | 143 | 'desc' => NULL, |
144 | - 'value' => __('Edit Entry', 'gravityview'), |
|
144 | + 'value' => __( 'Edit Entry', 'gravityview' ), |
|
145 | 145 | 'merge_tags' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - $add_option['new_window'] = array( |
|
148 | + $add_option[ 'new_window' ] = array( |
|
149 | 149 | 'type' => 'checkbox', |
150 | 150 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
151 | 151 | 'value' => false, |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $return = $tooltips; |
167 | 167 | |
168 | - $return['allow_edit_cap'] = array( |
|
169 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
170 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
168 | + $return[ 'allow_edit_cap' ] = array( |
|
169 | + 'title' => __( 'Limiting Edit Access', 'gravityview' ), |
|
170 | + 'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ), |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | return $return; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
189 | 189 | |
190 | 190 | // We only want to modify the settings for the edit context |
191 | - if( 'edit' !== $context ) { |
|
191 | + if ( 'edit' !== $context ) { |
|
192 | 192 | return $field_options; |
193 | 193 | } |
194 | 194 | |
195 | 195 | // Entry field is only for logged in users |
196 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
196 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
197 | 197 | |
198 | 198 | $add_options = array( |
199 | 199 | 'allow_edit_cap' => array( |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if ( ! empty( $passed_post ) ) { |
22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
23 | - foreach( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
23 | + foreach ( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
24 | 24 | if ( \GV\View::exists( $view_id ) && ! $this->views->contains( $view_id ) ) { |
25 | 25 | $this->views->add( \GV\View::by_id( $view_id ) ); |
26 | 26 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ( $passed_post as &$post ) { |
79 | 79 | $views = \GV\View_Collection::from_post( $post ); |
80 | 80 | foreach ( $views->all() as $view ) { |
81 | - $ids []= $view->ID; |
|
81 | + $ids [ ] = $view->ID; |
|
82 | 82 | |
83 | 83 | /** And as a side-effect... add each view to the global scope. */ |
84 | 84 | if ( ! $this->views->contains( $view->ID ) ) { |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | if ( is_string( $passed_post ) ) { |
93 | 93 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
94 | 94 | foreach ( $shortcodes as $shortcode ) { |
95 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) { |
|
96 | - $ids []= $shortcode->atts['id']; |
|
95 | + if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) ) { |
|
96 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
97 | 97 | |
98 | 98 | /** And as a side-effect... add each view to the global scope. */ |
99 | - if ( ! $this->views->contains( $shortcode->atts['id'] ) && \GV\View::exists( $shortcode->atts['id'] ) ) { |
|
100 | - $this->views->add( $shortcode->atts['id'] ); |
|
99 | + if ( ! $this->views->contains( $shortcode->atts[ 'id' ] ) && \GV\View::exists( $shortcode->atts[ 'id' ] ) ) { |
|
100 | + $this->views->add( $shortcode->atts[ 'id' ] ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | $id = $this->get_id_from_atts( $passed_post ); |
106 | - $ids[] = intval( $id ); |
|
106 | + $ids[ ] = intval( $id ); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // If it's just one ID, return that. |
115 | 115 | // Otherwise, return array of IDs |
116 | - return ( count( $ids ) === 1 ) ? $ids[0] : $ids; |
|
116 | + return ( count( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function getInstance( $passed_post = NULL ) { |
123 | 123 | |
124 | - if( empty( self::$instance ) ) { |
|
124 | + if ( empty( self::$instance ) ) { |
|
125 | 125 | self::$instance = new GravityView_View_Data( $passed_post ); |
126 | 126 | } |
127 | 127 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | return array(); |
138 | 138 | } |
139 | 139 | return array_combine( |
140 | - array_map( function ( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | - array_map( function ( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
140 | + array_map( function( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | + array_map( function( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -252,22 +252,22 @@ discard block |
||
252 | 252 | public function parse_post_content( $content ) { |
253 | 253 | $ids = array(); |
254 | 254 | foreach ( \GV\Shortcode::parse( $content ) as $shortcode ) { |
255 | - if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts['id'] ) ) { |
|
256 | - if ( \GV\View::exists( $shortcode->atts['id'] ) && ! $this->views->contains( $shortcode->atts['id'] ) ) { |
|
257 | - $this->views->add( \GV\View::by_id( $shortcode->atts['id'] ) ); |
|
255 | + if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
256 | + if ( \GV\View::exists( $shortcode->atts[ 'id' ] ) && ! $this->views->contains( $shortcode->atts[ 'id' ] ) ) { |
|
257 | + $this->views->add( \GV\View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
258 | 258 | } |
259 | 259 | /** |
260 | 260 | * The original function outputs the ID even though it wasn't added by ::add_view() |
261 | 261 | * Wether this is a bug or not remains a mystery. But we need to emulate this behavior |
262 | 262 | * until better times. |
263 | 263 | */ |
264 | - $ids []= $shortcode->atts['id']; |
|
264 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | if ( empty ( $ids ) ) { |
268 | 268 | return null; |
269 | 269 | } |
270 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
270 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // Not invalid if not set! |
291 | 291 | if ( empty( $post_id ) || empty( $view_id ) ) { |
292 | 292 | |
293 | - if( $empty_is_valid ) { |
|
293 | + if ( $empty_is_valid ) { |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
324 | 324 | |
325 | 325 | // The post or page specified does not contain the shortcode. |
326 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
326 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
327 | 327 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
328 | 328 | } |
329 | 329 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if ( ! $message ) { |
332 | 332 | // It's a View |
333 | 333 | if ( \GV\View::exists( $post_id ) ) { |
334 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
334 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
36 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
37 | 37 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
38 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
39 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
38 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
39 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | // Add help page to GravityView menu |
52 | 52 | add_submenu_page( |
53 | 53 | 'edit.php?post_type=gravityview', |
54 | - __('GravityView: Getting Started', 'gravityview'), |
|
55 | - __('Getting Started', 'gravityview'), |
|
54 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
55 | + __( 'Getting Started', 'gravityview' ), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'gv-getting-started', |
58 | 58 | array( $this, 'getting_started_screen' ) |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return boolean $is_page True: yep; false: nope |
87 | 87 | */ |
88 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
88 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
89 | 89 | global $plugin_page; |
90 | 90 | |
91 | - if($is_page) { return $is_page; } |
|
91 | + if ( $is_page ) { return $is_page; } |
|
92 | 92 | |
93 | 93 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
94 | 94 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
106 | 106 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
107 | 107 | |
108 | - if( !$this->is_dashboard_page() ) { return; } |
|
108 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
109 | 109 | |
110 | 110 | ?> |
111 | 111 | <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html"> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // Don't fetch -beta, etc. |
129 | 129 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
130 | 130 | |
131 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
131 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
132 | 132 | |
133 | 133 | echo gravityview_get_floaty( 132 ); |
134 | 134 | ?> |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
138 | 138 | |
139 | 139 | <h2 class="nav-tab-wrapper clear"> |
140 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
140 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
141 | 141 | <?php _e( "Getting Started", 'gravityview' ); ?> |
142 | 142 | </a> |
143 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
143 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
144 | 144 | <?php _e( "List of Changes", 'gravityview' ); ?> |
145 | 145 | </a> |
146 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
146 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
147 | 147 | <?php _e( 'Credits', 'gravityview' ); ?> |
148 | 148 | </a> |
149 | 149 | </h2> |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | <h3>Create a View</h3> |
178 | 178 | |
179 | 179 | <ol class="ol-decimal"> |
180 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
180 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
181 | 181 | <li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li> |
182 | 182 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
183 | 183 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | </ul> |
632 | 632 | |
633 | 633 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
634 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p> |
|
634 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p> |
|
635 | 635 | </div> |
636 | 636 | </div> |
637 | 637 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | global $plugin_page; |
674 | 674 | |
675 | 675 | // Bail if we're just editing the plugin |
676 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
676 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
677 | 677 | |
678 | 678 | // Bail if no activation redirect |
679 | 679 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
685 | 685 | |
686 | 686 | // Don't do anything if they've already seen the new version info |
687 | - if( $upgrade === GravityView_Plugin::version ) { |
|
687 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
688 | 688 | return; |
689 | 689 | } |
690 | 690 | |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
693 | 693 | |
694 | 694 | // Bail if activating from network, or bulk |
695 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
695 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
696 | 696 | |
697 | 697 | // First time install |
698 | - if( ! $upgrade ) { |
|
698 | + if ( ! $upgrade ) { |
|
699 | 699 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
700 | 700 | } |
701 | 701 | // Update |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | if ( ! $detailed ) { |
556 | 556 | $defaults = array(); |
557 | 557 | foreach ( $default_settings as $key => $value ) { |
558 | - $defaults[ $key ] = $value['value']; |
|
558 | + $defaults[ $key ] = $value[ 'value' ]; |
|
559 | 559 | } |
560 | 560 | return $defaults; |
561 | 561 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // If the $group argument is set for the method, |
567 | 567 | // ignore any settings that aren't in that group. |
568 | 568 | if ( ! empty( $group ) && is_string( $group ) ) { |
569 | - if ( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
569 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
570 | 570 | unset( $default_settings[ $key ] ); |
571 | 571 | } |
572 | 572 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | return; |
305 | 305 | } |
306 | 306 | |
307 | - $locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
307 | + $locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
308 | 308 | |
309 | 309 | gravityview()->log->error( sprintf( 'Unable to load textdomain for %s locale.', $locale ) ); |
310 | 310 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | */ |
527 | 527 | private function get_php_version() { |
528 | 528 | |
529 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
530 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
529 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
530 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | */ |
540 | 540 | private function get_wordpress_version() { |
541 | 541 | |
542 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
543 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
542 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
543 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | */ |
553 | 553 | private function get_gravityforms_version() { |
554 | 554 | |
555 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
555 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
556 | 556 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
557 | 557 | |
558 | 558 | return null; |
559 | 559 | } |
560 | 560 | |
561 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
562 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
561 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
562 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | $items = get_posts( array( |
606 | 606 | 'post_type' => 'gravityview', |
607 | 607 | 'post_status' => 'any', |
608 | - 'numberposts' => - 1, |
|
608 | + 'numberposts' => -1, |
|
609 | 609 | 'fields' => 'ids', |
610 | 610 | ) ); |
611 | 611 | |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $tables = array(); |
620 | 620 | |
621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
622 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
622 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
624 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
624 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | foreach ( $tables as $meta_table ) { |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | $tables = array(); |
641 | 641 | |
642 | 642 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
643 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
643 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
644 | 644 | } elseif ( ! $this->is_GF_25() ) { |
645 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
645 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) { |
55 | 55 | |
56 | - if ( empty( $article['id'] ) ) { |
|
56 | + if ( empty( $article[ 'id' ] ) ) { |
|
57 | 57 | return $tooltip; |
58 | 58 | } |
59 | 59 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | $css_class .= ' gv_tooltip'; |
71 | 71 | |
72 | - if ( ! empty( $article['type'] ) ) { |
|
73 | - $atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] ); |
|
72 | + if ( ! empty( $article[ 'type' ] ) ) { |
|
73 | + $atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] ); |
|
74 | 74 | } else { |
75 | - $atts = sprintf( 'data-beacon-article="%s"', $article['id'] ); |
|
75 | + $atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $url = \GV\Utils::get( $article, 'url', '#' ); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | ) ); |
173 | 173 | |
174 | 174 | // This is just HTML we don't need. |
175 | - unset( $response['message'] ); |
|
175 | + unset( $response[ 'message' ] ); |
|
176 | 176 | |
177 | - switch ( intval( $response['price_id'] ) ) { |
|
177 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
178 | 178 | default: |
179 | 179 | case 1: |
180 | 180 | $package = 'Core'; |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | 'signature' => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ), |
203 | 203 | 'affiliate_id' => gravityview()->plugin->settings->get( 'affiliate_id' ), |
204 | 204 | 'is_super_admin' => is_super_admin(), |
205 | - 'license_key' => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')', |
|
205 | + 'license_key' => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')', |
|
206 | 206 | 'license_level' => $package, |
207 | 207 | 'alt_emails' => sprintf( 'Admin: %s, GV Support: %s', get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ), |
208 | - 'payment_details' => $response['customer_name'] . ' ' . $response['customer_email'], |
|
208 | + 'payment_details' => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ], |
|
209 | 209 | 'wordpress_version' => get_bloginfo( 'version', 'display' ), |
210 | - 'php_version' => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ), |
|
210 | + 'php_version' => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ), |
|
211 | 211 | 'no_conflict_mode' => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled', |
212 | 212 | 'gravityview_version' => \GV\Plugin::$version, |
213 | 213 | 'gravity_forms_version' => GFForms::$version, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ob_get_clean(); |
218 | 218 | |
219 | 219 | // Help Scout length limit is 200 characters |
220 | - foreach( $data as $key => $value ) { |
|
220 | + foreach ( $data as $key => $value ) { |
|
221 | 221 | if ( ! is_string( $value ) ) { |
222 | 222 | continue; |
223 | 223 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | foreach ( $field->choices as $choice ) { |
49 | 49 | if ( is_array( $value ) && RGFormsModel::choice_value_match( $field, $choice, $value[ $input_id ] ) ) { |
50 | - return $choice['score']; |
|
50 | + return $choice[ 'score' ]; |
|
51 | 51 | } else if ( ! is_array( $value ) && RGFormsModel::choice_value_match( $field, $choice, $value ) ) { |
52 | - return $choice['score']; |
|
52 | + return $choice[ 'score' ]; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
60 | 60 | |
61 | - unset( $field_options['search_filter'] ); |
|
61 | + unset( $field_options[ 'search_filter' ] ); |
|
62 | 62 | |
63 | 63 | if ( 'edit' === $context ) { |
64 | 64 | return $field_options; |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | 'text' => __( 'Text value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ), |
81 | 81 | ); |
82 | 82 | |
83 | - if( $field->field->gsurveyLikertEnableScoring ) { |
|
84 | - $likert_display_options['score'] = __( 'Score value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ); |
|
83 | + if ( $field->field->gsurveyLikertEnableScoring ) { |
|
84 | + $likert_display_options[ 'score' ] = __( 'Score value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // Maintain for back-compatibility |
88 | - $add_options['score'] = array( |
|
88 | + $add_options[ 'score' ] = array( |
|
89 | 89 | 'type' => 'hidden', |
90 | 90 | 'value' => '', |
91 | 91 | 'group' => 'display', |
92 | 92 | ); |
93 | 93 | |
94 | - $add_options['choice_display'] = array( |
|
94 | + $add_options[ 'choice_display' ] = array( |
|
95 | 95 | 'type' => 'radio', |
96 | 96 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
97 | 97 | 'options' => $likert_display_options, |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - if( 'checkbox' === $field->field->inputType && $input_id ) { |
|
107 | - $field_options['choice_display'] = array( |
|
106 | + if ( 'checkbox' === $field->field->inputType && $input_id ) { |
|
107 | + $field_options[ 'choice_display' ] = array( |
|
108 | 108 | 'type' => 'radio', |
109 | 109 | 'class' => 'vertical', |
110 | 110 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | if ( 'rating' === $field->field->inputType ) { |
123 | - $field_options['choice_display'] = array( |
|
123 | + $field_options[ 'choice_display' ] = array( |
|
124 | 124 | 'type' => 'radio', |
125 | 125 | 'class' => 'vertical', |
126 | 126 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -26,52 +26,52 @@ |
||
26 | 26 | |
27 | 27 | <?php // list all the available templates (type= fresh or custom ) ?> |
28 | 28 | <div class="gv-grid"> |
29 | - <?php foreach( $templates as $id => $template ) { |
|
29 | + <?php foreach ( $templates as $id => $template ) { |
|
30 | 30 | $selected = ( $id == $current_template ) ? ' gv-selected' : ''; |
31 | - $placeholder = ! empty( $template['buy_source'] ); |
|
32 | - $is_included = ! empty( $template['included'] ); |
|
31 | + $placeholder = ! empty( $template[ 'buy_source' ] ); |
|
32 | + $is_included = ! empty( $template[ 'included' ] ); |
|
33 | 33 | $plugin_data = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) ); |
34 | 34 | $button_text = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' ); |
35 | 35 | $button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' ); |
36 | - $template_path = isset($plugin_data['path']) ? $plugin_data['path'] : ''; |
|
36 | + $template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : ''; |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | <div class="gv-grid-col-1-4"> |
40 | - <div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
40 | + <div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>"> |
|
41 | 41 | <div class="gv-view-types-normal"> |
42 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
43 | - <h5><?php echo esc_html( $template['label'] ); ?></h5> |
|
44 | - <p class="description"><?php echo esc_html( $template['description'] ); ?></p> |
|
42 | + <img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>"> |
|
43 | + <h5><?php echo esc_html( $template[ 'label' ] ); ?></h5> |
|
44 | + <p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p> |
|
45 | 45 | </div> |
46 | 46 | <div class="gv-view-types-hover"> |
47 | 47 | <div> |
48 | 48 | <?php |
49 | - if( $is_included ) { |
|
49 | + if ( $is_included ) { |
|
50 | 50 | ?> |
51 | 51 | <p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p> |
52 | - <?php if( !empty( $template['license'] ) ) { ?> |
|
53 | - <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', ' ', $template['license'] ) ) ); ?></p> |
|
52 | + <?php if ( ! empty( $template[ 'license' ] ) ) { ?> |
|
53 | + <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', ' ', $template[ 'license' ] ) ) ); ?></p> |
|
54 | 54 | <?php } ?> |
55 | 55 | <?php |
56 | - } elseif( $placeholder ) { |
|
57 | - $utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] ); |
|
56 | + } elseif ( $placeholder ) { |
|
57 | + $utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] ); |
|
58 | 58 | ?> |
59 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
59 | + <p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p> |
|
60 | 60 | |
61 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
62 | - <p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p> |
|
61 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
62 | + <p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p> |
|
63 | 63 | <?php } ?> |
64 | 64 | |
65 | - <?php if( ! empty( $template['license'] ) ) { ?> |
|
66 | - <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', ' ', $template['license'] ) ) . '</a>' ); ?></p> |
|
65 | + <?php if ( ! empty( $template[ 'license' ] ) ) { ?> |
|
66 | + <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', ' ', $template[ 'license' ] ) ) . '</a>' ); ?></p> |
|
67 | 67 | <?php } ?> |
68 | 68 | <?php } |
69 | 69 | |
70 | - if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?> |
|
70 | + if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?> |
|
71 | 71 | |
72 | - <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
73 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
74 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-welcome-view-site" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
72 | + <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p> |
|
73 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
74 | + <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-welcome-view-site" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a> |
|
75 | 75 | <?php } ?> |
76 | 76 | </div> |
77 | 77 | </div> |
@@ -114,14 +114,14 @@ |
||
114 | 114 | /** Require critical legacy core files. @todo Deprecate */ |
115 | 115 | require_once $this->plugin->dir( 'includes/import-functions.php' ); |
116 | 116 | require_once $this->plugin->dir( 'includes/helper-functions.php' ); |
117 | - require_once $this->plugin->dir( 'includes/class-common.php'); |
|
118 | - require_once $this->plugin->dir( 'includes/connector-functions.php'); |
|
117 | + require_once $this->plugin->dir( 'includes/class-common.php' ); |
|
118 | + require_once $this->plugin->dir( 'includes/connector-functions.php' ); |
|
119 | 119 | require_once $this->plugin->dir( 'includes/class-gravityview-compatibility.php' ); |
120 | 120 | require_once $this->plugin->dir( 'includes/class-gravityview-roles-capabilities.php' ); |
121 | 121 | require_once $this->plugin->dir( 'includes/class-gravityview-admin-notices.php' ); |
122 | 122 | require_once $this->plugin->dir( 'includes/class-admin.php' ); |
123 | - require_once $this->plugin->dir( 'includes/class-post-types.php'); |
|
124 | - require_once $this->plugin->dir( 'includes/class-cache.php'); |
|
123 | + require_once $this->plugin->dir( 'includes/class-post-types.php' ); |
|
124 | + require_once $this->plugin->dir( 'includes/class-cache.php' ); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * GravityView extensions and widgets. |