Using a create_preference() function within MP class.
[18-Apr-2013 15:39:33] create preference response: Array
(
[status] => 201
[response] => Array
| <?php | |
| /* | |
| Usage: | |
| $frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
| if ( !$frag->output() ) { // NOTE, testing for a return of false | |
| functions_that_do_stuff_live(); | |
| these_should_echo(); | |
| // IMPORTANT | |
| $frag->store(); | |
| // YOU CANNOT FORGET THIS. If you do, the site will break. |
| <?php | |
| remove_all_filters( 'group_buying_template_checkout/review-controls.php' ); | |
| add_filter( 'group_buying_template_checkout/review-controls.php', 'new_paypal_controls' ); | |
| function new_paypal_controls() { | |
| echo '<div class="checkout-controls"> | |
| <input type="hidden" name="" value="'.Group_Buying_Offsite_Processors::CHECKOUT_ACTION.'"> | |
| <input class="form-submit submit checkout_next_step" type="submit" value="'.gb__( 'NEW!' ).'" name="gb_checkout_button" /> | |
| </div>'; | |
| } |
| add_action( 'template_redirect', 'redirect_away_from_checkout' ); | |
| function redirect_away_from_checkout() { | |
| if ( !is_user_logged_in() && gb_on_checkout_page() ) { | |
| wp_redirect( add_query_arg( array( 'redirect_to' => gb_get_checkout_url() ), gb_get_account_login_url() ) ); | |
| exit(); | |
| } | |
| } |
| <canvas id="invoice_status_chart" min-height="300" max-height="500"></canvas> | |
| <script type="text/javascript" charset="utf-8"> | |
| var invoice_status_data = {}; | |
| function invoice_status_chart() { | |
| var can = jQuery('#invoice_status_chart'); | |
| var ctx = can.get(0).getContext("2d"); | |
| var container = can.parent().parent(); // get width from proper parent |
| <?php | |
| /** | |
| * Add the remote form via AJAX or php get. | |
| * Shortcode is [sa-create-demo-form] | |
| * Currently no attributes are used even though they could be used | |
| * so that the $demo_url variable doesn't need to be updated manually below. | |
| * | |
| * @param array $atts shortcode atts | |
| * @return string Create demo form. | |
| */ |
| <?php | |
| /* | |
| Plugin Name: NinjaDemo AJAX Callbacks | |
| Plugin URI: https://sproutapps.co/ | |
| Description: Allow for the demo form to be remotely retreived. | |
| Author: Sprout Apps | |
| Version: 0.8 | |
| Author URI: https://sproutapps.co | |
| */ |
| <?php | |
| function filter_si_submission_form_fields( $fields = array() ) { | |
| // Remove the budget field | |
| unset( $fields['budget'] ); | |
| $fields['examples'] = array( | |
| 'weight' => 120, | |
| 'label' => __( 'Examples' ), | |
| 'type' => 'textarea', | |
| 'required' => TRUE, |
| <?php | |
| /** | |
| * Hook into si_head hook and add a new custom CSS stylesheet. | |
| * | |
| */ | |
| function si_add_stylesheet() { | |
| echo '<link rel="stylesheet" id="sprout_doc_style-css" href="'.get_stylesheet_directory_uri() . '/css/sprout-invoices.custom-style.css" type="text/css" media="all">'; | |
| } | |
| add_action( 'si_head', 'si_add_stylesheet' ); |
| <?php | |
| // filter paypal because of discount | |
| function sa_mod_paypal_gateway_data( $paypal_args = array(), $purchase_data = array() ) { | |
| if ( isset( $paypal_args['cmd'] ) && $paypal_args['cmd'] == '_xclick-subscriptions' ) { | |
| $paypal_args['sra'] = '3'; // change failed attempts. | |
| if ( $paypal_args['a3'] < 0.00 && isset( $purchase_data['discount'] ) ) { | |
| // Fix recurring amount | |
| $paypal_args['a3'] += $purchase_data['discount']; | |
| // fix single item, it matches the recurring amount. |