本文整理汇总了PHP中edd_no_guest_checkout函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_no_guest_checkout函数的具体用法?PHP edd_no_guest_checkout怎么用?PHP edd_no_guest_checkout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_no_guest_checkout函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: details
/**
* Get EDD details
*
* ## OPTIONS
*
* None. Returns basic info regarding your EDD instance.
*
* ## EXAMPLES
*
* wp edd details
*
* @access public
* @param array $args
* @param array $assoc_args
* @return void
*/
public function details($args, $assoc_args)
{
$symlink_file_downloads = edd_get_option('symlink_file_downloads', false);
$purchase_page = edd_get_option('purchase_page', '');
$success_page = edd_get_option('success_page', '');
$failure_page = edd_get_option('failure_page', '');
WP_CLI::line(sprintf(__('You are running EDD version: %s', 'easy-digital-downloads'), EDD_VERSION));
WP_CLI::line("\n" . sprintf(__('Test mode is: %s', 'easy-digital-downloads'), edd_is_test_mode() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Ajax is: %s', 'easy-digital-downloads'), edd_is_ajax_enabled() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Guest checkouts are: %s', 'easy-digital-downloads'), edd_no_guest_checkout() ? __('Disabled', 'easy-digital-downloads') : __('Enabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Symlinks are: %s', 'easy-digital-downloads'), apply_filters('edd_symlink_file_downloads', isset($symlink_file_downloads)) && function_exists('symlink') ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line("\n" . sprintf(__('Checkout page is: %s', 'easy-digital-downloads'), !edd_get_option('purchase_page', false) ? __('Valid', 'easy-digital-downloads') : __('Invalid', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Checkout URL is: %s', 'easy-digital-downloads'), !empty($purchase_page) ? get_permalink($purchase_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Success URL is: %s', 'easy-digital-downloads'), !empty($success_page) ? get_permalink($success_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Failure URL is: %s', 'easy-digital-downloads'), !empty($failure_page) ? get_permalink($failure_page) : __('Undefined', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Downloads slug is: %s', 'easy-digital-downloads'), defined('EDD_SLUG') ? '/' . EDD_SLUG : '/downloads'));
WP_CLI::line("\n" . sprintf(__('Taxes are: %s', 'easy-digital-downloads'), edd_use_taxes() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
WP_CLI::line(sprintf(__('Tax rate is: %s', 'easy-digital-downloads'), edd_get_tax_rate() * 100 . '%'));
$rates = edd_get_tax_rates();
if (!empty($rates)) {
foreach ($rates as $rate) {
WP_CLI::line(sprintf(__('Country: %s, State: %s, Rate: %s', 'easy-digital-downloads'), $rate['country'], $rate['state'], $rate['rate']));
}
}
}
示例2: edd_get_login_fields
/**
* Gets the login fields for the login form on the checkout. This function hooks
* on the edd_purchase_form_login_fields to display the login form if a user already
* had an account.
*
* @since 1.0
* @return string
*/
function edd_get_login_fields()
{
$color = edd_get_option('checkout_color', 'gray');
$color = $color == 'inherit' ? '' : $color;
$style = edd_get_option('button_style', 'button');
$show_register_form = edd_get_option('show_register_form', 'none');
ob_start();
?>
<fieldset id="edd_login_fields">
<?php
if ($show_register_form == 'both') {
?>
<p id="edd-new-account-wrap">
<?php
_e('Need to create an account?', 'edd');
?>
<a href="<?php
echo esc_url(remove_query_arg('login'));
?>
" class="edd_checkout_register_login" data-action="checkout_register">
<?php
_e('Register', 'edd');
if (!edd_no_guest_checkout()) {
echo ' ' . __('or checkout as a guest.', 'edd');
}
?>
</a>
</p>
<?php
}
?>
<?php
do_action('edd_checkout_login_fields_before');
?>
<p id="edd-user-login-wrap">
<label class="edd-label" for="edd-username"><?php
_e('Username', 'edd');
?>
</label>
<input class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" type="text" name="edd_user_login" id="edd_user_login" value="" placeholder="<?php
_e('Your username', 'edd');
?>
"/>
</p>
<p id="edd-user-pass-wrap" class="edd_login_password">
<label class="edd-label" for="edd-password"><?php
_e('Password', 'edd');
?>
</label>
<input class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" type="password" name="edd_user_pass" id="edd_user_pass" placeholder="<?php
_e('Your password', 'edd');
?>
"/>
<input type="hidden" name="edd-purchase-var" value="needs-to-login"/>
</p>
<p id="edd-user-login-submit">
<input type="submit" class="edd-submit button <?php
echo $color;
?>
" name="edd_login_submit" value="<?php
_e('Login', 'edd');
?>
"/>
</p>
<?php
do_action('edd_checkout_login_fields_after');
?>
</fieldset><!--end #edd_login_fields-->
<?php
echo ob_get_clean();
}
示例3: edd_get_purchase_form_user
/**
* Get Purchase Form User
*
* @param array $valid_data
*
* @access private
* @since 1.0.8.1
* @return array
*/
function edd_get_purchase_form_user($valid_data = array())
{
// Initialize user
$user = false;
$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
if ($is_ajax) {
// Do not create or login the user during the ajax submission (check for errors only)
return true;
} else {
if (is_user_logged_in()) {
// Set the valid user as the logged in collected data
$user = $valid_data['logged_in_user'];
} else {
if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
// New user registration
if ($valid_data['need_new_user'] === true) {
// Set user
$user = $valid_data['new_user_data'];
// Register and login new user
$user['user_id'] = edd_register_and_login_new_user($user);
// User login
} else {
if ($valid_data['need_user_login'] === true && !$is_ajax) {
/*
* The login form is now processed in the edd_process_purchase_login() function.
* This is still here for backwards compatibility.
* This also allows the old login process to still work if a user removes the
* checkout login submit button.
*
* This also ensures that the customer is logged in correctly if they click "Purchase"
* instead of submitting the login form, meaning the customer is logged in during the purchase process.
*/
// Set user
$user = $valid_data['login_user_data'];
// Login user
edd_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
}
}
}
}
}
// Check guest checkout
if (false === $user && false === edd_no_guest_checkout()) {
// Set user
$user = $valid_data['guest_user_data'];
}
// Verify we have an user
if (false === $user || empty($user)) {
// Return false
return false;
}
// Get user first name
if (!isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
$user['user_first'] = isset($_POST["edd_first"]) ? strip_tags(trim($_POST["edd_first"])) : '';
}
// Get user last name
if (!isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
$user['user_last'] = isset($_POST["edd_last"]) ? strip_tags(trim($_POST["edd_last"])) : '';
}
// Get the user's billing address details
$user['address'] = array();
$user['address']['line1'] = !empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
$user['address']['line2'] = !empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
$user['address']['city'] = !empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
$user['address']['state'] = !empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
$user['address']['country'] = !empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
$user['address']['zip'] = !empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
if (empty($user['address']['country'])) {
$user['address'] = false;
}
// Country will always be set if address fields are present
if (!empty($user['user_id']) && $user['user_id'] > 0 && !empty($user['address'])) {
// Store the address in the user's meta so the cart can be pre-populated with it on return purchases
update_user_meta($user['user_id'], '_edd_user_address', $user['address']);
}
// Return valid user
return $user;
}
示例4: remove_register_form
/**
* Change the registration form depending on a few conditions
*
* @since 1.3
*/
public function remove_register_form($value, $key, $default)
{
// Guest purchasing disabled
if (edd_no_guest_checkout()) {
if (!is_user_logged_in()) {
// Not logged in so force login
$value = 'login';
} else {
// No form if logged in
$value = 'none';
}
} elseif ('both' === $value || 'registration' === $value) {
// Always remove registration form
$value = 'none';
}
return $value;
}
示例5: checkout_errors
/**
* 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') );
}
}
}
示例6: can_checkout
/**
* Can checkout?
* Prevents the form from being displayed when User must be logged in (Guest Checkout disabled), but "Show Register / Login Form?" is not
*
* @since 1.0
*/
public function can_checkout($can_checkout)
{
if (edd_no_guest_checkout() && !edd_get_option('show_register_form') && !is_user_logged_in()) {
return false;
}
return $can_checkout;
}
示例7: vp_edd_fd_get_register_fields
/**
* Get Register Fields
*
* @access private
* @since 1.0
* @return string
*/
function vp_edd_fd_get_register_fields()
{
global $edd_options;
global $user_ID;
if (is_user_logged_in()) {
$user_data = get_userdata($user_ID);
}
ob_start();
?>
<fieldset id="edd_register_fields">
<?php
do_action('edd_register_account_fields_before');
?>
<p id="edd-user-login-wrap">
<label for="edd_user_login"><?php
_e('Username', 'edd');
?>
</label>
<input name="edd_user_login" id="edd_user_login" class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" type="text" placeholder="<?php
_e('Username', 'edd');
?>
" title="<?php
_e('Username', 'edd');
?>
"/>
</p>
<p id="edd-user-email-wrap">
<label for="edd-email"><?php
_e('Email', 'edd');
?>
</label>
<input name="edd_email" id="edd-email" class="required edd-input" type="email" placeholder="<?php
_e('Email', 'edd');
?>
" title="<?php
_e('Email', 'edd');
?>
"/>
</p>
<p id="edd-user-pass-wrap">
<label for="password"><?php
_e('Password', 'edd');
?>
</label>
<input name="edd_user_pass" id="edd_user_pass" class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" placeholder="<?php
_e('Password', 'edd');
?>
" type="password"/>
</p>
<p id="edd-user-pass-confirm-wrap" class="edd_register_password">
<label for="password_again"><?php
_e('Password Again', 'edd');
?>
</label>
<input name="edd_user_pass_confirm" id="edd_user_pass_confirm" class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" placeholder="<?php
_e('Confirm password', 'edd');
?>
" type="password"/>
</p>
<p id="edd-user-first-name-wrap">
<label class="edd-label" for="edd-first"><?php
_e('First Name', 'edd');
?>
</label>
<input class="edd-input required" type="text" name="edd_first" placeholder="<?php
_e('First Name', 'edd');
?>
" id="edd-first" value="<?php
echo is_user_logged_in() ? $user_data->user_firstname : '';
?>
"/>
</p>
<p id="edd-user-last-name-wrap">
<label class="edd-label" for="edd-last"><?php
_e('Last Name', 'edd');
?>
</label>
<input class="edd-input" type="text" name="edd_last" id="edd-last" placeholder="<?php
//.........这里部分代码省略.........
示例8: edd_tools_sysinfo_get
/**
* Get system info
*
* @since 2.0
* @access public
* @global object $wpdb Used to query the database using the WordPress Database API
* @global array $edd_options Array of all EDD options
* @return string $return A string containing the info to output
*/
function edd_tools_sysinfo_get()
{
global $wpdb, $edd_options;
if (!class_exists('Browser')) {
require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php';
}
$browser = new Browser();
// Get theme info
if (get_bloginfo('version') < '3.4') {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
}
// Try to identify the hosting provider
$host = edd_get_host();
$return = '### Begin System Info ###' . "\n\n";
// Start with the basics...
$return .= '-- Site Info' . "\n\n";
$return .= 'Site URL: ' . site_url() . "\n";
$return .= 'Home URL: ' . home_url() . "\n";
$return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n";
$return = apply_filters('edd_sysinfo_after_site_info', $return);
// Can we determine the site's host?
if ($host) {
$return .= "\n" . '-- Hosting Provider' . "\n\n";
$return .= 'Host: ' . $host . "\n";
$return = apply_filters('edd_sysinfo_after_host_info', $return);
}
// The local users' browser information, handled by the Browser class
$return .= "\n" . '-- User Browser' . "\n\n";
$return .= $browser;
$return = apply_filters('edd_sysinfo_after_user_browser', $return);
// WordPress configuration
$return .= "\n" . '-- WordPress Configuration' . "\n\n";
$return .= 'Version: ' . get_bloginfo('version') . "\n";
$return .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
$return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n";
$return .= 'Active Theme: ' . $theme . "\n";
$return .= 'Show On Front: ' . get_option('show_on_front') . "\n";
// Only show page specs if frontpage is set to 'page'
if (get_option('show_on_front') == 'page') {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n";
$return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n";
}
// Make sure wp_remote_post() is working
$request['cmd'] = '_notify-validate';
$params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'EDD/' . EDD_VERSION, 'body' => $request);
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$WP_REMOTE_POST = 'wp_remote_post() works';
} else {
$WP_REMOTE_POST = 'wp_remote_post() does not work';
}
$return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
$return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n";
$return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
$return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
$return .= 'Registered Post Stati: ' . implode(', ', get_post_stati()) . "\n";
$return = apply_filters('edd_sysinfo_after_wordpress_config', $return);
// EDD configuration
$return .= "\n" . '-- EDD Configuration' . "\n\n";
$return .= 'Version: ' . EDD_VERSION . "\n";
$return .= 'Upgraded From: ' . get_option('edd_version_upgraded_from', 'None') . "\n";
$return .= 'Test Mode: ' . (edd_is_test_mode() ? "Enabled\n" : "Disabled\n");
$return .= 'Ajax: ' . (!edd_is_ajax_disabled() ? "Enabled\n" : "Disabled\n");
$return .= 'Guest Checkout: ' . (edd_no_guest_checkout() ? "Disabled\n" : "Enabled\n");
$return .= 'Symlinks: ' . (apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Enabled\n" : "Disabled\n");
$return .= 'Download Method: ' . ucfirst(edd_get_file_download_method()) . "\n";
$return .= 'Currency Code: ' . edd_get_currency() . "\n";
$return .= 'Currency Position: ' . edd_get_option('currency_position', 'before') . "\n";
$return .= 'Decimal Separator: ' . edd_get_option('decimal_separator', '.') . "\n";
$return .= 'Thousands Separator: ' . edd_get_option('thousands_separator', ',') . "\n";
$return = apply_filters('edd_sysinfo_after_edd_config', $return);
// EDD pages
$return .= "\n" . '-- EDD Page Configuration' . "\n\n";
$return .= 'Checkout: ' . (!empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n");
$return .= 'Checkout Page: ' . (!empty($edd_options['purchase_page']) ? get_permalink($edd_options['purchase_page']) . "\n" : "Unset\n");
$return .= 'Success Page: ' . (!empty($edd_options['success_page']) ? get_permalink($edd_options['success_page']) . "\n" : "Unset\n");
$return .= 'Failure Page: ' . (!empty($edd_options['failure_page']) ? get_permalink($edd_options['failure_page']) . "\n" : "Unset\n");
$return .= 'Downloads Slug: ' . (defined('EDD_SLUG') ? '/' . EDD_SLUG . "\n" : "/downloads\n");
$return = apply_filters('edd_sysinfo_after_edd_pages', $return);
// EDD gateways
$return .= "\n" . '-- EDD Gateway Configuration' . "\n\n";
$active_gateways = edd_get_enabled_payment_gateways();
if ($active_gateways) {
$default_gateway_is_active = edd_is_gateway_active(edd_get_default_gateway());
if ($default_gateway_is_active) {
//.........这里部分代码省略.........
示例9: edd_get_purchase_form_user
/**
* Get Purchase Form User
*
* @param array $valid_data
*
* @access private
* @since 1.0.8.1
* @return array
*/
function edd_get_purchase_form_user($valid_data = array())
{
// Initialize user
$user = false;
// Check if user is logged in
if (is_user_logged_in()) {
// set the valid user as the logged in collected data
$user = $valid_data['logged_in_user'];
} else {
if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
// new user registration
if ($valid_data['need_new_user'] === true) {
// set user
$user = $valid_data['new_user_data'];
// register and login new user
$user['user_id'] = edd_register_and_login_new_user($user);
// user login
} else {
if ($valid_data['need_user_login'] === true) {
// set user
$user = $valid_data['login_user_data'];
// login user
edd_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
}
}
}
}
// check guest checkout
if (false === $user && false === edd_no_guest_checkout()) {
// set user
$user = $valid_data['guest_user_data'];
}
// verify we have an user
if (false === $user || empty($user)) {
// return false
return false;
}
// get user first name
if (!isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
$user['user_first'] = isset($_POST["edd_first"]) ? strip_tags(trim($_POST["edd_first"])) : '';
}
// get user last name
if (!isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
$user['user_last'] = isset($_POST["edd_last"]) ? strip_tags(trim($_POST["edd_last"])) : '';
}
// return valid user
return $user;
}
示例10: edd_get_login_fields
/**
* Gets the login fields for the login form on the checkout. This function hooks
* on the edd_purchase_form_login_fields to display the login form if a user already
* had an account.
*
* @since 1.0
* @return string
*/
function edd_get_login_fields()
{
ob_start();
?>
<fieldset id="edd_login_fields">
<legend><?php
_e('Login to your account', 'edd');
?>
</legend>
<?php
do_action('edd_checkout_login_fields_before');
?>
<p id="edd-user-login-wrap">
<label class="edd-label" for="edd-username"><?php
_e('Username', 'edd');
?>
</label>
<input class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" type="text" name="edd_user_login" id="edd_user_login" value="" placeholder="<?php
_e('Your username', 'edd');
?>
"/>
</p>
<p id="edd-user-pass-wrap" class="edd_login_password">
<label class="edd-label" for="edd-password"><?php
_e('Password', 'edd');
?>
</label>
<input class="<?php
if (edd_no_guest_checkout()) {
echo 'required ';
}
?>
edd-input" type="password" name="edd_user_pass" id="edd_user_pass" placeholder="<?php
_e('Your password', 'edd');
?>
"/>
<input type="hidden" name="edd-purchase-var" value="needs-to-login"/>
</p>
<?php
do_action('edd_checkout_login_fields_after');
?>
</fieldset><!--end #edd_login_fields-->
<p id="edd-new-account-wrap">
<?php
_e('Need to create an account?', 'edd');
?>
<a href="<?php
echo remove_query_arg('login');
?>
" class="edd_checkout_register_login" data-action="checkout_register">
<?php
_e('Register', 'edd');
if (!edd_no_guest_checkout()) {
echo ' ' . __('or checkout as a guest.', 'edd');
}
?>
</a>
</p>
<?php
echo ob_get_clean();
}
示例11: edd_system_info
/**
* System info
*
* Shows the system info panel which contains version data and debug info.
* The data for the system info is generated by the Browser class.
*
* @since 1.4
* @global $wpdb
* @global object $wpdb Used to query the database using the WordPress
* Database API
* @global $edd_options Array of all the EDD Options
* @author Chris Christoff
* @return void
*/
function edd_system_info()
{
global $wpdb, $edd_options;
if (!class_exists('Browser')) {
require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php';
}
$browser = new Browser();
if (get_bloginfo('version') < '3.4') {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
}
// Try to identifty the hosting provider
$host = false;
if (defined('WPE_APIKEY')) {
$host = 'WP Engine';
} elseif (defined('PAGELYBIN')) {
$host = 'Pagely';
}
?>
<div class="wrap">
<h2><?php
_e('System Information', 'edd');
?>
</h2><br/>
<form action="<?php
echo esc_url(admin_url('edit.php?post_type=download&page=edd-system-info'));
?>
" method="post" dir="ltr">
<textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="edd-sysinfo" title="<?php
_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd');
?>
">
### Begin System Info ###
## Please include this information when posting support requests ##
<?php
do_action('edd_system_info_before');
?>
Multisite: <?php
echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n";
?>
SITE_URL: <?php
echo site_url() . "\n";
?>
HOME_URL: <?php
echo home_url() . "\n";
?>
EDD Version: <?php
echo EDD_VERSION . "\n";
?>
Upgraded From: <?php
echo get_option('edd_version_upgraded_from', 'None') . "\n";
?>
WordPress Version: <?php
echo get_bloginfo('version') . "\n";
?>
Permalink Structure: <?php
echo get_option('permalink_structure') . "\n";
?>
Active Theme: <?php
echo $theme . "\n";
if ($host) {
?>
Host: <?php
echo $host . "\n";
}
?>
Test Mode Enabled: <?php
echo edd_is_test_mode() ? "Yes\n" : "No\n";
?>
Ajax Enabled: <?php
echo edd_is_ajax_enabled() ? "Yes\n" : "No\n";
?>
Guest Checkout Enabled: <?php
echo edd_no_guest_checkout() ? "No\n" : "Yes\n";
?>
Symlinks Enabled: <?php
echo apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Yes\n" : "No\n";
//.........这里部分代码省略.........
示例12: edd_get_purchase_form_user
/**
* Get Purchase Form User
*
* @param array $valid_data
*
* @access private
* @since 1.0.8.1
* @return array
*/
function edd_get_purchase_form_user($valid_data = array())
{
// Initialize user
$user = false;
$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
if ($is_ajax) {
// Do not create or login the user during the ajax submission (check for errors only)
return true;
} else {
if (is_user_logged_in()) {
// Set the valid user as the logged in collected data
$user = $valid_data['logged_in_user'];
} else {
if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
// New user registration
if ($valid_data['need_new_user'] === true) {
// Set user
$user = $valid_data['new_user_data'];
// Register and login new user
$user['user_id'] = edd_register_and_login_new_user($user);
// User login
} else {
if ($valid_data['need_user_login'] === true && !$is_ajax) {
// Set user
$user = $valid_data['login_user_data'];
// Login user
edd_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
}
}
}
}
}
// Check guest checkout
if (false === $user && false === edd_no_guest_checkout()) {
// Set user
$user = $valid_data['guest_user_data'];
}
// Verify we have an user
if (false === $user || empty($user)) {
// Return false
return false;
}
// Get user first name
if (!isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
$user['user_first'] = isset($_POST["edd_first"]) ? strip_tags(trim($_POST["edd_first"])) : '';
}
// Get user last name
if (!isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
$user['user_last'] = isset($_POST["edd_last"]) ? strip_tags(trim($_POST["edd_last"])) : '';
}
// Return valid user
return $user;
}
示例13: edd_system_info
/**
* System info
*
* Shows the system info panel which contains version data and debug info.
* The data for the system info is generated by the Browser class.
*
* @since 1.4
* @global $wpdb
* @global object $wpdb Used to query the database using the WordPress
* Database API
* @global $edd_options Array of all the EDD Options
* @author Chris Christoff
* @return void
*/
function edd_system_info()
{
global $wpdb, $edd_options;
if (!class_exists('Browser')) {
require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php';
}
$browser = new Browser();
?>
<div class="wrap">
<h2><?php
_e('System Information', 'edd');
?>
</h2><br/>
<form action="<?php
echo esc_url(admin_url('edit.php?post_type=download&page=edd-system-info'));
?>
" method="post">
<textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="edd-sysinfo" title="<?php
_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd');
?>
">
### Begin System Info ###
## Please include this information when posting support requests ##
Multi-site: <?php
echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n";
?>
SITE_URL: <?php
echo site_url() . "\n";
?>
HOME_URL: <?php
echo home_url() . "\n";
?>
EDD Version: <?php
echo EDD_VERSION . "\n";
?>
Upgraded From: <?php
echo get_option('edd_version_upgraded_from', 'None') . "\n";
?>
WordPress Version: <?php
echo get_bloginfo('version') . "\n";
?>
Test Mode Enabled: <?php
echo edd_is_test_mode() ? "Yes\n" : "No\n";
?>
Ajax Enabled: <?php
echo edd_is_ajax_enabled() ? "Yes\n" : "No\n";
?>
Guest Checkout Enabled: <?php
echo edd_no_guest_checkout() ? "No\n" : "Yes\n";
?>
Symlinks Enabled: <?php
echo apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Yes\n" : "No\n";
?>
Checkout: <?php
echo !empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n";
?>
Taxes Enabled: <?php
echo edd_use_taxes() ? "Yes\n" : "No\n";
?>
Local Taxes Only: <?php
echo edd_local_taxes_only() ? "Yes\n" : "No\n";
?>
Taxes After Discounts: <?php
echo edd_taxes_after_discounts() ? "Yes\n" : "No\n";
?>
<?php
echo $browser;
?>
PHP Version: <?php
echo PHP_VERSION . "\n";
?>
MySQL Version: <?php
echo mysql_get_server_info() . "\n";
?>
Web Server Info: <?php
echo $_SERVER['SERVER_SOFTWARE'] . "\n";
?>
//.........这里部分代码省略.........