@@ -33,7 +33,7 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | if ( 'single' === $context ) { |
36 | - unset( $field_options['new_window'] ); |
|
36 | + unset( $field_options[ 'new_window' ] ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $field_options; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | function __construct() { |
21 | 21 | |
22 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
22 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
23 | 23 | |
24 | 24 | $default_values = array( |
25 | 25 | 'header' => 1, |
@@ -44,39 +44,39 @@ discard block |
||
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | |
47 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
47 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
50 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
51 | 51 | |
52 | - if( !$this->pre_render_frontend() ) { |
|
52 | + if ( ! $this->pre_render_frontend() ) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - if( !empty( $widget_args['title'] ) ) { |
|
57 | - echo $widget_args['title']; |
|
56 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
57 | + echo $widget_args[ 'title' ]; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | // Make sure the class is loaded in DataTables |
62 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
62 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
63 | 63 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
64 | 64 | } |
65 | 65 | |
66 | - $widget_args['content'] = trim( rtrim( \GV\Utils::get( $widget_args, 'content' ) ) ); |
|
66 | + $widget_args[ 'content' ] = trim( rtrim( \GV\Utils::get( $widget_args, 'content' ) ) ); |
|
67 | 67 | |
68 | 68 | // No custom content |
69 | - if( empty( $widget_args['content'] ) ) { |
|
69 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
70 | 70 | gravityview()->log->debug( 'No content.' ); |
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | 74 | // Add paragraphs? |
75 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
76 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
75 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
76 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
77 | 77 | } |
78 | 78 | |
79 | - $content = $widget_args['content']; |
|
79 | + $content = $widget_args[ 'content' ]; |
|
80 | 80 | |
81 | 81 | $content = GravityView_Merge_Tags::replace_variables( $content, array(), array(), false, true, false ); |
82 | 82 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | |
87 | 87 | |
88 | 88 | // Add custom class |
89 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
89 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
90 | 90 | $class = gravityview_sanitize_html_class( $class ); |
91 | 91 | |
92 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
92 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
93 | 93 | |
94 | 94 | } |
95 | 95 |
@@ -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/search-widget/class-search-widget.php' ); |
|
22 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
24 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
21 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
22 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
24 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.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 | } |
@@ -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' ) ) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->id = $item_id; |
77 | 77 | $this->form_id = $form_id; |
78 | 78 | $this->settings = $settings; |
79 | - $this->label_type = $item['label_type']; |
|
79 | + $this->label_type = $item[ 'label_type' ]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | foreach ( $field_info_items as $item ) { |
122 | 122 | |
123 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
123 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
127 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
128 | 128 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
129 | 129 | $output .= '<span class="' . $class . '">'; |
130 | - $output .= esc_html( $item['value'] ); |
|
130 | + $output .= esc_html( $item[ 'value' ] ); |
|
131 | 131 | $output .= '</span>'; |
132 | 132 | } |
133 | 133 | |
@@ -156,46 +156,46 @@ discard block |
||
156 | 156 | |
157 | 157 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
158 | 158 | // TODO: Un-hack this |
159 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
160 | - $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
159 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
160 | + $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
161 | 161 | |
162 | 162 | // When a field label is empty, use the Field ID |
163 | 163 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
164 | 164 | |
165 | 165 | // If there's a custom label, and show label is checked, use that as the field heading |
166 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
167 | - $label = $this->settings['custom_label']; |
|
168 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
169 | - $label = $this->item['customLabel']; |
|
166 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
167 | + $label = $this->settings[ 'custom_label' ]; |
|
168 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
169 | + $label = $this->item[ 'customLabel' ]; |
|
170 | 170 | } |
171 | 171 | $label = esc_attr( $label ); |
172 | 172 | |
173 | 173 | $field_icon = ''; |
174 | 174 | |
175 | 175 | $form = ! empty( $this->form_id ) ? GVCommon::get_form( $this->form_id ) : false; |
176 | - $nonexistent_form_field = $form && $this->id && preg_match('/^\d+\.\d+$|^\d+$/', $this->id) && ! gravityview_get_field( $form, $this->id ); |
|
176 | + $nonexistent_form_field = $form && $this->id && preg_match( '/^\d+\.\d+$|^\d+$/', $this->id ) && ! gravityview_get_field( $form, $this->id ); |
|
177 | 177 | |
178 | - if ( $this->item['icon'] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
178 | + if ( $this->item[ 'icon' ] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
179 | 179 | |
180 | - $has_gf_icon = ( false !== strpos( $this->item['icon'], 'gform-icon' ) ); |
|
181 | - $has_dashicon = ( false !== strpos( $this->item['icon'], 'dashicons' ) ); |
|
180 | + $has_gf_icon = ( false !== strpos( $this->item[ 'icon' ], 'gform-icon' ) ); |
|
181 | + $has_dashicon = ( false !== strpos( $this->item[ 'icon' ], 'dashicons' ) ); |
|
182 | 182 | |
183 | - if ( 0 === strpos( $this->item['icon'], 'data:' ) ) { |
|
183 | + if ( 0 === strpos( $this->item[ 'icon' ], 'data:' ) ) { |
|
184 | 184 | // Inline icon SVG |
185 | - $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item['icon'] ) . '\');"></i>'; |
|
186 | - } elseif( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
185 | + $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item[ 'icon' ] ) . '\');"></i>'; |
|
186 | + } elseif ( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
187 | 187 | // Gravity Forms icon font |
188 | - $field_icon = '<i class="gform-icon ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
189 | - } elseif( $has_dashicon ) { |
|
188 | + $field_icon = '<i class="gform-icon ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
189 | + } elseif ( $has_dashicon ) { |
|
190 | 190 | // Dashicon; prefix with "dashicons" |
191 | - $field_icon = '<i class="dashicons ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
191 | + $field_icon = '<i class="dashicons ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
192 | 192 | } else { |
193 | 193 | // Not dashicon icon |
194 | - $field_icon = '<i class="' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
194 | + $field_icon = '<i class="' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | $field_icon = $field_icon . ' '; |
198 | - } elseif( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
198 | + } elseif ( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
199 | 199 | $field_icon = '<i class="gv-icon gv-icon-level-down"></i>' . ' '; |
200 | 200 | } |
201 | 201 | |
@@ -222,19 +222,19 @@ discard block |
||
222 | 222 | |
223 | 223 | $output .= '</h5>'; |
224 | 224 | |
225 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
225 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
226 | 226 | |
227 | 227 | $container_class .= $nonexistent_form_field ? ' gv-nonexistent-form-field' : ''; |
228 | 228 | |
229 | - $container_class .= empty( $this->settings['show_as_link'] ) ? '' : ' has-single-entry-link'; |
|
229 | + $container_class .= empty( $this->settings[ 'show_as_link' ] ) ? '' : ' has-single-entry-link'; |
|
230 | 230 | |
231 | - $container_class .= empty( $this->settings['only_loggedin'] ) ? '' : ' has-custom-visibility'; |
|
231 | + $container_class .= empty( $this->settings[ 'only_loggedin' ] ) ? '' : ' has-custom-visibility'; |
|
232 | 232 | |
233 | - $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
233 | + $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
234 | 234 | |
235 | - $data_parent_label = ! empty( $this->item['parent'] ) ? ' data-parent-label="' . esc_attr( $this->item['parent']['label'] ) . '"' : ''; |
|
235 | + $data_parent_label = ! empty( $this->item[ 'parent' ] ) ? ' data-parent-label="' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . '"' : ''; |
|
236 | 236 | |
237 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
237 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
238 | 238 | |
239 | 239 | return $output; |
240 | 240 | } |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | |
253 | 253 | $icons = array( |
254 | 254 | 'show_as_link' => array( |
255 | - 'visible' => ( ! empty( $this->settings['show_as_link'] ) ), |
|
255 | + 'visible' => ( ! empty( $this->settings[ 'show_as_link' ] ) ), |
|
256 | 256 | 'title' => __( 'This field links to the Single Entry', 'gravityview' ), |
257 | 257 | 'css_class' => 'dashicons dashicons-media-default icon-link-to-single-entry', |
258 | 258 | ), |
259 | 259 | 'only_loggedin' => array( |
260 | - 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings['allow_edit_cap'] ) && 'read' !== $this->settings['allow_edit_cap'] ), |
|
260 | + 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings[ 'allow_edit_cap' ] ) && 'read' !== $this->settings[ 'allow_edit_cap' ] ), |
|
261 | 261 | 'title' => __( 'This field has modified visibility', 'gravityview' ), |
262 | 262 | 'css_class' => 'dashicons dashicons-lock icon-custom-visibility', |
263 | 263 | ), |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | * @param array $icons Array of icons to be shown, with `visible`, `title`, `css_class` keys. |
272 | 272 | * @param array $item_settings Settings for the current item (widget or field) |
273 | 273 | */ |
274 | - $icons = (array) apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
274 | + $icons = (array)apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
275 | 275 | |
276 | 276 | foreach ( $icons as $icon ) { |
277 | 277 | |
278 | - if ( empty( $icon['css_class'] ) || empty( $icon['title'] ) ) { |
|
278 | + if ( empty( $icon[ 'css_class' ] ) || empty( $icon[ 'title' ] ) ) { |
|
279 | 279 | continue; |
280 | 280 | } |
281 | 281 | |
282 | - $css_class = trim( $icon['css_class'] ); |
|
282 | + $css_class = trim( $icon[ 'css_class' ] ); |
|
283 | 283 | |
284 | - if ( empty( $icon['visible'] ) ) { |
|
284 | + if ( empty( $icon[ 'visible' ] ) ) { |
|
285 | 285 | $css_class .= ' hide-if-js'; |
286 | 286 | } |
287 | 287 | |
288 | - $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon['title'] ) . '"></span>'; |
|
288 | + $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon[ 'title' ] ) . '"></span>'; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $output; |
@@ -50,26 +50,26 @@ |
||
50 | 50 | |
51 | 51 | if ( ! empty( $quiz_fields ) ) { |
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | 'icon' => 'dashicons-forms', |
58 | 58 | ); |
59 | - $fields['gquiz_percent'] = array( |
|
59 | + $fields[ 'gquiz_percent' ] = array( |
|
60 | 60 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
61 | 61 | 'type' => 'quiz_percent', |
62 | 62 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
63 | 63 | 'icon' => 'dashicons-forms', |
64 | 64 | ); |
65 | - $fields['gquiz_grade'] = array( |
|
65 | + $fields[ 'gquiz_grade' ] = array( |
|
66 | 66 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
67 | 67 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
68 | 68 | 'type' => 'quiz_grade', |
69 | 69 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
70 | 70 | 'icon' => 'dashicons-forms', |
71 | 71 | ); |
72 | - $fields['gquiz_is_pass'] = array( |
|
72 | + $fields[ 'gquiz_is_pass' ] = array( |
|
73 | 73 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
74 | 74 | 'type' => 'quiz_is_pass', |
75 | 75 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
31 | 31 | |
32 | - if( 'edit' === $context ) { |
|
32 | + if ( 'edit' === $context ) { |
|
33 | 33 | return $field_options; |
34 | 34 | } |
35 | 35 | |
36 | - unset( $field_options['show_as_link'] ); |
|
36 | + unset( $field_options[ 'show_as_link' ] ); |
|
37 | 37 | |
38 | - $field_options['trim_words'] = array( |
|
38 | + $field_options[ 'trim_words' ] = array( |
|
39 | 39 | 'type' => 'number', |
40 | 40 | 'merge_tags' => false, |
41 | 41 | 'value' => null, |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
44 | 44 | ); |
45 | 45 | |
46 | - $field_options['make_clickable'] = array( |
|
46 | + $field_options[ 'make_clickable' ] = array( |
|
47 | 47 | 'type' => 'checkbox', |
48 | 48 | 'merge_tags' => false, |
49 | 49 | 'value' => 0, |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
52 | 52 | ); |
53 | 53 | |
54 | - $field_options['allow_html'] = array( |
|
54 | + $field_options[ 'allow_html' ] = array( |
|
55 | 55 | 'type' => 'checkbox', |
56 | 56 | 'merge_tags' => false, |
57 | 57 | 'value' => 1, |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | |
79 | 79 | $non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) ); |
80 | 80 | |
81 | - $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false); |
|
81 | + $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | foreach ( $modifiers as $passed_modifier ) { |
85 | 85 | |
86 | - foreach( $gv_modifiers as $gv_modifier => $method ) { |
|
86 | + foreach ( $gv_modifiers as $gv_modifier => $method ) { |
|
87 | 87 | |
88 | 88 | // Uses ^ to only match the first modifier, to enforce same order as passed by GF |
89 | 89 | preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private static function modifier_timestamp( $raw_value, $matches ) { |
134 | 134 | |
135 | - if( empty( $matches[0] ) ) { |
|
135 | + if ( empty( $matches[ 0 ] ) ) { |
|
136 | 136 | return $raw_value; |
137 | 137 | } |
138 | 138 | |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | */ |
162 | 162 | private static function modifier_maxwords( $raw_value, $matches, $field = null ) { |
163 | 163 | |
164 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
164 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
165 | 165 | return $raw_value; |
166 | 166 | } |
167 | 167 | |
168 | - $max = intval( $matches[1] ); |
|
168 | + $max = intval( $matches[ 1 ] ); |
|
169 | 169 | |
170 | 170 | $more_placeholder = '[GVMORE]'; |
171 | 171 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | private static function modifier_explode( $raw_value, $matches, $value, $field = null ) { |
235 | 235 | |
236 | 236 | // For JSON-encoded arrays |
237 | - if( $json_array = json_decode( $raw_value, true ) ) { |
|
237 | + if ( $json_array = json_decode( $raw_value, true ) ) { |
|
238 | 238 | return implode( ' ', $json_array ); |
239 | 239 | } |
240 | 240 | |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | */ |
256 | 256 | private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) { |
257 | 257 | |
258 | - if( empty( $matches[0] ) ) { |
|
258 | + if ( empty( $matches[ 0 ] ) ) { |
|
259 | 259 | return $raw_value; |
260 | 260 | } |
261 | 261 | |
262 | 262 | $return = $raw_value; |
263 | 263 | |
264 | - switch( $matches[0] ) { |
|
264 | + switch ( $matches[ 0 ] ) { |
|
265 | 265 | case 'urlencode': |
266 | 266 | $return = urlencode( $raw_value ); |
267 | 267 | break; |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | * @internal Fixed $form['title'] in Gravity Forms |
349 | 349 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
350 | 350 | */ |
351 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
352 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
353 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
351 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
352 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
353 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
354 | 354 | |
355 | 355 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data ); |
356 | 356 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | $site_url = get_site_url(); |
420 | 420 | |
421 | - if( $url_encode ) { |
|
421 | + if ( $url_encode ) { |
|
422 | 422 | $site_url = urlencode( $site_url ); |
423 | 423 | } |
424 | 424 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | // Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag? |
446 | 446 | preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER ); |
447 | 447 | |
448 | - if( empty( $matches ) ) { |
|
448 | + if ( empty( $matches ) ) { |
|
449 | 449 | return $original_text; |
450 | 450 | } |
451 | 451 | |
@@ -466,18 +466,18 @@ discard block |
||
466 | 466 | * } |
467 | 467 | */ |
468 | 468 | foreach ( $matches as $match ) { |
469 | - $full_tag = $match[0]; |
|
469 | + $full_tag = $match[ 0 ]; |
|
470 | 470 | |
471 | 471 | $link_args = array( |
472 | 472 | 'return' => 'url', |
473 | - 'entry_id' => $entry['id'], |
|
473 | + 'entry_id' => $entry[ 'id' ], |
|
474 | 474 | 'post_id' => \GV\Utils::get( $match, 1, null ), |
475 | 475 | 'action' => \GV\Utils::get( $match, 2, 'read' ), |
476 | 476 | ); |
477 | 477 | |
478 | 478 | $entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' ); |
479 | 479 | |
480 | - if( $url_encode ) { |
|
480 | + if ( $url_encode ) { |
|
481 | 481 | $entry_link = urlencode( $entry_link ); |
482 | 482 | } |
483 | 483 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
515 | 515 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
516 | 516 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
517 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
517 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
518 | 518 | ); |
519 | 519 | |
520 | 520 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -591,8 +591,8 @@ discard block |
||
591 | 591 | return $original_text; |
592 | 592 | } |
593 | 593 | |
594 | - foreach ( (array) $matches as $match ) { |
|
595 | - $full_tag = $match[0]; |
|
594 | + foreach ( (array)$matches as $match ) { |
|
595 | + $full_tag = $match[ 0 ]; |
|
596 | 596 | $modifier = \GV\Utils::get( $match, 2, 'permalink' ); |
597 | 597 | |
598 | 598 | $replacement = false; |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $replacement = esc_html( $replacement ); |
611 | 611 | } |
612 | 612 | |
613 | - if( $url_encode ) { |
|
613 | + if ( $url_encode ) { |
|
614 | 614 | $replacement = urlencode( $replacement ); |
615 | 615 | } |
616 | 616 | |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
651 | 651 | |
652 | 652 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
653 | - if( empty( $matches ) ) { |
|
653 | + if ( empty( $matches ) ) { |
|
654 | 654 | return $text; |
655 | 655 | } |
656 | 656 | |
657 | 657 | foreach ( $matches as $match ) { |
658 | 658 | |
659 | - $full_tag = $match[0]; |
|
660 | - $property = $match[1]; |
|
659 | + $full_tag = $match[ 0 ]; |
|
660 | + $property = $match[ 1 ]; |
|
661 | 661 | |
662 | 662 | $value = stripslashes_deep( \GV\Utils::_GET( $property ) ); |
663 | 663 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @since 1.15 |
682 | 682 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
683 | 683 | */ |
684 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
684 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
685 | 685 | |
686 | 686 | $value = $esc_html ? esc_html( $value ) : $value; |
687 | 687 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * @param[in] array $form Gravity Forms form array |
693 | 693 | * @param[in] array $entry Entry array |
694 | 694 | */ |
695 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
695 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
696 | 696 | |
697 | 697 | $text = str_replace( $full_tag, $value, $text ); |
698 | 698 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function register_noconflict( $items ) { |
55 | 55 | |
56 | - $items[] = 'gravityview-admin-installer'; |
|
56 | + $items[ ] = 'gravityview-admin-installer'; |
|
57 | 57 | |
58 | 58 | return $items; |
59 | 59 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | |
69 | 69 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
70 | 70 | |
71 | - if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
71 | + if ( ! $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
75 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
76 | 76 | foreach ( $downloads_data as $extension ) { |
77 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
77 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | - return (object) array( |
|
82 | - 'slug' => $extension['info']['slug'], |
|
83 | - 'name' => $extension['info']['title'], |
|
84 | - 'version' => $extension['licensing']['version'], |
|
85 | - 'download_link' => $extension['files'][0]['file'], |
|
81 | + return (object)array( |
|
82 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
83 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
84 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
85 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ( $all_plugins as $path => $plugin ) { |
151 | 151 | |
152 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
152 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | |
156 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
156 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
157 | 157 | 'path' => $path, |
158 | - 'version' => $plugin['Version'], |
|
158 | + 'version' => $plugin[ 'Version' ], |
|
159 | 159 | 'activated' => is_plugin_active( $path ) |
160 | 160 | ); |
161 | 161 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | |
210 | 210 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
211 | 211 | |
212 | - if ( $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
212 | + if ( $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
213 | 213 | return $downloads_data; |
214 | 214 | } |
215 | 215 | |
216 | - if( \GV\Plugin::is_network_activated() ) { |
|
216 | + if ( \GV\Plugin::is_network_activated() ) { |
|
217 | 217 | $home_url = network_home_url(); |
218 | 218 | } else { |
219 | 219 | $home_url = home_url(); |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | |
242 | 242 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
243 | 243 | |
244 | - if ( empty( $downloads_data['products'] ) ) { |
|
244 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
245 | 245 | return array(); |
246 | 246 | } |
247 | 247 | |
248 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
248 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
249 | 249 | |
250 | - return $downloads_data['products']; |
|
250 | + return $downloads_data[ 'products' ]; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | <h2><?php esc_html_e( 'The following plugins extend GravityView and Gravity Forms functionality:', 'gravityview' ); ?></h2> |
309 | 309 | |
310 | - <a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg(array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a> |
|
310 | + <a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg( array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a> |
|
311 | 311 | |
312 | 312 | <hr class="wp-header-end" /> |
313 | 313 | |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | |
325 | 325 | $this->render_section( 'extensions', esc_html__( 'GravityView Extensions', 'gravityview' ), $downloads_data, $wp_plugins ); |
326 | 326 | |
327 | - $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
327 | + $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
328 | 328 | |
329 | - $this->render_section( 'labs', esc_html__( 'GravityView Labs', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
329 | + $this->render_section( 'labs', esc_html__( 'GravityView Labs', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
330 | 330 | |
331 | - $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
331 | + $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
332 | 332 | ?> |
333 | 333 | </div> |
334 | 334 | </div> |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - if ( empty( $download['info'] ) ) { |
|
358 | + if ( empty( $download[ 'info' ] ) ) { |
|
359 | 359 | continue; |
360 | 360 | } |
361 | 361 | |
@@ -383,31 +383,31 @@ discard block |
||
383 | 383 | |
384 | 384 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
385 | 385 | |
386 | - $download_info = $details['download_info']; |
|
386 | + $download_info = $details[ 'download_info' ]; |
|
387 | 387 | |
388 | 388 | ?> |
389 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
389 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
390 | 390 | <div class="addon-inner"> |
391 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
392 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
391 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
392 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
393 | 393 | <div> |
394 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
395 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
396 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
394 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
395 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
396 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
397 | 397 | </div> |
398 | 398 | <?php } ?> |
399 | 399 | |
400 | - <?php if ( 'gravityview' !== $download_info['slug'] ) { ?> |
|
401 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
402 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
403 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
400 | + <?php if ( 'gravityview' !== $download_info[ 'slug' ] ) { ?> |
|
401 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
402 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
403 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
404 | 404 | </a> |
405 | 405 | <?php } ?> |
406 | 406 | </div> |
407 | 407 | |
408 | 408 | <div class="addon-excerpt"><?php |
409 | 409 | |
410 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
410 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
411 | 411 | |
412 | 412 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
413 | 413 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | */ |
450 | 450 | private function get_download_display_details( $download, $wp_plugins ) { |
451 | 451 | |
452 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
452 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
453 | 453 | 'thumbnail' => '', |
454 | 454 | 'title' => '', |
455 | 455 | 'textdomain' => '', |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | 'installer_excerpt' => null, // May not be defined |
462 | 462 | ) ); |
463 | 463 | |
464 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
464 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
465 | 465 | |
466 | - $has_access = ! empty( $download['files'] ); |
|
466 | + $has_access = ! empty( $download[ 'files' ] ); |
|
467 | 467 | $spinner = true; |
468 | 468 | $href = $plugin_path = '#'; |
469 | 469 | $status = $item_class = $button_title = $button_class = ''; |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
474 | 474 | |
475 | 475 | // The license is not active - no matter what level, this should not work |
476 | - if( ! $is_active && empty( $base_price ) ) { |
|
476 | + if ( ! $is_active && empty( $base_price ) ) { |
|
477 | 477 | $spinner = false; |
478 | 478 | $status_label = ''; |
479 | 479 | $button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license ); |
480 | - $href = $download_info['link']; |
|
480 | + $href = $download_info[ 'link' ]; |
|
481 | 481 | $button_class = 'button-primary'; |
482 | 482 | } |
483 | 483 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $status_label = ''; |
488 | 488 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
489 | 489 | $button_class = 'button-primary button-large'; |
490 | - $href = $download_info['link']; |
|
490 | + $href = $download_info[ 'link' ]; |
|
491 | 491 | $item_class = 'featured'; |
492 | 492 | } |
493 | 493 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
501 | 501 | } |
502 | 502 | |
503 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
503 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
504 | 504 | $spinner = false; |
505 | 505 | $status = 'notinstalled'; |
506 | 506 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | $href = add_query_arg( |
516 | 516 | array( |
517 | 517 | 'action' => 'install-plugin', |
518 | - 'plugin' => $download_info['slug'], |
|
519 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
518 | + 'plugin' => $download_info[ 'slug' ], |
|
519 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
520 | 520 | ), |
521 | 521 | self_admin_url( 'update.php' ) |
522 | 522 | ); |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | $status = 'inactive'; |
533 | 533 | $status_label = __( 'Inactive', 'gravityview' ); |
534 | 534 | $button_label = __( 'Activate', 'gravityview' ); |
535 | - $plugin_path = $wp_plugin['path']; |
|
535 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
536 | 536 | $button_class = 'button-secondary'; |
537 | 537 | } |
538 | 538 | // The plugin is installed and active |
539 | - elseif ( ! empty( $wp_plugin['path'] ) ) { |
|
540 | - $plugin_path = $wp_plugin['path']; |
|
539 | + elseif ( ! empty( $wp_plugin[ 'path' ] ) ) { |
|
540 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
541 | 541 | $status = 'active'; |
542 | 542 | $status_label = __( 'Active', 'gravityview' ); |
543 | 543 | $button_label = __( 'Deactivate', 'gravityview' ); |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | $href = add_query_arg( array( 'license_key' => $license_key ), $href ); |
551 | 551 | } |
552 | 552 | |
553 | - $download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] ); |
|
553 | + $download_info[ 'link' ] = add_query_arg( array( 'license_key' => $license_key ), $download_info[ 'link' ] ); |
|
554 | 554 | |
555 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
555 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -567,11 +567,11 @@ discard block |
||
567 | 567 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
568 | 568 | $base_price = \GFCommon::to_number( $base_price ); |
569 | 569 | |
570 | - unset( $download['pricing']['amount'] ); |
|
570 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
571 | 571 | |
572 | 572 | // Price options array, not single price |
573 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
574 | - $base_price = array_shift( $download['pricing'] ); |
|
573 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
574 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | return floatval( $base_price ); |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | public function activate_download() { |
586 | 586 | $data = \GV\Utils::_POST( 'data', array() ); |
587 | 587 | |
588 | - if ( empty( $data['path'] ) ) { |
|
588 | + if ( empty( $data[ 'path' ] ) ) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
592 | - $result = activate_plugin( $data['path'] ); |
|
592 | + $result = activate_plugin( $data[ 'path' ] ); |
|
593 | 593 | |
594 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
594 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
595 | 595 | wp_send_json_error( array( |
596 | 596 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
597 | 597 | ) ); |
@@ -608,13 +608,13 @@ discard block |
||
608 | 608 | public function deactivate_download() { |
609 | 609 | $data = \GV\Utils::_POST( 'data', array() ); |
610 | 610 | |
611 | - if ( empty( $data['path'] ) ) { |
|
611 | + if ( empty( $data[ 'path' ] ) ) { |
|
612 | 612 | return; |
613 | 613 | } |
614 | 614 | |
615 | - deactivate_plugins( $data['path'] ); |
|
615 | + deactivate_plugins( $data[ 'path' ] ); |
|
616 | 616 | |
617 | - if( is_plugin_active( $data['path'] ) ) { |
|
617 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
618 | 618 | wp_send_json_error( array( |
619 | 619 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
620 | 620 | ) ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
83 | 83 | */ |
84 | - foreach( $this->lead_db_columns as $column ) { |
|
84 | + foreach ( $this->lead_db_columns as $column ) { |
|
85 | 85 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
86 | 86 | } |
87 | 87 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
115 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
116 | 116 | |
117 | - $this->blacklist_add( $entry['form_id'] ); |
|
117 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function entry_updated( $form, $lead_id ) { |
129 | 129 | |
130 | - gravityview()->log->debug(' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) ); |
|
130 | + gravityview()->log->debug( ' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) ); |
|
131 | 131 | |
132 | - $this->blacklist_add( $form['id'] ); |
|
132 | + $this->blacklist_add( $form[ 'id' ] ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function entry_created( $entry, $form ) { |
146 | 146 | |
147 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
147 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
148 | 148 | |
149 | - $this->blacklist_add( $form['id'] ); |
|
149 | + $this->blacklist_add( $form[ 'id' ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
165 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
166 | 166 | |
167 | - $this->blacklist_add( $form['id'] ); |
|
167 | + $this->blacklist_add( $form[ 'id' ] ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // Normally just one form, but supports multiple forms |
184 | 184 | // |
185 | 185 | // Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14` |
186 | - $forms = 'f:' . implode( '-f:', (array) $form_ids ); |
|
186 | + $forms = 'f:' . implode( '-f:', (array)$form_ids ); |
|
187 | 187 | |
188 | 188 | // Prefix for transient keys |
189 | 189 | // Now the prefix would be: `gv-cache-f:12-f:5-f:14-` |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids ); |
236 | 236 | |
237 | 237 | // Add the passed form IDs |
238 | - $blacklist = array_merge( (array) $blacklist, $form_ids ); |
|
238 | + $blacklist = array_merge( (array)$blacklist, $form_ids ); |
|
239 | 239 | |
240 | 240 | // Don't duplicate |
241 | 241 | $blacklist = array_unique( $blacklist ); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
268 | 268 | |
269 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
269 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
270 | 270 | |
271 | 271 | gravityview()->log->debug( 'Removing form IDs from cache blacklist', array( 'data' => array( |
272 | 272 | '$form_ids' => $form_ids, |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | |
302 | - foreach ( (array) $form_ids as $form_id ) { |
|
302 | + foreach ( (array)$form_ids as $form_id ) { |
|
303 | 303 | |
304 | 304 | if ( in_array( $form_id, $blacklist ) ) { |
305 | 305 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
374 | 374 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
375 | 375 | */ |
376 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
376 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
377 | 377 | |
378 | 378 | gravityview()->log->debug( 'Setting cache with transient key {key} for {cache_time} seconds', array( 'key' => $this->key, 'cache_time' => $cache_time ) ); |
379 | 379 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | - foreach ( (array) $form_ids as $form_id ) { |
|
412 | + foreach ( (array)$form_ids as $form_id ) { |
|
413 | 413 | |
414 | 414 | $key = '_transient_gv-cache-'; |
415 | 415 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public function use_cache() { |
521 | 521 | |
522 | 522 | // Exit early if debugging (unless running PHPUnit) |
523 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
523 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
524 | 524 | return apply_filters( 'gravityview_use_cache', false, $this ); |
525 | 525 | } |
526 | 526 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
530 | 530 | |
531 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
531 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
532 | 532 | |
533 | 533 | gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' ); |
534 | 534 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | */ |
556 | 556 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
557 | 557 | |
558 | - return (boolean) $use_cache; |
|
558 | + return (boolean)$use_cache; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | } |