Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd

This page contains top rated real world PHP examples of function edd_set_error extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
File: prevent-discounts-with-sl-renewals.php Project:
0
8
9
10
11
12
13
14
15
function kfg_check_if_is_renewal( $return )
{
     if (EDD()->session->get( 'edd_is_renewal' )) {
         edd_set_error( 'edd-discount-error' , __( 'This discount is not valid with renewals.' , 'edd' ));
         return false;
     }
     return $return ;
}
Example #2
gum Men's Wayland Dekline Shoe Black Skateboard xvfapw6qa File: class-edd-force-discount.php Project:
0
25
26
27
28
29
30
31
32
public function discount_validation( $data )
{
     if ( $data [ 'discount' ] == 'none' || empty ( $data [ 'discount' ])) {
         $options = get_option( 'foa_edd_force_discount' , '' );
         $errornotice = empty ( $options [ 'errornotice' ]) ? __( 'Discount code is a required field. Please enter a discount code.' , 'edd-force-discount' ) : $options [ 'errornotice' ];
         edd_set_error( 'efdfoa_error_notice' , $errornotice );
     }
}
Example #3
File: force-minimum-password-length.php Project:
0
9
10
11
12
13
14
15
16
function sumobi_edd_set_minimum_password_length( $valid_data , $post_data )
{
     // how many characters should the password be?
     $length = 8;
     if ( strlen ( $post_data [ 'edd_user_pass' ]) < $length ) {
         edd_set_error( 'password_too_short' , sprintf(__( 'Please enter a password of %s characters or more.' , 'edd' ), $length ));
     }
}
Example #4
Dark Chunky Toe Pointed Women Heel jntworld Faux Pumps Suede Rhinestone Buckle Green 0WvnfH File: prevent-duplicate-purchases.php Project:
0
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
  * Prevents logged-in customers from purchasing an item twice
  *
  */
function pw_edd_prevent_duplicate_purchase( $valid_data , $posted )
{
     $cart_contents = edd_get_cart_contents();
     foreach ( $cart_contents as $item ) {
         if (edd_has_user_purchased(get_current_user_id(), $item [ 'id' ])) {
             edd_set_error( 'duplicate_item' , 'You have already purchased this item so may not purchase it again' );
         }
     }
}
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
  * Sets an error on checkout if no gateways are enabled
  *
  * @since 1.3.4
  * @return void
  */
function edd_no_gateway_error()
{
     $gateways = edd_get_enabled_payment_gateways();
     if ( empty ( $gateways )) {
         edd_set_error( 'no_gateways' , __( 'You must enable a payment gateway to use Easy Digital Downloads' , 'edd' ));
     } else {
         edd_unset_error( 'no_gateways' );
     }
}
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
  * Validates the survey results on checkout
  *
  * @since  1.0
  * @param  array $valid_data The array of valid data
  * @param  array $data       The data submitted
  * @return void
  */
function edd_acq_validate_custom_fields( $valid_data , $data )
{
     $methods = edd_acq_get_methods();
     if ( empty ( $methods )) {
         return ;
     }
     $required = edd_get_option( 'acq_require_response' , false);
     if ( $required && ( empty ( $data [ 'edd_acquisition_method' ]) || $data [ 'edd_acquisition_method' ] == '-1' )) {
         // check for a phone number
         edd_set_error( 'invalid_acquisition_method' , __( 'Please tell us how you found us.' , 'edd-acquisition-survey' ));
     }
}
Example #7
Women's El Naturalista Boot Ankle Plume NC18 Octopus Ibon qHnSw1gP File: one-subscription.php Project:
0
26
27
28
29
30
31
32
33
34
35
36
37
38
function pw_edd_recurring_limit_one_subscription( $valid_data , $post_data )
{
     if (! class_exists ( 'EDD_Recurring_Customer' )) {
         return ;
     }
     if (!is_user_logged_in()) {
         return ;
     }
     $purchase_data = array ( 'downloads' => edd_get_cart_contents());
     if (EDD_Recurring_Customer::is_customer_active() && EDD_Recurring()->is_purchase_recurring( $purchase_data )) {
         edd_set_error( 'edd-one-subscription' , __( 'You already have an active subscription so may not purchase a second one.' , 'edd' ));
     }
}
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public function edd_email_domain_validation( $data )
{
     // return if email doesn't exists
     if ( empty ( $data [ 'logged_in_user' ][ 'user_email' ]) && empty ( $data [ 'guest_user_data' ][ 'user_email' ])) {
         return ;
     }
     $email = empty ( $data [ 'logged_in_user' ][ 'user_email' ]) ? $data [ 'guest_user_data' ][ 'user_email' ] : $data [ 'logged_in_user' ][ 'user_email' ];
     $email = trim( $email );
     // return if email is unvalid
     if (!filter_var( $email , FILTER_VALIDATE_EMAIL)) {
         return ;
     }
     $error = $this ->verify_email( $email );
     // show error notice for blacklisted emails
     if ( $error ) {
         edd_set_error( 'wedb_blacklisted_email' , $error );
     }
}
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
/**
  * Ensure out of stock tickets cannot be purchased even if they manage to get added to the cart
  */
public function checkout_errors()
{
     foreach (( array ) edd_get_cart_contents() as $item ) {
         $remaining = $this ->stock_control->available_units( $item [ 'id' ]);
         // We have to append the item IDs otherwise if we have multiple errors of the same type one will overwrite
         // the other
         if (! $remaining ) {
             edd_set_error( 'no_stock_' . $item [ 'id' ], sprintf(__( '%s ticket is sold out' , 'event-tickets-plus' ), get_the_title( $item [ 'id' ])));
         } elseif (self::UNLIMITED !== $remaining && $item [ 'quantity' ] > $remaining ) {
             edd_set_error( 'insufficient_stock_' . $item [ 'id' ], sprintf(__( 'Sorry! Only %d tickets remaining for %s' , 'event-tickets-plus' ), $remaining , get_the_title( $item [ 'id' ])));
         }
     }
}
Example #10
File: template-functions.php Project:
0
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Coal Z Sport Barefoot Sandals Amuri Xero Charcoal Trek Black Shoes Women 90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/**
  * Get Purchase Link
  *
  * Builds a Purchase link for a specified download based on arguments passed.
  * This function is used all over EDD to generate the Purchase or Add to Cart
  * buttons. If no arguments are passed, the function uses the defaults that have
  * been set by the plugin. The Purchase link is built for simple and variable
  * pricing and filters are available throughout the function to override
  * certain elements of the function.
  *
  * $download_id = null, $link_text = null, $style = null, $color = null, $class = null
  *
  * @since 1.0
  * @param array $args Arguments for display
  * @return string $purchase_form
  */
function edd_get_purchase_link( $args = array ())
{
     global $post , $edd_displayed_form_ids ;
     $purchase_page = edd_get_option( 'purchase_page' , false);
     if (! $purchase_page || $purchase_page == 0) {
         edd_set_error( 'set_checkout' , sprintf(__( 'No checkout page has been configured. Visit Flat Knee Sandals Silver Cut Gladiator Out Womens Boots 6zWgcqOU to set one.' , 'easy-digital-downloads' ), admin_url( 'edit.php?post_type=download&page=edd-settings' )));
         edd_print_errors();
         return false;
     }
     $post_id = is_object ( $post ) ? $post ->ID : 0;
     $button_behavior = edd_get_download_button_behavior( $post_id );
     $defaults = apply_filters( 'edd_purchase_link_defaults' , array ( 'download_id' => $post_id , 'price' => (bool) true, 'price_id' => isset( $args [ 'price_id' ]) ? $args [ 'price_id' ] : false, 'direct' => $button_behavior Trek Xero Women Shoes Coal Z Barefoot Black Sandals Sport Amuri Charcoal == 'direct' ? true : false, 'text' => $button_behavior == 'direct' ? edd_get_option( 'buy_now_text' , __( 'Buy Now' , 'easy-digital-downloads' )) : edd_get_option( 'add_to_cart_text' , __( 'Purchase' , 'easy-digital-downloads' )), 'style' => edd_get_option( 'button_style' , 'button' ), 'color' => edd_get_option( 'checkout_color' , 'blue' ), 'class' => 'edd-submit' ));
     $args = wp_parse_args( $args , $defaults );
     // Override the stright_to_gateway if the shop doesn't support it
     if (!edd_shop_supports_buy_now()) {
         $args [ 'direct' ] = false;
     }
     $download = new EDD_Download( $args [ 'download_id' ]);
     if ( empty ( $download ->ID)) {
         return false;
     }
     if ( 'publish' !== $download ->post_status && !current_user_can( 'edit_product' , $download ->ID)) {
         return false;
         // Product not published or user doesn't have permission to view drafts
     }
     // Override color if color == inherit
     $args [ 'color' ] = $args [ 'color' ] == 'inherit' ? '' : $args [ 'color' ];
     $options = array ();
     $variable_pricing = $download ->has_variable_prices();
     $data_variable = $variable_pricing ? ' data-variable-price="yes"' : 'data-variable-price="no"' ;
     $type = $download ->is_single_price_mode() ? 'data-price-mode=multi' : 'data-price-mode=single' ;
     $show_price = $args [ 'price' ] && $args [ 'price' ] !== 'no' ;
     $data_price_value = 0;
     $price = false;
     if ( $variable_pricing && false !== $args [ 'price_id' ]) {
         $price_id = $args [ 'price_id' ];
         $prices = $download ->prices;
         $options [ 'price_id' ] = $args [ 'price_id' ];
         $found_price = isset( $prices [ $price_id ]) ? $prices [ $price_id ][ 'amount' ] : false;
         $data_price_value = $found_price ;
         if ( $show_price ) {
             $price = $found_price ;
         }
     } elseif (! $variable_pricing ) {
         $data_price_value = $download ->price;
         if ( $show_price ) {
             $price = $download ->price;
         }
     }
     $args [ 'display_price' ] = $data_price_value ;
     $data_price = 'data-price="' . $data_price_value . '"' ;
     $button_text = ! empty ( $args [ 'text' ]) ? '&nbsp;&ndash;&nbsp;' . $args [ 'text' ] : '' ;
     if (false !== $price ) {
         if (0 == $price ) {
             $args [ 'text' ] = __( 'Free' , 'easy-digital-downloads' ) . $button_text ;
         } else {
             $args [ 'text' ] = edd_currency_filter(edd_format_amount( $price )) . $button_text ;
         }
     }
     if (edd_item_in_cart( $download ->ID, $options ) && (! $variable_pricing || ! $download ->is_single_price_mode())) {
         $button_display = 'style="display:none;"' ;
         $checkout_display = '' ;
     } else {
         $button_display = '' ;
         $checkout_display = 'style="display:none;"' ;
     }
     // Collect any form IDs we've displayed already so we can avoid duplicate IDs
     if (isset( $edd_displayed_form_ids [ $download ->ID])) {
         $edd_displayed_form_ids [ $download ->ID]++;
     } else {
         $edd_displayed_form_ids [ $download ->ID] = 1;
     }
     $form_id = ! empty ( $args [ 'form_id' ]) ? $args [ 'form_id' ] : 'edd_purchase_' . $download ->ID;
     // If we've already generated a form ID for this download ID, apped -#
     if ( $edd_displayed_form_ids [ $download ->ID] > 1) {
         $form_id .= '-' . $edd_displayed_form_ids [ $download ->ID];
     }
     $args = apply_filters( 'edd_purchase_link_args' , $args );
     ob_start();
     ?>
    
     echo $form_id ;
     ?>
" class=" edd_download_purchase_form edd_purchase_
     echo absint( $download Z Women Barefoot Trek Black Sandals Xero Coal Charcoal Sport Shoes Amuri ->ID);
     ?>
" method=" post">
 
        
     do_action( 'edd_purchase_link_top' , $download ->ID, $argsKate Sloan Small WKRU2130 Red Charlotte Chili Spade Chili Street Red RwqrHORU );
     ?>
 
        
class = "edd_purchase_submit_wrapper" >
            
     $class = implode( ' ' , array ( $args [ 'style' ], $args [ 'color' ], trim( $args [ 'class' ])));
     if (!edd_is_ajax_disabled()) {
     }
     echo '. esc_attr( $class ) . '" name="edd_purchase_download" value="' . esc_attr( $args [ 'text' ]) . '" data-action="edd_add_to_cart" data-download-id="' . esc_attr( $download ->ID) . '" ' . $data_variable . ' ' . $type . ' ' . $button_display . '/>' ;
     ?>
 
            
     if (!edd_is_ajax_disabled()) {
         ?>
                 class = "edd-cart-ajax-alert" >
                     class = "edd-cart-added-alert" style= "display: none;" >
                        
         echo ' ' . __( 'Added to cart' , 'easy-digital-downloads' );
         ?>
                    
                
            
     }
     ?>
            
     if (! $download ->is_free( $args [ 'price_id' ])) {
         ?>
                
         if (edd_display_tax_rate() && edd_prices_include_tax()) {
             echo '' . sprintf(__( 'Includes %1$s&#37; tax' , 'easy-digital-downloads' ), edd_get_tax_rate() * 100) . '' ;
         } elseif (edd_display_tax_rate() && !edd_prices_include_tax()) {
             echo '' . sprintf(__( 'Excluding %1$s&#37; tax' , 'easy-digital-downloads' ), edd_get_tax_rate() * 100) . '' ;
         }
         ?>
            
     }
     ?>
        
 
         "hidden" name= "download_id" value="
     echo esc_attr( $download ->ID);
     ?>
">
        
     if ( $variable_pricing && isset( $price_id ) && isset( $prices [ $price_id ])) {
         ?>
             "hidden" name= "edd_options[price_id][]" id="edd_price_option_
         echo $download ->ID;
         ?>
_1 " class=" edd_price_option_
         echo $download ->ID;
         ?>
" value="
         echo $price_id ;
         ?>
">
        
     }
     ?>
        
     if (! empty ( $args [ 'direct' ]) && ! $download ->is_free( $args [ 'price_id' ])) {
         ?>
             "hidden" name= "edd_action" class = "edd_action_input" value= "straight_to_gateway" >
        
     } else {
         ?>
             "hidden" name= "edd_action" class = "edd_action_input" value= "add_to_cart" >
        
     }
     ?>
 
        
     if (apply_filters( 'edd_download_redirect_to_checkout' , edd_straight_to_checkout(), $download ->ID, $args )) {
         ?>
             "hidden" name= "edd_redirect_to_checkout" id= "edd_redirect_to_checkout" value= "1" >
        
     }
     ?>
 
        
     do_action( 'edd_purchase_link_end' , $download ->ID, $args );
     ?>
 
    
     $purchase_form = ob_get_clean();
     return apply_filters( 'edd_purchase_download_form' , $purchase_form , $args );
}
Example #11
File: shortcodes.php Project:
0
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
/**
  * Process Profile Updater Form
  *
  * Processes the profile updater form by updating the necessary fields
  *
  * @since 1.4
  * @author Sunny Ratilal
  * @param array $data Data sent from the profile editor
  * @return void
  */
function edd_process_profile_editor_updates( $data )
{
     // Profile field change request
     if ( empty ( $_POST [ 'edd_profile_editor_submit' ]) && !is_user_logged_in()) {
         return false;
     }
     // Nonce security
     if (!wp_verify_nonce( $data [ 'edd_profile_editor_nonce' ], 'edd-profile-editor-nonce' )) {
         return false;
     }
     $user_id = get_current_user_id();
     $display_name = sanitize_text_field( $data [ 'edd_display_name' ]);
     $first_name = sanitize_text_field( $data [ 'edd_first_name' ]);
     $last_name = sanitize_text_field( $data [ 'edd_last_name' ]);
     $email = sanitize_email( $data [ 'edd_email' ]);
     $userdata = array ( 'ID' => $user_id , 'first_name' => $first_name , 'last_name' => $last_name , 'display_name' => $display_name , 'user_email' => $email );
     // New password
     if (! empty ( $data [ 'edd_new_user_pass1' ])) {
         if ( $data [ 'edd_new_user_pass1' ] !== $data [ 'edd_new_user_pass2' ]) {
             edd_set_error( 'password_mismatch' , __( 'The passwords you entered do not match. Please try again.' , 'edd' ));
         } else {
             $userdata [ 'user_pass' ] = $data [ 'edd_new_user_pass1' ];
         }
     }
     // Update the user
     $updated = wp_update_user( $userdata );
     if ( $updated ) {
         do_action( 'edd_user_profile_updated' , $user_id , $userdata );
         wp_redirect(add_query_arg( 'updated' , 'true' , $data [ 'edd_redirect' ]));
         edd_die();
     }
}
Example #12
File: s3.php Project:
0
318
319
320
321
322
323
324
325
326
327
328
329
330
331
/**
  * Internal error handler
  *
  * @internal Internal error handler
  * @param string $message Error message
  * @param string $file Filename
  * @param integer $line Line number
  * @param integer $code Error code
  * @return void
  */
