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