@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $name The key name (will be prefixed). |
53 | 53 | * @param mixed $default The default value if not found (Default: null) |
54 | 54 | * |
55 | - * @return mixed The value or $default if not found. |
|
55 | + * @return string The value or $default if not found. |
|
56 | 56 | */ |
57 | 57 | public static function _SERVER( $name, $default = null ) { |
58 | 58 | return self::get( $_SERVER, $name, $default ); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param mixed $value The value to return from the closure. |
128 | 128 | * |
129 | - * @return Closure The closure with the $value bound. |
|
129 | + * @return \Closure The closure with the $value bound. |
|
130 | 130 | */ |
131 | 131 | public static function _return( $value ) { |
132 | 132 | return function() use ( $value ) { return $value; }; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function gf_query_debug( $query ) { |
146 | 146 | $introspect = $query->_introspect(); |
147 | 147 | return array( |
148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if ( $condition->expressions ) { |
159 | 159 | $conditions = array(); |
160 | 160 | foreach ( $condition->expressions as $expression ) { |
161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
162 | 162 | } |
163 | 163 | return call_user_func_array( |
164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $form_id; |
46 | 46 | |
47 | - function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) { |
|
47 | + function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) { |
|
48 | 48 | |
49 | 49 | // Backward compat |
50 | - if ( ! empty( $item['type'] ) ) { |
|
51 | - $item['input_type'] = $item['type']; |
|
52 | - unset( $item['type'] ); |
|
50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
52 | + unset( $item[ 'type' ] ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->id = $item_id; |
76 | 76 | $this->form_id = $form_id; |
77 | 77 | $this->settings = $settings; |
78 | - $this->label_type = $item['label_type']; |
|
78 | + $this->label_type = $item[ 'label_type' ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | |
120 | 120 | foreach ( $field_info_items as $item ) { |
121 | 121 | |
122 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
122 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | |
126 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
126 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
127 | 127 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
128 | 128 | $output .= '<span class="' . $class . '">'; |
129 | - $output .= esc_html( $item['value'] ); |
|
129 | + $output .= esc_html( $item[ 'value' ] ); |
|
130 | 130 | $output .= '</span>'; |
131 | 131 | } |
132 | 132 | |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | |
155 | 155 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
156 | 156 | // TODO: Un-hack this |
157 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | - $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
157 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
158 | + $settings_link = sprintf( '<button class="gv-field-settings" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons %2$s"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
159 | 159 | |
160 | 160 | // Should we show the icon that the field is being used as a link to single entry? |
161 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
161 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
162 | 162 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
163 | 163 | |
164 | 164 | // When a field label is empty, use the Field ID |
165 | 165 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
166 | 166 | |
167 | 167 | // If there's a custom label, and show label is checked, use that as the field heading |
168 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
169 | - $label = $this->settings['custom_label']; |
|
170 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
171 | - $label = $this->item['customLabel']; |
|
168 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
169 | + $label = $this->settings[ 'custom_label' ]; |
|
170 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
171 | + $label = $this->item[ 'customLabel' ]; |
|
172 | 172 | } |
173 | 173 | $label = esc_attr( $label ); |
174 | 174 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | $output .= '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
178 | 178 | |
179 | 179 | $parent_label = ''; |
180 | - if ( ! empty( $this->item['parent'] ) ) { |
|
181 | - $parent_label = ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
180 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
181 | + $parent_label = ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // Name of field / widget |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | |
194 | 194 | $output .= '</h5>'; |
195 | 195 | |
196 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
197 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
196 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
197 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
198 | 198 | |
199 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
199 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
200 | 200 | |
201 | 201 | return $output; |
202 | 202 | } |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | |
38 | 38 | $merge_tags = array( |
39 | 39 | array( |
40 | - 'label' => __('Entry Creator: Display Name', 'gravityview'), |
|
40 | + 'label' => __( 'Entry Creator: Display Name', 'gravityview' ), |
|
41 | 41 | 'tag' => '{created_by:display_name}' |
42 | 42 | ), |
43 | 43 | array( |
44 | - 'label' => __('Entry Creator: Email', 'gravityview'), |
|
44 | + 'label' => __( 'Entry Creator: Email', 'gravityview' ), |
|
45 | 45 | 'tag' => '{created_by:user_email}' |
46 | 46 | ), |
47 | 47 | array( |
48 | - 'label' => __('Entry Creator: Username', 'gravityview'), |
|
48 | + 'label' => __( 'Entry Creator: Username', 'gravityview' ), |
|
49 | 49 | 'tag' => '{created_by:user_login}' |
50 | 50 | ), |
51 | 51 | array( |
52 | - 'label' => __('Entry Creator: User ID', 'gravityview'), |
|
52 | + 'label' => __( 'Entry Creator: User ID', 'gravityview' ), |
|
53 | 53 | 'tag' => '{created_by:ID}' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'label' => __('Entry Creator: Roles', 'gravityview'), |
|
56 | + 'label' => __( 'Entry Creator: Roles', 'gravityview' ), |
|
57 | 57 | 'tag' => '{created_by:roles}' |
58 | 58 | ), |
59 | 59 | ); |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
82 | 82 | |
83 | 83 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
84 | - if( empty( $matches ) || empty( $entry['created_by'] ) ) { |
|
84 | + if ( empty( $matches ) || empty( $entry[ 'created_by' ] ) ) { |
|
85 | 85 | return $text; |
86 | 86 | } |
87 | 87 | |
88 | 88 | // Get the creator of the entry |
89 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
89 | + $entry_creator = new WP_User( $entry[ 'created_by' ] ); |
|
90 | 90 | |
91 | 91 | foreach ( $matches as $match ) { |
92 | 92 | |
93 | - $full_tag = $match[0]; |
|
94 | - $property = $match[1]; |
|
93 | + $full_tag = $match[ 0 ]; |
|
94 | + $property = $match[ 1 ]; |
|
95 | 95 | |
96 | - switch( $property ) { |
|
96 | + switch ( $property ) { |
|
97 | 97 | case '': |
98 | 98 | $value = $entry_creator->ID; |
99 | 99 | break; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | |
120 | 120 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
121 | 121 | |
122 | - if( 'edit' === $context ) { |
|
122 | + if ( 'edit' === $context ) { |
|
123 | 123 | return $field_options; |
124 | 124 | } |
125 | 125 | |
126 | - $field_options['name_display'] = array( |
|
126 | + $field_options[ 'name_display' ] = array( |
|
127 | 127 | 'type' => 'select', |
128 | 128 | 'label' => __( 'User Format', 'gravityview' ), |
129 | 129 | 'desc' => __( 'How should the User information be displayed?', 'gravityview' ), |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
49 | 49 | |
50 | - if( 'edit' === $context ) { |
|
50 | + if ( 'edit' === $context ) { |
|
51 | 51 | return $field_options; |
52 | 52 | } |
53 | 53 | |
54 | - $this->add_field_support('date_display', $field_options ); |
|
54 | + $this->add_field_support( 'date_display', $field_options ); |
|
55 | 55 | |
56 | 56 | return $field_options; |
57 | 57 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
72 | 72 | |
73 | 73 | /** Overridden by a template. */ |
74 | - if( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
74 | + if ( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - return GVCommon::format_date( $field['value'], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
78 | + return GVCommon::format_date( $field[ 'value' ], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | type="' . $field['type'] . '" |
563 | 563 | name="' . esc_attr( $name ) . '" |
564 | 564 | value="' . $value . '" ' . |
565 | - implode( ' ', $attributes ) . |
|
566 | - ' />'; |
|
565 | + implode( ' ', $attributes ) . |
|
566 | + ' />'; |
|
567 | 567 | |
568 | 568 | if ( $echo ) { |
569 | 569 | echo $html; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
584 | - * Check whether GravityView is being saved |
|
585 | - * |
|
586 | - * The generic is_save_postback() is true for all addons |
|
587 | - * |
|
588 | - * @since 2.0.8 |
|
589 | - * |
|
584 | + * Check whether GravityView is being saved |
|
585 | + * |
|
586 | + * The generic is_save_postback() is true for all addons |
|
587 | + * |
|
588 | + * @since 2.0.8 |
|
589 | + * |
|
590 | 590 | * @return bool |
591 | 591 | */ |
592 | 592 | public function is_save_postback() { |
@@ -600,16 +600,16 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function license_key_notice() { |
602 | 602 | |
603 | - if( $this->is_save_postback() ) { |
|
604 | - $settings = $this->get_posted_settings(); |
|
605 | - $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | - } else { |
|
608 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | - $license_key = $this->get( 'license_key' ); |
|
610 | - } |
|
603 | + if( $this->is_save_postback() ) { |
|
604 | + $settings = $this->get_posted_settings(); |
|
605 | + $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
|
606 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
607 | + } else { |
|
608 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
609 | + $license_key = $this->get( 'license_key' ); |
|
610 | + } |
|
611 | 611 | |
612 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
612 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
613 | 613 | |
614 | 614 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
615 | 615 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $update_below = false; |
627 | 627 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
628 | 628 | |
629 | - switch ( $license_status ) { |
|
629 | + switch ( $license_status ) { |
|
630 | 630 | /** @since 1.17 */ |
631 | 631 | case 'expired': |
632 | 632 | $title = __( 'Expired License', 'gravityview' ); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | return; |
665 | 665 | } |
666 | 666 | |
667 | - \GravityView_Admin_Notices::add_notice( array( |
|
668 | - 'message' => $message, |
|
669 | - 'class' => 'notice notice-warning', |
|
670 | - 'title' => $title, |
|
671 | - 'cap' => 'gravityview_edit_settings', |
|
672 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | - ) ); |
|
667 | + \GravityView_Admin_Notices::add_notice( array( |
|
668 | + 'message' => $message, |
|
669 | + 'class' => 'notice notice-warning', |
|
670 | + 'title' => $title, |
|
671 | + 'cap' => 'gravityview_edit_settings', |
|
672 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
673 | + ) ); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -684,12 +684,12 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | - * |
|
689 | - * @since 1.21.5 |
|
690 | - * |
|
691 | - * @see GFAddOn::scripts() |
|
692 | - * |
|
687 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
688 | + * |
|
689 | + * @since 1.21.5 |
|
690 | + * |
|
691 | + * @see GFAddOn::scripts() |
|
692 | + * |
|
693 | 693 | * @return array Array of scripts |
694 | 694 | */ |
695 | 695 | public function scripts() { |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | $scripts[] = array( |
699 | 699 | 'handle' => 'gform_tooltip_init', |
700 | 700 | 'enqueue' => array( |
701 | - array( |
|
702 | - 'admin_page' => array( 'app_settings' ) |
|
703 | - ) |
|
704 | - ) |
|
701 | + array( |
|
702 | + 'admin_page' => array( 'app_settings' ) |
|
703 | + ) |
|
704 | + ) |
|
705 | 705 | ); |
706 | 706 | |
707 | 707 | return $scripts; |
@@ -719,10 +719,10 @@ discard block |
||
719 | 719 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
720 | 720 | 'version' => Plugin::$version, |
721 | 721 | 'deps' => array( |
722 | - 'gform_admin', |
|
722 | + 'gform_admin', |
|
723 | 723 | 'gaddon_form_settings_css', |
724 | - 'gform_tooltip', |
|
725 | - 'gform_font_awesome', |
|
724 | + 'gform_tooltip', |
|
725 | + 'gform_font_awesome', |
|
726 | 726 | ), |
727 | 727 | 'enqueue' => array( |
728 | 728 | array( 'admin_page' => array( |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | array( |
891 | 891 | 'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ), |
892 | 892 | 'value' => '1', |
893 | - 'name' => 'beta', |
|
893 | + 'name' => 'beta', |
|
894 | 894 | ), |
895 | 895 | ), |
896 | 896 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -928,38 +928,38 @@ discard block |
||
928 | 928 | |
929 | 929 | if ( empty( $field['disabled'] ) ) { |
930 | 930 | unset( $field['disabled'] ); |
931 | - } |
|
931 | + } |
|
932 | 932 | } |
933 | 933 | |
934 | - $sections = array( |
|
935 | - array( |
|
936 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | - 'fields' => $fields, |
|
938 | - ) |
|
939 | - ); |
|
934 | + $sections = array( |
|
935 | + array( |
|
936 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
937 | + 'fields' => $fields, |
|
938 | + ) |
|
939 | + ); |
|
940 | 940 | |
941 | - // custom 'update settings' button |
|
942 | - $button = array( |
|
943 | - 'class' => 'button button-primary button-hero', |
|
944 | - 'type' => 'save', |
|
945 | - ); |
|
941 | + // custom 'update settings' button |
|
942 | + $button = array( |
|
943 | + 'class' => 'button button-primary button-hero', |
|
944 | + 'type' => 'save', |
|
945 | + ); |
|
946 | 946 | |
947 | 947 | if ( $disabled_attribute ) { |
948 | 948 | $button['disabled'] = $disabled_attribute; |
949 | 949 | } |
950 | 950 | |
951 | - /** |
|
952 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | - * Extensions can tap in here to insert their own section and settings. |
|
954 | - * <code> |
|
955 | - * $sections[] = array( |
|
956 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | - * 'fields' => $settings, |
|
958 | - * ); |
|
959 | - * </code> |
|
960 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | - */ |
|
962 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
951 | + /** |
|
952 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
953 | + * Extensions can tap in here to insert their own section and settings. |
|
954 | + * <code> |
|
955 | + * $sections[] = array( |
|
956 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
957 | + * 'fields' => $settings, |
|
958 | + * ); |
|
959 | + * </code> |
|
960 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
961 | + */ |
|
962 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
963 | 963 | |
964 | 964 | // If there are extensions, add a section for them |
965 | 965 | if ( ! empty( $extension_sections ) ) { |
@@ -972,13 +972,13 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - $k = count( $extension_sections ) - 1 ; |
|
976 | - $extension_sections[ $k ]['fields'][] = $button; |
|
975 | + $k = count( $extension_sections ) - 1 ; |
|
976 | + $extension_sections[ $k ]['fields'][] = $button; |
|
977 | 977 | $sections = array_merge( $sections, $extension_sections ); |
978 | 978 | } else { |
979 | - // add the 'update settings' button to the general section |
|
980 | - $sections[0]['fields'][] = $button; |
|
981 | - } |
|
979 | + // add the 'update settings' button to the general section |
|
980 | + $sections[0]['fields'][] = $button; |
|
981 | + } |
|
982 | 982 | |
983 | 983 | return $sections; |
984 | 984 | } |
@@ -1032,9 +1032,9 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | protected function settings_edd_license( $field, $echo = true ) { |
1034 | 1034 | |
1035 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | - $field['input_type'] = 'password'; |
|
1037 | - } |
|
1035 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1036 | + $field['input_type'] = 'password'; |
|
1037 | + } |
|
1038 | 1038 | |
1039 | 1039 | $text = $this->settings_text( $field, false ); |
1040 | 1040 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * Allow pure HTML settings row |
1054 | - * |
|
1055 | - * @since 2.0.6 |
|
1056 | - * |
|
1054 | + * |
|
1055 | + * @since 2.0.6 |
|
1056 | + * |
|
1057 | 1057 | * @param array $field |
1058 | 1058 | * @param bool $echo Whether to echo the |
1059 | 1059 | * |
@@ -1119,19 +1119,19 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | - * |
|
1124 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | - * |
|
1127 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | - * |
|
1130 | - * @since 1.21.5.2 |
|
1131 | - * |
|
1122 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1123 | + * |
|
1124 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1125 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1126 | + * |
|
1127 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1128 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1129 | + * |
|
1130 | + * @since 1.21.5.2 |
|
1131 | + * |
|
1132 | 1132 | * @param array $field |
1133 | - * |
|
1134 | - * @return void |
|
1133 | + * |
|
1134 | + * @return void |
|
1135 | 1135 | */ |
1136 | 1136 | public function single_setting_row( $field ) { |
1137 | 1137 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return array |
103 | 103 | */ |
104 | 104 | public function modify_app_settings_menu_title( $setting_tabs ) { |
105 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
105 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
106 | 106 | return $setting_tabs; |
107 | 107 | } |
108 | 108 | |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | </ul> |
309 | 309 | <div class="gv-followup widefat"> |
310 | 310 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
311 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
311 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
312 | 312 | </div> |
313 | 313 | <div class="scale-description"> |
314 | 314 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
315 | 315 | <ul class="inline"> |
316 | 316 | <?php |
317 | 317 | $i = 0; |
318 | - while( $i < 11 ) { |
|
319 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
318 | + while ( $i < 11 ) { |
|
319 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
320 | 320 | $i++; |
321 | 321 | } |
322 | 322 | ?> |
@@ -549,15 +549,15 @@ discard block |
||
549 | 549 | * @return string The HTML |
550 | 550 | */ |
551 | 551 | public function as_html( $field, $echo = true ) { |
552 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
552 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
553 | 553 | |
554 | 554 | $attributes = $this->get_field_attributes( $field ); |
555 | 555 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
556 | - $value = $this->get( $field['name'], $default_value ); |
|
556 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
557 | 557 | |
558 | 558 | |
559 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
560 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
559 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
560 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
561 | 561 | |
562 | 562 | if ( empty( $value ) ) { |
563 | 563 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $attributes = $this->get_field_attributes( $field ); |
567 | 567 | |
568 | 568 | $html = '<input |
569 | - type="' . $field['type'] . '" |
|
569 | + type="' . $field[ 'type' ] . '" |
|
570 | 570 | name="' . esc_attr( $name ) . '" |
571 | 571 | value="' . $value . '" ' . |
572 | 572 | implode( ' ', $attributes ) . |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @return bool |
598 | 598 | */ |
599 | 599 | public function is_save_postback() { |
600 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
600 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function license_key_notice() { |
609 | 609 | |
610 | - if( $this->is_save_postback() ) { |
|
610 | + if ( $this->is_save_postback() ) { |
|
611 | 611 | $settings = $this->get_posted_settings(); |
612 | 612 | $license_key = defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : \GV\Utils::get( $settings, 'license_key' ); |
613 | 613 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * but didn't want to mess up the translation strings for the translators. |
629 | 629 | */ |
630 | 630 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
631 | - $title = __( 'Inactive License', 'gravityview'); |
|
631 | + $title = __( 'Inactive License', 'gravityview' ); |
|
632 | 632 | $status = ''; |
633 | 633 | $update_below = false; |
634 | 634 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
659 | 659 | break; |
660 | 660 | } |
661 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
661 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
662 | 662 | |
663 | 663 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
664 | 664 | if ( $update_below && gravityview()->request->is_admin( '', 'settings' ) ) { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | public function scripts() { |
703 | 703 | $scripts = parent::scripts(); |
704 | 704 | |
705 | - $scripts[] = array( |
|
705 | + $scripts[ ] = array( |
|
706 | 706 | 'handle' => 'gform_tooltip_init', |
707 | 707 | 'enqueue' => array( |
708 | 708 | array( |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | public function styles() { |
722 | 722 | $styles = parent::styles(); |
723 | 723 | |
724 | - $styles[] = array( |
|
724 | + $styles[ ] = array( |
|
725 | 725 | 'handle' => 'gravityview_settings', |
726 | 726 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
727 | 727 | 'version' => Plugin::$version, |
@@ -810,26 +810,26 @@ discard block |
||
810 | 810 | 'label' => __( 'License Key', 'gravityview' ), |
811 | 811 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
812 | 812 | 'type' => 'edd_license', |
813 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
813 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
814 | 814 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
815 | - 'default_value' => $default_settings['license_key'], |
|
815 | + 'default_value' => $default_settings[ 'license_key' ], |
|
816 | 816 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
817 | 817 | ), |
818 | 818 | array( |
819 | 819 | 'name' => 'license_key_response', |
820 | - 'default_value' => $default_settings['license_key_response'], |
|
820 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
821 | 821 | 'type' => 'hidden', |
822 | 822 | ), |
823 | 823 | array( |
824 | 824 | 'name' => 'license_key_status', |
825 | - 'default_value' => $default_settings['license_key_status'], |
|
825 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
826 | 826 | 'type' => 'hidden', |
827 | 827 | ), |
828 | 828 | array( |
829 | 829 | 'name' => 'support-email', |
830 | 830 | 'type' => 'text', |
831 | 831 | 'validate' => 'email', |
832 | - 'default_value' => $default_settings['support-email'], |
|
832 | + 'default_value' => $default_settings[ 'support-email' ], |
|
833 | 833 | 'label' => __( 'Support Email', 'gravityview' ), |
834 | 834 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
835 | 835 | 'class' => 'code regular-text', |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | 'name' => 'support_port', |
842 | 842 | 'type' => 'radio', |
843 | 843 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
844 | - 'default_value' => $default_settings['support_port'], |
|
844 | + 'default_value' => $default_settings[ 'support_port' ], |
|
845 | 845 | 'horizontal' => 1, |
846 | 846 | 'choices' => array( |
847 | 847 | array( |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | 'name' => 'no-conflict-mode', |
861 | 861 | 'type' => 'radio', |
862 | 862 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
863 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
863 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
864 | 864 | 'horizontal' => 1, |
865 | 865 | 'choices' => array( |
866 | 866 | array( |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | 'name' => 'rest_api', |
883 | 883 | 'type' => 'radio', |
884 | 884 | 'label' => __( 'REST API', 'gravityview' ), |
885 | - 'default_value' => $default_settings['rest_api'], |
|
885 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
886 | 886 | 'horizontal' => 1, |
887 | 887 | 'choices' => array( |
888 | 888 | array( |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | 'name' => 'beta', |
902 | 902 | 'type' => 'checkbox', |
903 | 903 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
904 | - 'default_value' => $default_settings['beta'], |
|
904 | + 'default_value' => $default_settings[ 'beta' ], |
|
905 | 905 | 'horizontal' => 1, |
906 | 906 | 'choices' => array( |
907 | 907 | array( |
@@ -934,17 +934,17 @@ discard block |
||
934 | 934 | * @since 1.7.4 |
935 | 935 | */ |
936 | 936 | foreach ( $fields as &$field ) { |
937 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
938 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
939 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
940 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
937 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
938 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
939 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
940 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
941 | 941 | |
942 | 942 | if ( $disabled_attribute ) { |
943 | - $field['disabled'] = $disabled_attribute; |
|
943 | + $field[ 'disabled' ] = $disabled_attribute; |
|
944 | 944 | } |
945 | 945 | |
946 | - if ( empty( $field['disabled'] ) ) { |
|
947 | - unset( $field['disabled'] ); |
|
946 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
947 | + unset( $field[ 'disabled' ] ); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | ); |
963 | 963 | |
964 | 964 | if ( $disabled_attribute ) { |
965 | - $button['disabled'] = $disabled_attribute; |
|
965 | + $button[ 'disabled' ] = $disabled_attribute; |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /** |
@@ -981,20 +981,20 @@ discard block |
||
981 | 981 | // If there are extensions, add a section for them |
982 | 982 | if ( ! empty( $extension_sections ) ) { |
983 | 983 | |
984 | - if( $disabled_attribute ) { |
|
984 | + if ( $disabled_attribute ) { |
|
985 | 985 | foreach ( $extension_sections as &$section ) { |
986 | - foreach ( $section['fields'] as &$field ) { |
|
987 | - $field['disabled'] = $disabled_attribute; |
|
986 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
987 | + $field[ 'disabled' ] = $disabled_attribute; |
|
988 | 988 | } |
989 | 989 | } |
990 | 990 | } |
991 | 991 | |
992 | - $k = count( $extension_sections ) - 1 ; |
|
993 | - $extension_sections[ $k ]['fields'][] = $button; |
|
992 | + $k = count( $extension_sections ) - 1; |
|
993 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
994 | 994 | $sections = array_merge( $sections, $extension_sections ); |
995 | 995 | } else { |
996 | 996 | // add the 'update settings' button to the general section |
997 | - $sections[0]['fields'][] = $button; |
|
997 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | return $sections; |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | protected function settings_edd_license( $field, $echo = true ) { |
1051 | 1051 | |
1052 | 1052 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1053 | - $field['input_type'] = 'password'; |
|
1053 | + $field[ 'input_type' ] = 'password'; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | $text = $this->settings_text( $field, false ); |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | public function single_setting_row_html( $field ) { |
1100 | 1100 | ?> |
1101 | 1101 | |
1102 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1102 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1103 | 1103 | <td colspan="2"> |
1104 | 1104 | <?php $this->single_setting( $field ); ?> |
1105 | 1105 | </td> |
@@ -1117,10 +1117,10 @@ discard block |
||
1117 | 1117 | * @return string |
1118 | 1118 | */ |
1119 | 1119 | public function settings_save( $field, $echo = true ) { |
1120 | - $field['type'] = 'submit'; |
|
1121 | - $field['name'] = 'gform-settings-save'; |
|
1122 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
1123 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1120 | + $field[ 'type' ] = 'submit'; |
|
1121 | + $field[ 'name' ] = 'gform-settings-save'; |
|
1122 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
1123 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1124 | 1124 | |
1125 | 1125 | $output = $this->settings_submit( $field, false ); |
1126 | 1126 | |
@@ -1151,8 +1151,8 @@ discard block |
||
1151 | 1151 | * @return void |
1152 | 1152 | */ |
1153 | 1153 | public function single_setting_row( $field ) { |
1154 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1155 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1154 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1155 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1156 | 1156 | parent::single_setting_row( $field ); |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | public function single_setting_label( $field ) { |
1165 | 1165 | parent::single_setting_label( $field ); |
1166 | 1166 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
1167 | - echo '<span class="description">'. $description .'</span>'; |
|
1167 | + echo '<span class="description">' . $description . '</span>'; |
|
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1209,10 +1209,10 @@ discard block |
||
1209 | 1209 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1210 | 1210 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
1211 | 1211 | |
1212 | - unset( $posted_settings['license_key_response'] ); |
|
1213 | - unset( $posted_settings['license_key_status'] ); |
|
1212 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1213 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1214 | 1214 | |
1215 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1215 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1216 | 1216 | |
1217 | 1217 | $added_message = true; |
1218 | 1218 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | * |
74 | 74 | * @param array $allowlist Array of widgets to show before a search is performed, if the setting is enabled. |
75 | 75 | * |
76 | - * @return array |
|
76 | + * @return string[] |
|
77 | 77 | */ |
78 | 78 | function add_to_allowlist( $allowlist ) { |
79 | 79 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() { |
15 | 15 | |
16 | - $this->widget_description = __('Display a Gravity Forms form.', 'gravityview' ); |
|
16 | + $this->widget_description = __( 'Display a Gravity Forms form.', 'gravityview' ); |
|
17 | 17 | |
18 | 18 | $default_values = array( |
19 | 19 | 'header' => 1, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | add_filter( 'gravityview/widget/hide_until_searched/whitelist', array( $this, 'add_to_allowlist' ) ); |
56 | 56 | |
57 | - parent::__construct( __( 'Gravity Forms', 'gravityview' ) , 'gravityforms', $default_values, $settings ); |
|
57 | + parent::__construct( __( 'Gravity Forms', 'gravityview' ), 'gravityforms', $default_values, $settings ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * gravityview_get_forms() is currently running too early as widgets_init runs before init and |
82 | 82 | * when most Gravity Forms plugins register their own fields like GP Terms of Service. |
83 | 83 | */ |
84 | - if( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) { |
|
84 | + if ( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) { |
|
85 | 85 | |
86 | 86 | // check for available gravity forms |
87 | 87 | $forms = gravityview_get_forms(); |
88 | 88 | |
89 | 89 | foreach ( $forms as $form ) { |
90 | - $choices[ $form['id'] ] = $form['title']; |
|
90 | + $choices[ $form[ 'id' ] ] = $form[ 'title' ]; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function add_to_allowlist( $allowlist ) { |
105 | 105 | |
106 | - $allowlist[] = 'gravityforms'; |
|
106 | + $allowlist[ ] = 'gravityforms'; |
|
107 | 107 | |
108 | 108 | return $allowlist; |
109 | 109 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string $content |
114 | 114 | * @param string $context |
115 | 115 | */ |
116 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
116 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
117 | 117 | |
118 | 118 | if ( ! $this->pre_render_frontend() ) { |
119 | 119 | return; |
@@ -16,17 +16,17 @@ |
||
16 | 16 | */ |
17 | 17 | function gravityview_register_gravityview_widgets() { |
18 | 18 | |
19 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
19 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
20 | 20 | |
21 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
22 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
24 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
21 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
22 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
24 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
27 | 27 | |
28 | - if( class_exists('GFPolls') ) { |
|
29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
28 | + if ( class_exists( 'GFPolls' ) ) { |
|
29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | public function clear_cache_after_workflow( $form, $entry_id, $step_id, $starting_step_id ) { |
56 | - do_action( 'gravityview_clear_form_cache', $form['id'] ); |
|
56 | + do_action( 'gravityview_clear_form_cache', $form[ 'id' ] ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
72 | 72 | |
73 | - if( empty( $form_id ) ) { |
|
73 | + if ( empty( $form_id ) ) { |
|
74 | 74 | $form_id = GravityView_View::getInstance()->getFormId(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
78 | 78 | |
79 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
79 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $workflow_steps = $GFlow->get_steps(); |
100 | 100 | |
101 | - if( $workflow_steps ) { |
|
101 | + if ( $workflow_steps ) { |
|
102 | 102 | |
103 | 103 | foreach ( $workflow_steps as $step ) { |
104 | 104 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | - $fields['workflow_step'] = array( |
|
113 | + $fields[ 'workflow_step' ] = array( |
|
114 | 114 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
115 | 115 | 'type' => 'select', |
116 | 116 | ); |
117 | 117 | |
118 | - $fields['workflow_final_status'] = array( |
|
118 | + $fields[ 'workflow_final_status' ] = array( |
|
119 | 119 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
120 | 120 | 'type' => 'select', |
121 | 121 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
132 | 132 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
133 | 133 | |
134 | - $fields[] = array( |
|
134 | + $fields[ ] = array( |
|
135 | 135 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
136 | 136 | 'operators' => array( '>', '<' ), |
137 | 137 | 'placeholder' => 'yyyy-mm-dd', |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
158 | 158 | $values_end = array_splice( $values, $insert_at + 1 ); |
159 | 159 | |
160 | - $keys[] = 'workflow_current_status_timestamp'; |
|
161 | - $values[] = array( |
|
160 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
161 | + $values[ ] = array( |
|
162 | 162 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
163 | 163 | 'type' => 'workflow_current_status_timestamp', |
164 | 164 | ); |
@@ -97,7 +97,7 @@ |
||
97 | 97 | * @uses api_request() |
98 | 98 | * |
99 | 99 | * @param array $_transient_data Update array build by WordPress. |
100 | - * @return array Modified update array with custom plugin data. |
|
100 | + * @return stdClass Modified update array with custom plugin data. |
|
101 | 101 | */ |
102 | 102 | public function check_update( $_transient_data ) { |
103 | 103 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Allows plugins to use their own update API. |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | $this->api_data = $_api_data; |
49 | 49 | $this->name = plugin_basename( $_plugin_file ); |
50 | 50 | $this->slug = basename( $_plugin_file, '.php' ); |
51 | - $this->version = $_api_data['version']; |
|
52 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
53 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
54 | - $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
51 | + $this->version = $_api_data[ 'version' ]; |
|
52 | + $this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false; |
|
53 | + $this->beta = ! empty( $this->api_data[ 'beta' ] ) ? true : false; |
|
54 | + $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ); |
|
55 | 55 | |
56 | 56 | $edd_plugin_data[ $this->slug ] = $this->api_data; |
57 | 57 | |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
173 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | - if( ! is_multisite() ) { |
|
177 | + if ( ! is_multisite() ) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
282 | 282 | esc_html( $version_info->new_version ), |
283 | 283 | '</a>', |
284 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
284 | + '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">', |
|
285 | 285 | '</a>' |
286 | 286 | ); |
287 | 287 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $_data->contributors = $this->convert_object_to_array( $_data->contributors ); |
366 | 366 | } |
367 | 367 | |
368 | - if( ! isset( $_data->plugin ) ) { |
|
368 | + if ( ! isset( $_data->plugin ) ) { |
|
369 | 369 | $_data->plugin = $this->name; |
370 | 370 | } |
371 | 371 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | $verify_ssl = $this->verify_ssl(); |
406 | 406 | if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
407 | - $args['sslverify'] = $verify_ssl; |
|
407 | + $args[ 'sslverify' ] = $verify_ssl; |
|
408 | 408 | } |
409 | 409 | return $args; |
410 | 410 | |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) { |
433 | 433 | $test_url_parts = parse_url( $this->api_url ); |
434 | 434 | |
435 | - $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http'; |
|
436 | - $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : ''; |
|
437 | - $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : ''; |
|
435 | + $scheme = ! empty( $test_url_parts[ 'scheme' ] ) ? $test_url_parts[ 'scheme' ] : 'http'; |
|
436 | + $host = ! empty( $test_url_parts[ 'host' ] ) ? $test_url_parts[ 'host' ] : ''; |
|
437 | + $port = ! empty( $test_url_parts[ 'port' ] ) ? ':' . $test_url_parts[ 'port' ] : ''; |
|
438 | 438 | |
439 | 439 | if ( empty( $host ) ) { |
440 | 440 | $edd_plugin_url_available[ $store_hash ] = false; |
@@ -451,27 +451,27 @@ discard block |
||
451 | 451 | |
452 | 452 | $data = array_merge( $this->api_data, $_data ); |
453 | 453 | |
454 | - if ( $data['slug'] != $this->slug ) { |
|
454 | + if ( $data[ 'slug' ] != $this->slug ) { |
|
455 | 455 | return; |
456 | 456 | } |
457 | 457 | |
458 | - if( $this->api_url == trailingslashit ( home_url() ) ) { |
|
458 | + if ( $this->api_url == trailingslashit( home_url() ) ) { |
|
459 | 459 | return false; // Don't allow a plugin to ping itself |
460 | 460 | } |
461 | 461 | |
462 | 462 | $api_params = array( |
463 | 463 | 'edd_action' => 'get_version', |
464 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
465 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
466 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
467 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
468 | - 'slug' => $data['slug'], |
|
469 | - 'author' => $data['author'], |
|
464 | + 'license' => ! empty( $data[ 'license' ] ) ? $data[ 'license' ] : '', |
|
465 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
466 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
467 | + 'version' => isset( $data[ 'version' ] ) ? $data[ 'version' ] : false, |
|
468 | + 'slug' => $data[ 'slug' ], |
|
469 | + 'author' => $data[ 'author' ], |
|
470 | 470 | 'url' => home_url(), |
471 | - 'beta' => ! empty( $data['beta'] ), |
|
471 | + 'beta' => ! empty( $data[ 'beta' ] ), |
|
472 | 472 | ); |
473 | 473 | |
474 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
474 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
475 | 475 | |
476 | 476 | if ( ! is_wp_error( $request ) ) { |
477 | 477 | $request = json_decode( wp_remote_retrieve_body( $request ) ); |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | $request->icons = maybe_unserialize( $request->icons ); |
492 | 492 | } |
493 | 493 | |
494 | - if( ! empty( $request->sections ) ) { |
|
495 | - foreach( $request->sections as $key => $section ) { |
|
496 | - $request->$key = (array) $section; |
|
494 | + if ( ! empty( $request->sections ) ) { |
|
495 | + foreach ( $request->sections as $key => $section ) { |
|
496 | + $request->$key = (array)$section; |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
@@ -507,35 +507,35 @@ discard block |
||
507 | 507 | |
508 | 508 | global $edd_plugin_data; |
509 | 509 | |
510 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
510 | + if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' != $_REQUEST[ 'edd_sl_action' ] ) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | |
514 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
514 | + if ( empty( $_REQUEST[ 'plugin' ] ) ) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
518 | - if( empty( $_REQUEST['slug'] ) ) { |
|
518 | + if ( empty( $_REQUEST[ 'slug' ] ) ) { |
|
519 | 519 | return; |
520 | 520 | } |
521 | 521 | |
522 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
522 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
523 | 523 | wp_die( __( 'You do not have permission to install plugin updates', 'gravityview' ), __( 'Error', 'gravityview' ), array( 'response' => 403 ) ); |
524 | 524 | } |
525 | 525 | |
526 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
526 | + $data = $edd_plugin_data[ $_REQUEST[ 'slug' ] ]; |
|
527 | 527 | $version_info = $this->get_cached_version_info(); |
528 | 528 | |
529 | - if( false === $version_info ) { |
|
529 | + if ( false === $version_info ) { |
|
530 | 530 | |
531 | 531 | $api_params = array( |
532 | 532 | 'edd_action' => 'get_version', |
533 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
534 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
535 | - 'slug' => $_REQUEST['slug'], |
|
536 | - 'author' => $data['author'], |
|
533 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
534 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
535 | + 'slug' => $_REQUEST[ 'slug' ], |
|
536 | + 'author' => $data[ 'author' ], |
|
537 | 537 | 'url' => home_url(), |
538 | - 'beta' => ! empty( $data['beta'] ) |
|
538 | + 'beta' => ! empty( $data[ 'beta' ] ) |
|
539 | 539 | ); |
540 | 540 | |
541 | 541 | $verify_ssl = $this->verify_ssl(); |
@@ -551,22 +551,22 @@ discard block |
||
551 | 551 | $version_info = false; |
552 | 552 | } |
553 | 553 | |
554 | - if( ! empty( $version_info ) ) { |
|
555 | - foreach( $version_info->sections as $key => $section ) { |
|
556 | - $version_info->$key = (array) $section; |
|
554 | + if ( ! empty( $version_info ) ) { |
|
555 | + foreach ( $version_info->sections as $key => $section ) { |
|
556 | + $version_info->$key = (array)$section; |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | 560 | $this->set_version_info_cache( $version_info ); |
561 | 561 | |
562 | 562 | // Delete the unneeded option |
563 | - delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) ); |
|
563 | + delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST[ 'plugin' ] ) . '_' . $this->beta . '_version_info' ) ); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | if ( isset( $version_info->sections ) ) { |
567 | 567 | $sections = $this->convert_object_to_array( $version_info->sections ); |
568 | - if ( ! empty( $sections['changelog'] ) ) { |
|
569 | - echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>'; |
|
568 | + if ( ! empty( $sections[ 'changelog' ] ) ) { |
|
569 | + echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>'; |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -581,25 +581,25 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function get_cached_version_info( $cache_key = '' ) { |
583 | 583 | |
584 | - if( empty( $cache_key ) ) { |
|
584 | + if ( empty( $cache_key ) ) { |
|
585 | 585 | $cache_key = $this->cache_key; |
586 | 586 | } |
587 | 587 | |
588 | 588 | $cache = get_option( $cache_key ); |
589 | 589 | |
590 | - if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
590 | + if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) { |
|
591 | 591 | return false; // Cache is expired |
592 | 592 | } |
593 | 593 | |
594 | 594 | // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point. |
595 | - $cache['value'] = json_decode( $cache['value'] ); |
|
596 | - if ( ! empty( $cache['value']->icons ) ) { |
|
597 | - $cache['value']->icons = (array) $cache['value']->icons; |
|
595 | + $cache[ 'value' ] = json_decode( $cache[ 'value' ] ); |
|
596 | + if ( ! empty( $cache[ 'value' ]->icons ) ) { |
|
597 | + $cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons; |
|
598 | 598 | } else { |
599 | - $cache['value']->icons = array(); |
|
599 | + $cache[ 'value' ]->icons = array(); |
|
600 | 600 | } |
601 | 601 | |
602 | - return $cache['value']; |
|
602 | + return $cache[ 'value' ]; |
|
603 | 603 | |
604 | 604 | } |
605 | 605 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public function set_version_info_cache( $value = '', $cache_key = '' ) { |
613 | 613 | |
614 | - if( empty( $cache_key ) ) { |
|
614 | + if ( empty( $cache_key ) ) { |
|
615 | 615 | $cache_key = $this->cache_key; |
616 | 616 | } |
617 | 617 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | update_option( $cache_key, $data, 'no' ); |
624 | 624 | |
625 | 625 | // Delete the duplicate option |
626 | - delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) ); |
|
626 | + delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) ); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | * @return bool |
634 | 634 | */ |
635 | 635 | private function verify_ssl() { |
636 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
636 | + return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | } |