本文整理汇总了PHP中EM_Event::get_location方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Event::get_location方法的具体用法?PHP EM_Event::get_location怎么用?PHP EM_Event::get_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Event
的用法示例。
在下文中一共展示了EM_Event::get_location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_publish_location
/**
* Publish the location if the event has just been approved and the location is pending. We assume an editor published the event and approves the location too.
* @param EM_Event $EM_Event
*/
public static function maybe_publish_location($EM_Event)
{
//do a dirty update for location too if it's not published
if ($EM_Event->is_published() && !empty($EM_Event->location_id)) {
$EM_Location = $EM_Event->get_location();
if ($EM_Location->location_status !== 1) {
//let's also publish the location
$EM_Location->set_status(1, true);
}
}
}
示例2: getEventPostData
/**
*
* get event post data in array.
* if the post is not event, return empty array
*/
public static function getEventPostData($postID)
{
if (self::isEventsExists() == false) {
return array();
}
$postType = get_post_type($postID);
if ($postType != EM_POST_TYPE_EVENT) {
return array();
}
$event = new EM_Event($postID, 'post_id');
$location = $event->get_location();
$arrEvent = $event->to_array();
$arrLocation = $location->to_array();
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$arrEvent["event_start_date"] = date_format(date_create_from_format('Y-m-d', $arrEvent["event_start_date"]), $date_format);
$arrEvent["event_end_date"] = date_format(date_create_from_format('Y-m-d', $arrEvent["event_end_date"]), $date_format);
$arrEvent["event_start_time"] = date_format(date_create_from_format('H:i:s', $arrEvent["event_start_time"]), $time_format);
$arrEvent["event_end_time"] = date_format(date_create_from_format('H:i:s', $arrEvent["event_end_time"]), $time_format);
$response = array();
$response["start_date"] = $arrEvent["event_start_date"];
$response["end_date"] = $arrEvent["event_end_date"];
$response["start_time"] = $arrEvent["event_start_time"];
$response["end_time"] = $arrEvent["event_end_time"];
$response["id"] = $arrEvent["event_id"];
$response["location_name"] = $arrLocation["location_name"];
$response["location_address"] = $arrLocation["location_address"];
$response["location_slug"] = $arrLocation["location_slug"];
$response["location_town"] = $arrLocation["location_town"];
$response["location_state"] = $arrLocation["location_state"];
$response["location_postcode"] = $arrLocation["location_postcode"];
$response["location_region"] = $arrLocation["location_region"];
$response["location_country"] = $arrLocation["location_country"];
$response["location_latitude"] = $arrLocation["location_latitude"];
$response["location_longitude"] = $arrLocation["location_longitude"];
return $response;
}