@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | var $is_searchable = true; |
| 13 | 13 | |
| 14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 15 | 15 | |
| 16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | // Set the $_field_id var |
| 41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 42 | 42 | |
| 43 | - if( $this->is_choice_value_enabled() ) { |
|
| 44 | - $field_options['choice_display'] = array( |
|
| 43 | + if ( $this->is_choice_value_enabled() ) { |
|
| 44 | + $field_options[ 'choice_display' ] = array( |
|
| 45 | 45 | 'type' => 'radio', |
| 46 | 46 | 'value' => 'value', |
| 47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | // Set the $_field_id var |
| 45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 46 | 46 | |
| 47 | - if( $this->is_choice_value_enabled() ) { |
|
| 48 | - $field_options['choice_display'] = array( |
|
| 47 | + if ( $this->is_choice_value_enabled() ) { |
|
| 48 | + $field_options[ 'choice_display' ] = array( |
|
| 49 | 49 | 'type' => 'radio', |
| 50 | 50 | 'value' => 'value', |
| 51 | 51 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 26 | 26 | |
| 27 | - unset( $field_options['search_filter'] ); |
|
| 27 | + unset( $field_options[ 'search_filter' ] ); |
|
| 28 | 28 | |
| 29 | - if( 'edit' === $context ) { |
|
| 29 | + if ( 'edit' === $context ) { |
|
| 30 | 30 | return $field_options; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $add_options['link_to_file'] = array( |
|
| 33 | + $add_options[ 'link_to_file' ] = array( |
|
| 34 | 34 | 'type' => 'checkbox', |
| 35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 37 | 37 | 'value' => false, |
| 38 | 38 | 'merge_tags' => false, |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - $add_options['image_width'] = array( |
|
| 41 | + $add_options[ 'image_width' ] = array( |
|
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'label' => __( 'Custom Width:', 'gravityview' ), |
| 44 | 44 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | $base_id = null; |
| 128 | 128 | |
| 129 | 129 | $is_single = gravityview_get_context() === 'single'; |
| 130 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 130 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 131 | 131 | $field_compat = $gravityview_view->getCurrentField(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $output_arr = array(); |
| 135 | 135 | |
| 136 | 136 | // Get an array of file paths for the field. |
| 137 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 137 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 138 | 138 | |
| 139 | 139 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 140 | 140 | if ( ! is_array( $file_paths ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $rendered = null; |
| 154 | 154 | |
| 155 | 155 | // If the site is HTTPS, use HTTPS |
| 156 | - if ( function_exists('set_url_scheme') ) { |
|
| 156 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 157 | 157 | $file_path = set_url_scheme( $file_path ); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | $file_path_info = pathinfo( $file_path ); |
| 165 | 165 | |
| 166 | 166 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 167 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 168 | - $basename = $file_path_info['basename']; |
|
| 167 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 168 | + $basename = $file_path_info[ 'basename' ]; |
|
| 169 | 169 | |
| 170 | 170 | // Get the secure download URL |
| 171 | 171 | $is_secure = false; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 204 | 204 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 205 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 205 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 206 | 206 | ), $context ); |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 240 | 240 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 241 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 241 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 242 | 242 | ), $context ); |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 272 | 272 | $image_atts = array( |
| 273 | 273 | 'src' => $file_path, |
| 274 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 275 | - 'alt' => $field_settings['label'], |
|
| 276 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 274 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 275 | + 'alt' => $field_settings[ 'label' ], |
|
| 276 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 277 | 277 | ); |
| 278 | 278 | |
| 279 | 279 | if ( $is_secure ) { |
| 280 | - $image_atts['validate_src'] = false; |
|
| 280 | + $image_atts[ 'validate_src' ] = false; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $image = new GravityView_Image( $image_atts ); |
| 294 | 294 | |
| 295 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 295 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @filter `gravityview/fields/fileupload/allow_insecure_lightbox` Allow insecure links to be shown for the lighbox. |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | $override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context ); |
| 305 | 305 | |
| 306 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) { |
|
| 306 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) { |
|
| 307 | 307 | $lightbox_link_atts = array( |
| 308 | 308 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 309 | 309 | 'class' => 'thickbox', |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context ); |
| 313 | 313 | |
| 314 | 314 | if ( $override_security ) { |
| 315 | - $image_atts['src'] = $insecure_file_path; |
|
| 315 | + $image_atts[ 'src' ] = $insecure_file_path; |
|
| 316 | 316 | $image = new GravityView_Image( $image_atts ); |
| 317 | 317 | $file_path = $insecure_file_path; |
| 318 | 318 | // :( a kitten died somewhere |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | // Show as link should render the image regardless. |
| 327 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 327 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 328 | 328 | $text = $rendered; |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 342 | 342 | |
| 343 | 343 | // Output textualized content where |
| 344 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 344 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 345 | 345 | /** |
| 346 | 346 | * Modify the link text (defaults to the file name) |
| 347 | 347 | * |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 356 | 356 | |
| 357 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 357 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 358 | 358 | /** |
| 359 | 359 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 360 | 360 | * @param array|string $link_atts Array or attributes string |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $content = empty( $rendered ) ? $text : $rendered; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $output_arr[] = array( |
|
| 373 | + $output_arr[ ] = array( |
|
| 374 | 374 | 'file_path' => $file_path, |
| 375 | 375 | 'content' => $content |
| 376 | 376 | ); |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | $atts = apply_filters( 'gravityview/shortcodes/gventry/atts', $atts ); |
| 49 | 49 | |
| 50 | - $view = \GV\View::by_id( $atts['view_id'] ); |
|
| 50 | + $view = \GV\View::by_id( $atts[ 'view_id' ] ); |
|
| 51 | 51 | |
| 52 | 52 | if ( ! $view ) { |
| 53 | - gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts['view_id'] ) ); |
|
| 53 | + gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 54 | 54 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', null, null, $atts ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $entry_id = ! empty( $atts['entry_id'] ) ? $atts['entry_id'] : $atts['id']; |
|
| 57 | + $entry_id = ! empty( $atts[ 'entry_id' ] ) ? $atts[ 'entry_id' ] : $atts[ 'id' ]; |
|
| 58 | 58 | |
| 59 | - switch( $entry_id ): |
|
| 59 | + switch ( $entry_id ): |
|
| 60 | 60 | case 'last': |
| 61 | 61 | if ( class_exists( '\GF_Query' ) ) { |
| 62 | 62 | /** |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
| 66 | 66 | */ |
| 67 | 67 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
| 68 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
| 68 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
| 69 | 69 | /** |
| 70 | 70 | * Reverse existing sorts. |
| 71 | 71 | */ |
| 72 | - $sort = &$parameters['sorting']; |
|
| 73 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 72 | + $sort = &$parameters[ 'sorting' ]; |
|
| 73 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 74 | 74 | } else { |
| 75 | 75 | /** |
| 76 | 76 | * Otherwise, sort by date_created. |
| 77 | 77 | */ |
| 78 | - $parameters['sorting'] = array( |
|
| 78 | + $parameters[ 'sorting' ] = array( |
|
| 79 | 79 | 'key' => 'id', |
| 80 | 80 | 'direction' => 'ASC', |
| 81 | 81 | 'is_numeric' => true |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /** If a sort already exists, reverse it. */ |
| 92 | 92 | if ( $sort = end( $entries->sorts ) ) { |
| 93 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 93 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 94 | 94 | } else { |
| 95 | 95 | /** Otherwise, sort by date_created */ |
| 96 | 96 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | break; |
| 109 | 109 | default: |
| 110 | 110 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
| 111 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
| 111 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 112 | 112 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, null, $atts ); |
| 113 | 113 | } |
| 114 | 114 | endswitch; |
| 115 | 115 | |
| 116 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
| 116 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 117 | 117 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
| 118 | 118 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 119 | 119 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | return apply_filters( 'gravityview/shortcodes/gventry/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( ! $view->form ) { |
|
| 126 | + if ( ! $view->form ) { |
|
| 127 | 127 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -146,43 +146,43 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** Unapproved entries. */ |
| 149 | - if ( $entry['status'] != 'active' ) { |
|
| 149 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 150 | 150 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 151 | 151 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 154 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 155 | 155 | |
| 156 | 156 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 157 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 157 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 158 | 158 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 159 | 159 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( $atts['edit'] ) { |
|
| 163 | + if ( $atts[ 'edit' ] ) { |
|
| 164 | 164 | /** |
| 165 | 165 | * Based on code in our unit-tests. |
| 166 | 166 | * Mocks old context, etc. |
| 167 | 167 | */ |
| 168 | 168 | $loader = \GravityView_Edit_Entry::getInstance(); |
| 169 | - $render = $loader->instances['render']; |
|
| 169 | + $render = $loader->instances[ 'render' ]; |
|
| 170 | 170 | |
| 171 | 171 | add_filter( 'gravityview/is_single_entry', '__return_true' ); |
| 172 | 172 | |
| 173 | - $form = \GFAPI::get_form( $entry['form_id'] ); |
|
| 173 | + $form = \GFAPI::get_form( $entry[ 'form_id' ] ); |
|
| 174 | 174 | |
| 175 | 175 | $data = \GravityView_View_Data::getInstance( $view ); |
| 176 | 176 | $template = \GravityView_View::getInstance( array( |
| 177 | 177 | 'form' => $form, |
| 178 | - 'form_id' => $form['id'], |
|
| 178 | + 'form_id' => $form[ 'id' ], |
|
| 179 | 179 | 'view_id' => $view->ID, |
| 180 | 180 | 'entries' => array( $entry ), |
| 181 | 181 | 'atts' => \GVCommon::get_template_settings( $view->ID ), |
| 182 | 182 | ) ); |
| 183 | 183 | |
| 184 | - $_GET['edit'] = wp_create_nonce( |
|
| 185 | - \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form['id'], $entry['id'] ) |
|
| 184 | + $_GET[ 'edit' ] = wp_create_nonce( |
|
| 185 | + \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form[ 'id' ], $entry[ 'id' ] ) |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | add_filter( 'gravityview/edit_entry/success', $callback = function( $message ) use ( $view, $entry, $atts ) { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return apply_filters( 'gravityview/shortcodes/gventry/edit/success', $message, $view, $entry, $atts ); |
| 200 | 200 | } ); |
| 201 | 201 | |
| 202 | - ob_start() && $render->init( $data, \GV\Entry::by_id( $entry['id'] ), $view ); |
|
| 202 | + ob_start() && $render->init( $data, \GV\Entry::by_id( $entry[ 'id' ] ), $view ); |
|
| 203 | 203 | $output = ob_get_clean(); // Render :) |
| 204 | 204 | |
| 205 | 205 | remove_filter( 'gravityview/is_single_entry', '__return_true' ); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $renderer = new \GV\Entry_Renderer(); |
| 212 | 212 | |
| 213 | 213 | $request = new \GV\Mock_Request(); |
| 214 | - $request->returns['is_entry'] = $entry; |
|
| 214 | + $request->returns[ 'is_entry' ] = $entry; |
|
| 215 | 215 | |
| 216 | 216 | $output = $renderer->render( $entry, $view, $request ); |
| 217 | 217 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | parent::add_hooks(); |
| 44 | 44 | |
| 45 | - add_shortcode( 'gv_pageviews', array( $this, 'pageviews') ); |
|
| 45 | + add_shortcode( 'gv_pageviews', array( $this, 'pageviews' ) ); |
|
| 46 | 46 | |
| 47 | 47 | add_filter( 'gravityview/fields/custom/decode_shortcodes', array( $this, 'inject_entry_id' ), 10, 3 ); |
| 48 | 48 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * Used as sort of an action via the gravityview/fields/custom/decode_shortcodes filter. |
| 69 | 69 | */ |
| 70 | 70 | public function inject_entry_id( $r, $content, $context ) { |
| 71 | - if ( ! empty( $context->entry['id'] ) ) { |
|
| 72 | - $this->next_id = $context->entry['id']; |
|
| 71 | + if ( ! empty( $context->entry[ 'id' ] ) ) { |
|
| 72 | + $this->next_id = $context->entry[ 'id' ]; |
|
| 73 | 73 | } else { |
| 74 | 74 | $this->next_id = false; // Nothing to look at, move along |
| 75 | 75 | } |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | 'id' => $this->next_id, |
| 98 | 98 | ), $atts ); |
| 99 | 99 | |
| 100 | - if ( ! $this->atts['id'] ) { |
|
| 100 | + if ( ! $this->atts[ 'id' ] ) { |
|
| 101 | 101 | return; // The ID was not set |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | add_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) ); |
| 105 | 105 | |
| 106 | - $output = Pageviews::placeholder( 'GV' . $this->atts['id'] ); // Prefix the ID to avoid collissions with default post IDs |
|
| 106 | + $output = Pageviews::placeholder( 'GV' . $this->atts[ 'id' ] ); // Prefix the ID to avoid collissions with default post IDs |
|
| 107 | 107 | |
| 108 | 108 | remove_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) ); |
| 109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * Set the preload text. |
| 115 | 115 | */ |
| 116 | 116 | public function preload_callback( $preload ) { |
| 117 | - return $this->atts['preload']; |
|
| 117 | + return $this->atts[ 'preload' ]; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function increment_callback() { |
| 124 | 124 | if ( $entry = gravityview()->request->is_entry() ) { |
| 125 | - $increment = 'GV' . $entry['id']; |
|
| 125 | + $increment = 'GV' . $entry[ 'id' ]; |
|
| 126 | 126 | ?> |
| 127 | 127 | _pv_config.incr = <?php echo json_encode( $increment ); ?>; |
| 128 | 128 | <?php |
@@ -60,28 +60,28 @@ discard block |
||
| 60 | 60 | if ( $object->show_previous_button ) { |
| 61 | 61 | $previous_tabindex = GFCommon::get_tabindex(); |
| 62 | 62 | ?> |
| 63 | - <input id="gform_previous_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $labels['previous'] ); ?>" name="save" /> |
|
| 63 | + <input id="gform_previous_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $labels[ 'previous' ] ); ?>" name="save" /> |
|
| 64 | 64 | <?php |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if ( $object->show_next_button ) { |
| 68 | - $next_tabindex = GFCommon::get_tabindex(); |
|
| 68 | + $next_tabindex = GFCommon::get_tabindex(); |
|
| 69 | 69 | ?> |
| 70 | - <input id="gform_next_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $labels['next'] ); ?>" name="save" /> |
|
| 70 | + <input id="gform_next_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $labels[ 'next' ] ); ?>" name="save" /> |
|
| 71 | 71 | <?php |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if ( $object->show_update_button ) { |
| 75 | - $update_tabindex = GFCommon::get_tabindex(); |
|
| 75 | + $update_tabindex = GFCommon::get_tabindex(); |
|
| 76 | 76 | ?> |
| 77 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
| 77 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
| 78 | 78 | <?php |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $cancel_tabindex = GFCommon::get_tabindex(); |
|
| 81 | + $cancel_tabindex = GFCommon::get_tabindex(); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | - <a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
| 84 | + <a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
| 85 | 85 | <?php |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -97,5 +97,5 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | ?> |
| 99 | 99 | <input type="hidden" name="action" value="update" /> |
| 100 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
| 100 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
| 101 | 101 | </div> |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return self::$instance; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function shortcode( $atts, $content = '', $tag = '') { |
|
| 20 | + public function shortcode( $atts, $content = '', $tag = '' ) { |
|
| 21 | 21 | $shortcode = new \GV\Shortcodes\gvlogic(); |
| 22 | 22 | return $shortcode->callback( $atts, $content, $tag ); |
| 23 | 23 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function __destruct() { |
| 95 | - remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );; |
|
| 95 | + remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -175,59 +175,59 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ( $is_view && $post ) { |
| 177 | 177 | if ( $field_type ) { |
| 178 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 178 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 188 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** Field-specific */ |
| 195 | 195 | if ( $field_id && $form_id ) { |
| 196 | 196 | |
| 197 | 197 | if ( $field_id ) { |
| 198 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 198 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 200 | 200 | |
| 201 | 201 | if ( $view_id ) { |
| 202 | - $specifics []= sprintf( '%sview-%d-field-%d.php', $slug_dir, $view_id, $field_id ); |
|
| 202 | + $specifics [ ] = sprintf( '%sview-%d-field-%d.php', $slug_dir, $view_id, $field_id ); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if ( $field_type ) { |
| 207 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 208 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 209 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 210 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 211 | - |
|
| 212 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 213 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 214 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 215 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 216 | - |
|
| 217 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 218 | - $inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 219 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 220 | - $inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 207 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 208 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 209 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 210 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 211 | + |
|
| 212 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 213 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 214 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 215 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 216 | + |
|
| 217 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 218 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 219 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 220 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if ( $form_id ) { |
| 225 | 225 | /** Generic field templates */ |
| 226 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 227 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 226 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 227 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 228 | 228 | |
| 229 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 230 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 229 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 230 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | * Ignore some types that conflict. |
| 236 | 236 | */ |
| 237 | 237 | if ( ! in_array( $field_type, array( 'notes' ) ) ) { |
| 238 | - $specifics []= sprintf( '%s.php', $field_type ); |
|
| 239 | - $specifics []= sprintf( 'fields/%s.php', $field_type ); |
|
| 238 | + $specifics [ ] = sprintf( '%s.php', $field_type ); |
|
| 239 | + $specifics [ ] = sprintf( 'fields/%s.php', $field_type ); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 243 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
| 242 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 243 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
| 244 | 244 | |
| 245 | 245 | return array_merge( $specifics, $templates ); |
| 246 | 246 | }; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** Prevent any PHP warnings that may be generated. */ |
| 275 | 275 | ob_start(); |
| 276 | 276 | |
| 277 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry['currency'], false, 'html' ); |
|
| 277 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry[ 'currency' ], false, 'html' ); |
|
| 278 | 278 | |
| 279 | 279 | if ( $errors = ob_get_clean() ) { |
| 280 | 280 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |
@@ -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,21 +278,21 @@ 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>' : '' ); |
|
| 283 | - $license_limit = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit']; |
|
| 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 | + $license_limit = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ]; |
|
| 284 | 284 | |
| 285 | - $details = array( |
|
| 286 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 287 | - '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, |
|
| 288 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $license_limit ) ) . $local_text, |
|
| 289 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 290 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 285 | + $details = array( |
|
| 286 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 287 | + '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, |
|
| 288 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $license_limit ) ) . $local_text, |
|
| 289 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 290 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 294 | - unset( $details['upgrade'] ); |
|
| 295 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 293 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 294 | + unset( $details[ 'upgrade' ] ); |
|
| 295 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -318,20 +318,20 @@ discard block |
||
| 318 | 318 | if ( ! empty( $upgrades ) ) { |
| 319 | 319 | |
| 320 | 320 | $locale_parts = explode( '_', get_locale() ); |
| 321 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 321 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 322 | 322 | |
| 323 | 323 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 324 | 324 | $output .= '<ul class="ul-disc">'; |
| 325 | 325 | |
| 326 | 326 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 327 | - $upgrade = (object) $upgrade; |
|
| 327 | + $upgrade = (object)$upgrade; |
|
| 328 | 328 | |
| 329 | 329 | $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 ) ); |
| 330 | 330 | |
| 331 | 331 | if ( $is_english && isset( $upgrade->description ) ) { |
| 332 | 332 | $message = esc_html( $upgrade->description ); |
| 333 | 333 | } else { |
| 334 | - switch( $upgrade->price_id ) { |
|
| 334 | + switch ( $upgrade->price_id ) { |
|
| 335 | 335 | // Interstellar |
| 336 | 336 | case 1: |
| 337 | 337 | default: |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
| 391 | 391 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
| 392 | 392 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
| 393 | - '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>' ), |
|
| 393 | + '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>' ), |
|
| 394 | 394 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 395 | 395 | |
| 396 | 396 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | if ( ! empty( $license_data->renewal_url ) ) { |
| 421 | 421 | $renew_license_url = $license_data->renewal_url; |
| 422 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
| 422 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
| 423 | 423 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
| 424 | 424 | } else { |
| 425 | 425 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * @return array|\WP_Error |
| 437 | 437 | */ |
| 438 | 438 | private function _license_get_remote_response( $data, $license = '' ) { |
| 439 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 439 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 440 | 440 | |
| 441 | 441 | $url = add_query_arg( $api_params, self::url ); |
| 442 | 442 | |
@@ -476,9 +476,9 @@ discard block |
||
| 476 | 476 | private function license_call_update_settings( $license_data, $data ) { |
| 477 | 477 | $settings = array(); |
| 478 | 478 | |
| 479 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 480 | - $settings['license_key_status'] = $license_data->license; |
|
| 481 | - $settings['license_key_response'] = (array)$license_data; |
|
| 479 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 480 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 481 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 482 | 482 | |
| 483 | 483 | $this->settings->set( $settings ); |
| 484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | if ( ! empty( $key ) ) { |
| 495 | 495 | $response = $this->settings->get( 'license_key_response' ); |
| 496 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 496 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 497 | 497 | } else { |
| 498 | 498 | $response = array(); |
| 499 | 499 | } |
@@ -535,11 +535,11 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 537 | 537 | foreach ( $fields as $field ) { |
| 538 | - $field['type'] = 'button'; |
|
| 539 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 540 | - $field['style'] = 'margin-left: 10px;'; |
|
| 541 | - if( $disabled_attribute ) { |
|
| 542 | - $field['disabled'] = $disabled_attribute; |
|
| 538 | + $field[ 'type' ] = 'button'; |
|
| 539 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 540 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 541 | + if ( $disabled_attribute ) { |
|
| 542 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 543 | 543 | } |
| 544 | 544 | $submit .= $this->settings->as_html( $field, $echo ); |
| 545 | 545 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | 'url' => home_url(), |
| 619 | 619 | 'site_data' => $this->get_site_data(), |
| 620 | 620 | ), |
| 621 | - )); |
|
| 621 | + ) ); |
|
| 622 | 622 | |
| 623 | 623 | // make sure the response came back okay |
| 624 | 624 | if ( is_wp_error( $response ) ) { |
@@ -649,45 +649,45 @@ discard block |
||
| 649 | 649 | $theme_data = wp_get_theme(); |
| 650 | 650 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
| 651 | 651 | |
| 652 | - $data['gv_version'] = Plugin::$version; |
|
| 653 | - $data['php_version'] = phpversion(); |
|
| 654 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
| 655 | - $data['gf_version'] = \GFForms::$version; |
|
| 656 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 657 | - $data['multisite'] = is_multisite(); |
|
| 658 | - $data['theme'] = $theme; |
|
| 659 | - $data['url'] = home_url(); |
|
| 660 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
| 661 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
| 652 | + $data[ 'gv_version' ] = Plugin::$version; |
|
| 653 | + $data[ 'php_version' ] = phpversion(); |
|
| 654 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
| 655 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
| 656 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 657 | + $data[ 'multisite' ] = is_multisite(); |
|
| 658 | + $data[ 'theme' ] = $theme; |
|
| 659 | + $data[ 'url' ] = home_url(); |
|
| 660 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
| 661 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
| 662 | 662 | |
| 663 | 663 | // View Data |
| 664 | 664 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
| 665 | 665 | |
| 666 | - $data['view_count'] = null; |
|
| 667 | - $data['view_first'] = null; |
|
| 668 | - $data['view_latest'] = null; |
|
| 666 | + $data[ 'view_count' ] = null; |
|
| 667 | + $data[ 'view_first' ] = null; |
|
| 668 | + $data[ 'view_latest' ] = null; |
|
| 669 | 669 | |
| 670 | 670 | if ( $gravityview_posts->publish ) { |
| 671 | - $data['view_count'] = $gravityview_posts->publish; |
|
| 671 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
| 672 | 672 | |
| 673 | 673 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
| 674 | 674 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
| 675 | 675 | |
| 676 | 676 | if ( $first = array_shift( $first ) ) { |
| 677 | - $data['view_first'] = $first->post_date; |
|
| 677 | + $data[ 'view_first' ] = $first->post_date; |
|
| 678 | 678 | } |
| 679 | 679 | if ( $latest = array_pop( $latest ) ) { |
| 680 | - $data['view_latest'] = $latest->post_date; |
|
| 680 | + $data[ 'view_latest' ] = $latest->post_date; |
|
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | // Form counts |
| 685 | 685 | if ( class_exists( 'GFFormsModel' ) ) { |
| 686 | 686 | $form_data = \GFFormsModel::get_form_count(); |
| 687 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
| 688 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
| 689 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 690 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 687 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
| 688 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
| 689 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 690 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | // Retrieve current plugin information |
@@ -695,13 +695,13 @@ discard block |
||
| 695 | 695 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
| 699 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
| 700 | - $data['inactive_plugins'] = array(); |
|
| 701 | - $data['locale'] = get_locale(); |
|
| 698 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
| 699 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
| 700 | + $data[ 'inactive_plugins' ] = array(); |
|
| 701 | + $data[ 'locale' ] = get_locale(); |
|
| 702 | 702 | |
| 703 | 703 | // Validate request on the GV server |
| 704 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
| 704 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
| 705 | 705 | |
| 706 | 706 | return $data; |
| 707 | 707 | } |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | $plugin_data = get_plugin_data( $active_plugin ); |
| 733 | 733 | |
| 734 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
| 734 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | if ( ! empty( $extensions ) ) { |