@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
| 74 | 74 | |
| 75 | - if( false === $approved_result || false === $disapproved_result ) { |
|
| 75 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
| 76 | 76 | gravityview()->log->error( 'There was an error processing the query. {error}', array( 'error' => $wpdb->last_error ) ); |
| 77 | 77 | } else { |
| 78 | 78 | // All done: Meta values are migrated |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | $redux_settings = $this->get_redux_settings(); |
| 106 | 106 | |
| 107 | 107 | // No need to process |
| 108 | - if( false === $redux_settings ) { |
|
| 108 | + if ( false === $redux_settings ) { |
|
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
| 112 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
| 113 | 113 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | gravityview()->plugin->settings->update( $updated_settings ); |
| 124 | 124 | |
| 125 | 125 | // And now remove the previous option, so this is a one-time thing. |
| 126 | - delete_option('gravityview_settings'); |
|
| 127 | - delete_option('gravityview_settings-transients'); |
|
| 126 | + delete_option( 'gravityview_settings' ); |
|
| 127 | + delete_option( 'gravityview_settings-transients' ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $license_call = \GV\License_Handler::get()->license_call( $data ); |
| 149 | 149 | |
| 150 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
| 151 | - $redux_settings['license_key_status'] = $license_call->license; |
|
| 152 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
| 150 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
| 151 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
| 152 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $redux_settings; |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | function get_redux_settings() { |
| 164 | 164 | |
| 165 | 165 | // Previous settings set by Redux |
| 166 | - $redux_option = get_option('gravityview_settings'); |
|
| 166 | + $redux_option = get_option( 'gravityview_settings' ); |
|
| 167 | 167 | |
| 168 | 168 | // No Redux settings? Don't proceed. |
| 169 | - if( false === $redux_option ) { |
|
| 169 | + if ( false === $redux_option ) { |
|
| 170 | 170 | return false; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | if ( $license_array = \GV\Utils::get( $redux_option, 'license' ) ) { |
| 180 | 180 | |
| 181 | - $redux_settings['license_key'] = $license_key = \GV\Utils::get( $license_array, 'license' ); |
|
| 181 | + $redux_settings[ 'license_key' ] = $license_key = \GV\Utils::get( $license_array, 'license' ); |
|
| 182 | 182 | |
| 183 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
| 183 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
| 184 | 184 | |
| 185 | 185 | // This contains the last response for license validation |
| 186 | - if( !empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) { |
|
| 186 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = \GV\Utils::get( $redux_last_changed_values, 'changed_values' ) ) { |
|
| 187 | 187 | |
| 188 | 188 | $saved_license = \GV\Utils::get( $saved_values, 'license' ); |
| 189 | 189 | |
| 190 | 190 | // Only use the last-saved values if they are for the same license |
| 191 | - if( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) { |
|
| 192 | - $redux_settings['license_key_status'] = \GV\Utils::get( $saved_license, 'status' ); |
|
| 193 | - $redux_settings['license_key_response'] = \GV\Utils::get( $saved_license, 'response' ); |
|
| 191 | + if ( $saved_license && \GV\Utils::get( $saved_license, 'license' ) === $license_key ) { |
|
| 192 | + $redux_settings[ 'license_key_status' ] = \GV\Utils::get( $saved_license, 'status' ); |
|
| 193 | + $redux_settings[ 'license_key_response' ] = \GV\Utils::get( $saved_license, 'response' ); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | /** ---- Migrate from old search widget to new search widget ---- */ |
| 203 | 203 | function update_search_on_views() { |
| 204 | 204 | |
| 205 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
| 206 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
| 205 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
| 206 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // Loop through all the views |
@@ -215,20 +215,20 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $views = get_posts( $query_args ); |
| 217 | 217 | |
| 218 | - foreach( $views as $view ) { |
|
| 218 | + foreach ( $views as $view ) { |
|
| 219 | 219 | |
| 220 | 220 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
| 221 | 221 | $search_fields = null; |
| 222 | 222 | |
| 223 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
| 223 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
| 224 | 224 | |
| 225 | 225 | gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Loading View ID: {view_id}', array( 'view_id' => $view->ID ) ); |
| 226 | 226 | |
| 227 | - foreach( $widgets as $area => $ws ) { |
|
| 228 | - foreach( $ws as $k => $widget ) { |
|
| 229 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
| 227 | + foreach ( $widgets as $area => $ws ) { |
|
| 228 | + foreach ( $ws as $k => $widget ) { |
|
| 229 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
| 230 | 230 | |
| 231 | - if( is_null( $search_fields ) ) { |
|
| 231 | + if ( is_null( $search_fields ) ) { |
|
| 232 | 232 | $search_fields = $this->get_search_fields( $view->ID ); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -236,24 +236,24 @@ discard block |
||
| 236 | 236 | // [search_free] => 1 |
| 237 | 237 | // [search_date] => 1 |
| 238 | 238 | $search_generic = array(); |
| 239 | - if( !empty( $widget['search_free'] ) ) { |
|
| 240 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
| 239 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
| 240 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
| 241 | 241 | } |
| 242 | - if( !empty( $widget['search_date'] ) ) { |
|
| 243 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
| 242 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
| 243 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $search_config = array_merge( $search_generic, $search_fields ); |
| 247 | 247 | |
| 248 | 248 | // don't throw '[]' when json_encode an empty array |
| 249 | - if( empty( $search_config ) ) { |
|
| 249 | + if ( empty( $search_config ) ) { |
|
| 250 | 250 | $search_config = ''; |
| 251 | 251 | } else { |
| 252 | 252 | $search_config = json_encode( $search_config ); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
| 256 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
| 255 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
| 256 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
| 257 | 257 | |
| 258 | 258 | gravityview()->log->debug( '[GravityView_Migrate/update_search_on_views] Updated Widget: ', array( 'data' => $widgets[ $area ][ $k ] ) ); |
| 259 | 259 | } |
@@ -281,26 +281,26 @@ discard block |
||
| 281 | 281 | // check view fields' settings |
| 282 | 282 | $fields = gravityview_get_directory_fields( $view_id, false ); |
| 283 | 283 | |
| 284 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
| 284 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
| 285 | 285 | |
| 286 | - foreach( $fields as $t => $fs ) { |
|
| 286 | + foreach ( $fields as $t => $fs ) { |
|
| 287 | 287 | |
| 288 | - foreach( $fs as $k => $field ) { |
|
| 288 | + foreach ( $fs as $k => $field ) { |
|
| 289 | 289 | // is field a search_filter ? |
| 290 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
| 290 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
| 291 | 291 | |
| 292 | 292 | // get field type & calculate the input type (by default) |
| 293 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
| 293 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
| 294 | 294 | |
| 295 | - if( empty( $form_field['type'] ) ) { |
|
| 295 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
| 296 | 296 | continue; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // depending on the field type assign a group of possible search field types |
| 300 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
| 300 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
| 301 | 301 | |
| 302 | 302 | // add field to config |
| 303 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
| 303 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
| 304 | 304 | |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 50 | 50 | |
| 51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
| 51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
| 52 | 52 | |
| 53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
| 54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function no_views_text() { |
| 66 | 66 | |
| 67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
| 67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
| 68 | 68 | return __( 'No Views found in Trash', 'gravityview' ); |
| 69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
| 69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
| 70 | 70 | return __( 'No Views found.', 'gravityview' ); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $error ) { |
|
| 113 | + if ( $error ) { |
|
| 114 | 114 | ?> |
| 115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
| 116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | public function backend_actions() { |
| 130 | 130 | |
| 131 | 131 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
| 133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
| 134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
| 138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
| 139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
| 140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
| 141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
| 133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
| 134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
| 138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
| 139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
| 140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
| 141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
| 145 | 145 | * |
| 146 | 146 | * Nice place to insert extensions' backend stuff |
| 147 | 147 | */ |
| 148 | - do_action('gravityview_include_backend_actions'); |
|
| 148 | + do_action( 'gravityview_include_backend_actions' ); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $actions = array(); |
| 163 | 163 | |
| 164 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 164 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 168 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return array_merge( $actions, $links ); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // By default, there will only be one item being modified. |
| 195 | 195 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
| 196 | 196 | // of modified items that will override this array. |
| 197 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 197 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 198 | 198 | |
| 199 | 199 | // If we're starting fresh, a new form was created. |
| 200 | 200 | // We should let the user know this is the case. |
@@ -202,60 +202,60 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $new_form_text = ''; |
| 204 | 204 | |
| 205 | - if( !empty( $start_fresh ) ) { |
|
| 205 | + if ( ! empty( $start_fresh ) ) { |
|
| 206 | 206 | |
| 207 | 207 | // Get the form that was created |
| 208 | 208 | $connected_form = gravityview_get_form_id( $post_id ); |
| 209 | 209 | |
| 210 | - if( !empty( $connected_form ) ) { |
|
| 210 | + if ( ! empty( $connected_form ) ) { |
|
| 211 | 211 | $form = gravityview_get_form( $connected_form ); |
| 212 | - $form_name = esc_attr( $form['title'] ); |
|
| 212 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
| 213 | 213 | $image = self::get_floaty(); |
| 214 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
| 215 | - $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 |
|
| 214 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
| 215 | + $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 |
|
| 216 | 216 | |
| 217 | 217 | 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. |
| 218 | - ', '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>'); |
|
| 218 | + ', '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>' ); |
|
| 219 | 219 | $new_form_text = wpautop( $new_form_text ); |
| 220 | 220 | |
| 221 | 221 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $messages['gravityview'] = array( |
|
| 225 | + $messages[ 'gravityview' ] = array( |
|
| 226 | 226 | 0 => '', // Unused. Messages start at index 1. |
| 227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 228 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 228 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 229 | 229 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 230 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 230 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 231 | 231 | 3 => __( 'View deleted.', 'gravityview' ), |
| 232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 233 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 233 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 234 | 234 | /* translators: %s: date and time of the revision */ |
| 235 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 235 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
| 236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 237 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 237 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 238 | 238 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 239 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 239 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 240 | 240 | 8 => __( 'View submitted.', 'gravityview' ), |
| 241 | 241 | 9 => sprintf( |
| 242 | 242 | /* translators: Date and time the View is scheduled to be published */ |
| 243 | 243 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 244 | 244 | // translators: Publish box date format, see http://php.net/date |
| 245 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 245 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 246 | 246 | ) . $new_form_text, |
| 247 | 247 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 248 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 248 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * These apply to `bulk_post_updated_messages` |
| 252 | 252 | * @file wp-admin/edit.php |
| 253 | 253 | */ |
| 254 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
| 255 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
| 256 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
| 257 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
| 258 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
| 254 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
| 255 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
| 256 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
| 257 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
| 258 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | 261 | return $messages; |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | |
| 13 | 13 | $html_input_type = RGFormsModel::is_html5_enabled() ? 'search' : 'text'; |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <div class="gv-search-box gv-search-field-text gv-search-field-search_all"> |
| 17 | 17 | <div class="gv-search"> |
| 18 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 18 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 19 | 19 | <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 20 | 20 | <?php } ?> |
| 21 | 21 | <p><input type="<?php echo $html_input_type; ?>" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class="gv-search-box gv-search-field-entry_id"> |
| 15 | 15 | <div class="gv-search"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | 17 | <label for="gv_entry_id_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p><input type="text" name="gv_id" id="gv_entry_id_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | 17 | <label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p> |
| 20 | - <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>"> |
|
| 21 | - <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>"> |
|
| 20 | + <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>"> |
|
| 21 | + <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>"> |
|
| 22 | 22 | </p> |
| 23 | 23 | </div> |
| 24 | 24 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 12 | -$name = $gravityview_view->search_field['name']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | +$name = $gravityview_view->search_field[ 'name' ]; |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | - <label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | + <label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p> |
| 20 | - <input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>"> |
|
| 21 | - <input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>"> |
|
| 20 | + <input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>"> |
|
| 21 | + <input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>"> |
|
| 22 | 22 | </p> |
| 23 | 23 | </div> |
| 24 | 24 | \ No newline at end of file |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $args = array(); |
| 115 | 115 | |
| 116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
| 116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
| 117 | 117 | |
| 118 | 118 | $permalink = null; |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $view_collection = View_Collection::from_post( $post ); |
| 128 | 128 | |
| 129 | - if( 1 < $view_collection->count() ) { |
|
| 130 | - $args['gvid'] = $view_id; |
|
| 129 | + if ( 1 < $view_collection->count() ) { |
|
| 130 | + $args[ 'gvid' ] = $view_id; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | $link_parts = explode( '?', $permalink ); |
| 158 | 158 | |
| 159 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
| 159 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 160 | 160 | |
| 161 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
| 161 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
| 162 | 162 | } else { |
| 163 | 163 | $args[ $entry_endpoint_name ] = $entry_slug; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if ( $track_directory ) { |
| 167 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 168 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 167 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 168 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ( $sort = Utils::_GET( 'sort' ) ) { |
| 172 | - $args['sort'] = $sort; |
|
| 173 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
| 172 | + $args[ 'sort' ] = $sort; |
|
| 173 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 77 | 77 | |
| 78 | - $atts['action'] = 'edit'; |
|
| 78 | + $atts[ 'action' ] = 'edit'; |
|
| 79 | 79 | |
| 80 | 80 | return $this->shortcode( $atts, $content, $context ); |
| 81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 93 | 93 | |
| 94 | - $atts['action'] = 'delete'; |
|
| 94 | + $atts[ 'action' ] = 'delete'; |
|
| 95 | 95 | |
| 96 | 96 | return $this->shortcode( $atts, $content, $context ); |
| 97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
| 133 | 133 | |
| 134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
| 134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
| 135 | 135 | |
| 136 | 136 | if ( empty( $this->view_id ) ) { |
| 137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | return null; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
| 142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
| 143 | 143 | |
| 144 | 144 | if ( empty( $this->entry ) ) { |
| 145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
| 145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
| 146 | 146 | |
| 147 | 147 | return null; |
| 148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
| 151 | 151 | |
| 152 | 152 | if ( ! $this->has_cap() ) { |
| 153 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
| 153 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
| 154 | 154 | |
| 155 | 155 | return null; |
| 156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Get just the URL, not the tag |
| 167 | - if ( 'url' === $this->settings['return'] ) { |
|
| 167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
| 168 | 168 | return $url; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | private function get_link_atts() { |
| 187 | 187 | |
| 188 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
| 188 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
| 189 | 189 | |
| 190 | - if ( 'delete' === $this->settings['action'] ) { |
|
| 191 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 190 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
| 191 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return (array) $link_atts; |
|
| 194 | + return (array)$link_atts; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | return do_shortcode( $content ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - switch ( $this->settings['action'] ) { |
|
| 214 | + switch ( $this->settings[ 'action' ] ) { |
|
| 215 | 215 | case 'edit': |
| 216 | 216 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
| 217 | 217 | break; |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | private function get_url() { |
| 240 | 240 | |
| 241 | 241 | // if post_id is not defined, default to view_id |
| 242 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
| 242 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
| 243 | 243 | |
| 244 | - switch ( $this->settings['action'] ) { |
|
| 244 | + switch ( $this->settings[ 'action' ] ) { |
|
| 245 | 245 | case 'edit': |
| 246 | 246 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
| 247 | 247 | break; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function has_cap() { |
| 268 | 268 | |
| 269 | - switch ( $this->settings['action'] ) { |
|
| 269 | + switch ( $this->settings[ 'action' ] ) { |
|
| 270 | 270 | case 'edit': |
| 271 | 271 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
| 272 | 272 | break; |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | private function maybe_add_field_values_query_args( $url ) { |
| 333 | 333 | |
| 334 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
| 334 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
| 335 | 335 | |
| 336 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
| 336 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
| 337 | 337 | |
| 338 | 338 | $url = add_query_arg( $field_values, $url ); |
| 339 | 339 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | if ( ! empty( $action ) ) { |
| 103 | - $settings['edd_action'] = esc_attr( $action ); |
|
| 103 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return array_map( 'urlencode', $settings ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'format' => 'json', |
| 157 | 157 | ) ); |
| 158 | 158 | |
| 159 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
| 159 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
| 160 | 160 | die( -1 ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $json = json_encode( $license_data ); |
| 186 | 186 | |
| 187 | - $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action'); |
|
| 187 | + $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' ); |
|
| 188 | 188 | |
| 189 | 189 | $is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
| 190 | 190 | |
| 191 | 191 | if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) { |
| 192 | - do_action('gravityview/admin_installer/delete_downloads_data', true ); |
|
| 192 | + do_action( 'gravityview/admin_installer/delete_downloads_data', true ); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if ( $is_check_action_button ) { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | // most likely a mistake. |
| 202 | 202 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
| 203 | 203 | |
| 204 | - if ( ! empty( $data['field_id'] ) ) { |
|
| 204 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
| 205 | 205 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | if ( empty( $license_data ) ) { |
| 229 | 229 | $message = ''; |
| 230 | 230 | } else { |
| 231 | - if( ! empty( $license_data->error ) ) { |
|
| 231 | + if ( ! empty( $license_data->error ) ) { |
|
| 232 | 232 | $class = 'error'; |
| 233 | 233 | $string_key = $license_data->error; |
| 234 | 234 | } else { $class = $license_data->license; |
@@ -254,17 +254,17 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function license_details( $response = array() ) { |
| 256 | 256 | |
| 257 | - $response = (array) $response; |
|
| 257 | + $response = (array)$response; |
|
| 258 | 258 | |
| 259 | 259 | $return = ''; |
| 260 | 260 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
| 261 | 261 | |
| 262 | - if ( ! empty( $response['license_key'] ) ) { |
|
| 262 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
| 263 | 263 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
| 264 | 264 | |
| 265 | 265 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
| 266 | - $return .= $this->strings( $response['license'], $response ); |
|
| 267 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
| 266 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
| 267 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
| 268 | 268 | $response_keys = array( |
| 269 | 269 | 'license_name' => '', |
| 270 | 270 | 'license_limit' => '', |
@@ -278,19 +278,19 @@ discard block |
||
| 278 | 278 | // Make sure all the keys are set |
| 279 | 279 | $response = wp_parse_args( $response, $response_keys ); |
| 280 | 280 | |
| 281 | - $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' ) ); |
|
| 282 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 281 | + $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' ) ); |
|
| 282 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 283 | 283 | $details = array( |
| 284 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 285 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
| 286 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
| 287 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 288 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 284 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 285 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
| 286 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
| 287 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 288 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 292 | - unset( $details['upgrade'] ); |
|
| 293 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 291 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 292 | + unset( $details[ 'upgrade' ] ); |
|
| 293 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -316,20 +316,20 @@ discard block |
||
| 316 | 316 | if ( ! empty( $upgrades ) ) { |
| 317 | 317 | |
| 318 | 318 | $locale_parts = explode( '_', get_locale() ); |
| 319 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 319 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 320 | 320 | |
| 321 | 321 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 322 | 322 | $output .= '<ul class="ul-disc">'; |
| 323 | 323 | |
| 324 | 324 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 325 | - $upgrade = (object) $upgrade; |
|
| 325 | + $upgrade = (object)$upgrade; |
|
| 326 | 326 | |
| 327 | 327 | $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 ) ); |
| 328 | 328 | |
| 329 | 329 | if ( $is_english && isset( $upgrade->description ) ) { |
| 330 | 330 | $message = esc_html( $upgrade->description ); |
| 331 | 331 | } else { |
| 332 | - switch( $upgrade->price_id ) { |
|
| 332 | + switch ( $upgrade->price_id ) { |
|
| 333 | 333 | // Interstellar |
| 334 | 334 | case 1: |
| 335 | 335 | default: |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
| 389 | 389 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
| 390 | 390 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
| 391 | - '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>' ), |
|
| 391 | + '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>' ), |
|
| 392 | 392 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 393 | 393 | |
| 394 | 394 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | if ( ! empty( $license_data->renewal_url ) ) { |
| 419 | 419 | $renew_license_url = $license_data->renewal_url; |
| 420 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
| 420 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
| 421 | 421 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
| 422 | 422 | } else { |
| 423 | 423 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @return array|\WP_Error |
| 435 | 435 | */ |
| 436 | 436 | private function _license_get_remote_response( $data, $license = '' ) { |
| 437 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 437 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 438 | 438 | |
| 439 | 439 | $url = add_query_arg( $api_params, self::url ); |
| 440 | 440 | |
@@ -474,9 +474,9 @@ discard block |
||
| 474 | 474 | private function license_call_update_settings( $license_data, $data ) { |
| 475 | 475 | $settings = array(); |
| 476 | 476 | |
| 477 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 478 | - $settings['license_key_status'] = $license_data->license; |
|
| 479 | - $settings['license_key_response'] = (array)$license_data; |
|
| 477 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 478 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 479 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 480 | 480 | |
| 481 | 481 | $this->settings->set( $settings ); |
| 482 | 482 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | if ( ! empty( $key ) ) { |
| 493 | 493 | $response = $this->settings->get( 'license_key_response' ); |
| 494 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 494 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 495 | 495 | } else { |
| 496 | 496 | $response = array(); |
| 497 | 497 | } |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 535 | 535 | foreach ( $fields as $field ) { |
| 536 | - $field['type'] = 'button'; |
|
| 537 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 538 | - $field['style'] = 'margin-left: 10px;'; |
|
| 539 | - if( $disabled_attribute ) { |
|
| 540 | - $field['disabled'] = $disabled_attribute; |
|
| 536 | + $field[ 'type' ] = 'button'; |
|
| 537 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 538 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 539 | + if ( $disabled_attribute ) { |
|
| 540 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 541 | 541 | } |
| 542 | 542 | $submit .= $this->settings->as_html( $field, $echo ); |
| 543 | 543 | } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | 'url' => home_url(), |
| 617 | 617 | 'site_data' => $this->get_site_data(), |
| 618 | 618 | ), |
| 619 | - )); |
|
| 619 | + ) ); |
|
| 620 | 620 | |
| 621 | 621 | // make sure the response came back okay |
| 622 | 622 | if ( is_wp_error( $response ) ) { |
@@ -647,45 +647,45 @@ discard block |
||
| 647 | 647 | $theme_data = wp_get_theme(); |
| 648 | 648 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
| 649 | 649 | |
| 650 | - $data['gv_version'] = Plugin::$version; |
|
| 651 | - $data['php_version'] = phpversion(); |
|
| 652 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
| 653 | - $data['gf_version'] = \GFForms::$version; |
|
| 654 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 655 | - $data['multisite'] = is_multisite(); |
|
| 656 | - $data['theme'] = $theme; |
|
| 657 | - $data['url'] = home_url(); |
|
| 658 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
| 659 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
| 650 | + $data[ 'gv_version' ] = Plugin::$version; |
|
| 651 | + $data[ 'php_version' ] = phpversion(); |
|
| 652 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
| 653 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
| 654 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 655 | + $data[ 'multisite' ] = is_multisite(); |
|
| 656 | + $data[ 'theme' ] = $theme; |
|
| 657 | + $data[ 'url' ] = home_url(); |
|
| 658 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
| 659 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
| 660 | 660 | |
| 661 | 661 | // View Data |
| 662 | 662 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
| 663 | 663 | |
| 664 | - $data['view_count'] = null; |
|
| 665 | - $data['view_first'] = null; |
|
| 666 | - $data['view_latest'] = null; |
|
| 664 | + $data[ 'view_count' ] = null; |
|
| 665 | + $data[ 'view_first' ] = null; |
|
| 666 | + $data[ 'view_latest' ] = null; |
|
| 667 | 667 | |
| 668 | 668 | if ( $gravityview_posts->publish ) { |
| 669 | - $data['view_count'] = $gravityview_posts->publish; |
|
| 669 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
| 670 | 670 | |
| 671 | 671 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
| 672 | 672 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
| 673 | 673 | |
| 674 | 674 | if ( $first = array_shift( $first ) ) { |
| 675 | - $data['view_first'] = $first->post_date; |
|
| 675 | + $data[ 'view_first' ] = $first->post_date; |
|
| 676 | 676 | } |
| 677 | 677 | if ( $latest = array_pop( $latest ) ) { |
| 678 | - $data['view_latest'] = $latest->post_date; |
|
| 678 | + $data[ 'view_latest' ] = $latest->post_date; |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // Form counts |
| 683 | 683 | if ( class_exists( 'GFFormsModel' ) ) { |
| 684 | 684 | $form_data = \GFFormsModel::get_form_count(); |
| 685 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
| 686 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
| 687 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 688 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 685 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
| 686 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
| 687 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 688 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Retrieve current plugin information |
@@ -693,13 +693,13 @@ discard block |
||
| 693 | 693 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
| 697 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
| 698 | - $data['inactive_plugins'] = array(); |
|
| 699 | - $data['locale'] = get_locale(); |
|
| 696 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
| 697 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
| 698 | + $data[ 'inactive_plugins' ] = array(); |
|
| 699 | + $data[ 'locale' ] = get_locale(); |
|
| 700 | 700 | |
| 701 | 701 | // Validate request on the GV server |
| 702 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
| 702 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
| 703 | 703 | |
| 704 | 704 | return $data; |
| 705 | 705 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | |
| 730 | 730 | $plugin_data = get_plugin_data( $active_plugin ); |
| 731 | 731 | |
| 732 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
| 732 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if ( ! empty( $extensions ) ) { |