private static function __triggerError( $message , $file , $line , $code = 0)
{
     edd_set_error( 'edd-amazon-s3' , $message . ' - ' . $file . ':' . $line . "\n" . 'Code: ' . $code );
}
Example #13
File: class.edd-wallet-gateway.php Project:
0
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/**
  * Process payment submission
  *
  * @access      public
  * @since       1.0.0
  * @param       array $purchase_data The data for a specific purchase
  * @return      void
  */
public function process_payment( $purchase_data )
{
     if (!wp_verify_nonce( $purchase_data [ 'gateway_nonce' ], 'edd-gateway' )) {
         wp_die(__( 'Nonce verification has failed' , 'edd-wallet' ), __( 'Error' , 'edd-wallet' ), array ( 'response' => 403));
     }
     $error = false;
     // Double check that we can afford this item
     $value = edd_wallet()->wallet->balance( $purchase_data [ 'user_email' ]);
     if ( $value < $purchase_data [ 'price' ]) {
         edd_record_gateway_error(__( 'Wallet Gateway Error' , 'edd-wallet' ), __( 'User wallet has insufficient funds.' , 'edd-wallet' ), 0);
         edd_set_error( 'wallet_error'ACCEL WHITE GUM Skateboarding SLIM GRAY Shoes GRAY ES GUM WHITE wEqFg , __( 'Insufficient funds.' , 'edd-wallet' ));
         edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
     }
     $payment_data = array ( 'price' => $purchase_data [ 'price' ], 'date' => $purchase_data [ 'date' ], 'user_email' => $purchase_data [ 'user_email' ], 'purchase_key' => $purchase_data [ 'purchase_key' ], 'currency' => edd_get_currency(), 'downloads' => $purchase_data [ 'downloads' ], 'user_info' => $purchase_data [ 'user_info' ], 'cart_details' => $purchase_data [ 'cart_details' ], 'status' => 'pending' );
     // Record the pending payment
     $payment = edd_insert_payment( $payment_data );
     if ( $payment ) {
         // Update payment status
         edd_update_payment_status( $payment , 'publish' );
         // Withdraw the funds
         edd_wallet()->wallet->withdraw( $purchase_data [ 'user_info' ][ 'id' ], $payment_data [ 'price' ], 'withdrawal' , $payment );
         edd_empty_cart();
         edd_send_to_success_page();
     } else {
         edd_record_gateway_error(__( 'Wallet Gateway Error' , 'edd-wallet' ), sprintf(__( 'Payment creation failed while processing a Wallet purchase. Payment data: %s' , 'edd-wallet' ), json_encode( $payment_data )), $payment );
         edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
     }
}
Example #14
File: class-edd-slg-public.php Project:
0
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/**
  * Process Profile
  *
  * Handles to process social profile
  *
  * @package Easy Digital Download - Social Login
  * @since 1.5.6
  */
public function edd_slg_process_profile( $data = array ())
{
     global $wpdb ;
     $user = null;
     $new_customer = false;
     $found_via = null;
     $message = edd_slg_messages();
     if (! empty ( $data ) && ! empty ( $data [ 'type' ])) {
         //social provider type
         $type = $data [ 'type' ];
         $identifier = $data [ 'id' ];
         // First, try to identify user based on the social identifier
         $user_id = $wpdb ->get_var( $wpdb ->prepare( 'SELECT user_id FROM ' . $wpdb ->usermeta . ' WHERE ( meta_key = "%1$s" AND meta_value = "%2$s" || meta_key = "%3$s" AND meta_value = "%2$s" )' , 'edd_slg_social_' . $type . '_identifier' , $identifier , 'edd_slg_social_identifier' ));
         if ( $user_id ) {
             $user = get_user_by( 'id' , $user_id );
             $found_via = 'social_identifier' ;
         }
         // Fall back to email - user may already have an account with the same email as in their social profile
         if (! $user && ! empty ( $data [ 'email' ])) {
             $user = get_user_by( 'email' , $data [ 'email' ]);
             $found_via = 'email' ;
         }
         if (is_user_logged_in()) {
             // If a user is already logged in
             // check that the logged in user and found user are the same.
             // This happens when user is linking a new social profile to their account.
             if ( $user && get_current_user_id() !== $user ->ID) {
                 if ( $found_via == 'social_identifier' ) {
                     $already_linked_error = isset( $message [ 'already_linked_error' ]) ? $message [ 'already_linked_error' ] : '' ;
                     return edd_set_error( 'edd_slg_account_already_linked' , $already_linked_error );
                 } else {
                     $account_exist_error = isset( $message [ 'account_exist_error' ]) ? $message [ 'account_exist_error' ] : '' ;
                     return edd_set_error( 'edd_slg_account_already_exist' , $account_exist_error );
                 }
             }
             // If the social profile is not linked to any user accounts,
             // use the currently logged in user as the customer
             if (! $user ) {
                 $user = get_user_by( 'id' , get_current_user_id());
             }
         }
         if (! $user ) {
             // If no user was found, create one
             $user_id = $this ->edd_slg_add_user( $data );
             $user = get_user_by( 'id' , $user_id );
             // indicate that a new user was created
             $new_customer = true;
         }
         // Update customer's WP user profile and billing details
         $this ->edd_slg_update_customer_profile( $user ->ID, $data , $new_customer );
         if (!is_user_logged_in()) {
             // Log user in or add account linked notice for a logged in user
             wp_set_auth_cookie( $user ->ID);
             //update last login with social account
             edd_slg_update_social_last_login_timestamp( $user ->ID, $type );
             do_action( 'edd_slg_login_user_authenticated' , $user ->ID, $type );
         } else {
             $_SESSION [ 'edd_slg_linked_notice' ] = sprintf(__( 'Your %s account is now linked to your account.' , 'eddslg' ), $type );
         }
     }
}
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
/**
  * Process Profile Updater Form
  *
  * Processes the profile updater form by updating the necessary fields
  *
  * @since 1.4
  * @author Sunny Ratilal
  * @param array $data Data sent from the profile editor
  * @return void
  */
