本文整理汇总了PHP中em_get_location函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_location函数的具体用法?PHP em_get_location怎么用?PHP em_get_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了em_get_location函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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];
示例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;
}
示例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);
}
}
示例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;
}
示例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
}
}
示例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);
}
示例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;
}
示例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
示例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
示例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);