/**
 *  Creates a shortcode to displays a "nag" (which can be styled with CSS targeting a class of 'my-custom-nag')
 *
 *  Sample shortcodes:
 *
 *  [givetotal total_goal="10,000" link="http://example.com"] displays "So far, we have raised $0 toward our goal of $10,000! Donate now"
 *  (where "0" will be replaced with total earnings from all forms, and "Donate Now" is linked to http://example.com)
 *
 *  [givetotal form_id="34" total_goal="10,000"] will display earnings for just form with an ID of 34.
 *
 *  [givetotal total_goal="9,000" message_before="Hey! We've raised " message_between=" of the " message_after=" we are trying to raise for this campaign!" link="http://example.com" link_text="Help Us Reach Our Goal." form_id="245"]
 *
 *  [givetotal total_goal= "5,000" multi_id="34,114,141"] will display earnings for the three forms with IDs 34, 114, and 141.
 *
 *  Note that "multi_id" will override "form_id", so don't use both.
 */
function my_give_display_earnings_shortcode($atts)
{
    $total = get_option('give_earnings_total', false);
    $atts = shortcode_atts(array('total_goal' => '10,000', 'link' => false, 'form_id' => false, 'multi_id' => '', 'message_before' => 'So far, we have raised ', 'message_between' => ' toward our goal of ', 'message_after' => '! ', 'link_text' => 'Donate Now'), $atts, 'givetotal');
    $donate_link = '';
    if ($atts['link'] != false) {
        $donate_link = ' <a href="' . $atts['link'] . '">' . $atts['link_text'] . '</a>';
    }
    if ($atts['form_id'] != false && is_numeric($atts['form_id'])) {
        $total = get_post_meta($atts['form_id'], '_give_form_earnings', true);
    }
    if ($atts['multi_id'] != false) {
        $total = 0;
        $new_array = preg_split("/,/", $atts['multi_id']);
        foreach ($new_array as $value) {
            $total += get_post_meta($value, '_give_form_earnings', true);
        }
    }
    $custom_nag = "<div class='my-custom-nag'>" . $atts['message_before'] . "<span class='my-give-currency'>" . give_currency_symbol(give_get_currency()) . "</span><span class='my-give-raised my-give-amount'>" . give_format_amount($total) . "</span>" . $atts['message_between'] . "<span class='my-give-currency'>" . give_currency_symbol(give_get_currency()) . "</span><span class='my-give-total my-give-amount'>" . $atts['total_goal'] . "</span>" . $atts['message_after'] . $donate_link . "</div>";
    return $custom_nag;
}
Пример #2
0
/**
 * Define the metabox and field configurations.
 *
 * @param  array $meta_boxes
 *
 * @return array
 */