function edd_process_profile_editor_updates( $data )
{
     // Profile field change request
     if ( empty ( $_POST [ 'edd_profile_editor_submit' ]) && !is_user_logged_in()) {
         return false;
     }
     // Pending users can't edit their profile
     if (edd_user_pending_verification()) {
         return false;
     }
     // Nonce security
     if (!wp_verify_nonce( $data [ 'edd_profile_editor_nonce' ], 'edd-profile-editor-nonce' )) {
         return false;
     }
     $user_id = get_current_user_id();
     $old_user_data = get_userdata( $user_id );
     $display_name = isset( $data [ 'edd_display_name' ]) ? sanitize_text_field( $data [ 'edd_display_name' ]) : $old_user_data ->display_name;
     $first_name = isset( $data [ 'edd_first_name' ]) ? sanitize_text_field( $data [ 'edd_first_name' ]) : $old_user_data ->first_name;
     $last_name = isset( $data [ 'edd_last_name' ]) ? sanitize_text_field( $data [ 'edd_last_name' ]) : $old_user_data ->last_name;
     $email = isset( $data [ 'edd_email' ]) ? sanitize_email( $data [ 'edd_email' ]) : $old_user_data ->user_email;
     $line1 = isset( $data [ 'edd_address_line1' ]) ? sanitize_text_field( $data [ 'edd_address_line1' ]) : '' ;
     $line2 = isset( $data [ 'edd_address_line2' ]) ? sanitize_text_field( $data [ 'edd_address_line2' ]) : '' ;
     $city = isset( $data [ 'edd_address_city' ]) ? sanitize_text_field( $data [ 'edd_address_city' ]) : '' ;
     $state = isset( $data [ 'edd_address_state' ]) ? sanitize_text_field( $data [ 'edd_address_state' ]) : '' ;
     $zip = isset( $data [ 'edd_address_zip' ]) ? sanitize_text_field( $data [ 'edd_address_zip' ]) : '' ;
     $country = isset( $data [ 'edd_address_country' ]) ? sanitize_text_field( $data [ 'edd_address_country' ]) : '' ;
     $userdata = array ( 'ID' => $user_id , 'first_name' => $first_name , 'last_name' => $last_name , 'display_name' => $display_name , 'user_email' => $email );
     $address = array ( 'line1' => $line1 , 'line2' => $line2 , 'city' => $city , 'state' => $state , 'zip' => $zip , 'country' => $country );
     do_action( 'edd_pre_update_user_profile' , $user_id , $userdata );
     // New password
     if (! empty ( $data [ 'edd_new_user_pass1' ])) {
         if ( $data [ 'edd_new_user_pass1' ] !== $data [ 'edd_new_user_pass2' ]) {
             edd_set_error( 'password_mismatch' , __( 'The passwords you entered do not match. Please try again.' , 'easy-digital-downloads' ));
         } else {
             $userdata [ 'user_pass' ] = $data [ 'edd_new_user_pass1' ];
         }
     }
     // Make sure the new email doesn't belong to another user
     if ( $email != $old_user_data ->user_email) {
         // Make sure the new email is valid
         if (!is_email( $email )) {
             edd_set_error( 'email_invalid' , __( 'The email you entered is invalid. Please enter a valid email.' , 'easy-digital-downloads' ));
         }
         // Make sure the new email doesn't belong to another user
         if (email_exists( $email )) {
             edd_set_error( 'email_exists' , __( Shoes Coal Xero Charcoal Women Sandals Z Black Trek Barefoot Sport Amuri 'The email you entered belongs to another user. Please use another.' , 'easy-digital-downloads' ));
         }
     }
     // Check for errors
     $errors = edd_get_errors();
     if ( $errors ) {
         // Send back to the profile editor if there are errors
         wp_redirect( $data [ 'edd_redirect' ]);
         edd_die();
     }
     // Update the user
     $meta = update_user_meta( $user_id , '_edd_user_address' , $address );
     $updated = wp_update_user( $userdata );
     if ( $updated ) {
         do_action( 'edd_user_profile_updated' , $user_id , $userdata );
         wp_redirect(add_query_arg( 'updated' , 'true' , $data [ 'edd_redirect' ]));
         edd_die();
     }
}
Example #16
File: edd-recurring.php Project:
0
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/**
  * Look for errors during checkout
  *
  * This makes sure that only one recurring item is purchased per order.
  *
  * This checks to ensure a user is creating an account, logged/ing in if purchasing a subscription
  *
  * @since  1.0
  * @return void
  */
public function checkout_errors( $valid_data , $post_data )
{
     // Retrieve the cart contents
     $cart_items = edd_get_cart_contents();
     /********* Check for multiple recurring products *********/
     // If less than 2 items in the cart, get out
     if ( count ( $cart_items ) < 2) {
         return ;
     }
     $has_recurring = false;
     // Loops through each item to see if any of them are recurring
     foreach ( $cart_items as $cart_item ) {
         $item_id = $cart_item [ 'id' ];
         $options = $cart_item [ 'options' ];
         $price_id = isset( $options [ 'price_id' ]) ? intval ( $options [ 'price_id' ]) : null;
         // Only one subscription can be purchased at a time. Throw an error is more than one.
         // This also throws an error if a recurring and non recurring product are purchased at once.
         if (! empty ( $price_id ) && self::is_price_recurring( $item_id , $price_id ) || self::is_recurring( $item_id )) {
             $has_recurring = true;
             edd_set_error( 'subscription_invalid' , __( 'Sorry, you cannot purchase items in the same checkout session as subscriptions.' , 'edd-recurring' ));
             break ;
         }
     }
     /********* Ensure users create an account *********/
     // Only check if guest checkout is enabled
     if (!edd_no_guest_checkout() && $has_recurring && !is_user_logged_in()) {
         // If customer is purchasing as a guest, we must throw an error
         // TODO: this doesn't work yet
         if (isset( $valid_data [ 'new_user_data' ]) && ( $valid_data [ 'new_user_data' ] = '-1' )) {
             //edd_set_error( 'must_be_user', __( 'You must login or register to purchase a subscription.', 'edd-recurring') );
         }
     }
}
Example #17
File: discount-functions.php Project:
0
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
/**
  * Check whether a discount code is valid (when purchasing).
  *
  * @since 1.0
  * @param string $code Discount Code
  * @param string $user User info
  * @return bool
  */
function edd_is_discount_valid( $code = '' , $user = '' , $set_error = true)
{
     $return = false;
     $discount_id = edd_get_discount_id_by_code( $code );
     Amuri Black Shoes Z Women Sport Sandals Charcoal Xero Trek Barefoot Coal $user = trim( $user );
     if (edd_get_cart_contents()) {
         if ( $discount_id ) {
             if (edd_is_discount_active( $discount_id ) && edd_is_discount_started( $discount_id ) && !edd_is_discount_maxed_out( $discount_id ) && !edd_is_discount_used( $code , $user , $discount_id ) && edd_discount_is_min_met( $discount_id ) && edd_discount_product_reqs_met( $discount_id )) {
                 $return = true;
             }
         } elseif ( $set_error ) {
             edd_set_error( 'edd-discount-error' , __( 'This discount is invalid.' , 'edd' ));
         }
     }
     return apply_filters( 'edd_is_discount_valid' , $return , $discount_id , $code , $user );
}
Example #18
File: functions.php Project:
0
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
/**
  * Ensure cart quantities are OK
  *
  * @since       1.0.0
  * @return      void
  */
function edd_pl_checkout_errors( $valid_data , $posted )
{
     global $edd_prices_sold_out ;
     $cart = edd_get_cart_contents();
     $scope = edd_get_option( 'edd_purchase_limit_scope' ) ? edd_get_option( 'edd_purchase_limit_scope' ) : 'site-wide' ;
     $errors = array ();
     foreach ( $cart as $item ) {
         if (edd_has_variable_prices( $item [ 'id' ])) {
             if (edd_pl_is_item_sold_out( $item [ 'id' ], $item [ 'options' ][ 'price_id' ], false, false)) {
                 $errors [] = array ( 'id' => $item [ 'id' ], 'price' => $item [ 'options' ][ 'price_id' ], 'type' => Trek Amuri Women Shoes Black Coal Sport Charcoal Sandals Barefoot Z Xero 'soldout' , 'avail' => null);
             }
         } else {
             $max_purchases = edd_pl_get_file_purchase_limit( $item [ 'id' ]);
             if ( $scope == 'site-wide' ) {
                 $purchases = edd_get_download_sales_stats( $item [ 'id' ]);
                 if ( $max_purchases && $purchases >= $max_purchases || ! empty ( $edd_prices_sold_out )) {
                     $errors [] = array ( 'id' => $item [ 'id' ], 'price' => null, 'type' => 'soldout' , 'avail' => null);
                 }
             } else {
                 if (is_user_logged_in()) {
                     $purchases = edd_pl_get_user_purchase_count(get_current_user_id(), $item [ 'id' ]);
                     if ( $max_purchases && $purchases >= $max_purchases || ! empty ( $edd_prices_sold_out )) {
                         $errors [] = array ( 'id' => $item [ 'id' ], 'price' => null, 'type' => 'soldout' , 'avail' => null);
                     }
                 }
             }
         }
         if (edd_item_in_cart( $item [ 'id' ])) {
             if (edd_has_variable_prices( $item [ 'id' ])) {
                 $max_purchases = edd_pl_get_file_purchase_limit( $item [ 'id' ], null, $item [ 'options' ][ 'price_id' ]);
                 $purchases = edd_pl_get_file_purchases( $item [ 'id' ], $item [ 'options' ][ 'price_id' ]);
             }
             if ( $max_purchases > 0) {
                 $cart_qty = edd_get_cart_item_quantity( $item [ 'id' ]);
                 $total = $purchases + $cart_qty ;
                 if ( $total > $max_purchases ) {
                     $errors [] = array ( 'id' => $item [ 'id' ], 'price' => edd_has_variable_prices( $item [ 'id' ]) ? $item [ 'options' ][ 'price_id' ] : null, 'type' => 'toomany' , 'avail' => $max_purchases - $purchases );
                 }
             }
         }
     }
     if ( count ( $errors ) > 0) {
         foreach ( $errors as $error ) {
             $product = get_post( $error [ 'id' ]);
             if ( $error [ 'type' ] == 'soldout' ) {
                 edd_set_error( 'purchase_limit_reached' , sprintf(__( 'The %s "%s" is sold out!' , 'edd-purchase-limit' ), strtolower (edd_get_label_singular()), $product ->post_title));
             } elseif ( $error [ 'type' ] == 'toomany' ) {
                 edd_set_error( 'purchase_limit_exceeded' , sprintf(_n( 'There is only %s available for the %s "%s"!' , 'There are only %s available for the %s "%s"!' , $error [ 'avail' ], 'edd-purchase-limit' ), $error [ 'avail' ], strtolower (edd_get_label_singular()), $product ->post_title));
             }
         }
     }
}
Example #19
File: plugin-compatibilities.php Project:
0
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
function wppb_check_edd_login_form( $auth_cookie , $expire , $expiration , $user_id , $scheme )
{
     $wppb_generalSettings = get_option( 'wppb_general_settings' , 'not_found' );
     if ( $wppb_generalSettings != 'not_found' ) {
         if (! empty ( $wppb_generalSettings [ 'adminApproval' ]) && $wppb_generalSettings [ 'adminApproval' ] == 'yes' ) {
             if (isset( $_REQUEST [ 'edd_login_nonce' ])) {
                 if (wp_get_object_terms( $user_id , 'user_status' )) {
                     if (isset( $_REQUEST [ 'edd_redirect' ])) {
                         wp_redirect( $_REQUEST [ 'edd_redirect' ]);
                         edd_set_error( 'user_unapproved' , __( 'Your account has to be confirmed by an administrator before you can log in.' , 'profile-builder' ));
                         edd_get_errors();
                         edd_die();
                     }
                 }
             }
         }
     }
}
Example #20
File: class-checkout.php Project:
0
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
  * Check for errors with out custom fields
  *
  * @param array $valid_data Unused.
  * @param array $data The data filled in by the customer.
  */
