コード例 #1
0
    /**
     * Returns domain available response HTML with a link on purchase form or paypal checkout.
     *
     * @since 4.0.0
     *
     * @access public
     * @global ProSites $psts The instance of ProSites plugin class.
     * @param string $sld The actual SLD.
     * @param string $tld The actual TLD.
     * @param string $purchase_link The purchase URL.
     * @return string Response HTML.
     */
    public function get_domain_available_response($sld, $tld, $purchase_link = false)
    {
        global $psts;
        if ($psts) {
            if ($this->_get_gateway() == self::GATEWAY_PROSITES) {
                $locale = apply_filters('domainmap_locale', get_locale());
                if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $locale)) {
                    $locale = 'en_US';
                }
                return parent::get_domain_available_response($sld, $tld, sprintf('
					<form class="domainmapping-paypal-form" action="%s">
						<input type="hidden" name="action" value="%s">
						<input type="hidden" name="nonce" value="%s">
						<input type="hidden" name="sld" value="%s">
						<input type="hidden" name="tld" value="%s">
						<button type="submit" class="domainmapping-transparent-button"><img src="http://www.paypalobjects.com/%s/i/btn/btn_buynow_LG.gif" alt="%s"></button>
					</form>
					', admin_url('admin-ajax.php'), Domainmap_Plugin::ACTION_PAYPAL_PURCHASE, wp_create_nonce(Domainmap_Plugin::ACTION_PAYPAL_PURCHASE), $sld, $tld, $locale, __('Purchase this domain with PayPal Express Checkout.', 'domainmap')));
            }
        }
        return parent::get_domain_available_response($sld, $tld, $purchase_link);
    }