Ejemplo n.º 1
0
/**
 *  Main function to register all of the plugin settings
 *
 * @since 1.0.0
 */
function sc_register_settings()
{
    global $sc_options;
    $sc_options = array();
    $sc_settings = array('default' => array('note' => array('id' => 'settings_note', 'name' => '', 'desc' => '<a href="' . sc_ga_campaign_url(SC_WEBSITE_BASE_URL . 'docs/shortcodes/stripe-checkout/', 'stripe_checkout', 'settings', 'docs') . '" target="_blank">' . __('See shortcode options and examples', 'sc') . '</a> ' . __('for', 'sc') . ' ' . Stripe_Checkout::get_plugin_title() . '<p class="description">' . __('Shortcode attributes take precedence and will always override site-wide default settings.', 'sc') . '</p>', 'type' => 'section'), 'name' => array('id' => 'name', 'name' => __('Site Name', 'sc'), 'desc' => __('The name of your store or website. Defaults to Site Name.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'currency' => array('id' => 'currency', 'name' => __('Currency Code', 'sc'), 'desc' => __('Specify a currency using it\'s ', 'sc') . sprintf('<a href="%s" target="_blank">%s</a>', 'https://support.stripe.com/questions/which-currencies-does-stripe-support', __('3-letter ISO Code', 'sc')) . '. ' . __('Defaults to USD.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'image_url' => array('id' => 'image_url', 'name' => __('Image URL', 'sc'), 'desc' => __('A URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'checkout_button_label' => array('id' => 'checkout_button_label', 'name' => __('Checkout Button Label', 'sc'), 'desc' => __('The label of the payment button in the checkout form. You can use {{amount}} to display the amount.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'payment_button_label' => array('id' => 'payment_button_label', 'name' => __('Payment Button Label', 'sc'), 'desc' => __('Text to display on the default blue button that users click to initiate a checkout process.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'success_redirect_url' => array('id' => 'success_redirect_url', 'name' => __('Success Redirect URL', 'sc'), 'desc' => __('The URL that the user should be redirected to after a successful payment.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'disable_success_message' => array('id' => 'disable_success_message', 'name' => __('Disable Success Message', 'sc'), 'desc' => __('Disable default success message. Useful if you are redirecting to your own success page.', 'sc'), 'type' => 'checkbox'), 'failure_redirect_url' => array('id' => 'failure_redirect_url', 'name' => __('Failure Redirect URL', 'sc'), 'desc' => __('The URL that the user should be redirected to after a failed payment.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'billing' => array('id' => 'billing', 'name' => __('Enable Billing Address', 'sc'), 'desc' => __('Require the user to enter their billing address during checkout.', 'sc') . (class_exists('Stripe_Checkout_Pro') ? '<br><em>' . __('See below if you also need to require a shipping address.', 'sc') . '</em>' : ''), 'type' => 'checkbox'), 'verify_zip' => array('id' => 'verify_zip', 'name' => __('Verify Zip Code', 'sc'), 'desc' => __('Verifies the zip code of the card.', 'sc'), 'type' => 'checkbox'), 'enable_remember' => array('id' => 'enable_remember', 'name' => __('Enable "Remember Me"', 'sc'), 'desc' => __('Adds a "Remember Me" option to the checkout form to allow the user to store their credit card for future use with other sites using Stripe. ', 'sc') . sprintf('<a href="%s" target="_blank">%s</a>', 'https://stripe.com/checkout/info', __('See how it works', 'sc')) . '.', 'type' => 'checkbox'), 'disable_css' => array('id' => 'disable_css', 'name' => __('Disable Form CSS', 'sc'), 'desc' => __('Disable the plugin from ouputting the default form CSS.', 'sc'), 'type' => 'checkbox'), 'uninstall_save_settings' => array('id' => 'uninstall_save_settings', 'name' => __('Save Settings', 'sc'), 'desc' => __('Save your settings when uninstalling this plugin. Useful when upgrading or re-installing.', 'sc'), 'type' => 'checkbox')), 'keys' => array('enable_live_key' => array('id' => 'enable_live_key', 'name' => __('Test or Live Mode', 'sc'), 'desc' => '<p class="description">' . __('Toggle between using your Test or Live API keys.', 'sc') . '</p>', 'type' => 'toggle_control'), 'test_secret_key' => array('id' => 'test_secret_key', 'name' => __('Test Secret Key', 'sc'), 'desc' => __('Enter your test secret key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'test_publish_key' => array('id' => 'test_publish_key', 'name' => __('Test Publishable Key', 'sc'), 'desc' => __('Enter your test publishable key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'live_secret_key' => array('id' => 'live_secret_key', 'name' => __('Live Secret Key', 'sc'), 'desc' => __('Enter your live secret key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text'), 'live_publish_key' => array('id' => 'live_publish_key', 'name' => __('Live Publishable Key', 'sc'), 'desc' => __('Enter your live publishable key, found in your Stripe account settings.', 'sc'), 'type' => 'text', 'size' => 'regular-text')));
    $sc_settings = apply_filters('sc_settings', $sc_settings);
    $sc_settings_title = '';
    foreach ($sc_settings as $setting => $option) {
        if (false == get_option('sc_settings_' . $setting)) {
            add_option('sc_settings_' . $setting);
        }
        add_settings_section('sc_settings_' . $setting, apply_filters('sc_settings_' . $setting . '_title', $sc_settings_title), '__return_false', 'sc_settings_' . $setting);
        foreach ($sc_settings[$setting] as $option) {
            add_settings_field('sc_settings_' . $setting . '[' . $option['id'] . ']', $option['name'], function_exists('sc_' . $option['type'] . '_callback') ? 'sc_' . $option['type'] . '_callback' : 'sc_missing_callback', 'sc_settings_' . $setting, 'sc_settings_' . $setting, sc_get_settings_field_args($option, $setting));
        }
        register_setting('sc_settings_' . $setting, 'sc_settings_' . $setting, 'sc_settings_sanitize');
        $sc_options = array_merge($sc_options, is_array(get_option('sc_settings_' . $setting)) ? get_option('sc_settings_' . $setting) : array());
    }
    update_option('sc_settings_master', $sc_options);
}
Ejemplo n.º 2
0
</a>
				</li>

				<li>
					<div class="dashicons dashicons-arrow-right-alt2"></div>
					<a href="http://wordpress.org/support/plugin/stripe" target="_blank">
						<?php 
_e('Community support forums', 'sc');
?>
</a>
				</li>

				<li>
					<div class="dashicons dashicons-arrow-right-alt2"></div>
					<a href="<?php 
echo sc_ga_campaign_url(SC_WEBSITE_BASE_URL, 'stripe_checkout', 'sidebar_link', 'addons');
?>
" target="_blank">
						<?php 
_e('Stripe Checkout Pro', 'sc');
?>
</a>
				</li>
			</ul>
		</div>
	</div>
</div>

<div class="sidebar-container metabox-holder">
	<div class="postbox">
		<div class="inside">
Ejemplo n.º 3
0
 public function purchase_pro_link($links)
 {
     $pro_link = sprintf('<a href="%s">%s</a>', sc_ga_campaign_url(SC_WEBSITE_BASE_URL, 'stripe_checkout', 'plugin_listing', 'pro_upgrade'), __('Purchase Pro', 'sc'));
     array_push($links, $pro_link);
     return $links;
 }
		margin: 2px 0;
	}
</style>

<div id="sc-license-notice" class="error">
	<p>
		<?php 
// Check for empty key first.
echo '<strong>' . __('Notice: You must enter your plugin license key(s) to receive automatic updates and support.', 'sc') . '</strong><br />' . "\n";
// Show "below" message on Support tab.
if (!(isset($_GET['tab']) && 'licenses' == $_GET['tab'])) {
    // Render link to Support tab on other plugin tabs.
    echo '<a href="' . esc_url(add_query_arg(array('page' => SC_PLUGIN_SLUG, 'tab' => 'licenses'), admin_url('admin.php'))) . '">' . __('Go to the Licenses tab to enter your license key(s)', 'sc') . '</a>.<br />' . "\n";
}
// In all cases show message and link to purchase a key.
?>

		<?php 
_e('If you would like to purchase a license ', 'sc');
?>
		<a href="<?php 
echo sc_ga_campaign_url(SC_WEBSITE_BASE_URL, 'stripe_checkout_pro', 'license_notice', 'license_notice');
?>
"
		   target="_blank"><?php 
_e('please visit our store', 'sc');
?>
</a>.
	</p>
</div>
Ejemplo n.º 5
0
function sc_upgrade_redirect()
{
    wp_redirect(sc_ga_campaign_url(SC_WEBSITE_BASE_URL, 'stripe_checkout', 'plugin_menu', 'pro_upgrade'), 301);
    exit;
}