function give_single_forms_cmb2_metaboxes(array $meta_boxes)
{
    $post_id = give_get_admin_post_id();
    $price = give_get_form_price($post_id);
    $goal = give_get_form_goal($post_id);
    $variable_pricing = give_has_variable_prices($post_id);
    $prices = give_get_variable_prices($post_id);
    //No empty prices - min. 1.00 for new forms
    if (empty($price)) {
        $price = esc_attr(give_format_amount('1.00'));
    }
    // Start with an underscore to hide fields from custom fields list
    $prefix = '_give_';
    /**
     * Repeatable Field Groups
     */
    $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array('id' => 'form_field_options', 'title' => __('Donation Options', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(array('name' => __('Donation Option', 'give'), 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'), 'id' => $prefix . 'price_option', 'type' => 'radio_inline', 'default' => 'set', 'options' => apply_filters('give_forms_price_options', array('set' => __('Set Donation', 'give'), 'multi' => __('Multi-level Donation', 'give')))), array('name' => __('Set Donation', 'give'), 'description' => __('This is the set donation amount for this form.', 'give'), 'id' => $prefix . 'set_price', 'type' => 'text_small', 'row_classes' => 'give-subfield', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('1.00'), 'value' => $price, 'class' => 'cmb-type-text-small give-money-field')), array('id' => $prefix . 'levels_header', 'type' => 'levels_repeater_header'), array('id' => $prefix . 'donation_levels', 'type' => 'group', 'row_classes' => 'give-subfield', 'options' => array('add_button' => __('Add Level', 'give'), 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), 'sortable' => true), 'fields' => apply_filters('give_donation_levels_table_row', array(array('name' => __('ID', 'give'), 'id' => $prefix . 'id', 'type' => 'levels_id'), array('name' => __('Amount', 'give'), 'id' => $prefix . 'amount', 'type' => 'text_small', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('1.00'), 'class' => 'cmb-type-text-small give-money-field'), 'before' => 'give_format_admin_multilevel_amount'), array('name' => __('Text', 'give'), 'id' => $prefix . 'text', 'type' => 'text', 'attributes' => array('placeholder' => __('Donation Level', 'give'), 'rows' => 3)), array('name' => __('Default', 'give'), 'id' => $prefix . 'default', 'type' => 'give_default_radio_inline')))), array('name' => __('Display Style', 'give'), 'description' => __('Set how the donations levels will display on the form.', 'give'), 'id' => $prefix . 'display_style', 'type' => 'radio_inline', 'default' => 'buttons', 'options' => array('buttons' => __('Buttons', 'give'), 'radios' => __('Radios', 'give'), 'dropdown' => __('Dropdown', 'give'))), array('name' => __('Custom Amount', 'give'), 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), 'id' => $prefix . 'custom_amount', 'type' => 'radio_inline', 'default' => 'no', 'options' => array('yes' => __('Yes', 'give'), 'no' => __('No', 'give'))), array('name' => __('Custom Amount Text', 'give'), 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'), 'id' => $prefix . 'custom_amount_text', 'type' => 'text', 'row_classes' => 'give-subfield', 'attributes' => array('rows' => 3, 'placeholder' => __('Give a Custom Amount', 'give'))), array('name' => __('Set Goal?', 'give'), 'description' => __('Do you want to set a donation goal for this form?', 'give'), 'id' => $prefix . 'goal_option', 'type' => 'radio_inline', 'default' => 'no', 'options' => array('yes' => __('Yes', 'give'), 'no' => __('No', 'give'))), array('name' => __('Set Goal', 'give'), 'description' => __('This is the goal you want to achieve for this form.', 'give'), 'id' => $prefix . 'set_goal', 'type' => 'text_small', 'row_classes' => 'give-subfield', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('0.00'), 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', 'class' => 'cmb-type-text-small give-money-field')), array('name' => __('Goal Progress Bar Color', 'give'), 'id' => $prefix . 'goal_color', 'type' => 'colorpicker', 'row_classes' => 'give-subfield', 'default' => '#2bc253')))));
    /**
     * Content Field
     */
    $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array('id' => 'form_content_options', 'title' => __('Form Content', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(array('name' => __('Display Content', 'give'), 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), 'id' => $prefix . 'content_option', 'type' => 'select', 'options' => apply_filters('give_forms_content_options_select', array('none' => __('No content', 'give'), 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'))), 'default' => 'none'), array('name' => __('Content', 'give'), 'description' => __('This content will display on the single give form page.', 'give'), 'id' => $prefix . 'form_content', 'row_classes' => 'give-subfield', 'type' => 'wysiwyg')))));
    /**
     * Display Options
     */
    $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array('id' => 'form_display_options', 'title' => __('Form Display Options', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(array('name' => __('Payment Fields', 'give'), 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), 'id' => $prefix . 'payment_display', 'type' => 'select', 'options' => array('onpage' => __('Show on Page', 'give'), 'reveal' => __('Reveal Upon Click', 'give'), 'modal' => __('Modal Window Upon Click', 'give')), 'default' => 'onpage'), array('id' => $prefix . 'reveal_label', 'name' => __('Reveal / Modal Open Text', 'give'), 'desc' => __('The button label for completing the donation.', 'give'), 'type' => 'text_small', 'row_classes' => 'give-subfield', 'attributes' => array('placeholder' => __('Donate Now', 'give'))), array('id' => $prefix . 'checkout_label', 'name' => __('Complete Donation Text', 'give'), 'desc' => __('The button label for completing a donation.', 'give'), 'type' => 'text_small', 'attributes' => array('placeholder' => __('Donate Now', 'give'))), array('name' => __('Default Gateway', 'give'), 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), 'id' => $prefix . 'default_gateway', 'type' => 'default_gateway'), array('name' => __('Disable Guest Donations', 'give'), 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), 'id' => $prefix . 'logged_in_only', 'type' => 'checkbox'), array('name' => __('Register / Login Form', 'give'), 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'), 'id' => $prefix . 'show_register_form', 'type' => 'select', 'options' => array('both' => __('Registration and Login Forms', 'give'), 'registration' => __('Registration Form Only', 'give'), 'login' => __('Login Form Only', 'give'), 'none' => __('None', 'give')), 'default' => 'none'), array('name' => __('Floating Labels', 'give'), 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), 'id' => $prefix . 'form_floating_labels', 'type' => 'select', 'options' => array('' => __('Use the global setting', 'give'), 'enabled' => __('Enabled', 'give'), 'disabled' => __('Disabled', 'give')), 'default' => 'none')))));
    /**
     * Terms & Conditions
     */
    $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array('id' => 'form_terms_options', 'title' => __('Terms and Conditions', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(array('name' => __('Terms and Conditions', 'give'), 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), 'id' => $prefix . 'terms_option', 'type' => 'select', 'options' => apply_filters('give_forms_content_options_select', array('none' => __('No', 'give'), 'yes' => __('Yes', 'give'))), 'default' => 'none'), array('id' => $prefix . 'agree_label', 'name' => __('Agree to Terms Label', 'give'), 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), 'type' => 'text', 'row_classes' => 'give-subfield', 'size' => 'regular', 'attributes' => array('placeholder' => __('Agree to Terms?', 'give'))), array('id' => $prefix . 'agree_text', 'row_classes' => 'give-subfield', 'name' => __('Agreement Text', 'give'), 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), 'type' => 'wysiwyg')))));
    return $meta_boxes;
}
Пример #3
0
/**
 * Donation Levels Output
 *
 * Outputs donation levels based on the specific form ID.
 * The output generated can be overridden by the filters provided or by removing
 * the action and adding your own custom action.
 *
 * @since 1.0
 *
 * @param int $form_id Give Form ID
 *
 * @return void
 */
function give_output_donation_levels($form_id = 0, $args = array())
{
    global $give_options;
    $variable_pricing = give_has_variable_prices($form_id);
    $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
    $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
    $symbol = isset($give_options['currency']) ? give_currency_symbol($give_options['currency']) : '$';
    $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
    $default_amount = give_format_amount(give_get_default_form_amount($form_id));
    $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
    do_action('give_before_donation_levels', $form_id);
    //Set Price, No Custom Amount Allowed means hidden price field
    if ($allow_custom_amount == 'no') {
        ?>

		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php 
        echo $default_amount;
        ?>
" required>
		<p class="set-price give-donation-amount form-row-wide">
			<?php 
        if ($currency_position == 'before') {
            echo $currency_output;
        }
        ?>
			<span id="give-amount" class="give-text-input"><?php 
        echo give_format_amount($default_amount);
        ?>
</span>
		</p>
		<?php 
    } else {
        //Custom Amount Allowed
        ?>
		<div class="give-total-wrap">
			<div class="give-donation-amount form-row-wide">
				<?php 
        if ($currency_position == 'before') {
            echo $currency_output;
        }
        ?>

				<input class="give-text-input" id="give-amount" name="give-amount" type="text" placeholder="" value="<?php 
        echo $default_amount;
        ?>
" required autocomplete="off">

				<?php 
        if ($currency_position == 'after') {
            echo $currency_output;
        }
        ?>

				<p class="give-loading-text give-updating-price-loader" style="display: none;">
					<span class="give-loading-animation"></span> <?php 
        _e('Updating Price', 'Give');
        ?>
					<span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
			</div>
		</div>
	<?php 
    }
    //Custom Amount Text
    if (!empty($custom_amount_text) && !$variable_pricing && $allow_custom_amount == 'yes') {
        ?>
		<p class="give-custom-amount-text"><?php 
        echo $custom_amount_text;
        ?>
</p>
	<?php 
    }
    //Output Variable Pricing Levels
    if ($variable_pricing) {
        give_output_levels($form_id);
    }
    do_action('give_after_donation_levels', $form_id);
}
Пример #4
0
    ?>
												</ul>
											</div>
										<?php 
}
?>


										<div class="give-order-payment give-admin-box-inside">
											<p>
												<span class="label"><?php 
_e('Total Donation', 'give');
?>
:</span>&nbsp;
												<?php 
echo give_currency_symbol($payment_meta['currency']);
?>
&nbsp;<input name="give-payment-total" type="text" class="small-text" value="<?php 
echo esc_attr(give_format_amount(give_get_payment_amount($payment_id)));
?>
" />
											</p>
										</div>

										<?php 
do_action('give_view_order_details_totals_after', $payment_id);
?>

									</div>
									<!-- /.give-admin-box -->
Пример #5
0
 /**
  * Define General Settings Metabox and field configurations.
  *
  * Filters are provided for each settings section to allow add-ons and other plugins to add their own settings
  *
  * @param $active_tab active tab settings; null returns full array
  *
  * @return array
  */
 public function give_settings($active_tab)
 {
     $give_settings = array('general' => array('id' => 'options_page', 'give_title' => __('General Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_general', array(array('name' => __('General Settings', 'give'), 'desc' => '', 'type' => 'give_title', 'id' => 'give_title_general_settings_1'), array('name' => __('Success Page', 'give'), 'desc' => sprintf(__('This is the page donors are sent to after completing their donations. The %1$s[give_receipt]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'), 'id' => 'success_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Failed Transaction Page', 'give'), 'desc' => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), 'id' => 'failure_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Donation History Page', 'give'), 'desc' => sprintf(__('This page shows a complete donation history for the current user. The %1$s[donation_history]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'), 'id' => 'history_page', 'type' => 'select', 'options' => give_cmb2_get_post_options(array('post_type' => 'page', 'numberposts' => -1))), array('name' => __('Base Country', 'give'), 'desc' => __('Where does your site operate from?', 'give'), 'id' => 'base_country', 'type' => 'select', 'options' => give_get_country_list()), array('name' => __('Currency Settings', 'give'), 'desc' => '', 'type' => 'give_title', 'id' => 'give_title_general_settings_2'), array('name' => __('Currency', 'give'), 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', 'id' => 'currency', 'type' => 'select', 'options' => give_get_currencies(), 'default' => 'USD'), array('name' => __('Currency Position', 'give'), 'desc' => 'Choose the position of the currency sign.', 'id' => 'currency_position', 'type' => 'select', 'options' => array('before' => sprintf(__('Before - %1$s10', 'give'), give_currency_symbol(give_get_currency())), 'after' => sprintf(__('After - 10%1$s', 'give'), give_currency_symbol(give_get_currency()))), 'default' => 'before'), array('name' => __('Thousands Separator', 'give'), 'desc' => __('The symbol (typically , or .) to separate thousands', 'give'), 'id' => 'thousands_separator', 'type' => 'text_small', 'default' => ','), array('name' => __('Decimal Separator', 'give'), 'desc' => __('The symbol (usually , or .) to separate decimal points', 'give'), 'id' => 'decimal_separator', 'type' => 'text_small', 'default' => '.')))), 'gateways' => array('id' => 'options_page', 'give_title' => __('Payment Gateways', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_gateways', array(array('name' => __('Gateways Settings', 'give'), 'desc' => '', 'id' => 'give_title_gateway_settings_1', 'type' => 'give_title'), array('name' => __('Test Mode', 'give'), 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), 'id' => 'test_mode', 'type' => 'checkbox'), array('name' => __('Enabled Gateways', 'give'), 'desc' => __('Choose the payment gateways you would like enabled.', 'give'), 'id' => 'gateways', 'type' => 'enabled_gateways'), array('name' => __('Default Gateway', 'give'), 'desc' => __('This is the gateway that will be selected by default.', 'give'), 'id' => 'default_gateway', 'type' => 'default_gateway'), array('name' => __('PayPal Standard', 'give'), 'desc' => '', 'type' => 'give_title', 'id' => 'give_title_gateway_settings_2'), array('name' => __('PayPal Email', 'give'), 'desc' => __('Enter your PayPal account\'s email', 'give'), 'id' => 'paypal_email', 'type' => 'text_email'), array('name' => __('PayPal Page Style', 'give'), 'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'), 'id' => 'paypal_page_style', 'type' => 'text'), array('name' => __('PayPal Transaction Type', 'give'), 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), 'id' => 'paypal_button_type', 'type' => 'radio_inline', 'options' => array('donation' => __('Donation', 'give'), 'standard' => __('Standard Transaction', 'give')), 'default' => 'donation'), array('name' => __('Disable PayPal IPN Verification', 'give'), 'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), 'id' => 'disable_paypal_verification', 'type' => 'checkbox'), array('name' => __('Offline Donations', 'give'), 'desc' => '', 'type' => 'give_title', 'id' => 'give_title_gateway_settings_3'), array('name' => __('Collect Billing Details', 'give'), 'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), 'id' => 'give_offline_donation_enable_billing_fields', 'type' => 'checkbox'), array('name' => __('Offline Donation Instructions', 'give'), 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), 'id' => 'global_offline_donation_content', 'default' => give_get_default_offline_donation_content(), 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 6)), array('name' => __('Offline Donation Email Instructions Subject', 'give'), 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), 'id' => 'offline_donation_subject', 'default' => __('{donation} - Offline Donation Instructions', 'give'), 'type' => 'text'), array('name' => __('Offline Donation Email Instructions', 'give'), 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), 'id' => 'global_offline_donation_email', 'default' => give_get_default_offline_donation_email_content(), 'type' => 'wysiwyg', 'options' => array('textarea_rows' => 6))))), 'display' => array('id' => 'options_page', 'give_title' => __('Display Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_display', array(array('name' => __('Display Settings', 'give'), 'desc' => '', 'id' => 'give_title_display_settings_1', 'type' => 'give_title'), array('name' => __('Disable CSS', 'give'), 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), 'id' => 'disable_css', 'type' => 'checkbox'), array('name' => __('Enable Floating Labels', 'give'), 'desc' => sprintf(esc_html__('Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), '<a href="' . esc_url("http://bradfrost.com/blog/post/float-label-pattern/") . '" target="_blank">', '</a>', '<br />'), 'id' => 'enable_floatlabels', 'type' => 'checkbox'), array('name' => __('Disable Welcome Screen', 'give'), 'desc' => sprintf(esc_html__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen %1$shere%2$s if you want in the future.', 'give'), '<a href="' . esc_url(admin_url('index.php?page=give-about')) . '">', '</a>'), 'id' => 'disable_welcome', 'type' => 'checkbox'), array('name' => __('Post Types', 'give'), 'desc' => '', 'id' => 'give_title_display_settings_2', 'type' => 'give_title'), array('name' => __('Disable Form Single Views', 'give'), 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), 'id' => 'disable_forms_singular', 'type' => 'checkbox'), array('name' => __('Disable Form Archives', 'give'), 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), 'id' => 'disable_forms_archives', 'type' => 'checkbox'), array('name' => __('Disable Form Excerpts', 'give'), 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), 'id' => 'disable_forms_excerpt', 'type' => 'checkbox'), array('name' => __('Featured Image Size', 'give'), 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'), 'id' => 'featured_image_size', 'type' => 'select', 'default' => 'large', 'options' => give_get_featured_image_sizes()), array('name' => __('Disable Form Featured Image', 'give'), 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), 'id' => 'disable_form_featured_img', 'type' => 'checkbox'), array('name' => __('Disable Single Form Sidebar', 'give'), 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), 'id' => 'disable_form_sidebar', 'type' => 'checkbox'), array('name' => __('Taxonomies', 'give'), 'desc' => '', 'id' => 'give_title_display_settings_3', 'type' => 'give_title'), array('name' => __('Enable Form Categories', 'give'), 'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), 'id' => 'enable_categories', 'type' => 'checkbox'), array('name' => __('Enable Form Tags', 'give'), 'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), 'id' => 'enable_tags', 'type' => 'checkbox')))), 'emails' => array('id' => 'options_page', 'give_title' => __('Give Email Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_emails', array(array('name' => __('Email Settings', 'give'), 'desc' => '', 'id' => 'give_title_email_settings_1', 'type' => 'give_title'), array('id' => 'email_template', 'name' => __('Email Template', 'give'), 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), 'type' => 'select', 'options' => give_get_email_templates()), array('id' => 'email_logo', 'name' => __('Logo', 'give'), 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), 'type' => 'file'), array('id' => 'from_name', 'name' => __('From Name', 'give'), 'desc' => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), 'default' => get_bloginfo('name'), 'type' => 'text'), array('id' => 'from_email', 'name' => __('From Email', 'give'), 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), 'default' => get_bloginfo('admin_email'), 'type' => 'text'), array('name' => __('Donation Receipt', 'give'), 'desc' => '', 'id' => 'give_title_email_settings_2', 'type' => 'give_title'), array('id' => 'donation_subject', 'name' => __('Donation Email Subject', 'give'), 'desc' => __('Enter the subject line for the donation receipt email', 'give'), 'default' => __('Donation Receipt', 'give'), 'type' => 'text'), array('id' => 'donation_receipt', 'name' => __('Donation Receipt', 'give'), 'desc' => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give') . '<br/>' . give_get_emails_tags_list(), 'type' => 'wysiwyg', 'default' => give_get_default_donation_receipt_email()), array('name' => __('New Donation Notification', 'give'), 'desc' => '', 'id' => 'give_title_email_settings_3', 'type' => 'give_title'), array('id' => 'donation_notification_subject', 'name' => __('Donation Notification Subject', 'give'), 'desc' => __('Enter the subject line for the donation notification email', 'give'), 'type' => 'text', 'default' => __('New Donation - #{payment_id}', 'give')), array('id' => 'donation_notification', 'name' => __('Donation Notification', 'give'), 'desc' => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give') . '<br/>' . give_get_emails_tags_list(), 'type' => 'wysiwyg', 'default' => give_get_default_donation_notification_email()), array('id' => 'admin_notice_emails', 'name' => __('Donation Notification Emails', 'give'), 'desc' => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'), 'type' => 'textarea', 'default' => get_bloginfo('admin_email')), array('id' => 'disable_admin_notices', 'name' => __('Disable Admin Notifications', 'give'), 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), 'type' => 'checkbox')))), 'addons' => array('id' => 'options_page', 'give_title' => __('Give Add-ons Settings', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_addons', array())), 'licenses' => array('id' => 'options_page', 'give_title' => __('Give Licenses', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_licenses', array())), 'advanced' => array('id' => 'options_page', 'give_title' => __('Advanced Options', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_advanced', array(array('name' => __('Access Control', 'give'), 'desc' => '', 'id' => 'give_title_session_control_1', 'type' => 'give_title'), array('id' => 'session_lifetime', 'name' => __('Session Lifetime', 'give'), 'desc' => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'), 'type' => 'select', 'options' => array('86400' => __('24 Hours', 'give'), '172800' => __('48 Hours', 'give'), '259200' => __('72 Hours', 'give'), '604800' => __('1 Week', 'give'))), array('name' => __('Email Access', 'give'), 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), 'id' => 'email_access', 'type' => 'checkbox'), array('id' => 'recaptcha_key', 'name' => __('reCAPTCHA Site Key', 'give'), 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>'), 'default' => '', 'type' => 'text'), array('id' => 'recaptcha_secret', 'name' => __('reCAPTCHA Secret Key', 'give'), 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), 'default' => '', 'type' => 'text'), array('name' => __('Data Control', 'give'), 'desc' => '', 'id' => 'give_title_data_control_2', 'type' => 'give_title'), array('name' => __('Remove All Data on Uninstall?', 'give'), 'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), 'id' => 'uninstall_on_delete', 'type' => 'checkbox'), array('name' => __('Filter Control', 'give'), 'desc' => '', 'id' => 'give_title_filter_control', 'type' => 'give_title'), array('name' => __('Disable <code>the_content</code> filter', 'give'), 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')), 'id' => 'disable_the_content_filter', 'type' => 'checkbox'), array('name' => __('Script Loading', 'give'), 'desc' => '', 'id' => 'give_title_script_control', 'type' => 'give_title'), array('name' => __('Load Scripts in Footer?', 'give'), 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), 'id' => 'scripts_footer', 'type' => 'checkbox')))), 'api' => array('id' => 'options_page', 'give_title' => __('API', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'show_names' => false, 'fields' => apply_filters('give_settings_system', array(array('id' => 'api', 'name' => __('API', 'give'), 'type' => 'api')))), 'system_info' => array('id' => 'options_page', 'give_title' => __('System Info', 'give'), 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), 'fields' => apply_filters('give_settings_system', array(array('id' => 'system_info', 'name' => __('System Info', 'give'), 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), 'type' => 'system_info')))));
     //Return all settings array if necessary
     if ($active_tab === null || !isset($give_settings[$active_tab])) {
         return apply_filters('give_registered_settings', $give_settings);
     }
     // Add other tabs and settings fields as needed
     return apply_filters('give_registered_settings', $give_settings[$active_tab]);
 }
Пример #6
0
/**
 * Formats the currency display
 *
 * @since 1.0
 *
 * @param string $price
 * @param string $currency
 *
 * @return mixed|string|void
 */
function give_currency_filter($price = '', $currency = '')
{
    if (empty($currency)) {
        $currency = give_get_currency();
    }
    $position = give_get_option('currency_position', 'before');
    $negative = $price < 0;
    if ($negative) {
        $price = substr($price, 1);
        // Remove proceeding "-" -
    }
    $symbol = give_currency_symbol($currency);
    if ($position == 'before') {
        switch ($currency) {
            case 'GBP':
            case 'BRL':
            case 'EUR':
            case 'USD':
            case 'AUD':
            case 'CAD':
            case 'HKD':
            case 'MXN':
            case 'NZD':
            case 'SGD':
            case 'JPY':
            case 'THB':
            case 'INR':
            case 'RIAL':
            case 'TRY':
            case 'RUB':
            case 'SEK':
            case 'PLN':
            case 'PHP':
            case 'TWD':
            case 'MYR':
            case 'CZK':
            case 'DKK':
            case 'HUF':
            case 'ILS':
                $formatted = $symbol . $price;
                break;
            case 'NOK':
                $formatted = $symbol . ' ' . $price;
                break;
            default:
                $formatted = $currency . ' ' . $price;
                break;
        }
        $formatted = apply_filters('give_' . strtolower($currency) . '_currency_filter_before', $formatted, $currency, $price);
    } else {
        switch ($currency) {
            case 'GBP':
            case 'BRL':
            case 'EUR':
            case 'USD':
            case 'AUD':
            case 'CAD':
            case 'HKD':
            case 'MXN':
            case 'SGD':
            case 'JPY':
            case 'THB':
            case 'INR':
            case 'RIAL':
            case 'TRY':
            case 'RUB':
            case 'SEK':
            case 'PLN':
            case 'PHP':
            case 'TWD':
            case 'CZK':
            case 'DKK':
            case 'HUF':
            case 'MYR':
            case 'ILS':
                $formatted = $price . $symbol;
                break;
            default:
                $formatted = $price . ' ' . $currency;
                break;
        }
        $formatted = apply_filters('give_' . strtolower($currency) . '_currency_filter_after', $formatted, $currency, $price);
    }
    if ($negative) {
        // Prepend the mins sign before the currency sign
        $formatted = '-' . $formatted;
    }
    return $formatted;
}
Пример #7
0
/**
 * Donation Amount Field
 *
 * Outputs the donation amount field that appears at the top of the donation forms. If the user has custom amount enabled the field will output as a customizable input
 *
 * @since  1.0
 *
 * @param  int   $form_id Give Form ID
 * @param  array $args
 *
 * @return void
 */
function give_output_donation_amount_top($form_id = 0, $args = array())
{
    global $give_options;
    $variable_pricing = give_has_variable_prices($form_id);
    $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
    $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
    $symbol = give_currency_symbol(give_get_currency());
    $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
    $default_amount = give_format_amount(give_get_default_form_amount($form_id));
    $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
    do_action('give_before_donation_levels', $form_id, $args);
    //Set Price, No Custom Amount Allowed means hidden price field
    if ($allow_custom_amount == 'no') {
        ?>

		<label class="give-hidden" for="give-amount-hidden"><?php 
        echo esc_html__('Donation Amount:', 'give');
        ?>
</label>
		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
		       value="<?php 
        echo $default_amount;
        ?>
" required>
		<div class="set-price give-donation-amount form-row-wide">
			<?php 
        if ($currency_position == 'before') {
            echo $currency_output;
        }
        ?>
			<span id="give-amount-text" class="give-text-input give-amount-top"><?php 
        echo $default_amount;
        ?>
</span>
			<?php 
        if ($currency_position == 'after') {
            echo $currency_output;
        }
        ?>
		</div>
		<?php 
    } else {
        //Custom Amount Allowed
        ?>
		<div class="give-total-wrap">
			<div class="give-donation-amount form-row-wide">
				<?php 
        if ($currency_position == 'before') {
            echo $currency_output;
        }
        ?>
				<label class="give-hidden" for="give-amount"><?php 
        echo esc_html__('Donation Amount:', 'give');
        ?>
</label>
				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php 
        echo $default_amount;
        ?>
" autocomplete="off">
				<?php 
        if ($currency_position == 'after') {
            echo $currency_output;
        }
        ?>
			</div>
		</div>
	<?php 
    }
    do_action('give_after_donation_amount', $form_id, $args);
    //Custom Amount Text
    if (!$variable_pricing && $allow_custom_amount == 'yes' && !empty($custom_amount_text)) {
        ?>
		<p class="give-custom-amount-text"><?php 
        echo $custom_amount_text;
        ?>
</p>
	<?php 
    }
    //Output Variable Pricing Levels
    if ($variable_pricing) {
        give_output_levels($form_id);
    }
    do_action('give_after_donation_levels', $form_id, $args);
}
Пример #8
0
/**
 * Formats the currency display
 *
 * @since 1.0
 *
 * @param string $price Price
 *
 * @return array $currency Currencies displayed correctly
 */
function give_currency_filter($price = '', $currency = '')
{
    if (empty($currency)) {
        $currency = give_get_currency();
    }
    $position = give_get_option('currency_position', 'before');
    $negative = $price < 0;
    if ($negative) {
        $price = substr($price, 1);
        // Remove proceeding "-" -
    }
    $symbol = give_currency_symbol($currency);
    if ($position == 'before') {
        switch ($currency) {
            case "GBP":
            case "BRL":
            case "EUR":
            case "USD":
            case "AUD":
            case "CAD":
            case "HKD":
            case "MXN":
            case "NZD":
            case "SGD":
            case "JPY":
                $formatted = $symbol . $price;
                break;
            default:
                $formatted = $currency . ' ' . $price;
                break;
        }
        $formatted = apply_filters('give_' . strtolower($currency) . '_currency_filter_before', $formatted, $currency, $price);
    } else {
        switch ($currency) {
            case "GBP":
            case "BRL":
            case "EUR":
            case "USD":
            case "AUD":
            case "CAD":
            case "HKD":
            case "MXN":
            case "SGD":
            case "JPY":
                $formatted = $price . $symbol;
                break;
            default:
                $formatted = $price . ' ' . $currency;
                break;
        }
        $formatted = apply_filters('give_' . strtolower($currency) . '_currency_filter_after', $formatted, $currency, $price);
    }
    if ($negative) {
        // Prepend the mins sign before the currency sign
        $formatted = '-' . $formatted;
    }
    return $formatted;
}
Пример #9
0
    ?>
												</ul>
											</div>
										<?php 
}
?>


										<div class="give-order-payment give-admin-box-inside">
											<p>
												<span class="label"><?php 
esc_html_e('Total Donation', 'give');
?>
:</span>&nbsp;
												<?php 
echo give_currency_symbol($payment->currency);
?>
&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php 
echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id)));
?>
"/>
											</p>
										</div>

										<?php 
