/** * make_the_title_a_link * callback for widget_title filter * * @param $title * @return string */ public function make_the_title_a_link($title) { return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; }
/** * Child scope classes indicate what gets returned when the frontend_url is requested. * Frontend url usually points to the single page view for the given id. * * @since 1.0.0 * @param int | EE_Event[] $EVT_ID ID or array of ids for the EE_Event object being utilized * @return string */ public function get_frontend_url($EVT_ID) { EE_Registry::instance()->load_helper('Event_View'); if (empty($EVT_ID) || is_array($EVT_ID)) { return EEH_Event_View::event_archive_url(); } return EEH_Event_View::event_link_url($EVT_ID); }
/** * edit_event_link * * @access public * @param int $EVT_ID * @param string $link * @param string $before * @param string $after * @return string */ public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { $event = EEH_Event_View::get_event($EVT_ID); if ($event instanceof EE_Event) { // can the user edit this post ? if (current_user_can('edit_post', $event->ID())) { // set link text $link = !empty($link) ? $link : __('edit this event'); // generate nonce $nonce = wp_create_nonce('edit_nonce'); // generate url to event editor for this event $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); // get edit CPT text $post_type_obj = get_post_type_object('espresso_events'); // build final link html $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr($post_type_obj->labels->edit_item) . '">' . $link . '</a>'; // put it all together return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after; } } return ''; }
<th> <label for="event_listings_url"> <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info'); ?> </label> </th> <td> <a id="event_listings_url" class="ee-admin-settings-hdr-lnk small-text" href="<?php echo EEH_Event_View::event_archive_url(); ?> "><?php echo EEH_Event_View::event_archive_url(); ?> </a> </td> </tr> <tr> <th> <label for="event_cpt_slug"> <?php _e('Event Slug', 'event_espresso'); ?> </label> </th> <td> <p><?php
/** * ticket_selector_form_open * * @access public * @param int $ID * @param string $external_url * @return string */ public static function ticket_selector_form_open($ID = 0, $external_url = '') { // if redirecting, we don't need any anything else if ($external_url) { $html = '<form method="GET" action="' . EEH_URL::refactor_url($external_url) . '">'; $query_args = EEH_URL::get_query_string($external_url); foreach ($query_args as $query_arg => $value) { $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; } return $html; } $checkout_url = EEH_Event_View::event_link_url($ID); if (!$checkout_url) { EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); } $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); return $html; }
/** * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event. * * * * [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event. * [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event. * [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime. * [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket. * [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees * regardless of status. Note default is to only return approved attendees * [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar. Otherwise if this is set * then return gravatar for email address given. * * Note: because of the relationship between event_id, ticket_id, and datetime_id. If more than one of those params * is included then preference is given to the following: * - event_id is used whenever its present and any others are ignored. * - if no event_id then datetime is used whenever its present and any others are ignored. * - otherwise ticket_id is used if present. * * @access public * @param array $attributes * @return string */ public function process_shortcode($attributes = array()) { //load helpers EE_Registry::instance()->load_helper('Event_View'); EE_Registry::instance()->load_helper('Template'); // merge in any attributes passed via fallback shortcode processor $attributes = array_merge((array) $attributes, (array) $this->_attributes); //set default attributes $default_shortcode_attributes = array('event_id' => null, 'datetime_id' => null, 'ticket_id' => null, 'status' => EEM_Registration::status_id_approved, 'show_gravatar' => false); // allow the defaults to be filtered $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); // grab attributes and merge with defaults, then extract $attributes = array_merge($default_shortcode_attributes, $attributes); $template_args = array('contacts' => array(), 'event' => null, 'datetime' => null, 'ticket' => null, 'show_gravatar' => $attributes['show_gravatar']); //start setting up the query for the contacts $query = array(); $error = false; //what event? if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { //seems like is_espresso_event_single() isn't working as expected. So using alternate method. if (is_single() && is_espresso_event()) { $event = EEH_Event_View::get_event(); if ($event instanceof EE_Event) { $template_args['event'] = $event; $query[0]['Registration.EVT_ID'] = $event->ID(); } } else { //try getting the earliest active event if none then get the $events = EEM_Event::instance()->get_active_events(array('limit' => 1, 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'))); $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'))) : $events; $event = reset($events); if ($event instanceof EE_Event) { $query[0]['Registration.EVT_ID'] = $event->ID(); $template_args['event'] = $event; } } } elseif (!empty($attributes['event_id'])) { $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); if ($event instanceof EE_Event) { $query[0]['Registration.EVT_ID'] = $attributes['event_id']; $template_args['event'] = $event; } else { $error = true; } } //datetime? if (!empty($attributes['datetime_id']) && empty($attributes['event_id'])) { $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); if ($datetime instanceof EE_Datetime) { $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; $query['default_where_conditions'] = 'this_model_only'; $template_args['datetime'] = $datetime; $template_args['event'] = $datetime->event(); } else { $error = true; } } //ticket?just if (!empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); if ($ticket instanceof EE_Ticket) { $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; $template_args['ticket'] = $ticket; $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; } else { $error = true; } } //status $reg_status_array = EEM_Registration::reg_status_array(); if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { $query[0]['Registration.STS_ID'] = $attributes['status']; } $query['group_by'] = array('ATT_ID'); $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. if (!isset($query[0]) || !is_array($query[0]) || $error) { if (WP_DEBUG) { return '<div class="important-notice ee-attention">' . __('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso') . '</div>'; } else { return ''; } } //get contacts! $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); //all set let's load up the template and return. return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); }
/** * espresso_edit_event_link * returns a link to edit an event * * @param int $EVT_ID * @param bool $echo * @return string */ function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { EE_Registry::instance()->load_helper('Event_View'); if ($echo) { echo EEH_Event_View::edit_event_link($EVT_ID); return ''; } return EEH_Event_View::edit_event_link($EVT_ID); }
/** * espresso_edit_event_link * returns a link to edit an event * * @param int $EVT_ID * @param bool $echo * @return string */ function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { if ($echo) { echo EEH_Event_View::edit_event_link($EVT_ID); return ''; } return EEH_Event_View::edit_event_link($EVT_ID); }
/** * ticket_selector_form_open * * @access public * @param int $ID * @param string $external_url * @return string */ public static function ticket_selector_form_open($ID = 0, $external_url = '') { // if redirecting, we don't need any anything else if ($external_url) { EE_Registry::instance()->load_helper('URL'); $html = '<form id="" method="GET" action="' . EEH_URL::refactor_url($external_url) . '">'; $query_args = EEH_URL::get_query_string($external_url); foreach ($query_args as $query_arg => $value) { $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; } return $html; } EE_Registry::instance()->load_helper('Event_View'); $checkout_url = EEH_Event_View::event_link_url($ID); if (!$checkout_url) { $msg = __('The URL for the Event Details page could not be retrieved.', 'event_espresso'); EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); } $checkout_url = add_query_arg(array('ee' => 'process_ticket_selections'), $checkout_url); return '<form id="" method="POST" action="' . $checkout_url . '">' . wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); }
public function dateTime() { return EEH_Event_View::get_all_date_obj($this->ID, FALSE, FALSE, 1); }
public function active() { return EEH_Event_View::event_active_status($this->ID); }