@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) { |
46 | 46 | |
47 | 47 | // No modifier was set or the raw value was empty |
48 | - if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
48 | + if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
49 | 49 | return $value; |
50 | 50 | } |
51 | 51 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | foreach ( $gv_modifiers as $gv_modifier => $method ) { |
62 | 62 | |
63 | 63 | // Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure |
64 | - preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches ); |
|
64 | + preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches ); |
|
65 | 65 | |
66 | - if( ! empty( $matches ) ) { |
|
66 | + if ( ! empty( $matches ) ) { |
|
67 | 67 | // The called method is passed the raw value and the full matches array |
68 | 68 | $return = self::$method( $raw_value, $matches ); |
69 | 69 | break; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private static function modifier_timestamp( $raw_value, $matches ) { |
89 | 89 | |
90 | - if( empty( $matches[0] ) ) { |
|
90 | + if ( empty( $matches[ 0 ] ) ) { |
|
91 | 91 | return $raw_value; |
92 | 92 | } |
93 | 93 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private static function modifier_wpautop( $raw_value, $matches ) { |
113 | 113 | |
114 | - if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) { |
|
114 | + if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) { |
|
115 | 115 | return $raw_value; |
116 | 116 | } |
117 | 117 | |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private static function modifier_maxwords( $raw_value, $matches ) { |
137 | 137 | |
138 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
138 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
139 | 139 | return $raw_value; |
140 | 140 | } |
141 | 141 | |
142 | - $max = intval( $matches[1] ); |
|
142 | + $max = intval( $matches[ 1 ] ); |
|
143 | 143 | |
144 | 144 | $more_placeholder = '[GVMORE]'; |
145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param bool $esc_html Pass return value through `esc_html()` |
172 | 172 | * @return string Text with variables maybe replaced |
173 | 173 | */ |
174 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
174 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | * @internal Reported to GF Support on 12/3 |
196 | 196 | * @internal Fixed in Gravity Forms |
197 | 197 | */ |
198 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
199 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
200 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
198 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
199 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
200 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
201 | 201 | |
202 | 202 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
203 | 203 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return mixed |
219 | 219 | */ |
220 | - public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
220 | + public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @see GFCommon::replace_variables_prepopulate() |
226 | 226 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
227 | 227 | */ |
228 | - if( false === $form ) { |
|
228 | + if ( false === $form ) { |
|
229 | 229 | return $text; |
230 | 230 | } |
231 | 231 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
258 | 258 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
259 | 259 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
260 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
260 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
261 | 261 | ); |
262 | 262 | |
263 | 263 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
321 | 321 | |
322 | 322 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
323 | - if( empty( $matches ) ) { |
|
323 | + if ( empty( $matches ) ) { |
|
324 | 324 | return $text; |
325 | 325 | } |
326 | 326 | |
327 | 327 | foreach ( $matches as $match ) { |
328 | 328 | |
329 | - $full_tag = $match[0]; |
|
330 | - $property = $match[1]; |
|
329 | + $full_tag = $match[ 0 ]; |
|
330 | + $property = $match[ 1 ]; |
|
331 | 331 | |
332 | 332 | $value = stripslashes_deep( rgget( $property ) ); |
333 | 333 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @since 1.15 |
352 | 352 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
353 | 353 | */ |
354 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
354 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
355 | 355 | |
356 | 356 | $value = $esc_html ? esc_html( $value ) : $value; |
357 | 357 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @param[in] array $form Gravity Forms form array |
363 | 363 | * @param[in] array $entry Entry array |
364 | 364 | */ |
365 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
365 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
366 | 366 | |
367 | 367 | $text = str_replace( $full_tag, $value, $text ); |
368 | 368 | } |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
55 | 55 | |
56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57 | 57 | |
58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
59 | 59 | |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | public function backend_actions() { |
69 | 69 | |
70 | 70 | /** @define "GRAVITYVIEW_DIR" "../" */ |
71 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
72 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
73 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
74 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
75 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
76 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
77 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
71 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
72 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
73 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
74 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
75 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
76 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
81 | 81 | * |
82 | 82 | * Nice place to insert extensions' backend stuff |
83 | 83 | */ |
84 | - do_action('gravityview_include_backend_actions'); |
|
84 | + do_action( 'gravityview_include_backend_actions' ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | |
98 | 98 | $actions = array(); |
99 | 99 | |
100 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
101 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
100 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
101 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
102 | 102 | } |
103 | 103 | |
104 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
105 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
104 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
105 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return array_merge( $actions, $links ); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // By default, there will only be one item being modified. |
131 | 131 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
132 | 132 | // of modified items that will override this array. |
133 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
133 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
134 | 134 | |
135 | 135 | // If we're starting fresh, a new form was created. |
136 | 136 | // We should let the user know this is the case. |
@@ -138,60 +138,60 @@ discard block |
||
138 | 138 | |
139 | 139 | $new_form_text = ''; |
140 | 140 | |
141 | - if( !empty( $start_fresh ) ) { |
|
141 | + if ( ! empty( $start_fresh ) ) { |
|
142 | 142 | |
143 | 143 | // Get the form that was created |
144 | 144 | $connected_form = gravityview_get_form_id( $post_id ); |
145 | 145 | |
146 | - if( !empty( $connected_form ) ) { |
|
146 | + if ( ! empty( $connected_form ) ) { |
|
147 | 147 | $form = gravityview_get_form( $connected_form ); |
148 | - $form_name = esc_attr( $form['title'] ); |
|
148 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
149 | 149 | $image = self::get_floaty(); |
150 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
151 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
150 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
151 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
152 | 152 | |
153 | 153 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
154 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
154 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
155 | 155 | $new_form_text = wpautop( $new_form_text ); |
156 | 156 | |
157 | 157 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - $messages['gravityview'] = array( |
|
161 | + $messages[ 'gravityview' ] = array( |
|
162 | 162 | 0 => '', // Unused. Messages start at index 1. |
163 | 163 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
164 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
164 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
165 | 165 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
166 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
166 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
167 | 167 | 3 => __( 'View deleted.', 'gravityview' ), |
168 | 168 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
169 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
169 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
170 | 170 | /* translators: %s: date and time of the revision */ |
171 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
171 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
173 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
173 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
174 | 174 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
175 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
176 | 176 | 8 => __( 'View submitted.', 'gravityview' ), |
177 | 177 | 9 => sprintf( |
178 | 178 | /* translators: Date and time the View is scheduled to be published */ |
179 | 179 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
180 | 180 | // translators: Publish box date format, see http://php.net/date |
181 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
181 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
182 | 182 | ) . $new_form_text, |
183 | 183 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
184 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
184 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * These apply to `bulk_post_updated_messages` |
188 | 188 | * @file wp-admin/edit.php |
189 | 189 | */ |
190 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
191 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
192 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
193 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
194 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
190 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
191 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
192 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
193 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
194 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | return $messages; |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | static function is_admin_page( $hook = '', $page = NULL ) { |
252 | 252 | global $current_screen, $plugin_page, $pagenow, $post; |
253 | 253 | |
254 | - if( ! is_admin() ) { return false; } |
|
254 | + if ( ! is_admin() ) { return false; } |
|
255 | 255 | |
256 | 256 | $is_page = false; |
257 | 257 | |
258 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
258 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
259 | 259 | |
260 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
260 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
261 | 261 | |
262 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
262 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
263 | 263 | |
264 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
265 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
266 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
264 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
265 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
266 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
267 | 267 | } else { |
268 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
268 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
269 | 269 | } |
270 | 270 | |
271 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
271 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
272 | 272 | |
273 | 273 | // $_GET `post_type` variable |
274 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
274 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
275 | 275 | $is_page = 'single'; |
276 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
276 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
277 | 277 | $is_page = 'settings'; |
278 | 278 | } else { |
279 | 279 | $is_page = 'views'; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
289 | 289 | |
290 | 290 | // If the current page is the same as the compared page |
291 | - if( !empty( $page ) ) { |
|
291 | + if ( ! empty( $page ) ) { |
|
292 | 292 | return $is_page === $page; |
293 | 293 | } |
294 | 294 | |
@@ -309,6 +309,6 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
311 | 311 | */ |
312 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
312 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
313 | 313 | return GravityView_Admin::is_admin_page( $hook, $page ); |
314 | 314 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return GV_License_Handler |
41 | 41 | */ |
42 | 42 | public static function get_instance( GravityView_Settings $GFAddOn ) { |
43 | - if( empty( self::$instance ) ) { |
|
43 | + if ( empty( self::$instance ) ) { |
|
44 | 44 | self::$instance = new self( $GFAddOn ); |
45 | 45 | } |
46 | 46 | return self::$instance; |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | public function refresh_license_status() { |
71 | 71 | |
72 | 72 | // Only perform on GravityView pages |
73 | - if( ! gravityview_is_admin_page() ) { |
|
73 | + if ( ! gravityview_is_admin_page() ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
77 | 77 | // The transient is fresh; don't fetch. |
78 | - if( $status = get_transient( self::status_transient_key ) ) { |
|
78 | + if ( $status = get_transient( self::status_transient_key ) ) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
@@ -100,37 +100,37 @@ discard block |
||
100 | 100 | $status = trim( $this->Addon->get_app_setting( 'license_key_status' ) ); |
101 | 101 | $key = trim( $this->Addon->get_app_setting( 'license_key' ) ); |
102 | 102 | |
103 | - if( !empty( $key ) ) { |
|
103 | + if ( ! empty( $key ) ) { |
|
104 | 104 | $response = $this->Addon->get_app_setting( 'license_key_response' ); |
105 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
105 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
106 | 106 | } else { |
107 | 107 | $response = array(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array( |
111 | 111 | 'license_box' => $this->get_license_message( $response ) |
112 | - )); |
|
112 | + ) ); |
|
113 | 113 | |
114 | 114 | |
115 | 115 | $fields = array( |
116 | 116 | array( |
117 | 117 | 'name' => 'edd-activate', |
118 | - 'value' => __('Activate License', 'gravityview'), |
|
119 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
118 | + 'value' => __( 'Activate License', 'gravityview' ), |
|
119 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
120 | 120 | 'data-edd_action' => 'activate_license', |
121 | 121 | 'class' => 'button-primary', |
122 | 122 | ), |
123 | 123 | array( |
124 | 124 | 'name' => 'edd-deactivate', |
125 | - 'value' => __('Deactivate License', 'gravityview'), |
|
126 | - 'data-pending_text' => __('Deactivating license…', 'gravityview'), |
|
125 | + 'value' => __( 'Deactivate License', 'gravityview' ), |
|
126 | + 'data-pending_text' => __( 'Deactivating license…', 'gravityview' ), |
|
127 | 127 | 'data-edd_action' => 'deactivate_license', |
128 | 128 | 'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ), |
129 | 129 | ), |
130 | 130 | array( |
131 | 131 | 'name' => 'edd-check', |
132 | - 'value' => __('Check License', 'gravityview'), |
|
133 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
132 | + 'value' => __( 'Check License', 'gravityview' ), |
|
133 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
134 | 134 | 'title' => 'Check the license before saving it', |
135 | 135 | 'data-edd_action' => 'check_license', |
136 | 136 | 'class' => 'button-secondary', |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | |
141 | 141 | $class = 'button gv-edd-action'; |
142 | 142 | |
143 | - $class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
143 | + $class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
144 | 144 | |
145 | 145 | $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
146 | 146 | |
147 | 147 | $submit = '<div class="gv-edd-button-wrapper">'; |
148 | 148 | foreach ( $fields as $field ) { |
149 | - $field['type'] = 'button'; |
|
150 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
151 | - $field['style'] = 'margin-left: 10px;'; |
|
152 | - if( $disabled_attribute ) { |
|
153 | - $field['disabled'] = $disabled_attribute; |
|
149 | + $field[ 'type' ] = 'button'; |
|
150 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
151 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
152 | + if ( $disabled_attribute ) { |
|
153 | + $field[ 'disabled' ] = $disabled_attribute; |
|
154 | 154 | } |
155 | 155 | $submit .= $this->Addon->settings_submit( $field, $echo ); |
156 | 156 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | */ |
167 | 167 | private function setup_edd() { |
168 | 168 | |
169 | - if( !class_exists('EDD_SL_Plugin_Updater') ) { |
|
170 | - require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php'); |
|
169 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
170 | + require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // setup the updater |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | 'url' => home_url(), |
205 | 205 | ); |
206 | 206 | |
207 | - if( !empty( $action ) ) { |
|
208 | - $settings['edd_action'] = esc_attr( $action ); |
|
207 | + if ( ! empty( $action ) ) { |
|
208 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $settings = array_map( 'urlencode', $settings ); |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | */ |
220 | 220 | private function _license_get_remote_response( $data, $license = '' ) { |
221 | 221 | |
222 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
222 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
223 | 223 | |
224 | 224 | $url = add_query_arg( $api_params, self::url ); |
225 | 225 | |
226 | 226 | $response = wp_remote_get( $url, array( |
227 | 227 | 'timeout' => 15, |
228 | 228 | 'sslverify' => false, |
229 | - )); |
|
229 | + ) ); |
|
230 | 230 | |
231 | 231 | if ( is_wp_error( $response ) ) { |
232 | 232 | return array(); |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | */ |
260 | 260 | function get_license_message( $license_data ) { |
261 | 261 | |
262 | - if( empty( $license_data ) ) { |
|
262 | + if ( empty( $license_data ) ) { |
|
263 | 263 | $message = ''; |
264 | 264 | } else { |
265 | 265 | |
266 | - if( ! empty( $license_data->error ) ) { |
|
266 | + if ( ! empty( $license_data->error ) ) { |
|
267 | 267 | $class = 'error'; |
268 | 268 | $string_key = $license_data->error; |
269 | 269 | } else { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $string_key = $license_data->license; |
272 | 272 | } |
273 | 273 | |
274 | - $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) ); |
|
274 | + $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) ); |
|
275 | 275 | |
276 | 276 | $message = $this->generate_license_box( $message, $class ); |
277 | 277 | } |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function license_details( $response = array() ) { |
310 | 310 | |
311 | - $response = (array) $response; |
|
311 | + $response = (array)$response; |
|
312 | 312 | |
313 | 313 | $return = ''; |
314 | 314 | $return .= '<span class="gv-license-details" aria-live="polite" aria-busy="false">'; |
315 | 315 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
316 | 316 | |
317 | - if( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
318 | - $return .= $this->strings( $response['license'], $response ); |
|
319 | - } elseif( ! empty( $response['license_name'] ) ) { |
|
317 | + if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
318 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
319 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
320 | 320 | |
321 | 321 | $response_keys = array( |
322 | 322 | 'license_name' => '', |
@@ -331,19 +331,19 @@ discard block |
||
331 | 331 | // Make sure all the keys are set |
332 | 332 | $response = wp_parse_args( $response, $response_keys ); |
333 | 333 | |
334 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
335 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
334 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
335 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
336 | 336 | $details = array( |
337 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
338 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'] ), esc_html__( $response['customer_email'] ) ) . $login_link, |
|
339 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
340 | - 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
341 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
337 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
338 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ] ), esc_html__( $response[ 'customer_email' ] ) ) . $login_link, |
|
339 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
340 | + 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
341 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
342 | 342 | ); |
343 | 343 | |
344 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
345 | - unset( $details['upgrade'] ); |
|
346 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
344 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
345 | + unset( $details[ 'upgrade' ] ); |
|
346 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | |
368 | 368 | $output = ''; |
369 | 369 | |
370 | - if( ! empty( $upgrades ) ) { |
|
370 | + if ( ! empty( $upgrades ) ) { |
|
371 | 371 | |
372 | 372 | $locale_parts = explode( '_', get_locale() ); |
373 | 373 | |
374 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
374 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
375 | 375 | |
376 | 376 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
377 | 377 | |
@@ -379,14 +379,14 @@ discard block |
||
379 | 379 | |
380 | 380 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
381 | 381 | |
382 | - $upgrade = (object) $upgrade; |
|
382 | + $upgrade = (object)$upgrade; |
|
383 | 383 | |
384 | 384 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
385 | 385 | |
386 | - if( $is_english && isset( $upgrade->description ) ) { |
|
386 | + if ( $is_english && isset( $upgrade->description ) ) { |
|
387 | 387 | $message = esc_html( $upgrade->description ); |
388 | 388 | } else { |
389 | - switch( $upgrade->price_id ) { |
|
389 | + switch ( $upgrade->price_id ) { |
|
390 | 390 | // Interstellar |
391 | 391 | case 1: |
392 | 392 | default: |
@@ -424,16 +424,16 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function license_call( $array = array() ) { |
426 | 426 | |
427 | - $is_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); |
|
428 | - $data = empty( $array ) ? $_POST['data'] : $array; |
|
427 | + $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
428 | + $data = empty( $array ) ? $_POST[ 'data' ] : $array; |
|
429 | 429 | $has_cap = GVCommon::has_cap( 'gravityview_edit_settings' ); |
430 | 430 | |
431 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
432 | - die( - 1 ); |
|
431 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
432 | + die( -1 ); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | // If the user isn't allowed to edit settings, show an error message |
436 | - if( ! $has_cap ) { |
|
436 | + if ( ! $has_cap ) { |
|
437 | 437 | $license_data = new stdClass(); |
438 | 438 | $license_data->error = 'capability'; |
439 | 439 | $license_data->message = $this->get_license_message( $license_data ); |
@@ -457,9 +457,9 @@ discard block |
||
457 | 457 | |
458 | 458 | $json = json_encode( $license_data ); |
459 | 459 | |
460 | - $update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) ); |
|
460 | + $update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) ); |
|
461 | 461 | |
462 | - $is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
462 | + $is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
463 | 463 | |
464 | 464 | // Failed is the response from trying to de-activate a license and it didn't work. |
465 | 465 | // This likely happened because people entered in a different key and clicked "Deactivate", |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | // most likely a mistake. |
468 | 468 | if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) { |
469 | 469 | |
470 | - if ( ! empty( $data['field_id'] ) ) { |
|
470 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
471 | 471 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
472 | 472 | } |
473 | 473 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | if ( $is_ajax ) { |
479 | 479 | exit( $json ); |
480 | 480 | } else { // Non-ajax call |
481 | - return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
|
481 | + return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json; |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | // Update option with passed data license |
493 | 493 | $settings = $this->Addon->get_app_settings(); |
494 | 494 | |
495 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
496 | - $settings['license_key_status'] = $license_data->license; |
|
497 | - $settings['license_key_response'] = (array)$license_data; |
|
495 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
496 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
497 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
498 | 498 | |
499 | 499 | $this->Addon->update_app_settings( $settings ); |
500 | 500 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | private function get_license_renewal_url( $license_data ) { |
509 | 509 | $license_data = is_array( $license_data ) ? (object)$license_data : $license_data; |
510 | - $renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
510 | + $renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
511 | 511 | return $renew_license_url; |
512 | 512 | } |
513 | 513 | |
@@ -522,31 +522,31 @@ discard block |
||
522 | 522 | |
523 | 523 | |
524 | 524 | $strings = array( |
525 | - 'status' => esc_html__('Status', 'gravityview'), |
|
526 | - 'error' => esc_html__('There was an error processing the request.', 'gravityview'), |
|
527 | - 'failed' => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'), |
|
528 | - 'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
529 | - 'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
530 | - 'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
531 | - 'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'), |
|
532 | - 'valid' => esc_html__('The license key is valid and active.', 'gravityview'), |
|
533 | - 'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'), |
|
534 | - 'missing' => esc_html__('Invalid license key.', 'gravityview'), |
|
535 | - 'revoked' => esc_html__('This license key has been revoked.', 'gravityview'), |
|
536 | - 'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
525 | + 'status' => esc_html__( 'Status', 'gravityview' ), |
|
526 | + 'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ), |
|
527 | + 'failed' => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ), |
|
528 | + 'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
529 | + 'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
530 | + 'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
531 | + 'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ), |
|
532 | + 'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ), |
|
533 | + 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
|
534 | + 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
|
535 | + 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
|
536 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
537 | 537 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
538 | 538 | |
539 | - 'verifying_license' => esc_html__('Verifying license…', 'gravityview'), |
|
540 | - 'activate_license' => esc_html__('Activate License', 'gravityview'), |
|
541 | - 'deactivate_license' => esc_html__('Deactivate License', 'gravityview'), |
|
542 | - 'check_license' => esc_html__('Verify License', 'gravityview'), |
|
539 | + 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
|
540 | + 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
|
541 | + 'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ), |
|
542 | + 'check_license' => esc_html__( 'Verify License', 'gravityview' ), |
|
543 | 543 | ); |
544 | 544 | |
545 | - if( empty( $status ) ) { |
|
545 | + if ( empty( $status ) ) { |
|
546 | 546 | return $strings; |
547 | 547 | } |
548 | 548 | |
549 | - if( isset( $strings[ $status ] ) ) { |
|
549 | + if ( isset( $strings[ $status ] ) ) { |
|
550 | 550 | return $strings[ $status ]; |
551 | 551 | } |
552 | 552 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - if( ! is_admin() ) { return; } |
|
21 | + if ( ! is_admin() ) { return; } |
|
22 | 22 | |
23 | 23 | $this->add_hooks(); |
24 | 24 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private function add_hooks() { |
34 | 34 | //Hooks for no-conflict functionality |
35 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
36 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
35 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
36 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
37 | 37 | |
38 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
39 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
40 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
41 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
38 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
39 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
40 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
41 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function no_conflict_scripts() { |
52 | 52 | global $wp_scripts; |
53 | 53 | |
54 | - if( ! gravityview_is_admin_page() ) { |
|
54 | + if ( ! gravityview_is_admin_page() ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
58 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
59 | 59 | |
60 | - if( empty( $no_conflict_mode ) ) { |
|
60 | + if ( empty( $no_conflict_mode ) ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -110,24 +110,24 @@ discard block |
||
110 | 110 | function no_conflict_styles() { |
111 | 111 | global $wp_styles; |
112 | 112 | |
113 | - if( ! gravityview_is_admin_page() ) { |
|
113 | + if ( ! gravityview_is_admin_page() ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Dequeue other jQuery styles even if no-conflict is off. |
118 | 118 | // Terrible-looking tabs help no one. |
119 | - if( !empty( $wp_styles->registered ) ) { |
|
120 | - foreach ($wp_styles->registered as $key => $style) { |
|
121 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
119 | + if ( ! empty( $wp_styles->registered ) ) { |
|
120 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
121 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
122 | 122 | wp_dequeue_style( $key ); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
127 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
128 | 128 | |
129 | 129 | // If no conflict is off, jQuery will suffice. |
130 | - if( empty( $no_conflict_mode ) ) { |
|
130 | + if ( empty( $no_conflict_mode ) ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
156 | 156 | */ |
157 | - do_action('gravityview_remove_conflicts_after'); |
|
157 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | |
179 | 179 | //reset queue |
180 | 180 | $queue = array(); |
181 | - foreach( $wp_objects->queue as $object ) { |
|
182 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
183 | - $queue[] = $object; |
|
181 | + foreach ( $wp_objects->queue as $object ) { |
|
182 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
183 | + $queue[ ] = $object; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | $wp_objects->queue = $queue; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | //unregistering scripts |
191 | 191 | $registered = array(); |
192 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
193 | - if( in_array( $handle, $required_objects ) ){ |
|
192 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
193 | + if ( in_array( $handle, $required_objects ) ) { |
|
194 | 194 | $registered[ $handle ] = $script_registration; |
195 | 195 | } |
196 | 196 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param array $registered [description] |
206 | 206 | * @param array $scripts [description] |
207 | 207 | */ |
208 | - private function add_script_dependencies($registered, $scripts) { |
|
208 | + private function add_script_dependencies( $registered, $scripts ) { |
|
209 | 209 | |
210 | 210 | //gets all dependent scripts linked to the $scripts array passed |
211 | 211 | do { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
215 | 215 | foreach ( $deps as $dep ) { |
216 | 216 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
217 | - $dependents[] = $dep; |
|
217 | + $dependents[ ] = $dep; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
@@ -19,12 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | 29 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
30 | 30 | </label> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'radio'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
15 | 15 | |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'checkbox'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Checkbox'; |
15 | 15 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | 41 | // It's not the parent field; it's an input |
42 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
42 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
43 | 43 | |
44 | - if( $this->is_choice_value_enabled() ) { |
|
45 | - $field_options['choice_display'] = array( |
|
44 | + if ( $this->is_choice_value_enabled() ) { |
|
45 | + $field_options[ 'choice_display' ] = array( |
|
46 | 46 | 'type' => 'radio', |
47 | 47 | 'value' => 'value', |
48 | 48 | 'class' => 'vertical', |
@@ -38,8 +38,8 @@ |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
111 | 111 | |
112 | - if( $this->_custom_merge_tag ) { |
|
112 | + if ( $this->_custom_merge_tag ) { |
|
113 | 113 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
114 | 114 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
133 | 133 | */ |
134 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
134 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @see GFCommon::replace_variables_prepopulate() |
140 | 140 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
141 | 141 | */ |
142 | - if( false === $form ) { |
|
142 | + if ( false === $form ) { |
|
143 | 143 | return $text; |
144 | 144 | } |
145 | 145 | |
@@ -172,19 +172,19 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
174 | 174 | |
175 | - foreach( $matches as $match ) { |
|
175 | + foreach ( $matches as $match ) { |
|
176 | 176 | |
177 | - $full_tag = $match[0]; |
|
177 | + $full_tag = $match[ 0 ]; |
|
178 | 178 | |
179 | 179 | // Strip the Merge Tags |
180 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
180 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
181 | 181 | |
182 | 182 | // Replace the value from the entry, if exists |
183 | - if( isset( $entry[ $tag ] ) ) { |
|
183 | + if ( isset( $entry[ $tag ] ) ) { |
|
184 | 184 | |
185 | 185 | $value = $entry[ $tag ]; |
186 | 186 | |
187 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
187 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
188 | 188 | $value = $this->get_content( $value ); |
189 | 189 | } |
190 | 190 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function _filter_sortable_fields( $not_sortable ) { |
259 | 259 | |
260 | - if( ! $this->is_sortable ) { |
|
261 | - $not_sortable[] = $this->name; |
|
260 | + if ( ! $this->is_sortable ) { |
|
261 | + $not_sortable[ ] = $this->name; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | return $not_sortable; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | 'date_display' => array( |
288 | 288 | 'type' => 'text', |
289 | 289 | 'label' => __( 'Override Date Format', 'gravityview' ), |
290 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
290 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
291 | 291 | /** |
292 | 292 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
293 | 293 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | $options = $this->field_support_options(); |
314 | 314 | |
315 | - if( isset( $options[ $key ] ) ) { |
|
315 | + if ( isset( $options[ $key ] ) ) { |
|
316 | 316 | $field_options[ $key ] = $options[ $key ]; |
317 | 317 | } |
318 | 318 | |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | $connected_form = rgpost( 'form_id' ); |
377 | 377 | |
378 | 378 | // Otherwise, get the Form ID from the Post page |
379 | - if( empty( $connected_form ) ) { |
|
379 | + if ( empty( $connected_form ) ) { |
|
380 | 380 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
381 | 381 | } |
382 | 382 | |
383 | - if( empty( $connected_form ) ) { |
|
383 | + if ( empty( $connected_form ) ) { |
|
384 | 384 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
385 | 385 | return false; |
386 | 386 | } |