本文整理汇总了PHP中em_get_location函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_location函数的具体用法?PHP em_get_location怎么用?PHP em_get_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了em_get_location函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: redirection
/**
* will redirect old links to new link structures.
*/
public static function redirection()
{
global $wpdb, $wp_query;
if (is_object($wp_query) && $wp_query->get('em_redirect')) {
//is this a querystring url?
if ($wp_query->get('event_slug')) {
$event = $wpdb->get_row('SELECT event_id, post_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get('event_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
if (!empty($event)) {
$EM_Event = em_get_event($event['event_id']);
$url = get_permalink($EM_Event->post_id);
}
} elseif ($wp_query->get('location_slug')) {
$location = $wpdb->get_row('SELECT location_id, post_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='" . $wp_query->get('location_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
if (!empty($location)) {
$EM_Location = em_get_location($location['location_id']);
$url = get_permalink($EM_Location->post_id);
}
} elseif ($wp_query->get('category_slug')) {
$url = get_term_link($wp_query->get('category_slug'), EM_TAXONOMY_CATEGORY);
}
if (!empty($url)) {
wp_redirect($url, 301);
exit;
}
}
}
开发者ID:pcco,项目名称:portal-redesign,代码行数:29,代码来源:em-permalinks.php
示例2: event_get_location
/**
* Changes necessary event properties when an event is instantiated.
* Specifically, modifies the location id to the currently translated location if applicable.
* @param EM_Event $EM_Event
*/
public static function event_get_location($EM_Location, $EM_Event)
{
//check if location has a translation, if so load that one
if ($EM_Location->location_id) {
$translated_post_id = EM_ML::get_translated_post_id($EM_Location->post_id, EM_POST_TYPE_LOCATION);
if ($translated_post_id && $EM_Location->post_id != $translated_post_id) {
$EM_Location = em_get_location($translated_post_id, 'post_id');
}
}
return $EM_Location;
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:16,代码来源:em-ml-io.php
示例3: em_object_get_default_search
public static function em_object_get_default_search($defaults, $array, $super_defaults)
{
if (!empty($defaults['location'])) {
//check that this location ID is the original one, given that all events of any language will refer to the location_id of the original
$EM_Location = em_get_location($defaults['location']);
if (!EM_ML::is_original($EM_Location)) {
$defaults['location'] = EM_ML::get_original_location($EM_Location)->location_id;
}
}
return $defaults;
}
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:11,代码来源:em-ml-search.php
示例4: the_content
function the_content($content)
{
global $post, $EM_Location;
if ($post->post_type == EM_POST_TYPE_LOCATION) {
if (is_archive() || is_search()) {
if (get_option('dbem_cp_locations_archive_formats')) {
$EM_Location = em_get_location($post);
$content = $EM_Location->output(get_option('dbem_location_list_item_format'));
}
} else {
if (get_option('dbem_cp_locations_formats') && !post_password_required()) {
$EM_Location = em_get_location($post);
ob_start();
em_locate_template('templates/location-single.php', true);
$content = ob_get_clean();
}
}
}
return $content;
}
开发者ID:batruji,项目名称:metareading,代码行数:20,代码来源:em-location-post.php
示例5: columns_output
public static function columns_output($column)
{
global $post;
$post = em_get_location($post);
switch ($column) {
case 'location-id':
echo $post->location_id;
break;
case 'address':
echo $post->location_address;
break;
case 'town':
echo $post->location_town;
break;
case 'state':
echo $post->location_state;
break;
case 'country':
echo $post->location_country;
break;
}
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:22,代码来源:em-location-posts-admin.php
示例6: time
*/
global $EM_Event;
$rightNow = time();
$args = array('post_type' => 'event', 'posts_per_page' => -1, 'orderby' => 'meta_value_num', 'meta_key' => '_start_ts', 'meta_value' => $rightNow, 'meta_compare' => '>', 'order' => 'ASC');
$posts = new WP_Query($args);
header("Content-Type: application/rss+xml; charset=UTF-8");
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
?>
<NewDataSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<?php
if ($posts->have_posts()) {
while ($posts->have_posts()) {
$posts->the_post();
// Get our event object; associated location object and metadata
$EM_Event = em_get_event(get_the_ID());
$EM_Location = em_get_location($EM_Event->location_id);
$meta = get_post_custom();
?>
<DataSet1>
<Title><?php
echo get_the_title();
?>
</Title>
<Description><?php
echo strip_tags(get_the_content());
?>
</Description>
<Location><?php
echo $EM_Location->location_name;
if ($meta['Room'][0] != '') {
echo ", " . $meta['Room'][0];
开发者ID:hmcmathcomp,项目名称:wpdev-hmc-edu,代码行数:31,代码来源:page-custom-feed.php
示例7: get_location
/**
* Returns the location object this event belongs to.
* @return EM_Location
*/
function get_location()
{
global $EM_Location;
if (is_object($EM_Location) && $EM_Location->location_id == $this->location_id) {
$this->location = $EM_Location;
} else {
if (!is_object($this->location) || $this->location->location_id != $this->location_id) {
$this->location = apply_filters('em_event_get_location', em_get_location($this->location_id), $this);
}
}
return $this->location;
}
开发者ID:rolka,项目名称:events-manager,代码行数:16,代码来源:em-event.php
示例8: em_load_event
/**
* This function will load an event into the global $EM_Event variable during page initialization, provided an event_id is given in the url via GET or POST.
* global $EM_Recurrences also holds global array of recurrence objects when loaded in this instance for performance
* All functions (admin and public) can now work off this object rather than it around via arguments.
* @return null
*/
function em_load_event()
{
global $EM_Event, $EM_Recurrences, $EM_Location, $EM_Person, $EM_Booking, $EM_Category, $EM_Ticket, $current_user;
if (!defined('EM_LOADED')) {
$EM_Recurrences = array();
if (isset($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id']) && !is_object($EM_Event)) {
$EM_Event = new EM_Event($_REQUEST['event_id']);
} elseif (isset($_REQUEST['post']) && (get_post_type($_REQUEST['post']) == 'event' || get_post_type($_REQUEST['post']) == 'event-recurring')) {
$EM_Event = em_get_event($_REQUEST['post'], 'post_id');
} elseif (!empty($_REQUEST['event_slug']) && EM_MS_GLOBAL && is_main_site() && !get_site_option('dbem_ms_global_events_links')) {
// single event page for a subsite event being shown on the main blog
global $wpdb;
$matches = array();
if (preg_match('/\\-([0-9]+)$/', $_REQUEST['event_slug'], $matches)) {
$event_id = $matches[1];
} else {
$event_id = $wpdb->get_var('SELECT event_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='{$_REQUEST['event_slug']}' AND blog_id!=" . get_current_blog_id());
}
$EM_Event = em_get_event($event_id);
}
if (isset($_REQUEST['location_id']) && is_numeric($_REQUEST['location_id']) && !is_object($EM_Location)) {
$EM_Location = new EM_Location($_REQUEST['location_id']);
} elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']) == 'location') {
$EM_Location = em_get_location($_REQUEST['post'], 'post_id');
} elseif (!empty($_REQUEST['location_slug']) && EM_MS_GLOBAL && is_main_site() && !get_site_option('dbem_ms_global_locations_links')) {
// single event page for a subsite event being shown on the main blog
global $wpdb;
$matches = array();
if (preg_match('/\\-([0-9]+)$/', $_REQUEST['location_slug'], $matches)) {
$location_id = $matches[1];
} else {
$location_id = $wpdb->get_var('SELECT location_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='{$_REQUEST['location_slug']}' AND blog_id!=" . get_current_blog_id());
}
$EM_Location = em_get_location($location_id);
}
if (is_user_logged_in() || !empty($_REQUEST['person_id']) && is_numeric($_REQUEST['person_id'])) {
//make the request id take priority, this shouldn't make it into unwanted objects if they use theobj::get_person().
if (!empty($_REQUEST['person_id'])) {
$EM_Person = new EM_Person($_REQUEST['person_id']);
} else {
$EM_Person = new EM_Person(get_current_user_id());
}
}
if (isset($_REQUEST['booking_id']) && is_numeric($_REQUEST['booking_id']) && !is_object($_REQUEST['booking_id'])) {
$EM_Booking = new EM_Booking($_REQUEST['booking_id']);
}
if (isset($_REQUEST['category_id']) && is_numeric($_REQUEST['category_id']) && !is_object($_REQUEST['category_id'])) {
$EM_Category = new EM_Category($_REQUEST['category_id']);
} elseif (isset($_REQUEST['category_slug']) && !is_object($EM_Category)) {
$EM_Category = new EM_Category($_REQUEST['category_slug']);
}
if (isset($_REQUEST['ticket_id']) && is_numeric($_REQUEST['ticket_id']) && !is_object($_REQUEST['ticket_id'])) {
$EM_Ticket = new EM_Ticket($_REQUEST['ticket_id']);
}
define('EM_LOADED', true);
}
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:63,代码来源:events-manager.php
示例9: get_original
/**
* Returns the original EM_Location object from the provided EM_Location object
* @param EM_Location|EM_Event $object
* @return EM_Location|EM_Event
*/
public static function get_original($object)
{
global $em_wpml_original_cache, $pagenow;
if (!empty($em_wpml_original_cache[$object->blog_id][$object->post_id])) {
//we have done this before....
$original_post_id = $em_wpml_original_cache[$object->blog_id][$object->post_id];
//retrieve cached ID
} else {
//find the original post id via WPML
$original_post_id = SitePress::get_original_element_id($object->post_id, 'post_' . $object->post_type);
//check a few admin specific stuff if a standard check didn't work, in case we're in the admin area translating via WPML
if (empty($original_post_id) && is_admin()) {
if (!empty($_REQUEST['trid'])) {
//we are adding a new translation belonging to a trid set
$original_post_id = SitePress::get_original_element_id_by_trid($_REQUEST['trid']);
} elseif (!empty($_REQUEST['icl_translation_of'])) {
//a new translation has just been submitted
$translation_of = $_REQUEST['icl_translation_of'];
//could be a translation from another translation, e.g. try adding a translation from a second language
$original_post_id = SitePress::get_original_element_id($translation_of, 'post_' . $object->post_type);
}
}
}
//save to the cache (whether already saved or not)
$em_wpml_original_cache[$object->blog_id][$object->post_id] = $original_post_id;
//if the post_ids don't match then the original translation is different to the one passed on, so switch the $object to that translation
if ($original_post_id != $object->post_id) {
//get the EM_Event or EM_Location object
if ($object->post_type == EM_POST_TYPE_EVENT) {
$object = em_get_event($original_post_id, 'post_id');
} elseif ($object->post_type == EM_POST_TYPE_LOCATION) {
$object = em_get_location($original_post_id, 'post_id');
}
}
return $object;
}
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:41,代码来源:events-manager-wpml.php
示例10: untrashed_post
function untrashed_post($post_id)
{
if (get_post_type($post_id) == EM_POST_TYPE_LOCATION) {
global $EM_Notices;
$EM_Location = em_get_location($post_id, 'post_id');
$EM_Location->set_status(1);
$EM_Notices->remove_all();
//no validation/notices needed
}
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:10,代码来源:em-location-post-admin.php
示例11: get
/**
* Returns an array of EM_Location objects
* @param boolean $eventful
* @param boolean $return_objects
* @return array
*/
public static function get($args = array(), $count = false)
{
global $wpdb;
$events_table = EM_EVENTS_TABLE;
$locations_table = EM_LOCATIONS_TABLE;
$locations = array();
//Quick version, we can accept an array of IDs, which is easy to retrieve
if (self::array_is_numeric($args)) {
//Array of numbers, assume they are event IDs to retreive
//We can just get all the events here and return them
$sql = "SELECT * FROM {$locations_table} WHERE location_id=" . implode(" OR location_id=", $args);
$results = $wpdb->get_results($sql, ARRAY_A);
$events = array();
foreach ($results as $result) {
$locations[$result['location_id']] = new EM_Location($result);
}
return apply_filters('em_locations_get', $locations, $args);
//We return all the events matched as an EM_Event array.
} elseif (is_numeric($args)) {
//return an event in the usual array format
return apply_filters('em_locations_get', array(new EM_Location($args)), $args);
} elseif (is_array($args) && is_object(current($args)) && get_class(current($args)) == 'EM_Location') {
return apply_filters('em_locations_get', $args, $args);
}
//We assume it's either an empty array or array of search arguments to merge with defaults
$args = self::get_default_search($args);
$limit = $args['limit'] && is_numeric($args['limit']) ? "LIMIT {$args['limit']}" : '';
$offset = $limit != "" && is_numeric($args['offset']) ? "OFFSET {$args['offset']}" : '';
//Get the default conditions
$conditions = self::build_sql_conditions($args);
//Put it all together
$EM_Location = new EM_Location(0);
//Empty class for strict message avoidance
$fields = $locations_table . "." . implode(", {$locations_table}.", array_keys($EM_Location->fields));
$where = count($conditions) > 0 ? " WHERE " . implode(" AND ", $conditions) : '';
//Get ordering instructions
$EM_Event = new EM_Event();
//blank event for below
$accepted_fields = $EM_Location->get_fields(true);
$accepted_fields = array_merge($EM_Event->get_fields(true), $accepted_fields);
$orderby = self::build_sql_orderby($args, $accepted_fields, get_option('dbem_events_default_order'));
//Now, build orderby sql
$orderby_sql = count($orderby) > 0 ? 'ORDER BY ' . implode(', ', $orderby) : '';
$fields = $count ? $locations_table . '.location_id' : $locations_table . '.post_id';
if (EM_MS_GLOBAL) {
$selectors = $count ? 'COUNT(' . $locations_table . '.location_id)' : $locations_table . '.post_id, ' . $locations_table . '.blog_id';
} else {
$selectors = $count ? 'COUNT(' . $locations_table . '.location_id)' : $locations_table . '.post_id';
}
//Create the SQL statement and execute
$sql = "\r\n\t\t\tSELECT {$selectors} FROM {$locations_table}\r\n\t\t\tLEFT JOIN {$events_table} ON {$locations_table}.location_id={$events_table}.location_id\r\n\t\t\t{$where}\r\n\t\t\tGROUP BY {$locations_table}.location_id\r\n\t\t\t{$orderby_sql}\r\n\t\t\t{$limit} {$offset}\r\n\t\t";
//If we're only counting results, return the number of results
if ($count) {
return apply_filters('em_locations_get_array', count($wpdb->get_col($sql)), $args);
}
$results = $wpdb->get_results($sql, ARRAY_A);
//If we want results directly in an array, why not have a shortcut here?
if ($args['array'] == true) {
return apply_filters('em_locations_get_array', $results, $args);
}
if (EM_MS_GLOBAL) {
foreach ($results as $location) {
if (empty($location['blog_id'])) {
$location['blog_id'] = get_current_site()->blog_id;
}
$locations[] = em_get_location($location['post_id'], $location['blog_id']);
}
} else {
foreach ($results as $location) {
$locations[] = em_get_location($location['post_id'], 'post_id');
}
}
return apply_filters('em_locations_get', $locations, $args);
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:80,代码来源:em-locations.php
示例12: get_location
/**
* Returns the location object this event belongs to.
* @return EM_Location
*/
function get_location()
{
global $EM_Location;
if (is_object($EM_Location) && $EM_Location->location_id == $this->location_id) {
$this->location = $EM_Location;
} else {
if (!is_object($this->location) || $this->location->location_id != $this->location_id) {
$this->location = em_get_location($this->location_id);
}
}
return $this->location;
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:16,代码来源:em-event.php
示例13: strtotime
$old_time_timestamp = strtotime($old_time);
$new_time = date('h:iA', $old_time_timestamp);
?>
<strong><?php
echo $new_date;
?>
</strong>
<strong><?php
echo $new_time;
?>
</strong>
</div>
<div class="col-two pull-left">
<?php
$location = em_get_location(get_post_meta($post->ID, '_location_id', true));
if ($location->location_name != '') {
?>
<span>Location</span>
<strong><?php
echo $location->location_name;
?>
</br>
<?php
echo $location->location_address;
?>
</br>
<?php
echo $location->location_town;
?>
, <?php
开发者ID:jackrabbit-design,项目名称:itg,代码行数:31,代码来源:template-events.php
示例14: elseif
}
?>
</select>
</td>
</tr>
</table>
<?php
} else {
?>
<table class="em-location-data">
<?php
global $EM_Location;
if ($EM_Event->location_id !== 0) {
$EM_Location = $EM_Event->get_location();
} elseif (get_option('dbem_default_location') > 0) {
$EM_Location = em_get_location(get_option('dbem_default_location'));
} else {
$EM_Location = new EM_Location();
}
?>
<tr class="em-location-data-name">
<th><?php
_e('Location Name:', 'events-manager');
?>
</th>
<td>
<input id='location-id' name='location_id' type='hidden' value='<?php
echo $EM_Location->location_id;
?>
' size='15' />
<input id="location-name" type="text" name="location_name" value="<?php
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:31,代码来源:location.php
示例15: post_class
<div <?php
post_class("teaser");
?>
>
<?php
// Date formats
$datebox_format = 'M \\<\\s\\p\\a\\n \\c\\l\\a\\s\\s=\\"\\d\\a\\t\\e\\-\\b\\i\\g\\"\\>j\\<\\/\\s\\p\\a\\n\\> Y';
$atc_format = 'Y-m-d H:i:s';
$loc_id = !empty($meta['_location_id']) ? $meta['_location_id'][0] : false;
if ($loc_id) {
global $EM_Location;
$location_obj;
if (is_object($EM_Location) && $EM_Location->location_id == $loc_id) {
$location_obj = $EM_Location;
} else {
$location_obj = apply_filters('em_event_get_location', em_get_location($loc_id));
}
$location = !is_object($location_obj) ? false : $location_obj->location_address . ', ' . $location_obj->location_town . ', ' . $location_obj->location_state . ' ' . $location_obj->location_postcode;
}
$start = !empty($meta['_start_ts']) ? $meta['_start_ts'][0] : 0;
$end = !empty($meta['_end_ts']) ? $meta['_end_ts'][0] : 0;
// d($meta);
$time = __("All day", 'proud-core');
if ($start && !empty($meta['_event_start_time']) && $meta['_event_start_time'][0] != "00:00:00") {
$time = date_i18n('h:i a', $meta['_start_ts'][0]);
}
?>
<div class="row">
<div class="col-xs-3 col-md-2">
<div class="date-box"><?php
echo date_i18n($datebox_format, $start);
开发者ID:proudcity,项目名称:wp-proud-theme,代码行数:31,代码来源:teaser-event-list.php
示例16: meta_boxes
public static function meta_boxes()
{
global $EM_Location, $post;
//no need to proceed if we're not dealing with a location
if ($post->post_type != EM_POST_TYPE_LOCATION) {
return;
}
//since this is the first point when the admin area loads location stuff, we load our EM_Event here
if (empty($EM_Location) && !empty($post)) {
$EM_Location = em_get_location($post->ID, 'post_id');
}
add_meta_box('em-location-where', __('Where', 'dbem'), array('EM_Location_Post_Admin', 'meta_box_where'), EM_POST_TYPE_LOCATION, 'normal', 'high');
//add_meta_box('em-location-metadump', __('EM_Location Meta Dump','dbem'), array('EM_Location_Post_Admin','meta_box_metadump'),EM_POST_TYPE_LOCATION, 'normal','high');
if (get_option('dbem_location_attributes_enabled')) {
add_meta_box('em-location-attributes', __('Attributes', 'dbem'), array('EM_Location_Post_Admin', 'meta_box_attributes'), EM_POST_TYPE_LOCATION, 'normal', 'default');
}
}
开发者ID:Olaf1989,项目名称:Cakes-and-more,代码行数:17,代码来源:em-location-post-admin.php
示例17: em_get_location_shortcode
/**
* Shows a single location according to given specifications. Accepts any event query attribute.
* @param array $atts
* @return string
*/
function em_get_location_shortcode($atts, $format = '')
{
$atts = (array) $atts;
$atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
$atts['format'] = html_entity_decode($atts['format']);
//shorcode doesn't accept html
if (!empty($atts['location']) && is_numeric($atts['location'])) {
$EM_Location = em_get_location($atts['location']);
return !empty($atts['format']) ? $EM_Location->output($atts['format']) : $EM_Location->output_single();
} elseif (!empty($atts['post_id']) && is_numeric($atts['post_id'])) {
$EM_Location = em_get_location($atts['post_id'], 'post_id');
return !empty($atts['format']) ? $EM_Location->output($atts['format']) : $EM_Location->output_single();
}
}
开发者ID:rajankz,项目名称:webspace,代码行数:19,代码来源:em-shortcode.php
示例18: em_get_location
* Override this template by copying it to yourtheme/loop-event/location-details.php
*
* @author Digital Factory
* @package Events Maker/Templates
* @since 1.2.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
?>
<div class="archive-meta entry-meta">
<?php
$location = em_get_location();
$location_details = $location->location_meta;
?>
<?php
if (!empty($location) && !is_wp_error($location)) {
?>
<?php
if (!empty($location_details['address'])) {
?>
<div class="location-address"><strong><?php
echo __('Address', 'events-maker');
?>
:</strong> <?php
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:31,代码来源:location-details.php
示例19: empty
<?php
/**
* Event location image
*
* Override this template by copying it to yourtheme/loop-event/location-image.php
*
* @author Digital Factory
* @package Events Maker/Templates
* @since 1.6.0
*/
if (!defined('ABSPATH')) {
exit;
}
// exit if accessed directly
global $location;
// get the term if not set
$location = empty($location) ? em_get_location() : $location;
// image
if (!empty($location->location_meta['image'])) {
$image_title = apply_filters('em_loop_event_location_thumbnail_title', esc_html($location->name));
$image_link = apply_filters('em_loop_event_location_thumbnail_link', get_term_link(absint($location->term_id), esc_attr($location->taxonomy)));
$size = apply_filters('em_loop_event_location_thumbnail_size', 'post-thumbnail');
$attr = apply_filters('em_loop_event_location_thumbnail_attr', array('title' => $image_title));
$image = wp_get_attachment_image($location->location_meta['image'], $size, $attr);
echo apply_filters('em_loop_event_location_thumbnail_html', sprintf('<a href="%s" class="post-thumbnail term-thumbnail" title="%s" rel="bookmark">%s</a>', $image_link, $image_title, $image), $location);
}
开发者ID:patlegris,项目名称:On-Off,代码行数:27,代码来源:location-image.php
示例20: get_translation
/**
* Gets and EM_Event or EM_Location object of the desired language $lang for the passed EM_Event or EM_Location $object, returns same object if already in requested language.
* If $language is false or not provided, another translation of $object should be returned with precedence for the main language of this blog if $object isn't in that language.
* This function ouptut does not need to be filtered by a ML plugin if em_ml_get_tralsation_id is already filtered and efficiently provides an ID without loading the object too (otherwise object may be loaded twice unecessarily).
* @uses EM_ML::get_translation_id()
* @param EM_Event|EM_Location $object
* @param string $language Optional. WPLANG accepted value or false
* @return EM_Event|EM_Location
*/
public static function get_translation($object, $language = false)
{
$translated_id = self::get_translation_id($object, $language);
$translated_object = $object;
//return $object if the condition below isn't met
if ($object->post_id != $translated_id) {
if ($object->post_type == EM_POST_TYPE_EVENT) {
$translated_object = em_get_event($translated_id, 'post_id');
}
if ($object->post_type == EM_POST_TYPE_LOCATION) {
$translated_object = em_get_location($translated_id, 'post_id');
}
}
return apply_filters('em_ml_get_translation', $translated_object, $object, $language);
}
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:24,代码来源:em-ml.php
注:本文中的em_get_location函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论