本文整理汇总了PHP中BYT_Theme_Utils::is_woocommerce_active方法的典型用法代码示例。如果您正苦于以下问题:PHP BYT_Theme_Utils::is_woocommerce_active方法的具体用法?PHP BYT_Theme_Utils::is_woocommerce_active怎么用?PHP BYT_Theme_Utils::is_woocommerce_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BYT_Theme_Utils
的用法示例。
在下文中一共展示了BYT_Theme_Utils::is_woocommerce_active方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_cart_page_url
public function get_cart_page_url()
{
$cart_page_url = '';
if (function_exists('wc_get_page_id') && BYT_Theme_Utils::is_woocommerce_active()) {
$cart_page_id = wc_get_page_id('cart');
$cart_page_id = BYT_Theme_Utils::get_current_language_page_id($cart_page_id);
$cart_page_url = get_permalink($cart_page_id);
}
return $cart_page_url;
}
示例2: wp_logout_url
}
// (!empty($my_account_page_url) || !empty($cart_page_url))
?>
<li><a class="fn" href="<?php
echo wp_logout_url(home_url());
?>
"><?php
_e('Logout', 'bookyourtravel');
?>
</a></li>
<?php
}
?>
</ul>
<?php
if (!BYT_Theme_Utils::is_woocommerce_active()) {
?>
<?php
}
?>
<?php
get_sidebar('header');
?>
</nav>
</div>
<!--//ribbon-->
<?php
}
// endif (!$hide_header_ribbon)
?>
<!--search-->
示例3: book_accommodation_ajax_request
function book_accommodation_ajax_request()
{
global $byt_accommodations_post_type, $byt_theme_globals, $byt_theme_woocommerce;
$enc_key = $byt_theme_globals->get_enc_key();
$add_captcha_to_forms = $byt_theme_globals->add_captcha_to_forms();
if (isset($_REQUEST)) {
$nonce = $_REQUEST['nonce'];
if (wp_verify_nonce($nonce, 'byt-ajax-nonce')) {
$first_name = isset($_REQUEST['first_name']) ? wp_kses($_REQUEST['first_name'], '') : '';
$last_name = isset($_REQUEST['last_name']) ? wp_kses($_REQUEST['last_name'], '') : '';
$email = isset($_REQUEST['email']) ? wp_kses($_REQUEST['email'], '') : '';
$phone = isset($_REQUEST['phone']) ? wp_kses($_REQUEST['phone'], '') : '';
$address = isset($_REQUEST['address']) ? wp_kses($_REQUEST['address'], '') : '';
$town = isset($_REQUEST['town']) ? wp_kses($_REQUEST['town'], '') : '';
$zip = isset($_REQUEST['zip']) ? wp_kses($_REQUEST['zip'], '') : '';
$country = isset($_REQUEST['country']) ? wp_kses($_REQUEST['country'], '') : '';
$special_requirements = isset($_REQUEST['special_requirements']) ? wp_kses($_REQUEST['special_requirements'], '') : '';
$date_from = isset($_REQUEST['date_from']) ? date('Y-m-d', strtotime(wp_kses($_REQUEST['date_from'], ''))) : null;
$date_to = isset($_REQUEST['date_to']) ? date('Y-m-d', strtotime(wp_kses($_REQUEST['date_to'], ''))) : null;
$accommodation_id = isset($_REQUEST['accommodation_id']) ? intval(wp_kses($_REQUEST['accommodation_id'], '')) : 0;
$room_type_id = isset($_REQUEST['room_type_id']) ? intval(wp_kses($_REQUEST['room_type_id'], '')) : 0;
$room_count = isset($_REQUEST['room_count']) ? intval(wp_kses($_REQUEST['room_count'], '')) : 1;
$adults = isset($_REQUEST['adults']) ? intval(wp_kses($_REQUEST['adults'], '')) : 1;
$children = isset($_REQUEST['children']) ? intval(wp_kses($_REQUEST['children'], '')) : 0;
$c_val_s = isset($_REQUEST['c_val_s']) ? intval(wp_kses($_REQUEST['c_val_s'], '')) : 0;
$c_val_1 = isset($_REQUEST['c_val_1']) ? intval(BYT_Theme_Utils::decrypt(wp_kses($_REQUEST['c_val_1'], ''), $enc_key)) : 0;
$c_val_2 = isset($_REQUEST['c_val_2']) ? intval(BYT_Theme_Utils::decrypt(wp_kses($_REQUEST['c_val_2'], ''), $enc_key)) : 0;
// nonce passed ok
$accommodation = get_post($accommodation_id);
if ($room_type_id) {
$room_type = get_post($room_type_id);
}
if ($accommodation != null) {
if ($add_captcha_to_forms && $c_val_s != $c_val_1 + $c_val_2) {
echo 'captcha_error';
die;
} else {
$is_self_catered = get_post_meta($accommodation_id, 'accommodation_is_self_catered', true);
$is_reservation_only = get_post_meta($accommodation_id, 'accommodation_is_reservation_only', true);
$current_user = wp_get_current_user();
$total_price = $byt_accommodations_post_type->calculate_total_price($accommodation_id, $room_type_id, $date_from, $date_to, $room_count, $adults, $children);
$booking_id = $byt_accommodations_post_type->create_accommodation_booking($first_name, $last_name, $email, $phone, $address, $town, $zip, $country, $special_requirements, $room_count, $date_from, $date_to, $accommodation_id, $room_type_id, $current_user->ID, $is_self_catered, $total_price, $adults, $children);
$use_woocommerce_for_checkout = $byt_theme_globals->use_woocommerce_for_checkout();
if (BYT_Theme_Utils::is_woocommerce_active() && !$is_reservation_only) {
if ($use_woocommerce_for_checkout) {
$product_id = $byt_theme_woocommerce->woocommerce_create_product($accommodation->post_title, '', 'ACC_' . $accommodation_id . '_', $booking_id, $total_price, BOOKYOURTRAVEL_WOO_PRODUCT_CAT_ACCOMMODATIONS);
echo $product_id;
}
} else {
echo $booking_id;
}
if (!$use_woocommerce_for_checkout || !BYT_Theme_Utils::is_woocommerce_active()) {
// only send email if we are not proceeding to WooCommerce checkout or if woocommerce is not active at all.
$admin_email = get_bloginfo('admin_email');
$admin_name = get_bloginfo('name');
$headers = "From: {$admin_name} <{$admin_email}>\n";
$subject = __('New accommodation booking', 'bookyourtravel');
$message = '';
if ($is_self_catered) {
$message = __("New self-catered booking: \n\nFirst name: %s \n\nLast name: %s \n\nEmail: %s \n\nPhone: %s \n\nAddress: %s \n\nTown: %s \n\nZip: %s \n\nCountry: %s \n\nSpecial requirements: %s \n\nAdults: %s \n\nChildren: %s \n\nDate from: %s \n\nDate to: %s \n\nTotal price: %d \n\nAccommodation: %s", 'bookyourtravel');
$message = sprintf($message, $first_name, $last_name, $email, $phone, $address, $town, $zip, $country, $special_requirements, $adults, $children, $date_from, $date_to, $total_price, $accommodation->post_title);
} else {
$message = __("New hotel booking: \n\nFirst name: %s \n\nLast name: %s \n\nEmail: %s \n\nPhone: %s \n\nAddress: %s \n\nTown: %s \n\nZip: %s \n\nCountry: %s \n\nSpecial requirements: %s \n\nRoom count: %d \n\nAdults: %s \n\nChildren: %s \n\nDate from: %s \n\nDate to: %s \n\nTotal price: %d \n\nAccommodation: %s \n\nRoom type: %s \n", 'bookyourtravel');
$message = sprintf($message, $first_name, $last_name, $email, $phone, $address, $town, $zip, $country, $special_requirements, $room_count, $adults, $children, $date_from, $date_to, $total_price, $accommodation->post_title, $room_type->post_title);
}
wp_mail($email, $subject, $message, $headers);
$contact_email = get_post_meta($accommodation_id, 'accommodation_contact_email', true);
$contact_emails = explode(';', $contact_email);
if (empty($contact_email)) {
$contact_emails = array($admin_email);
}
foreach ($contact_emails as $e) {
if (!empty($e)) {
wp_mail($e, $subject, $message, $headers);
}
}
}
}
}
}
}
// Always die in functions echoing ajax content
die;
}
示例4: init
public function init()
{
if (BYT_Theme_Utils::is_woocommerce_active()) {
add_action('init', array($this, 'woocommerce_init'));
}
}