WP eCommerce - Version 3.8.8-rc2

Version Description

Download this release

Release Info

Developer garyc40
Plugin Icon 128x128 WP eCommerce
Version 3.8.8-rc2
Comparing to
See all releases

Code changes from version 3.8.8-rc1 to 3.8.8-rc2

wp-shopping-cart.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP e-Commerce
4
  * Plugin URI: http://getshopped.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
6
- * Version: 3.8.8-rc1
7
  * Author: Instinct Entertainment
8
  * Author URI: http://getshopped.org/
9
  **/
3
  * Plugin Name: WP e-Commerce
4
  * Plugin URI: http://getshopped.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
6
+ * Version: 3.8.8-rc2
7
  * Author: Instinct Entertainment
8
  * Author URI: http://getshopped.org/
9
  **/
wpsc-admin/ajax-and-init.php CHANGED
@@ -779,7 +779,14 @@ function wpsc_purchlog_edit_status( $purchlog_id='', $purchlog_status='' ) {
779
  }
780
  }
781
 
782
- add_action( 'wp_ajax_wpsc_change_purchase_log_status', 'wpsc_purchlog_edit_status' );
 
 
 
 
 
 
 
783
 
784
  function wpsc_save_product_order() {
785
  global $wpdb;
@@ -1219,7 +1226,6 @@ function prod_upload() {
1219
  // Save the data
1220
  $id = wp_insert_post( $attachment );
1221
  }
1222
-
1223
  $deletion_url = wp_nonce_url( "admin.php?wpsc_admin_action=delete_file&amp;file_name={$attachment['post_title']}&amp;product_id={$product_id}", 'delete_file_' . $attachment['post_title'] );
1224
 
1225
  $output .= '<tr class="wpsc_product_download_row ' . $class . '" id="elect_product_file_row_id_' . $id . '">';
@@ -1227,7 +1233,7 @@ function prod_upload() {
1227
  $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
1228
  $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
1229
  $output .= "<td><a class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Downliad UI row', 'wpsc' ) . "</a></td>";
1230
- $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Downliad UI row', 'wpsc' ) . '</a></td>';
1231
  $output .= '</tr>';
1232
  }
1233
 
@@ -1696,5 +1702,4 @@ function wpsc_delete_variant_from_products_page(){
1696
  wp_delete_term( $variant_id, 'wpsc-variation');
1697
  exit();
1698
  }
1699
- add_action( 'wp_ajax_wpsc_delete_variant_from_products_page', 'wpsc_delete_variant_from_products_page' );
1700
- ?>
779
  }
780
  }
781
 
782
+ function _wpsc_ajax_purchlog_edit_status() {
783
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_purchase_logs' ) )
784
+ die( '-1' );
785
+
786
+ wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
787
+ }
788
+
789
+ add_action( 'wp_ajax_wpsc_change_purchase_log_status', '_wpsc_ajax_purchlog_edit_status' );
790
 
791
  function wpsc_save_product_order() {
792
  global $wpdb;
1226
  // Save the data
1227
  $id = wp_insert_post( $attachment );
1228
  }
 
1229
  $deletion_url = wp_nonce_url( "admin.php?wpsc_admin_action=delete_file&amp;file_name={$attachment['post_title']}&amp;product_id={$product_id}", 'delete_file_' . $attachment['post_title'] );
1230
 
1231
  $output .= '<tr class="wpsc_product_download_row ' . $class . '" id="elect_product_file_row_id_' . $id . '">';
1233
  $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
1234
  $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
1235
  $output .= "<td><a class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Downliad UI row', 'wpsc' ) . "</a></td>";
1236
+ $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Downliad UI row', 'wpsc' ) . '</a></td>';
1237
  $output .= '</tr>';
1238
  }
1239
 
1702
  wp_delete_term( $variant_id, 'wpsc-variation');
1703
  exit();
1704
  }
1705
+ add_action( 'wp_ajax_wpsc_delete_variant_from_products_page', 'wpsc_delete_variant_from_products_page' );
 