public function validate_btw_nr( $valid_data , $data )
{
     if (! empty ( $data [ 'yst_btw' ])) {
         $vat_response = $this ->check_vat( $data [ 'billing_country' ], $data [ 'yst_btw' ]);
         if (0 === $vat_response ) {
             edd_set_error( 'yst_btw' , __( 'We cannot verify this VAT number, this means you will have to pay VAT. Please make sure you\'ve entered the number correctly.' , 'yoastcom' ));
         } elseif (2 === $vat_response ) {
             edd_set_error( 'yst_btw_unavailable' , __( 'We cannot check if your VAT number is correct because the VAT checking system for the EU is currently down. We\'re sorry for the inconvenience. Please try again later.' , 'yoastcom' ));
         }
     }
}
Example #21
File: Global_Stock.php Project:
0
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/**
  * Trigger an error if the quantity for a capped ticket is exceeded.
  *
  * @param int $product_id
  */
protected function cart_flag_capped_stock_error( $product_id )
{
     $error = new WP_Error();
     $ticket_name = get_the_title( $product_id );
     $message = sprintf(__( 'Sorry, there is insufficient stock to fulfill your order with respect to %s' , 'event-tickets-plus' ), '' . $ticket_name Shoes Women Coal Z Barefoot Sport Trek Charcoal Xero Amuri Black Sandals . '' );
     /**
      * Error message generated when an insufficiency of stock for a capped-sales ticket
      * is discovered during validation of cart item quantities.
      *
      * @param string $message
      * @param int    $product_ud
      */
     $message = apply_filters( 'tribe_tickets_plus_edd_global_stock_cart_error' , $message , $product_id );
     $error ->add( 'out-of-capped-stock-' . $product_id , $message );
     edd_set_error( 'insufficient_stock_capped_' . $product_id , $error ->get_error_message());
}
Example #22
File: process-purchase.php Project:
0
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
/**
  * Check the purchase to ensure a banned email is not allowed through
  *
  * @since       2.0
  * @return      void
  */
function edd_check_purchase_email( $valid_data , $posted )
{
     $is_banned = false;
     $banned = edd_get_banned_emails();
     if ( empty ( $banned )) {
         return ;
     }
     if (is_user_logged_in()) {
         // The user is logged in, check that their account email is not banned
         $user_data = get_userdata(get_current_user_id());
         if (edd_is_email_banned( $user_data ->user_email)) {
             $is_banned = true;
         }
         if (edd_is_email_banned( $posted [ 'edd_email' ])) {
             $is_banned = true;
         }
     } elseif (isset( $posted [ 'edd-purchase-var' ]) && $posted [ 'edd-purchase-var' ] == 'needs-to-login' ) {
         // The user is logging in, check that their email is not banned
         $user_data = get_user_by( 'login' , $posted [ 'edd_user_login' ]);
         if ( $user_data && edd_is_email_banned( $user_data ->user_email)) {
             $is_banned = true;
         }
     } else {
         // Guest purchase, check that the email is not banned
         if (edd_is_email_banned( $posted [ 'edd_email' ])) {
             $is_banned = true;
         }
     }
     if ( $is_banned ) {
         // Set an error and give the customer a general error (don't alert them that they were banned)
         edd_set_error( 'email_banned' , __( 'An internal error has occurred, please try again or contact support.' , 'easy-digital-downloads' ));
     }
}
Example #23
Black Seduce Women's Sequins Pump Pleaser 1pOqtxU File: login-register.php Project:
0
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
  * Process Register Form
  *
  * @since 2.0
  * @param array $data Data sent from the register form
  * @return void
