本文整理汇总了PHP中BYT_Theme_Utils::get_default_language方法的典型用法代码示例。如果您正苦于以下问题:PHP BYT_Theme_Utils::get_default_language方法的具体用法?PHP BYT_Theme_Utils::get_default_language怎么用?PHP BYT_Theme_Utils::get_default_language使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BYT_Theme_Utils
的用法示例。
在下文中一共展示了BYT_Theme_Utils::get_default_language方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_cruise_bookings
function list_cruise_bookings($paged = null, $per_page = 0, $orderby = 'Id', $order = 'ASC', $search_term = null, $user_id = 0, $author_id = null)
{
global $wpdb, $byt_multi_language_count;
$table_name_schedule = BOOKYOURTRAVEL_CRUISE_SCHEDULE_TABLE;
$table_name_bookings = BOOKYOURTRAVEL_CRUISE_BOOKING_TABLE;
$sql = "SELECT \tDISTINCT bookings.*, \r\n\t\t\t\t\t\tcruises.post_title cruise_name, \r\n\t\t\t\t\t\tcabin_types.post_title cabin_type, \r\n\t\t\t\t\t\tschedule.duration_days,\r\n\t\t\t\t\t\tbookings.total_price,\r\n\t\t\t\t\t\tschedule.cruise_id,\r\n\t\t\t\t\t\tschedule.cabin_type_id\r\n\t\t\t\tFROM {$table_name_bookings} bookings \r\n\t\t\t\tINNER JOIN {$table_name_schedule} schedule ON schedule.Id = bookings.cruise_schedule_id\r\n\t\t\t\tINNER JOIN {$wpdb->posts} cruises ON cruises.ID = schedule.cruise_id \r\n\t\t\t\tINNER JOIN {$wpdb->posts} cabin_types ON cabin_types.ID = schedule.cabin_type_id ";
if (defined('ICL_LANGUAGE_CODE') && (BYT_Theme_Utils::get_default_language() != ICL_LANGUAGE_CODE || $byt_multi_language_count > 1)) {
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations ON translations.element_type = 'post_cruise' AND translations.language_code='" . ICL_LANGUAGE_CODE . "' AND translations.element_id = cruises.ID ";
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations_default ON translations_default.element_type = 'post_cruise' AND translations_default.language_code='" . BYT_Theme_Utils::get_default_language() . "' AND translations_default.trid = translations.trid ";
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations2 ON translations2.element_type = 'post_cabin_type' AND translations2.language_code='" . ICL_LANGUAGE_CODE . "' AND translations2.element_id = cabin_types.ID ";
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations_default2 ON translations_default2.element_type = 'post_cabin_type' AND translations_default2.language_code='" . BYT_Theme_Utils::get_default_language() . "' AND translations_default2.trid = translations2.trid ";
}
$sql .= " WHERE cruises.post_status = 'publish' ";
if ($search_term != null && !empty($search_term)) {
$search_term = "%" . $search_term . "%";
$sql .= $wpdb->prepare(" AND (bookings.first_name LIKE '%s' OR bookings.last_name LIKE '%s') ", $search_term, $search_term);
}
if (isset($user_id)) {
$sql .= $wpdb->prepare(" AND bookings.user_id=%d ", $user_id);
}
if (isset($author_id)) {
$sql .= $wpdb->prepare(" AND cruises.post_author=%d ", $author_id);
}
if (!empty($orderby) && !empty($order)) {
$sql .= "ORDER BY {$orderby} {$order}";
}
$sql_count = $sql;
if (!empty($paged) && !empty($per_page)) {
$offset = ($paged - 1) * $per_page;
$sql .= $wpdb->prepare(" LIMIT %d, %d ", $offset, $per_page);
}
$results = array('total' => $wpdb->query($sql_count), 'results' => $wpdb->get_results($sql));
return $results;
}
示例2: get_active_languages
public static function get_active_languages()
{
$language_array = array();
$language_array[] = BYT_Theme_Utils::get_default_language();
global $sitepress;
if ($sitepress) {
if (function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0&orderby=code');
if (!empty($languages)) {
foreach ($languages as $l) {
if ($l['active'] && !in_array($l['language_code'], $language_array)) {
$language_array[] = $l['language_code'];
}
}
}
}
}
return $language_array;
}
示例3: get_car_rental_booking
function get_car_rental_booking($booking_id)
{
global $wpdb, $byt_multi_language_count;
$table_name = BOOKYOURTRAVEL_CAR_RENTAL_BOOKINGS_TABLE;
$sql = "SELECT \tDISTINCT bookings.*, \r\n\t\t\t\t\t\tcar_rentals.post_title car_rental_name,\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT MIN(booking_date) FROM " . BOOKYOURTRAVEL_CAR_RENTAL_BOOKING_DAYS_TABLE . " v2 \r\n\t\t\t\t\t\t\tWHERE v2.car_rental_booking_id = bookings.Id \r\n\t\t\t\t\t\t) from_day,\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT MAX(booking_date) FROM " . BOOKYOURTRAVEL_CAR_RENTAL_BOOKING_DAYS_TABLE . " v3 \r\n\t\t\t\t\t\t\tWHERE v3.car_rental_booking_id = bookings.Id \r\n\t\t\t\t\t\t) to_day, \r\n\t\t\t\t\t\tlocations.ID pick_up_location_id, \r\n\t\t\t\t\t\tlocations_2.ID drop_off_location_id,\t\t\t\t\t\r\n\t\t\t\t\t\tlocations.post_title pick_up, \r\n\t\t\t\t\t\tlocations_2.post_title drop_off\r\n\t\t\t\tFROM " . $table_name . " bookings \r\n\t\t\t\tINNER JOIN {$wpdb->posts} car_rentals ON car_rentals.ID = bookings.car_rental_id ";
if (defined('ICL_LANGUAGE_CODE') && (BYT_Theme_Utils::get_default_language() != ICL_LANGUAGE_CODE || $byt_multi_language_count > 1)) {
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations ON translations.element_type = 'post_car_rental' AND translations.language_code='" . ICL_LANGUAGE_CODE . "' AND translations.element_id = car_rentals.ID ";
$sql .= " INNER JOIN " . $wpdb->prefix . "icl_translations translations_default ON translations_default.element_type = 'post_car_rental' AND translations_default.language_code='" . BYT_Theme_Utils::get_default_language() . "' AND translations_default.trid = translations.trid ";
}
$sql .= "LEFT JOIN {$wpdb->postmeta} car_rental_meta_location ON car_rentals.ID=car_rental_meta_location.post_id AND car_rental_meta_location.meta_key='car_rental_location_post_id'\r\n\t\t\t\tLEFT JOIN {$wpdb->posts} locations ON locations.ID = car_rental_meta_location.meta_value+0\r\n\t\t\t\tLEFT JOIN {$wpdb->posts} locations_2 ON locations_2.ID = bookings.drop_off\r\n\t\t\t\tWHERE car_rentals.post_status = 'publish' AND locations.post_status = 'publish' AND locations_2.post_status = 'publish' AND bookings.Id = {$booking_id} ";
return $wpdb->get_row($sql);
}
示例4: list_accommodation_bookings
function list_accommodation_bookings($paged = null, $per_page = 0, $orderby = 'Id', $order = 'ASC', $search_term = null, $user_id = 0, $author_id = null)
{
global $wpdb, $byt_multi_language_count;
$sql = "SELECT DISTINCT bookings.*, accommodations.post_title accommodation_name, room_types.post_title room_type\r\n\t\t\t\tFROM " . BOOKYOURTRAVEL_ACCOMMODATION_BOOKINGS_TABLE . " bookings \r\n\t\t\t\tINNER JOIN {$wpdb->posts} accommodations ON accommodations.ID = bookings.accommodation_id ";
if (defined('ICL_LANGUAGE_CODE') && (BYT_Theme_Utils::get_default_language() != ICL_LANGUAGE_CODE || $byt_multi_language_count > 1)) {
$sql .= $wpdb->prepare(" INNER JOIN " . $wpdb->prefix . "icl_translations translations ON translations.element_type = 'post_accommodation' AND translations.language_code=%s AND translations.element_id = accommodations.ID ", ICL_LANGUAGE_CODE);
$sql .= $wpdb->prepare(" INNER JOIN " . $wpdb->prefix . "icl_translations translations_default ON translations_default.element_type = 'post_accommodation' AND translations_default.language_code=%s AND translations_default.trid = translations.trid ", BYT_Theme_Utils::get_default_language());
}
$sql .= " LEFT JOIN {$wpdb->posts} room_types ON room_types.ID = bookings.room_type_id ";
$sql .= " WHERE accommodations.post_status = 'publish' AND (room_types.post_status IS NULL OR room_types.post_status = 'publish') ";
if ($user_id > 0) {
$sql .= $wpdb->prepare(" AND bookings.user_id = %d ", $user_id);
}
if ($search_term != null && !empty($search_term)) {
$search_term = "%" . $search_term . "%";
$sql .= $wpdb->prepare(" AND 1=1 AND (bookings.first_name LIKE '%s' OR bookings.last_name LIKE '%s') ", $search_term, $search_term);
}
if (isset($author_id)) {
$sql .= $wpdb->prepare(" AND accommodations.post_author = %d ", $author_id);
}
if (!empty($orderby) & !empty($order)) {
$sql .= ' ORDER BY ' . $orderby . ' ' . $order;
}
$sql_count = $sql;
if (!empty($paged) && !empty($per_page)) {
$offset = ($paged - 1) * $per_page;
$sql .= $wpdb->prepare(" LIMIT %d, %d ", $offset, $per_page);
}
$results = array('total' => $wpdb->query($sql_count), 'results' => $wpdb->get_results($sql));
return $results;
}