本文整理汇总了PHP中EM_Events::output方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Events::output方法的具体用法?PHP EM_Events::output怎么用?PHP EM_Events::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Events
的用法示例。
在下文中一共展示了EM_Events::output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: em_get_events
/**
* Returns a html list of events filtered by the array or query-string of arguments supplied.
* @param array|string $args
* @return string
*/
function em_get_events($args = array())
{
if (is_string($args) && strpos($args, "=")) {
// allows the use of arguments without breaking the legacy code
$args = wp_parse_args($args, array());
} else {
$args = (array) $args;
}
$args['ajax'] = isset($args['ajax']) ? $args['ajax'] : !defined('EM_AJAX') || EM_AJAX;
$args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit');
if (empty($args['format']) && empty($args['format_header']) && empty($args['format_footer'])) {
ob_start();
if (!empty($args['ajax'])) {
echo '<div class="em-search-ajax">';
}
//open AJAX wrapper
em_locate_template('templates/events-list.php', true, array('args' => $args));
if (!empty($args['ajax'])) {
echo "</div>";
}
//close AJAX wrapper
$return = ob_get_clean();
} else {
$return = EM_Events::output($args);
}
return $return;
}
示例2: bp_em_events_content
function bp_em_events_content()
{
global $bp, $EM_Notices;
echo $EM_Notices;
?>
<h4><?php
_e('My Events', 'dbem');
?>
</h4>
<?php
$events = EM_Events::get(array('owner' => $bp->displayed_user->id));
if (count($events) > 0) {
$args = array('format_header' => get_option('dbem_bp_events_list_format_header'), 'format' => get_option('dbem_bp_events_list_format'), 'format_footer' => get_option('dbem_bp_events_list_format_footer'), 'owner' => $bp->displayed_user->id);
echo EM_Events::output($events, $args);
} else {
?>
<p><?php
_e('No Events', 'dbem');
?>
</p>
<?php
}
?>
<h4><?php
_e("Events I'm Attending", 'dbem');
?>
</h4>
<?php
bp_em_attending_content();
}
示例3: em_get_events_list_shortcode
/**
* Shows a list of events according to given specifications. Accepts any event query attribute.
* @param array $args
* @return string
*/
function em_get_events_list_shortcode($args, $format = '')
{
$args = (array) $args;
$args['ajax'] = isset($args['ajax']) ? $args['ajax'] : !defined('EM_AJAX') || EM_AJAX;
$args['format'] = $format != '' || empty($args['format']) ? $format : $args['format'];
$args['format'] = html_entity_decode($args['format']);
//shortcode doesn't accept html
$args['limit'] = isset($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit');
if (empty($args['format']) && empty($args['format_header']) && empty($args['format_footer'])) {
ob_start();
if (!empty($args['ajax'])) {
echo '<div class="em-search-ajax">';
}
//open AJAX wrapper
em_locate_template('templates/events-list.php', true, array('args' => $args));
if (!empty($args['ajax'])) {
echo "</div>";
}
//close AJAX wrapper
$return = ob_get_clean();
} else {
$args['ajax'] = false;
$pno = !empty($_GET['pno']) && is_numeric($_GET['pno']) ? $_GET['pno'] : 1;
$args['page'] = !empty($args['page']) && is_numeric($args['page']) ? $args['page'] : $pno;
$return = EM_Events::output($args);
}
return $return;
}
示例4: em_get_events
/**
* Returns a html list of events filtered by the array or query-string of arguments supplied.
* @param array|string $args
* @return string
*/
function em_get_events($args = array())
{
if (is_string($args) && strpos($args, "=")) {
// allows the use of arguments without breaking the legacy code
$defaults = EM_Events::get_default_search();
$args = wp_parse_args($args, $defaults);
}
return EM_Events::output($args);
}
示例5: getPastEvents
/**
* Get past events
* @return string HTML
*/
public static function getPastEvents()
{
return \EM_Events::output(array('format_header' => '<ul>', 'format' => '<li>
<div>#_{j M Y}</div>
<h3>#_EVENTNAME</h3>
<div>#_EVENTNOTES</div>
<a href="#_EVENTURL">En savoir plus</a>
</li>', 'format_footer' => '</ul>', 'scope' => 'past', 'order' => 'DESC', 'limit' => 3, 'pagination' => true));
}
示例6: getPastEvents
/**
* Get past events.
*
* @return string HTML
*/
public static function getPastEvents()
{
return \EM_Events::output(['format_header' => '<ul class="eventList grid-3-medium-2-small-2-tiny-1">', 'format' => '<li class="eventItem">
<div class="eventDate">#_{j M Y}</div>
<div class="eventImg"><a href="#_EVENTURL">#_EVENTIMAGE{372,372}</a></div>
<h3 class="eventTitle"><a href="#_EVENTURL">#_EVENTNAME</a></h3>
<div class="eventDesc">#_EVENTNOTES</div>
</li>', 'format_footer' => '</ul>', 'scope' => 'past', 'order' => 'DESC', 'limit' => 3, 'pagination' => true]);
}
示例7: em_get_events_list_shortcode
/**
* Shows a list of events according to given specifications. Accepts any event query attribute.
* @param array $atts
* @return string
*/
function em_get_events_list_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
$atts['page'] = !empty($atts['page']) && is_numeric($atts['page']) ? $atts['page'] : 1;
$atts['page'] = !empty($_GET['pno']) && is_numeric($_GET['pno']) ? $_GET['pno'] : $atts['page'];
return EM_Events::output($atts);
}
示例8: dbem_get_events_list
/**
* TOTALLY DEPRECIATED (NOT ALTERNATIVE TAG) - Just use EM_Events::output, see below
* @param unknown_type $limit
* @param unknown_type $scope
* @param unknown_type $order
* @param unknown_type $format
* @param unknown_type $echo
* @param unknown_type $category
* @return unknown_type
*/
function dbem_get_events_list($limit = "10", $scope = "future", $order = "ASC", $format = '', $echo = 1, $category = '')
{
if (strpos($limit, "=")) {
// allows the use of arguments without breaking the legacy code
$defaults = EM_Events::get_default_search();
$r = wp_parse_args($limit, $defaults);
extract($r, EXTR_OVERWRITE);
}
$return = EM_Events::output(array('limit' => $limit, 'scope' => $scope, 'order' => $order, 'format' => $format, 'category' => $category));
if ($echo) {
echo $return;
}
return $return;
}
示例9: em_get_events_list_shortcode_all
function em_get_events_list_shortcode_all($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
$atts['page'] = !empty($atts['page']) && is_numeric($atts['page']) ? $atts['page'] : 1;
$atts['page'] = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : $atts['page'];
// get recurrence events
$atts['recurring'] = 1;
$evts_recurring = EM_Events::get($atts);
// get non-recurrence events
$atts['recurring'] = 0;
$evts = EM_Events::get($atts);
// filter out the events that are instances of recurring events
$non_recurrence_evts = array_filter($evts, 'is_no_recurrence');
// merge recurrence and non-recurring events
$evts_all = array_merge($non_recurrence_evts, $evts_recurring);
// sort them by start==start date+time
usort($evts_all, 'evt_start_sort');
//
return EM_Events::output($evts_all, $atts);
}
示例10: em_content
/**
* Filters for page content and if an event replaces it with the relevant event data.
* @param $data
* @return string
*/
function em_content($content)
{
$events_page_id = get_option('dbem_events_page');
if (get_the_ID() == $events_page_id && $events_page_id != 0) {
global $wpdb, $EM_Event;
//TODO FILTER - filter em page content before placeholder replacing
//TODO any loop should put the current $EM_Event etc. into the global variable
//general defaults
$args = array('orderby' => get_option('dbem_events_default_orderby'), 'order' => get_option('dbem_events_default_order'), 'owner' => false, 'pagination' => 1);
if (!empty($_REQUEST['calendar_day'])) {
//Events for a specific day
$args['scope'] = $_REQUEST['calendar_day'];
$page = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
$events = EM_Events::get(apply_filters('em_content_calendar_day_args', $args));
//Get events first, so we know how many there are in advance
if (count($events) > 1 || $page > 1 || get_option('dbem_display_calendar_day_single') == 1) {
$args['limit'] = get_option('dbem_events_default_limit');
$args['offset'] = $args['limit'] * ($page - 1);
$content = EM_Events::output($events, apply_filters('em_content_calendar_day_output_args', $args));
} elseif (count($events) == 1) {
$EM_Event = $events[0];
$content = $EM_Event->output_single();
} else {
$content = get_option('dbem_no_events_message');
}
} elseif (!empty($_REQUEST['location_id']) && is_numeric($_REQUEST['location_id'])) {
//Just a single location
$location = new EM_Location($_REQUEST['location_id']);
$content = $location->output_single();
} elseif (!empty($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id'])) {
// single event page
$event = new EM_Event($_REQUEST['event_id']);
$content = $event->output_single();
} elseif (!empty($_REQUEST['bookings_id'])) {
//bookings page
} else {
// Multiple events page
$scope = !empty($_REQUEST['scope']) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
//If we have a $_GET['page'] var, use it to calculate the offset/limit ratios (safer than offset/limit get vars)
$args['scope'] = $scope;
if (!empty($_REQUEST['category_id'])) {
$args['category'] = $_REQUEST['category_id'];
}
if (get_option('dbem_display_calendar_in_events_page')) {
$args['full'] = 1;
$args['long_events'] = get_option('dbem_full_calendar_long_events');
$content = EM_Calendar::output(apply_filters('em_content_calendar_args', $args));
} else {
$args['limit'] = get_option('dbem_events_default_limit');
$args['page'] = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
/*calculate event list time range */
$time_limit = get_option('dbem_events_page_time_limit');
if (is_numeric($time_limit) && $time_limit > 0) {
$args['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($time_limit - 1) . ' month'));
}
$content = EM_Events::output(apply_filters('em_content_events_args', $args));
}
}
//If disable rewrite flag is on, then we need to add a placeholder here
if (get_option('dbem_disable_title_rewrites') == 1) {
$content = str_replace('#_PAGETITLE', em_events_page_title(''), get_option('dbem_title_html')) . $content;
}
//TODO FILTER - filter em page content before display
return apply_filters('em_content', '<div id="em-wrapper">' . $content . '</div>');
}
return $content;
}
示例11: output
function output($format, $target = "html")
{
preg_match_all('/\\{([a-zA-Z0-9_]+)\\}([^{]+)\\{\\/[a-zA-Z0-9_]+\\}/', $format, $conditionals);
if (count($conditionals[0]) > 0) {
//Check if the language we want exists, if not we take the first language there
foreach ($conditionals[1] as $key => $condition) {
$format = str_replace($conditionals[0][$key], apply_filters('em_category_output_condition', '', $condition, $conditionals[0][$key], $this), $format);
}
}
$category_string = $format;
preg_match_all("/(#@?_?[A-Za-z0-9]+)({([a-zA-Z0-9,]+)})?/", $format, $placeholders);
foreach ($placeholders[1] as $key => $result) {
$replace = '';
$full_result = $placeholders[0][$key];
switch ($result) {
case '#_CATEGORYNAME':
$replace = $this->name;
break;
case '#_CATEGORYID':
$replace = $this->term_id;
break;
case '#_CATEGORYNOTES':
case '#_CATEGORYDESCRIPTION':
$replace = $this->description;
break;
case '#_CATEGORYIMAGE':
case '#_CATEGORYIMAGEURL':
if ($this->get_image_url() != '') {
if ($result == '#_CATEGORYIMAGEURL') {
$replace = $this->get_image_url();
} else {
if (empty($placeholders[3][$key])) {
$replace = "<img src='" . esc_url($this->get_image_url()) . "' alt='" . esc_attr($this->name) . "'/>";
} else {
$image_size = explode(',', $placeholders[3][$key]);
if ($this->array_is_numeric($image_size) && count($image_size) > 1) {
if (get_option('dbem_disable_timthumb') && $this->get_image_id()) {
//since we previously didn't store image ids along with the url to the image (since taxonomies don't allow normal featured images), sometimes we won't be able to do this, which is why we check there's a valid image id first
$this->ms_global_switch();
$replace = wp_get_attachment_image($this->get_image_id(), $image_size);
$this->ms_global_switch_back();
} else {
$replace = "<img src='" . em_get_thumbnail_url($this->get_image_url(), $image_size[0], $image_size[1]) . "' alt='" . esc_attr($this->name) . "' width='{$image_size[0]}' height='{$image_size[1]}'/>";
}
} else {
$replace = "<img src='" . esc_url($this->get_image_url()) . "' alt='" . esc_attr($this->name) . "'/>";
}
}
}
}
break;
case '#_CATEGORYCOLOR':
$replace = $this->get_color();
break;
case '#_CATEGORYLINK':
case '#_CATEGORYURL':
$link = $this->get_url();
$replace = $result == '#_CATEGORYURL' ? $link : '<a href="' . $link . '">' . esc_html($this->name) . '</a>';
break;
case '#_CATEGORYSLUG':
$replace = $this->slug;
break;
case '#_CATEGORYEVENTSPAST':
//depreciated, erroneous documentation, left for compatability
//depreciated, erroneous documentation, left for compatability
case '#_CATEGORYEVENTSNEXT':
//depreciated, erroneous documentation, left for compatability
//depreciated, erroneous documentation, left for compatability
case '#_CATEGORYEVENTSALL':
//depreciated, erroneous documentation, left for compatability
//depreciated, erroneous documentation, left for compatability
case '#_CATEGORYPASTEVENTS':
case '#_CATEGORYNEXTEVENTS':
case '#_CATEGORYALLEVENTS':
//convert depreciated placeholders for compatability
$result = $result == '#_CATEGORYEVENTSPAST' ? '#_CATEGORYPASTEVENTS' : $result;
$result = $result == '#_CATEGORYEVENTSNEXT' ? '#_CATEGORYNEXTEVENTS' : $result;
$result = $result == '#_CATEGORYEVENTSALL' ? '#_CATEGORYALLEVENTS' : $result;
//forget it ever happened? :/
if ($result == '#_CATEGORYPASTEVENTS') {
$scope = 'past';
} elseif ($result == '#_CATEGORYNEXTEVENTS') {
$scope = 'future';
} else {
$scope = 'all';
}
$events_count = EM_Events::count(array('category' => $this->term_id, 'scope' => $scope));
if ($events_count > 0) {
$args = array('category' => $this->term_id, 'scope' => $scope, 'pagination' => 1);
$args['format_header'] = get_option('dbem_category_event_list_item_header_format');
$args['format_footer'] = get_option('dbem_category_event_list_item_footer_format');
$args['format'] = get_option('dbem_category_event_list_item_format');
$args['limit'] = get_option('dbem_category_event_list_limit');
$args['page'] = !empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$replace = EM_Events::output($args);
} else {
$replace = get_option('dbem_category_no_events_message', '</ul>');
}
break;
default:
//.........这里部分代码省略.........
示例12: is_numeric
<?php
/*
* Default Calendar day
* This page displays a list of events or single event for a specific calendar day, called during the em_content() if this is an calendar day page.
* You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
* You can display events however you wish, there are a few variables made available to you:
*
* $args - the args passed onto EM_Events::output()
*
*/
$args['scope'] = $_REQUEST['calendar_day'];
$page = !empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$events = EM_Events::get(apply_filters('em_content_calendar_day_args', $args));
//Get events first, so we know how many there are in advance
if (count($events) > 1 || $page > 1 || get_option('dbem_display_calendar_day_single') == 1) {
$args['limit'] = get_option('dbem_events_default_limit');
$args['offset'] = $args['limit'] * ($page - 1);
echo EM_Events::output($events, apply_filters('em_content_calendar_day_output_args', $args));
} elseif (count($events) == 1) {
$EM_Event = $events[0];
echo $EM_Event->output_single();
} else {
echo get_option('dbem_no_events_message');
}
示例13: get_post
echo get_post(get_post_thumbnail_id())->post_excerpt;
echo "</p></figcaption>";
echo "</figure>";
}
?>
<?php
the_content();
?>
<section class="content-band" id="library-content">
<h1 class="content-band-title">Special events</h1>
<?php
echo EM_Events::output(array('limit' => 30, 'location' => $EM_Location->location_id, 'pagination' => 1));
?>
</section>
</div>
</div> <!-- end entry-content style -->
</div> <!-- end .g-row -->
</article>
</div> <!-- end .inner-wrapper -->
<?php
示例14: array
<ul class="events-list">
<?php
$parameters = array('format' => '<li>
<h6 class="event-start">
<time class="event-month" datetime="#M">#M</time>
<time class="event-date" datetime="#j">#j</time>
<time class="event-day" datetime="#D">#D</time>
</h6>
<h3 class="post-title event-title">#_EVENTLINK</h3>
</li>');
// TODO: Add exclude site customization?
if (!empty($eventnumber)) {
$parameters['limit'] = $eventnumber;
}
$events = EM_Events::output($parameters);
?>
<?php
echo $events;
?>
<li class="event-promo"><h3 class="promo-title"><a href="/events" title="Calendar">View all events</a></h3></li>
</ul>
</article>
<?php
} else {
?>
<?php
get_template_part('partials/error', 'plugin');
示例15: output
function output($format, $target = "html")
{
$location_string = $format;
//First let's do some conditional placeholder removals
for ($i = 0; $i < EM_CONDITIONAL_RECURSIONS; $i++) {
//you can add nested recursions by modifying this setting in your wp_options table
preg_match_all('/\\{([a-zA-Z0-9_]+)\\}(.+?)\\{\\/\\1\\}/s', $location_string, $conditionals);
if (count($conditionals[0]) > 0) {
//Check if the language we want exists, if not we take the first language there
foreach ($conditionals[1] as $key => $condition) {
$show_condition = false;
if ($condition == 'has_loc_image') {
//does this event have an image?
$show_condition = $this->get_image_url() != '';
} elseif ($condition == 'no_loc_image') {
//does this event have an image?
$show_condition = $this->get_image_url() == '';
}
$show_condition = apply_filters('em_location_output_show_condition', $show_condition, $condition, $conditionals[0][$key], $this);
if ($show_condition) {
//calculate lengths to delete placeholders
$placeholder_length = strlen($condition) + 2;
$replacement = substr($conditionals[0][$key], $placeholder_length, strlen($conditionals[0][$key]) - ($placeholder_length * 2 + 1));
} else {
$replacement = '';
}
$location_string = str_replace($conditionals[0][$key], apply_filters('em_location_output_condition', $replacement, $condition, $conditionals[0][$key], $this), $location_string);
}
}
}
//This is for the custom attributes
preg_match_all('/#_LATT\\{([^}]+)\\}(\\{([^}]+)\\})?/', $location_string, $results);
foreach ($results[0] as $resultKey => $result) {
//Strip string of placeholder and just leave the reference
$attRef = substr(substr($result, 0, strpos($result, '}')), 7);
$attString = '';
if (is_array($this->location_attributes) && array_key_exists($attRef, $this->location_attributes) && !empty($this->location_attributes[$attRef])) {
$attString = $this->location_attributes[$attRef];
} elseif (!empty($results[3][$resultKey])) {
//Check to see if we have a second set of braces;
$attString = $results[3][$resultKey];
}
$attString = apply_filters('em_location_output_placeholder', $attString, $this, $result, $target);
$location_string = str_replace($result, $attString, $location_string);
}
preg_match_all("/(#@?_?[A-Za-z0-9]+)({([^}]+)})?/", $location_string, $placeholders);
$replaces = array();
foreach ($placeholders[1] as $key => $result) {
$replace = '';
$full_result = $placeholders[0][$key];
switch ($result) {
case '#_LOCATIONID':
$replace = $this->location_id;
break;
case '#_LOCATIONPOSTID':
$replace = $this->post_id;
break;
case '#_NAME':
//Depricated
//Depricated
case '#_LOCATION':
//Depricated
//Depricated
case '#_LOCATIONNAME':
$replace = $this->location_name;
break;
case '#_ADDRESS':
//Depricated
//Depricated
case '#_LOCATIONADDRESS':
$replace = $this->location_address;
break;
case '#_TOWN':
//Depricated
//Depricated
case '#_LOCATIONTOWN':
$replace = $this->location_town;
break;
case '#_LOCATIONSTATE':
$replace = $this->location_state;
break;
case '#_LOCATIONPOSTCODE':
$replace = $this->location_postcode;
break;
case '#_LOCATIONREGION':
$replace = $this->location_region;
break;
case '#_LOCATIONCOUNTRY':
$replace = $this->get_country();
break;
case '#_LOCATIONFULLLINE':
$replace = $this->location_address;
$replace .= empty($this->location_town) ? '' : ', ' . $this->location_town;
$replace .= empty($this->location_state) ? '' : ', ' . $this->location_state;
$replace .= empty($this->location_postcode) ? '' : ', ' . $this->location_postcode;
$replace .= empty($this->location_region) ? '' : ', ' . $this->location_region;
break;
case '#_LOCATIONFULLBR':
$replace = $this->location_address;
$replace .= empty($this->location_town) ? '' : '<br />' . $this->location_town;
//.........这里部分代码省略.........