wpsc-admin/display-upgrades.page.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  function wpsc_display_upgrades_page() {
4
-
5
  do_action( 'wpsc_gold_module_activation' ); ?>
6
 
7
  <div class='wrap'>
@@ -44,7 +44,7 @@ function wpsc_display_upgrades_page() {
44
  <p class='wpsc_gold_text'>Make your Online photo gallery into an e-Commerce solution.</p>
45
  <span class='wpsc_gold_info'>$10</span>
46
  </div>
47
-
48
  <div class='wpsc_gold_module'>
49
  <br />
50
  <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/jplayer-mp3-player/" target="_blank"><strong><?php _e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
@@ -69,7 +69,7 @@ function wpsc_display_upgrades_page() {
69
  <h2><?php _e( 'Upgrades', 'wpsc' ); ?></h2>
70
  <div class='wpsc_gold_float'>
71
  <p><?php _e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
72
- <p><a href="http://getshopped.org/resources/docs/installation/gold-files/"><?php _e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
73
 
74
  <div class='metabox-holder'>
75
  <form method='post' id='gold_cart_form' action=''>
1
  <?php
2
 
3
  function wpsc_display_upgrades_page() {
4
+
5
  do_action( 'wpsc_gold_module_activation' ); ?>
6
 
7
  <div class='wrap'>
44
  <p class='wpsc_gold_text'>Make your Online photo gallery into an e-Commerce solution.</p>
45
  <span class='wpsc_gold_info'>$10</span>
46
  </div>
47
+
48
  <div class='wpsc_gold_module'>
49
  <br />
50
  <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/jplayer-mp3-player/" target="_blank"><strong><?php _e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
69
  <h2><?php _e( 'Upgrades', 'wpsc' ); ?></h2>
70
  <div class='wpsc_gold_float'>
71
  <p><?php _e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
72
+ <p><a href="http://docs.getshopped.org/category/extending-your-store/premium-plugins/gold-cart/"><?php _e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
73
 
74
  <div class='metabox-holder'>
75
  <form method='post' id='gold_cart_form' action=''>
wpsc-admin/includes/settings-tabs/checkout.php CHANGED
@@ -17,7 +17,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
17
  $this->shipping_same_as_billing = get_option( 'shippingsameasbilling', 0 );
18
  $this->force_ssl = get_option( 'wpsc_force_ssl', 0 );
19
  $this->checkout_sets = get_option( 'wpsc_checkout_form_sets' );
20
- $this->current_checkout_set = empty( $_GET['checkout-set'] ) ? 0 : $_GET['checkout-set'];
21
  $this->field_types = get_option( 'wpsc_checkout_form_fields' );
22
  $this->user_field_types = array('text','textarea','heading','select','radio','checkbox');
23
 
@@ -44,7 +44,18 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
44
  public function callback_submit_options() {
45
  global $wpdb;
46
 
47
- if ( ! isset( $_POST['form_name'] ) )
 
 
 
 
 
 
 
 
 
 
 
48
  return;
49
 
50
  $existing_orders = array();
@@ -60,52 +71,54 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
60
  }
61
  }
62
 
63
- $sql = "SELECT id FROM " . WPSC_TABLE_CHECKOUT_FORMS;
64
  $ids = $wpdb->get_col( $sql );
65
 
66
- foreach ( $_POST['form_name'] as $field_id => $name ) {
67
- $data = array(
68
- 'name' => $name,
69
- 'active' => empty( $_POST['form_display'][$field_id] ) ? 0 : 1,
70
- 'mandatory' => empty( $_POST['form_mandatory'][$field_id] ) ? 0 : 1,
71
- );
72
-
73
- $data_format = array(
74
- '%s', // name
75
- '%s', // active
76
- '%s', // mandatory
77
- );
78
-
79
- $where = array( 'id' => $field_id );
 
 
 
 
 
 
80
 
81
- if ( isset( $_POST['form_type'][$field_id] ) ) {
82
- $data['type'] = $_POST['form_type'][$field_id];
83
- $data_format[] = '%s';
84
- }
85
 
86
- if ( isset( $existing_orders[$field_id] ) ) {
87
- $data['checkout_order'] = $existing_orders[$field_id];
88
- $data_format[] = '%d';
89
- }
 
 
 
 
 
 
 
90
 
91
- if ( isset( $_POST['form_options'][$field_id]['label'] ) ) {
92
- $options = array();
93
- foreach( $_POST['form_options'][$field_id]['label'] as $key => $label ) {
94
- $value = $_POST['form_options'][$field_id]['value'][$key];
95
- if ( $label === '' && $value === '')
96
- continue;
97
- $options[$label] = $value;
98
  }
99
- $data['options'] = serialize( $options );
100
- $data_format[] = '%s';
101
- }
102
 
103
- $index = array_search( $field_id, $ids );
104
- if ( $index !== false ) {
105
- unset( $ids[$index] );
106
  }
107
-
108
- $wpdb->update( WPSC_TABLE_CHECKOUT_FORMS, $data, $where, $data_format, '%d' );
109
  }
110
 
111
  // delete all other fields that are not present in the submitted form
@@ -115,14 +128,15 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
115
  }
116
 
117
  foreach ( $_POST['new_field_name'] as $key => $name ) {
118
- if ( $key === 0 && empty( $name ) )
119
  continue;
120
 
121
  $data = array(
122
- 'name' => $name,
123
- 'type' => $_POST['new_field_type'][$key],
124
- 'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
125
- 'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
 
126
  );
127
 
128
  $data_format = array(
@@ -152,9 +166,6 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
152
 
153
  $wpdb->insert( WPSC_TABLE_CHECKOUT_FORMS, $data, $data_format );
154
  }
155
-
156
- wp_redirect( $_SERVER['REQUEST_URI'] );
157
- exit;
158
  }
159
 
160
  /**
@@ -208,6 +219,105 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
208
  return false;
209
  }
210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  public function display() {
212
  global $wpdb;
213
 
@@ -268,7 +378,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
268
 
269
  <p>
270
  <label for='wpsc_form_set'><?php _e('Select a Form Set' , 'wpsc'); ?>:</label>
271
- <select id='wpsc_form_set' name='wpsc_form_set'>
272
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
273
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
274
  <?php endforeach; ?>
@@ -299,166 +409,90 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab
299
  </tfoot>
300
 
301
  <tbody id='wpsc_checkout_list_body'>
302
- <?php foreach ( $this->form_fields as $form_field ): ?>
303
- <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field">
304
- <td class="drag">
305
- <div class="cell-wrapper">
306
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
307
- <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
308
- </a>
309
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
310
- </div>
311
- </td>
312
- <td class="namecol">
313
- <div class="cell-wrapper">
314
- <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
315
- <a
316
- class="edit-options" href="#"
317
- <?php
318
- if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) )
319
- echo 'style="display:inline;"';
320
- ?>
321
- ><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
322
- </div>
323
- </td>
324
- <td class="typecol">
325
- <div class="cell-wrapper">
326
- <?php if ( $this->is_field_default( $form_field ) ): ?>
327
- <strong><?php echo esc_html( $form_field->type ); ?></strong>
328
- <?php else: ?>
329
- <select name="form_type[<?php echo esc_attr( $form_field->id ); ?>]">
330
- <?php foreach ($this->field_types as $label => $name): ?>
331
- <option <?php selected( $form_field->type, $name ); ?> value="<?php echo esc_attr( $name ); ?>"><?php echo esc_html( $label ); ?></option>
332
- <?php endforeach ?>
333
- </select>
334
- <?php
335
- $field_options = unserialize( $form_field->options );
336
- if ( empty( $field_options ) )
337
- $field_options = array();
338
-
339
- $i = 0;
340
- foreach ( $field_options as $label => $value ):
341
- $i ++;
342
  ?>
343
- <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][label][]" value="<?php echo esc_attr( $label ); ?>" />
344
- <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][value][]" value="<?php echo esc_attr( $value ); ?>" />
345
- <?php endforeach; ?>
346
- <?php endif; ?>
347
- </div>
348
- </td>
349
-
350
- <td class="uniquenamecol">
351
- <div class="cell-wrapper">
352
- <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
353
- <small><?php echo esc_html( $form_field->unique_name ); ?></small>
354
- <?php endif ?>
355
- </div>
356
- </td>
357
- <td class="displaycol">
358
- <div class="cell-wrapper">
359
- <input <?php checked( $form_field->active, 1 ); ?> type="checkbox" name="form_display[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
360
- </div>
361
- </td>
362
- <td class="mandatorycol">
363
- <div class="cell-wrapper">
364
- <?php if ( $form_field->type != 'heading' ): ?>
365
- <input <?php checked( $form_field->mandatory, 1 ); ?> type="checkbox" name="form_mandatory[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
 
 
 
 
 
 
 
 
 
 
366
  <?php endif ?>
367
- </div>
368
- </td>
369
- <td class="actionscol">
370
- <div class="cell-wrapper">
371
- <?php if ( ! $this->is_field_default( $form_field ) ): ?>
372
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
373
- <?php else: ?>
374
- <span title="<?php _e( 'Cannot Delete Default Fields', 'wpsc' ); ?>" class="action delete">Delete</span>
375
- <?php endif; ?>
376
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
377
- </div>
378
- </td>
379
- </tr>
380
- <?php endforeach; ?>
381
- <tr id="field-prototype" class="new-field">
382
- <td class="drag">
383
- <div class="cell-wrapper">
384
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
385
- <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
386
- </a>
387
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
388
- </div>
389
- </td>
390
- <td class="namecol">
391
- <div class="cell-wrapper">
392
- <input type="text" name="new_field_name[0]" value="" />
393
- <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
394
- </div>
395
- </td>
396
- <td class="typecol">
397
- <div class="cell-wrapper">
398
- <select name="new_field_type[0]">
399
- <?php foreach ( $this->field_types as $name => $type ): ?>
400
- <?php if( in_array($type, $this->user_field_types) ): ?>
401
- <option value="<?php echo esc_attr( $type ); ?>"><?php echo esc_html( $name ); ?></option>
402
  <?php endif ?>
403
- <?php endforeach ?>
404
- </select>
405
- </div>
406
- </td>
407
- <td class="uniquenamecol">
408
- </td>
409
- <td class="displaycol">
410
- <div class="cell-wrapper">
411
- <input checked="checked" type="checkbox" name="new_field_display[0]" value="1" />
412
- </div>
413
- </td>
414
- <td class="mandatorycol">
415
- <div class="cell-wrapper">
416
- <input type="checkbox" name="new_field_mandatory[0]" value="1" />
417
- </div>
418
- </td>
419
- <td class="actionscol">
420
- <div class="cell-wrapper">
421
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
422
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
423
- </div>
424
- </td>
425
- </tr>
426
- <tr id="field-options-prototype" class="form-field-options">
427
- <td></td>
428
- <td>
429
- <div class="cell-wrapper">
430
- <h4></h4>
431
- <table class="wpsc-field-options-table">
432
- <thead>
433
- <th class="column-labels"><?php echo esc_html( _x( 'Label', "checkout field's options", 'wpsc' ) ); ?></th>
434
- <th class="column-values"><?php echo esc_html( _x( 'Value', "checkout field's options", 'wpsc' ) ) ?></th>
435
- <th class="column-actions">&nbsp;</th>
436
- </thead>
437
- <tbody>
438
- <tr class="new-option">
439
- <td class="column-labels">
440
- <div class="field-option-cell-wrapper">
441
- <input type="text" name="form_options[0][labels][]" value="" />
442
- </div>
443
- </td>
444
- <td class="column-values">
445
- <div class="field-option-cell-wrapper">
446
- <input type="text" name="form_options[0][values][]" value="" />
447
- </div>
448
- </td>
449
- <td class="column-actions">
450
- <div class="field-option-cell-wrapper">
451
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
452
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
453
- </div>
454
- </td>
455
- </tr>
456
- </tbody>
457
- </table>
458
- </div>
459
- </td>
460
- <td colspan="5"></td>
461
- </tr>
462
  </tbody>
463
  </table>
464
  <?php
17
  $this->shipping_same_as_billing = get_option( 'shippingsameasbilling', 0 );
18
  $this->force_ssl = get_option( 'wpsc_force_ssl', 0 );
19
  $this->checkout_sets = get_option( 'wpsc_checkout_form_sets' );
20
+ $this->current_checkout_set = empty( $_GET['checkout_set'] ) ? 0 : $_GET['checkout_set'];
21
  $this->field_types = get_option( 'wpsc_checkout_form_fields' );
22
  $this->user_field_types = array('text','textarea','heading','select','radio','checkbox');
23
 
44
  public function callback_submit_options() {
45
  global $wpdb;
46
 
47
+ if ( ! empty( $_POST['new_form_set'] ) ) {
48
+ $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
49
+ $checkout_sets[] = $_POST['new_form_set'];
50
+ update_option( 'wpsc_checkout_form_sets', $checkout_sets );
51
+ add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wpsc' ), 'updated' );
52
+ }
53
+
54
+ if ( isset( $_POST['checkout_set'] ) ) {
55
+ $_SERVER['REQUEST_URI'] = add_query_arg( 'checkout_set', $_POST['checkout_set'] );
56
+ }
57
+
58
+ if ( ! isset( $_POST['form_name'] ) && ! isset( $_POST['new_field_name'] ) )
59
  return;
60
 
61
  $existing_orders = array();
71
  }
72
  }
73
 
74
+ $sql = $wpdb->prepare( "SELECT id FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE checkout_set = %s", $this->current_checkout_set );
75
  $ids = $wpdb->get_col( $sql );
76
 
77
+ if ( ! empty( $_POST['form_name'] ) ) {
78
+ foreach ( $_POST['form_name'] as $field_id => $name ) {
79
+ $data = array(
80
+ 'name' => $name,
81
+ 'active' => empty( $_POST['form_display'][$field_id] ) ? 0 : 1,
82
+ 'mandatory' => empty( $_POST['form_mandatory'][$field_id] ) ? 0 : 1,
83
+ );
84
+
85
+ $data_format = array(
86
+ '%s', // name
87
+ '%s', // active
88
+ '%s', // mandatory
89
+ );
90
+
91
+ $where = array( 'id' => $field_id );
92
+
93
+ if ( isset( $_POST['form_type'][$field_id] ) ) {
94
+ $data['type'] = $_POST['form_type'][$field_id];
95
+ $data_format[] = '%s';
96
+ }
97
 
98
+ if ( isset( $existing_orders[$field_id] ) ) {
99
+ $data['checkout_order'] = $existing_orders[$field_id];
100
+ $data_format[] = '%d';
101
+ }
102
 
103
+ if ( isset( $_POST['form_options'][$field_id]['label'] ) ) {
104
+ $options = array();
105
+ foreach( $_POST['form_options'][$field_id]['label'] as $key => $label ) {
106
+ $value = $_POST['form_options'][$field_id]['value'][$key];
107
+ if ( $label === '' && $value === '')
108
+ continue;
109
+ $options[$label] = $value;
110
+ }
111
+ $data['options'] = serialize( $options );
112
+ $data_format[] = '%s';
113
+ }
114
 
115
+ $index = array_search( $field_id, $ids );
116
+ if ( $index !== false ) {
117
+ unset( $ids[$index] );
 
 
 
 
118
  }
 
 
 
119
 
120
+ $wpdb->update( WPSC_TABLE_CHECKOUT_FORMS, $data, $where, $data_format, '%d' );
 
 
121
  }
 
 
122
  }
123
 
124
  // delete all other fields that are not present in the submitted form
128
  }
129
 
130
  foreach ( $_POST['new_field_name'] as $key => $name ) {
131
+ if ( $key === 0 || empty( $name ) )
132
  continue;
133
 
134
  $data = array(
135
+ 'name' => $name,
136
+ 'type' => $_POST['new_field_type'][$key],
137
+ 'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
138
+ 'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
139
+ 'checkout_set' => $this->current_checkout_set,
140
  );
141
 
142
  $data_format = array(
166
 
167
  $wpdb->insert( WPSC_TABLE_CHECKOUT_FORMS, $data, $data_format );
168
  }
 
 
 
169
  }
170
 
171
  /**
219
  return false;
220
  }
221
 
222
+ private function prototype_field( $mode = 'hidden' ) {
223
+ $row_id = 'field-prototype';
224
+ $row_class = 'new-field';
225
+ $data = '';
226
+ $new_field_id = 0;
227
+ $style = '';
228
+
229
+ if ( $mode == 'new' ) {
230
+ $new_field_id = 1;
231
+ $row_id = 'new-field-1';
232
+ $row_class .= ' checkout_form_field';
233
+ $data = 'data-new-field-id="1"';
234
+ $style = 'style="display:table-row;"';
235
+ }
236
+ ?>
237
+ <tr id="<?php echo $row_id; ?>" class="<?php echo $row_class; ?>" <?php echo $data; ?> <?php echo $style; ?>>
238
+ <td class="drag">
239
+ <div class="cell-wrapper">
240
+ <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
241
+ <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
242
+ </a>
243
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
244
+ </div>
245
+ </td>
246
+ <td class="namecol">
247
+ <div class="cell-wrapper">
248
+ <input type="text" name="new_field_name[<?php echo $new_field_id; ?>]" value="" />
249
+ <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
250
+ </div>
251
+ </td>
252
+ <td class="typecol">
253
+ <div class="cell-wrapper">
254
+ <select name="new_field_type[<?php echo $new_field_id; ?>]">
255
+ <?php foreach ( $this->field_types as $name => $type ): ?>
256
+ <?php if( in_array($type, $this->user_field_types) ): ?>
257
+ <option value="<?php echo esc_attr( $type ); ?>"><?php echo esc_html( $name ); ?></option>
258
+ <?php endif ?>
259
+ <?php endforeach ?>
260
+ </select>
261
+ </div>
262
+ </td>
263
+ <td class="uniquenamecol">
264
+ </td>
265
+ <td class="displaycol">
266
+ <div class="cell-wrapper">
267
+ <input checked="checked" type="checkbox" name="new_field_display[<?php echo $new_field_id; ?>]" value="1" />
268
+ </div>
269
+ </td>
270
+ <td class="mandatorycol">
271
+ <div class="cell-wrapper">
272
+ <input type="checkbox" name="new_field_mandatory[<?php echo $new_field_id; ?>]" value="1" />
273
+ </div>
274
+ </td>
275
+ <td class="actionscol">
276
+ <div class="cell-wrapper">
277
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
278
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
279
+ </div>
280
+ </td>
281
+ </tr>
282
+ <tr id="field-options-prototype" class="form-field-options">
283
+ <td></td>
284
+ <td>
285
+ <div class="cell-wrapper">
286
+ <h4></h4>
287
+ <table class="wpsc-field-options-table">
288
+ <thead>
289
+ <th class="column-labels"><?php echo esc_html_x( 'Label', "checkout field's options", 'wpsc' ); ?></th>
290
+ <th class="column-values"><?php echo esc_html_x( 'Value', "checkout field's options", 'wpsc' ); ?></th>
291
+ <th class="column-actions">&nbsp;</th>
292
+ </thead>
293
+ <tbody>
294
+ <tr class="new-option">
295
+ <td class="column-labels">
296
+ <div class="field-option-cell-wrapper">
297
+ <input type="text" name="form_options[<?php echo $new_field_id; ?>][labels][]" value="" />
298
+ </div>
299
+ </td>
300
+ <td class="column-values">
301
+ <div class="field-option-cell-wrapper">
302
+ <input type="text" name="form_options[<?php echo $new_field_id; ?>][values][]" value="" />
303
+ </div>
304
+ </td>
305
+ <td class="column-actions">
306
+ <div class="field-option-cell-wrapper">
307
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
308
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
309
+ </div>
310
+ </td>
311
+ </tr>
312
+ </tbody>
313
+ </table>
314
+ </div>
315
+ </td>
316
+ <td colspan="5"></td>
317
+ </tr>
318
+ <?php
319
+ }
320
+
321
  public function display() {
322
  global $wpdb;
323
 
378
 
379
  <p>
380
  <label for='wpsc_form_set'><?php _e('Select a Form Set' , 'wpsc'); ?>:</label>
381
+ <select id='wpsc_form_set' name='checkout_set'>
382
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
383
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
384
  <?php endforeach; ?>
409
  </tfoot>
410
 
411
  <tbody id='wpsc_checkout_list_body'>
412
+ <?php if ( empty( $this->form_fields ) ): ?>
413
+ <?php $this->prototype_field( 'new' ); ?>
414
+ <?php else: ?>
415
+ <?php foreach ( $this->form_fields as $form_field ): ?>
416
+ <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field">
417
+ <td class="drag">
418
+ <div class="cell-wrapper">
419
+ <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
420
+ <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
421
+ </a>
422
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
423
+ </div>
424
+ </td>
425
+ <td class="namecol">
426
+ <div class="cell-wrapper">
427
+ <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
428
+ <a
429
+ class="edit-options" href="#"
430
+ <?php
431
+ if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) )
432
+ echo 'style="display:inline;"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  ?>
434
+ ><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
435
+ </div>
436
+ </td>
437
+ <td class="typecol">
438
+ <div class="cell-wrapper">
439
+ <?php if ( $this->is_field_default( $form_field ) ): ?>
440
+ <strong><?php echo esc_html( $form_field->type ); ?></strong>
441
+ <?php else: ?>
442
+ <select name="form_type[<?php echo esc_attr( $form_field->id ); ?>]">
443
+ <?php foreach ($this->field_types as $label => $name): ?>
444
+ <option <?php selected( $form_field->type, $name ); ?> value="<?php echo esc_attr( $name ); ?>"><?php echo esc_html( $label ); ?></option>
445
+ <?php endforeach ?>
446
+ </select>
447
+ <?php
448
+ $field_options = unserialize( $form_field->options );
449
+ if ( empty( $field_options ) )
450
+ $field_options = array();
451
+
452
+ $i = 0;
453
+ foreach ( $field_options as $label => $value ):
454
+ $i ++;
455
+ ?>
456
+ <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][label][]" value="<?php echo esc_attr( $label ); ?>" />
457
+ <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][value][]" value="<?php echo esc_attr( $value ); ?>" />
458
+ <?php endforeach; ?>
459
+ <?php endif; ?>
460
+ </div>
461
+ </td>
462
+
463
+ <td class="uniquenamecol">
464
+ <div class="cell-wrapper">
465
+ <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
466
+ <small><?php echo esc_html( $form_field->unique_name ); ?></small>
467
  <?php endif ?>
468
+ </div>
469
+ </td>
470
+ <td class="displaycol">
471
+ <div class="cell-wrapper">
472
+ <input <?php checked( $form_field->active, 1 ); ?> type="checkbox" name="form_display[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
473
+ </div>
474
+ </td>
475
+ <td class="mandatorycol">
476
+ <div class="cell-wrapper">
477
+ <?php if ( $form_field->type != 'heading' ): ?>
478
+ <input <?php checked( $form_field->mandatory, 1 ); ?> type="checkbox" name="form_mandatory[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  <?php endif ?>
480
+ </div>
481
+ </td>
482
+ <td class="actionscol">
483
+ <div class="cell-wrapper">
484
+ <?php if ( ! $this->is_field_default( $form_field ) ): ?>
485
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
486
+ <?php else: ?>
487
+ <span title="<?php _e( 'Cannot Delete Default Fields', 'wpsc' ); ?>" class="action delete">Delete</span>
488
+ <?php endif; ?>
489
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
490
+ </div>
491
+ </td>
492
+ </tr>
493
+ <?php endforeach; ?>
494
+ <?php endif; ?>
495
+ <?php $this->prototype_field(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  </tbody>
497
  </table>
498
  <?php
wpsc-admin/js/settings-page.js CHANGED
@@ -48,6 +48,7 @@
48
  $(window).bind('beforeunload', WPSC_Settings_Page.event_before_unload);
49
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
50
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
 
51
  });
52
  },
53
 
@@ -313,6 +314,8 @@
313
  stop : WPSC_Settings_Page.Checkout.event_sort_stop,
314
  update : WPSC_Settings_Page.Checkout.event_sort_update
315
  });
 
 
316
  },
317
 
318
  event_add_field_option : function() {
@@ -503,7 +506,25 @@
503
  },
504
 
505
  event_delete_field : function() {
506
- var target_row = $(this).closest('tr');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  target_row.find('.cell-wrapper').slideUp(150, function(){
508
  var id = target_row.data('field-id');
509
 
48
  $(window).bind('beforeunload', WPSC_Settings_Page.event_before_unload);
49
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
50
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
51
+ $('.settings-error').insertAfter('.nav-tab-wrapper');
52
  });
53
  },
54
 
314
  stop : WPSC_Settings_Page.Checkout.event_sort_stop,
315
  update : WPSC_Settings_Page.Checkout.event_sort_update
316
  });
317
+
318
+ WPSC_Settings_Page.Checkout.new_field_count = $('.new-field').length;
319
  },
320
 
321
  event_add_field_option : function() {
506
  },
507
 
508
  event_delete_field : function() {
509
+ var target_row = $(this).closest('tr'), next_row;
510
+
511
+ if ( $('.checkout_form_field').length == 1 ) {
512
+ next_row = target_row.next();
513
+ next_row.hide();
514
+ target_row.removeClass('editing-options');
515
+ target_row.find('input[type="text"]').val('');
516
+ target_row.find('select').val('');
517
+ target_row.find('.edit-options').removeClass('expanded').text(WPSC_Settings_Page.edit_field_options).hide();
518
+
519
+ next_row.find('input[type="text"]').val('');
520
+ next_row.find('.wpsc-field-options-table tbody tr:gt(1)').remove();
521
+
522
+ target_row.find('.cell-wrapper').slideUp(150, function(){
523
+ $(this).slideDown(150);
524
+ });
525
+ return false;
526
+ }
527
+
528
  target_row.find('.cell-wrapper').slideUp(150, function(){
529
  var id = target_row.data('field-id');
530
 
wpsc-admin/js/variations.js CHANGED
@@ -155,7 +155,7 @@
155
  post_data = {
156
  action : 'wpsc_update_variations',
157
  description : $('#content_ifr').contents().find('body').html(),
158
- additional_description : $('textareaa#additional_description').text(),
159
  name : $('input#title').val(),
160
  product_id : $('input#product_id').val()
161
  },
155
  post_data = {
156
  action : 'wpsc_update_variations',
157
  description : $('#content_ifr').contents().find('body').html(),
158
+ additional_description : $('textarea#additional_description').text(),
159
  name : $('input#title').val(),
160
  product_id : $('input#product_id').val()
161
  },
wpsc-admin/settings-page.php CHANGED
@@ -308,6 +308,13 @@ final class WPSC_Settings_Page
308
  $this->save_options();
309
  if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) )
310
  $this->current_tab->callback_submit_options();
 
 
 
 
 
 
 
311
  }
312
  }
313
 
308
  $this->save_options();
309
  if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) )
310
  $this->current_tab->callback_submit_options();
311
+
312
+ $errors = get_settings_errors();
313
+ add_settings_error( 'wpsc-settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
314
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
315
+
316
+ wp_redirect( add_query_arg( 'settings-updated', true ) );
317
+ exit;
318
  }
319
  }
320
 
wpsc-core/wpsc-constants.php CHANGED
@@ -26,9 +26,9 @@ function wpsc_core_constants() {
26
  if(!defined('WPSC_URL'))
27
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
28
  // Define Plugin version
29
- define( 'WPSC_VERSION', '3.8.8-rc1' );
30
- define( 'WPSC_MINOR_VERSION', '516111' );
31
- define( 'WPSC_PRESENTABLE_VERSION', '3.8.8-rc1' );
32
 
33
  // Define Debug Variables for developers
34
  define( 'WPSC_DEBUG', false );
26
  if(!defined('WPSC_URL'))
27
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
28
  // Define Plugin version
29
+ define( 'WPSC_VERSION', '3.8.8-rc2' );
30
+ define( 'WPSC_MINOR_VERSION', '525805' );
31
+ define( 'WPSC_PRESENTABLE_VERSION', '3.8.8-rc2' );
32
 
33
  // Define Debug Variables for developers
34
  define( 'WPSC_DEBUG', false );