Plugin Directory

Changeset 2797313


Ignore:
Timestamp:
10/11/2022 02:41:45 PM (3 years ago)
Author:
netweblogic
Message:

dev 6.1.2.6

Location:
events-manager/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • events-manager/trunk/classes/em-booking.php

    r2795697 r2797313  
    10741074            $this->feedback_message = sprintf(__('Booking %s.','events-manager'), $action_string);
    10751075            $result = apply_filters('em_booking_set_status', $result, $this); // run the filter before emails go out, in case others need to hook in first
    1076             if( $result && $email && $this->previous_status != $this->booking_status ){ //email if status has changed
     1076            if( $result && $this->previous_status != $this->booking_status ){ //email if status has changed
    10771077                do_action('em_booking_status_changed', $this, array('status' => $status, 'email' => $email, 'ignore_spaces' => $ignore_spaces)); // method params passed as array
    1078                 if( $this->email() ){
    1079                     if( $this->mails_sent > 0 ){
    1080                         $this->feedback_message .= " ".__('Email Sent.','events-manager');
    1081                     }
    1082                 }else{
    1083                     //extra errors may be logged by email() in EM_Object
    1084                     $this->feedback_message .= ' <span style="color:red">'.__('ERROR : Email Not Sent.','events-manager').'</span>';
    1085                     $this->add_error(__('ERROR : Email Not Sent.','events-manager'));
     1078                if( $email ){
     1079                    if( $this->email() ){
     1080                        if( $this->mails_sent > 0 ){
     1081                            $this->feedback_message .= " ".__('Email Sent.','events-manager');
     1082                        }
     1083                    }else{
     1084                        //extra errors may be logged by email() in EM_Object
     1085                        $this->feedback_message .= ' <span style="color:red">'.__('ERROR : Email Not Sent.','events-manager').'</span>';
     1086                        $this->add_error(__('ERROR : Email Not Sent.','events-manager'));
     1087                    }
    10861088                }
    10871089            }
     
    14911493        return $booking;
    14921494    }
     1495   
     1496    function to_api( $args = array('event' => true), $version = 'v1' ){
     1497        $booking = array (
     1498            'id' => $this->booking_id,
     1499            'event_id' => $this->event_id,
     1500            'uuid' => $this->booking_uuid,
     1501            'person_id' => $this->person_id,
     1502            'status' => $this->booking_status,
     1503            'spaces' => $this->booking_spaces,
     1504            'price' => $this->get_price(),
     1505            'tax_rate' => $this->get_tax_rate(true), // returned as decimal/percen
     1506            'taxes' => $this->booking_taxes,
     1507            'comment' => $this->booking_comment,
     1508            'meta' => $this->booking_meta,
     1509            'tickets' => array(),
     1510        );
     1511        // add tickets
     1512        foreach ( $this->get_tickets_bookings() as $EM_Ticket_Bookings ){
     1513            $booking['tickets'][$EM_Ticket_Bookings->ticket_id] = array(
     1514                'name' => $EM_Ticket_Bookings->get_ticket()->ticket_name,
     1515                'description' => $EM_Ticket_Bookings->get_ticket()->ticket_name,
     1516                'spaces' => $EM_Ticket_Bookings->get_spaces(),
     1517                'price' => $EM_Ticket_Bookings->get_price(),
     1518                'attendees' => array(),
     1519            );
     1520            foreach ( $EM_Ticket_Bookings as $EM_Ticket_Booking ){
     1521                $booking['tickets'][$EM_Ticket_Bookings->ticket_id]['attendees'][] = array(
     1522                    'uuid' => $EM_Ticket_Booking->ticket_uuid,
     1523                    'price' => $EM_Ticket_Booking->ticket_booking_price,
     1524                    'meta' => $EM_Ticket_Booking->meta,
     1525                );
     1526            }
     1527        }
     1528        // if event data should be sent
     1529        if( !empty($args['event']) ) {
     1530            $booking['event'] = $this->get_event()->to_api();
     1531        }
     1532        return apply_filters('em_booking_to_api', $booking, array(), $this);
     1533    }
    14931534}
    14941535?>
  • events-manager/trunk/classes/em-bookings.php

    r2784153 r2797313  
    66 * @property EM_Event $event
    77 */
    8 class EM_Bookings extends EM_Object implements Iterator{
     8class EM_Bookings extends EM_Object implements Iterator, ArrayAccess {
    99   
    1010    /**
     
    866866        return $var;
    867867    }
     868   
     869    // ArrayAccess Implementation
     870    #[\ReturnTypeWillChange]
     871    /**
     872     * @param $offset
     873     * @param $value
     874     * @return void
     875     */
     876    public function offsetSet($offset, $value) {
     877        if (is_null($offset)) {
     878            $this->bookings[] = $value;
     879        } else {
     880            $this->bookings[$offset] = $value;
     881        }
     882    }
     883    #[\ReturnTypeWillChange]
     884    /**
     885     * @param $offset
     886     * @return bool
     887     */
     888    public function offsetExists($offset) {
     889        return isset($this->bookings[$offset]);
     890    }
     891    #[\ReturnTypeWillChange]
     892    /**
     893     * @param $offset
     894     * @return void
     895     */
     896    public function offsetUnset($offset) {
     897        unset($this->bookings[$offset]);
     898    }
     899    #[\ReturnTypeWillChange]
     900    /**
     901     * @param $offset
     902     * @return EM_Ticket_Bookings|null
     903     */
     904    public function offsetGet($offset) {
     905        return isset($this->bookings[$offset]) ? $this->bookings[$offset] : null;
     906    }
    868907}
    869908?>
  • events-manager/trunk/classes/em-event.php

    r2784153 r2797313  
    35973597        return apply_filters('em_event_can_manage', parent::can_manage($owner_capability, $admin_capability, $user_to_check), $this, $owner_capability, $admin_capability, $user_to_check);
    35983598    }
     3599   
     3600    /**
     3601     * Outputs a JSON-encodable associative array of data to output to REST or other remote operations
     3602     * @return array
     3603     */
     3604    function to_api(){
     3605        $event = array (
     3606            'name' => $this->event_name,
     3607            'id' => $this->event_id,
     3608            'post_id' => $this->post_id,
     3609            'parent' => $this->event_parent,
     3610            'owner' => $this->event_owner, // overwritten further down
     3611            'blog_id' => $this->blog_id,
     3612            'group_id' => $this->group_id,
     3613            'slug' => $this->event_slug,
     3614            'status' => $this->event_private,
     3615            'content' => $this->post_content,
     3616            'bookings' => array (
     3617                'end_date' => '$this->event_rsvp_date',
     3618                'end_time' => '$this->event_rsvp_time',
     3619                'rsvp_spaces' => '$this->event_rsvp_spaces',
     3620                'spaces' => $this->event_spaces,
     3621            ),
     3622            'when' => array(
     3623                'all_day' => $this->event_all_day,
     3624                'start' => $this->event_start,
     3625                'start_date' => $this->event_start_date,
     3626                'start_time' => $this->event_start_time,
     3627                'end' => $this->event_end,
     3628                'end_date' => $this->event_end_date,
     3629                'end_time' => $this->event_end_time,
     3630                'timezone' => $this->event_timezone,
     3631            ),
     3632            'location' => false,
     3633            'recurrence' => false,
     3634            'language' => $this->event_language,
     3635            'translation' => $this->event_translation,
     3636        );
     3637        if( $this->event_owner ){
     3638            // anonymous
     3639            $event['owner'] = array(
     3640                'guest' => true,
     3641                'email' => $this->get_contact()->user_email,
     3642                'name' => $this->get_contact()->get_name(),
     3643            );
     3644        }else{
     3645            // user
     3646            $event['owner'] = array(
     3647                'guest' => false,
     3648                'email' => $this->get_contact()->user_email,
     3649                'name' => $this->get_contact()->get_name(),
     3650            );
     3651        }
     3652        if( $this->recurrence_id ){
     3653            $event['recurrence_id'] = $this->recurrence_id;
     3654        }
     3655        if( $this->recurrence ){
     3656            $event['recurrence'] = array (
     3657                'interval' => $this->recurrence_interval,
     3658                'freq' => $this->recurrence_freq,
     3659                'days' => $this->recurrence_days,
     3660                'byday' => $this->recurrence_byday,
     3661                'byweekno' => $this->recurrence_byweekno,
     3662                'rsvp_days' => $this->recurrence_rsvp_days,
     3663            );
     3664        }
     3665        if( $this->location_type ){
     3666            $event['location_type'] = $this->event_location_type;
     3667            if( $this->has_location() ) {
     3668                $EM_Location = $this->get_location();
     3669                $event['location'] = $EM_Location->to_api();
     3670            }elseif( $this->has_event_location() ){
     3671                $event['location'] = $this->get_event_location()->to_api();
     3672            }
     3673        }
     3674        return $event;
     3675    }
    35993676}
    36003677
  • events-manager/trunk/classes/em-location.php

    r2760880 r2797313  
    11711171        return apply_filters('em_location_get_google_maps_embed_url', $url, $this);
    11721172    }
     1173   
     1174    public function to_api(){
     1175        return array (
     1176            'name' => $this->location_name,
     1177            'id' => $this->location_id,
     1178            'parent' => $this->location_parent,
     1179            'post_id' => $this->post_id,
     1180            'blog_id' => $this->blog_id,
     1181            'owner' => $this->location_owner,
     1182            'status' => $this->location_status,
     1183            'slug' => $this->location_slug,
     1184            'content' => $this->post_content,
     1185            'geo' => array(
     1186                'latitude' => $this->location_latitude,
     1187                'longitude' => $this->location_longitude,
     1188            ),
     1189            'address' => array(
     1190                'address' => $this->location_address,
     1191                'town' => $this->location_town,
     1192                'region' => $this->location_region,
     1193                'state' => $this->location_state,
     1194                'postcode' => $this->location_postcode,
     1195                'country' => $this->location_country,
     1196            ),
     1197            'language' => $this->location_language,
     1198            'translation' => $this->location_translation,
     1199        );
     1200    }
    11731201}
  • events-manager/trunk/classes/em-person.php

    r2569289 r2797313  
    124124        return apply_filters('em_person_get_name', $name, $this);
    125125    }
     126   
     127    function to_api(){
     128        $person = array(
     129            'id' => $this->ID, // maybe hide this depending on permissions
     130            'name' => $this->get_name(),
     131            'name_first' => $this->first_name,
     132            'name_last' => $this->last_name,
     133            'email' => $this->user_email,
     134            'phone' => $this->phone,
     135            'guest' => $this->ID > 0, // whether person is registered or not
     136        );
     137        $person = array_merge( $person, $this->custom_user_fields );
     138        return apply_filters('em_person_to_api', $person);
     139    }
    126140}
    127141?>
  • events-manager/trunk/classes/event-locations/em-event-location.php

    r2623955 r2797313  
    206206        return false;
    207207    }
     208   
     209    public function to_api(){
     210        return array_merge( $this->data, array(
     211            'type' => static::$type,
     212        ));
     213    }
    208214}
    209215
  • events-manager/trunk/events-manager.php

    r2795697 r2797313  
    22/*
    33Plugin Name: Events Manager
    4 Version: 6.1.2.5
     4Version: 6.1.2.6
    55Plugin URI: http://wp-events-plugin.com
    66Description: Event registration and booking management for WordPress. Recurring events, locations, webinars, google maps, rss, ical, booking registration and more!
     
    2929
    3030// Setting constants
    31 define('EM_VERSION', '6.1.2.5'); //self expanatory, although version currently may not correspond directly with published version number. until 6.0 we're stuck updating 5.999.x
     31define('EM_VERSION', '6.1.2.6'); //self expanatory, although version currently may not correspond directly with published version number. until 6.0 we're stuck updating 5.999.x
    3232define('EM_PRO_MIN_VERSION', '3.0'); //self expanatory
    3333define('EM_PRO_MIN_VERSION_CRITICAL', '3.0'); //self expanatory
  • events-manager/trunk/readme.txt

    r2795697 r2797313  
    136136
    137137== Changelog ==
    138 = 6.1.2.5 (dev) =
     138= 6.1.2.6 (dev) =
    139139* fixed datepicker range JS issues
    140140* added ability to override email formats (currently only upon installation for event approval email template)
     
    158158* added em_booking_output_show_condition filter to help determine whether to show a condition
    159159* fixed search results coming back with incorrect styling layout when in responsive/mobile mode
     160* added output methods for APIs via array for JSON for main objects (events, locations, bookings)
    160161
    161162= 6.1.2.1 =
Note: See TracChangeset for help on using the changeset viewer.