*/
function edd_process_register_form( $data )
{
     if (is_user_logged_in()) {
         return ;
     }
     if ( empty ( $_POST [ 'edd_register_submit' ])) {
         return ;
     }
     do_action( 'edd_pre_process_register_form' );
     if ( empty ( $data [ 'edd_user_login' ])) {
         edd_set_error( 'empty_username' , __( 'Invalid username' , 'edd' ));
     }
     if (username_exists( $data [ 'edd_user_login' ])) {
         edd_set_error( 'username_unavailable' , __( 'Username already taken' , 'edd' ));
     }
     if (!validate_username( $data [ 'edd_user_login' ])) {
         edd_set_error( 'username_invalid' , __( 'Invalid username' , 'edd' ));
     }
     if (email_exists( $data [ 'edd_user_email' ])) {
         edd_set_error( 'email_unavailable' , __( 'Email address already taken' , 'edd' ));
     }
     if ( empty ( $data [ 'edd_user_email' ]) || !is_email( $data [ 'edd_user_email' ])) {
         edd_set_error( 'email_invalid' , __( 'Invalid email' , 'edd' ));
     }
     if (! empty ( $data [ 'edd_payment_email' ]) && $data [ 'edd_payment_email' ] != $data [ 'edd_user_email' ] && !is_email( $data [ 'edd_payment_email' ])) {
         edd_set_error( 'payment_email_invalid' , __( 'Invalid payment email' , 'edd' ));
     }
     if ( empty ( $_POST [ 'edd_user_pass' ])) {
         edd_set_error( 'empty_password' , __( 'Please enter a password' , 'edd' ));
     }
     if (! empty ( $_POST [ 'edd_user_pass' ]) && empty ( $_POST [ 'edd_user_pass2' ]) || $_POST [ 'edd_user_pass' ] !== $_POST [ 'edd_user_pass2' ]) {
         edd_set_error( 'password_mismatch' , __( 'Passwords do not match' , 'edd' ));
     }
     do_action( 'edd_process_register_form' );
     // Check for errors and redirect if none present
     $errors = edd_get_errors();
     if ( empty ( $errors )) {
         $redirect = apply_filters( 'edd_register_redirect' , $data [ 'edd_redirect' ]);
         edd_register_and_login_new_user( array ( 'user_login' => $data [ 'edd_user_login' ], 'user_pass' => $data [ 'edd_user_pass' ], 'user_email' => $data [ 'edd_user_email' ], 'user_registered' => date ( 'Y-m-d H:i:s' ), 'role' => get_option( 'default_role' )));
         wp_redirect( $redirect );
         edd_die();
     }
}
Example #24
File: actions.php Project:
0
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/**
  * Process the payment details edit
  *
  * @access      private
  * @since       1.9
  * @return      void
*/
function edd_update_payment_details( $data )
{
     if (!current_user_can( 'edit_shop_payments' , $data [ 'edd_payment_id' ])) {
         wp_die(__( 'You do not have permission to edit this payment record' , 'easy-digital-downloads' ), __( 'Error' , 'easy-digital-downloads' ), array ( 'response' => 403));
     }
     check_admin_referer( 'edd_update_payment_details_nonce' );
     // Retrieve the payment ID
     $payment_id = absint( $data [ 'edd_payment_id' ]);
     $payment = new EDD_Payment( $payment_id );
     // Retrieve existing payment meta
     $meta = $payment ->get_meta();
     $user_info = $payment ->user_info;
     $status = $data [ 'edd-payment-status' ];
     $unlimited = isset( $data [ 'edd-unlimited-downloads' ]) ? '1' : '' ;
     $date = sanitize_text_field( $data [ 'edd-payment-date' ]);
     $hour = sanitize_text_field( $data [ 'edd-payment-time-hour' ]);
     // Restrict to our high and low
     if ( $hour > 23) {
         $hour = 23;
     } elseif ( $hour < 0) {
         $hour = 00;
     }
     $minute = sanitize_text_field( $data [ 'edd-payment-time-min' ]);
     // Restrict to our high and low
     if ( $minute > 59) {
         $minute = 59;
     } elseif ( $minute < 0) {
         $minute = 00;
     }
     $address = array_map ( 'trim' , $data [ 'edd-payment-address' ][0]);
     $curr_total = edd_sanitize_amount( $payment ->total);
     $new_total = edd_sanitize_amount( $_POST [ 'edd-payment-total' ]);
     $tax = isset( $_POST [ 'edd-payment-tax' ]) ? edd_sanitize_amount( $_POST [ 'edd-payment-tax' ]) : 0;
     $date = date ( 'Y-m-d' , strtotime ( $date )) . ' ' . $hour . ':' . $minute . ':00' ;
     $curr_customer_id = sanitize_text_field( $data [ 'edd-current-customer' ]);
     $new_customer_id = sanitize_text_field( $data [ 'customer-id' ]);
     // Setup purchased Downloads and price options
     $updated_downloads = isset( $_POST [ 'edd-payment-details-downloads' ]) ? $_POST [ 'edd-payment-details-downloads' ] : false;
     if ( $updated_downloads && ! empty ( $_POST [ 'edd-payment-downloads-changed' ])) {
         foreach ( $updated_downloads as $download ) {
             // If this item doesn't have a log yet, add one for each quantity count
             $has_log = absint( $download [ 'has_log' ]);
             $has_log = empty ( $has_log ) ? false : true;
             if ( $has_log ) {
                 continue ;
             }
             if ( empty ( $download [ 'item_price' ])) {
                 $download [ 'item_price' ] = 0.0;
             }
             $item_price = $download [ 'item_price' ];
             $download_id = absint( $download [ 'id' ]);
             $quantity = absint( $download [ 'quantity' ]) > 0 ? absint( $download [ 'quantity' ]) : 1;
             $price_id = false;
             if (edd_has_variable_prices( $download_id ) && isset( $download [ 'price_id' ])) {
                 $price_id = absint( $download [ 'price_id' ]);
             }
             // Set some defaults
             $args = array ( 'quantity' => $quantity , 'item_price' => $item_price , 'price_id' => $price_id );
             $payment ->add_download( $download_id , $args );
         }
         $deleted_downloads = json_decode( stripcslashes ( $data [ 'edd-payment-removed' ]), true);
         foreach ( $deleted_downloads as $deleted_download ) {
             $deleted_download = $deleted_download [0];
             if ( empty ( $deleted_download [ 'id' ])) {
                 continue ;
             }
             $price_id = empty ( $deleted_download [ 'price_id' ]) ? 0 : (int) $deleted_download [ 'price_id' ];
             $args = array ( 'quantity' => (int) $deleted_download [ 'quantity' ], 'price_id' => (int) $price_id , 'item_price' => (double) $deleted_download [ 'amount' ]);
             $payment ->remove_download( $deleted_download [ 'id' ], $args );
             do_action( 'edd_remove_download_from_payment' , $payment_id , $deleted_download [ 'id' ]);
         }
     }
     do_action( 'edd_update_edited_purchase' , $payment_id );
     $payment -> date = $date ;
     $updated = $payment ->save();
     if (0 === $updated ) {
         wp_die(__( 'Error Updating Payment' , 'easy-digital-downloads' ), __( 'Error' , 'easy-digital-downloads' ), array ( 'response' => 400));
     }
     $customer_changed = false;
     if (isset( $data [ 'edd-new-customer' ]) && $data [ 'edd-new-customer' ] == '1' ) {
         $email = isset( $data [ 'edd-new-customer-email' ]) ? sanitize_text_field( $data [ 'edd-new-customer-email' ]) : '' ;
         $names = isset( $data [ 'edd-new-customer-name' ]) ? sanitize_text_field( $data [ 'edd-new-customer-name' ]) : '' ;
         if ( empty ( $email ) || empty ( $names )) {
             wp_die(__( 'New Customers require a name and email address' , 'easy-digital-downloads' ));
         }
         $customer = new EDD_Customer( $email );
         if ( empty ( $customer ->id)) {
             $customer_data = array ( 'name' => $names , 'email' => $email );
             $user_id = email_exists( $email );
             if (false !== $user_id ) {
                 $customer_data [ 'user_id' ] = $user_id ;
             }
             if (! $customer ->create( $customer_data )) {
                 // Failed to crete the new customer, assume the previous customer
                 $customer_changed = false;
                 $customer = new EDD_Customer( $curr_customer_id );
                 edd_set_error( 'edd-payment-new-customer-fail' , __( 'Error creating new customer' , 'easy-digital-downloads' ));
             }
         }
         $new_customer_id = $customer ->id;
         $previous_customer = new EDD_Customer( $curr_customer_id );
         $customer_changed = true;
     } elseif ( $curr_customer_id !== $new_customer_id ) {
         $customer = new EDD_Customer( $new_customer_id );
         $email = $customer ->email;
         $names = $customer ->name;
         $previous_customer = new EDD_Customer( $curr_customer_id );
         $customer_changed = true;
     } else {
         Z Barefoot Xero Amuri Women Trek Coal Sandals Black Sport Charcoal Shoes $customer = new EDD_Customer( $curr_customer_id );
         $email = $customer ->email;
         $names = $customer ->name;
     }
     // Setup first and last name from input values
     $names = explode ( ' ' , $names );
     $first_name = ! empty ( $names [0]) ? $names [0] : '' ;
     $last_name = '' ;
     if (! empty ( $names [1])) {
         unset( $names [0]);
         $last_name = implode( ' ' , $names );
     }
     if ( $customer_changed ) {
         // Remove the stats and payment from the previous customer and attach it to the new customer
         $previous_customer ->remove_payment( $payment_id , false);
         $customer ->attach_payment( $payment_id , false);
         // If purchase was completed and not ever refunded, adjust stats of customers
         if ( 'revoked' == $status || 'publish' == $status ) {
             $previous_customer ->decrease_purchase_count();
             $previous_customer ->decrease_value( $new_total );
             $customer ->increase_purchase_count();
             $customer ->increase_value( $new_total );
         }
         $payment ->customer_id = $customer ->id;
     }
     // Set new meta values
     $payment ->user_id = $customer ->user_id;
     $payment ->email = $customer ->email;
     $payment ->first_name = $first_name ;
     $payment ->last_name = $last_name ;
     $payment ->address = $address ;
     $payment ->total = $new_total ;
     $payment ->tax = $tax ;
     $payment ->has_unlimited_downloads = $unlimited ;
     // Check for payment notes
     if (! empty ( $data [ 'edd-payment-note' ])) {
         $note = wp_kses( $data [ 'edd-payment-note' ], array ());
         edd_insert_payment_note( $payment ->ID, $note );
     }
     // Set new status
     $payment ->status = $status ;
     // Adjust total store earnings if the payment total has been changed
     Sandals Barefoot Amuri Women Shoes Xero Black Trek Charcoal Coal Sport Z if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status )) {
         if ( $new_total > $curr_total ) {
             // Increase if our new total is higher
             $difference = $new_total - $curr_total ;
             edd_increase_total_earnings( $difference );
         } Trek Sport Coal Black Amuri Charcoal Xero Barefoot Z Shoes Sandals Women elseif ( $curr_total > $new_total ) {
             // Decrease if our new total is lower
             $difference = $curr_total - $new_total ;
             edd_decrease_total_earnings( $difference );
         }
     }
     $payment ->save();
     do_action( 'edd_updated_edited_purchase' , $payment_id );
     wp_safe_redirect(admin_url( 'edit.php?post_type=download&page=edd-payment-history&view=view-order-details&edd-message=payment-updated&id=' . $payment_id ));
     exit ;
}
Example #25
Women's Boots Lace Blue Pu Closed Heels Solid Up Kitten Round Toe WeenFashion dX0vnPd File: paypal_adaptive_payments.php Project:
0
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/**
  * Hide the submission form if needed.
  *
  * @since Astoundify Crowdfunding 1.3
  *
  * @param boolean $show
  * @return void
  */
