本文整理汇总了PHP中EM_Events类的典型用法代码示例。如果您正苦于以下问题:PHP EM_Events类的具体用法?PHP EM_Events怎么用?PHP EM_Events使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EM_Events类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
echo $args['before_widget'];
echo $args['before_title'];
echo $instance['title'];
echo $args['after_title'];
if (is_numeric($instance['time_limit']) && $instance['time_limit'] > 0) {
$instance['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($instance['time_limit'] - 1) . ' month'));
}
$instance['owner'] = false;
$events = EM_Events::get($instance);
echo "<ul>";
$li_wrap = !preg_match('/^<li>/i', trim($instance['format']));
if (count($events) > 0) {
foreach ($events as $event) {
if ($li_wrap) {
echo '<li>' . $event->output($instance['format']) . '</li>';
} else {
echo $event->output($instance['format']);
}
}
} else {
echo '<li>' . __('No events', 'dbem') . '</li>';
}
if (!empty($instance['all_events'])) {
$events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
echo '<li>' . $events_link . '</li>';
}
echo "</ul>";
echo $args['after_widget'];
}
示例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: mob_shortcode_countdown
function mob_shortcode_countdown($atts)
{
$defaults = array('id' => 'countdown_' . uniqid(), 'day' => 0, 'month' => 0, 'year' => 0, 'hour' => 0, 'minutes' => 0, 'seconds' => 0, 'nextevent' => false, 'labels' => "['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds']", 'labels1' => "['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second']", 'compactLabels' => "['y', 'm', 'w', 'd']", 'whichLabels' => null, 'digits' => "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']", 'timeSeparator' => ':', 'isRTL' => false, 'since' => null, 'timezone' => null, 'serverSync' => null, 'format' => 'dHMS', 'layout' => '', 'compact' => false, 'padZeroes' => false, 'significant' => 0, 'description' => '', 'expiryUrl' => null, 'alwaysExpire' => false, 'onExpiry' => null, 'onTick' => null, 'tickInterval' => 1);
$a = shortcode_atts($defaults, $atts);
if ($a['nextevent'] && class_exists('EM_Events')) {
if ($events = EM_Events::get(array('limit' => 1))) {
$datetime = strtotime($events[0]->event_start_date . ' ' . $events[0]->event_start_time);
$a['day'] = date('j', $datetime);
$a['month'] = date('n', $datetime);
$a['year'] = date('Y', $datetime);
$a['hour'] = date('G', $datetime);
$a['minutes'] = intval(date('i', $datetime));
$a['seconds'] = intval(date('s', $datetime));
}
}
$return = '<div id="' . $a['id'] . '"></div><script type="text/javascript">jQuery(document).ready(function(){
jQuery(\'#' . $a['id'] . '\').countdown({';
foreach (array_diff_key($a, array('id' => '', 'day' => '', 'month' => '', 'year' => '', 'hour' => '', 'minutes' => '', 'seconds' => '')) as $k => $v) {
if ($v != $defaults[$k] && $v != null && $v != false && !empty($v)) {
$return .= $k . ':' . (substr($defaults[$k], 0, 1) == '[' || $defaults[$k] == null || is_numeric($defaults[$k]) || is_bool($defaults[$k]) ? $v : '"' . $v . '"') . ',';
}
}
$return .= '
until: new Date(' . intval($a['year']) . ',' . intval($a['month'] - 1) . ',' . intval($a['day']) . ',' . intval($a['hour']) . ',' . intval($a['minutes']) . ',' . intval($a['seconds']) . '),
});
});</script>';
if (isset($events[0]->event_slug)) {
$return = '<a href="' . $events[0]->event_slug . '">' . $return . '</a>';
}
return $return;
}
示例4: em_rss
function em_rss()
{
global $post, $wp_query;
if (!empty($_REQUEST['dbem_rss']) || is_object($post) && $post->ID == get_option('dbem_events_page') && $wp_query->get('rss')) {
header("Content-type: text/xml");
ob_start();
echo "<?xml version='1.0'?>\n";
?>
<rss version="2.0">
<channel>
<title><?php
echo get_option('dbem_rss_main_title');
?>
</title>
<link><?php
echo get_permalink(get_option('dbem_events_page'));
?>
</link>
<description><?php
echo get_option('dbem_rss_main_description');
?>
</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>Weblog Editor 2.0</generator>
<?php
$description_format = str_replace(">", ">", str_replace("<", "<", get_option('dbem_rss_description_format')));
$events = EM_Events::get(array('limit' => 5, 'owner' => false));
foreach ($events as $event) {
$description = $event->output(get_option('dbem_rss_description_format'), "rss");
$description = ent2ncr(convert_chars(strip_tags($description)));
//Some RSS filtering
?>
<item>
<title><?php
echo $event->output(get_option('dbem_rss_title_format'), "rss");
?>
</title>
<link><?php
echo $event->output('#_EVENTURL');
?>
</link>
<description><?php
echo $description;
?>
</description>
</item>
<?php
}
?>
</channel>
</rss>
<?php
echo apply_filters('em_rss', ob_get_clean());
die;
}
}
示例5: queue_emails
/**
* Run on cron and prep emails to go out
*/
public static function queue_emails()
{
global $EM_Event, $wpdb;
//save old event in case already set
$old_EM_Event = !empty($EM_Event) ? clone $EM_Event : null;
//disable the current events are past rule
add_filter('option_pre_dbem_events_current_are_past', 'em_emails_return_false', create_function('$a', 'return false;'));
//For each event x days on
$days = get_option('dbem_emp_emails_reminder_days', 1);
$scope = $days > 0 ? date('Y-m-d', current_time('timestamp') + 86400 * $days) : date('Y-m-d', current_time('timestamp') + 86400);
//make sure we don't get past events, only events starting that specific date
$events_are_past = get_option('dbem_events_current_are_past');
update_option('dbem_events_current_are_past', true);
$output_type = get_option('dbem_smtp_html') ? 'html' : 'email';
foreach (EM_Events::get(array('scope' => $scope, 'private' => 1, 'blog' => get_current_blog_id())) as $EM_Event) {
/* @var $EM_Event EM_Event */
$emails = array();
//get ppl attending
foreach ($EM_Event->get_bookings()->get_bookings()->bookings as $EM_Booking) {
//get confirmed bookings
/* @var $EM_Booking EM_Booking */
if (is_email($EM_Booking->get_person()->user_email)) {
$subject = $EM_Booking->output(get_option('dbem_emp_emails_reminder_subject'), 'raw');
$message = $EM_Booking->output(get_option('dbem_emp_emails_reminder_body'), $output_type);
$emails[] = array($EM_Booking->get_person()->user_email, $subject, $message, $EM_Booking->booking_id);
}
}
if (count($emails) > 0) {
$attachments = serialize(array());
if (get_option('dbem_emp_emails_reminder_ical')) {
//create invite ical
$upload_dir = wp_upload_dir();
if (file_exists(trailingslashit($upload_dir['basedir']) . "em-cache") || mkdir(trailingslashit($upload_dir['basedir']) . "em-cache")) {
$icalfilename = trailingslashit($upload_dir['basedir']) . "em-cache/invite_" . $EM_Event->event_id . ".ics";
$icalfile = fopen($icalfilename, 'w+');
if ($icalfile) {
ob_start();
em_locate_template('templates/ical.php', true, array('args' => array('event' => $EM_Event->event_id)));
$icalcontent = preg_replace("/([^\r])\n/", "\$1\r\n", ob_get_clean());
fwrite($icalfile, $icalcontent);
fclose($icalfile);
$ical_file_array = array('name' => 'invite.ics', 'type' => 'text/calendar', 'path' => $icalfilename);
$attachments = serialize(array($ical_file_array));
}
}
}
foreach ($emails as $email) {
$wpdb->insert(EM_EMAIL_QUEUE_TABLE, array('email' => $email[0], 'subject' => $email[1], 'body' => $email[2], 'attachment' => $attachments, 'event_id' => $EM_Event->event_id, 'booking_id' => $email[3]));
}
}
}
//cleanup
update_option('dbem_events_current_are_past', $events_are_past);
//reset previous current events are past setting
$EM_Event = $old_EM_Event;
//reset global
remove_filter('option_pre_dbem_events_current_are_past', 'em_emails_return_false');
}
示例6: 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));
}
示例7: 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]);
}
示例8: 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);
}
示例9: find
public function find($params)
{
$events = EM_Events::get(array('limit' => 0, 'offset' => 100));
$events = self::filter_events($events, $params);
$events = array_slice($events, $params['offset']);
$remaped_events = array();
foreach ($events as $event) {
$remaped_events[] = $this->convert_to_se_event($event);
}
return $paged_posts = $this->add_paging_info($remaped_events, $params);
}
示例10: widget
/** @see WP_Widget::widget */
function widget($args, $instance) {
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance); // depcreciate
echo $args['before_widget'];
if( !empty($instance['title']) ){
echo $args['before_title'];
echo apply_filters('widget_title',$instance['title'], $instance, $this->id_base);
echo $args['after_title'];
}
//remove owner searches
$instance['owner'] = false;
//legacy stuff
//add li tags to old widgets that have no forced li wrappers
if ( !preg_match('/^<li/i', trim($instance['format'])) ) $instance['format'] = '<li>'. $instance['format'] .'</li>';
if (!preg_match('/^<li/i', trim($instance['no_events_text'])) ) $instance['no_events_text'] = '<li>'.$instance['no_events_text'].'</li>';
//orderby fix for previous versions with old orderby values
if( !array_key_exists($instance['orderby'], $this->em_orderby_options) ){
//replace old values
$old_vals = array(
'name' => 'event_name',
'end_date' => 'event_end_date',
'start_date' => 'event_start_date',
'end_time' => 'event_end_time',
'start_time' => 'event_start_time'
);
foreach($old_vals as $old_val => $new_val){
$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
}
}
//get events
$events = EM_Events::get(apply_filters('em_widget_events_get_args',$instance));
//output events
echo "<ul>";
if ( count($events) > 0 ){
foreach($events as $event){
echo $event->output( $instance['format'] );
}
}else{
echo $instance['no_events_text'];
}
if ( !empty($instance['all_events']) ){
$events_link = (!empty($instance['all_events_text'])) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events','charity'));
echo '<li class="all-events-link">'.$events_link.'</li>';
}
echo "</ul>";
echo $args['after_widget'];
}
示例11: EM_Events
function EM_Events($args = array())
{
if (is_array($args)) {
if (is_object(current($args)) && get_class(current($args)) == 'EM_Event') {
$this->events = $args;
} else {
$this->events = EM_Events::get($args);
}
} else {
$this->events = EM_Events::get();
}
do_action('em_events', $this);
}
示例12: tag_taxonomy_workaround
/**
* Hooks in after EM_Tag_Taxonomy::template() and makes sure WPML doesn't reset $wp_query and wipe the work EM just did.
*/
public static function tag_taxonomy_workaround()
{
global $EM_Tag;
if (defined('EM_WPML_TAXONOMIES_TWEAKED') && EM_WPML_TAXONOMIES_TWEAKED) {
return;
}
//prevent endless loop
if (EM_Events::count(array('tag' => $EM_Tag->term_id)) == 0) {
self::preset_query($EM_Tag->output(get_option('dbem_tag_page_title_format')));
}
define('EM_WPML_TAXONOMIES_TWEAKED', true);
wp_reset_query();
add_filter('the_post', 'EM_Tag_Taxonomy::template', 1);
}
示例13: 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;
}
示例14: export
/**
* export the data in selected format
*/
public function export()
{
$EM_Events = EM_Events::get();
$format = isset($_POST['exp_format']) ? wp_unslash($_POST['exp_format']) : '';
switch ($format) {
case 'xCal':
$this->exportXCal($EM_Events);
break;
case 'iCal':
$this->exportICal($EM_Events);
break;
case 'Event Espresso':
$this->exportEventEspresso($EM_Events);
break;
}
}
示例15: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'];
echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
echo $args['after_title'];
}
$instance['owner'] = false;
//orderby fix for previous versions with old orderby values
if (!array_key_exists($instance['orderby'], $this->em_orderby_options)) {
//replace old values
$old_vals = array('name' => 'event_name', 'end_date' => 'event_end_date', 'start_date' => 'event_start_date', 'end_time' => 'event_end_time', 'start_time' => 'event_start_time');
foreach ($old_vals as $old_val => $new_val) {
$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
}
}
$events = EM_Events::get(apply_filters('em_widget_events_get_args', $instance));
echo "<div id='events'>";
$li_wrap = !preg_match('/^<div class="item">/i', trim($instance['format']));
if (count($events) > 0) {
foreach ($events as $event) {
if ($li_wrap) {
echo '<div class="item">' . $event->output($instance['format']) . '</div>';
} else {
echo $event->output($instance['format']);
}
}
} else {
echo '<div class="item"><h4>' . $instance['no_events_text'] . '</h4></div>';
}
if (!empty($instance['all_events'])) {
$events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
echo '<div class="all-events-link">» ' . $events_link . '</div>';
}
echo "</div>";
echo $args['after_widget'];
}