@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | ) ); |
116 | 116 | |
117 | 117 | // This is just HTML we don't need. |
118 | - unset( $response['message'] ); |
|
118 | + unset( $response[ 'message' ] ); |
|
119 | 119 | |
120 | - switch ( intval( $response['license_limit'] ) ) { |
|
120 | + switch ( intval( $response[ 'license_limit' ] ) ) { |
|
121 | 121 | case 1: |
122 | 122 | $package = 'Sol'; |
123 | 123 | break; |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | $package = 'Interstellar'; |
129 | 129 | break; |
130 | 130 | default: |
131 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
131 | + $package = sprintf( '%d-Site License', $response[ 'license_limit' ] ); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $data = array( |
135 | 135 | 'email' => GravityView_Settings::getSetting( 'support-email' ), |
136 | - 'name' => $response['customer_name'], |
|
137 | - 'Valid License?' => ucwords( $response['license'] ), |
|
138 | - 'License Key' => $response['license_key'], |
|
136 | + 'name' => $response[ 'customer_name' ], |
|
137 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
138 | + 'License Key' => $response[ 'license_key' ], |
|
139 | 139 | 'License Level' => $package, |
140 | 140 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
141 | 141 | 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
142 | - 'License Limit' => $response['license_limit'], |
|
143 | - 'Site Count' => $response['site_count'], |
|
144 | - 'License Expires' => $response['expires'], |
|
145 | - 'Activations Left' => $response['activations_left'], |
|
146 | - 'Payment ID' => $response['payment_id'], |
|
147 | - 'Payment Name' => $response['customer_name'], |
|
148 | - 'Payment Email' => $response['customer_email'], |
|
142 | + 'License Limit' => $response[ 'license_limit' ], |
|
143 | + 'Site Count' => $response[ 'site_count' ], |
|
144 | + 'License Expires' => $response[ 'expires' ], |
|
145 | + 'Activations Left' => $response[ 'activations_left' ], |
|
146 | + 'Payment ID' => $response[ 'payment_id' ], |
|
147 | + 'Payment Name' => $response[ 'customer_name' ], |
|
148 | + 'Payment Email' => $response[ 'customer_email' ], |
|
149 | 149 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
150 | 150 | 'PHP Version' => phpversion(), |
151 | 151 | 'GravityView Version' => GravityView_Plugin::version, |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | |
193 | 193 | $plugin_data = get_plugin_data( $active_plugin ); |
194 | 194 | |
195 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
195 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
196 | 196 | } |
197 | 197 | |
198 | - if( ! empty( $extensions ) ) { |
|
198 | + if ( ! empty( $extensions ) ) { |
|
199 | 199 | set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
200 | 200 | } else { |
201 | 201 | return 'There was an error fetching related plugins.'; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
12 | 12 | |
13 | 13 | // Add script to enable edit link |
14 | - add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') ); |
|
14 | + add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script' ) ); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function add_edit_script() { |
27 | 27 | |
28 | 28 | // We're on a single entry page, or at least not the Entries page. |
29 | - if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; } |
|
29 | + if ( ! empty( $_GET[ 'view' ] ) && $_GET[ 'view' ] !== 'entries' ) { return; } |
|
30 | 30 | ?> |
31 | 31 | <script> |
32 | 32 | jQuery( document ).ready( function( $ ) { |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | 'page' => 'gf_entries', |
57 | 57 | 'view' => 'entry', |
58 | 58 | 'id' => (int)$form_id, |
59 | - 'lid' => (int)$lead["id"], |
|
59 | + 'lid' => (int)$lead[ "id" ], |
|
60 | 60 | 'screen_mode' => 'edit', |
61 | 61 | ); |
62 | 62 | ?> |
63 | 63 | |
64 | 64 | <span class="edit edit_entry"> |
65 | 65 | | |
66 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
66 | + <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
67 | 67 | </span> |
68 | 68 | <?php |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @copydoc GravityView_Entry_Link_Shortcode::shortcode |
73 | 73 | */ |
74 | 74 | public function edit_shortcode( $atts, $content = null, $context = 'gv_edit_entry_link' ) { |
75 | - $atts['action'] = 'edit'; |
|
75 | + $atts[ 'action' ] = 'edit'; |
|
76 | 76 | |
77 | 77 | return $this->shortcode( $atts, $content, $context ); |
78 | 78 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @copydoc GravityView_Entry_Link_Shortcode::shortcode |
86 | 86 | */ |
87 | 87 | public function delete_shortcode( $atts, $content = null, $context = 'gv_delete_entry_link' ) { |
88 | - $atts['action'] = 'delete'; |
|
88 | + $atts[ 'action' ] = 'delete'; |
|
89 | 89 | |
90 | 90 | return $this->shortcode( $atts, $content, $context ); |
91 | 91 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
128 | 128 | |
129 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
129 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
130 | 130 | |
131 | 131 | if ( empty( $this->view_id ) ) { |
132 | 132 | do_action( 'gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View' ); |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | return null; |
135 | 135 | } |
136 | 136 | |
137 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
137 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
138 | 138 | |
139 | 139 | do_action( 'gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts ); |
140 | 140 | |
141 | 141 | if ( ! $this->has_cap() ) { |
142 | - do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings['action'] ) . ' this entry: ' . $this->entry['id'] ); |
|
142 | + do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings[ 'action' ] ) . ' this entry: ' . $this->entry[ 'id' ] ); |
|
143 | 143 | |
144 | 144 | return null; |
145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | // Get just the URL, not the tag |
156 | - if ( 'url' === $this->settings['return'] ) { |
|
156 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
157 | 157 | return $url; |
158 | 158 | } |
159 | 159 | |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | */ |
175 | 175 | private function get_link_atts() { |
176 | 176 | |
177 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
177 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
178 | 178 | |
179 | - if ( 'delete' === $this->settings['action'] ) { |
|
180 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
179 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
180 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
181 | 181 | } |
182 | 182 | |
183 | - return (array) $link_atts; |
|
183 | + return (array)$link_atts; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | return $content; |
201 | 201 | } |
202 | 202 | |
203 | - switch ( $this->settings['action'] ) { |
|
203 | + switch ( $this->settings[ 'action' ] ) { |
|
204 | 204 | case 'edit': |
205 | 205 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
206 | 206 | break; |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | private function get_url() { |
229 | 229 | |
230 | 230 | // if post_id is not defined, default to view_id |
231 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] ); |
|
231 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : absint( $this->settings[ 'post_id' ] ); |
|
232 | 232 | |
233 | - switch ( $this->settings['action'] ) { |
|
233 | + switch ( $this->settings[ 'action' ] ) { |
|
234 | 234 | case 'edit': |
235 | 235 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
236 | 236 | break; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | private function has_cap() { |
257 | 257 | |
258 | - switch ( $this->settings['action'] ) { |
|
258 | + switch ( $this->settings[ 'action' ] ) { |
|
259 | 259 | case 'edit': |
260 | 260 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
261 | 261 | break; |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | */ |
321 | 321 | private function maybe_add_field_values_query_args( $url ) { |
322 | 322 | |
323 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
323 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
324 | 324 | |
325 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
325 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
326 | 326 | |
327 | 327 | $url = add_query_arg( $field_values, $url ); |
328 | 328 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function load() { |
26 | 26 | |
27 | - if( !is_admin() ) { |
|
27 | + if ( ! is_admin() ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
39 | 39 | |
40 | 40 | // add tooltips |
41 | - add_filter( 'gravityview_tooltips', array( $this, 'tooltips') ); |
|
41 | + add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
|
42 | 42 | |
43 | 43 | // custom fields' options for zone EDIT |
44 | 44 | add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 5 ); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( $zone !== 'edit' ) { |
|
55 | + if ( $zone !== 'edit' ) { |
|
56 | 56 | |
57 | - $entry_default_fields['edit_link'] = array( |
|
58 | - 'label' => __('Edit Entry', 'gravityview'), |
|
57 | + $entry_default_fields[ 'edit_link' ] = array( |
|
58 | + 'label' => __( 'Edit Entry', 'gravityview' ), |
|
59 | 59 | 'type' => 'edit_link', |
60 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
60 | + 'desc' => __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ), |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | } |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | $caps = $visibility_caps; |
82 | 82 | |
83 | 83 | // If we're configuring fields in the edit context, we want a limited selection |
84 | - if( $context === 'edit' ) { |
|
84 | + if ( $context === 'edit' ) { |
|
85 | 85 | |
86 | 86 | // Remove other built-in caps. |
87 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
87 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
88 | 88 | |
89 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
89 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $caps; |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
105 | 105 | |
106 | 106 | // Always a link, never a filter |
107 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
107 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
108 | 108 | |
109 | 109 | // Edit Entry link should only appear to visitors capable of editing entries |
110 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
110 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
111 | 111 | |
112 | - $add_option['edit_link'] = array( |
|
112 | + $add_option[ 'edit_link' ] = array( |
|
113 | 113 | 'type' => 'text', |
114 | 114 | 'label' => __( 'Edit Link Text', 'gravityview' ), |
115 | 115 | 'desc' => NULL, |
116 | - 'value' => __('Edit Entry', 'gravityview'), |
|
116 | + 'value' => __( 'Edit Entry', 'gravityview' ), |
|
117 | 117 | 'merge_tags' => true, |
118 | 118 | ); |
119 | 119 | |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | |
130 | 130 | $return = $tooltips; |
131 | 131 | |
132 | - $return['allow_edit_cap'] = array( |
|
133 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
134 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
132 | + $return[ 'allow_edit_cap' ] = array( |
|
133 | + 'title' => __( 'Limiting Edit Access', 'gravityview' ), |
|
134 | + 'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ), |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | return $return; |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
150 | 150 | |
151 | 151 | // We only want to modify the settings for the edit context |
152 | - if( 'edit' !== $context ) { |
|
152 | + if ( 'edit' !== $context ) { |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @since 1.8.4 |
156 | 156 | */ |
157 | - $field_options['new_window'] = array( |
|
157 | + $field_options[ 'new_window' ] = array( |
|
158 | 158 | 'type' => 'checkbox', |
159 | 159 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
160 | 160 | 'value' => false, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Entry field is only for logged in users |
167 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
167 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
168 | 168 | |
169 | 169 | $add_options = array( |
170 | 170 | 'allow_edit_cap' => array( |
@@ -6,17 +6,17 @@ |
||
6 | 6 | ?><script type="text/javascript"> |
7 | 7 | |
8 | 8 | function DeleteFile(leadId, fieldId, deleteButton){ |
9 | - if(confirm('<?php echo esc_js( __("Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview') ); ?>')){ |
|
9 | + if(confirm('<?php echo esc_js( __( "Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview' ) ); ?>')){ |
|
10 | 10 | var fileIndex = jQuery(deleteButton).parent().index(); |
11 | - var mysack = new sack("<?php echo admin_url("admin-ajax.php")?>"); |
|
11 | + var mysack = new sack("<?php echo admin_url( "admin-ajax.php" )?>"); |
|
12 | 12 | mysack.execute = 1; |
13 | 13 | mysack.method = 'POST'; |
14 | 14 | mysack.setVar( "action", "rg_delete_file" ); |
15 | - mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce("rg_delete_file") ?>" ); |
|
15 | + mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce( "rg_delete_file" ) ?>" ); |
|
16 | 16 | mysack.setVar( "lead_id", leadId ); |
17 | 17 | mysack.setVar( "field_id", fieldId ); |
18 | 18 | mysack.setVar( "file_index", fileIndex ); |
19 | - mysack.onError = function() { alert('<?php echo esc_js(__('Ajax error while deleting field.', 'gravityview')) ?>' )}; |
|
19 | + mysack.onError = function() { alert('<?php echo esc_js( __( 'Ajax error while deleting field.', 'gravityview' ) ) ?>' )}; |
|
20 | 20 | mysack.runAJAX(); |
21 | 21 | |
22 | 22 | return true; |
@@ -7,13 +7,13 @@ |
||
7 | 7 | extract( $gravityview_view->getCurrentField() ); |
8 | 8 | |
9 | 9 | // Only show the link to logged-in users. |
10 | -if( !GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
10 | +if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
14 | -$link_text = empty( $field_settings['edit_link'] ) ? __('Edit Entry', 'gravityview') : $field_settings['edit_link']; |
|
14 | +$link_text = empty( $field_settings[ 'edit_link' ] ) ? __( 'Edit Entry', 'gravityview' ) : $field_settings[ 'edit_link' ]; |
|
15 | 15 | |
16 | -$link_atts = empty( $field_settings['new_window'] ) ? '' : 'target="_blank"'; |
|
16 | +$link_atts = empty( $field_settings[ 'new_window' ] ) ? '' : 'target="_blank"'; |
|
17 | 17 | |
18 | 18 | $output = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
19 | 19 |
@@ -7,11 +7,11 @@ |
||
7 | 7 | extract( $gravityview_view->getCurrentField() ); |
8 | 8 | |
9 | 9 | // Only show the link to logged-in users with the rigth caps. |
10 | -if( !GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
10 | +if ( ! GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
14 | -$link_text = empty( $field_settings['delete_link'] ) ? __('Delete Entry', 'gravityview') : $field_settings['delete_link']; |
|
14 | +$link_text = empty( $field_settings[ 'delete_link' ] ) ? __( 'Delete Entry', 'gravityview' ) : $field_settings[ 'delete_link' ]; |
|
15 | 15 | |
16 | 16 | $link_text = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
17 | 17 |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $redux_settings = $this->get_redux_settings(); |
52 | 52 | |
53 | 53 | // No need to process |
54 | - if( false === $redux_settings ) { |
|
54 | + if ( false === $redux_settings ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
58 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
59 | 59 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
60 | 60 | } |
61 | 61 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
70 | 70 | |
71 | 71 | // And now remove the previous option, so this is a one-time thing. |
72 | - delete_option('gravityview_settings'); |
|
73 | - delete_option('gravityview_settings-transients'); |
|
72 | + delete_option( 'gravityview_settings' ); |
|
73 | + delete_option( 'gravityview_settings-transients' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | |
87 | 87 | $data = array( |
88 | 88 | 'edd_action' => 'check_license', |
89 | - 'license' => rgget('license_key', $redux_settings ), |
|
89 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
90 | 90 | 'update' => false, |
91 | 91 | 'format' => 'object', |
92 | 92 | ); |
93 | 93 | |
94 | 94 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
95 | 95 | |
96 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | - $redux_settings['license_key_status'] = $license_call->license; |
|
98 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
96 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
98 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $redux_settings; |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | function get_redux_settings() { |
110 | 110 | |
111 | 111 | // Previous settings set by Redux |
112 | - $redux_option = get_option('gravityview_settings'); |
|
112 | + $redux_option = get_option( 'gravityview_settings' ); |
|
113 | 113 | |
114 | 114 | // No Redux settings? Don't proceed. |
115 | - if( false === $redux_option ) { |
|
115 | + if ( false === $redux_option ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -122,21 +122,21 @@ discard block |
||
122 | 122 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
123 | 123 | ); |
124 | 124 | |
125 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
125 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
126 | 126 | |
127 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
127 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
128 | 128 | |
129 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
129 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
130 | 130 | |
131 | 131 | // This contains the last response for license validation |
132 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
132 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
133 | 133 | |
134 | - $saved_license = rgget('license', $saved_values ); |
|
134 | + $saved_license = rgget( 'license', $saved_values ); |
|
135 | 135 | |
136 | 136 | // Only use the last-saved values if they are for the same license |
137 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
139 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
137 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
139 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | /** ---- Migrate from old search widget to new search widget ---- */ |
149 | 149 | function update_search_on_views() { |
150 | 150 | |
151 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
152 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
151 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
152 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Loop through all the views |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | $views = get_posts( $query_args ); |
163 | 163 | |
164 | - foreach( $views as $view ) { |
|
164 | + foreach ( $views as $view ) { |
|
165 | 165 | |
166 | 166 | $widgets = get_post_meta( $view->ID, '_gravityview_directory_widgets', true ); |
167 | 167 | $search_fields = null; |
168 | 168 | |
169 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
169 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
170 | 170 | |
171 | 171 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
172 | 172 | |
173 | - foreach( $widgets as $area => $ws ) { |
|
174 | - foreach( $ws as $k => $widget ) { |
|
175 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
173 | + foreach ( $widgets as $area => $ws ) { |
|
174 | + foreach ( $ws as $k => $widget ) { |
|
175 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
176 | 176 | |
177 | - if( is_null( $search_fields ) ) { |
|
177 | + if ( is_null( $search_fields ) ) { |
|
178 | 178 | $search_fields = $this->get_search_fields( $view->ID ); |
179 | 179 | } |
180 | 180 | |
@@ -182,24 +182,24 @@ discard block |
||
182 | 182 | // [search_free] => 1 |
183 | 183 | // [search_date] => 1 |
184 | 184 | $search_generic = array(); |
185 | - if( !empty( $widget['search_free'] ) ) { |
|
186 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
185 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
186 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
187 | 187 | } |
188 | - if( !empty( $widget['search_date'] ) ) { |
|
189 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
188 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
189 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $search_config = array_merge( $search_generic, $search_fields ); |
193 | 193 | |
194 | 194 | // don't throw '[]' when json_encode an empty array |
195 | - if( empty( $search_config ) ) { |
|
195 | + if ( empty( $search_config ) ) { |
|
196 | 196 | $search_config = ''; |
197 | 197 | } else { |
198 | 198 | $search_config = json_encode( $search_config ); |
199 | 199 | } |
200 | 200 | |
201 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
202 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
201 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
202 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
203 | 203 | |
204 | 204 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
205 | 205 | } |
@@ -227,26 +227,26 @@ discard block |
||
227 | 227 | // check view fields' settings |
228 | 228 | $fields = get_post_meta( $view_id, '_gravityview_directory_fields', true ); |
229 | 229 | |
230 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
230 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
231 | 231 | |
232 | - foreach( $fields as $t => $fs ) { |
|
232 | + foreach ( $fields as $t => $fs ) { |
|
233 | 233 | |
234 | - foreach( $fs as $k => $field ) { |
|
234 | + foreach ( $fs as $k => $field ) { |
|
235 | 235 | // is field a search_filter ? |
236 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
236 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
237 | 237 | |
238 | 238 | // get field type & calculate the input type (by default) |
239 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
239 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
240 | 240 | |
241 | - if( empty( $form_field['type'] ) ) { |
|
241 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // depending on the field type assign a group of possible search field types |
246 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
246 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
247 | 247 | |
248 | 248 | // add field to config |
249 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
249 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | static function getInstance() { |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | |
48 | 48 | self::$instance->initialize(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // Catch either |
95 | 95 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
96 | 96 | |
97 | - return '#'.$match_regex.'#i'; |
|
97 | + return '#' . $match_regex . '#i'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | $post_id = url_to_postid( $url ); |
115 | 115 | |
116 | - if( empty( $post_id ) ) { |
|
116 | + if ( empty( $post_id ) ) { |
|
117 | 117 | |
118 | 118 | $args = array( |
119 | 119 | 'post_status' => 'publish', |
120 | 120 | 'name' => $slug, |
121 | - 'post_type' => array('any', 'gravityview'), |
|
121 | + 'post_type' => array( 'any', 'gravityview' ), |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | $posts = get_posts( $args ); |
125 | 125 | |
126 | - if( !empty( $posts ) ) { |
|
127 | - $post_id = $posts[0]->ID; |
|
126 | + if ( ! empty( $posts ) ) { |
|
127 | + $post_id = $posts[ 0 ]->ID; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
158 | 158 | |
159 | 159 | // If not using permalinks, re-assign values for matching groups |
160 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
161 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
162 | - $matches['slug'] = $matches['slug2']; |
|
163 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
164 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
160 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
161 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
162 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
163 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
164 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // No Entry was found |
168 | - if( empty( $matches['entry_slug'] ) ) { |
|
168 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
169 | 169 | |
170 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
170 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
171 | 171 | |
172 | 172 | return ''; |
173 | 173 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | // Setup the data used |
178 | 178 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
179 | 179 | |
180 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
180 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
181 | 181 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
182 | 182 | } else { |
183 | 183 | |
184 | - if( $this->is_full_oembed_preview ) { |
|
184 | + if ( $this->is_full_oembed_preview ) { |
|
185 | 185 | $return .= $this->generate_preview_notice(); |
186 | 186 | } |
187 | 187 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | private function generate_preview_notice() { |
201 | 201 | $floaty = GravityView_Admin::get_floaty(); |
202 | 202 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
203 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
204 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
203 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
204 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
216 | 216 | |
217 | - $this->entry_id = $matches['entry_slug']; |
|
217 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
218 | 218 | |
219 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
219 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
220 | 220 | |
221 | 221 | // The URL didn't have the View Custom Post Type structure. |
222 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
222 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
223 | 223 | |
224 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
224 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
225 | 225 | |
226 | 226 | $this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
235 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
235 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | // Floaty the astronaut |
251 | 251 | $image = GravityView_Admin::get_floaty(); |
252 | 252 | |
253 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
253 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
254 | 254 | |
255 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
255 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
256 | 256 | |
257 | 257 | return ' |
258 | 258 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
259 | - <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
259 | + <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
260 | 260 | <p style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;"> |
261 | - '.$embed_text.' |
|
261 | + '.$embed_text . ' |
|
262 | 262 | </p> |
263 | 263 | <br style="clear: both;"> |
264 | 264 | </div>'; |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
314 | 314 | |
315 | 315 | // If it's already been parsed, don't re-output it. |
316 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
316 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
317 | 317 | return $this->output[ $this->entry_id ]; |
318 | 318 | } |
319 | 319 | |
320 | 320 | $entry_output = $this->generate_entry_output(); |
321 | 321 | |
322 | 322 | // Wrap a container div around the output to allow for custom styling |
323 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
323 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @var string $url The original URL that was matched by the regex. \n |
334 | 334 | * @var array $rawattr The original unmodified attributes. |
335 | 335 | */ |
336 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
336 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
337 | 337 | |
338 | 338 | unset( $entry_output ); |
339 | 339 |