function atcf_gateway_pap_shortcode_submit_hide( $show )
{
     global $edd_options ;
     if (!is_user_logged_in()) {
         return $show ;
     }
     if (!isset( $edd_options [ 'epap_campaigns_per_year' ])) {
         return $show ;
     }
     $user = wp_get_current_user();
     $submitted = $user ->get( 'atcf_campaigns_created' );
     $year = date ( 'Y' );
     $this_year = isset( $submitted [ $year ]) ? $submitted [ $year ] : 0;
     if ( Sandals Coal Shoes Amuri Trek Xero Black Z Barefoot Sport Women Charcoal $this_year == $edd_options [ 'epap_campaigns_per_year' ]) {
         edd_set_error( 'campaign-limit-reached' , __( 'You have submitted the maximum number of campaigns allowed for this year.' , 'atcf' ));
         return true;
     }
     return $show ;
}
Example #26
Cognac Velvet Clog up Women's Leather Wolky qxH0w6HR File: edd-pagseguro-gateway.php Project:
0
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
/**
  * Process Payment
  *
  * Process payments trough the PagSeguro gateway.
  *
  * @return   void
  * @since    1.0
  */
function process_payment( $purchase_data )
{
     global $edd_options ;
     // check there is a gateway name
     if (!isset( $purchase_data [ 'post_data' ][ 'edd-gateway' ])) {
         return ;
     }
     // get credentials
     $credentials = $this ->get_credentials();
     // check credentials have been set
     if ( is_null ( $credentials [ 'email' ]) || is_null ( $credentials [ 'token' ])) {
         edd_set_error(0, __( 'Please enter your PagSeguro Client Email and Token in settings' , Shoes Women Sandals Coal Amuri Charcoal Barefoot Xero Z Black Trek Sport 'edd-pagseguro-gateway' ));
         edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
     }
     // get payment
     $payment_data = array ( 'price' => $purchase_data [ 'price' ], 'date' => $purchase_data [ 'date' ], 'user_email' => $purchase_data [ 'user_email' ], 'purchase_key' => $purchase_data [ 'purchase_key' ], 'currency' => edd_get_option( 'currency' , 'BRL' ), 'downloads' => $purchase_data [ 'downloads' ], 'user_info' => $purchase_data [ 'user_info' ], 'cart_details' => $purchase_data [ 'cart_details' ], 'status' => 'pending' );
     // insert pending payment
     $payment = edd_insert_payment( $payment_data );
     if (! $payment ) {
         // problems? send back
         edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
     } else {
         // require PagSeguro files
         $this ->load_pagseguro_sdk();
         // verify classes exists
         if (! class_exists ( 'PagSeguroPaymentRequest' )) {
             edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
         }
         // create payment request
         $paymentRequest = new PagSeguroPaymentRequest();
         // sets the currency
         $paymentRequest ->setCurrency( 'BRL' );
         // cart summary
         $cart_summary = edd_get_purchase_summary( $purchase_data , false);
         // format total price
         $total_price = number_format( $purchase_data [ 'price' ], 2, '.' , '' );
         // payment request details
         $paymentRequest ->addItem( '01' , sanitize_text_field( substr ( $cart_summary , 0, 95)), '1' , strval ( $total_price ));
         // sets the reference code for this request
         $paymentRequest ->setReference( $payment );
         // sets customer information
         $paymentRequest ->setSender(sanitize_text_field( $purchase_data [ 'user_info' ][ 'first_name' ] . ' ' . $purchase_data [ 'user_info' ][ 'last_name' ]), $purchase_data [ 'user_email' ]);
         // redirect url
         $paymentRequest ->setRedirectUrl(add_query_arg( 'payment-confirmation' , 'pagseguro' , edd_get_success_page_uri()));
         // IPN URL
         $paymentRequest ->addParameter( 'notificationURL' , get_site_url());
         /* TRY CHECKOUT */
         try {
             // generate credentials
             $credentials = new PagSeguroAccountCredentials( $credentials [ 'email' ], $credentials [ 'token' ]);
             // register this payment request in PagSeguro, to obtain the payment URL for redirect your customer
             $checkout_uri = $paymentRequest ->register( $credentials );
             if ( gettype ( $checkout_uri ) != 'string' ) {
                 throw new exception( $checkout_uri );
             }
             // empty cart
             edd_empty_cart();
             // send the user to PagSeguro
             wp_redirect( $checkout_uri );
             die ;
         } catch (Exception $e ) {
             //catch exception
             wp_mail(get_bloginfo( 'admin_email' ), __( 'PagSeguro Checkout Error' , 'edd-pagseguro-gateway' ), $e ->getMessage());
             edd_set_error( 'pagseguro_exception' , $e ->getMessage());
             edd_send_back_to_checkout( '?payment-mode=' . $purchase_data [ 'post_data' ][ 'edd-gateway' ]);
Fashion Women Toe Pumps KemeKiss Claret Pointed 56wxqHUU
         }
     }
}
Example #27
File: customers.php Project:
0
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/**
  * Renders the customer view wrapper
  *
  * @since  2.3
  * @param  string $view      The View being requested
  * @param  array $callbacks  The Registered views and their callback functions
  * @return void
  */
function edd_render_customer_view( $view , $callbacks )
{
     $render = true;
     $customer_view_role = apply_filters( 'edd_view_customers_role' , 'view_shop_reports' );
     if (!current_user_can( $customer_view_role )) {
         edd_set_error( 'edd-no-access' , __( 'You are not permitted to view this data.' , 'edd' ));
         $render = false;
     }
     if (!isset( $_GET [ 'id' ]) || ! is_numeric ( $_GET [ 'id' ])) {
         edd_set_error( 'edd-invalid_customer' , __( 'Invalid Customer ID Provided.' , 'edd' ));
         $render = false;
     }
     $customer_id = (int) $_GET [ 'id' ];
     $customer = new EDD_Customer( $customer_id );
     if ( empty ( $customer ->id)) {
         edd_set_error( 'edd-invalid_customer' , __( 'Invalid Customer ID Provided.' , 'edd' ));
         $render = false;
     }
     $customer_tabs = edd_customer_tabs();
     ?>
 
    
class = 'wrap' >
        

     _e( 'Customer Details' , 'edd' );
     ?>
        
     if (edd_get_errors()) {
         ?>
            
class = "error settings-error" >
                
         edd_print_errors();
         ?>
            
        
     }
     ?>
 
        
     if ( $customer && $render ) {
         ?>
 
            
"customer-tab-wrapper" >
                
    "customer-tab-wrapper-list" >
                
         foreach ( $customer_tabs as $key => $tab ) {
             ?>
                    
             $active = $key === $view ? true : false;
             ?>
                    
             $class = $active ? 'active' : 'inactive' ;
             ?>
 
                    
             if (! $active ) {
                 ?>
                    
             }
             ?>
 
                
         }
         ?>
                
            
 
            
"edd-customer-card-wrapper" style= "float: left" >
                
         $callbacks [ $view ]( $customer );
         ?>
            
 
        
     }
     ?>
 
    
    
}
Example #28
File: amazon-payments.php Project:
0
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
/**
  * Process the purchase and create the charge in Amazon
  *
  * @access public
  * @since  2.4
  * @param  $purchase_data array Cart details
  * @return void
  */