do_action('give_view_order_details_totals_after', $payment_id);
?>

									</div>
									<!-- /.give-admin-box -->
Пример #10
0
/**
 * Manually render amount field.
 *
 * @since  1.7
 *
 * @param  array      $field_args Array of field arguments.
 * @param  CMB2_Field $field      The field object
 *
 * @return void
 */
function give_cmb_amount_field_render_row_cb($field_args, $field)
{
    // Get args.
    $id = $field->args('id');
    $label = $field->args('name');
    $name = $field->args('_name');
    $description = $field->args('description');
    $attributes = $field->args('attributes');
    $attributes_string = '';
    $row_class = $field->row_classes();
    // Get attributes.
    if (!empty($attributes)) {
        foreach ($attributes as $attribute_name => $attribute_val) {
            $attributes_string[] = "{$attribute_name}=\"{$attribute_val}\"";
        }
        $attributes_string = implode(' ', $attributes_string);
    }
    // Get row class.
    if (!empty($row_class) && is_array($row_class)) {
        $row_class = implode(' ', $row_class);
    }
    ?>
	<div class="cmb-row <?php 
    echo $row_class;
    ?>
">
		<div class="cmb-th">
			<label for="<?php 
    echo $id;
    ?>
"><?php 
    echo $label;
    ?>
</label>
		</div>
		<div class="cmb-td">
			<?php 
    echo give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '';
    ?>
			<input id="<?php 
    echo $id;
    ?>
" type="text" name="<?php 
    echo $name;
    ?>
" <?php 
    echo $attributes_string;
    ?>
/>
			<?php 
    echo give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '';
    ?>

			<span class="cmb2-metabox-description"><?php 
    echo $description;
    ?>
</span>
		</div>
	</div>
	<?php 
}