WordPress.org

Plugin Directory

Changeset 1722840


Ignore:
Timestamp:
08/31/17 17:53:01 (3 weeks ago)
Author:
netweblogic
Message:

dev 5.7.3.3

Location:
events-manager/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • events-manager/trunk/admin/settings/tabs/emails.php

    r1651260 r1722840  
    7070            ?> 
    7171            <tr class="em-subheader"><td colspan='2'> 
     72                <h5><?php _e('Booking cancelled','events-manager') ?></h5> 
     73                <em><?php echo __('This will be sent when a user cancels their booking.','events-manager').$bookings_placeholder_tip ?></em> 
     74            </td></tr> 
     75            <?php 
     76            em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_email_cancelled_subject', $email_subject_tip ); 
     77            em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_email_cancelled_body', '' ); 
     78            ?> 
     79            <tr class="em-subheader"><td colspan='2'> 
    7280                <h5><?php _e('Rejected booking email','events-manager') ?></h5> 
    7381                <em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'events-manager').$bookings_placeholder_tip ?></em> 
     
    7684            em_options_input_text ( __( 'Booking rejected email subject', 'events-manager'), 'dbem_bookings_email_rejected_subject', $email_subject_tip ); 
    7785            em_options_textarea ( __( 'Booking rejected email', 'events-manager'), 'dbem_bookings_email_rejected_body', '' ); 
    78             ?> 
    79             <tr class="em-subheader"><td colspan='2'> 
    80                 <h5><?php _e('Booking cancelled','events-manager') ?></h5> 
    81                 <em><?php echo __('This will be sent when a user cancels their booking.','events-manager').$bookings_placeholder_tip ?></em> 
    82             </td></tr> 
    83             <?php 
    84             em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_email_cancelled_subject', $email_subject_tip ); 
    85             em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_email_cancelled_body', '' ); 
    8686            ?> 
    8787            </tbody> 
  • events-manager/trunk/classes/em-bookings.php

    r1720802 r1722840  
    6565            return $this->load(); 
    6666        } 
     67    } 
     68     
     69    /** 
     70     * Counter-intuitive but __isset works against isset() but for our purpose it's mainly aimed at empty() calls, which also references this function. 
     71     * We don't expect nor do we want people using isset on things like the bookings property. 
     72     * Assume every property in EM_Bookings isset() == true and avoid it, only use empty() calls to check if there's anything in that property. 
     73     * Therefore, we'd return !empty($this->bookings) because if there's bookings, isset() should return true  
     74     * @param string $var 
     75     * @return boolean 
     76     */ 
     77    public function __isset( $var ){ 
     78        //if isset is invoked on $EM_Bookings->bookings then we'll assume it's only set if the bookings property is empty, not if null. 
     79        $result = false; 
     80        if( $var == 'bookings' ){ 
     81            $result = !empty($this->bookings); 
     82        } 
     83        return $result; 
    6784    } 
    6885     
  • events-manager/trunk/classes/em-calendar.php

    r1720802 r1722840  
    444444        //These defaults aren't for db queries, but flags for what to display in calendar output 
    445445        $defaults = array(  
     446            'recurring' => false, //we don't initially look for recurring events only events and recurrences of recurring events 
    446447            'full' => 0, //Will display a full calendar with event names 
    447448            'long_events' => 0, //Events that last longer than a day 
  • events-manager/trunk/classes/em-events.php

    r1720802 r1722840  
    5757            if( !in_array($field_name, $event_fields) ) $location_fields[] = $field_name; 
    5858        } 
    59         $accepted_fields = array_merge($event_fields, $location_fields); 
    60          
    61         //Create the SQL statement and execute 
     59        if( get_option('dbem_locations_enabled') ){ 
     60            $accepted_fields = array_merge($event_fields, $location_fields); 
     61        }else{ 
     62            //if locations disabled then we don't accept location-specific fields 
     63            $accepted_fields = $event_fields; 
     64        } 
     65         
     66        //Start SQL statement 
     67         
     68        //Create the SQL statement selectors 
    6269        $calc_found_rows = $limit && ( $args['pagination'] || $args['offset'] > 0 || $args['page'] > 0 ); 
    6370        if( $count ){ 
     
    103110        //depending on whether to join we do certain things like add a join SQL, change specific values like status search 
    104111        $location_optional_join = $join_locations ? "LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id" : ''; 
    105         $args['location_status'] = $args['location_status'] === false ? $join_locations : $args['location_status']; //if we're joining events table, by default we want status to match that of locations in this search 
    106112         
    107113        //Build ORDER BY and WHERE SQL statements here, after we've done all the pre-processing necessary 
     
    190196$limit $offset"; 
    191197        } 
    192          
     198     
    193199        //THE Query filter 
    194200        $sql = apply_filters('em_events_get_sql', $sql, $args); 
     
    512518        //continue with conditions 
    513519        $conditions = parent::build_sql_conditions($args); 
     520        //specific location query conditions if locations are enabled 
     521        if( get_option('dbem_locations_enabled') ){ 
     522            //events with or without locations 
     523            if( !empty($args['has_location']) ){ 
     524                $conditions['has_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NOT NULL AND '.EM_EVENTS_TABLE.'.location_id != 0)'; 
     525            }elseif( !empty($args['no_location']) ){ 
     526                $conditions['no_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NULL OR '.EM_EVENTS_TABLE.'.location_id = 0)';             
     527            }elseif( !empty($conditions['location_status']) ){ 
     528                $location_specific_args = array('town', 'state', 'country', 'region', 'near', 'geo', 'search'); 
     529                foreach( $location_specific_args as $location_arg ){ 
     530                    if( !empty($args[$location_arg]) ) $skip_location_null_condition = true; 
     531                } 
     532                if( empty($skip_location_null_condition) ){ 
     533                    $conditions['location_status'] = '('.$conditions['location_status'].' OR '.EM_LOCATIONS_TABLE.'.location_id IS NULL)'; 
     534                } 
     535            } 
     536        } 
     537        //search conditions 
    514538        if( !empty($args['search']) ){ 
    515             $like_search = array('event_name',EM_EVENTS_TABLE.'.post_content','location_name','location_address','location_town','location_postcode','location_state','location_country','location_region'); 
     539            if( get_option('dbem_locations_enabled') ){ 
     540                $like_search = array('event_name',EM_EVENTS_TABLE.'.post_content','location_name','location_address','location_town','location_postcode','location_state','location_country','location_region'); 
     541            }else{ 
     542                $like_search = array('event_name',EM_EVENTS_TABLE.'.post_content'); 
     543            } 
    516544            $like_search_string = '%'.$wpdb->esc_like($args['search']).'%'; 
    517545            $like_search_strings = array(); 
     
    549577            } 
    550578        } 
    551         //events with or without locations 
    552         if( !empty($args['has_location']) ){ 
    553             $conditions['has_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NOT NULL AND '.EM_EVENTS_TABLE.'.location_id != 0)'; 
    554         }elseif( !empty($args['no_location']) ){ 
    555             $conditions['no_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NULL OR '.EM_EVENTS_TABLE.'.location_id = 0)';             
    556         } 
    557579        return apply_filters( 'em_events_build_sql_conditions', $conditions, $args ); 
    558580    } 
     
    615637        self::$context = EM_POST_TYPE_EVENT; 
    616638        $defaults = array( 
    617             'recurring' => false, //we don't initially look for recurring events 
     639            'recurring' => false, //we don't initially look for recurring events only events and recurrences of recurring events 
    618640            'orderby' => get_option('dbem_events_default_orderby'), 
    619641            'order' => get_option('dbem_events_default_order'), 
     
    655677            } 
    656678        } 
    657         return apply_filters('em_events_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults); 
     679        //check if we're doing any location-specific searching, if so then we (by default) want to match the status of events 
     680        if( !empty($array['has_location']) ){ 
     681            //we're looking for events with locations, so we match the status we're searching for events unless there's an argument passed on for something different 
     682            $defaults['location_status'] = true; 
     683        }elseif( !empty($array['no_location']) ){ 
     684            //if no location is being searched for, we should ignore any status searches for location 
     685            $defaults['location_status'] = $array['location_status'] = false; 
     686        }else{ 
     687            $location_specific_args = array('town', 'state', 'country', 'region', 'near', 'geo', 'search'); 
     688            foreach( $location_specific_args as $location_arg ){ 
     689                if( !empty($array[$location_arg]) ) $defaults['location_status'] = true; 
     690            } 
     691        } 
     692        $args = parent::get_default_search($defaults,$array); 
     693        //do some post-parnet cleaning up here if locations are enabled or disabled 
     694        if( !get_option('dbem_locations_enabled') ){ 
     695            //locations disabled, wipe any args to do with locations so they're ignored 
     696            $location_args = array('town', 'state', 'country', 'region', 'has_location', 'no_location', 'location_status', 'location', 'geo', 'near', 'location_id'); 
     697            foreach( $location_args as $arg ) $args[$arg] = false; 
     698        } 
     699        return apply_filters('em_events_get_default_search', $args, $array, $defaults); 
    658700    } 
    659701} 
  • events-manager/trunk/classes/em-object.php

    r1720802 r1722840  
    222222        // e.g. if in events, search for 'publish' events and 0 location_status, it'll find events with a location pending review. 
    223223        foreach( array('event_status', 'location_status') as $status_type ){ 
     224            //find out whether the main status context we're after is an event or location i.e. are we running an events or location query 
    224225            $is_location_status = $status_type == "location_status" && self::$context == EM_POST_TYPE_LOCATION; 
    225226            $is_event_status = $status_type == "event_status" && self::$context == EM_POST_TYPE_EVENT; 
     227            //$is_joined_status decides whether this status we're dealing with is part of a joined table or the main table 
    226228            $is_joined_status = (!$is_location_status || !$is_event_status) && $args[$status_type] !== false; 
     229            //we add a status condition if this is the main status context or if joining a table and joined status arg is not exactly false 
    227230            if( $is_location_status || $is_event_status || $args[$status_type] !== false ){ 
    228                 $condition_status = $is_joined_status ? $status_type : 'status'; 
     231                $condition_status = $is_joined_status ? $status_type : 'status'; //the key for this condition type 
     232                //if this is the status belonging to the joined table, if set to true we match the main context status otherwise we check the specific status 
    229233                $status_arg = $is_joined_status && $args[$status_type] !== true ? $args[$status_type] : $args['status']; 
     234                //if joining by event or location, we may mistakenly omit any results without a complementing event or location, we need to account for that here 
     235                //other parts of the condition can negate whether or not eventful locations or events with/without locations should be included 
    230236                $conditions[$condition_status] = "(`{$status_type}` >= 0 )"; //shows pending & published if not defined 
    231237                if( is_numeric($status_arg) ){ 
     
    260266                $conditions['recurrences'] = $recurrences ? "(`recurrence_id` > 0 )":"(`recurrence_id` IS NULL OR `recurrence_id`=0 )"; 
    261267            } 
    262             //if we get here and $recurring is not exactly null, it was set to false or 0 meaning recurring events shouldn't be included 
     268            //if we get here and $recurring is not exactly null (meaning ignored), it was set to false or 0 meaning recurring events shouldn't be included 
    263269            if( $recurring !== null ){ 
    264270                $conditions['recurring'] = "(`recurrence`!=1 OR `recurrence` IS NULL)"; 
  • events-manager/trunk/em-actions.php

    r1720802 r1722840  
    648648        $handle = fopen("php://output", "w"); 
    649649        fputcsv($handle, $EM_Bookings_Table->get_headers(true), $delimiter); 
    650         while(!empty($EM_Bookings->bookings)){ 
     650        while( !empty($EM_Bookings->bookings) ){ 
    651651            foreach( $EM_Bookings->bookings as $EM_Booking ) { 
    652652                //Display all values 
  • events-manager/trunk/events-manager.php

    r1720802 r1722840  
    22/* 
    33Plugin Name: Events Manager 
    4 Version: 5.7.3.2 
     4Version: 5.7.3.3 
    55Plugin URI: http://wp-events-plugin.com 
    66Description: Event registration and booking management for WordPress. Recurring events, locations, google maps, rss, ical, booking registration and more! 
     
    2929 
    3030// Setting constants 
    31 define('EM_VERSION', 5.732); //self expanatory 
     31define('EM_VERSION', 5.733); //self expanatory 
    3232define('EM_PRO_MIN_VERSION', 2.392); //self expanatory 
    3333define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory 
  • events-manager/trunk/readme.txt

    r1720802 r1722840  
    100100 
    101101== Changelog == 
    102 = (dev) 5.7.3.2 = 
     102= 5.7.3.3 = 
    103103* fixed category color picker and image uploader problems 
    104104* created base classes for EM taxonomies to make adding custom EM taxonomies even easier in the future, 
Note: See TracChangeset for help on using the changeset viewer.