public function process_purchase( $purchase_data )
{
     if ( empty ( $purchase_data [ 'post_data'Women's Nd54 Stella Flat Naturalista Pleasant El Sandal Black Piedra HqEa5W ][ 'edd_amazon_reference_id' ])) {
         edd_set_error( 'missing_reference_id' , __( 'Missing Reference ID, please try again' , 'edd' ));
     }
     $errors = edd_get_errors();
     if ( $errors ) {
         edd_send_back_to_checkout( '?payment-mode=amazon' );
     }
     $args = apply_filters( 'edd_amazon_charge_args' , array ( 'merchant_id' => edd_get_option( 'amazon_seller_id' , '' ), 'amazon_reference_id' => $purchase_data [ 'post_data' ][ 'edd_amazon_reference_id' ], 'authorization_reference_id' => $purchase_data [ 'purchase_key' ], 'charge_amount' => $purchase_data [ 'price' ], 'currency_code' => edd_get_currency(), 'charge_note' => html_entity_decode(edd_get_purchase_summary( $purchase_data , false)), 'charge_order_id' => $purchase_data [ 'purchase_key' ], 'store_name' => remove_accents(wp_specialchars_decode(get_bloginfo( 'name' ), ENT_QUOTES)), 'transaction_timeout' => 0), $purchase_data );
     $args [ 'platform_id' ] = 'A3JST9YM1SX7LB' ;
     $charge = $this ->client->charge( $args );
     if (200 == $charge ->response[ 'Status' ]) {
         $charge = new ResponseParser( $charge ->response);
         $charge = $charge ->toArray();
         $status = $charge [ 'AuthorizeResult' ][ 'AuthorizationDetails' ][ 'AuthorizationStatus' ][ 'State' ];
         if ( 'Declined' === $status ) {
             $reason = $charge [ 'AuthorizeResult' ][ 'AuthorizationDetails' ][ 'AuthorizationStatus' ][ 'ReasonCode' ];
             edd_set_error( 'payment_declined' , sprintf(__( 'Your payment could not be authorized, please try a different payment method. Reason: %s' , 'edd' ), $reason ));
             edd_send_back_to_checkout( '?payment-mode=amazon&amazon_reference_id=' . $purchase_data [ 'post_data' ][ 'edd_amazon_reference_id' ]);
         }
         // Setup payment data to be recorded
         $payment_data = array ( 'price' => $purchase_data [ 'price' ], 'date' => $purchase_data [ 'date' ], 'user_email' => $purchase_data [ 'user_email' ], 'purchase_key' => $purchase_data [ 'purchase_key' ], 'currency' => edd_get_currency(), 'downloads' => $purchase_data [ 'downloads' ], 'user_info' => $purchase_data [ 'user_info' ], 'cart_details' => $purchase_data [ 'cart_details' ], 'gateway' => $this ->gateway_id, 'status' => 'pending' );
         $payment_id = edd_insert_payment( $payment_data );
         $authorization_id = $charge [ 'AuthorizeResult' ][ 'AuthorizationDetails' ][ 'AmazonAuthorizationId' ];
         $capture_id = str_replace ( '-A' , '-C' , $authorization_id );
Xero Shoes Z Trek Amuri Coal Sandals Women Charcoal Sport Barefoot Black          $reference_id = sanitize_text_field( $_POST [ 'edd_amazon_reference_id' ]);
         // Confirm the capture was completed
         $capture = $this ->client->getCaptureDetails( array ( 'merchant_id' => edd_get_option( 'amazon_seller_id' , '' ), 'amazon_capture_id' => $capture_id ));
         $capture = new ResponseParser( $capture ->response);
         $capture = $capture ->toArray();
         // Check capture status
         edd_update_payment_meta( $payment_id , '_edd_amazon_authorization_id' , $authorization_id );
         edd_update_payment_meta( $payment_id , '_edd_amazon_capture_id' , $capture_id );
         edd_set_payment_transaction_id( $payment_id , $reference_id );
         edd_update_payment_status( $payment_id , 'publish' );
         // Empty the shopping cart
         edd_empty_cart();
         edd_send_to_success_page();
     } else {
         // Set an error
         edd_set_error( 'amazon_error' , sprintf(__( 'There was an issue processing your payment. Amazon error: %s' , 'edd' ), print_r( $charge , true)));
         edd_send_back_to_checkout( '?payment-mode=amazon&amazon_reference_id=' . $purchase_data [ 'post_data' ][ 'edd_amazon_reference_id' ]);
     }
}
Example #29
Ankle Greystone Raina Camuto Bootie Vince Women's SqwRp8qOW File: edd-simple-shipping.php Project:
0
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
/**
  * Perform error checks during checkout
  *
  * @since 1.0
  *
  * @access public
  * @return void
  */
public function error_checks( $valid_data , $post_data )
{
     // Only perform error checks if we have a product that needs shipping
     if (! $this ->cart_needs_shipping()) {
         return ;
     }
     // Check to see if shipping is different than billing
     if (isset( $post_data [ 'edd_use_different_shipping' ]) || ! $this ->has_billing_fields()) {
         Shoes Coal Women Amuri Xero Sandals Black Trek Barefoot Z Sport Charcoal // Shipping address is different
         if ( empty ( $post_data [ 'shipping_address' ])) {
             edd_set_error( 'missing_address' , __( 'Please enter a shipping address' , 'edd-simple-shipping' ));
         }
         if ( empty ( $post_data [ 'shipping_city' ])) {
             edd_set_error( 'missing_city' , __( 'Please enter a city for shipping' , 'edd-simple-shipping' ));
         }
         if ( empty ( $post_data [ 'shipping_zip' ])) {
             edd_set_error( 'missing_zip' , __( 'Please enter a zip/postal code for shipping' , 'edd-simple-shipping' ));
         }
     } else {
         // Shipping address is the same as billing
         if ( empty ( $post_data [ 'card_address' ])) {
             edd_set_error( 'missing_address' , __( 'Please enter a shipping address' , 'edd-simple-shipping' ));
Slip Walking Men's Stone Go 3 Performance Shoe Walk On Skechers wXpPS6qp
         }
         if ( empty ( $post_data [ 'card_city' ])) {
             edd_set_error( 'missing_city' , __( 'Please enter a city for shipping' , 'edd-simple-shipping' ));
         Barefoot Amuri Coal Women Charcoal Sandals Black Trek Xero Sport Shoes Z }
         if ( empty ( $post_data [ 'card_zip' ])) {
             edd_set_error( 'missing_zip' , __( 'Please enter a zip/postal code for shipping' , 'edd-simple-shipping' ));
         }
     }
}
Example #30
File: shortcodes.php Project:
0
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
/**
  * Process Profile Updater Form
  *
  * Processes the profile updater form by updating the necessary fields
  *
  * @access      private
  * @since       1.4
  * @author      Sunny Ratilal
*/
function edd_process_profile_editor_updates( $data )
{
     if ( $_SERVER [ 'REQUEST_METHOD' ] == 'POST' && isset( $data [ 'edd_profile_editor_submit' ]) && wp_verify_nonce( $data [ 'edd_profile_editor_nonce' ], 'edd-profile-editor-nonce' ) && is_user_logged_in()) {
         $user_id = get_current_user_id();
         if (! empty ( $data [ 'edd_first_name' ]) || ! empty ( Shoes Amuri Charcoal Xero Black Women Z Sandals Barefoot Sport Coal Trek $data [ 'edd_last_name' ])) {
             $first_name = sanitize_text_field( $data [ 'edd_first_name' ]);
             $last_name = sanitize_text_field( $data [ 'edd_last_name' ]);
         }
         if (! empty ( $data [ 'edd_display_name' ])) {
             $display_name = sanitize_text_field( $data [ 'edd_display_name' ]);
         }
         if (! empty ( $data [ 'edd_email' ])) {
             $email = sanitize_email( $data [ 'edd_email' ]);
         }
         if (! empty ( $data [ 'edd_new_user_pass1' ]) && ! empty ( $data [ 'edd_new_user_pass2' ])) {
             if ( $data [ 'edd_new_user_pass1' ] !== $data [ 'edd_new_user_pass2' ]) {
                 edd_set_error( 'password_mismatch' , __( 'The passwords you entered do not match. Please try again.' , 'edd' ));
             } else {
                 wp_set_password( $data [ 'edd_new_user_pass1' ], $user_id );
                 $updated = true;
             }
         }
         // Update user
         $updated = wp_update_user( array ( 'ID' => $user_id , 'first_name' => $first_name , 'last_name' => $last_name , 'display_name' => $display_name , 'user_email' => $email ));
         if ( $updated ) {
             wp_redirect(add_query_arg( 'updated' , 'true' , $data [ 'edd_redirect' ]));
             exit ;
         }
     } else {
         wp_die(__( 'Security check failed. Please try again.' , 'edd' ), __( 'Security Check Failed' , 'edd' ));
         exit ;
     }
}
Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd Shoes Charcoal Barefoot Z Amuri Sandals Coal Black Sport Women Trek Xero 7dBwqUd