WordPress.org

Plugin Directory

Changeset 1651260


Ignore:
Timestamp:
05/04/17 19:44:35 (4 months ago)
Author:
netweblogic
Message:

5.7.6 (dev)

Location:
events-manager/trunk
Files:
59 edited

Legend:

Unmodified
Added
Removed
  • events-manager/trunk/admin/bookings/em-events.php

    r1311743 r1651260  
    8181                ?> 
    8282            </div> 
    83                  
     83            <div class="clear"></div> 
    8484            <?php 
    8585            if (empty ( $events )) { 
  • events-manager/trunk/admin/em-admin.php

    r1395984 r1651260  
    102102        } 
    103103        .menu-icon-event .dashicons-calendar:before, #toplevel_page_events-manager-options .dashicons-calendar:before { 
    104           font-family: 'em_dashicons' !important; 
     104          font-family: 'em_dashicons'; 
    105105          content: '\e600'; 
    106106        } 
  • events-manager/trunk/admin/em-bookings.php

    r1395984 r1651260  
    223223                        </h3> 
    224224                        <div class="inside"> 
    225                             <?php $no_user = get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user'); ?> 
    226225                            <div class="em-booking-person-details"> 
    227226                                <?php echo $EM_Booking->get_person()->display_summary(); ?> 
    228                                 <?php if( $no_user ): ?> 
    229                                 <input type="button" id="em-booking-person-modify" value="<?php esc_attr_e('Edit Details','events-manager'); ?>" /> 
     227                                <?php if( $EM_Booking->is_no_user() ): ?> 
     228                                <input type="button" class="button-secondary" id="em-booking-person-modify" value="<?php esc_attr_e('Edit Details','events-manager'); ?>" /> 
    230229                                <?php endif; ?> 
    231230                            </div> 
    232                             <?php if( $no_user ): ?> 
     231                            <?php if( $EM_Booking->is_no_user() ): ?> 
    233232                            <form action="" method="post" class="em-booking-person-form"> 
    234233                                <div class="em-booking-person-editor" style="display:none;"> 
     
    238237                                    <input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/> 
    239238                                    <input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_modify_person_'.$EM_Booking->booking_id); ?>'/> 
    240                                     <input type="submit" class="em-booking-person-modify-submit" id="em-booking-person-modify-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
    241                                     <input type="button" id="em-booking-person-modify-cancel" value="<?php esc_attr_e('Cancel','events-manager'); ?>" /> 
     239                                    <input type="submit" class="button-primary em-button em-booking-person-modify-submit" id="em-booking-person-modify-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
     240                                    <input type="button" id="em-booking-person-modify-cancel" class="button-secondary em-button" value="<?php esc_attr_e('Cancel','events-manager'); ?>" /> 
    242241                                </div> 
    243242                            </form>  
     
    273272                                    <strong><?php esc_html_e('Status','events-manager'); ?> : </strong> 
    274273                                    <?php echo $EM_Booking->get_status(); ?> 
    275                                     <input type="button" class="em-booking-submit-status-modify" id="em-booking-submit-status-modify" value="<?php esc_attr_e('Change', 'events-manager'); ?>" /> 
    276                                     <input type="submit" class="em-booking-resend-email" id="em-booking-resend-email" value="<?php esc_attr_e('Resend Email', 'events-manager'); ?>" /> 
     274                                    <input type="button" class="button-secondary em-button em-booking-submit-status-modify" id="em-booking-submit-status-modify" value="<?php esc_attr_e('Change', 'events-manager'); ?>" /> 
     275                                    <input type="submit" class="button-primary em-button em-booking-resend-email" id="em-booking-resend-email" value="<?php esc_attr_e('Resend Email', 'events-manager'); ?>" /> 
    277276                                    <input type='hidden' name='action' value='booking_resend_email'/> 
    278277                                    <input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/> 
     
    289288                                    <input type="checkbox" checked="checked" name="send_email" value="1" /> 
    290289                                    <?php esc_html_e('Send Email','events-manager'); ?> 
    291                                     <input type="submit" class="em-booking-submit-status" id="em-booking-submit-status" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
    292                                     <input type="button" class="em-booking-submit-status-cancel" id="em-booking-submit-status-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" /> 
     290                                    <input type="submit" class="button-primary em-button em-booking-submit-status" id="em-booking-submit-status" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
     291                                    <input type="button" class="button-secondary em-button em-booking-submit-status-cancel" id="em-booking-submit-status-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" /> 
    293292                                    <input type='hidden' name='action' value='booking_set_status'/> 
    294293                                    <input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/> 
     
    329328                                                    <td> 
    330329                                                        <span class="em-booking-single-info">0</span> 
    331                                                         <div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket_Booking->ticket_id; ?>" value="0" /></div> 
     330                                                        <div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket->ticket_id; ?>" value="0" /></div> 
    332331                                                    </td> 
    333332                                                    <td><?php echo em_get_currency_symbol() ?>0.00</td> 
     
    353352                                            <tr> 
    354353                                                <th><?php echo $discount_summary['name']; ?></th> 
    355                                                 <th><?php echo $discount_summary['discount']; ?></th> 
     354                                                <th><?php echo $discount_summary['adjustment']; ?></th> 
    356355                                                <th>- <?php echo $discount_summary['amount']; ?></th> 
     356                                            </tr> 
     357                                            <?php endforeach; ?> 
     358                                        <?php endif; ?> 
     359                                        <?php if( count($price_summary['surcharges_pre_tax']) > 0 ): ?> 
     360                                            <?php foreach( $price_summary['surcharges_pre_tax'] as $surcharge_summary ): ?> 
     361                                            <tr> 
     362                                                <th><?php echo $surcharge_summary['name']; ?></th> 
     363                                                <th><?php echo $surcharge_summary['adjustment']; ?></th> 
     364                                                <th><?php echo $surcharge_summary['amount']; ?></th> 
    357365                                            </tr> 
    358366                                            <?php endforeach; ?> 
     
    372380                                            <tr> 
    373381                                                <th><?php echo $discount_summary['name']; ?></th> 
    374                                                 <th><?php echo $discount_summary['discount']; ?></th> 
     382                                                <th><?php echo $discount_summary['adjustment']; ?></th> 
    375383                                                <th>- <?php echo $discount_summary['amount']; ?></th> 
     384                                            </tr> 
     385                                            <?php endforeach; ?> 
     386                                        <?php endif; ?> 
     387                                        <?php if( count($price_summary['surcharges_post_tax']) > 0 ): ?> 
     388                                            <?php foreach( $price_summary['surcharges_post_tax'] as $surcharge_summary ): ?> 
     389                                            <tr> 
     390                                                <th><?php echo $surcharge_summary['name']; ?></th> 
     391                                                <th><?php echo $surcharge_summary['adjustment']; ?></th> 
     392                                                <th><?php echo $surcharge_summary['amount']; ?></th> 
    376393                                            </tr> 
    377394                                            <?php endforeach; ?> 
     
    398415                                </table> 
    399416                                <p class="em-booking-single-info"> 
    400                                     <input type="button" class="em-booking-submit-modify" id="em-booking-submit-modify" value="<?php esc_attr_e('Modify Booking', 'events-manager'); ?>" /> 
     417                                    <input type="button" class="button-secondary em-button em-booking-submit-modify" id="em-booking-submit-modify" value="<?php esc_attr_e('Modify Booking', 'events-manager'); ?>" /> 
    401418                                </p> 
    402419                                <p class="em-booking-single-edit"> 
    403420                                    <em><?php _e('<strong>Notes:</strong> Ticket availability not taken into account (i.e. you can overbook). Emails are not resent automatically.','events-manager'); ?></em> 
    404421                                    <br /><br /> 
    405                                     <input type="submit" class="em-booking-submit" id="em-booking-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
    406                                     <input type="button" class="em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" /> 
     422                                    <input type="submit" class="button-primary em-button em-booking-submit" id="em-booking-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" /> 
     423                                    <input type="button" class="button-secondary em-button em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" /> 
    407424                                    <input type='hidden' name='action' value='booking_save'/> 
    408425                                    <input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/> 
     
    456473                                <input type="hidden" name="action" value="bookings_add_note" /> 
    457474                                <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('bookings_add_note'); ?>" /> 
    458                                 <input type="submit" value="Add Note" /> 
     475                                <input type="submit" class="em-button button-primary" value="Add Note" /> 
    459476                            </form> 
    460477                        </div> 
  • events-manager/trunk/admin/em-docs.php

    r1311743 r1651260  
    3232                    'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','events'), 'default'=>1), 
    3333                    'tag' => array( 'desc'=> str_replace('%s', 'tags', 'Supply a single id, slug or comma-separated ids or slugs (e.g. "1,%s-slug,3") to limit the search to events in any of these %s. You can also use negative numbers and slugs to exclude specific %s (e.g. -1,-exclude-%s,-3). If you mix inclusions and exclusions, all events with included %s AND without excluded %s will be shown. You can also use &amp; to separate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0), 
    34                     'year' => array( 'desc'=> 'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Does not work as intended if used with scope.', 'default'=>'') 
     34                    'year' => array( 'desc'=> 'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Does not work as intended if used with scope.', 'default'=>''), 
     35                    'has_location' => array( 'desc'=> 'When set to true, only events WITH an assigned location will be shown, has priority over no_location.', 'default'=>''), 
     36                    'no_location' => array( 'desc'=> 'When set to true, only events WITHOUT an assigned location will be shown.', 'default'=>'') 
    3537                ), 
    3638                'locations' => array( 
     
    8991                            '#_EVENTEXCERPT' => array( 'desc' => 'If an excerpt has been added to the event, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your event description, only the content before this tag will show.' ), 
    9092                            '#_EVENTEXCERPT{words,...}' => array( 'desc' => 'If an excerpt has not been added to the event you can use this format <code>#_EVENTEXCERPT{10,...}</code>, where 10 is the number of words to show and ... is what is used at the cut-off point.' ), 
     93                            '#_EVENTEXCERPTCUT' => array( 'desc' => 'Same as <code>#_EVENTEXCERPT</code> (and also accepts the <code>{words,...}</code> arguments) but will also cut excerpts as well as post content. Default word limit is 55 and cut-off is <code>[...]</code>' ), 
    9194                            '#_EVENTIMAGE' => array( 'desc' => 'Shows the event image, if available.' ), 
    9295                            '#_EVENTIMAGE{x,y}' => array( 'desc' => 'Shows the event image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_EVENTIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized' ), 
     
    214217                            '#_TAGID' => array( 'desc' => 'Shows the tag ID.' ), 
    215218                            '#_TAGSLUG' => array( 'desc' => 'Shows the tag slug.' ), 
    216                             '#_TAGIMAGE' => array( 'desc' => 'Shows the tag image, if available.' ), 
    217                             '#_TAGIMAGE{x,y}' => array( 'desc' => 'Shows the tag image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_TAGIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ), 
    218                             '#_TAGIMAGEURL' => array( 'desc' => 'Shows the tag image url, if available.' ), 
    219219                            '#_TAGNOTES' => array( 'desc' => 'Shows the tag description.' ) 
    220220                        ) 
  • events-manager/trunk/admin/em-ms-options.php

    r1395984 r1651260  
    1 <?php 
     1<?php 
    22function em_ms_upgrade( $blog_id ){ 
    33    ?> 
     
    3333                <input type="hidden" name="action" value="upgrade" /> 
    3434                <input type="submit" value="<?php esc_attr_e('Update','events-manager'); ?>" /> 
    35              </form> 
     35            </form> 
    3636            <?php 
    3737        } 
     
    152152                            $global_post_tip = __( 'Displays %s from all sites on the network by default. You can still restrict %s by blog using shortcodes and template tags coupled with the <code>blog</code> attribute. Requires global tables to be turned on.','events-manager'); 
    153153                            $global_link_tip2 = __('You <strong>must</strong> have assigned a %s page in your <a href="%s">main blog settings</a> for this to work.','events-manager'); 
    154                             $options_page_link = get_admin_url($current_site->blog_id, 'edit.php?post_type=event&page=events-manager-options#pages'); 
     154                            $options_page_link = get_admin_url($current_site->blog_id, 'edit.php?post_type='.EM_POST_TYPE_EVENT.'&page=events-manager-options#pages'); 
    155155                            ?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','events-manager'),__('Event','events-manager')); ?></h4></td></tr><?php 
    156156                            em_options_radio_binary ( sprintf(__( 'Display global events on main blog?', 'events-manager'), __('events','events-manager')), 'dbem_ms_global_events', sprintf($global_post_tip, __('events','events-manager'), __('events','events-manager')) ); 
  • events-manager/trunk/admin/em-options.php

    r1488912 r1651260  
    161161        $EM_Notices->add_confirm(__('Checking for dev versions.','events-manager').' '. __('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','events-manager'), true); 
    162162        wp_redirect(em_wp_get_referer()); 
     163        exit(); 
     164    } 
     165    //import EM settings 
     166    if( !empty($_REQUEST['action']) && ($_REQUEST['action'] == 'import_em_settings' && check_admin_referer('import_em_settings')) || (is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' && check_admin_referer('import_em_ms_settings')) && is_super_admin() ){ 
     167        //upload uniquely named file to system for usage later 
     168        if( !empty($_FILES['import_settings_file']['size']) && is_uploaded_file($_FILES['import_settings_file']['tmp_name']) ){ 
     169            $settings = file_get_contents($_FILES['import_settings_file']['tmp_name']); 
     170            $settings = json_decode($settings, true); 
     171            if( is_array($settings) ){ 
     172                if( is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' ){ 
     173                    global $EM_MS_Globals, $wpdb; 
     174                    $sitewide_options = $EM_MS_Globals->get_globals(); 
     175                    foreach( $settings as $k => $v ){ 
     176                        if( in_array($k, $sitewide_options) ) update_site_option($k, $v); 
     177                    } 
     178                }else{ 
     179                    foreach( $settings as $k => $v ){ 
     180                        if( preg_match('/^(?:db)emp?_/', $k) ){ 
     181                            update_option($k, $v); 
     182                        } 
     183                    } 
     184                } 
     185                $EM_Notices->add_confirm(__('Settings imported.','events-manager'), true); 
     186                wp_redirect(em_wp_get_referer()); 
     187                exit(); 
     188            } 
     189        } 
     190        $EM_Notices->add_error(__('Please upload a valid txt file containing Events Manager import settings.','events-manager'), true); 
     191        wp_redirect(em_wp_get_referer()); 
     192        exit(); 
     193    } 
     194    //export EM settings 
     195    if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_settings' && check_admin_referer('export_em_settings') && is_super_admin() ){ 
     196        global $wpdb; 
     197        $results = $wpdb->get_results('SELECT option_name, option_value FROM '.$wpdb->options ." WHERE option_name LIKE 'dbem_%' OR option_name LIKE 'emp_%' OR option_name LIKE 'em_%'", ARRAY_A); 
     198        $options = array(); 
     199        foreach( $results as $result ) $options[$result['option_name']] = $result['option_value']; 
     200        header('Content-Type: text/plain; charset=utf-8'); 
     201        header('Content-Disposition: attachment; filename="events-manager-settings.txt"'); 
     202        echo json_encode($options); 
     203        exit(); 
     204    } 
     205    if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_ms_em_settings' && check_admin_referer('export_ms_em_settings') && is_multisite() && is_super_admin() ){ 
     206        //delete transients, and add a flag to recheck dev version next time round 
     207        global $EM_MS_Globals, $wpdb; 
     208        $options = array(); 
     209        $sitewide_options = $EM_MS_Globals->get_globals(); 
     210        foreach( $sitewide_options as $option ) $options[$option] = get_site_option($option); 
     211        header('Content-Type: text/plain; charset=utf-8'); 
     212        header('Content-Disposition: attachment; filename="events-manager-settings.txt"'); 
     213        echo json_encode($options); 
    163214        exit(); 
    164215    } 
     
    568619        $recheck_updates_url = admin_url().'network/admin.php?page=events-manager-options&amp;action=recheck_updates&amp;_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce'); 
    569620        $check_devs = admin_url().'network/admin.php?page=events-manager-options&amp;action=check_devs&amp;_wpnonce='.wp_create_nonce('em_check_devs_wpnonce'); 
     621        $export_settings_url = admin_url().'network/admin.php?page=events-manager-options&amp;action=export_em_ms_settings&amp;_wpnonce='.wp_create_nonce('export_em_ms_settings'); 
     622        $import_nonce = wp_create_nonce('import_em_ms_settings'); 
    570623    }else{ 
    571624        $uninstall_url = EM_ADMIN_URL.'&amp;page=events-manager-options&amp;action=uninstall&amp;_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce'); 
     
    573626        $recheck_updates_url = EM_ADMIN_URL.'&amp;page=events-manager-options&amp;action=recheck_updates&amp;_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce'); 
    574627        $check_devs = EM_ADMIN_URL.'&amp;page=events-manager-options&amp;action=check_devs&amp;_wpnonce='.wp_create_nonce('em_check_devs_wpnonce'); 
     628        $export_settings_url = EM_ADMIN_URL.'&amp;page=events-manager-options&amp;action=export_em_settings&amp;_wpnonce='.wp_create_nonce('export_em_settings'); 
     629        $import_nonce = wp_create_nonce('import_em_settings'); 
    575630    } 
    576631    ?> 
     
    578633        <div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Admin Tools', 'events-manager'); ?> (<?php _e ( 'Advanced', 'events-manager'); ?>)</span></h3> 
    579634        <div class="inside"> 
     635             
    580636            <table class="form-table"> 
    581637                <tr class="em-header"><td colspan="2"> 
     
    596652            <table class="form-table"> 
    597653                <tr class="em-header"><td colspan="2"> 
     654                    <h4><?php esc_html_e( 'Import/Export Settings', 'events-manager'); ?></h4> 
     655                    <?php if( is_multisite() && is_network_admin() ): ?> 
     656                    <p><?php esc_html_e("Within the network admin area, only network-specific settings will be exported or imported. For individual site settings please visit the relevant site within your network.", 'events-manager'); ?></p> 
     657                    <?php endif; ?> 
     658                </td></tr> 
     659                <tr> 
     660                    <th style="text-align:right;"> 
     661                        <a href="#" class="button-secondary" id="em-admin-import-settings"><?php esc_html_e('Import Settings','events-manager'); ?></a> 
     662                    </th> 
     663                    <td> 
     664                        <input type="file" name="import_settings_file" id="em-admin-import-settings-file" /> 
     665                        <p><em><?php echo esc_html(sprintf(__('Choose a settings file saved from a backup or another Events Manager installation and click the \'%s\' button.','events-manager'), __('Import Settings','events-manager'))); ?></em></p> 
     666                    </td> 
     667                    <script type="text/javascript" charset="utf-8"> 
     668                        jQuery(document).ready(function($){ 
     669                            $('a#em-admin-import-settings').click(function(e,el){ 
     670                                var thisform = $(this).closest('form'); 
     671                                thisform.find('input[type=text], textarea, select, input[type=radio], input[type=hidden]').prop('disabled', true); 
     672                                thisform.find('input[name=_wpnonce]').val('<?php echo esc_attr($import_nonce); ?>').prop('disabled', false); 
     673                                thisform.append($('<input type="hidden" name="action" value="<?php echo is_multisite() ? 'import_em_ms_settings':'import_em_settings'; ?>" />')); 
     674                                thisform.attr('enctype', 'multipart/form-data').submit(); 
     675                            }); 
     676                        }); 
     677                    </script> 
     678                </tr> 
     679                <tr> 
     680                    <th style="text-align:right;"> 
     681                        <a href="<?php echo $export_settings_url; ?>" class="button-secondary"><?php esc_html_e('Export Settings','events-manager'); ?></a> 
     682                    </th> 
     683                    <td><?php esc_html_e('Export your Events Manager settings and restore them here or on another website running this plugin.','events-manager'); ?></td> 
     684                </tr> 
     685            </table> 
     686             
     687            <table class="form-table"> 
     688                <tr class="em-header"><td colspan="2"> 
    598689                    <h4><?php _e ( 'Uninstall/Reset', 'events-manager'); ?></h4> 
    599690                    <p><?php _e('Use the buttons below to uninstall Events Manager completely from your system or reset Events Manager to original settings and keep your event data.','events-manager'); ?></p> 
  • events-manager/trunk/admin/settings/tabs/bookings.php

    r1311743 r1651260  
    134134        <table class='form-table'> 
    135135            <tr><td colspan='2'> 
     136                <p><?php _e('The option below allows you to disable user accounts, yet you will still see the supplied personal information for each booking.','events-manager'); ?></p> 
    136137                <p><?php _e('By default, when a booking is made by a user, this booking is tied to a user account, if the user is not registered nor logged in and guest bookings are enabled, an account will be created for them.','events-manager'); ?></p> 
    137                 <p><?php _e('The option below allows you to disable user accounts and assign all bookings to a parent user, yet you will still see the supplied booking personal information for each booking. When this mode is enabled, extra booking information about the person is stored alongside the booking record rather than as a WordPress user.','events-manager'); ?></p> 
    138138                <p><?php _e('Users with accounts (which would be created by other means when this mode is enabled) will still be able to log in and make bookings linked to their account as normal.','events-manager'); ?></p> 
    139139                <p><?php _e('<strong>Warning : </strong> Various features afforded to users with an account will not be available, e.g. viewing bookings. Once you enable this and select a user, modifying these values will prevent older non-user bookings from displaying the correct information.','events-manager'); ?></p> 
     
    142142            em_options_radio_binary ( __( 'Enable No-User Booking Mode?', 'events-manager'), 'dbem_bookings_registration_disable', __( 'This disables user registrations for bookings.', 'events-manager') ); 
    143143            em_options_radio_binary ( __( 'Allow bookings with registered emails?', 'events-manager'), 'dbem_bookings_registration_disable_user_emails', __( 'By default, if a guest tries to book an event using the email of a user account on your site they will be asked to log in, selecting yes will bypass this security measure.', 'events-manager').'<br />'.__('<strong>Warning : </strong> By enabling this, registered users will not be able to see bookings they make as guests in their "My Bookings" page.','events-manager') ); 
    144             $current_user = array(); 
    145             if( get_option('dbem_bookings_registration_user') ){ 
    146                 $user = get_user_by('id',get_option('dbem_bookings_registration_user')); 
    147                 $current_user[$user->ID] = $user->display_name; 
    148             } 
    149             if( defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') && EM_OPTIMIZE_SETTINGS_PAGE_USERS ){ 
    150                 em_options_input_text ( __( 'Assign bookings to', 'events-manager'), 'dbem_bookings_registration_user', __('Please add a User ID.','events-manager').' '.__( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'events-manager') ); 
    151             }else{ 
    152                 em_options_select ( __( 'Assign bookings to', 'events-manager'), 'dbem_bookings_registration_user', em_get_wp_users(array('role' => 'subscriber'), $current_user), __( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'events-manager') ); 
    153             } 
    154144            echo $save_button;  
    155145            ?> 
  • events-manager/trunk/admin/settings/tabs/emails.php

    r1311743 r1651260  
    106106             
    107107            em_options_input_text ( __( 'Registration email subject', 'events-manager'), 'dbem_bookings_email_registration_subject' ); 
    108             em_options_textarea ( __( 'Registration email', 'events-manager'), 'dbem_bookings_email_registration_body', sprintf(__('%s is replaced by username and %s is replaced by the user password.','events-manager'),'<code>%username%</code>','<code>%password%</code>') ); 
     108            em_options_textarea ( __( 'Registration email', 'events-manager'), 'dbem_bookings_email_registration_body', sprintf(__('%s is replaced by username, %s is replaced by the user password and %s is replaced by a link to create a password.','events-manager'),'<code>%username%</code>','<code>%password%</code>','<code>%passwordurl%</code>') ); 
    109109            echo $save_button; 
    110110            ?> 
  • events-manager/trunk/admin/settings/tabs/formats.php

    r1450218 r1651260  
    104104            <tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Country', 'events-manager'); ?></h5></td></tr> 
    105105            <?php 
    106             em_options_radio_binary ( __( 'Show countries?', 'events-manager'), 'dbem_search_form_countries', '', '', '#dbem_search_form_country_label_row, #dbem_search_form_countries_label_row' ); 
    107             em_options_select ( __( 'Default Country', 'events-manager'), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'events-manager')), __('Search form will be pre-selected with this country, if searching by country is disabled above, only search results from this country will be returned.','events-manager') ); 
     106            em_options_radio_binary ( __( 'Show countries?', 'events-manager'), 'dbem_search_form_countries', '', '', '#dbem_search_form_default_country_row, #dbem_search_form_country_label_row, #dbem_search_form_countries_label_row' ); 
     107            em_options_select ( __( 'Default Country', 'events-manager'), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'events-manager')), __('Search form will be pre-selected with this country.','events-manager') ); 
    108108            em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_country_label', __('Appears as the label for this search option.','events-manager') ); 
    109109            em_options_input_text ( __( 'All countries text', 'events-manager'), 'dbem_search_form_countries_label', __('Appears as the first default search option.','events-manager') ); 
  • events-manager/trunk/buddypress/bp-em-core.php

    r1488912 r1651260  
    7171            $can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations'); 
    7272            $can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings'); 
    73             switch_to_blog($current_blog); 
     73            restore_current_blog(); 
    7474        }else{ 
    7575            $can_manage_events = current_user_can('edit_events'); 
     
    177177                $can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations'); 
    178178                $can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings'); 
    179                 switch_to_blog($current_blog); 
     179                restore_current_blog(); 
    180180            }else{ 
    181181                $can_manage_events = current_user_can('edit_events'); 
     
    289289        return $bp->events->link.'my-events/?action=edit&event_id='.$EM_Event->event_id; 
    290290    } 
     291    function em_bp_rewrite_events_admin_url( $url ){ 
     292        global $bp; 
     293        return $bp->events->link.'my-events/'; 
     294    } 
    291295    if( !get_option('dbem_edit_events_page') ){ 
    292296        add_filter('em_event_get_edit_url','em_bp_rewrite_edit_url',10,2); 
     297        add_filter('em_get_events_admin_url','em_bp_rewrite_edit_url',10,2); 
    293298    }    
    294299     
  • events-manager/trunk/buddypress/bp-em-notifications.php

    r1395984 r1651260  
    8080        $action = 'cancelled_booking'; 
    8181    } 
    82     if( !empty($action) && !(get_option('dbem_bookings_registration_disable') && get_option('dbem_bookings_registration_user') == $EM_Booking->get_event()->get_contact()->ID) ){ 
     82    if( !empty($action) && !$EM_Booking->is_no_user() ){ 
    8383        bp_notifications_add_notification( array( 
    8484            'item_id' => $EM_Booking->booking_id, 
  • events-manager/trunk/classes/em-booking.php

    r1488912 r1651260  
    354354        if( $this->booking_price === null ){ 
    355355            $this->calculate_price(); 
     356            /* Deprecated filter - Equivalent of em_booking_calculate_price, please use that instead */ 
    356357            $this->booking_price = apply_filters('em_booking_get_price', $this->booking_price, $this); 
    357358        } 
     
    369370     */ 
    370371    function get_price_base( $format = false ){ 
    371         $price = $this->get_tickets_bookings()->get_price(); 
     372        $price = apply_filters('em_booking_get_price_base', $this->get_tickets_bookings()->get_price(), $this); 
    372373        if($format){ 
    373374            return $this->format_price($price); 
     
    379380        $price = $base_price = $this->get_price_base(); 
    380381        //apply pre-tax discounts 
    381         $price -= $this->get_price_discounts_amount('pre', $price); 
     382        $price -= $this->get_price_adjustments_amount('discounts', 'pre', $base_price); 
     383        $price += $this->get_price_adjustments_amount('surcharges', 'pre', $base_price); 
     384        $price = apply_filters('em_booking_get_price_pre_taxes', $price, $base_price, $this); 
    382385        if( $price < 0 ){ $price = 0; } //no negative prices 
    383386        //return amount of taxes applied, formatted or not 
     
    401404        } 
    402405        //apply post-tax discounts 
    403         $price -= $this->get_price_discounts_amount('post', $price); 
     406        $price_after_taxes = $price; 
     407        $price -= $this->get_price_adjustments_amount('discounts', 'post', $price_after_taxes); 
     408        $price += $this->get_price_adjustments_amount('surcharges', 'post', $price_after_taxes); 
     409        $price = apply_filters('em_booking_get_price_post_taxes', $price, $price_after_taxes, $this); 
    404410        if( $price < 0 ){ $price = 0; } //no negative prices 
    405411        //return amount of taxes applied, formatted or not 
     
    424430        } 
    425431        return $this->booking_taxes; 
    426     } 
    427      
    428     function get_price_discount(){ 
    429          
    430432    } 
    431433     
     
    445447     * Gets tax rate of booking 
    446448     * @see EM_Object::get_tax_rate() 
    447      * @return double 
    448      */ 
    449     function get_tax_rate(){ 
     449     */ 
     450    function get_tax_rate( $decimal = false ){ 
    450451        if( $this->booking_tax_rate === null ){ 
    451452            //booking not saved or tax never defined 
     
    466467            } 
    467468        } 
    468         return $this->booking_tax_rate; 
     469        $this->booking_tax_rate = $this->booking_tax_rate > 0 ? $this->booking_tax_rate : 0; 
     470        $this->booking_tax_rate = apply_filters('em_booking_get_tax_rate', $this->booking_tax_rate, $this); 
     471        if( $this->booking_tax_rate > 0 && $decimal ){ 
     472            return $this->booking_tax_rate / 100; 
     473        }else{ 
     474            return $this->booking_tax_rate; 
     475        } 
     476    } 
     477     
     478    /* START Price Adjustment Functions */ 
     479    //now we can use one function for both discounts and surcharges, the three functions below are now deprecated. 
     480    /** 
     481     * DEPRECATED. Use $this->get_price_adjustments('discounts'); instead. 
     482     */ 
     483    function get_price_discounts(){ 
     484        return apply_filters('em_booking_get_price_discounts', $this->get_price_adjustments('discounts'), $this); 
     485    } 
     486    /** 
     487     * DEPRECATED - Use $this->get_price_adjustments_amount('discounts', $pre_or_post, $price); instead. 
     488     */ 
     489    function get_price_discounts_amount( $pre_or_post = 'pre', $price = false ){ 
     490        return $this->get_price_adjustments_amount( 'discounts', $pre_or_post, $price ); 
     491    } 
     492    /** 
     493     * DEPRECATED - Use get_price_discounts_summary('discounts', $pre_or_post, $price); instead. 
     494     */ 
     495    function get_price_discounts_summary( $pre_or_post = 'pre', $price = false ){ 
     496        return $this->get_price_adjustments_summary( 'discounts', $pre_or_post, $price ); 
    469497    } 
    470498     
     
    473501     * array('name' => 'Name of Discount', 'type'=>'% or #', 'amount'=> 0.00, 'desc' => 'Comments about discount', 'tax'=>'pre/post', 'data' => 'any info for hooks to use' ); 
    474502     * About the array keys: 
    475      * type - $ means a fixed amount of discount, % means a percentage off the base price 
     503     * type - # means a fixed amount of discount, % means a percentage off the base price 
    476504     * amount - if type is a percentage, it is written as a number from 0-100, e.g. 10 = 10% 
    477505     * tax - 'pre' means discount is applied before tax, 'post' means after tax 
    478506     * data - any data to be stored that can be used by actions/filters 
     507     * @param string $type The type of adjustment you would like to retrieve. This would normally be 'discounts' or 'surcharges'. 
    479508     * @return array 
    480509     */ 
    481     function get_price_discounts(){ 
    482         $discounts = array(); 
    483         if( !empty($this->booking_meta['discounts']) && is_array($this->booking_meta['discounts']) ){ 
    484             $discounts = $this->booking_meta['discounts']; 
    485         } 
    486         return apply_filters('em_booking_get_price_discounts', $discounts, $this); 
    487     } 
    488      
    489     function get_price_discounts_amount( $pre_or_post = 'pre', $price = false ){ 
    490         $discounts = $this->get_price_discounts_summary($pre_or_post, $price); 
    491         $discount_amount = 0; 
    492         foreach($discounts as $discount){ 
    493             $discount_amount += $discount['amount_discounted']; 
    494         } 
    495         return $discount_amount; 
    496     } 
    497  
    498     function get_price_discounts_summary( $pre_or_post = 'pre', $price = false ){ 
    499         $discounts=  $this->get_price_discounts(); 
    500         $discount_summary = array(); 
     510    function get_price_adjustments( $type ){ 
     511        $adjustments = array(); 
     512        if( !empty($this->booking_meta[$type]) && is_array($this->booking_meta[$type]) ){ 
     513            $adjustments = $this->booking_meta[$type]; 
     514        } 
     515        //run this filter to be backwards compatible, e.g. em_booking_get_price_discount 
     516        if( $type == 'discounts' ){ 
     517            $adjustments = apply_filters('em_booking_get_price_discounts', $adjustments, $this); 
     518        } 
     519        return apply_filters('em_booking_get_price_adjustments', $adjustments, $type, $this); 
     520    } 
     521     
     522    /** 
     523     * Returns a numerical amount to adjust the price by, in the context of a certain type and before or after taxes. 
     524     * This will be a positive number whether or not this is to be added or subtracted from the price. 
     525     * @param string $type The type of adjustment to get, which would normally be 'discounts' or 'surcharges' 
     526     * @param string $pre_or_post Adjustments limited to 'pre' (before), 'post' (after) taxes or 'both' 
     527     * @param float $price Price relative to be adjusted. 
     528     * @return float 
     529     */ 
     530    function get_price_adjustments_amount( $type, $pre_or_post = 'both', $price = false ){ 
     531        $adjustments = $this->get_price_adjustments_summary($type, $pre_or_post, $price); 
     532        $adjustment_amount = 0; 
     533        foreach($adjustments as $adjustment){ 
     534            $adjustment_amount += $adjustment['amount_adjusted']; 
     535        } 
     536        return $adjustment_amount; 
     537    } 
     538     
     539    /** 
     540     * Provides an array summary of adjustments to make to the price, in the context of a certain type and before or after taxes. 
     541     * @param string $type The type of adjustment to get, which would normally be 'discounts' or 'surcharges' 
     542     * @param string $pre_or_post Adjustments limited to 'pre' (before), 'post' (after) taxes or 'both' 
     543     * @param float $price Price to calculate relative to adjustments. If not supplied or if $pre_or_post is 'both', price is automatically obtained from booking instance according to pre/post taxes requirement.  
     544     * @return array 
     545     */ 
     546    function get_price_adjustments_summary( $type, $pre_or_post = 'both', $price = false ){ 
     547        if( $pre_or_post == 'both' ){ 
     548            $adjustment_summary_pre = $this->get_price_adjustments_summary($type, 'pre'); 
     549            $adjustment_summary_post = $this->get_price_adjustments_summary($type, 'post');  
     550            return $adjustment_summary = array_merge($adjustment_summary_pre, $adjustment_summary_post); 
     551        } 
     552        $adjustments = $this->get_price_adjustments($type); 
     553        $adjustment_summary = array(); 
    501554        if( $price === false ){ 
    502             $price = $this->get_price_base(); 
    503             if( $pre_or_post == 'post' ) $price = $this->get_price_pre_taxes() + $this->get_price_taxes(); 
    504         } 
    505         foreach($discounts as $discount){ 
    506             $discount_amount = 0; 
    507             if( !empty($discount['amount']) ){ 
    508                 if( !empty($discount['tax']) && $discount['tax'] == $pre_or_post ){ 
    509                     if( !empty($discount['type']) ){ 
    510                         $discount_summary_item = array('name' => $discount['name'], 'desc' => $discount['desc'], 'discount'=>'0', 'amount_discounted'=>0); 
    511                         if( $discount['type'] == '%' ){ //discount by percentage 
    512                             $discount_summary_item['amount_discounted'] = round($price * ($discount['amount']/100),2); 
    513                             $discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']); 
    514                             $discount_summary_item['discount'] = number_format($discount['amount'],2).'%'; 
    515                             $discount_summary[] = $discount_summary_item; 
    516                         }elseif( $discount['type'] == '#' ){ //discount by amount 
    517                             $discount_summary_item['amount_discounted'] = round($discount['amount'],2); 
    518                             $discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']); 
    519                             $discount_summary_item['discount'] = $this->format_price($discount['amount']); 
    520                             $discount_summary[] = $discount_summary_item; 
     555            if( $pre_or_post == 'post' ){ 
     556                $price = $this->get_price_pre_taxes() + $this->get_price_taxes(); 
     557            }else{ 
     558                $price = $this->get_price_base(); 
     559            } 
     560        } 
     561        foreach($adjustments as $adjustment){ 
     562            $adjustment_amount = 0; 
     563            if( !empty($adjustment['amount']) ){ 
     564                if( !empty($adjustment['tax']) && $adjustment['tax'] == $pre_or_post ){ 
     565                    if( !empty($adjustment['type']) ){ 
     566                        $adjustment_summary_item = array('name' => $adjustment['name'], 'desc' => $adjustment['desc'], 'adjustment'=>'0', 'amount_adjusted'=>0, 'tax'=>$pre_or_post); 
     567                        if( $adjustment['type'] == '%' ){ //adjustment by percentage 
     568                            $adjustment_summary_item['amount_adjusted'] = round($price * ($adjustment['amount']/100),2); 
     569                            $adjustment_summary_item['amount'] = $this->format_price($adjustment_summary_item['amount_adjusted']); 
     570                            $adjustment_summary_item['adjustment'] = number_format($adjustment['amount'],2).'%'; 
     571                            $adjustment_summary[] = $adjustment_summary_item; 
     572                        }elseif( $adjustment['type'] == '#' ){ //adjustment by amount 
     573                            $adjustment_summary_item['amount_adjusted'] = round($adjustment['amount'],2); 
     574                            $adjustment_summary_item['amount'] = $this->format_price($adjustment_summary_item['amount_adjusted']); 
     575                            $adjustment_summary_item['adjustment'] = $this->format_price($adjustment['amount']); 
     576                            $adjustment_summary[] = $adjustment_summary_item; 
    521577                        } 
    522578                    } 
     
    524580            } 
    525581        } 
    526         return $discount_summary; 
    527     } 
     582        return $adjustment_summary; 
     583    } 
     584    /* END Price Adjustment Functions */ 
    528585     
    529586    /** 
     
    534591        //get base price of bookings 
    535592        $summary['total_base'] = $this->get_price_base(); 
    536         //get discounts 
    537593        //apply pre-tax discounts 
    538         $summary['discounts_pre_tax'] = $this->get_price_discounts_summary('pre'); 
     594        $summary['discounts_pre_tax'] = $this->get_price_adjustments_summary('discounts', 'pre'); 
     595        $summary['surcharges_pre_tax'] = $this->get_price_adjustments_summary('surcharges', 'pre'); 
    539596        //add taxes to price 
    540597        $summary['taxes'] = array('rate'=> 0, 'amount'=> 0); 
     
    543600        } 
    544601        //apply post-tax discounts 
    545         $summary['discounts_post_tax'] = $this->get_price_discounts_summary('post'); 
     602        $summary['discounts_post_tax'] = $this->get_price_adjustments_summary('discounts', 'post'); 
     603        $summary['surcharges_post_tax'] = $this->get_price_adjustments_summary('surcharges', 'post'); 
    546604        //final price 
    547605        $summary['total'] =  $this->get_price(true); 
     
    609667        } 
    610668        //if this user is the parent user of disabled registrations, replace user details here: 
    611         if( get_option('dbem_bookings_registration_disable') && $this->person->ID == get_option('dbem_bookings_registration_user') && (empty($this->person->loaded_no_user) || $this->person->loaded_no_user != $this->booking_id) ){ 
     669        if( $this->person->ID === 0 && (empty($this->person->loaded_no_user) || $this->person->loaded_no_user != $this->booking_id) ){ 
    612670            //override any registration data into the person objet 
    613671            if( !empty($this->booking_meta['registration']) ){ 
     
    695753            if( !empty($name_string) ) $user_data['user_name'] = implode(' ', $name_string); 
    696754        } 
    697         //Save full name 
    698         if( !empty($user_data['first_name']) || !empty($user_data['last_name']) ) 
    699755        //Check the phone 
    700756        if( !empty($_REQUEST['dbem_phone']) ){ 
     
    853909        } 
    854910        return apply_filters('em_booking_is_reserved', $result, $this); 
     911    } 
     912     
     913    /** 
     914     * Returns true if booking is associated with a non-registered user, i.e. booked as a guest 'no user mode'. 
     915     * @return mixed 
     916     */ 
     917    function is_no_user(){ 
     918        return apply_filters('em_booking_is_no_user', $this->get_person()->ID === 0, $this); 
    855919    } 
    856920     
  • events-manager/trunk/classes/em-bookings-table.php

    r1311743 r1651260  
    530530                $val = esc_html($EM_Booking->get_person()->phone); 
    531531            }elseif($col == 'user_name'){ 
    532                 if( $csv || ( get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user') ) ){ 
     532                if( $csv || $EM_Booking->is_no_user() ){ 
    533533                    $val = $EM_Booking->get_person()->get_name(); 
    534534                }else{ 
  • events-manager/trunk/classes/em-bookings.php

    r1397828 r1651260  
    539539         
    540540        //Create the SQL statement and execute 
    541         $sql = " 
     541        $sql = apply_filters('em_bookings_get_sql'," 
    542542            SELECT $selectors FROM $bookings_table  
    543543            LEFT JOIN $events_table ON {$events_table}.event_id={$bookings_table}.event_id  
     
    546546            $orderby_sql 
    547547            $limit $offset 
    548         "; 
     548        ", $args); 
     549         
    549550        //If we're only counting results, return the number of results 
    550551        if( $count ){ 
    551552            return apply_filters('em_bookings_get_count', $wpdb->get_var($sql), $args);      
    552553        } 
    553         $results = $wpdb->get_results( apply_filters('em_events_get_sql',$sql, $args), ARRAY_A); 
     554        $results = $wpdb->get_results($sql, ARRAY_A); 
    554555 
    555556        //If we want results directly in an array, why not have a shortcut here? 
  • events-manager/trunk/classes/em-calendar.php

    r1488912 r1651260  
    447447            'order' => get_option('dbem_display_calendar_order'), 
    448448            'number_of_weeks' => false, //number of weeks to be displayed in the calendar 
    449             'limit' => get_option('dbem_display_calendar_events_limit') 
     449            'limit' => get_option('dbem_display_calendar_events_limit'), 
     450            'post_id' => false 
    450451        ); 
    451452        //sort out whether defaults were supplied or just the array of search values 
  • events-manager/trunk/classes/em-categories-taxonomy.php

    r1409081 r1651260  
    3333        global $pagenow; 
    3434        if( ($pagenow == 'edit-tags.php' || $pagenow == 'term.php') && !empty($_GET['taxonomy']) && $_GET['taxonomy'] == EM_TAXONOMY_CATEGORY){ 
    35             wp_enqueue_style( 'farbtastic' ); 
    36             wp_enqueue_style( 'thickbox' ); 
    37              
     35            wp_enqueue_media(); 
    3836            wp_enqueue_script( 'em-categories-admin', plugins_url().'/events-manager/includes/js/categories-admin.js', array( 'jquery','media-upload','thickbox','farbtastic' ) ); 
    3937        } 
     
    6058        <tr class="form-field"> 
    6159            <th scope="row" valign="top"><label for="category-image"><?php esc_html_e('Image','events-manager'); ?></label></th> 
    62             <td> 
    63                 <?php if( !empty($category_image) ): ?> 
    64                 <p id="category-image-img"><img src="<?php echo $category_image; ?>" /></p> 
    65                 <?php endif; ?> 
    66                 <input type="text" name="category_image" id="category-image" value="<?php echo esc_attr($category_image); ?>" style="width:300px;" /> 
    67                 <input type="hidden" name="category_image_id" id="category-image-id" value="<?php echo esc_attr($category_image); ?>" /> 
    68                 <input id="upload_image_button" type="button" value="<?php _e('Choose/Upload Image','events-manager'); ?>" class="button-secondary" style="width:auto;" /> 
    69                 <?php if( !empty($category_image) ): ?> 
    70                 <input id="delete_image_button" type="button" value="<?php _e('Remove Image','events-manager'); ?>" class="button-secondary" style="width:auto;" /> 
    71                 <?php endif; ?> 
     60            <td id="event-tax-image"> 
     61                <div class="img-container"> 
     62                    <?php if( !empty($category_image) ): ?> 
     63                    <img src="<?php echo $category_image; ?>" /> 
     64                    <?php endif; ?> 
     65                </div> 
     66                <input type="text" name="category_image" id="category-image" class="img-url" value="<?php echo esc_attr($category_image); ?>" /> 
     67                <input type="hidden" name="category_image_id" id="category-image-id" class="img-id" value="<?php echo esc_attr($category_image_id); ?>" /> 
     68                <p class="hide-if-no-js"> 
     69                    <input id="upload_image_button" type="button" value="<?php _e('Choose/Upload Image','events-manager'); ?>" class="upload-img-button button-secondary" /> 
     70                    <input id="delete_image_button" type="button" value="<?php _e('Remove Image','events-manager'); ?>" class="delete-img-button button-secondary" <?php if( empty($category_image) ) echo 'style="display:none;"'; ?> /> 
     71                </p> 
    7272                <br /> 
    7373                <p class="description"><?php echo sprintf(__('Choose an image for your category, which can be displayed using the %s placeholder.','events-manager'),'<code>#_CATEGORYIMAGE</code>'); ?></p> 
  • events-manager/trunk/classes/em-categories.php

    r1234828 r1651260  
    7979            if($default_term) $term_slugs[] = $default_term->slug; 
    8080        } 
    81         if( count($term_slugs) > 0 ){ 
    82             if( is_multisite() ){ 
    83                 //In MS Global mode, we also save category meta information for global lookups 
    84                 if( EM_MS_GLOBAL && !empty($this->event_id) ){ 
    85                     //delete categories 
    86                     $this->save_index(); 
    87                 } 
    88                 if( !EM_MS_GLOBAL || is_main_site() ){ 
    89                     wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY); 
    90                 } 
    91             }else{ 
     81        if( is_multisite() ){ 
     82            //In MS Global mode, we also save category meta information for global lookups 
     83            if( EM_MS_GLOBAL && !empty($this->event_id) ){ 
     84                //delete categories 
     85                $this->save_index(); 
     86            } 
     87            if( !EM_MS_GLOBAL || is_main_site() ){ 
    9288                wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY); 
    93             }            
     89            } 
     90        }else{ 
     91            wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY); 
    9492        } 
    9593        do_action('em_categories_save', $this); 
  • events-manager/trunk/classes/em-event-post-admin.php

    r1488912 r1651260  
    99            add_action('admin_head', array('EM_Event_Post_Admin','admin_head')); //I don't think we need this anymore? 
    1010            //Meta Boxes 
    11             add_action('add_meta_boxes', array('EM_Event_Post_Admin','meta_boxes')); 
     11            add_action('add_meta_boxes_'.EM_POST_TYPE_EVENT, array('EM_Event_Post_Admin','meta_boxes'), 10, 1); 
    1212            //Notices 
    1313            add_action('admin_notices',array('EM_Event_Post_Admin','admin_notices')); 
     
    3737            if ( $EM_Event->is_recurring() ) { 
    3838                $warning = "<p><strong>".__( 'WARNING: This is a recurring event.', 'events-manager')."</strong></p>"; 
    39                 $warning .= "<p>". __( 'Modifications to this event will cause all recurrences of this event to be deleted and recreated and previous bookings will be deleted! You can edit individual recurrences and disassociate them with this recurring event.', 'events-manager'); 
     39                $warning .= "<p>". __( 'Modifications to recurring events will be applied to all recurrences and will overwrite any changes made to those individual event recurrences.', 'events-manager') . '</p>'; 
     40                $warning .= "<p>". __( 'Bookings to individual event recurrences will be preserved if event times and ticket settings are not modified.', 'events-manager') . '</p>'; 
     41                $warning .= '<p><a href="'. esc_url( add_query_arg(array('scope'=>'all', 'recurrence_id'=>$EM_Event->event_id), em_get_events_admin_url()) ).'">'. esc_html__('You can edit individual recurrences and disassociate them with this recurring event.','events-manager') . '</a></p>'; 
    4042                ?><div class="updated"><?php echo $warning; ?></div><?php 
    4143            } elseif ( $EM_Event->is_recurrence() ) { 
     
    224226    } 
    225227     
    226     public static function meta_boxes(){ 
    227         global $EM_Event, $post; 
    228         //no need to proceed if we're not dealing with an event 
    229         if( $post->post_type != EM_POST_TYPE_EVENT ) return; 
     228    public static function meta_boxes( $post ){ 
     229        global $EM_Event; 
    230230        //since this is the first point when the admin area loads event stuff, we load our EM_Event here 
    231231        if( empty($EM_Event) && !empty($post) ){ 
     
    254254            add_meta_box('em-event-categories', __('Site Categories','events-manager'), array('EM_Event_Post_Admin','meta_box_ms_categories'),EM_POST_TYPE_EVENT, 'side','low'); 
    255255        } 
    256     } 
     256        add_action('post_submitbox_misc_actions', 'EM_Event_Post_Admin::meta_box_action_post_submitbox_start'); 
     257    } 
     258     
     259    public static function meta_box_action_post_submitbox_start(){ 
     260        global $EM_Event; 
     261        ?> 
     262        <div class="misc-pub-section misc-pub-post-status misc-event-duplicate-link"> 
     263            <a href="<?php echo esc_url($EM_Event->duplicate_url()); ?>"><?php echo esc_html(sprintf(__('Duplicate %s','events-manager'), __('Event','events-manager'))); ?></a> 
     264        </div> 
     265        <?php 
     266    }        
    257267     
    258268    public static function meta_box_metadump(){ 
     
    328338            add_action('admin_head', array('EM_Event_Recurring_Post_Admin','admin_head')); 
    329339            //Meta Boxes 
    330             add_action('add_meta_boxes', array('EM_Event_Recurring_Post_Admin','meta_boxes')); 
     340            add_action('add_meta_boxes_event-recurring', array('EM_Event_Recurring_Post_Admin','meta_boxes'), 10, 1); 
    331341            //Notices 
    332342            add_action('admin_notices',array('EM_Event_Post_Admin','admin_notices')); //shared with posts 
     
    373383            $EM_Event->post_type = $post_type; 
    374384            //get the list post IDs for recurrences this recurrence 
    375             if( !$EM_Event->save_events() && $EM_Event->is_published() ){ 
     385            if( !$EM_Event->save_events() && ( $EM_Event->is_published() || 'future' == $EM_Event->post_status ) ){ 
    376386                $EM_Event->set_status(null, true); 
    377387                $EM_Notices->add_error(__ ( 'Something went wrong with the recurrence update...', 'events-manager'). __ ( 'There was a problem saving the recurring events.', 'events-manager')); 
     
    448458    } 
    449459     
    450     public static function meta_boxes(){ 
    451         global $EM_Event, $post; 
    452         //no need to proceed if we're not dealing with a recurring event 
    453         if( $post->post_type != 'event-recurring' ) return; 
     460    public static function meta_boxes( $post ){ 
     461        global $EM_Event; 
    454462        //since this is the first point when the admin area loads event stuff, we load our EM_Event here 
    455463        if( empty($EM_Event) && !empty($post) ){ 
     
    477485     
    478486    public static function meta_box_recurrence(){ 
     487        ?><input type="hidden" name="_emnonce" value="<?php echo wp_create_nonce('edit_event'); ?>" /><?php 
    479488        em_locate_template('forms/event/recurring-when.php', true); 
    480489    } 
  • events-manager/trunk/classes/em-event-post.php

    r1311743 r1651260  
    2929            } 
    3030            //Override post template tags 
    31             add_filter('the_date',array('EM_Event_Post','the_date'),10,2); 
    32             add_filter('get_the_date',array('EM_Event_Post','the_date'),10,2); 
    33             add_filter('the_time',array('EM_Event_Post','the_time'),10,2); 
    34             add_filter('get_the_time',array('EM_Event_Post','the_time'),10,2); 
     31            add_filter('get_the_date',array('EM_Event_Post','the_date'),10,3); 
     32            add_filter('get_the_time',array('EM_Event_Post','the_time'),10,3); 
    3533            add_filter('the_category',array('EM_Event_Post','the_category'),10,3); 
    3634        } 
     
    141139    } 
    142140     
    143     public static function the_date( $the_date, $d = '' ){ 
    144         global $post; 
     141    public static function the_date( $the_date, $d = '', $post = null ){ 
     142        $post = get_post( $post ); 
    145143        if( $post->post_type == EM_POST_TYPE_EVENT ){ 
    146144            $EM_Event = em_get_event($post); 
     
    154152    } 
    155153     
    156     public static function the_time( $the_time, $f = '' ){ 
    157         global $post; 
     154    public static function the_time( $the_time, $f = '', $post = null ){ 
     155        $post = get_post( $post ); 
    158156        if( $post->post_type == EM_POST_TYPE_EVENT ){ 
    159157            $EM_Event = em_get_event($post); 
     
    233231        //Scoping 
    234232        if( !empty($wp_query->query_vars['post_type']) && ($wp_query->query_vars['post_type'] == EM_POST_TYPE_EVENT || $wp_query->query_vars['post_type'] == 'event-recurring') && (empty($wp_query->query_vars['post_status']) || !in_array($wp_query->query_vars['post_status'],array('trash','pending','draft'))) ) { 
     233            $query = array(); 
    235234            //Let's deal with the scope - default is future 
    236235            if( is_admin() ){ 
    237236                $scope = $wp_query->query_vars['scope'] = (!empty($_REQUEST['scope'])) ? $_REQUEST['scope']:'future'; 
    238237                //TODO limit what a user can see admin side for events/locations/recurring events 
     238                if( !empty($wp_query->query_vars['recurrence_id']) && is_numeric($wp_query->query_vars['recurrence_id']) ){ 
     239                    $query[] = array( 'key' => '_recurrence_id', 'value' => $wp_query->query_vars['recurrence_id'], 'compare' => '=' ); 
     240                } 
    239241            }else{ 
    240242                if( !empty($wp_query->query_vars['calendar_day']) ) $wp_query->query_vars['scope'] = $wp_query->query_vars['calendar_day']; 
     
    249251                } 
    250252            } 
    251             $query = array(); 
    252253            $time = current_time('timestamp'); 
    253254            if ( preg_match ( "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $scope ) ) { 
  • events-manager/trunk/classes/em-event-posts-admin.php

    r1311743 r1651260  
    1010                } 
    1111            } 
     12            //admin warnings 
     13            add_action('admin_notices', 'EM_Event_Posts_Admin::admin_notices'); 
    1214            //hide some cols by default: 
    1315            $screen = 'edit-'.EM_POST_TYPE_EVENT; 
     
    5961    } 
    6062     
     63    public static function admin_notices(){ 
     64        if( !empty($_REQUEST['recurrence_id']) && is_numeric($_REQUEST['recurrence_id']) ){ 
     65            $EM_Event = em_get_event($_REQUEST['recurrence_id']); 
     66            ?> 
     67            <div class="updated"> 
     68                <p><?php echo sprintf(esc_html__('You are viewing individual recurrences of recurring event %s.', 'events-manager'), '<a href="'.$EM_Event->get_edit_url().'">'.$EM_Event->event_name.'</a>'); ?></p> 
     69                <p><?php esc_html_e('You can edit individual recurrences and disassociate them with this recurring event.', 'events-manager'); ?></p> 
     70            </div> 
     71            <?php 
     72        } 
     73    } 
     74     
    6175    /** 
    6276     * Handles WP_Query filter option in the admin area, which gets executed before EM_Event_Post::parse_query 
     
    195209                $EM_Location = $EM_Event->get_location(); 
    196210                if( !empty($EM_Location->location_id) ){ 
    197                     echo "<strong>" . $EM_Location->location_name . "</strong><br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town; 
     211                    echo "<strong><a href='". $EM_Location->get_permalink()."'>" . $EM_Location->location_name . "</a></strong>  
     212                        <span class='row-actions'> -  
     213                            <a href='". esc_url($EM_Location->get_edit_url())."'>". esc_html__('Edit') ."</a> |  
     214                            <a href='". esc_url($EM_Location->get_permalink())."'>". esc_html__('View') ."</a> 
     215                        </span> 
     216                        <br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town; 
    198217                }else{ 
    199218                    echo __('None','events-manager'); 
     
    271290            add_filter('manage_posts_custom_column' , array('EM_Event_Recurring_Posts_Admin','columns_output'),10,1 ); 
    272291            add_action('restrict_manage_posts', array('EM_Event_Posts_Admin','restrict_manage_posts')); 
     292            //actions 
     293            $row_action_type = is_post_type_hierarchical( EM_POST_TYPE_EVENT ) ? 'page_row_actions' : 'post_row_actions'; 
     294            add_filter($row_action_type, array('EM_Event_Recurring_Posts_Admin','row_actions'),10,2); 
    273295        } 
    274296    } 
    275297     
    276298    public static function admin_notices(){ 
    277         $warning = sprintf(__( 'Modifications to these events will cause all recurrences of each event to be deleted and recreated and previous bookings will be deleted! You can edit individual recurrences and detach them from recurring events by visiting the <a href="%s">events page</a>.', 'events-manager'), admin_url().'edit.php?post_type='.EM_POST_TYPE_EVENT); 
    278         ?><div class="updated"><p><?php echo $warning; ?></p></div><?php 
     299        ?> 
     300        <div class="updated"> 
     301            <p><?php esc_html_e( 'Modifications to recurring events will be applied to all recurrences and will overwrite any changes made to those individual event recurrences.', 'events-manager'); ?></p> 
     302            <p><?php esc_html_e( 'Bookings to individual event recurrences will be preserved if event times and ticket settings are not modified.', 'events-manager'); ?></p> 
     303            <p> 
     304                <a href="<?php echo esc_url( em_get_events_admin_url() ); ?>"> 
     305                    <strong><?php esc_html_e('You can edit individual recurrences and disassociate them with a recurring event to prevent getting overwritten.', 'events-manager'); ?></strong> 
     306                </a> 
     307            </p> 
     308        </div> 
     309        <?php 
    279310    } 
    280311     
     
    329360                    $EM_Location = $EM_Event->get_location(); 
    330361                    if( !empty($EM_Location->location_id) ){ 
    331                         echo "<strong>" . $EM_Location->location_name . "</strong><br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town; 
     362                        echo "<strong><a href='". $EM_Location->get_permalink()."'>" . $EM_Location->location_name . "</a></strong>  
     363                            <span class='row-actions'> -  
     364                                <a href='". esc_url($EM_Location->get_edit_url())."'>". esc_html__('Edit') ."</a> |  
     365                                <a href='". esc_url($EM_Location->get_permalink())."'>". esc_html__('View') ."</a> 
     366                            </span> 
     367                            <br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town; 
    332368                    }else{ 
    333369                        echo __('None','events-manager'); 
     
    336372                case 'date-time': 
    337373                    echo $EM_Event->get_recurrence_description(); 
     374                    $edit_url = add_query_arg(array('scope'=>'all', 'recurrence_id'=>$EM_Event->event_id), em_get_events_admin_url()); 
     375                    $link_text = sprintf(__('View %s', 'events-manager'), __('Recurrences', 'events-manager')); 
     376                    echo "<br /><span class='row-actions'> 
     377                            <a href='". esc_url($edit_url) ."'>". esc_html($link_text) ."</a> 
     378                        </span>"; 
    338379                    break; 
    339380            } 
    340381        } 
    341     }    
     382    } 
     383     
     384    public static function row_actions($actions, $post){ 
     385        if($post->post_type == 'event-recurring'){ 
     386            global $post, $EM_Event; 
     387            $EM_Event = em_get_event($post, 'post_id'); 
     388            $actions['duplicate'] = '<a href="'.$EM_Event->duplicate_url().'" title="'.sprintf(__('Duplicate %s','events-manager'), __('Event','events-manager')).'">'.__('Duplicate','events-manager').'</a>'; 
     389        } 
     390        return $actions; 
     391    } 
    342392} 
    343393add_action('admin_init', array('EM_Event_Recurring_Posts_Admin','init')); 
  • events-manager/trunk/classes/em-event.php

    r1488912 r1651260  
    4444    var $event_owner; 
    4545    var $event_name; 
    46     var $event_start_time; 
    47     var $event_end_time; 
     46    var $event_start_time = '00:00:00'; 
     47    var $event_end_time = '00:00:00'; 
    4848    var $event_all_day; 
    4949    var $event_start_date; 
     
    106106        'blog_id' => array( 'name'=>'blog_id', 'type'=>'%d', 'null'=>true ), 
    107107        'group_id' => array( 'name'=>'group_id', 'type'=>'%d', 'null'=>true ), 
    108         'recurrence' => array( 'name'=>'recurrence', 'type'=>'%d', 'null'=>true ), //every x day(s)/week(s)/month(s) 
     108        'recurrence' => array( 'name'=>'recurrence', 'type'=>'%d', 'null'=>true ), //is this a recurring event template 
    109109        'recurrence_interval' => array( 'name'=>'interval', 'type'=>'%d', 'null'=>true ), //every x day(s)/week(s)/month(s) 
    110110        'recurrence_freq' => array( 'name'=>'freq', 'type'=>'%s', 'null'=>true ), //daily,weekly,monthly? 
    111         'recurrence_days' => array( 'name'=>'days', 'type'=>'%d', 'null'=>true ), //daily,weekly,monthly? 
     111        'recurrence_days' => array( 'name'=>'days', 'type'=>'%d', 'null'=>true ), //each event spans x days 
    112112        'recurrence_byday' => array( 'name'=>'byday', 'type'=>'%s', 'null'=>true ), //if weekly or monthly, what days of the week? 
    113113        'recurrence_byweekno' => array( 'name'=>'byweekno', 'type'=>'%d', 'null'=>true ), //if monthly which week (-1 is last) 
     
    189189     */ 
    190190    var $previous_status = false; 
     191    /** 
     192     * If set to true, recurring events will delete and recreate recurrences when saved. 
     193     * @var boolean 
     194     */ 
     195    var $recurring_reschedule = false; 
     196    /** 
     197     * If set to true, recurring events will delete bookings and tickets of recurrences and recreate tickets. 
     198     * @var boolean 
     199     */ 
     200    var $recurring_recreate_bookings = false; 
     201    /** 
     202     * Flag used for when saving a recurring event that previously had bookings enabled and then subsequently disabled. 
     203     * If set to true, and $this->recurring_recreate_bookings is false, bookings and tickets of recurrences will be deleted. 
     204     * @var boolean 
     205     */ 
     206    var $recurring_delete_bookings = false; 
     207    /** 
     208     * If the event was just added/created during this execution, value will be true. Useful when running validation or making decisions on taking actions when events are saved/created for the first time. 
     209     * @var boolean 
     210     */ 
     211    var $just_added_event = false; 
    191212     
    192213    /* Post Variables - copied out of post object for easy IDE reference */ 
     
    388409    function get_post_meta(){ 
    389410        do_action('em_event_get_post_meta_pre', $this); 
    390         //Grab POST data     
    391         $this->event_start_date = ( !empty($_POST['event_start_date']) ) ? wp_kses_data($_POST['event_start_date']) : ''; 
    392         $this->event_end_date = ( !empty($_POST['event_end_date']) ) ? wp_kses_data($_POST['event_end_date']) : $this->event_start_date; 
    393         //check if this is recurring or not 
     411         
     412        //Check if this is recurring or not early on so we can take appropriate action further down 
    394413        if( !empty($_POST['recurring']) ){ 
    395414            $this->recurrence = 1; 
    396415            $this->post_type = 'event-recurring'; 
    397416        } 
     417         
     418        //Dates and Times - ignored if event is recurring being updated (not new) and not specifically chosen to reschedule event 
     419        if( !$this->is_recurring() || (empty($this->event_id) || !empty($_REQUEST['event_reschedule'])) ){ 
     420            //Event Dates 
     421            $this->event_start_date = ( !empty($_POST['event_start_date']) ) ? wp_kses_data($_POST['event_start_date']) : ''; 
     422            $this->event_end_date = ( !empty($_POST['event_end_date']) ) ? wp_kses_data($_POST['event_end_date']) : $this->event_start_date; 
     423            //Sort out time 
     424            $this->event_all_day = ( !empty($_POST['event_all_day']) ) ? 1 : 0; 
     425            if( $this->event_all_day ){ 
     426                $times_array = array('event_rsvp_time'); 
     427                $this->event_start_time = '00:00:00'; 
     428                $this->event_end_time = '23:59:59'; 
     429            }else{ 
     430                $times_array = array('event_start_time','event_end_time', 'event_rsvp_time'); 
     431            } 
     432            foreach( $times_array as $timeName ){ 
     433                $match = array(); 
     434                if( !empty($_POST[$timeName]) && preg_match ( '/^([01]\d|[0-9]|2[0-3])(:([0-5]\d))? ?(AM|PM)?$/', $_POST[$timeName], $match ) ){ 
     435                    if( empty($match[3]) ) $match[3] = '00'; 
     436                    if( strlen($match[1]) == 1 ) $match[1] = '0'.$match[1]; 
     437                    if( !empty($match[4]) && $match[4] == 'PM' && $match[1] != 12 ){ 
     438                        $match[1] = 12+$match[1]; 
     439                    }elseif( !empty($match[4]) && $match[4] == 'AM' && $match[1] == 12 ){ 
     440                        $match[1] = '00'; 
     441                    } 
     442                    $this->$timeName = $match[1].":".$match[3].":00"; 
     443                }else{ 
     444                    $this->$timeName = ($timeName == 'event_start_time') ? "00:00:00":$this->event_start_time; 
     445                } 
     446            } 
     447            //Start/End times should be available as timestamp 
     448            $this->start = strtotime($this->event_start_date." ".$this->event_start_time); 
     449            $this->end = strtotime($this->event_end_date." ".$this->event_end_time); 
     450        } 
     451         
    398452        //Get Location info 
    399453        if( !get_option('dbem_locations_enabled') || (!empty($_POST['no_location']) && !get_option('dbem_require_location',true)) || (empty($_POST['location_id']) && !get_option('dbem_require_location',true) && get_option('dbem_use_select_for_locations')) ){ 
     
    407461            $this->get_location()->post_content = ''; //reset post content, as it'll grab the event description otherwise 
    408462        } 
    409         //Sort out time 
    410         $this->event_all_day = ( !empty($_POST['event_all_day']) ) ? 1 : 0; 
    411         if( !$this->event_all_day ){ 
    412             $this->event_start_time = $this->event_end_time = '00:00:00'; 
    413         } 
    414         foreach( array('event_start_time','event_end_time', 'event_rsvp_time') as $timeName ){ 
    415             $match = array(); 
    416             if( !empty($_POST[$timeName]) && preg_match ( '/^([01]\d|[0-9]|2[0-3])(:([0-5]\d))? ?(AM|PM)?$/', $_POST[$timeName], $match ) ){ 
    417                 if( empty($match[3]) ) $match[3] = '00'; 
    418                 if( strlen($match[1]) == 1 ) $match[1] = '0'.$match[1]; 
    419                 if( !empty($match[4]) && $match[4] == 'PM' && $match[1] != 12 ){ 
    420                     $match[1] = 12+$match[1]; 
    421                 }elseif( !empty($match[4]) && $match[4] == 'AM' && $match[1] == 12 ){ 
    422                     $match[1] = '00'; 
    423                 } 
    424                 $this->$timeName = $match[1].":".$match[3].":00"; 
    425             }else{ 
    426                 $this->$timeName = ($timeName == 'event_start_time') ? "00:00:00":$this->event_start_time; 
    427             } 
    428         } 
    429         //Start/End times should be available as timestamp 
    430         $this->start = strtotime($this->event_start_date." ".$this->event_start_time); 
    431         $this->end = strtotime($this->event_end_date." ".$this->event_end_time); 
     463         
    432464        //Bookings 
    433465        $can_manage_bookings = $this->can_manage('manage_bookings','manage_others_bookings'); 
    434466        $preview_autosave = is_admin() && !empty($_REQUEST['_emnonce']) && !empty($_REQUEST['wp-preview']) && $_REQUEST['wp-preview'] == 'dopreview'; //we shouldn't save new data during a preview auto-save 
    435467        if( !$preview_autosave && $can_manage_bookings && !empty($_POST['event_rsvp']) && $_POST['event_rsvp'] ){ 
    436             $this->get_bookings()->get_tickets()->get_post(); 
     468            //get tickets only if event is new, non-recurring, or recurring but specifically allowed to reschedule by user 
     469            if( !$this->is_recurring() || (empty($this->event_id) || !empty($_REQUEST['event_recreate_tickets'])) ){ 
     470                $this->get_bookings()->get_tickets()->get_post(); 
     471            } 
    437472            $this->event_rsvp = 1; 
    438473            //RSVP cuttoff TIME is set up above where start/end times are as well  
     
    498533            $this->event_rsvp_spaces = ( isset($_POST['event_rsvp_spaces']) ) ? absint($_POST['event_rsvp_spaces']):0; 
    499534        }elseif( !$preview_autosave && ($can_manage_bookings || !$this->event_rsvp) ){ 
     535            if( empty($_POST['event_rsvp']) && $this->event_rsvp ) $deleting_bookings = true; 
    500536            $this->event_rsvp = 0; 
    501537            $this->event_rsvp_time = '00:00:00'; 
    502538        } 
     539         
    503540        //Sort out event attributes - note that custom post meta now also gets inserted here automatically (and is overwritten by these attributes) 
    504541        if(get_option('dbem_attributes_enabled')){ 
     
    523560            } 
    524561        } 
    525         //Set Blog ID 
    526         if( is_multisite() ){ 
    527             $this->blog_id = get_current_blog_id(); 
    528         } 
     562         
    529563        //group id 
    530564        $this->group_id = (!empty($_POST['group_id']) && is_numeric($_POST['group_id'])) ? $_POST['group_id']:0; 
     565         
    531566        //Recurrence data 
    532567        if( $this->is_recurring() ){ 
    533568            $this->recurrence = 1; //just in case 
    534             $this->recurrence_freq = ( !empty($_POST['recurrence_freq']) && in_array($_POST['recurrence_freq'], array('daily','weekly','monthly','yearly')) ) ? $_POST['recurrence_freq']:'daily'; 
    535             if( !empty($_POST['recurrence_bydays']) && $this->recurrence_freq == 'weekly' && self::array_is_numeric($_POST['recurrence_bydays']) ){ 
    536                 $this->recurrence_byday = str_replace(' ', '', implode( ",", $_POST['recurrence_bydays'] )); 
    537             }elseif( !empty($_POST['recurrence_byday']) && $this->recurrence_freq == 'monthly' ){ 
    538                 $this->recurrence_byday = wp_kses_data($_POST['recurrence_byday']); 
    539             } 
    540             $this->recurrence_interval = ( !empty($_POST['recurrence_interval']) && is_numeric($_POST['recurrence_interval']) ) ? $_POST['recurrence_interval']:1; 
    541             $this->recurrence_byweekno = ( !empty($_POST['recurrence_byweekno']) ) ? wp_kses_data($_POST['recurrence_byweekno']):''; 
    542             $this->recurrence_days = ( !empty($_POST['recurrence_days']) && is_numeric($_POST['recurrence_days']) ) ? (int) $_POST['recurrence_days']:0; 
     569             
     570            //If event is new or reschedule is requested, then proceed with new time pattern 
     571            if( empty($this->event_id) || !empty($_REQUEST['event_reschedule']) ){ 
     572                //dates and time schedules of events 
     573                $this->recurrence_freq = ( !empty($_POST['recurrence_freq']) && in_array($_POST['recurrence_freq'], array('daily','weekly','monthly','yearly')) ) ? $_POST['recurrence_freq']:'daily'; 
     574                if( !empty($_POST['recurrence_bydays']) && $this->recurrence_freq == 'weekly' && self::array_is_numeric($_POST['recurrence_bydays']) ){ 
     575                    $this->recurrence_byday = str_replace(' ', '', implode( ",", $_POST['recurrence_bydays'] )); 
     576                }elseif( isset($_POST['recurrence_byday']) && $this->recurrence_freq == 'monthly' ){ 
     577                    $this->recurrence_byday = wp_kses_data($_POST['recurrence_byday']); 
     578                }else{ 
     579                    $this->recurrence_byday = null; 
     580                } 
     581                $this->recurrence_interval = ( !empty($_POST['recurrence_interval']) && is_numeric($_POST['recurrence_interval']) ) ? $_POST['recurrence_interval']:1; 
     582                $this->recurrence_byweekno = ( !empty($_POST['recurrence_byweekno']) ) ? wp_kses_data($_POST['recurrence_byweekno']):''; 
     583                $this->recurrence_days = ( !empty($_POST['recurrence_days']) && is_numeric($_POST['recurrence_days']) ) ? (int) $_POST['recurrence_days']:0; 
     584            } 
     585             
     586            //here we do a comparison between new and old event data to see if we are to reschedule events or recreate bookings 
     587            if( $this->event_id ){ //only needed if this is an existing event needing rescheduling/recreation 
     588                //Get original recurring event so we can tell whether event recurrences or bookings will be recreated or just modified 
     589                $EM_Event = new EM_Event($this->event_id); 
     590                 
     591                //first check event times 
     592                $recurring_event_dates = array( 
     593                        'event_start_date' => $EM_Event->event_start_date, 
     594                        'event_end_date' => $EM_Event->event_end_date, 
     595                        'recurrence_byday' => $EM_Event->recurrence_byday, 
     596                        'recurrence_byweekno' => $EM_Event->recurrence_byweekno, 
     597                        'recurrence_days' => $EM_Event->recurrence_days, 
     598                        'recurrence_freq' => $EM_Event->recurrence_freq, 
     599                        'recurrence_interval' => $EM_Event->recurrence_interval 
     600                ); 
     601                //check previously saved event info compared to current recurrence info to see if we need to reschedule 
     602                foreach($recurring_event_dates as $k => $v){ 
     603                    if( $this->$k != $v ){ 
     604                        $this->recurring_reschedule = true; //something changed, so we reschedule 
     605                    } 
     606                } 
     607                 
     608                //now check tickets if we don't already have to reschedule 
     609                if( !$this->recurring_reschedule && $this->event_rsvp ){ 
     610                    //@TODO - ideally tickets could be independent of events, it'd make life easier here for comparison and editing without rescheduling 
     611                    $EM_Tickets = $EM_Event->get_tickets(); 
     612                    //we compare tickets 
     613                    foreach( $this->get_tickets()->tickets as $EM_Ticket ){ 
     614                        if( !empty($EM_Ticket->ticket_id) && !empty($EM_Tickets->tickets[$EM_Ticket->ticket_id]) ){ 
     615                            $new_ticket = $EM_Ticket->to_array(true); 
     616                            foreach( $EM_Tickets->tickets[$EM_Ticket->ticket_id]->to_array() as $k => $v ){ 
     617                                if( !(empty($new_ticket[$k]) && empty($v)) && ((empty($new_ticket[$k]) && $v) || $new_ticket[$k] != $v) ){ 
     618                                    if( $k == 'ticket_meta' && is_array($v) && is_array($new_ticket['ticket_meta']) ){ 
     619                                        foreach( $v as $k_meta => $v_meta ){ 
     620                                            if( (empty($new_ticket['ticket_meta'][$k_meta]) && !empty($v_meta)) || $new_ticket['ticket_meta'][$k_meta] != $v_meta ){ 
     621                                                $this->recurring_recreate_bookings = true; //something changed, so we reschedule 
     622                                            } 
     623                                        } 
     624                                    }else{ 
     625                                        $this->recurring_recreate_bookings = true; //something changed, so we reschedule 
     626                                    } 
     627                                } 
     628                            } 
     629                        }else{ 
     630                            $this->recurring_recreate_bookings = true; //we have a new ticket 
     631                        } 
     632                    } 
     633                }elseif( !empty($deleting_bookings) ){ 
     634                    $this->recurring_delete_bookings = true; 
     635                } 
     636                unset($EM_Event); 
     637            }else{ 
     638                //new event so we create everything from scratch 
     639                $this->recurring_reschedule = $this->recurring_recreate_bookings = true; 
     640            } 
    543641        } 
    544642        //categories in MS GLobal 
     
    546644            $this->get_categories()->get_post(); //it'll know what to do 
    547645        } 
    548         //validate (optional) and return result 
    549646        $this->compat_keys(); //compatability 
    550647        return apply_filters('em_event_get_post_meta', count($this->errors) == 0, $this); 
     
    635732            return apply_filters('em_event_save', false, $this); 
    636733        } 
     734        //sort out multisite blog id if appliable 
     735        if( is_multisite() && empty($this->blog_id) ){ 
     736            $this->blog_id = get_current_blog_id(); 
     737        } 
     738        //start saving process 
    637739        do_action('em_event_save_pre', $this); 
    638740        $post_array = array(); 
     
    788890                    update_post_meta($this->post_id, '_event_id', $this->event_id); 
    789891                    $this->feedback_message = sprintf(__('Successfully saved %s','events-manager'),__('Event','events-manager')); 
    790                     $just_added_event = true; //make an easy hook 
     892                    $this->just_added_event = true; //make an easy hook 
    791893                    do_action('em_event_save_new', $this); 
    792894                } 
     
    814916            if($this->event_rsvp == 0){ 
    815917                $this->get_bookings()->delete(); 
     918                $this->get_tickets()->delete(); 
    816919            }elseif( $this->can_manage('manage_bookings','manage_others_bookings') ){ 
    817920                if( !$this->get_bookings()->get_tickets()->save() ){ 
     
    830933            $this->compat_keys(); //compatability keys, loaded before saving recurrences 
    831934            //build recurrences if needed 
    832             if( $this->is_recurring() && $result && $this->is_published() ){ //only save events if recurring event validates and is published 
     935            if( $this->is_recurring() && $result && ($this->is_published() || $this->post_status == 'future') ){ //only save events if recurring event validates and is published or set for future 
    833936                global $EM_EVENT_SAVE_POST; 
    834937                //If we're in WP Admin and this was called by EM_Event_Post_Admin::save_post, don't save here, it'll be done later in EM_Event_Recurring_Post_Admin::save_post 
    835938                if( empty($EM_EVENT_SAVE_POST) ){ 
     939                    if( $this->just_added_event ) $this->recurring_reschedule = true; 
    836940                    if( !$this->save_events() ){ 
    837941                        $this->add_error(__ ( 'Something went wrong with the recurrence update...', 'events-manager'). __ ( 'There was a problem saving the recurring events.', 'events-manager')); 
     
    839943                } 
    840944            } 
    841             if( !empty($just_added_event) ){ 
     945            if( !empty($this->just_added_event) ){ 
    842946                do_action('em_event_added', $this); 
    843947            } 
     
    9611065            if( $result !== false ){ 
    9621066                $this->get_bookings()->delete(); 
     1067                $this->get_tickets()->delete(); 
    9631068                //Delete the recurrences then this recurrence event 
    9641069                if( $this->is_recurring() ){ 
     
    10061111    /** 
    10071112     * Change the status of the event. This will save to the Database too.  
    1008      * @param int $status 
    1009      * @param boolean $set_post_status 
     1113     * @param int $status               A number to change the status to, which may be -1 for trash, 1 for publish, 0 for pending or null if draft. 
     1114     * @param boolean $set_post_status  If set to true the wp_posts table status will also be changed to the new corresponding status. 
    10101115     * @return string 
    10111116     */ 
    10121117    function set_status($status, $set_post_status = false){ 
    10131118        global $wpdb; 
     1119        //decide on what status to set and update wp_posts in the process 
    10141120        if($status === null){  
    1015             $set_status='NULL';  
     1121            $set_status='NULL'; //draft post 
    10161122            if($set_post_status){ 
    10171123                //if the post is trash, don't untrash it! 
     
    10221128            $set_status = -1; 
    10231129            if($set_post_status){ 
     1130                //set the post status of the location in wp_posts too 
    10241131                $wpdb->update( $wpdb->posts, array( 'post_status' => $this->post_status ), array( 'ID' => $this->post_id ) ); 
    10251132            } 
    10261133            $this->post_status = 'trash'; //set post status in this instance 
    10271134        }else{ 
    1028             $set_status = $status ? 1:0; 
     1135            $set_status = $status ? 1:0; //published or pending post 
    10291136            $post_status = $set_status ? 'publish':'pending'; 
     1137            if( empty($this->post_name) ){ 
     1138                //published or pending posts should have a valid post slug 
     1139                $this->post_name = sanitize_title($this->post_title); 
     1140                $set_post_name = true; 
     1141            } 
    10301142            if($set_post_status){ 
    1031                 if($this->post_status == 'pending' && empty($this->post_name)){ 
    1032                     $this->post_name = sanitize_title($this->post_title); 
    1033                 } 
    10341143                $wpdb->update( $wpdb->posts, array( 'post_status' => $post_status, 'post_name' => $this->post_name ), array( 'ID' => $this->post_id ) ); 
     1144            }elseif( $set_post_name ){ 
     1145                //if we've added a post slug then update wp_posts anyway 
     1146                $wpdb->update( $wpdb->posts, array( 'post_name' => $this->post_name ), array( 'ID' => $this->post_id ) ); 
    10351147            } 
    10361148            $this->post_status = $post_status; 
    10371149        } 
     1150        //save in the wp_em_locations table 
    10381151        $this->get_previous_status(); 
    10391152        $result = $wpdb->query( $wpdb->prepare("UPDATE ".EM_EVENTS_TABLE." SET event_status=$set_status, event_slug=%s WHERE event_id=%d", array($this->post_name, $this->event_id)) ); 
     
    11591272        return $this->get_bookings($force_reload)->get_tickets(); 
    11601273    } 
    1161      
    1162     /* 
    1163      * Provides the tax rate for this event. 
    1164      * Currently a site-wide default, but this hook allows easy overriding of tax rates for specific events. 
    1165      * @uses apply_filters() on 'em_event_get_tax_rate' before returning value 
    1166      * @uses EM_Object::get_tax_rate() 
    1167      */ 
    1168     function get_tax_rate(){ 
    1169         return apply_filters('em_event_get_tax_rate', parent::get_tax_rate(), $this); 
     1274 
     1275    /* Provides the tax rate for this event. 
     1276     * @see EM_Object::get_tax_rate() 
     1277     */ 
     1278    function get_tax_rate( $decimal = false ){ 
     1279        $tax_rate = apply_filters('em_event_get_tax_rate', parent::get_tax_rate( false ), $this); //we get tax rate but without decimal 
     1280        $tax_rate = ( $tax_rate > 0 ) ? $tax_rate : 0; 
     1281        if( $decimal && $tax_rate > 0 ) $tax_rate = $tax_rate / 100; 
     1282        return $tax_rate; 
    11701283    } 
    11711284     
     
    12971410     */  
    12981411    function output($format, $target="html") {   
     1412        global $wpdb; 
    12991413        $event_string = $format; 
    13001414        //Time place holder that doesn't show if empty. 
     
    13171431        } 
    13181432        //This is for the custom attributes 
    1319         preg_match_all('/#_ATT\{([^}]+)\}(\{([^}]+)\})?/', $event_string, $results); 
     1433        preg_match_all('/#_ATT\{([^}]+)\}(\{([^}]+\}?)\})?/', $event_string, $results); 
    13201434        $attributes = em_get_attributes(); 
    13211435        foreach($results[0] as $resultKey => $result) { 
     
    14241538                        //if event is not a recurrence 
    14251539                        $show_condition = $this->event_private == 0; 
     1540                    }elseif ( strpos($condition, 'is_user_attendee') !== false || strpos($condition, 'not_user_attendee') !== false ){ 
     1541                        //if current user has a booking at this event 
     1542                        $show_condition = false; 
     1543                        if( is_user_logged_in() ){ 
     1544                            //we only need a user id, booking id and booking status so we do a direct SQL lookup and once for the loop 
     1545                            if( !isset($user_bookings) || !is_array($user_bookings) ){ 
     1546                                $sql = $wpdb->prepare('SELECT booking_status FROM '.EM_BOOKINGS_TABLE.' WHERE person_id=%d AND event_id=%d', array(get_current_user_id(), $this->event_id)); 
     1547                                $user_bookings = $wpdb->get_col($sql); 
     1548                            } 
     1549                            if( $condition == 'is_user_attendee' && count($user_bookings) > 0 ){ 
     1550                                //user has a booking for this event, could be any booking status 
     1551                                $show_condition = true; 
     1552                            }elseif( $condition == 'not_user_attendee' && count($user_bookings) == 0 ){ 
     1553                                //user has no bookings to this event 
     1554                                $show_condition = true; 
     1555                            }elseif( strpos($condition, 'is_user_attendee_') !== false ){ 
     1556                                //user has a booking for this event, and we'll now look for a specific status 
     1557                                $attendee_booking_status = str_replace('is_user_attendee_', '', $condition); 
     1558                                $show_condition = in_array($attendee_booking_status, $user_bookings); 
     1559                            }elseif( strpos($condition, 'not_user_attendee_') !== false ){ 
     1560                                //user has a booking for this event, and we'll now look for a specific status 
     1561                                $attendee_booking_status = str_replace('not_user_attendee_', '', $condition); 
     1562                                $show_condition = !in_array($attendee_booking_status, $user_bookings); 
     1563                            } 
     1564                        } 
    14261565                    }elseif ( preg_match('/^has_category_([a-zA-Z0-9_\-]+)$/', $condition, $category_match)){ 
    14271566                        //event is in this category 
     
    14731612                case '#_EVENTNOTES': 
    14741613                case '#_EVENTEXCERPT': 
     1614                case '#_EVENTEXCERPTCUT': 
    14751615                    $replace = $this->post_content; 
    1476                     if($result == "#_EXCERPT" || $result == "#_EVENTEXCERPT"){ 
    1477                         if( !empty($this->post_excerpt) ){ 
     1616                    if($result == "#_EXCERPT" || $result == "#_EVENTEXCERPT" || $result == "#_EVENTEXCERPTCUT" ){ 
     1617                        if( !empty($this->post_excerpt) && $result != "#_EVENTEXCERPTCUT" ){ 
    14781618                            $replace = $this->post_excerpt; 
    14791619                        }else{ 
    1480                             $excerpt_length = 55; 
     1620                            $excerpt_length = 55; 
    14811621                            $excerpt_more = apply_filters('em_excerpt_more', ' ' . '[...]'); 
    1482                             if( !empty($placeholders[3][$key]) ){ 
    1483                                 $trim = true; 
    1484                                 $ph_args = explode(',', $placeholders[3][$key]); 
    1485                                 if( is_numeric($ph_args[0]) ) $excerpt_length = $ph_args[0]; 
    1486                                 if( !empty($ph_args[1]) ) $excerpt_more = $ph_args[1]; 
    1487                             } 
    1488                             if ( preg_match('/<!--more(.*?)?-->/', $replace, $matches) ) { 
    1489                                 $content = explode($matches[0], $replace, 2); 
    1490                                 $replace = force_balance_tags($content[0]); 
     1622                            if( !empty($placeholders[3][$key]) ){ 
     1623                                $trim = true; 
     1624                                $ph_args = explode(',', $placeholders[3][$key]); 
     1625                                if( is_numeric($ph_args[0]) ) $excerpt_length = $ph_args[0]; 
     1626                                if( !empty($ph_args[1]) ) $excerpt_more = $ph_args[1]; 
    14911627                            } 
    1492                             if( !empty($trim) ){ 
    1493                                 //shorten content by supplied number - copied from wp_trim_excerpt 
    1494                                 $replace = strip_shortcodes( $replace ); 
    1495                                 $replace = str_replace(']]>', ']]&gt;', $replace); 
    1496                                 $replace = wp_trim_words( $replace, $excerpt_length, $excerpt_more ); 
    1497                             } 
     1628                            $replace = $this->output_excerpt($excerpt_length, $excerpt_more); 
    14981629                        } 
    14991630                    } 
     
    15541685                case '#_EVENTTIMES': 
    15551686                    //get format of time to show 
    1556                     if( !$this->event_all_day ){ 
    1557                         $time_format = ( get_option('dbem_time_format') ) ? get_option('dbem_time_format'):get_option('time_format'); 
    1558                         if($this->event_start_time != $this->event_end_time ){ 
    1559                             $replace = date_i18n($time_format, $this->start). get_option('dbem_times_separator') . date_i18n($time_format, $this->end); 
    1560                         }else{ 
    1561                             $replace = date_i18n($time_format, $this->start); 
    1562                         } 
    1563                     }else{ 
    1564                         $replace = get_option('dbem_event_all_day_message'); 
    1565                     } 
     1687                    $replace = $this->output_times(); 
    15661688                    break; 
    15671689                case '#_EVENTDATES': 
    15681690                    //get format of time to show 
    1569                     $date_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format'); 
    1570                     if( $this->event_start_date != $this->event_end_date){ 
    1571                         $replace = date_i18n($date_format, $this->start). get_option('dbem_dates_separator') . date_i18n($date_format, $this->end); 
    1572                     }else{ 
    1573                         $replace = date_i18n($date_format, $this->start); 
    1574                     } 
     1691                    $replace = $this->output_dates(); 
    15751692                    break; 
    15761693                //Links 
     
    18281945                    $gcal_url = str_replace('start_date', urlencode($dateStart), $gcal_url); 
    18291946                    $gcal_url = str_replace('end_date', urlencode($dateEnd), $gcal_url); 
    1830                     $gcal_url = str_replace('location_name', urlencode($this->output('#_LOCATION')), $gcal_url); 
     1947                    $gcal_url = str_replace('location_name', urlencode($this->output('#_LOCATION, #_LOCATIONADDRESS, #_LOCATIONCOUNTRY')), $gcal_url); 
    18311948                    $gcal_url = str_replace('blog_name', urlencode(get_bloginfo()), $gcal_url); 
    18321949                    $gcal_url = str_replace('event_url', urlencode($this->get_permalink()), $gcal_url); 
     
    19212038        } 
    19222039        return apply_filters('em_event_output', $event_string, $this, $format, $target); 
    1923     }    
     2040    } 
     2041     
     2042    function output_times(){ 
     2043        if( !$this->event_all_day ){ 
     2044            $time_format = ( get_option('dbem_time_format') ) ? get_option('dbem_time_format'):get_option('time_format'); 
     2045            if($this->event_start_time != $this->event_end_time ){ 
     2046                $replace = date_i18n($time_format, $this->start). get_option('dbem_times_separator') . date_i18n($time_format, $this->end); 
     2047            }else{ 
     2048                $replace = date_i18n($time_format, $this->start); 
     2049            } 
     2050        }else{ 
     2051            $replace = get_option('dbem_event_all_day_message'); 
     2052        } 
     2053        return $replace; 
     2054    } 
     2055     
     2056    function output_dates(){ 
     2057        $date_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format'); 
     2058        if( $this->event_start_date != $this->event_end_date){ 
     2059            $replace = date_i18n($date_format, $this->start). get_option('dbem_dates_separator') . date_i18n($date_format, $this->end); 
     2060        }else{ 
     2061            $replace = date_i18n($date_format, $this->start); 
     2062        } 
     2063        return $replace; 
     2064    } 
     2065     
     2066    function output_excerpt($excerpt_length = 55, $excerpt_more = '[...]', $cut_excerpt = true){ 
     2067        if( !empty($this->post_excerpt) ){ 
     2068            $replace = $this->post_excerpt; 
     2069        }else{ 
     2070            $replace = $this->post_content; 
     2071        } 
     2072        if( empty($this->post_excerpt) || $cut_excerpt ){ 
     2073            if ( preg_match('/<!--more(.*?)?-->/', $replace, $matches) ) { 
     2074                $content = explode($matches[0], $replace, 2); 
     2075                $replace = force_balance_tags($content[0]); 
     2076            } 
     2077            if( !empty($excerpt_length) ){ 
     2078                //shorten content by supplied number - copied from wp_trim_excerpt 
     2079                $replace = strip_shortcodes( $replace ); 
     2080                $replace = str_replace(']]>', ']]&gt;', $replace); 
     2081                $replace = wp_trim_words( $replace, $excerpt_length, $excerpt_more ); 
     2082            } 
     2083        } 
     2084        return $replace; 
     2085    } 
    19242086     
    19252087    /********************************************************** 
     
    20122174        global $wpdb; 
    20132175        $event_ids = $post_ids = array(); 
    2014         if( $this->can_manage('edit_events','edit_others_events') && $this->is_published() ){ 
     2176        if( $this->can_manage('edit_events','edit_others_events') && ($this->is_published() || 'future' == $this->post_status) ){ 
    20152177            do_action('em_event_save_events_pre', $this); //actions/filters only run if event is recurring 
    2016             //Make template event index, post, and meta (and we just change event dates) 
     2178            //Make template event index, post, and meta (we change event dates, timestamps, rsvp dates and other recurrence-relative info whilst saving each event recurrence) 
    20172179            $event = $this->to_array(true); //event template - for index 
    2018             $event['event_attributes'] = serialize($event['event_attributes']); 
     2180            if( !empty($event['event_attributes']) ) $event['event_attributes'] = serialize($event['event_attributes']); 
    20192181            $post_fields = $wpdb->get_row('SELECT * FROM '.$wpdb->posts.' WHERE ID='.$this->post_id, ARRAY_A); //post to copy 
    20202182            $post_name = $post_fields['post_name']; //save post slug since we'll be using this  
     
    20262188                $meta_fields[$meta_data['meta_key']] = $meta_data['meta_value']; 
    20272189            } 
     2190            if( isset($meta_fields['_edit_last']) ) unset($meta_fields['_edit_last']); 
     2191            if( isset($meta_fields['_edit_lock']) ) unset($meta_fields['_edit_lock']); 
    20282192            //remove id and we have a event template to feed to wpdb insert 
    2029             unset($event['event_id']);  
     2193            unset($event['event_id'], $event['post_id']);  
    20302194            unset($post_fields['ID']); 
     2195            unset($meta_fields['_event_id']); 
     2196            if( isset($meta_fields['_post_id']) ) unset($meta_fields['_post_id']); //legacy bugfix, post_id was never needed in meta table 
    20312197            //remove recurrence meta info we won't need in events 
    20322198            foreach( array_keys($this->recurrence_fields) as $recurrence_field){ 
    20332199                unset($event[$recurrence_field]); 
    20342200                unset($meta_fields['_'.$recurrence_field]); 
    2035             }        
    2036             $event['event_date_created'] = current_time('mysql'); //since the recurrences are recreated 
    2037             unset($event['event_date_modified']); 
     2201            } 
    20382202            //Set the recurrence ID 
    20392203            $event['recurrence_id'] = $meta_fields['_recurrence_id'] = $this->event_id; 
    20402204            $event['recurrence'] = $meta_fields['_recurrence'] = 0; 
     2205             
    20412206            //Let's start saving! 
    2042             $this->delete_events(); //Delete old events beforehand, this will change soon 
    20432207            $event_saves = array(); 
    2044             $matching_days = $this->get_recurrence_days(); //Get days where events recur 
    2045             if( count($matching_days) > 0 ){ 
    2046                 //first save event post data 
    2047                 $recurring_date_format = apply_filters('em_event_save_events_format', 'Y-m-d'); 
    2048                 foreach( $matching_days as $day ) { 
    2049                     //rewrite post fields if needed 
    2050                     $post_fields['post_name'] = $event['event_slug'] = $meta_fields['_event_slug'] = apply_filters('em_event_save_events_slug', $post_name.'-'.date($recurring_date_format, $day), $post_fields, $day, $matching_days, $this); 
    2051                     //adjust certain meta information 
    2052                     $event['event_start_date'] = $meta_fields['_event_start_date'] = date("Y-m-d", $day); 
    2053                     $meta_fields['_start_ts'] = strtotime($event['event_start_date'].' '.$event['event_start_time']); 
    2054                     if( !empty($event['recurrence_rsvp_days']) && is_numeric($event['recurrence_rsvp_days']) ){ 
    2055                         $event_rsvp_days = $event['recurrence_rsvp_days'] >= 0 ? '+'. $event['recurrence_rsvp_days']: $event['recurrence_rsvp_days']; 
    2056                         $event_rsvp_date = date('Y-m-d',  strtotime($event_rsvp_days.' days', $meta_fields['_start_ts'])); 
     2208            //First thing - times. If we're changing event times, we need to delete all events and recreate them with the right times, no other way 
     2209            $recurring_date_format = apply_filters('em_event_save_events_format', 'Y-m-d'); 
     2210            if( $this->recurring_reschedule ){ 
     2211                $this->delete_events(); //Delete old events beforehand, this will change soon 
     2212                $matching_days = $this->get_recurrence_days(); //Get days where events recur 
     2213                $event['event_date_created'] = current_time('mysql'); //since the recurrences are recreated 
     2214                unset($event['event_date_modified']); 
     2215                if( count($matching_days) > 0 ){ 
     2216                    //first save event post data 
     2217                    foreach( $matching_days as $day ) { 
     2218                        //rewrite post fields if needed 
     2219                        $post_fields['post_name'] = $event['event_slug'] = $meta_fields['_event_slug'] = apply_filters('em_event_save_events_slug', $post_name.'-'.date($recurring_date_format, $day), $post_fields, $day, $matching_days, $this); 
     2220                        //adjust certain meta information 
     2221                        $event['event_start_date'] = $meta_fields['_event_start_date'] = date("Y-m-d", $day); 
     2222                        $meta_fields['_start_ts'] = strtotime($event['event_start_date'].' '.$event['event_start_time']); 
     2223                        if( !empty($event['recurrence_rsvp_days']) && is_numeric($event['recurrence_rsvp_days']) ){ 
     2224                            $event_rsvp_days = $event['recurrence_rsvp_days'] >= 0 ? '+'. $event['recurrence_rsvp_days']: $event['recurrence_rsvp_days']; 
     2225                            $event_rsvp_date = date('Y-m-d',  strtotime($event_rsvp_days.' days', $meta_fields['_start_ts'])); 
     2226                            $event['event_rsvp_date'] = $meta_fields['_event_rsvp_date'] = $event_rsvp_date; 
     2227                        }else{ 
     2228                            $event['event_rsvp_date'] = $meta_fields['_event_rsvp_date'] = $event['event_start_date']; 
     2229                        } 
     2230                        $event['event_rsvp_time'] = $meta_fields['_event_rsvp_time'] = $event['event_rsvp_time']; 
     2231                        if($this->recurrence_days > 0){ 
     2232                            $event['event_end_date'] = $meta_fields['_event_end_date'] = date("Y-m-d", $meta_fields['_start_ts'] + ($this->recurrence_days * 60*60*24)); 
     2233                        }else{ 
     2234                            $event['event_end_date'] = $meta_fields['_event_end_date'] = $event['event_start_date']; 
     2235                        }    
     2236                        $meta_fields['_end_ts'] = strtotime($event['event_end_date'].' '.$event['event_end_time']); 
     2237                        //create the event 
     2238                        if( $wpdb->insert($wpdb->posts, $post_fields ) ){ 
     2239                            $event['post_id'] = $post_id = $post_ids[] = $wpdb->insert_id; //post id saved into event and also as a var for later user 
     2240                            // Set GUID and event slug as per wp_insert_post 
     2241                            $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_id ) ), array('ID'=>$post_id) ); 
     2242                            //insert into events index table 
     2243                            $event_saves[] = $wpdb->insert(EM_EVENTS_TABLE, $event); 
     2244                            $event_ids[$post_id] = $event_id = $wpdb->insert_id; 
     2245                            $event_dates[$event_id] = $meta_fields['_start_ts']; 
     2246                            //create the meta inserts for each event 
     2247                            $meta_fields['_event_id'] = $event_id; 
     2248                            foreach($meta_fields as $meta_key => $meta_val){ 
     2249                                $meta_inserts[] = $wpdb->prepare("(%d, %s, %s)", array($post_id, $meta_key, $meta_val)); 
     2250                            } 
     2251                        }else{ 
     2252                            $event_saves[] = false; 
     2253                        } 
     2254                        //if( EM_DEBUG ){ echo "Entering recurrence " . date("D d M Y", $day)."<br/>"; } 
     2255                    } 
     2256                    //insert the metas in one go, faster than one by one 
     2257                    if( count($meta_inserts) > 0 ){ 
     2258                        $result = $wpdb->query("INSERT INTO ".$wpdb->postmeta." (post_id,meta_key,meta_value) VALUES ".implode(',',$meta_inserts)); 
     2259                        if($result === false){ 
     2260                            $this->add_error('There was a problem adding custom fields to your recurring events.','events-manager'); 
     2261                        } 
     2262                    } 
     2263                }else{ 
     2264                    $this->add_error('You have not defined a date range long enough to create a recurrence.','events-manager'); 
     2265                    $result = false; 
     2266                } 
     2267            }else{ 
     2268                //we go through all event main data and meta data, we delete and recreate all meta data 
     2269                $meta_inserts = array(); 
     2270                //now unset some vars we don't need to deal with since we're just updating data in the wp_em_events and posts table 
     2271                unset( $event['event_date_created'], $event['recurrence_id'], $event['recurrence'], $event['event_start_date'], $event['event_end_date'], $event['event_start_time'], $event['event_end_time'] ); 
     2272                $event['event_date_modified'] = current_time('mysql'); //since the recurrences are modified but not recreated 
     2273                unset( $post_fields['comment_count'], $post_fields['guid'], $post_fields['menu_order']); 
     2274                //now we go through the recurrences and check whether things relative to dates need to be changed 
     2275                //@todo do a direct DB lookup once we have timezones implemented to save processing and memory 
     2276                $EM_Events = EM_Events::get( array('recurrence'=>$this->event_id, 'scope'=>'all', 'status'=>'everything' ) ); 
     2277                foreach($EM_Events as $EM_Event){ /* @var $EM_Event EM_Event */ 
     2278                    $event_ids[$EM_Event->post_id] = $EM_Event->event_id; 
     2279                    $post_ids[] = $EM_Event->post_id; 
     2280                    //do we need to change the slugs? 
     2281                    $post_fields['post_name'] = $event['event_slug'] = $meta_fields['_event_slug'] = apply_filters('em_event_save_events_slug', $post_name.'-'.date($recurring_date_format, $EM_Event->start), $post_fields, $EM_Event->start, array(), $this); 
     2282                    //adjust certain meta information relativv 
     2283                    if( !empty($event['recurrence_rsvp_days']) && is_numeric($event['recurrence_rsvp_days']) ){ 
     2284                        $event_rsvp_days = $event['recurrence_rsvp_days'] >= 0 ? '+'. $event['recurrence_rsvp_days']: $event['recurrence_rsvp_days']; 
     2285                        $event_rsvp_date = date('Y-m-d',  strtotime($event_rsvp_days.' days', $EM_Event->start)); 
    20572286                        $event['event_rsvp_date'] = $meta_fields['_event_rsvp_date'] = $event_rsvp_date; 
    2058                         $event['event_rsvp_time'] = $meta_fields['_event_rsvp_time'] = $event['event_rsvp_time']; 
    2059                     }else{ 
    2060                         $event['event_rsvp_date'] = $meta_fields['_event_rsvp_date'] = $event['event_start_date']; 
    2061                         $event['event_rsvp_time'] = $meta_fields['_event_rsvp_time'] = $event['event_rsvp_time']; 
    2062                     } 
    2063                     if($this->recurrence_days > 0){ 
    2064                         $event['event_end_date'] = $meta_fields['_event_end_date'] = date("Y-m-d", $meta_fields['_start_ts'] + ($this->recurrence_days * 60*60*24)); 
    2065                     }else{ 
    2066                         $event['event_end_date'] = $meta_fields['_event_end_date'] = $event['event_start_date']; 
    2067                     }    
    2068                     $meta_fields['_end_ts'] = strtotime($event['event_end_date'].' '.$event['event_end_time']); 
    2069                     //create the event 
    2070                     if( $wpdb->insert($wpdb->posts, $post_fields ) ){ 
    2071                         $event['post_id'] = $meta_fields['_post_id'] = $post_id = $post_ids[] = $wpdb->insert_id; //post id saved into event and also as a var for later user 
    2072                         // Set GUID and event slug as per wp_insert_post 
    2073                         $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_id ) ), array('ID'=>$post_id) ); 
    2074                         //insert into events index table 
    2075                         $event_saves[] = $wpdb->insert(EM_EVENTS_TABLE, $event); 
    2076                         $event_ids[$post_id] = $event_id = $wpdb->insert_id; 
    2077                         $event_dates[$event_id] = $meta_fields['_start_ts']; 
    2078                         //create the meta inserts for each event 
    2079                         $meta_fields['_event_id'] = $event_id; 
    2080                         foreach($meta_fields as $meta_key => $meta_val){ 
    2081                             $meta_inserts[] = $wpdb->prepare("(%d, %s, %s)", array($post_id, $meta_key, $meta_val)); 
    2082                         } 
    2083                     }else{ 
    2084                         $event_saves[] = false; 
    2085                     } 
    2086                     //if( EM_DEBUG ){ echo "Entering recurrence " . date("D d M Y", $day)."<br/>"; } 
     2287                    }else{ 
     2288                        $event['event_rsvp_date'] = $meta_fields['_event_rsvp_date'] = $EM_Event->event_start_date; 
     2289                    } 
     2290                    $event['event_rsvp_time'] = $meta_fields['_event_rsvp_time'] = $event['event_rsvp_time']; 
     2291                    //add meta fields we deleted and are specific to this event 
     2292                    $meta_fields['_event_start_date'] = $EM_Event->event_start_date; 
     2293                    $meta_fields['_event_end_date'] = $EM_Event->event_end_date; 
     2294                    $meta_fields['_start_ts'] = $EM_Event->start; 
     2295                    $meta_fields['_end_ts'] = $EM_Event->end; 
     2296                    //overwrite event and post tables 
     2297                    $wpdb->update(EM_EVENTS_TABLE, $event, array('event_id' => $EM_Event->event_id)); 
     2298                    $wpdb->update($wpdb->posts, $post_fields, array('ID' => $EM_Event->post_id)); 
     2299                    //save meta field data for insertion in one go 
     2300                    foreach($meta_fields as $meta_key => $meta_val){ 
     2301                        $meta_inserts[] = $wpdb->prepare("(%d, %s, %s)", array($EM_Event->post_id, $meta_key, $meta_val)); 
     2302                    } 
     2303                } 
     2304                //delete all meta 
     2305                if( !empty($post_ids) ){ 
     2306                    $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id IN (".implode(',', array_keys($post_ids)).")"); 
    20872307                } 
    20882308                //insert the metas in one go, faster than one by one 
     
    20932313                    } 
    20942314                } 
    2095                 //copy the event tags and categories 
    2096                 $taxonomies = self::get_taxonomies(); 
    2097                 foreach($taxonomies as $tax_name => $tax_data){ 
    2098                     //In MS Global mode, we also save category meta information for global lookups so we use our objects 
    2099                     if( EM_MS_GLOBAL && $tax_name == 'category' ){ 
    2100                         //use EM_Categories as this is a special taxonomy in global mode 
    2101                         $EM_Categories = new EM_Categories($this); 
    2102                         //we save index data for each category in in MS Global mode 
    2103                         foreach($event_ids as $post_id => $event_id){ 
    2104                             foreach( $EM_Categories->categories as $EM_Category ){ 
    2105                                 $EM_Categories->event_id = $event_id; 
    2106                                 $EM_Categories->post_id = $post_id; 
    2107                                 $EM_Categories->save(); 
    2108                             } 
    2109                         } 
    2110                     }else{ 
    2111                         //general taxonomies including event tags 
    2112                         $terms = get_the_terms( $this->post_id, $tax_data['name']); 
    2113                         $term_slugs = array(); 
    2114                         if( is_array($terms) ){ 
    2115                             foreach($terms as $term){ 
    2116                                 if( !empty($term->slug) ) $term_slugs[] = $term->slug; //save of category will soft-fail if slug is empty 
    2117                             } 
    2118                         } 
    2119                         foreach($post_ids as $post_id){ 
    2120                             wp_set_object_terms($post_id, $term_slugs, $tax_data['name']); 
    2121                         } 
    2122                     } 
    2123                 } 
    2124                 //featured images 
    2125                 if( !empty($this->attributes['thumbnail_id']) ){ 
    2126                     $image_inserts = array(); 
    2127                     foreach($post_ids as $post_ids){ 
    2128                         $image_inserts[] = "({$this->post_id}, '_thumbnail_id', {$this->attributes['thumbnail_id']})"; 
    2129                     } 
    2130                     if( count($image_inserts) > 0 ){ 
    2131                         $wpdb->query('INSERT INTO '.$wpdb->postmeta.' (post_id, meta_key, meta_value) VALUES '.implode(', ', $image_inserts)); 
     2315            } 
     2316            //Next - Bookings. If we're completely rescheduling or just recreating bookings, we're deleting them and starting again 
     2317            if( $this->recurring_reschedule || $this->recurring_recreate_bookings ){ 
     2318                //first, delete all bookings & tickets if we haven't done so during the reschedule above - something we'll want to change later if possible so bookings can be modified without losing all data 
     2319                if( !$this->recurring_reschedule ){ 
     2320                    foreach($EM_Events as $EM_Event){ //$EM_Events was defined in the else statement above so we reuse it 
     2321                        /* @var $EM_Event EM_Event */ 
     2322                        if($EM_Event->recurrence_id == $this->event_id){ 
     2323                            $EM_Event->get_bookings()->delete(); 
     2324                            $EM_Event->get_tickets()->delete(); 
     2325                        } 
    21322326                    } 
    21332327                } 
    2134                 //MS Global Categories 
    2135                 if( EM_MS_GLOBAL && get_option('dbem_categories_enabled') ){ 
    2136                     foreach( self::get_categories() as $EM_Category ){ 
    2137                         foreach($event_ids as $event_id){ 
    2138                             $wpdb->insert(EM_META_TABLE, array('meta_value'=>$EM_Category->term_id,'object_id'=>$event_id,'meta_key'=>'event-category')); 
    2139                         } 
    2140                     } 
    2141                 } 
    2142                 //now, save booking info for each event 
     2328                //if bookings hasn't been disabled, delete it all 
    21432329                if( $this->event_rsvp ){ 
    21442330                    $meta_inserts = array(); 
     
    21902376                    $result = $wpdb->query($sql); 
    21912377                } 
    2192             }else{ 
    2193                 $this->add_error('You have not defined a date range long enough to create a recurrence.','events-manager'); 
    2194                 $result = false; 
     2378            }elseif( $this->recurring_delete_bookings ){ 
     2379                foreach($EM_Events as $EM_Event){ //$EM_Events was defined in the else statement above so we reuse it 
     2380                    /* @var $EM_Event EM_Event */ 
     2381                    if($EM_Event->recurrence_id == $this->event_id){ 
     2382                        $EM_Event->get_bookings()->delete(); 
     2383                        $EM_Event->get_tickets()->delete(); 
     2384                    } 
     2385                } 
    21952386            } 
     2387            //copy the event tags and categories, which are automatically deleted/recreated by WP and EM_Categories 
     2388            foreach( self::get_taxonomies() as $tax_name => $tax_data ){ 
     2389                //In MS Global mode, we also save category meta information for global lookups so we use our objects 
     2390                if( $tax_name == 'category' ){ 
     2391                    //we save index data for each category in in MS Global mode 
     2392                    foreach($event_ids as $post_id => $event_id){ 
     2393                        //set and trick category event and post ids so it saves to the right place 
     2394                        $this->get_categories()->event_id = $event_id; 
     2395                        $this->get_categories()->post_id = $post_id; 
     2396                        $this->get_categories()->save(); 
     2397                    } 
     2398                    $this->get_categories()->event_id = $this->event_id; 
     2399                    $this->get_categories()->post_id = $this->post_id; 
     2400                }else{ 
     2401                    //general taxonomies including event tags 
     2402                    $terms = get_the_terms( $this->post_id, $tax_data['name']); 
     2403                    $term_slugs = array(); 
     2404                    if( is_array($terms) ){ 
     2405                        foreach($terms as $term){ 
     2406                            if( !empty($term->slug) ) $term_slugs[] = $term->slug; //save of category will soft-fail if slug is empty 
     2407                        } 
     2408                    } 
     2409                    foreach($post_ids as $post_id){ 
     2410                        wp_set_object_terms($post_id, $term_slugs, $tax_data['name']); 
     2411                    } 
     2412                } 
     2413            } 
     2414            if( 'future' == $this->post_status ){ 
     2415                $time = strtotime( $this->post_date_gmt . ' GMT' ); 
     2416                foreach( $post_ids as $post_id ){ 
     2417                    if( !$this->recurring_reschedule ){ 
     2418                        wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system 
     2419                    } 
     2420                    wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); 
     2421                } 
     2422            } 
    21962423            return apply_filters('em_event_save_events', !in_array(false, $event_saves) && $result !== false, $this, $event_ids, $post_ids); 
    21972424        } 
     
    23702597            $natural_days = array(); 
    23712598            foreach($weekday_array as $day){ 
    2372                 if( !empty($day) ){ 
     2599                if( is_numeric($day) ){ 
    23732600                    array_push($natural_days, $weekdays_name[$day]); 
    23742601                } 
     
    24122639     */ 
    24132640    function can_manage( $owner_capability = false, $admin_capability = false, $user_to_check = false ){ 
    2414         if( $this->event_id == '' && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions') ){ 
     2641        if( ($this->just_added_event || $this->event_id == '') && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions') ){ 
    24152642            $user_to_check = get_option('dbem_events_anonymous_user'); 
    24162643        } 
     
    24302657function em_event_output_placeholder($result,$event,$placeholder,$target='html'){ 
    24312658    if( $target == 'raw' ) return $result; 
    2432     if( in_array($placeholder, array("#_EXCERPT",'#_EVENTEXCERPT', "#_LOCATIONEXCERPT")) && $target == 'html' ){ 
     2659    if( in_array($placeholder, array("#_EXCERPT",'#_EVENTEXCERPT','#_EVENTEXCERPTCUT', "#_LOCATIONEXCERPT")) && $target == 'html' ){ 
    24332660        $result = apply_filters('dbem_notes_excerpt', $result); 
    24342661    }elseif( $placeholder == '#_CONTACTEMAIL' && $target == 'html' ){ 
  • events-manager/trunk/classes/em-events.php

    r1397828 r1651260  
    3434        $limit = ( $args['limit'] && is_numeric($args['limit'])) ? "LIMIT {$args['limit']}" : ''; 
    3535        $offset = ( $limit != "" && is_numeric($args['offset']) ) ? "OFFSET {$args['offset']}" : ''; 
    36         $groupby_sql = ''; 
     36        $groupby_sql = array(); 
    3737         
    3838        //Get the default conditions 
     
    242242        $args['mode'] = !empty($args['mode']) ? $args['mode'] : get_option('dbem_event_list_groupby'); 
    243243        $args['header_format'] = !empty($args['header_format']) ? $args['header_format'] :  get_option('dbem_event_list_groupby_header_format', '<h2>#s</h2>'); 
    244         $args['date_format'] = !empty($args['date_format']) ? $args['date_format'] :  get_option('dbem_event_list_groupby_format'); 
    245244        //Reset some vars for counting events and displaying set arrays of events 
    246245        $atts = (array) $args; 
     
    460459            } 
    461460        } 
     461        //events with or without locations 
     462        if( !empty($args['has_location']) ){ 
     463            $conditions['has_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NOT NULL AND '.EM_EVENTS_TABLE.'.location_id != 0)'; 
     464        }elseif( !empty($args['no_location']) ){ 
     465            $conditions['no_location'] = '('.EM_EVENTS_TABLE.'.location_id IS NULL OR '.EM_EVENTS_TABLE.'.location_id = 0)';             
     466        } 
    462467        return apply_filters( 'em_events_build_sql_conditions', $conditions, $args ); 
    463468    } 
     
    491496            'country' => false, 
    492497            'region' => false, 
     498            'has_location' => false, 
     499            'no_location' => false, 
    493500            'blog' => get_current_blog_id(), 
    494501            'private' => current_user_can('read_private_events'), 
  • events-manager/trunk/classes/em-location-post-admin.php

    r1311743 r1651260  
    77        } 
    88        //Meta Boxes 
    9         add_action('add_meta_boxes', array('EM_Location_Post_Admin','meta_boxes')); 
     9        add_action('add_meta_boxes_'.EM_POST_TYPE_LOCATION, array('EM_Location_Post_Admin','meta_boxes'), 10, 1); 
    1010        //Save/Edit actions 
    1111        add_filter('wp_insert_post_data',array('EM_Location_Post_Admin','wp_insert_post_data'),100,2); //validate post meta before saving is done 
     
    149149    } 
    150150     
    151     public static function meta_boxes(){ 
    152         global $EM_Location, $post; 
    153         //no need to proceed if we're not dealing with a location 
    154         if( $post->post_type != EM_POST_TYPE_LOCATION ) return; 
     151    public static function meta_boxes( $post ){ 
     152        global $EM_Location; 
    155153        //since this is the first point when the admin area loads location stuff, we load our EM_Event here 
    156154        if( empty($EM_Location) && !empty($post) ){ 
  • events-manager/trunk/classes/em-location.php

    r1488912 r1651260  
    466466    /** 
    467467     * Change the status of the location. This will save to the Database too.  
    468      * @param int $status 
    469      * @param boolean $set_post_status 
     468     * @param int $status               A number to change the status to, which may be -1 for trash, 1 for publish, 0 for pending or null if draft. 
     469     * @param boolean $set_post_status  If set to true the wp_posts table status will also be changed to the new corresponding status. 
    470470     * @return string 
    471471     */ 
    472472    function set_status($status, $set_post_status = false){ 
    473473        global $wpdb; 
     474        //decide on what status to set and update wp_posts in the process 
    474475        if($status === null){  
    475             $set_status='NULL';  
     476            $set_status='NULL'; //draft post 
    476477            if($set_post_status){ 
     478                //if the post is trash, don't untrash it! 
    477479                $wpdb->update( $wpdb->posts, array( 'post_status' => 'draft' ), array( 'ID' => $this->post_id ) ); 
    478480            }  
     
    481483            $set_status = -1; 
    482484            if($set_post_status){ 
     485                //set the post status of the location in wp_posts too 
    483486                $wpdb->update( $wpdb->posts, array( 'post_status' => 'trash' ), array( 'ID' => $this->post_id ) ); 
    484487            } 
    485488            $this->post_status = 'trash'; //set post status in this instance 
    486489        }else{ 
    487             $set_status = $status ? 1:0; 
     490            $set_status = $status ? 1:0; //published or pending post 
    488491            $post_status = $set_status ? 'publish':'pending'; 
     492            if( empty($this->post_name) ){ 
     493                //published or pending posts should have a valid post slug 
     494                $this->post_name = sanitize_title($this->post_title); 
     495                $set_post_name = true; 
     496            } 
    489497            if($set_post_status){ 
    490                 if($this->post_status == 'pending' && empty($this->post_name)){ 
    491                     $this->post_name = sanitize_title($this->post_title); 
    492                 } 
    493498                $wpdb->update( $wpdb->posts, array( 'post_status' => $post_status, 'post_name' => $this->post_name ), array( 'ID' => $this->post_id ) ); 
     499            }elseif( $set_post_name ){ 
     500                //if we've added a post slug then update wp_posts anyway 
     501                $wpdb->update( $wpdb->posts, array( 'post_name' => $this->post_name ), array( 'ID' => $this->post_id ) ); 
    494502            } 
    495503            $this->post_status = $post_status; 
    496504        } 
     505        //save in the wp_em_locations table 
    497506        $this->previous_status = $wpdb->get_var('SELECT location_status FROM '.EM_LOCATIONS_TABLE.' WHERE location_id='.$this->location_id); //get status from db, not post_status, as posts get saved quickly 
    498507        $result = $wpdb->query($wpdb->prepare("UPDATE ".EM_LOCATIONS_TABLE." SET location_status=$set_status, location_slug=%s WHERE location_id=%d", array($this->post_name, $this->location_id))); 
    499         $this->get_status(); 
     508        $this->get_status(); //reload status 
    500509        return apply_filters('em_location_set_status', $result !== false, $status, $this); 
    501510    }    
     
    619628        } 
    620629        return apply_filters('em_location_get_rss_url', $return); 
     630    } 
     631     
     632    /* 
     633     * Extends the default EM_Object function by switching blogs as needed if in MS Global mode 
     634     * @param string $size 
     635     * @return string 
     636     * @see EM_Object::get_image_url() 
     637     */ 
     638    function get_image_url($size = 'full'){ 
     639        if( EM_MS_GLOBAL && get_current_blog_id() != $this->blog_id ){ 
     640            switch_to_blog($this->blog_id); 
     641            $switch_back = true; 
     642        } 
     643        $return = parent::get_image_url($size); 
     644        if( !empty($switch_back) ){ restore_current_blog(); } 
     645        return $return; 
    621646    } 
    622647     
     
    807832                case '#_LOCATIONIMAGEURL': 
    808833                case '#_LOCATIONIMAGE': 
    809                     if($this->get_image_url() != ''){ 
    810                         $image_url = esc_url($this->get_image_url()); 
     834                    $image_url = $this->get_image_url(); 
     835                    if( $image_url != ''){ 
     836                        $image_url = esc_url($image_url); 
    811837                        if($result == '#_LOCATIONIMAGEURL'){ 
    812                             $replace =  $this->get_image_url(); 
     838                            $replace =  $image_url; 
    813839                        }else{ 
    814840                            if( empty($placeholders[3][$key]) ){ 
  • events-manager/trunk/classes/em-locations.php

    r1397828 r1651260  
    6262        } 
    6363        //Create the SQL statement and execute 
    64         $sql = " 
     64        $sql = apply_filters('em_locations_get_sql', " 
    6565            SELECT $selectors FROM $locations_table 
    6666            LEFT JOIN $events_table ON {$locations_table}.location_id={$events_table}.location_id 
     
    6969            $orderby_sql 
    7070            $limit $offset 
    71         "; 
     71        ", $args); 
    7272         
    7373        //If we're only counting results, return the number of results 
    7474        if( $count ){ 
    75             return apply_filters('em_locations_get_array', count($wpdb->get_col($sql)), $args);  
     75            return apply_filters('em_locations_get_count', count($wpdb->get_col($sql)), $args);  
    7676        } 
    7777        $results = $wpdb->get_results($sql, ARRAY_A); 
  • events-manager/trunk/classes/em-mailer.php

    r1395984 r1651260  
    4545            } 
    4646            return $send; 
    47         }elseif ( $emails_ok && get_option('dbem_rsvp_mail_send_method') == 'mail' ){ 
    48             if(is_array($receiver)){ 
    49                 $receiver = implode(', ', $receiver); 
    50             } 
    51             $headers = ''; 
    52             if( get_option('dbem_smtp_html') ){ 
    53                 $headers  = 'MIME-Version: 1.0' . "\r\n"; 
    54                 $headers .= 'Content-type: text/html; charset="UTF-8"' . "\r\n"; 
    55             }else{ 
    56                 $headers = 'Content-Type: text/plain; charset="UTF-8"' . "\r\n"; 
    57             } 
    58             $from = get_option('dbem_mail_sender_address'); 
    59             $headers .= get_option('dbem_mail_sender_name') ? 'From: '.get_option('dbem_mail_sender_name').' <'.$from.'>':'From: '.$from; 
    60             $send = mail($receiver, $subject, $body, $headers); 
    61             if(!$send){ 
    62                 $this->errors[] = __('Could not send email.', 'events-manager'); 
    63             } 
    64             return $send; 
    6547        }elseif( $emails_ok ){ 
    6648            $this->load_phpmailer(); 
     
    10789            //Protocols 
    10890            if( get_option('dbem_rsvp_mail_send_method') == 'qmail' ){        
    109                 $mail->IsQmail(); 
     91                $mail->isQmail(); 
     92            }elseif( get_option('dbem_rsvp_mail_send_method') == 'sendmail' ){        
     93                $mail->isSendmail(); 
    11094            }else { 
    11195                $mail->Mailer = get_option('dbem_rsvp_mail_send_method'); 
  • events-manager/trunk/classes/em-object.php

    r1488912 r1651260  
    11631163        return apply_filters('em_object_get_fields', array(), $this, $inverted_array); 
    11641164    } 
    1165  
    1166     /** 
    1167      * Sanitize text before inserting into database 
    1168      * @param string $value 
    1169      * @return string 
    1170      */ 
    1171     function sanitize( $value ) { 
    1172         if( get_magic_quotes_gpc() )  
    1173           $value = wp_unslash( $value ); 
    1174      
    1175         //check if this function exists 
    1176         if( function_exists( "mysql_real_escape_string" ) ) { 
    1177             $value = mysql_real_escape_string( $value ); 
    1178             //for PHP version < 4.3.0 use addslashes 
    1179         } else { 
    1180           $value = addslashes( $value ); 
    1181         } 
    1182         return apply_filters('em_object_sanitize', $value); 
    1183     } 
    11841165     
    11851166    /** 
     
    15381519    } 
    15391520     
    1540     function get_tax_rate(){ 
    1541         return get_option('dbem_bookings_tax'); 
     1521    /** 
     1522     * Returns contextual tax rate of object, which may be global or instance-specific. By default a number representing percentage is provided, e.g. 21% returns 21.  
     1523     * If $decimal is set to true, 21% is returned as 0.21   
     1524     * @param boolean $decimal If set to true, a decimal representation will be returned. 
     1525     * @return float 
     1526     */ 
     1527    function get_tax_rate( $decimal = false ){ 
     1528        $tax_rate = get_option('dbem_bookings_tax'); 
     1529        $tax_rate = ($tax_rate > 0) ? $tax_rate : 0; 
     1530        if( $decimal && $tax_rate > 0 ) $tax_rate = $tax_rate / 100; 
     1531        return $tax_rate; 
    15421532    } 
    15431533} 
  • events-manager/trunk/classes/em-people.php

    r1311743 r1651260  
    11<?php 
    22class EM_People extends EM_Object { 
     3     
     4    public static function init(){ 
     5        add_action('delete_user', 'EM_People::delete_user', 10, 1); 
     6        add_filter( 'user_contactmethods', 'EM_People::user_contactmethods', 10, 1); 
     7        add_filter('pre_option_dbem_bookings_registration_user', 'EM_People::dbem_bookings_registration_user'); 
     8    } 
    39     
    410    /** 
     
    1420            $wpdb->query("DELETE FROM ".EM_EVENTS_TABLE." WHERE event_owner=$id"); 
    1521        } 
    16         //delete the booking completely 
    17         if( !get_option('dbem_bookings_registration_disable') || $id != get_option('dbem_bookings_registration_user') ){ 
    18             $EM_Person = new EM_Person(); 
    19             $EM_Person->ID = $EM_Person->person_id = $id; 
    20             foreach( $EM_Person->get_bookings() as $EM_Booking){ 
    21                 $EM_Booking->manage_override = true; 
    22                 $EM_Booking->delete(); 
    23             }            
    24         }else{ //user is the no-user mode assigned user, so don't delete all the guest bookings, in case of mistake. 
    25             $wpdb->update(EM_BOOKINGS_TABLE, array('booking_status'=>3, 'person_id'=>0, 'booking_comment'=>__('User deleted by administrators','events-manager')), array('person_id'=>$id)); 
    26         } 
     22        //delete their bookings completely 
     23        $EM_Person = new EM_Person(); 
     24        $EM_Person->ID = $EM_Person->person_id = $id; 
     25        foreach( $EM_Person->get_bookings() as $EM_Booking){ 
     26            $EM_Booking->manage_override = true; 
     27            $EM_Booking->delete(); 
     28        } 
    2729    } 
    2830     
     
    3537        $array['dbem_phone'] = __('Phone','events-manager') . ' <span class="description">('. __('Events Manager','events-manager') .')</span>'; 
    3638        return $array; 
    37     }    
     39    } 
     40     
     41    /** 
     42     * Workaround function for any legacy code requesting the dbem_bookings_registration_user option which should always be 0 
     43     * @return int 
     44     */ 
     45    public static function dbem_bookings_registration_user(){ 
     46        return 0;        
     47    } 
    3848} 
    39 add_action('delete_user', array('EM_People','delete_user'),10,1); 
    40 add_filter( 'user_contactmethods' , array('EM_People','user_contactmethods'),10,1); 
     49EM_People::init(); 
    4150?> 
  • events-manager/trunk/classes/em-permalinks.php

    r1409081 r1651260  
    55        static $em_queryvars = array( 
    66            'event_id','event_slug', 'em_redirect', 
     7            'recurrence_id', 
    78            'location_id','location_slug', 
    89            'person_id', 
     
    288289function em_get_my_bookings_url(){ 
    289290    global $bp, $wp_rewrite; 
     291    // @todo add filter for bookings url, remove bp condition and add it to bp-em-core.php 
    290292    if( !empty($bp->events->link) ){ 
    291293        //get member url 
     
    301303    } 
    302304} 
     305 
     306/** 
     307 * Gets the admin URL for editing events. If called from front-end and there's a front-end edit events page, that will be 
     308 * returned, otherwise a url to the dashboard will be returned. 
     309 */ 
     310function em_get_events_admin_url(){ 
     311    $admin_url = admin_url('edit.php?post_type=event'); 
     312    if( !is_admin() ){ 
     313        if( get_option('dbem_edit_events_page') ){ 
     314            $admin_url = get_permalink(get_option( 'dbem_edit_events_page' )); 
     315        } 
     316    } 
     317    return apply_filters('em_get_events_admin_url', $admin_url); 
     318} 
  • events-manager/trunk/classes/em-person.php

    r1395984 r1651260  
    33class EM_Person extends WP_User{ 
    44     
    5     function __construct( $person_id = 0, $username = '', $blog_id='' ){ 
     5    function __construct( $person_id = false, $username = '', $blog_id='' ){ 
    66        if( is_array($person_id) ){ 
    77            if( array_key_exists('person_id',$person_id) ){ 
     
    1717        if($username){ 
    1818            parent::__construct($person_id, $username); 
    19         }elseif( is_numeric($person_id) && ($person_id <= 0) ){ 
     19        }elseif( is_numeric($person_id) && $person_id == 0 ){ 
    2020            $this->data = new stdClass(); 
    2121            $this->ID = 0; 
    22             $this->display_name = 'Non-Registered User'; 
    23             $this->user_email = ''; 
     22            $this->display_name = 'Anonymous User'; 
     23            $this->user_email = 'anonymous@'.preg_replace('/https?:\/\//', '', get_site_url()); 
    2424        }else{ 
    2525            parent::__construct($person_id); 
     
    8585    function display_summary(){ 
    8686        ob_start(); 
    87         $no_user = get_option('dbem_bookings_registration_disable') && $this->ID == get_option('dbem_bookings_registration_user'); 
    8887        ?> 
    8988        <table class="em-form-fields"> 
     
    9291                <td style="padding-left:10px; vertical-align: top;"> 
    9392                    <table> 
    94                         <?php if( $no_user ): ?> 
     93                        <?php if( $this->ID === 0 ): ?> 
    9594                        <tr><th><?php _e('Name','events-manager'); ?> : </th><th><?php echo $this->get_name(); ?></th></tr> 
    9695                        <?php else: ?> 
  • events-manager/trunk/classes/em-ticket.php

    r1488912 r1651260  
    326326     */ 
    327327    function get_price_with_tax( $format = false ){ 
    328         $price = $this->get_price_without_tax() * (1 + $this->get_event()->get_tax_rate()/100); 
     328        $price = $this->get_price_without_tax() * (1 + $this->get_event()->get_tax_rate( true )); 
    329329        if( $format ) return $this->format_price($price); 
    330330        return $price;  
  • events-manager/trunk/classes/em-tickets.php

    r1311743 r1651260  
    116116                $this->add_error(__('You cannot delete tickets if there are any bookings associated with them. Please delete these bookings first.','events-manager')); 
    117117            }else{ 
    118                 $result = $wpdb->query("DELETE FROM ".EM_TICKETS_TABLE." WHERE event_id IN (".implode(',',$ticket_ids).")"); 
     118                $result = $wpdb->query("DELETE FROM ".EM_TICKETS_TABLE." WHERE ticket_id IN (".implode(',',$ticket_ids).")"); 
    119119            } 
    120120        } 
     
    138138                    $ticket_data['event_id'] = $this->event_id; 
    139139                    $EM_Ticket->get_post($ticket_data); 
    140                     $this->tickets[] = $EM_Ticket; 
     140                    if( $EM_Ticket->ticket_id ){ 
     141                        $this->tickets[$EM_Ticket->ticket_id] = $EM_Ticket; 
     142                    }else{ 
     143                        $this->tickets[] = $EM_Ticket; 
     144                    } 
    141145                } 
    142146            } 
  • events-manager/trunk/em-actions.php

    r1488912 r1651260  
    4444            die();    
    4545        } 
     46        if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'GlobalEventsMapData') { 
     47            $_REQUEST['has_location'] = true; //we're looking for locations in this context, so locations necessary 
     48            $EM_Events = EM_Events::get( $_REQUEST ); 
     49            $json_locations = array(); 
     50            $locations = array(); 
     51            foreach($EM_Events as $EM_Event) { 
     52                if( !empty($EM_Event->location_id) && empty($locations[$EM_Event->location_id]) ){ 
     53                    $EM_Location = $EM_Event->get_location(); 
     54                    $location_array = $EM_Event->get_location()->to_array(); 
     55                    $location_array['location_balloon'] = $EM_Location->output(get_option('dbem_map_text_format')); 
     56                    $json_locations[] = $location_array; 
     57                    $locations[$EM_Event->location_id] = true; 
     58                } 
     59            } 
     60            echo EM_Object::json_encode($json_locations); 
     61            die();    
     62        } 
    4663     
    4764        if(isset($_REQUEST['ajaxCalendar']) && $_REQUEST['ajaxCalendar']) { 
     
    92109                wp_redirect( em_wp_get_referer() ); 
    93110            }else{ 
    94                 $EM_Notices->add_confirm($EM_Event->feedback_message, true); 
     111                $EM_Notices->add_confirm($event->feedback_message, true); 
    95112                wp_redirect( $event->get_edit_url() ); 
    96113            } 
     
    251268            //ADD/EDIT Booking 
    252269            ob_start(); 
    253             if( !defined('WP_CACHE') || !WP_CACHE ) em_verify_nonce('booking_add'); 
     270            if( (!defined('WP_CACHE') || !WP_CACHE) && !isset($GLOBALS["wp_fastest_cache"]) ) em_verify_nonce('booking_add'); 
    254271            if( !is_user_logged_in() || get_option('dbem_bookings_double') || !$EM_Event->get_bookings()->has_booking(get_current_user_id()) ){ 
    255272                $EM_Booking->get_post(); 
     
    435452            if( $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ){ 
    436453                global $wpdb; 
    437                 $no_user = get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user'); 
    438454                if( //save just the booking meta, avoid extra unneccesary hooks and things to go wrong 
    439                     $no_user && $EM_Booking->get_person_post() &&  
     455                    $EM_Booking->is_no_user() && $EM_Booking->get_person_post() &&  
    440456                    $wpdb->update(EM_BOOKINGS_TABLE, array('booking_meta'=> serialize($EM_Booking->booking_meta)), array('booking_id'=>$EM_Booking->booking_id)) 
    441457                ){ 
  • events-manager/trunk/em-events.php

    r1311743 r1651260  
    1111function em_content($page_content) { 
    1212    global $post, $wpdb, $wp_query, $EM_Event, $EM_Location, $EM_Category; 
    13     if( empty($post) ) return $page_content; //fix for any other plugins calling the_content outside the loop 
     13    if( empty($post) || empty($post->ID) ) return $page_content; //fix for any other plugins calling the_content outside the loop 
    1414    $events_page_id = get_option ( 'dbem_events_page' ); 
    1515    $locations_page_id = get_option( 'dbem_locations_page' ); 
     
    6060                        if( !empty($args['ajax']) ){ echo '<div class="em-search-ajax">'; } //AJAX wrapper open 
    6161                        if( get_option('dbem_event_list_groupby') ){ 
     62                            $args['date_format'] = get_option('dbem_event_list_groupby_format'); 
    6263                            em_locate_template('templates/events-list-grouped.php', true, array('args'=>$args)); 
    6364                        }else{ 
  • events-manager/trunk/em-functions.php

    r1488912 r1651260  
    388388        if( $EM_Booking->get_person_post() ){ 
    389389            //Save default person to booking 
    390             $EM_Booking->person_id = get_option('dbem_bookings_registration_user'); 
     390            $EM_Booking->person_id = 0; 
    391391        }else{ 
    392392            $registration = false; 
     
    556556    $search_args['categories_label'] = get_option('dbem_search_form_categories_label'); //select default 
    557557    //countries 
    558     $search_args['country'] = get_option('dbem_search_form_advanced') ? get_option('dbem_search_form_default_country'):''; //default country 
    559558    $search_args['search_countries'] = get_option('dbem_search_form_countries'); 
     559    $search_args['country'] = $search_args['search_countries'] ? get_option('dbem_search_form_default_country'):''; //default country 
    560560    $search_args['country_label'] = get_option('dbem_search_form_country_label'); //field label 
    561561    $search_args['countries_label'] = get_option('dbem_search_form_countries_label'); //select default 
  • events-manager/trunk/em-ical.php

    r1234828 r1651260  
    55    function em_ical( ){ 
    66        //check if this is a calendar request for all events 
    7         if ( preg_match('/events.ics$/', $_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '/?ical=1' ) { 
    8             header('Content-type: text/calendar; charset=utf-8'); 
     7        if ( preg_match('/events.ics(\?.+)?$/', $_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '/?ical=1' ) { 
     8            header('Content-Type: text/calendar; charset=utf-8'); 
    99            header('Content-Disposition: inline; filename="events.ics"'); 
    1010            //send headers 
     
    6666    } 
    6767    add_action ( 'parse_query', 'em_ical_item' ); 
     68     
     69 
     70    /** 
     71     * A utf-8 safe wordwrap function, avoiding CRLF issues with Chinese and other multi-byte characters. 
     72     * @param string $string 
     73     * @return string 
     74     */ 
     75    function em_mb_ical_wordwrap($string){ 
     76        if( !defined('EM_MB_ICAL_WORDWRAP') || !EM_MB_ICAL_WORDWRAP ){ 
     77            /* 
     78            // Match anything 1 to $width chars long followed by whitespace or EOS, otherwise match anything $width chars long 
     79            $search = '/(.{1,74})(?:\s|$)|(.{74})/uS'; 
     80            $replace = '$1$2'."\r\n "; 
     81            $return = preg_replace($search, $replace, $string); 
     82            return $return; 
     83            return preg_replace('/\r\n $/', '', $return); 
     84            */ 
     85            /* 
     86            $str_len = mb_strlen($string,'UTF-8'); 
     87            $while = ceil($str_len / 74); 
     88            $return = ''; 
     89            for($i = 1; $i < $while; $i++){ 
     90                preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){74}#', $string, $matches); 
     91                $return .= $matches[0]."\r\n "; 
     92                $string = substr($string, strlen($matches[0])); 
     93            } 
     94            return $return.$string; 
     95            */ 
     96            /*$strlen = strlen($string); 
     97            $return = ''; 
     98            for( $i = 0; $i + 74 <= $strlen; $i = $i + 74 ){ 
     99                $return = mb_strcut 
     100            } 
     101            */ 
     102            $return = ''; 
     103            for ( $i = 0; strlen($string) > 0; $i++ ) { 
     104                $linewidth = ($i == 0? 75 : 74); 
     105                $linesize = (strlen($string) > $linewidth? $linewidth: strlen($string)); 
     106                if($i > 0) $return .= "\r\n "; 
     107                $return .= mb_strcut($string,0,$linesize); 
     108                $string = mb_strcut($string,$linewidth); 
     109            } 
     110            return $return; 
     111        } 
     112        return wordwrap($string, 75, "\r\n ", true); 
     113    } 
    68114?> 
  • events-manager/trunk/em-install.php

    r1488912 r1651260  
    4040            //set caps and options 
    4141            em_set_capabilities(); 
    42             em_add_options();            
     42            em_add_options(); 
     43            em_upgrade_current_installation(); 
    4344            //Update Version 
    4445            update_option('dbem_version', EM_VERSION); 
     
    664665        'dbem_bookings_registration_disable' => 0, 
    665666        'dbem_bookings_registration_disable_user_emails' => 0, 
    666         'dbem_bookings_registration_user' => '', 
    667667        'dbem_bookings_approval' => 1, //approval is on by default 
    668668        'dbem_bookings_approval_reserved' => 0, //overbooking before approval? 
     
    823823        add_option($key, $value); 
    824824    } 
    825      
     825         
     826    //set time localization for first time depending on current settings 
     827    if( get_option('dbem_time_24h','not set') == 'not set'){ 
     828        //Localise vars regardless 
     829        $locale_code = substr ( get_locale(), 0, 2 ); 
     830        if (preg_match('/^en_(?:GB|IE|AU|NZ|ZA|TT|JM)$/', get_locale())) { 
     831            $locale_code = 'en-GB'; 
     832        } 
     833        //Set time 
     834        $show24Hours = ( !preg_match("/en|sk|zh|us|uk/", $locale_code ) );  // Setting 12 hours format for those countries using it 
     835        update_option('dbem_time_24h', $show24Hours); 
     836    } 
     837} 
     838 
     839function em_upgrade_current_installation(){ 
     840    global $wpdb, $wp_locale; 
    826841    if( !get_option('dbem_version') ){ add_option('dbem_credits',1); } 
    827842    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5 ){ 
     
    852867    } 
    853868    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.19 ){ 
    854         update_option('dbem_event_reapproved_email_subject',  get_option('dbem_event_approved_email_subject')); 
    855         update_option('dbem_event_reapproved_email_body', get_option('dbem_event_approved_email_body')); 
     869        update_option('dbem_event_reapproved_email_subject',  get_option('dbem_event_approved_email_subject')); 
     870        update_option('dbem_event_reapproved_email_body', get_option('dbem_event_approved_email_body')); 
    856871    } 
    857872    if( get_option('dbem_version') != '' && get_option('dbem_version') <= 5.21 ){ 
    858         //just remove all rsvp cut-off info 
    859         $wpdb->query("UPDATE ".$wpdb->postmeta." SET meta_value = NULL WHERE meta_key IN ('_event_rsvp_date','_event_rsvp_time') AND post_id IN (SELECT post_id FROM ".EM_EVENTS_TABLE." WHERE recurrence_id > 0)"); 
    860         $wpdb->query("UPDATE ".EM_EVENTS_TABLE." SET event_rsvp_time = NULL, event_rsvp_date = NULL WHERE recurrence_id > 0"); 
     873        //just remove all rsvp cut-off info 
     874        $wpdb->query("UPDATE ".$wpdb->postmeta." SET meta_value = NULL WHERE meta_key IN ('_event_rsvp_date','_event_rsvp_time') AND post_id IN (SELECT post_id FROM ".EM_EVENTS_TABLE." WHERE recurrence_id > 0)"); 
     875        $wpdb->query("UPDATE ".EM_EVENTS_TABLE." SET event_rsvp_time = NULL, event_rsvp_date = NULL WHERE recurrence_id > 0"); 
    861876    } 
    862877    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.364 ){ 
    863         if( get_option('dbem_cp_events_template_page') ){ 
    864             update_option('dbem_cp_events_template', 'page'); 
    865             delete_option('dbem_cp_events_template_page'); 
    866         } 
    867         if( get_option('dbem_cp_locations_template_page') ){ 
    868             update_option('dbem_cp_locations_template', 'page'); 
    869             delete_option('dbem_cp_locations_template_page'); 
    870         } 
    871         update_option('dbem_events_archive_scope', get_option('dbem_events_page_scope')); 
    872         update_option('em_last_modified', current_time('timestamp', true)); 
    873         update_option('dbem_category_event_single_format',get_option('dbem_category_event_list_item_header_format').get_option('dbem_category_event_list_item_format').get_option('dbem_category_event_list_item_footer_format')); 
    874         update_option('dbem_category_no_event_message',get_option('dbem_category_event_list_item_header_format').get_option('dbem_category_no_events_message').get_option('dbem_category_event_list_item_footer_format')); 
    875         update_option('dbem_location_event_single_format',get_option('dbem_location_event_list_item_header_format').get_option('dbem_location_event_list_item_format').get_option('dbem_location_event_list_item_footer_format')); 
    876         update_option('dbem_location_no_event_message',get_option('dbem_location_event_list_item_header_format').get_option('dbem_location_no_events_message').get_option('dbem_location_event_list_item_footer_format')); 
    877         update_option('dbem_tag_event_single_format',get_option('dbem_tag_event_list_item_header_format').get_option('dbem_tag_event_list_item_format').get_option('dbem_tag_event_list_item_footer_format')); 
    878         update_option('dbem_tag_no_event_message',get_option('dbem_tag_event_list_item_header_format').get_option('dbem_tag_no_events_message').get_option('dbem_tag_event_list_item_footer_format')); 
     878        if( get_option('dbem_cp_events_template_page') ){ 
     879            update_option('dbem_cp_events_template', 'page'); 
     880            delete_option('dbem_cp_events_template_page'); 
     881        } 
     882        if( get_option('dbem_cp_locations_template_page') ){ 
     883            update_option('dbem_cp_locations_template', 'page'); 
     884            delete_option('dbem_cp_locations_template_page'); 
     885        } 
     886        update_option('dbem_events_archive_scope', get_option('dbem_events_page_scope')); 
     887        update_option('em_last_modified', current_time('timestamp', true)); 
     888        update_option('dbem_category_event_single_format',get_option('dbem_category_event_list_item_header_format').get_option('dbem_category_event_list_item_format').get_option('dbem_category_event_list_item_footer_format')); 
     889        update_option('dbem_category_no_event_message',get_option('dbem_category_event_list_item_header_format').get_option('dbem_category_no_events_message').get_option('dbem_category_event_list_item_footer_format')); 
     890        update_option('dbem_location_event_single_format',get_option('dbem_location_event_list_item_header_format').get_option('dbem_location_event_list_item_format').get_option('dbem_location_event_list_item_footer_format')); 
     891        update_option('dbem_location_no_event_message',get_option('dbem_location_event_list_item_header_format').get_option('dbem_location_no_events_message').get_option('dbem_location_event_list_item_footer_format')); 
     892        update_option('dbem_tag_event_single_format',get_option('dbem_tag_event_list_item_header_format').get_option('dbem_tag_event_list_item_format').get_option('dbem_tag_event_list_item_footer_format')); 
     893        update_option('dbem_tag_no_event_message',get_option('dbem_tag_event_list_item_header_format').get_option('dbem_tag_no_events_message').get_option('dbem_tag_event_list_item_footer_format')); 
    879894    } 
    880895    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.38 ){ 
    881         update_option('dbem_dates_separator', get_option('dbem_dates_Seperator', get_option('dbem_dates_seperator',' - '))); 
    882         update_option('dbem_times_separator', get_option('dbem_times_Seperator', get_option('dbem_times_seperator',' - '))); 
    883         delete_option('dbem_dates_Seperator'); 
    884         delete_option('dbem_times_Seperator'); 
    885         delete_option('dbem_dates_seperator'); 
    886         delete_option('dbem_times_seperator'); 
     896        update_option('dbem_dates_separator', get_option('dbem_dates_Seperator', get_option('dbem_dates_seperator',' - '))); 
     897        update_option('dbem_times_separator', get_option('dbem_times_Seperator', get_option('dbem_times_seperator',' - '))); 
     898        delete_option('dbem_dates_Seperator'); 
     899        delete_option('dbem_times_Seperator'); 
     900        delete_option('dbem_dates_seperator'); 
     901        delete_option('dbem_times_seperator'); 
    887902    } 
    888903    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.4 ){ 
    889         //tax rates now saved at booking level, so that alterations to tax rates don't change previous booking prices 
    890         //any past bookings that don't get updated will adhere to these two values when calculating prices 
    891         update_option('dbem_legacy_bookings_tax_auto_add', get_option('dbem_bookings_tax_auto_add')); 
    892         update_option('dbem_legacy_bookings_tax', get_option('dbem_bookings_tax')); 
     904        //tax rates now saved at booking level, so that alterations to tax rates don't change previous booking prices 
     905        //any past bookings that don't get updated will adhere to these two values when calculating prices 
     906        update_option('dbem_legacy_bookings_tax_auto_add', get_option('dbem_bookings_tax_auto_add')); 
     907        update_option('dbem_legacy_bookings_tax', get_option('dbem_bookings_tax')); 
    893908    } 
    894909    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.422 ){ 
    895         //copy registration email content into new setting 
    896         update_option('dbem_rss_limit',0); 
     910        //copy registration email content into new setting 
     911        update_option('dbem_rss_limit',0); 
    897912    } 
    898913    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.4425 ){ 
    899         //copy registration email content into new setting 
    900         update_option('dbem_css_editors',0); 
    901         update_option('dbem_css_rsvp',0); 
    902         update_option('dbem_css_evlist',0); 
    903         update_option('dbem_css_loclist',0); 
    904         update_option('dbem_css_rsvpadmin',0); 
    905         update_option('dbem_css_catlist',0); 
    906         update_option('dbem_css_taglist',0); 
    907         if( locate_template('plugins/events-manager/templates/events-search.php') ){ 
    908             update_option('dbem_css_search', 0); 
    909             update_option('dbem_search_form_hide_advanced',0); 
    910         } 
    911         update_option('dbem_events_page_search_form',get_option('dbem_events_page_search')); 
    912         update_option('dbem_search_form_dates_separator',get_option('dbem_dates_separator')); 
    913         delete_option('dbem_events_page_search'); //avoids the double search form on overridden templates 
    914         update_option('dbem_locations_page_search_form',0); //upgrades shouldn't get extra surprises   
     914        //copy registration email content into new setting 
     915        update_option('dbem_css_editors',0); 
     916        update_option('dbem_css_rsvp',0); 
     917        update_option('dbem_css_evlist',0); 
     918        update_option('dbem_css_loclist',0); 
     919        update_option('dbem_css_rsvpadmin',0); 
     920        update_option('dbem_css_catlist',0); 
     921        update_option('dbem_css_taglist',0); 
     922        if( locate_template('plugins/events-manager/templates/events-search.php') ){ 
     923            update_option('dbem_css_search', 0); 
     924            update_option('dbem_search_form_hide_advanced',0); 
     925        } 
     926        update_option('dbem_events_page_search_form',get_option('dbem_events_page_search')); 
     927        update_option('dbem_search_form_dates_separator',get_option('dbem_dates_separator')); 
     928        delete_option('dbem_events_page_search'); //avoids the double search form on overridden templates 
     929        update_option('dbem_locations_page_search_form',0); //upgrades shouldn't get extra surprises 
    915930    } 
    916931    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.512 ){ 
     
    919934        update_option('dbem_search_form_submit', get_option('dbem_serach_form_submit')); 
    920935        //if template isn't overridden, assume it is still being used 
    921         if( !locate_template('plugins/events-manager/templates/events-search.php') ){ 
    922             delete_option('dbem_serach_form_submit', 0); 
    923         } 
    924         //ML translation 
     936        if( !locate_template('plugins/events-manager/templates/events-search.php') ){ 
     937            delete_option('dbem_serach_form_submit', 0); 
     938        } 
     939        //ML translation 
    925940        if( get_option('dbem_serach_form_submit_ml') ){ 
    926941            update_option('dbem_search_form_submit_ml', get_option('dbem_serach_form_submit_ml')); 
     
    933948    } 
    934949    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.55 ){ 
    935         //rename email templates sent to admins on new bookings 
    936         update_option('dbem_bookings_contact_email_cancelled_subject',get_option('dbem_contactperson_email_cancelled_subject')); 
    937         update_option('dbem_bookings_contact_email_cancelled_body',get_option('dbem_contactperson_email_cancelled_body')); 
    938         if( get_option('dbem_bookings_approval') ){ 
    939             //if approvals ENABLED, we should make the old 'New Booking' email the one for a pending booking 
    940             update_option('dbem_bookings_contact_email_pending_subject',get_option('dbem_bookings_contact_email_subject')); 
    941             update_option('dbem_bookings_contact_email_pending_body',get_option('dbem_bookings_contact_email_body')); 
    942         }else{ 
    943             //if approvals DISABLED, we should make the old 'New Booking' email the one for a confirmed booking 
    944             update_option('dbem_bookings_contact_email_confirmed_subject',get_option('dbem_bookings_contact_email_subject')); 
    945             update_option('dbem_bookings_contact_email_confirmed_body',get_option('dbem_bookings_contact_email_body'));          
    946         } 
    947         delete_option('dbem_contactperson_email_cancelled_subject'); 
    948         delete_option('dbem_contactperson_email_cancelled_body'); 
    949         delete_option('dbem_bookings_contact_email_subject'); 
    950         delete_option('dbem_bookings_contact_email_body'); 
     950        //rename email templates sent to admins on new bookings 
     951        update_option('dbem_bookings_contact_email_cancelled_subject',get_option('dbem_contactperson_email_cancelled_subject')); 
     952        update_option('dbem_bookings_contact_email_cancelled_body',get_option('dbem_contactperson_email_cancelled_body')); 
     953        if( get_option('dbem_bookings_approval') ){ 
     954            //if approvals ENABLED, we should make the old 'New Booking' email the one for a pending booking 
     955            update_option('dbem_bookings_contact_email_pending_subject',get_option('dbem_bookings_contact_email_subject')); 
     956            update_option('dbem_bookings_contact_email_pending_body',get_option('dbem_bookings_contact_email_body')); 
     957        }else{ 
     958            //if approvals DISABLED, we should make the old 'New Booking' email the one for a confirmed booking 
     959            update_option('dbem_bookings_contact_email_confirmed_subject',get_option('dbem_bookings_contact_email_subject')); 
     960            update_option('dbem_bookings_contact_email_confirmed_body',get_option('dbem_bookings_contact_email_body')); 
     961        } 
     962        delete_option('dbem_contactperson_email_cancelled_subject'); 
     963        delete_option('dbem_contactperson_email_cancelled_body'); 
     964        delete_option('dbem_bookings_contact_email_subject'); 
     965        delete_option('dbem_bookings_contact_email_body'); 
    951966    } 
    952967    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.62 ){ 
    953         //delete all _event_created_date and _event_date_modified records in post_meta, we don't need them anymore, they were never accurate to begin with, refer to the records in em_events table if still needed  
    954         $wpdb->query('DELETE FROM '.$wpdb->postmeta." WHERE (meta_key='_event_date_created' OR meta_key='_event_date_modified') AND post_id IN (SELECT ID FROM ".$wpdb->posts." WHERE post_type='".EM_POST_TYPE_EVENT."' OR post_type='event-recurring')"); 
    955         $wpdb->query('ALTER TABLE '. $wpdb->prefix.'em_bookings CHANGE event_id event_id BIGINT(20) UNSIGNED NULL'); 
     968        //delete all _event_created_date and _event_date_modified records in post_meta, we don't need them anymore, they were never accurate to begin with, refer to the records in em_events table if still needed 
     969        $wpdb->query('DELETE FROM '.$wpdb->postmeta." WHERE (meta_key='_event_date_created' OR meta_key='_event_date_modified') AND post_id IN (SELECT ID FROM ".$wpdb->posts." WHERE post_type='".EM_POST_TYPE_EVENT."' OR post_type='event-recurring')"); 
     970        $wpdb->query('ALTER TABLE '. $wpdb->prefix.'em_bookings CHANGE event_id event_id BIGINT(20) UNSIGNED NULL'); 
    956971    } 
    957972    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.66 ){ 
     
    959974        if( get_option('dbem_ical_location_format') == "#_LOCATION" ) update_option('dbem_ical_location_format', "#_LOCATIONNAME, #_LOCATIONFULLLINE, #_LOCATIONCOUNTRY"); 
    960975        $old_values = array( 
    961             'dbem_ical_description_format' => "#_EVENTNAME - #_LOCATIONNAME - #_EVENTDATES - #_EVENTTIMES", 
    962             'dbem_ical_location_format' => "#_LOCATION",             
     976                'dbem_ical_description_format' => "#_EVENTNAME - #_LOCATIONNAME - #_EVENTDATES - #_EVENTTIMES", 
     977                'dbem_ical_location_format' => "#_LOCATION", 
    963978        ); 
    964979    } 
    965          
    966     //set time localization for first time depending on current settings 
    967     if( get_option('dbem_time_24h','not set') == 'not set'){ 
    968         //Localise vars regardless 
    969         $locale_code = substr ( get_locale(), 0, 2 ); 
    970         if (preg_match('/^en_(?:GB|IE|AU|NZ|ZA|TT|JM)$/', get_locale())) { 
    971             $locale_code = 'en-GB'; 
    972         } 
    973         //Set time 
    974         $show24Hours = ( !preg_match("/en|sk|zh|us|uk/", $locale_code ) );  // Setting 12 hours format for those countries using it 
    975         update_option('dbem_time_24h', $show24Hours); 
     980    if( get_option('dbem_version') != '' && get_option('dbem_version') < 5.6636 ){ 
     981        $sql = $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE meta_key='_post_id' AND post_id IN (SELECT ID FROM {$wpdb->posts} WHERE post_type=%s OR post_type=%s)", array(EM_POST_TYPE_EVENT, 'event-recurring')); 
     982        $wpdb->query($sql); 
     983        remove_filter('pre_option_dbem_bookings_registration_user', 'EM_People::dbem_bookings_registration_user'); 
     984        $no_user = get_option('dbem_bookings_registration_user'); 
     985        if( get_option('dbem_bookings_registration_disable') && is_numeric($no_user) ){ 
     986            if( $wpdb->update(EM_BOOKINGS_TABLE, array('person_id'=>0), array('person_id'=>$no_user), '%d', '%d') ){ 
     987                delete_option('dbem_bookings_registration_user'); 
     988            } 
     989        }else{ 
     990            delete_option('dbem_bookings_registration_user'); 
     991        } 
    976992    } 
    977993} 
  • events-manager/trunk/em-shortcode.php

    r1311743 r1651260  
    4747add_shortcode('locations-map', 'em_get_locations_map_shortcode'); //deprecate this... confusing for WordPress  
    4848 
     49 
     50/** 
     51 * Generates a map of locations that match given query attributes. Accepts any location query attributes. 
     52 * @param array $args 
     53 * @return string 
     54 */ 
     55function em_get_events_map_shortcode($args){ 
     56    $args['em_ajax'] = true; 
     57    $args['query'] = 'GlobalEventsMapData'; 
     58    //get dimensions with px or % added in 
     59    $width = (!empty($args['width'])) ? $args['width']:get_option('dbem_map_default_width','400px'); 
     60    $width = preg_match('/(px)|%/', $width) ? $width:$width.'px'; 
     61    $height = (!empty($args['height'])) ? $args['height']:get_option('dbem_map_default_height','300px'); 
     62    $height = preg_match('/(px)|%/', $height) ? $height:$height.'px'; 
     63    $args['width'] = $width; 
     64    $args['height'] = $height; 
     65    //assign random number for element id reference 
     66    $args['random_id'] = substr(md5(rand().rand()),0,5); 
     67    ob_start(); 
     68    em_locate_template('templates/map-global.php',true, array('args'=>$args)); 
     69    return ob_get_clean(); 
     70} 
     71add_shortcode('events_map', 'em_get_events_map_shortcode'); 
     72 
    4973/** 
    5074 * Shows a list of events according to given specifications. Accepts any event query attribute. 
     
    109133 */ 
    110134function em_get_event_shortcode($atts, $format='') { 
    111     global $EM_Event, $post; 
     135    global $post; 
    112136    $return = ''; 
    113     $the_event = is_object($EM_Event) ? clone($EM_Event):null; //save global temporarily 
    114137    $atts = (array) $atts; 
    115138    $atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];  
     
    129152        $return = ( !empty($atts['format']) ) ? $EM_Event->output($atts['format']) : $EM_Event->output_single(); 
    130153    } 
    131     $EM_Event = is_object($the_event) ? $the_event:$EM_Event; //reset global 
    132154    return $return; 
    133155} 
  • events-manager/trunk/em-template-tags.php

    r1395984 r1651260  
    220220 */ 
    221221function em_events_admin($args = array()){ 
    222     global $EM_Event, $bp; 
     222    global $EM_Event, $EM_Notices, $bp; 
    223223    if( is_user_logged_in() && current_user_can('edit_events') ){ 
    224224        if( !empty($_GET['action']) && $_GET['action']=='edit' ){ 
     
    229229        }else{ 
    230230            if( get_option('dbem_css_editors') ) echo '<div class="css-events-admin">'; 
    231             //template $args for different views 
    232             $args_views['pending'] = array('status'=>0, 'owner' =>get_current_user_id(), 'scope' => 'all', 'recurring'=>'include'); 
    233             $args_views['draft'] = array('status'=>null, 'owner' =>get_current_user_id(), 'scope' => 'all', 'recurring'=>'include'); 
    234             $args_views['past'] = array('status'=>'all', 'owner' =>get_current_user_id(), 'scope' => 'past'); 
    235             $args_views['future'] = array('status'=>'1', 'owner' =>get_current_user_id(), 'scope' => 'future'); 
    236231            //get listing options for $args 
    237232            $limit = ( !empty($_REQUEST['limit']) ) ? $_REQUEST['limit'] : 20;//Default limit 
     
    243238            $show_add_new = isset($args['show_add_new']) ? $args['show_add_new']:true; 
    244239            $args = array('order' => $order, 'search' => $search, 'owner' => get_current_user_id()); 
     240            if( !empty($_REQUEST['recurrence_id']) ){ 
     241                $Event = em_get_event($_REQUEST['recurrence_id']); 
     242                $EM_Notices->add_alert(sprintf(esc_html__('You are viewing individual recurrences of recurring event %s.', 'events-manager'), '<a href="'.$Event->get_edit_url().'">'.$Event->event_name.'</a>')); 
     243                $EM_Notices->add_alert(esc_html__('You can edit individual recurrences and disassociate them with this recurring event.', 'events-manager')); 
     244                $args['recurrence_id'] = $_REQUEST['recurrence_id']; 
     245            } 
     246            $args = apply_filters('em_events_admin_args', $args); 
     247            //template $args for different views 
     248            $args_views = array(); 
     249            $args_views['pending'] = array_merge($args, array('status'=>0, 'scope' => 'all', 'recurring'=>'include')); 
     250            $args_views['draft'] = array_merge($args, array('status'=>null, 'scope' => 'all', 'recurring'=>'include')); 
     251            $args_views['past'] = array_merge($args, array('status'=>'all', 'scope' => 'past')); 
     252            $args_views['future'] = array_merge($args, array('status'=>'1', 'scope' => 'future')); 
     253            //modify $args for current view 
    245254            if( !empty($_REQUEST['view']) && in_array($_REQUEST['view'], array('future','draft','past','pending')) ){ 
    246255                $args = array_merge($args, $args_views[$_REQUEST['view']]); 
     
    257266                $args['status'] = $status; 
    258267            } 
     268            //reset the limit and offset to allow for filter 
     269            unset($args['limit']); unset($args['offset']); 
    259270            $events_count = EM_Events::count( $args ); //count events without limits for pagination 
     271            //add limit and offset again to args 
    260272            $args['limit'] = $limit; 
    261273            $args['offset'] = $offset; 
     
    297309    return ob_get_clean(); 
    298310} 
    299  
    300311/** 
    301312 * Outputs the event search form. 
  • events-manager/trunk/events-manager.php

    r1489758 r1651260  
    22/* 
    33Plugin Name: Events Manager 
    4 Version: 5.6.6.1 
     4Version: 5.6.7 
    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.6624); //self expanatory 
     31define('EM_VERSION', 5.67); //self expanatory 
    3232define('EM_PRO_MIN_VERSION', 2.392); //self expanatory 
    3333define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory 
     
    186186        if( is_admin() ){ 
    187187            //Scripts and Styles 
    188             if( (!empty($_GET['page']) && substr($_GET['page'],0,14) == 'events-manager') || (!empty($_GET['post_type']) && in_array($_GET['post_type'], array(EM_POST_TYPE_EVENT,EM_POST_TYPE_LOCATION,'event-recurring'))) ){ 
    189                 add_action('admin_print_scripts', array('EM_Scripts_and_Styles','admin_enqueue')); 
    190             }else{ 
    191                 add_action('admin_print_styles-post.php', array('EM_Scripts_and_Styles','admin_enqueue')); 
    192             } 
     188            add_action('admin_enqueue_scripts', array('EM_Scripts_and_Styles','admin_enqueue')); 
    193189        }else{ 
    194190            add_action('wp_enqueue_scripts', array('EM_Scripts_and_Styles','public_enqueue')); 
     
    208204            'my-bookings' => get_option('dbem_my_bookings_page') 
    209205        ); 
     206        $pages = apply_filters('em_scripts_and_styles_public_enqueue_pages', $pages); 
    210207        $obj = $wp_query->get_queried_object(); 
    211208        $obj_id = 0; 
     
    223220                $script_deps['jquery'] = 'jquery'; 
    224221            } 
    225             if( (!empty($pages['events']) && is_page($pages['events']) &&  get_option('dbem_events_page_search')) || get_option('dbem_js_limit_search') === '0' || in_array($obj_id, explode(',', get_option('dbem_js_limit_search'))) ){  
     222            if( (!empty($pages['events']) && is_page($pages['events']) &&  get_option('dbem_events_page_search_form')) || get_option('dbem_js_limit_search') === '0' || in_array($obj_id, explode(',', get_option('dbem_js_limit_search'))) ){  
    226223                //events page only needs datepickers 
    227224                $script_deps['jquery-ui-core'] = 'jquery-ui-core'; 
     
    295292    } 
    296293     
    297     public static function admin_enqueue(){ 
    298         wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js',__FILE__), array('jquery', 'jquery-ui-core','jquery-ui-widget','jquery-ui-position','jquery-ui-sortable','jquery-ui-datepicker','jquery-ui-autocomplete','jquery-ui-dialog'), EM_VERSION); 
    299         do_action('em_enqueue_admin_scripts'); 
    300         wp_enqueue_style('events-manager-admin', plugins_url('includes/css/events_manager_admin.css',__FILE__), array(), EM_VERSION); 
    301         do_action('em_enqueue_admin_styles'); 
    302         self::localize_script(); 
     294    public static function admin_enqueue( $hook_suffix = false ){ 
     295        if( $hook_suffix == 'post.php' || (!empty($_GET['page']) && substr($_GET['page'],0,14) == 'events-manager') || (!empty($_GET['post_type']) && in_array($_GET['post_type'], array(EM_POST_TYPE_EVENT,EM_POST_TYPE_LOCATION,'event-recurring'))) ){ 
     296            wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js',__FILE__), array('jquery', 'jquery-ui-core','jquery-ui-widget','jquery-ui-position','jquery-ui-sortable','jquery-ui-datepicker','jquery-ui-autocomplete','jquery-ui-dialog'), EM_VERSION); 
     297            do_action('em_enqueue_admin_scripts'); 
     298            wp_enqueue_style('events-manager-admin', plugins_url('includes/css/events_manager_admin.css',__FILE__), array(), EM_VERSION); 
     299            do_action('em_enqueue_admin_styles'); 
     300            self::localize_script(); 
     301        } 
    303302    } 
    304303 
     
    329328        //booking-specific stuff 
    330329        if( get_option('dbem_rsvp_enabled') ){ 
     330            $offset = defined('EM_BOOKING_MSG_JS_OFFSET') ? EM_BOOKING_MSG_JS_OFFSET : 30; 
    331331            $em_localized_js = array_merge($em_localized_js, array( 
    332332                'bookingInProgress' => __('Please wait while the booking is being submitted.','events-manager'), 
     
    336336                'bookings_settings_save' => __('Save Settings','events-manager'), 
    337337                'booking_delete' => __("Are you sure you want to delete?",'events-manager'), 
     338                'booking_offset' => $offset, 
    338339                //booking button 
    339340                'bb_full' =>  get_option('dbem_booking_button_msg_full'), 
     
    355356        if( is_user_logged_in() || is_page(get_option('dbem_edit_events_page')) ){ 
    356357            if( get_option('dbem_recurrence_enabled') ){ 
    357                 $em_localized_js['event_reschedule_warning'] = __('Are you sure you want to reschedule this recurring event? If you do this, you will lose all booking information and the old recurring events will be deleted.', 'events-manager'); 
     358                if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && !empty($_REQUEST['event_id'])){ 
     359                    $em_localized_js['event_reschedule_warning'] = __('Are you sure you want to continue?', 'events-manager') .PHP_EOL.PHP_EOL; 
     360                    $em_localized_js['event_reschedule_warning'] .= __('Modifications to event times will cause all recurrences of this event to be deleted and recreated, previous bookings will be deleted.', 'events-manager'); 
     361                    $em_localized_js['event_recurrence_overwrite'] = __('Are you sure you want to continue?', 'events-manager') .PHP_EOL.PHP_EOL; 
     362                    $em_localized_js['event_recurrence_overwrite'] .= __( 'Modifications to recurring events will be applied to all recurrences and will overwrite any changes made to those individual event recurrences.', 'events-manager') .PHP_EOL.PHP_EOL; 
     363                    $em_localized_js['event_recurrence_overwrite'] .= __( 'Bookings to individual event recurrences will be preserved if event times and ticket settings are not modified.', 'events-manager'); 
     364                    $em_localized_js['event_recurrence_bookings'] = __('Are you sure you want to continue?', 'events-manager') .PHP_EOL.PHP_EOL; 
     365                    $em_localized_js['event_recurrence_bookings'] .= __('Modifications to event tickets will cause all bookings to individual recurrences of this event to be deleted.', 'events-manager'); 
     366                } 
    358367                $em_localized_js['event_detach_warning'] = __('Are you sure you want to detach this event? By doing so, this event will be independent of the recurring set of events.', 'events-manager'); 
    359368                $delete_text = ( !EMPTY_TRASH_DAYS ) ? __('This cannot be undone.','events-manager'):__('All events will be moved to trash.','events-manager'); 
     
    373382                $em_localized_js['open_text'] = __('Expand All','events-manager'); 
    374383            } 
    375         } 
    376         //calendar translations 
    377         $locale_code = get_locale(); 
    378         $locale_code_short = substr ( $locale_code, 0, 2 ); 
    379         $calendar_languages = array( 
    380             'nl'=>array('closeText'=>'Sluiten','prevText'=>'←','nextText'=>'→','currentText'=>'Vandaag','monthNames'=>array('januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december'),'monthNamesShort'=>array('jan','feb','maa','apr','mei','jun','jul','aug','sep','okt','nov','dec'),'dayNames'=>array('zondag','maandag','dinsdag','woensdag','donderdag','vrijdag','zaterdag'),'dayNamesShort'=>array('zon','maa','din','woe','don','vri','zat'),'dayNamesMin'=>array('zo','ma','di','wo','do','vr','za'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    381             'af'=>array('closeText'=>'Selekteer','prevText'=>'Vorige','nextText'=>'Volgende','currentText'=>'Vandag','monthNames'=>array('Januarie','Februarie','Maart','April','Mei','Junie','Julie','Augustus','September','Oktober','November','Desember'),'monthNamesShort'=>array('Jan','Feb','Mrt','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Des'),'dayNames'=>array('Sondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrydag','Saterdag'),'dayNamesShort'=>array('Son','Maa','Din','Woe','Don','Vry','Sat'),'dayNamesMin'=>array('So','Ma','Di','Wo','Do','Vr','Sa'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    382             'ar'=>array('closeText'=>'إغلاق','prevText'=>'<السابق','nextText'=>'التالي>','currentText'=>'اليوم','monthNames'=>array('كانون الثاني','شباط','آذار','نيسان','آذار','حزيران','تموز','آب','أيلول','تشرين الأول','تشرين الثاني','كانون الأول'),'monthNamesShort'=>array('1','2','3','4','5','6','7','8','9','10','11','12'),'dayNames'=>array('السبت','الأحد','الاثنين','الثلاثاء','الأربعاء','الخميس','الجمعة'),'dayNamesShort'=>array('سبت','أحد','اثنين','ثلاثاء','أربعاء','خميس','جمعة'),'dayNamesMin'=>array('سبت','أحد','اثنين','ثلاثاء','أربعاء','خميس','جمعة'),'weekHeader'=>'أسبوع','dateFormat'=>'dd/mm/yy','firstDay'=>0,'isRTL'=>true,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    383             'az'=>array('closeText'=>'Bağla','prevText'=>'<Geri','nextText'=>'İrəli>','currentText'=>'Bugün','monthNames'=>array('Yanvar','Fevral','Mart','Aprel','May','İyun','İyul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'),'monthNamesShort'=>array('Yan','Fev','Mar','Apr','May','İyun','İyul','Avq','Sen','Okt','Noy','Dek'),'dayNames'=>array('Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'),'dayNamesShort'=>array('B','Be','Ça','Ç','Ca','C','Ş'),'dayNamesMin'=>array('B','B','Ç','С','Ç','C','Ş'),'weekHeader'=>'Hf','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    384             'bg'=>array('closeText'=>'затвори','prevText'=>'<назад','nextText'=>'напред>','nextBigText'=>'>>','currentText'=>'днес','monthNames'=>array('Януари','Февруари','Март','Април','Май','Юни','Юли','Август','Септември','Октомври','Ноември','Декември'),'monthNamesShort'=>array('Яну','Фев','Мар','Апр','Май','Юни','Юли','Авг','Сеп','Окт','Нов','Дек'),'dayNames'=>array('Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'),'dayNamesShort'=>array('Нед','Пон','Вто','Сря','Чет','Пет','Съб'),'dayNamesMin'=>array('Не','По','Вт','Ср','Че','Пе','Съ'),'weekHeader'=>'Wk','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    385             'bs'=>array('closeText'=>'Zatvori','prevText'=>'<','nextText'=>'>','currentText'=>'Danas','monthNames'=>array('Januar','Februar','Mart','April','Maj','Juni','Juli','August','Septembar','Oktobar','Novembar','Decembar'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'),'dayNames'=>array('Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'),'dayNamesShort'=>array('Ned','Pon','Uto','Sri','Čet','Pet','Sub'),'dayNamesMin'=>array('Ne','Po','Ut','Sr','Če','Pe','Su'),'weekHeader'=>'Wk','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    386             'ca' => array('closeText'=> 'Tancar','prevText'=> '&#x3c;Ant','nextText'=> 'Seg&#x3e;','currentText'=> 'Avui','monthNames'=> array('Gener','Febrer','Mar&ccedil;','Abril','Maig','Juny','Juliol','Agost','Setembre','Octubre','Novembre','Desembre'),'monthNamesShort'=> array('Gen','Feb','Mar','Abr','Mai','Jun','Jul','Ago','Set','Oct','Nov','Des'),'dayNames'=> array('Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'),'dayNamesShort'=> array('Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'),'dayNamesMin'=> array('Dg','Dl','Dt','Dc','Dj','Dv','Ds'),'weekHeader'=> 'Sm','dateFormat'=> 'dd/mm/yy','firstDay'=> 1,'isRTL'=> false,'showMonthAfterYear'=> false,'yearSuffix'=> ''), 
    387             'cs'=>array('closeText'=>'Zavřít','prevText'=>'<Dříve','nextText'=>'Později>','currentText'=>'Nyní','monthNames'=>array('leden','únor','březen','duben','květen','červen','červenec','srpen','září','říjen','listopad','prosinec'),'monthNamesShort'=>array('led','úno','bře','dub','kvě','čer','čvc','srp','zář','říj','lis','pro'),'dayNames'=>array('neděle','pondělí','úterý','středa','čtvrtek','pátek','sobota'),'dayNamesShort'=>array('ne','po','út','st','čt','pá','so'),'dayNamesMin'=>array('ne','po','út','st','čt','pá','so'),'weekHeader'=>'Týd','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    388             'da'=>array('closeText'=>'Luk','prevText'=>'<Forrige','nextText'=>'Næste>','currentText'=>'Idag','monthNames'=>array('Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'),'dayNames'=>array('Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'),'dayNamesShort'=>array('Søn','Man','Tir','Ons','Tor','Fre','Lør'),'dayNamesMin'=>array('Sø','Ma','Ti','On','To','Fr','Lø'),'weekHeader'=>'Uge','dateFormat'=>'dd-mm-yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    389             'de'=>array('closeText'=>'schließen','prevText'=>'<zurück','nextText'=>'Vor>','currentText'=>'heute','monthNames'=>array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'),'monthNamesShort'=>array('Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'),'dayNames'=>array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'),'dayNamesShort'=>array('So','Mo','Di','Mi','Do','Fr','Sa'),'dayNamesMin'=>array('So','Mo','Di','Mi','Do','Fr','Sa'),'weekHeader'=>'Wo','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    390             'el'=>array('closeText'=>'Κλείσιμο','prevText'=>'Προηγούμενος','nextText'=>'Επόμενος','currentText'=>'Τρέχων Μήνας','monthNames'=>array('Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος','Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'),'monthNamesShort'=>array('Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν','Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'),'dayNames'=>array('Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'),'dayNamesShort'=>array('Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'),'dayNamesMin'=>array('Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'),'weekHeader'=>'Εβδ','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    391             'en_GB'=>array('closeText'=>'Done','prevText'=>'Prev','nextText'=>'Next','currentText'=>'Today','monthNames'=>array('January','February','March','April','May','June','July','August','September','October','November','December'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),'dayNames'=>array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'),'dayNamesShort'=>array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'),'dayNamesMin'=>array('Su','Mo','Tu','We','Th','Fr','Sa'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    392             'eo'=>array('closeText'=>'Fermi','prevText'=>'<Anta','nextText'=>'Sekv>','currentText'=>'Nuna','monthNames'=>array('Januaro','Februaro','Marto','Aprilo','Majo','Junio','Julio','Aŭgusto','Septembro','Oktobro','Novembro','Decembro'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aŭg','Sep','Okt','Nov','Dec'),'dayNames'=>array('Dimanĉo','Lundo','Mardo','Merkredo','Ĵaŭdo','Vendredo','Sabato'),'dayNamesShort'=>array('Dim','Lun','Mar','Mer','Ĵaŭ','Ven','Sab'),'dayNamesMin'=>array('Di','Lu','Ma','Me','Ĵa','Ve','Sa'),'weekHeader'=>'Sb','dateFormat'=>'dd/mm/yy','firstDay'=>0,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    393             'et'=>array('closeText'=>'Sulge','prevText'=>'Eelnev','nextText'=>'Järgnev','currentText'=>'Täna','monthNames'=>array('Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni','Juuli','August','September','Oktoober','November','Detsember'),'monthNamesShort'=>array('Jaan','Veebr','Märts','Apr','Mai','Juuni','Juuli','Aug','Sept','Okt','Nov','Dets'),'dayNames'=>array('Pühapäev','Esmaspäev','Teisipäev','Kolmapäev','Neljapäev','Reede','Laupäev'),'dayNamesShort'=>array('Pühap','Esmasp','Teisip','Kolmap','Neljap','Reede','Laup'),'dayNamesMin'=>array('P','E','T','K','N','R','L'),'weekHeader'=>'Sm','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    394             'eu'=>array('closeText'=>'Egina','prevText'=>'<Aur','nextText'=>'Hur>','currentText'=>'Gaur','monthNames'=>array('Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina','Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'),'monthNamesShort'=>array('Urt','Ots','Mar','Api','Mai','Eka','Uzt','Abu','Ira','Urr','Aza','Abe'),'dayNames'=>array('Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'),'dayNamesShort'=>array('Iga','Ast','Ast','Ast','Ost','Ost','Lar'),'dayNamesMin'=>array('Ig','As','As','As','Os','Os','La'),'weekHeader'=>'Wk','dateFormat'=>'yy/mm/dd','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    395             'fa'=>array('closeText'=>'بستن','prevText'=>'<قبلي','nextText'=>'بعدي>','currentText'=>'امروز','monthNames'=>array('فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور','مهر','آبان','آذر','دي','بهمن','اسفند'),'monthNamesShort'=>array('1','2','3','4','5','6','7','8','9','10','11','12'),'dayNames'=>array('يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'),'dayNamesShort'=>array('ي','د','س','چ','پ','ج','ش'),'dayNamesMin'=>array('ي','د','س','چ','پ','ج','ش'),'weekHeader'=>'هف','dateFormat'=>'yy/mm/dd','firstDay'=>6,'isRTL'=>true,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    396             'fi'=>array('closeText'=>'Sulje','prevText'=>'<Edel','nextText'=>'Seur>','currentText'=>'Tänään','monthNames'=>array('Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu','Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'),'monthNamesShort'=>array('Tammi','Helmi','Maalis','Huhti','Touko','Kesä','Heinä','Elo','Syys','Loka','Marras','Joulu'),'dayNames'=>array('Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'),'dayNamesShort'=>array('Su','Ma','Ti','Ke','To','Pe','La'),'dayNamesMin'=>array('Su','Ma','Ti','Ke','To','Pe','La'),'weekHeader'=>'Sm','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    397             'fo'=>array('closeText'=>'Lat aftur','prevText'=>'<Fyrra','nextText'=>'Næsta>','currentText'=>'Í dag','monthNames'=>array('Januar','Februar','Mars','Apríl','Mei','Juni','Juli','August','September','Oktober','November','Desember'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Des'),'dayNames'=>array('Sunnudagur','Mánadagur','Týsdagur','Mikudagur','Hósdagur','Fríggjadagur','Leyardagur'),'dayNamesShort'=>array('Sun','Mán','Týs','Mik','Hós','Frí','Ley'),'dayNamesMin'=>array('Su','Má','Tý','Mi','Hó','Fr','Le'),'weekHeader'=>'Vk','dateFormat'=>'dd-mm-yy','firstDay'=>0,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    398             'fr_CH'=>array('closeText'=>'Fermer','prevText'=>'<Préc','nextText'=>'Suiv>','currentText'=>'Courant','monthNames'=>array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'),'monthNamesShort'=>array('Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'),'dayNames'=>array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'),'dayNamesShort'=>array('Dim','Lun','Mar','Mer','Jeu','Ven','Sam'),'dayNamesMin'=>array('Di','Lu','Ma','Me','Je','Ve','Sa'),'weekHeader'=>'Sm','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    399             'fr'=>array('closeText'=>'Fermer','prevText'=>'<Préc','nextText'=>'Suiv>','currentText'=>'Courant','monthNames'=>array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'),'monthNamesShort'=>array('Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'),'dayNames'=>array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'),'dayNamesShort'=>array('Dim','Lun','Mar','Mer','Jeu','Ven','Sam'),'dayNamesMin'=>array('Di','Lu','Ma','Me','Je','Ve','Sa'),'weekHeader'=>'Sm','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    400             'he'=>array('closeText'=>'סגור','prevText'=>'<הקודם','nextText'=>'הבא>','currentText'=>'היום','monthNames'=>array('ינואר','פברואר','מרץ','אפריל','מאי','יוני','יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'),'monthNamesShort'=>array('1','2','3','4','5','6','7','8','9','10','11','12'),'dayNames'=>array('ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'),'dayNamesShort'=>array('א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'),'dayNamesMin'=>array('א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>0,'isRTL'=>true,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    401             'hu'=>array('closeText'=>'Kész','prevText'=>'Előző','nextText'=>'Következő','currentText'=>'Ma','monthNames'=>array('január','február','március','április','május','június','július','augusztus','szeptember','október','november','cecember'),'monthNamesShort'=>array('jan','febr','márc','ápr','máj','jún','júl','aug','szept','okt','nov','dec'),'dayNames'=>array('vasárnap','hétfő','kedd','szerda','csütörtök','péntek','szombat'),'dayNamesShort'=>array('va','hé','k','sze','csü','pé','szo'),'dayNamesMin'=>array('v','h','k','sze','cs','p','szo'),'weekHeader'=>'Wk','dateFormat'=>'yy.mm.dd.','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>true,'yearSuffix'=>''), 
    402             'hr'=>array('closeText'=>'Zatvori','prevText'=>'<','nextText'=>'>','currentText'=>'Danas','monthNames'=>array('Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj','Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'),'monthNamesShort'=>array('Sij','Velj','Ožu','Tra','Svi','Lip','Srp','Kol','Ruj','Lis','Stu','Pro'),'dayNames'=>array('Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'),'dayNamesShort'=>array('Ned','Pon','Uto','Sri','Čet','Pet','Sub'),'dayNamesMin'=>array('Ne','Po','Ut','Sr','Če','Pe','Su'),'weekHeader'=>'Tje','dateFormat'=>'dd.mm.yy.','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    403             'ja'=>array('closeText'=>'閉じる','prevText'=>'<前','nextText'=>'次>','currentText'=>'今日','monthNames'=>array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'),'monthNamesShort'=>array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'),'dayNames'=>array('日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'),'dayNamesShort'=>array('日','月','火','水','木','金','土'),'dayNamesMin'=>array('日','月','火','水','木','金','土'),'weekHeader'=>'週','dateFormat'=>'yy/mm/dd','firstDay'=>0,'isRTL'=>false,'showMonthAfterYear'=>true,'yearSuffix'=>'年'), 
    404             'ro'=>array('closeText'=>'Închide','prevText'=>'« Luna precedentă','nextText'=>'Luna următoare »','currentText'=>'Azi','monthNames'=>array('Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie','Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'),'monthNamesShort'=>array('Ian','Feb','Mar','Apr','Mai','Iun','Iul','Aug','Sep','Oct','Nov','Dec'),'dayNames'=>array('Duminică','Luni','Marţi','Miercuri','Joi','Vineri','Sâmbătă'),'dayNamesShort'=>array('Dum','Lun','Mar','Mie','Joi','Vin','Sâm'),'dayNamesMin'=>array('Du','Lu','Ma','Mi','Jo','Vi','Sâ'),'weekHeader'=>'Săpt','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    405             'sk'=>array('closeText'=> 'Zavrieť','prevText'=> '&#x3c;Predchádzajúci','nextText'=> 'Nasledujúci&#x3e;','currentText'=> 'Dnes','monthNames'=> array('Január','Február','Marec','Apríl','Máj','Jún','Júl','August','September','Október','November','December'),'monthNamesShort'=> array('Jan','Feb','Mar','Apr','Máj','Jún','Júl','Aug','Sep','Okt','Nov','Dec'),'dayNames'=> array('Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'),'dayNamesShort'=> array('Ned','Pon','Uto','Str','Štv','Pia','Sob'),'dayNamesMin'=> array('Ne','Po','Ut','St','Št','Pia','So'),'weekHeader'=> 'Ty','dateFormat'=> 'dd.mm.yy','firstDay'=> 1,'isRTL'=> false,'showMonthAfterYear'=> false,'yearSuffix'=> ''), 
    406             'sq'=>array('closeText'=>'mbylle','prevText'=>'<mbrapa','nextText'=>'Përpara>','currentText'=>'sot','monthNames'=>array('Janar','Shkurt','Mars','Prill','Maj','Qershor','Korrik','Gusht','Shtator','Tetor','Nëntor','Dhjetor'),'monthNamesShort'=>array('Jan','Shk','Mar','Pri','Maj','Qer','Kor','Gus','Sht','Tet','Nën','Dhj'),'dayNames'=>array('E Diel','E Hënë','E Martë','E Mërkurë','E Enjte','E Premte','E Shtune'),'dayNamesShort'=>array('Di','Hë','Ma','Më','En','Pr','Sh'),'dayNamesMin'=>array('Di','Hë','Ma','Më','En','Pr','Sh'),'weekHeader'=>'Ja','dateFormat'=>'dd.mm.yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    407             'sr_SR'=>array('closeText'=>'Zatvori','prevText'=>'<','nextText'=>'>','currentText'=>'Danas','monthNames'=>array('Januar','Februar','Mart','April','Maj','Jun','Jul','Avgust','Septembar','Oktobar','Novembar','Decembar'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Maj','Jun','Jul','Avg','Sep','Okt','Nov','Dec'),'dayNames'=>array('Nedelja','Ponedeljak','Utorak','Sreda','Četvrtak','Petak','Subota'),'dayNamesShort'=>array('Ned','Pon','Uto','Sre','Čet','Pet','Sub'),'dayNamesMin'=>array('Ne','Po','Ut','Sr','Če','Pe','Su'),'weekHeader'=>'Sed','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    408             'sr'=>array('closeText'=>'Затвори','prevText'=>'<','nextText'=>'>','currentText'=>'Данас','monthNames'=>array('Јануар','Фебруар','Март','Април','Мај','Јун','Јул','Август','Септембар','Октобар','Новембар','Децембар'),'monthNamesShort'=>array('Јан','Феб','Мар','Апр','Мај','Јун','Јул','Авг','Сеп','Окт','Нов','Дец'),'dayNames'=>array('Недеља','Понедељак','Уторак','Среда','Четвртак','Петак','Субота'),'dayNamesShort'=>array('Нед','Пон','Уто','Сре','Чет','Пет','Суб'),'dayNamesMin'=>array('Не','По','Ут','Ср','Че','Пе','Су'),'weekHeader'=>'Сед','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    409             'sv'=>array('closeText'=>'Stäng','prevText'=>'«Förra','nextText'=>'Nästa»','currentText'=>'Idag','monthNames'=>array('Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'),'monthNamesShort'=>array('Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'),'dayNamesShort'=>array('Sön','Mån','Tis','Ons','Tor','Fre','Lör'),'dayNames'=>array('Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'),'dayNamesMin'=>array('Sö','Må','Ti','On','To','Fr','Lö'),'weekHeader'=>'Ve','dateFormat'=>'yy-mm-dd','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    410             'ta'=>array('closeText'=>'மூடு','prevText'=>'முன்னையது','nextText'=>'அடுத்தது','currentText'=>'இன்று','monthNames'=>array('தை','மாசி','பங்குனி','சித்திரை','வைகாசி','ஆனி','ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி'),'monthNamesShort'=>array('தை','மாசி','பங்','சித்','வைகா','ஆனி','ஆடி','ஆவ','புர','ஐப்','கார்','மார்'),'dayNames'=>array('ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்க்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'),'dayNamesShort'=>array('ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'),'dayNamesMin'=>array('ஞா','தி','செ','பு','வி','வெ','ச'),'weekHeader'=>'Не','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    411             'th'=>array('closeText'=>'ปิด','prevText'=>'« ย้อน','nextText'=>'ถัดไป »','currentText'=>'วันนี้','monthNames'=>array('มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'),'monthNamesShort'=>array('ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'),'dayNames'=>array('อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'),'dayNamesShort'=>array('อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'),'dayNamesMin'=>array('อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>0,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    412             'tr'=>array('closeText' => 'kapat', 'prevText' => '&#x3c;geri', 'nextText' => 'ileri&#x3e', 'currentText' => 'bugün', 'monthNames' => array('Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'),'monthNamesShort' => array('Oca','Şub','Mar','Nis','May','Haz','Tem','Ağu','Eyl','Eki','Kas','Ara'),'dayNames' => array('Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'),'dayNamesShort' => array('Pz','Pt','Sa','Ça','Pe','Cu','Ct'),'dayNamesMin' => array('Pz','Pt','Sa','Ça','Pe','Cu','Ct'),'weekHeader' => 'Hf','dateFormat' => 'dd.mm.yy','firstDay' => 1,'isRTL' => false,'showMonthAfterYear' => false,'yearSuffix' => ''), 
    413             'vi'=>array('closeText'=>'Đóng','prevText'=>'<Trước','nextText'=>'Tiếp>','currentText'=>'Hôm nay','monthNames'=>array('Tháng Một','Tháng Hai','Tháng Ba','Tháng Tư','Tháng Năm','Tháng Sáu','Tháng Bảy','Tháng Tám','Tháng Chín','Tháng Mười','Tháng Mười Một','Tháng Mười Hai'),'monthNamesShort'=>array('Tháng 1','Tháng 2','Tháng 3','Tháng 4','Tháng 5','Tháng 6','Tháng 7','Tháng 8','Tháng 9','Tháng 10','Tháng 11','Tháng 12'),'dayNames'=>array('Chủ Nhật','Thứ Hai','Thứ Ba','Thứ Tư','Thứ Năm','Thứ Sáu','Thứ Bảy'),'dayNamesShort'=>array('CN','T2','T3','T4','T5','T6','T7'),'dayNamesMin'=>array('CN','T2','T3','T4','T5','T6','T7'),'weekHeader'=>'Tu','dateFormat'=>'dd/mm/yy','firstDay'=>0,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    414             'zh-TW'=>array('closeText'=>'關閉','prevText'=>'<上月','nextText'=>'下月>','currentText'=>'今天','monthNames'=>array('一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'),'monthNamesShort'=>array('一','二','三','四','五','六','七','八','九','十','十一','十二'),'dayNames'=>array('星期日','星期一','星期二','星期三','星期四','星期五','星期六'),'dayNamesShort'=>array('周日','周一','周二','周三','周四','周五','周六'),'dayNamesMin'=>array('日','一','二','三','四','五','六'),'weekHeader'=>'周','dateFormat'=>'yy/mm/dd','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>true,'yearSuffix'=>'年'), 
    415             'es'=>array('closeText'=>'Cerrar','prevText'=>'<Ant','nextText'=>'Sig>','currentText'=>'Hoy','monthNames'=>array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'),'monthNamesShort'=>array('Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'),'dayNames'=>array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'),'dayNamesShort'=>array('Dom','Lun','Mar','Mié','Juv','Vie','Sáb'),'dayNamesMin'=>array('Do','Lu','Ma','Mi','Ju','Vi','Sá'),'weekHeader'=>'Sm','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''), 
    416             'it'=>array('closeText'=>'Fatto','prevText'=>'Precedente','nextText'=>'Prossimo','currentText'=>'Oggi','monthNames'=>array('Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'),'monthNamesShort'=>array('Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'),'dayNames'=>array('Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'),'dayNamesShort'=>array('Dom','Lun','Mar','Mer','Gio','Ven','Sab'),'dayNamesMin'=>array('Do','Lu','Ma','Me','Gi','Ve','Sa'),'weekHeader'=>'Wk','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>'') 
    417         ); 
    418         if( array_key_exists($locale_code, $calendar_languages) ){ 
    419             $em_localized_js['locale_data'] = $calendar_languages[$locale_code]; 
    420         }elseif( array_key_exists($locale_code_short, $calendar_languages) ){ 
    421             $em_localized_js['locale_data'] = $calendar_languages[$locale_code_short]; 
    422384        }        
    423385        wp_localize_script('events-manager','EM', apply_filters('em_wp_localize_script', $em_localized_js)); 
     
    496458    } 
    497459    if( $wp_rewrite->using_permalinks() ){ 
    498         define('EM_RSS_URI', trailingslashit(home_url()). EM_POST_TYPE_EVENT_SLUG.'/feed/'); //RSS PAGE URI via CPT archives page 
     460        $rss_url = trailingslashit(home_url()). EM_POST_TYPE_EVENT_SLUG.'/feed/'; 
     461        define('EM_RSS_URI', $rss_url); //RSS PAGE URI via CPT archives page 
    499462    }else{ 
    500         define('EM_RSS_URI', em_add_get_params(home_url(), array('post_type'=>EM_POST_TYPE_EVENT, 'feed'=>'rss2'))); //RSS PAGE URI 
     463        $rss_url = em_add_get_params(home_url(), array('post_type'=>EM_POST_TYPE_EVENT, 'feed'=>'rss2')); 
     464        define('EM_RSS_URI', $rss_url); //RSS PAGE URI 
    501465    } 
    502466    $EM_Mailer = new EM_Mailer(); 
     
    578542if(is_admin()){ add_action('init', 'em_load_event', 2); } 
    579543 
    580 /** 
    581  * Catches various option names and returns a network-wide option value instead of the individual blog option. Uses the magc __call function to catch unprecedented names. 
    582  * @author marcus 
    583  * 
    584  */ 
    585 class EM_MS_Globals { 
    586     function __construct(){ add_action( 'init', array(&$this, 'add_filters'), 1); } 
    587     function add_filters(){ 
    588         foreach( $this->get_globals() as $global_option_name ){ 
    589             add_filter('pre_option_'.$global_option_name, array(&$this, 'pre_option_'.$global_option_name), 1,1); 
    590             add_filter('pre_update_option_'.$global_option_name, array(&$this, 'pre_update_option_'.$global_option_name), 1,2); 
    591             add_action('add_option_'.$global_option_name, array(&$this, 'add_option_'.$global_option_name), 1,1); 
    592         } 
    593         //if we're in MS Global mode, the categories option currently resides in the main blog, consider moving this to a network setting in the future 
    594         if( EM_MS_GLOBAL ){ 
    595             add_filter('pre_option_dbem_categories_enabled', array(&$this, 'pre_option_dbem_categories_enabled'), 1,1); 
    596         } 
    597     } 
    598     function get_globals(){ 
    599         $globals = array( 
    600             //multisite settings 
    601             'dbem_ms_global_table', 'dbem_ms_global_caps', 
    602             'dbem_ms_global_events', 'dbem_ms_global_events_links','dbem_ms_events_slug', 
    603             'dbem_ms_global_locations','dbem_ms_global_locations_links','dbem_ms_locations_slug','dbem_ms_mainblog_locations', 
    604             //mail 
    605             'dbem_rsvp_mail_port', 'dbem_mail_sender_address', 'dbem_smtp_password', 'dbem_smtp_username','dbem_smtp_host', 'dbem_mail_sender_name','dbem_smtp_html','dbem_smtp_html_br','dbem_smtp_host','dbem_rsvp_mail_send_method','dbem_rsvp_mail_SMTPAuth', 
    606             //images 
    607             'dbem_image_max_width','dbem_image_max_height','dbem_image_max_size' 
    608         ); 
    609         if( EM_MS_GLOBAL ){ 
    610             $globals[] = 'dbem_taxonomy_category_slug'; 
    611         } 
    612         return apply_filters('em_ms_globals', $globals); 
    613     } 
    614     function __call($filter_name, $value){ 
    615         if( strstr($filter_name, 'pre_option_') !== false ){ 
    616             $return = get_site_option(str_replace('pre_option_','',$filter_name)); 
    617             return $return; 
    618         }elseif( strstr($filter_name, 'pre_update_option_') !== false ){ 
    619             if( is_super_admin() ){ 
    620                 update_site_option(str_replace('pre_update_option_','',$filter_name), $value[0]); 
    621             } 
    622             return $value[1]; 
    623         }elseif( strstr($filter_name, 'add_option_') !== false ){ 
    624             if( is_super_admin() ){ 
    625                 update_site_option(str_replace('add_option_','',$filter_name),$value[0]); 
    626             } 
    627             delete_option(str_replace('pre_option_','',$filter_name)); 
    628             return; 
    629         } 
    630         return $value[0]; 
    631     } 
     544if( is_multisite() ){ 
    632545    /** 
    633      * Returns the option of the main site in this network, this function should only be fired if in MS Global mode. 
    634      * @param int $value 
    635      * @return int 
     546     * Catches various option names and returns a network-wide option value instead of the individual blog option. Uses the magc __call function to catch unprecedented names. 
     547     * @author marcus 
     548     * 
    636549     */ 
    637     function pre_option_dbem_categories_enabled($value){ 
    638         if( !is_main_site() ){ //only alter value if not on main site already 
    639             $value = get_blog_option(get_current_site()->blog_id, 'dbem_categories_enabled') ? 1:0; //return a number since false will not circumvent pre_option_ filter 
    640         } 
    641         return $value; 
    642     } 
    643 } 
    644 if( is_multisite() ){ 
     550    class EM_MS_Globals { 
     551        function __construct(){ add_action( 'init', array(&$this, 'add_filters'), 1); } 
     552        function add_filters(){ 
     553            foreach( $this->get_globals() as $global_option_name ){ 
     554                add_filter('pre_option_'.$global_option_name, array(&$this, 'pre_option_'.$global_option_name), 1,1); 
     555                add_filter('pre_update_option_'.$global_option_name, array(&$this, 'pre_update_option_'.$global_option_name), 1,2); 
     556                add_action('add_option_'.$global_option_name, array(&$this, 'add_option_'.$global_option_name), 1,1); 
     557            } 
     558            //if we're in MS Global mode, the categories option currently resides in the main blog, consider moving this to a network setting in the future 
     559            if( EM_MS_GLOBAL ){ 
     560                add_filter('pre_option_dbem_categories_enabled', array(&$this, 'pre_option_dbem_categories_enabled'), 1,1); 
     561            } 
     562        } 
     563        function get_globals(){ 
     564            $globals = array( 
     565                //multisite settings 
     566                'dbem_ms_global_table', 'dbem_ms_global_caps', 
     567                'dbem_ms_global_events', 'dbem_ms_global_events_links','dbem_ms_events_slug', 
     568                'dbem_ms_global_locations','dbem_ms_global_locations_links','dbem_ms_locations_slug','dbem_ms_mainblog_locations', 
     569                //mail 
     570                'dbem_rsvp_mail_port', 'dbem_mail_sender_address', 'dbem_smtp_password', 'dbem_smtp_username','dbem_smtp_host', 'dbem_mail_sender_name','dbem_smtp_html','dbem_smtp_html_br','dbem_smtp_host','dbem_rsvp_mail_send_method','dbem_rsvp_mail_SMTPAuth', 
     571                //images 
     572                'dbem_image_max_width','dbem_image_max_height','dbem_image_max_size' 
     573            ); 
     574            if( EM_MS_GLOBAL ){ 
     575                $globals[] = 'dbem_taxonomy_category_slug'; 
     576            } 
     577            return apply_filters('em_ms_globals', $globals); 
     578        } 
     579        function __call($filter_name, $value){ 
     580            if( strstr($filter_name, 'pre_option_') !== false ){ 
     581                $return = get_site_option(str_replace('pre_option_','',$filter_name)); 
     582                return $return; 
     583            }elseif( strstr($filter_name, 'pre_update_option_') !== false ){ 
     584                if( is_super_admin() ){ 
     585                    update_site_option(str_replace('pre_update_option_','',$filter_name), $value[0]); 
     586                } 
     587                return $value[1]; 
     588            }elseif( strstr($filter_name, 'add_option_') !== false ){ 
     589                if( is_super_admin() ){ 
     590                    update_site_option(str_replace('add_option_','',$filter_name),$value[0]); 
     591                } 
     592                delete_option(str_replace('pre_option_','',$filter_name)); 
     593                return; 
     594            } 
     595            return $value[0]; 
     596        } 
     597        /** 
     598         * Returns the option of the main site in this network, this function should only be fired if in MS Global mode. 
     599         * @param int $value 
     600         * @return int 
     601         */ 
     602        function pre_option_dbem_categories_enabled($value){ 
     603            if( !is_main_site() ){ //only alter value if not on main site already 
     604                $value = get_blog_option(get_current_site()->blog_id, 'dbem_categories_enabled') ? 1:0; //return a number since false will not circumvent pre_option_ filter 
     605            } 
     606            return $value; 
     607        } 
     608    } 
    645609    global $EM_MS_Globals; 
    646610    $EM_MS_Globals = new EM_MS_Globals(); 
  • events-manager/trunk/includes/css/events_manager.css

    r1489758 r1651260  
    77    .em-warning-errors { background-color:#FFEBE8; border:1px solid #C00; } 
    88    .em-warning-confirms { background-color:#f1fff0; border:1px solid #a8d144; } 
    9     a.em-button { float:right; padding:5px 10px; margin:5px; background:#EEE; color:#333; border:1px solid #CCC; border-radius:3px; display:inline-block; text-decoration:none; } 
     9    a.em-button { padding:5px 10px; margin:5px; background:#EEE; color:#333; border:1px solid #CCC; border-radius:3px; display:inline-block; text-decoration:none; } 
    1010    a.em-button:hover { text-decoration:none; }  
    1111     
     
    1818        div.em-search.css-search div { display:block; } 
    1919        div.css-search input, div.css-search select, div.css-search option, div.css-search div, div.css-search span, div.css-search button {  
    20             width:auto; height:auto; margin:0; padding:0; float:none; display:auto; font-size:14px; /* reset everything */ 
     20            width:auto; height:auto; margin:0; padding:0; float:none; display:inline-block; font-size:14px; /* reset everything */ 
    2121        } 
    2222        div.css-search input, div.css-search select { padding:5px; } 
     
    2626            div.css-search div.em-search-main div { display:inline; } 
    2727            div.css-search div.em-search-field { padding:5px 0px; } 
    28             div.css-search input.em-search-text, div.css-search input.em-search-geo { width:90%; font-size:16px; line-height:16px; padding:8px; border:none; outline:none !important; color:#666; text-overflow: ellipsis; } 
     28            div.css-search input.em-search-text, div.css-search input.em-search-geo { width:90%; font-size:16px; line-height:16px; padding:8px; border:none; outline:none !important; color:#666; text-overflow: ellipsis; display:inline-block; } 
    2929            div.css-search div.em-search-geo { margin:0px 0px 0px 5px; padding-left:20px; background:url(../images/search-geo.png) 0px 3px no-repeat; } 
    3030            div.css-search div.em-search-text { margin:0px 0px 0px 5px; padding-left:20px; background:url(../images/search-mag-ico.png) 0px 4px no-repeat; } 
     
    111111/* Events Admin */ 
    112112#em-wrapper #posts-filter .subsubsub .current { font-weight:bold; }      
     113#em-wrapper .em-events-admin-list .em-button, #em-wrapper .em-events-admin-list .em-button { float:right; } 
    113114         
    114115/* Add Event Form */ 
     
    123124        #event-form .event-extra-details { margin-top:20px; } 
    124125        #event-form .event-extra-details select { vertical-align:top; } 
     126    /* Recurring Event Rescheduling */ 
     127    #event-form .reschedule-hidden, #post .reschedule-hidden { display:none; visibility:hidden; } 
     128    #event-form .em-recurrence-reschedule, #post .em-recurrence-reschedule { padding:15px 20px; border-left: 4px solid #ffa500; } 
     129    #event-form .em-recurrence-reschedule h4, #post .em-recurrence-reschedule h4 { margin-top:0px; } 
     130    #event-form .recurrence-reschedule-warning, #post .recurrence-reschedule-warning { margin-bottom:25px; color:#c45500; } 
     131    #event-form .recurrence-reschedule-warning p, #post .recurrence-reschedule-warning p { margin-top:0px; font-size:14px; } 
    125132    /*Tickets*/ 
    126133        #event-rsvp-box { margin:10px; } 
  • events-manager/trunk/includes/css/events_manager_admin.css

    r1234828 r1651260  
    2424 
    2525/* Events Add Page */ 
     26#post-body .misc-pub-post-status.misc-event-duplicate-link:before { content: "\f132"; } 
    2627#event-form #event-name, #location-form, #location-name { margin: 2px 0 7px; padding: 6px 5px; width: 98%; } 
     28    /* Recurring Event Rescheduling */ 
     29    #event-form .reschedule-hidden, #post .reschedule-hidden { display:none; visibility:hidden; } 
     30    #event-form .em-recurrence-reschedule, #post .em-recurrence-reschedule { padding:15px 20px; border-left: 4px solid #ffa500; } 
     31    #event-form .em-recurrence-reschedule h4, #post .em-recurrence-reschedule h4 { margin-top:0px; } 
     32    #event-form .recurrence-reschedule-warning, #post .recurrence-reschedule-warning { margin-bottom:25px; color:#c45500; } 
     33    #event-form .recurrence-reschedule-warning p, #post .recurrence-reschedule-warning p { margin-top:0px; font-size:14px; } 
    2734    /*Locations*/ 
    2835    div.em-location-data table { float:left; margin:0px 15px 0px 0px; } 
  • events-manager/trunk/includes/js/bookingsform.js

    r1311743 r1651260  
    4343                $(document).trigger('em_booking_error', [response]); 
    4444            } 
    45             $('html, body').animate({ scrollTop: em_booking_form.parent().offset().top - 30 }); //sends user back to top of form 
     45            $('html, body').animate({ scrollTop: $('.em-booking-message').offset().top - EM.booking_offset }); //sends user back to top of form 
    4646            em_booking_doing_ajax = false; 
    4747            //run extra actions after showing the message here 
  • events-manager/trunk/includes/js/categories-admin.js

    r1445870 r1651260  
    11jQuery(document).ready(function($) { 
    22    //color picker 
    3     var f = $.farbtastic('#picker'); 
    4     var p = $('#picker').css('opacity', 0.25); 
    5     var selected; 
    6     $('.colorwell').each(function () { f.linkTo(this); $(this).css('opacity', 0.75); }).focus(function() { 
    7         if (selected) { $(selected).css('opacity', 0.75).removeClass('colorwell-selected'); } 
    8         f.linkTo(this); 
    9         p.css('opacity', 1); 
    10         $(selected = this).css('opacity', 1).addClass('colorwell-selected'); 
    11     }); 
    12     $('.colorwell').click(function() { 
     3    var f = $.farbtastic('#picker'); 
     4    var p = $('#picker').css('opacity', 0.25); 
     5    var selected; 
     6    $('.colorwell').each(function () { f.linkTo(this); $(this).css('opacity', 0.75); }).focus(function() { 
     7        if (selected) { $(selected).css('opacity', 0.75).removeClass('colorwell-selected'); } 
     8        f.linkTo(this); 
     9        p.css('opacity', 1); 
     10        $(selected = this).css('opacity', 1).addClass('colorwell-selected'); 
     11    }); 
     12    $('.colorwell').click(function() { 
    1313        var position = $(selected = this).position(); 
    14         $('#picker').css('left', (position.left + 150) ); 
    15         $('#picker').css('top', position.top);  
    16         $('#picker').fadeIn(900,function (){ 
    17             $('#picker').css('display', 'inline'); 
    18         }); 
     14        $('#picker').css('left', (position.left + 150) ); 
     15        $('#picker').css('top', position.top);  
     16        $('#picker').fadeIn(900,function (){ 
     17            $('#picker').css('display', 'inline'); 
     18        }); 
    1919    }).blur(function(){ 
    20           $('#picker').fadeOut('fast'); 
    21           $('#picker').css('display', 'none'); 
    22     }); 
     20        $('#picker').fadeOut('fast'); 
     21        $('#picker').css('display', 'none'); 
     22    }); 
    2323 
    24     //image button upload - thanks Brad Williams, Ozh Richard, and Justin Tadlock! 
    25     var formfield = null; 
    26      
    27     $('#upload_image_button').click(function() { 
    28         $('html').addClass('Image'); 
    29         formfield = $('#category-image').attr('name'); 
    30         tb_show('', 'media-upload.php?type=image&TB_iframe=true'); 
    31         return false; 
     24    //Event Taxonomy Image Picker 
     25    var frame;   
     26    // ADD IMAGE LINK 
     27    $('#event-tax-image .upload-img-button').on( 'click', function( event ){ 
     28        event.preventDefault(); 
     29        // If the media frame already exists, reopen it. 
     30        if ( frame ) { 
     31        frame.open(); 
     32        return; 
     33        } 
     34        // Create a new media frame 
     35        frame = wp.media({ 
     36            library: { 
     37                type: 'image' 
     38            }, 
     39            title: wp.media.view.l10n.chooseImage, 
     40            multiple: false  // Set to true to allow multiple files to be selected 
     41        }); 
     42        // When an image is selected in the media frame... 
     43        frame.on( 'select', function() { 
     44            // Get media attachment details from the frame state 
     45            var attachment = frame.state().get('selection').first().toJSON(); 
     46            // Send the attachment URL to our custom image input field. 
     47            $( '#event-tax-image .img-container').empty().append( '<img src="'+attachment.url+'" alt="" style="max-width:100%;"/>' ); 
     48            // Send the attachment id to our hidden input 
     49            $( '#event-tax-image .img-id' ).val( attachment.id ); 
     50            $( '#event-tax-image .img-url' ).val( attachment.url ); 
     51            // Unhide the remove image link 
     52            $( '#event-tax-image .delete-img-button').show(); 
     53        }); 
     54        // Finally, open the modal on click 
     55        frame.open(); 
    3256    }); 
    33      
    34     // user inserts file into post. only run custom if user started process using the above process 
    35     // window.send_to_editor(html) is how wp would normally handle the received data 
    36     window.original_send_to_editor = window.send_to_editor; 
    37     window.send_to_editor = function(html){ 
    38         var fileurl; 
     57    // DELETE IMAGE LINK 
     58    $( '#event-tax-image .delete-img-button').on( 'click', function( event ){ 
     59        event.preventDefault(); 
     60        // Clear out the preview image 
     61        $( '#event-tax-image .img-container').html( '' ); 
     62        // Un-hide the add image link 
     63        $(this).hide(); 
     64        // Delete the image id from the hidden input 
     65        $( '#event-tax-image .img-id' ).val( '' ); 
     66        $( '#event-tax-image .img-url' ).val( '' ); 
     67    }); 
    3968 
    40         if (formfield != null) { 
    41             var img = $(html).find('img'); 
    42             fileurl = img.attr('src'); 
    43             $('#category-image').val(fileurl); 
    44             $('#category-image-img img').attr('src', fileurl); 
    45             //get the attachment id if possible 
    46             var fileIdClass = img.attr('class'); 
    47             var pattern = /wp\-image\-[0-9]+/; 
    48             var fileIdFull = pattern.exec(fileIdClass); 
    49             if( fileIdFull[0] != '' ){ 
    50                 var fileId = fileIdFull[0].replace('wp-image-',''); 
    51                 $('#category-image-id').val(fileId); 
    52             }            
    53  
    54             tb_remove(); 
    55  
    56             $('html').removeClass('Image'); 
    57             formfield = null; 
    58         } else { 
    59             window.original_send_to_editor(html); 
    60         } 
    61     }; 
    62      
    63     //detach/remove image from category for saving 
    64     $('#delete_image_button').on('click', function(){ 
    65         $('#category-image-img').remove(); 
    66         $('#category-image, #category-image-id').val(''); 
    67     });  
    6869}); 
  • events-manager/trunk/includes/js/events-manager.js

    r1445870 r1651260  
    176176        } 
    177177    }); 
     178    //Event Editor  
     179        //Recurrence Warnings 
     180        $('#event-form.em-event-admin-recurring').submit( function(event){ 
     181            var form = $(this); 
     182            if( form.find('input[name="event_reschedule"]').first().val() == 1 ){ 
     183                var warning_text = EM.event_reschedule_warning; 
     184            }else if( form.find('input[name="event_recreate_tickets"]').first().val() == 1 ){ 
     185                var warning_text = EM.event_recurrence_bookings; 
     186            }else{ 
     187                var warning_text = EM.event_recurrence_overwrite; 
     188            } 
     189            confirmation = confirm(warning_text); 
     190            if( confirmation == false ){ 
     191                event.preventDefault(); 
     192            } 
     193        }); 
     194        //Buttons for recurrence warnings within event editor forms 
     195        $('.em-reschedule-trigger').click(function(e){ 
     196            e.preventDefault(); 
     197            var trigger = $(this); 
     198            trigger.closest('.em-recurrence-reschedule').find(trigger.data('target')).removeClass('reschedule-hidden'); 
     199            trigger.siblings('.em-reschedule-value').val(1); 
     200            trigger.addClass('reschedule-hidden').siblings('a').removeClass('reschedule-hidden'); 
     201        }); 
     202        $('.em-reschedule-cancel').click(function(e){ 
     203            e.preventDefault(); 
     204            var trigger = $(this); 
     205            trigger.closest('.em-recurrence-reschedule').find(trigger.data('target')).addClass('reschedule-hidden'); 
     206            trigger.siblings('.em-reschedule-value').val(0); 
     207            trigger.addClass('reschedule-hidden').siblings('a').removeClass('reschedule-hidden'); 
     208        }); 
    178209    //Tickets & Bookings 
    179210    if( $("#em-tickets-form").length > 0 ){ 
     
    558589    //Datepicker 
    559590    if( $('.em-date-single, .em-date-range, #em-date-start').length > 0 ){ 
    560         if( EM.locale != 'en' && EM.locale_data ){ 
    561             $.datepicker.setDefaults(EM.locale_data); 
    562         } 
    563591        load_ui_css = true; 
    564592        em_setup_datepicker('body'); 
     
    828856            var proto = (EM.is_ssl) ? 'https:' : 'http:'; 
    829857            if( typeof EM.google_maps_api !== 'undefined' ){ 
    830                 script.src = proto + '//maps.google.com/maps/api/js?v=3.24&libraries=places&callback=em_maps&key='+EM.google_maps_api; 
     858                script.src = proto + '//maps.google.com/maps/api/js?v=3&libraries=places&callback=em_maps&key='+EM.google_maps_api; 
    831859            }else{ 
    832                 script.src = proto + '//maps.google.com/maps/api/js?v=3.24&libraries=places&callback=em_maps'; 
     860                script.src = proto + '//maps.google.com/maps/api/js?v=3&libraries=places&callback=em_maps'; 
    833861            } 
    834862            document.body.appendChild(script); 
     
    858886              maps[map_id] = new google.maps.Map(el[0], map_options); 
    859887              maps_markers[map_id] = []; 
     888 
     889              var bounds = new google.maps.LatLngBounds(); 
    860890               
    861               var minLatLngArr = [0,0]; 
    862               var maxLatLngArr = [0,0]; 
    863                
    864               for (var i = 0; i < data.length; i++) { 
    865                   if( !(data[i].location_latitude == 0 && data[i].location_longitude == 0) ){ 
    866                     var latitude = parseFloat( data[i].location_latitude ); 
    867                     var longitude = parseFloat( data[i].location_longitude ); 
    868                     var location = new google.maps.LatLng( latitude, longitude ); 
     891              jQuery.map( data, function( location, i ){ 
     892                  if( !(location.location_latitude == 0 && location.location_longitude == 0) ){ 
     893                    var latitude = parseFloat( location.location_latitude ); 
     894                    var longitude = parseFloat( location.location_longitude ); 
     895                    var location_position = new google.maps.LatLng( latitude, longitude ); 
    869896                    //extend the default marker options 
    870897                    jQuery.extend(marker_options, { 
    871                         position: location,  
     898                        position: location_position,  
    872899                        map: maps[map_id] 
    873900                    }) 
    874901                    var marker = new google.maps.Marker(marker_options); 
    875902                    maps_markers[map_id].push(marker); 
    876                     marker.setTitle(data[i].location_name); 
    877                     var myContent = '<div class="em-map-balloon"><div id="em-map-balloon-'+map_id+'" class="em-map-balloon-content">'+ data[i].location_balloon +'</div></div>'; 
     903                    marker.setTitle(location.location_name); 
     904                    var myContent = '<div class="em-map-balloon"><div id="em-map-balloon-'+map_id+'" class="em-map-balloon-content">'+ location.location_balloon +'</div></div>'; 
    878905                    em_map_infobox(marker, myContent, maps[map_id]); 
    879                      
    880                     //Get min and max long/lats 
    881                     minLatLngArr[0] = (latitude < minLatLngArr[0] || i == 0) ? latitude : minLatLngArr[0]; 
    882                     minLatLngArr[1] = (longitude < minLatLngArr[1] || i == 0) ? longitude : minLatLngArr[1]; 
    883                     maxLatLngArr[0] = (latitude > maxLatLngArr[0] || i == 0) ? latitude : maxLatLngArr[0]; 
    884                     maxLatLngArr[1] = (longitude > maxLatLngArr[1] || i == 0) ? longitude : maxLatLngArr[1]; 
     906                    //extend bounds 
     907                    bounds.extend(new google.maps.LatLng(latitude,longitude)) 
    885908                  } 
    886               } 
     909              }); 
    887910              // Zoom in to the bounds 
    888               var minLatLng = new google.maps.LatLng(minLatLngArr[0],minLatLngArr[1]); 
    889               var maxLatLng = new google.maps.LatLng(maxLatLngArr[0],maxLatLngArr[1]); 
    890               var bounds = new google.maps.LatLngBounds(minLatLng,maxLatLng); 
    891911              maps[map_id].fitBounds(bounds); 
    892912               
    893913            //Call a hook if exists 
    894             jQuery(document).triggerHandler('em_maps_locations_hook', [maps[map_id], data, map_id]); 
     914            jQuery(document).triggerHandler('em_maps_locations_hook', [maps[map_id], data, map_id, maps_markers[map_id]]); 
    895915        }else{ 
    896916            el.children().first().html('No locations found'); 
     
    904924    em_LatLng = new google.maps.LatLng( jQuery('#em-location-map-coords-'+map_id+' .lat').text(), jQuery('#em-location-map-coords-'+map_id+' .lng').text()); 
    905925    //extend map and markers via event triggers 
     926    var is_touch = 'ontouchstart' in window || navigator.maxTouchPoints; 
    906927    var map_options = { 
    907928        zoom: 14, 
    908929        center: em_LatLng, 
    909930        mapTypeId: google.maps.MapTypeId.ROADMAP, 
    910         mapTypeControl: false 
     931        mapTypeControl: false, 
     932        scrollwheel: is_touch 
    911933    }; 
    912934    jQuery(document).triggerHandler('em_maps_location_map_options', map_options); 
    913935    maps[map_id] = new google.maps.Map( document.getElementById('em-location-map-'+map_id), map_options); 
     936    if( !is_touch ){ 
     937        maps[map_id].addListener('click', function(){ maps[map_id].setOptions({ scrollwheel:true }); }); 
     938        maps[map_id].addListener('mouseout', function(){ maps[map_id].setOptions({ scrollwheel:false }); }); 
     939    } 
    914940    var marker_options = { 
    915941        position: em_LatLng, 
     
    10341060        if(jQuery('#em-map').length > 0){ 
    10351061            var em_LatLng = new google.maps.LatLng(0, 0); 
     1062            var is_touch = 'ontouchstart' in window || navigator.maxTouchPoints; 
    10361063            map = new google.maps.Map( document.getElementById('em-map'), { 
    10371064                zoom: 14, 
    10381065                center: em_LatLng, 
    10391066                mapTypeId: google.maps.MapTypeId.ROADMAP, 
    1040                 mapTypeControl: false 
    1041             }); 
     1067                mapTypeControl: false, 
     1068                scrollwheel: is_touch 
     1069            }); 
     1070            if( !is_touch ){ 
     1071                map.addListener('click', function(){ map.setOptions({ scrollwheel:true }); }); 
     1072                map.addListener('mouseout', function(){ map.setOptions({ scrollwheel:false }); }); 
     1073            } 
    10421074            var marker = new google.maps.Marker({ 
    10431075                position: em_LatLng, 
  • events-manager/trunk/readme.txt

    r1551894 r1651260  
    100100 
    101101== Changelog == 
     102= 5.6.7 (dev) = 
     103* added em_events_admin_args filter allowing modification of event search arguments 
     104* removed jQuery UI localize files for the datepicker in favor of WP 4.6 native localization 
     105* fixed potential bug where modified ticket spaces aren't saving correctly when editing a booking 
     106* added is_user_attendee, not_user_attendee and variations of both proceeding with _0 or another number representing booking status 
     107* added edit/view shortcut links for each event location in events list admin area 
     108* fixed conflict with BuddyPress Group Extras and potentially other plugins when one or more of our list pages aren't assigned a page (e.g. locations page) resulting in a blank page 
     109* fixed ical feed not serving wrapped content lines, 
     110* added EM_ICAL_APPLE_STRUCT constant to allow ommitting of X-APPLE-STRUCTURED-LOCATION lines in the ical file 
     111* fixed formatting issues with ical X-APPLE-STRUCTURED-LOCATION line 
     112* fixed instances where locations or events automatically creating a post slug if needed when published 
     113* fixed location image display issues on other blogs when in MultiSite Global mode 
     114* corrected and updated docs 
     115* fixed switch_to_blog() being used instead of restore_current_blog() in buddypress/bp-em-core.php (props @mikegillihan) 
     116* fixed search form CSS inconsistencies for Twenty Seventeen theme 
     117* fixed locations map breaking when provided with object versions of JSON response (such as with WPML compat add-on) 
     118* updated maps google library to always use most stable version 
     119* fixed issues when creating MS Global Events programmatically 
     120* moved some logic out of the EM_Event->output() function into their own function for easier future use in templates 
     121* fixed google calendar links not including full location address 
     122* added an import/export settings option in settings page 
     123* added ability to use post_id in calendar shortcode and PHP functions 
     124* added has_location and no_location to event search attributes 
     125* added [events_map] shortcode which searches by event rather than location 
     126* changed behaviour of zooming when mouse is over a map so a click is required first to avoid catching whilst scrolling the page 
     127* fixed all errors and warnings for PHP 7 and others highlighted by PHP Compatibility Checker plugin 
     128* added decimal parameter to get_tax_rate functions which allows fixing of minor PHP warning when tax is set to 0 
     129* fixed filter typos and _get_sql positions in EM_Bookings::get() and EM_Locations::get() 
     130* removed unnecessary storage of _post_id in postmeta for recurring events 
     131* fixed bug where tickets aren't deleted with event 
     132* fixed incompatibility with WP Fastest Cache for bookings on cached pages 
     133* fixed EM_Categories not removing categories if none are selected when resaving an event 
     134* added em_get_events_admin_url() function 
     135* added major improvements to recurring events including ability to duplicate templates and also make changes without deleting previous recurrences, 
     136* changed various event editor templates to accommodate new recurring event changes 
     137* changed no-user bookings feature to not require a dummy user 
     138* changed no-user bookings so previous bookings appear correctly regardless of whether NU bookings is enabled or disabled 
     139* tweaked PHP Mail sending method to go through WP PHPMailer class for better encoding 
     140* fixed overly aggressive filtering of get_the_date and get_the_time filters (kudos @boonebgorges) 
     141* fixed missing map markers array variable to be supplied in JS hook em_maps_locations_hook (kudos @raruto) 
     142* changed booking discount php functions into price adjustment functions which will now allow for surcharges to be implemented 
     143* fixed guest submissions with bookings enabled producing false permission errors instead of a confirmation 
     144* fixed/updated media uploader JS interface for category image 
     145* added more booking price filters to individual functions 
     146* fixed minor nuance where upcoming events scope filter not selectable on mobile view 
     147* fixed JS not being loaded automatically on events list when JS performance loading enabled 
     148* fixed regex matching preventing use of a #_LATT attribute within an #_ATT default value bracket 
     149* fixed confirmation message not showing for event duplication 
     150* added duplicate shortcut link on dashboard edit event page 
     151* fixed issues with selection of Sunday on monthly recurrences and the generated pattern summary 
     152* changed/fixed events_list_grouped using date format for sub-section titles from settings page if no date_format supplied regardless of grouping mode 
     153* added em_scripts_and_styles_public_enqueue_pages filter for custom pages to automatically include EM script/styles when limiting for performance is enabled 
     154* fixed PHP non-object notices on certain non-EM dashboard pages 
     155* changed booking form scrolling JS to scroll to booking message feedback element and added EM_BOOKING_MSG_JS_OFFSET constant to allow adjusting the offset in wp-config.php 
     156* fixed redirect link on booking form login not taking into account SSL pages 
     157* added #_EVENTEXCERPTCUT to allow cutting of both excerpts and post content 
     158* changed event all day times to start at 00:00:00 and end at 23:59:59 when saved (kudos @cliffpaulick) 
     159* changed default search form settings behaviour to ignore country filtering if search option is not enabled 
     160* fixed scheduled recurring events not publishing recurrences 
     161* improved google maps JS for multiple events/locations maps and auto-zooming of included locations (kudos @benklocek) 
     162* fixed minor php warning on user profile page 
     163 
    102164= 5.6.6.1 = 
    103165* fixed search forms disappearing in latest update when Styling Options for search forms are turned off (props @factchecker) 
  • events-manager/trunk/templates/buddypress/group-events.php

    r1311743 r1651260  
    2929        echo "<p>". __( 'No Events','events-manager') ."</p>"; 
    3030    } else { 
    31         foreach( $EM_Events as $EM_Event ) break; 
     31        foreach( $EM_Events as $EM_Event ){ break; } 
    3232        $can_edit_events = $EM_Event->can_manage('edit_events','edit_others_events'); 
    3333    ?> 
  • events-manager/trunk/templates/emails/bookingsummary.php

    r1311743 r1651260  
    3333 
    3434<?php endforeach; ?> 
     35<?php endif; ?> 
     36<?php if( count($price_summary['surcharges_pre_tax']) > 0 ): ?> 
    3537 
     38<?php _e('Surcharges Before Taxes','events-manager'); ?> 
     39 
     40<?php foreach( $price_summary['surcharges_pre_tax'] as $surcharge_summary ): ?> 
     41(<?php echo $surcharge_summary['name']; ?>) : <?php echo $surcharge_summary['amount']; ?> 
     42 
     43<?php endforeach; ?> 
    3644<?php endif; ?> 
     45 
    3746<?php if( !empty($price_summary['taxes']['amount'])  ): ?> 
    3847<?php _e('Taxes','events-manager'); ?> ( <?php echo $price_summary['taxes']['rate']; ?> ) : <?php echo $price_summary['taxes']['amount']; ?> 
     
    4857<?php endforeach; ?> 
    4958<?php endif; ?> 
     59<?php if( count($price_summary['surcharges_post_tax']) > 0 ): ?> 
     60 
     61<?php _e('Surcharges (After Taxes)','events-manager'); ?> 
     62 
     63<?php foreach( $price_summary['surcharges_post_tax'] as $surcharge_summary ): ?> 
     64<?php echo $surcharge_summary['name']; ?> : <?php echo $surcharge_summary['amount']; ?> 
     65  
     66<?php endforeach; ?> 
     67<?php endif; ?> 
    5068 
    5169<?php _e('Total Price','events-manager'); ?> : <?php echo $price_summary['total']; ?> 
  • events-manager/trunk/templates/forms/bookingform/login.php

    r1311743 r1651260  
    1818    <input type="submit" name="wp-submit" id="em_wp-submit" value="<?php esc_html_e('Log In', 'events-manager'); ?>" tabindex="100" /> 
    1919    <input name="rememberme" type="checkbox" id="em_rememberme" value="forever" /> <label><?php esc_html_e( 'Remember Me','events-manager') ?></label> 
    20     <input type="hidden" name="redirect_to" value="<?php echo esc_url($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); ?>#em-booking" /> 
     20    <input type="hidden" name="redirect_to" value="<?php echo esc_url( get_site_url(false, $_SERVER['REQUEST_URI']) ); ?>#em-booking" /> 
    2121    <br /> 
    2222    <?php 
  • events-manager/trunk/templates/forms/event-editor.php

    r1311743 r1651260  
    2424} 
    2525?>   
    26 <form enctype='multipart/form-data' id="event-form" method="post" action="<?php echo esc_url(add_query_arg(array('success'=>null))); ?>"> 
     26<form enctype='multipart/form-data' id="event-form" class="em-event-admin-editor <?php if( $EM_Event->is_recurring() ) echo 'em-event-admin-recurring' ?>" method="post" action="<?php echo esc_url(add_query_arg(array('success'=>null))); ?>"> 
    2727    <div class="wrap"> 
    2828        <?php do_action('em_front_event_form_header'); ?> 
  • events-manager/trunk/templates/forms/event/bookings.php

    r1450218 r1651260  
    11<?php 
    22global $EM_Event, $post, $allowedposttags, $EM_Ticket, $col_count; 
     3$reschedule_warnings = !empty($EM_Event->event_id) && $EM_Event->is_recurring() && $EM_Event->event_rsvp; 
    34?> 
    45<div id="event-rsvp-box"> 
     
    89</div> 
    910<div id="event-rsvp-options" style="<?php echo ($EM_Event->event_rsvp) ? '':'display:none;' ?>"> 
    10     <?php do_action('em_events_admin_bookings_header', $EM_Event); ?> 
    11     <div id="em-tickets-form"> 
    12     <?php 
     11    <?php  
     12    do_action('em_events_admin_bookings_header', $EM_Event); 
    1313    //get tickets here and if there are none, create a blank ticket 
    1414    $EM_Tickets = $EM_Event->get_tickets(); 
     
    1717        $delete_temp_ticket = true; 
    1818    } 
    19     if( get_option('dbem_bookings_tickets_single') && count($EM_Tickets->tickets) == 1 ){ 
     19    ?> 
     20    <div class="event-rsvp-options-tickets <?php if( $reschedule_warnings ) echo 'em-recurrence-reschedule'; ?>"> 
     21        <?php 
     22        //output title 
     23        if( get_option('dbem_bookings_tickets_single') && count($EM_Tickets->tickets) == 1 ){ 
     24            ?> 
     25            <h4><?php esc_html_e('Ticket Options','events-manager'); ?></h4> 
     26            <?php 
     27        }else{ 
     28            ?> 
     29            <h4><?php esc_html_e('Tickets','events-manager'); ?></h4> 
     30            <?php 
     31        } 
     32        //If this event is a recurring template, we need to warn the user that editing tickets will delete previous bookings 
     33        if( $reschedule_warnings ){  
     34            ?> 
     35            <div class="recurrence-reschedule-warning"> 
     36                <p><?php esc_html_e( 'Modifications to event tickets will cause all bookings to individual recurrences of this event to be deleted.', 'events-manager'); ?></p> 
     37                <p>          
     38                    <a href="<?php echo esc_url( add_query_arg(array('scope'=>'all', 'recurrence_id'=>$EM_Event->event_id), em_get_events_admin_url()) ); ?>"> 
     39                        <strong><?php esc_html_e('You can edit individual recurrences and disassociate them with this recurring event.', 'events-manager'); ?></strong> 
     40                    </a> 
     41                </p> 
     42            </div> 
     43            <?php  
     44        } 
    2045        ?> 
    21         <h4><?php esc_html_e('Ticket Options','events-manager'); ?></h4> 
     46        <div id="em-tickets-form" class="em-tickets-form<?php if( $reschedule_warnings && empty($_REQUEST['recreate_tickets']) ) echo ' reschedule-hidden' ?>"> 
    2247        <?php 
    23         $col_count = 1;  
    24         $EM_Ticket = $EM_Tickets->get_first();               
    25         include( em_locate_template('forms/ticket-form.php') ); //in future we'll be accessing forms/event/bookings-ticket-form.php directly 
    26     }else{ 
     48        //output ticket options 
     49        if( get_option('dbem_bookings_tickets_single') && count($EM_Tickets->tickets) == 1 ){ 
     50            $col_count = 1;  
     51            $EM_Ticket = $EM_Tickets->get_first();               
     52            include( em_locate_template('forms/ticket-form.php') ); //in future we'll be accessing forms/event/bookings-ticket-form.php directly 
     53        }else{ 
     54            ?> 
     55            <p><em><?php esc_html_e('You can have single or multiple tickets, where certain tickets become available under certain conditions, e.g. early bookings, group discounts, maximum bookings per ticket, etc.', 'events-manager'); ?> <?php esc_html_e('Basic HTML is allowed in ticket labels and descriptions.','events-manager'); ?></em></p>                    
     56            <table class="form-table"> 
     57                <thead> 
     58                    <tr valign="top"> 
     59                        <th colspan="2"><?php esc_html_e('Ticket Name','events-manager'); ?></th> 
     60                        <th><?php esc_html_e('Price','events-manager'); ?></th> 
     61                        <th><?php esc_html_e('Min/Max','events-manager'); ?></th> 
     62                        <th><?php esc_html_e('Start/End','events-manager'); ?></th> 
     63                        <th><?php esc_html_e('Avail. Spaces','events-manager'); ?></th> 
     64                        <th><?php esc_html_e('Booked Spaces','events-manager'); ?></th> 
     65                        <th>&nbsp;</th> 
     66                    </tr> 
     67                </thead>     
     68                <tfoot> 
     69                    <tr valign="top"> 
     70                        <td colspan="8"> 
     71                            <a href="#" id="em-tickets-add"><?php esc_html_e('Add new ticket','events-manager'); ?></a> 
     72                        </td> 
     73                    </tr> 
     74                </tfoot> 
     75                <?php 
     76                    $EM_Ticket = new EM_Ticket(); 
     77                    $EM_Ticket->event_id = $EM_Event->event_id; 
     78                    array_unshift($EM_Tickets->tickets, $EM_Ticket); //prepend template ticket for JS 
     79                    $col_count = 0; 
     80                    foreach( $EM_Tickets->tickets as $EM_Ticket){ 
     81                        /* @var $EM_Ticket EM_Ticket */ 
     82                        ?> 
     83                        <tbody id="em-ticket-<?php echo $col_count ?>" <?php if( $col_count == 0 ) echo 'style="display:none;"' ?>> 
     84                            <tr class="em-tickets-row"> 
     85                                <td class="ticket-status"><span class="<?php if($EM_Ticket->ticket_id && $EM_Ticket->is_available()){ echo 'ticket_on'; }elseif($EM_Ticket->ticket_id > 0){ echo 'ticket_off'; }else{ echo 'ticket_new'; } ?>"></span></td>                                                  
     86                                <td class="ticket-name"> 
     87                                    <span class="ticket_name"><?php if($EM_Ticket->ticket_members) echo '* ';?><?php echo wp_kses_data($EM_Ticket->ticket_name); ?></span> 
     88                                    <div class="ticket_description"><?php echo wp_kses($EM_Ticket->ticket_description,$allowedposttags); ?></div> 
     89                                    <div class="ticket-actions"> 
     90                                        <a href="#" class="ticket-actions-edit"><?php esc_html_e('Edit','events-manager'); ?></a>  
     91                                        <?php if( count($EM_Ticket->get_bookings()->bookings) == 0 ): ?> 
     92                                        | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php esc_html_e('Delete','events-manager'); ?></a> 
     93                                        <?php else: ?> 
     94                                        | <a href="<?php echo esc_url(add_query_arg('ticket_id', $EM_Ticket->ticket_id, $EM_Event->get_bookings_url())); ?>"><?php esc_html_e('View Bookings','events-manager'); ?></a> 
     95                                        <?php endif; ?> 
     96                                    </div> 
     97                                </td> 
     98                                <td class="ticket-price"> 
     99                                    <span class="ticket_price"><?php echo ($EM_Ticket->ticket_price) ? esc_html($EM_Ticket->get_price_precise()) : esc_html__('Free','events-manager'); ?></span> 
     100                                </td> 
     101                                <td class="ticket-limit"> 
     102                                    <span class="ticket_min"> 
     103                                        <?php  echo ( !empty($EM_Ticket->ticket_min) ) ? esc_html($EM_Ticket->ticket_min):'-'; ?> 
     104                                    </span> /  
     105                                    <span class="ticket_max"><?php echo ( !empty($EM_Ticket->ticket_max) ) ? esc_html($EM_Ticket->ticket_max):'-'; ?></span> 
     106                                </td> 
     107                                <td class="ticket-time"> 
     108                                    <span class="ticket_start ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date(get_option('dbem_date_format'), $EM_Ticket->start_timestamp):''; ?></span> 
     109                                    <span class="ticket_start_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['start_days']; ?></span> 
     110                                    <span class="ticket_start_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['start_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','events-manager'); ?></span> 
     111                                    <span class="ticket_start_time"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date( em_get_hour_format(), $EM_Ticket->start_timestamp):''; ?></span> 
     112                                    <br /> 
     113                                    <span class="ticket_end ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date(get_option('dbem_date_format'), $EM_Ticket->end_timestamp):''; ?></span> 
     114                                    <span class="ticket_end_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['end_days']; ?></span> 
     115                                    <span class="ticket_end_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['end_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','events-manager'); ?></span> 
     116                                    <span class="ticket_end_time"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date( em_get_hour_format(), $EM_Ticket->end_timestamp):''; ?></span> 
     117                                </td> 
     118                                <td class="ticket-qty"> 
     119                                    <span class="ticket_available_spaces"><?php echo $EM_Ticket->get_available_spaces(); ?></span>/ 
     120                                    <span class="ticket_spaces"><?php echo $EM_Ticket->get_spaces() ? $EM_Ticket->get_spaces() : '-'; ?></span> 
     121                                </td> 
     122                                <td class="ticket-booked-spaces"> 
     123                                    <span class="ticket_booked_spaces"><?php echo $EM_Ticket->get_booked_spaces(); ?></span> 
     124                                </td> 
     125                                <?php do_action('em_event_edit_ticket_td', $EM_Ticket); ?> 
     126                            </tr> 
     127                            <tr class="em-tickets-row-form" style="display:none;"> 
     128                                <td colspan="<?php echo apply_filters('em_event_edit_ticket_td_colspan', 7); ?>"> 
     129                                    <?php include( em_locate_template('forms/event/bookings-ticket-form.php')); ?> 
     130                                    <div class="em-ticket-form-actions"> 
     131                                    <button type="button" class="ticket-actions-edited"><?php esc_html_e('Close Ticket Editor','events-manager')?></button> 
     132                                    </div> 
     133                                </td> 
     134                            </tr> 
     135                        </tbody> 
     136                        <?php 
     137                        $col_count++; 
     138                    } 
     139                    array_shift($EM_Tickets->tickets); 
     140                ?> 
     141            </table> 
     142        <?php  
     143        } 
    27144        ?> 
    28         <h4><?php esc_html_e('Tickets','events-manager'); ?></h4> 
    29         <p><em><?php esc_html_e('You can have single or multiple tickets, where certain tickets become available under certain conditions, e.g. early bookings, group discounts, maximum bookings per ticket, etc.', 'events-manager'); ?> <?php esc_html_e('Basic HTML is allowed in ticket labels and descriptions.','events-manager'); ?></em></p>                    
    30         <table class="form-table"> 
    31             <thead> 
    32                 <tr valign="top"> 
    33                     <th colspan="2"><?php esc_html_e('Ticket Name','events-manager'); ?></th> 
    34                     <th><?php esc_html_e('Price','events-manager'); ?></th> 
    35                     <th><?php esc_html_e('Min/Max','events-manager'); ?></th> 
    36                     <th><?php esc_html_e('Start/End','events-manager'); ?></th> 
    37                     <th><?php esc_html_e('Avail. Spaces','events-manager'); ?></th> 
    38                     <th><?php esc_html_e('Booked Spaces','events-manager'); ?></th> 
    39                     <th>&nbsp;</th> 
    40                 </tr> 
    41             </thead>     
    42             <tfoot> 
    43                 <tr valign="top"> 
    44                     <td colspan="8"> 
    45                         <a href="#" id="em-tickets-add"><?php esc_html_e('Add new ticket','events-manager'); ?></a> 
    46                     </td> 
    47                 </tr> 
    48             </tfoot> 
    49             <?php 
    50                 $EM_Ticket = new EM_Ticket(); 
    51                 $EM_Ticket->event_id = $EM_Event->event_id; 
    52                 array_unshift($EM_Tickets->tickets, $EM_Ticket); //prepend template ticket for JS 
    53                 $col_count = 0; 
    54                 foreach( $EM_Tickets->tickets as $EM_Ticket){ 
    55                     /* @var $EM_Ticket EM_Ticket */ 
    56                     ?> 
    57                     <tbody id="em-ticket-<?php echo $col_count ?>" <?php if( $col_count == 0 ) echo 'style="display:none;"' ?>> 
    58                         <tr class="em-tickets-row"> 
    59                             <td class="ticket-status"><span class="<?php if($EM_Ticket->ticket_id && $EM_Ticket->is_available()){ echo 'ticket_on'; }elseif($EM_Ticket->ticket_id > 0){ echo 'ticket_off'; }else{ echo 'ticket_new'; } ?>"></span></td>                                                  
    60                             <td class="ticket-name"> 
    61                                 <span class="ticket_name"><?php if($EM_Ticket->ticket_members) echo '* ';?><?php echo wp_kses_data($EM_Ticket->ticket_name); ?></span> 
    62                                 <div class="ticket_description"><?php echo wp_kses($EM_Ticket->ticket_description,$allowedposttags); ?></div> 
    63                                 <div class="ticket-actions"> 
    64                                     <a href="#" class="ticket-actions-edit"><?php esc_html_e('Edit','events-manager'); ?></a>  
    65                                     <?php if( count($EM_Ticket->get_bookings()->bookings) == 0 ): ?> 
    66                                     | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php esc_html_e('Delete','events-manager'); ?></a> 
    67                                     <?php else: ?> 
    68                                     | <a href="<?php echo esc_url(add_query_arg('ticket_id', $EM_Ticket->ticket_id, $EM_Event->get_bookings_url())); ?>"><?php esc_html_e('View Bookings','events-manager'); ?></a> 
    69                                     <?php endif; ?> 
    70                                 </div> 
    71                             </td> 
    72                             <td class="ticket-price"> 
    73                                 <span class="ticket_price"><?php echo ($EM_Ticket->ticket_price) ? esc_html($EM_Ticket->get_price_precise()) : esc_html__('Free','events-manager'); ?></span> 
    74                             </td> 
    75                             <td class="ticket-limit"> 
    76                                 <span class="ticket_min"> 
    77                                     <?php  echo ( !empty($EM_Ticket->ticket_min) ) ? esc_html($EM_Ticket->ticket_min):'-'; ?> 
    78                                 </span> /  
    79                                 <span class="ticket_max"><?php echo ( !empty($EM_Ticket->ticket_max) ) ? esc_html($EM_Ticket->ticket_max):'-'; ?></span> 
    80                             </td> 
    81                             <td class="ticket-time"> 
    82                                 <span class="ticket_start ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date(get_option('dbem_date_format'), $EM_Ticket->start_timestamp):''; ?></span> 
    83                                 <span class="ticket_start_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['start_days']; ?></span> 
    84                                 <span class="ticket_start_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['start_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','events-manager'); ?></span> 
    85                                 <span class="ticket_start_time"><?php echo ( !empty($EM_Ticket->ticket_start) ) ? date( em_get_hour_format(), $EM_Ticket->start_timestamp):''; ?></span> 
    86                                 <br /> 
    87                                 <span class="ticket_end ticket-dates-from-normal"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date(get_option('dbem_date_format'), $EM_Ticket->end_timestamp):''; ?></span> 
    88                                 <span class="ticket_end_recurring_days ticket-dates-from-recurring"><?php if( !empty($EM_Ticket->ticket_meta['recurrences']) ) echo $EM_Ticket->ticket_meta['recurrences']['end_days']; ?></span> 
    89                                 <span class="ticket_end_recurring_days_text ticket-dates-from-recurring <?php if( !empty($EM_Ticket->ticket_meta['recurrences']) && !is_numeric($EM_Ticket->ticket_meta['recurrences']['end_days']) ) echo 'hidden'; ?>"><?php _e('day(s)','events-manager'); ?></span> 
    90                                 <span class="ticket_end_time"><?php echo ( !empty($EM_Ticket->ticket_end) ) ? date( em_get_hour_format(), $EM_Ticket->end_timestamp):''; ?></span> 
    91                             </td> 
    92                             <td class="ticket-qty"> 
    93                                 <span class="ticket_available_spaces"><?php echo $EM_Ticket->get_available_spaces(); ?></span>/ 
    94                                 <span class="ticket_spaces"><?php echo $EM_Ticket->get_spaces() ? $EM_Ticket->get_spaces() : '-'; ?></span> 
    95                             </td> 
    96                             <td class="ticket-booked-spaces"> 
    97                                 <span class="ticket_booked_spaces"><?php echo $EM_Ticket->get_booked_spaces(); ?></span> 
    98                             </td> 
    99                             <?php do_action('em_event_edit_ticket_td', $EM_Ticket); ?> 
    100                         </tr> 
    101                         <tr class="em-tickets-row-form" style="display:none;"> 
    102                             <td colspan="<?php echo apply_filters('em_event_edit_ticket_td_colspan', 7); ?>"> 
    103                                 <?php include( em_locate_template('forms/event/bookings-ticket-form.php')); ?> 
    104                                 <div class="em-ticket-form-actions"> 
    105                                 <button type="button" class="ticket-actions-edited"><?php esc_html_e('Close Ticket Editor','events-manager')?></button> 
    106                                 </div> 
    107                             </td> 
    108                         </tr> 
    109                     </tbody> 
    110                     <?php 
    111                     $col_count++; 
    112                 } 
    113                 array_shift($EM_Tickets->tickets); 
    114             ?> 
    115         </table> 
    116     <?php  
    117     } 
    118     ?> 
     145        </div> 
     146        <?php if( $reschedule_warnings ): //If this event is a recurring template, we need to warn the user that editing tickets will delete previous bookings ?> 
     147        <div class="recurrence-reschedule-buttons"> 
     148            <a href="<?php echo esc_url(add_query_arg('recreate_tickets', null)); ?>" class="button-secondary em-button em-reschedule-cancel<?php if( empty($_REQUEST['recreate_tickets']) ) echo ' reschedule-hidden'; ?>" data-target=".em-tickets-form"> 
     149                <?php esc_html_e('Cancel Ticket Recreation', 'events-manager'); ?> 
     150            </a> 
     151            <a href="<?php echo esc_url(add_query_arg('recreate_tickets', '1')); ?>" class="em-reschedule-trigger em-button button-secondary<?php if( !empty($_REQUEST['recreate_tickets']) ) echo ' reschedule-hidden'; ?>" data-target=".em-tickets-form"> 
     152                <?php esc_html_e('Modify Recurring Event Tickets ', 'events-manager'); ?> 
     153            </a> 
     154            <input type="hidden" name="event_recreate_tickets" class="em-reschedule-value" value="<?php echo empty($_REQUEST['recreate_tickets']) ? 0:1 ?>" /> 
     155        </div> 
     156        <?php endif; ?> 
    119157    </div> 
    120     <div id="em-booking-options"> 
     158    <div id="em-booking-options" class="em-booking-options"> 
    121159    <?php if( !get_option('dbem_bookings_tickets_single') || count($EM_Ticket->get_event()->get_tickets()->tickets) > 1 ): ?> 
    122160    <h4><?php esc_html_e('Event Options','events-manager'); ?></h4> 
  • events-manager/trunk/templates/forms/event/recurring-when.php

    r1311743 r1651260  
    44$days_names = em_get_days_names(); 
    55$hours_format = em_get_hour_format(); 
     6$classes = array(); 
    67?> 
    7 <?php if( is_admin() ): ?><input type="hidden" name="_emnonce" value="<?php echo wp_create_nonce('edit_event'); ?>" /><?php endif; ?> 
    88<!-- START recurrence postbox --> 
    9 <div id="em-form-recurrence" class="event-form-recurrence event-form-when"> 
    10     <?php _e ( 'This event repeats', 'events-manager'); ?>  
     9<div id="em-form-recurrence" class="event-form-recurrence event-form-when <?php if( !empty($EM_Event->event_id) ) echo 'em-recurrence-reschedule'; ?>"> 
     10    <?php if( !empty($EM_Event->event_id) ): ?> 
     11    <div class="recurrence-reschedule-warning"> 
     12        <p><em><?php echo sprintf(esc_html__('Current Recurrence Pattern: %s', 'events-manager'), $EM_Event->get_recurrence_description()); ?></em></p> 
     13        <p><strong><?php esc_html_e( 'Modifications to event times will cause all recurrences of this event to be deleted and recreated, previous bookings will be deleted.', 'events-manager'); ?></strong></p> 
     14        <p> 
     15           <a href="<?php echo esc_url( add_query_arg(array('scope'=>'all', 'recurrence_id'=>$EM_Event->event_id), em_get_events_admin_url()) ); ?>"> 
     16                <strong><?php esc_html_e('You can edit individual recurrences and disassociate them with this recurring event.', 'events-manager'); ?></strong> 
     17           </a> 
     18        </p> 
     19    </div> 
     20    <?php endif; ?> 
     21    <div class="event-form-when-wrap <?php if( !empty($EM_Event->event_id) && empty($_REQUEST['reschedule']) ) echo 'reschedule-hidden'; ?>"> 
     22    <?php _e ( 'This event repeats', 'events-manager'); ?>  
    1123        <select id="recurrence-frequency" name="recurrence_freq"> 
    1224            <?php 
     
    2537        <span class='interval-desc' id="interval-yearly-singular"><?php _e ( 'year', 'events-manager')?></span>  
    2638        <span class='interval-desc' id="interval-yearly-plural"><?php _e ( 'years', 'events-manager') ?></span> 
    27     <p class="alternate-selector" id="weekly-selector"> 
    28         <?php 
    29             $saved_bydays = ($EM_Event->is_recurring() && $EM_Event->recurrence_byday != '' ) ? explode ( ",", $EM_Event->recurrence_byday ) : array();  
    30             em_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );  
    31         ?> 
    32     </p> 
    33     <p class="alternate-selector" id="monthly-selector" style="display:inline;"> 
    34         <select id="monthly-modifier" name="recurrence_byweekno"> 
     39        <p class="alternate-selector" id="weekly-selector"> 
    3540            <?php 
    36                 $weekno_options = array ("1" => __ ( 'first', 'events-manager'), '2' => __ ( 'second', 'events-manager'), '3' => __ ( 'third', 'events-manager'), '4' => __ ( 'fourth', 'events-manager'), '-1' => __ ( 'last', 'events-manager') );  
    37                 em_option_items ( $weekno_options, $EM_Event->recurrence_byweekno );  
     41                $saved_bydays = ($EM_Event->is_recurring() && $EM_Event->recurrence_byday != '' ) ? explode ( ",", $EM_Event->recurrence_byday ) : array();  
     42                em_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );  
    3843            ?> 
    39         </select> 
    40         <select id="recurrence-weekday" name="recurrence_byday"> 
    41             <?php em_option_items ( $days_names, $EM_Event->recurrence_byday  ); ?> 
    42         </select> 
    43         <?php _e('of each month','events-manager'); ?> 
    44         &nbsp; 
    45     </p> 
    46     <div class="event-form-recurrence-when"> 
    47         <p class="em-date-range"> 
    48             <?php _e ( 'Recurrences span from ', 'events-manager'); ?>                   
    49             <input class="em-date-start em-date-input-loc" type="text" /> 
    50             <input class="em-date-input" type="hidden" name="event_start_date" value="<?php echo $EM_Event->event_start_date ?>" /> 
    51             <?php _e('to','events-manager'); ?> 
    52             <input class="em-date-end em-date-input-loc" type="text" /> 
    53             <input class="em-date-input" type="hidden" name="event_end_date" value="<?php echo $EM_Event->event_end_date ?>" /> 
    5444        </p> 
    55         <p class="em-time-range"> 
    56             <?php _e('Events start from','events-manager'); ?> 
    57             <input id="start-time" class="em-time-input em-time-start" type="text" size="8" maxlength="8" name="event_start_time" value="<?php echo date( $hours_format, $EM_Event->start ); ?>" /> 
    58             <?php _e('to','events-manager'); ?> 
    59             <input id="end-time" class="em-time-input em-time-end" type="text" size="8" maxlength="8" name="event_end_time" value="<?php echo date( $hours_format, $EM_Event->end ); ?>" /> 
    60             <?php _e('All day','events-manager'); ?> <input type="checkbox" class="em-time-allday" name="event_all_day" id="em-time-all-day" value="1" <?php if(!empty($EM_Event->event_all_day)) echo 'checked="checked"'; ?> /> 
     45        <p class="alternate-selector" id="monthly-selector" style="display:inline;"> 
     46            <select id="monthly-modifier" name="recurrence_byweekno"> 
     47                <?php 
     48                    $weekno_options = array ("1" => __ ( 'first', 'events-manager'), '2' => __ ( 'second', 'events-manager'), '3' => __ ( 'third', 'events-manager'), '4' => __ ( 'fourth', 'events-manager'), '-1' => __ ( 'last', 'events-manager') );  
     49                    em_option_items ( $weekno_options, $EM_Event->recurrence_byweekno  );  
     50                ?> 
     51            </select> 
     52            <select id="recurrence-weekday" name="recurrence_byday"> 
     53                <?php em_option_items ( $days_names, $EM_Event->recurrence_byday  ); ?> 
     54            </select> 
     55            <?php _e('of each month','events-manager'); ?> 
     56            &nbsp; 
    6157        </p> 
    62         <p class="em-duration-range"> 
    63             <?php echo sprintf(__('Each event spans %s day(s)','events-manager'), '<input id="end-days" type="text" size="8" maxlength="8" name="recurrence_days" value="'. $EM_Event->recurrence_days .'" />'); ?> 
    64         </p> 
    65         <p class="em-range-description"><em><?php _e( 'For a recurring event, a one day event will be created on each recurring date within this date range.', 'events-manager'); ?></em></p> 
    66     </div>  
    67     <script type="text/javascript"> 
    68         jQuery(document).ready( function($) { 
    69             //Recurrence Warnings 
    70             $('#event-form').submit( function(event){ 
    71                 confirmation = confirm(EM.event_reschedule_warning); 
    72                 if( confirmation == false ){ 
    73                     event.preventDefault(); 
    74                 } 
    75             }); 
    76         });      
    77     </script> 
     58        <div class="event-form-recurrence-when"> 
     59            <p class="em-date-range"> 
     60                <?php _e ( 'Recurrences span from ', 'events-manager'); ?>                   
     61                <input class="em-date-start em-date-input-loc" type="text" /> 
     62                <input class="em-date-input" type="hidden" name="event_start_date" value="<?php echo $EM_Event->event_start_date ?>" /> 
     63                <?php _e('to','events-manager'); ?> 
     64                <input class="em-date-end em-date-input-loc" type="text" /> 
     65                <input class="em-date-input" type="hidden" name="event_end_date" value="<?php echo $EM_Event->event_end_date ?>" /> 
     66            </p> 
     67            <p class="em-time-range"> 
     68                <?php _e('Events start from','events-manager'); ?> 
     69                <input id="start-time" class="em-time-input em-time-start" type="text" size="8" maxlength="8" name="event_start_time" value="<?php echo date( $hours_format, $EM_Event->start ); ?>" /> 
     70                <?php _e('to','events-manager'); ?> 
     71                <input id="end-time" class="em-time-input em-time-end" type="text" size="8" maxlength="8" name="event_end_time" value="<?php echo date( $hours_format, $EM_Event->end ); ?>" /> 
     72                <?php _e('All day','events-manager'); ?> <input type="checkbox" class="em-time-allday" name="event_all_day" id="em-time-all-day" value="1" <?php if(!empty($EM_Event->event_all_day)) echo 'checked="checked"'; ?> /> 
     73            </p> 
     74            <p class="em-duration-range"> 
     75                <?php echo sprintf(__('Each event spans %s day(s)','events-manager'), '<input id="end-days" type="text" size="8" maxlength="8" name="recurrence_days" value="'. $EM_Event->recurrence_days .'" />'); ?> 
     76            </p> 
     77            <p class="em-range-description"><em><?php _e( 'For a recurring event, a one day event will be created on each recurring date within this date range.', 'events-manager'); ?></em></p> 
     78        </div> 
     79    </div> 
     80    <?php if( !empty($EM_Event->event_id) ): ?> 
     81    <div class="recurrence-reschedule-buttons"> 
     82        <a href="<?php echo esc_url(add_query_arg('reschedule', null)); ?>" class="button-secondary em-button em-reschedule-cancel<?php if( empty($_REQUEST['reschedule']) ) echo ' reschedule-hidden'; ?>" data-target=".event-form-when-wrap"> 
     83            <?php esc_html_e('Cancel Reschedule', 'events-manager'); ?> 
     84        </a> 
     85        <a href="<?php echo esc_url(add_query_arg('reschedule', '1')); ?>" class="em-reschedule-trigger em-button button-secondary<?php if( !empty($_REQUEST['reschedule']) ) echo ' reschedule-hidden'; ?>" data-target=".event-form-when-wrap"> 
     86            <?php esc_html_e('Reschedule Recurring Event', 'events-manager'); ?> 
     87        </a> 
     88        <input type="hidden" name="event_reschedule" class="em-reschedule-value" value="<?php echo empty($_REQUEST['reschedule']) ? 0:1 ?>" /> 
     89    </div> 
     90    <?php endif; ?> 
    7891</div> 
  • events-manager/trunk/templates/forms/event/when-with-recurring.php

    r1311743 r1651260  
    66$admin_recurring = is_admin() && $EM_Event->is_recurring(); 
    77?> 
    8 <?php if( is_admin() ): ?><input type="hidden" name="_emnonce" value="<?php echo wp_create_nonce('edit_event'); ?>" /><?php endif; ?> 
    98<!-- START recurrence postbox --> 
    109<div id="em-form-with-recurrence" class="event-form-with-recurrence event-form-when"> 
  • events-manager/trunk/templates/placeholders/attendees.php

    r1234828 r1651260  
    77    <ul class="event-attendees"> 
    88    <?php 
    9     $guest_bookings = get_option('dbem_bookings_registration_disable'); 
    10     $guest_booking_user = get_option('dbem_bookings_registration_user'); 
    11     foreach( $EM_Bookings as $EM_Booking){ 
     9    foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */ 
    1210        if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){ 
    1311            $people[] = $EM_Booking->get_person()->ID; 
    1412            echo '<li>'. get_avatar($EM_Booking->get_person()->ID, 50) .'</li>'; 
    15         }elseif($EM_Booking->booking_status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){ 
     13        }elseif($EM_Booking->booking_status == 1 && $EM_Booking->is_no_user() ){ 
    1614            echo '<li>'. get_avatar($EM_Booking->get_person()->ID, 50) .'</li>'; 
    1715        } 
  • events-manager/trunk/templates/placeholders/attendeeslist.php

    r1234828 r1651260  
    77    <ul class="event-attendees"> 
    88    <?php 
    9     $guest_bookings = get_option('dbem_bookings_registration_disable'); 
    10     $guest_booking_user = get_option('dbem_bookings_registration_user'); 
    11     foreach( $EM_Bookings as $EM_Booking){ 
     9    foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */ 
    1210        if($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ){ 
    1311            $people[] = $EM_Booking->get_person()->ID; 
    1412            echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; 
    15         }elseif($EM_Booking->booking_status == 1 && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){ 
     13        }elseif($EM_Booking->booking_status == 1 && $EM_Booking->is_no_user() ){ 
    1614            echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; 
    1715        } 
  • events-manager/trunk/templates/placeholders/attendeespendinglist.php

    r1234828 r1651260  
    77    <ul class="event-attendees"> 
    88    <?php 
    9     $guest_bookings = get_option('dbem_bookings_registration_disable'); 
    10     $guest_booking_user = get_option('dbem_bookings_registration_user'); 
    119    foreach( $EM_Bookings as $EM_Booking){ /* @var $EM_Booking EM_Booking */ 
    1210        if( $EM_Booking->is_pending() && !in_array($EM_Booking->get_person()->ID, $people) ){ 
    1311            $people[] = $EM_Booking->get_person()->ID; 
    1412            echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; 
    15         }elseif( $EM_Booking->is_pending() && $guest_bookings && $EM_Booking->get_person()->ID == $guest_booking_user ){ 
     13        }elseif( $EM_Booking->is_pending() && $EM_Booking->is_no_user() ){ 
    1614            echo '<li>'. $EM_Booking->get_person()->get_name() .'</li>'; 
    1715        } 
  • events-manager/trunk/templates/tables/events.php

    r1395984 r1651260  
    1212    /* @var $limit int */ 
    1313    //add new button will only appear if called from em_event_admin template tag, or if the $show_add_new var is set 
    14     if(!empty($show_add_new) && current_user_can('edit_events')) echo '<a class="em-button button add-new-h2" href="'.em_add_get_params($_SERVER['REQUEST_URI'],array('action'=>'edit','scope'=>null,'status'=>null,'event_id'=>null, 'success'=>null)).'">'.__('Add New','events-manager').'</a>'; 
    1514    ?> 
    16     <div class="wrap"> 
    17         <?php echo $EM_Notices; ?> 
     15    <div class="em-events-admin-list"> 
     16        <?php 
     17            echo $EM_Notices; 
     18            if(!empty($show_add_new) && current_user_can('edit_events')) echo '<a class="em-button button add-new-h2" href="'.em_add_get_params($_SERVER['REQUEST_URI'],array('action'=>'edit','scope'=>null,'status'=>null,'event_id'=>null, 'success'=>null)).'">'.__('Add New','events-manager').'</a>'; 
     19        ?> 
    1820        <form id="posts-filter" action="" method="get"> 
    1921            <div class="subsubsub"> 
  • events-manager/trunk/templates/tables/locations.php

    r1311743 r1651260  
    44    if(!empty($show_add_new) && current_user_can('edit_locations')) echo '<a class="em-button button add-new-h2" href="'.em_add_get_params($_SERVER['REQUEST_URI'],array('action'=>'edit','scope'=>null,'status'=>null,'location_id'=>null)).'">'.__('Add New','events-manager').'</a>'; 
    55?> 
     6<div class="em-locations-admin-list"> 
    67<?php if(!is_admin()) echo $EM_Notices; ?>             
    78<form id='locations-filter' method='post' action=''> 
     
    9192    <?php if ( !empty($locations_nav) ) echo $locations_nav; ?> 
    9293</form> 
     94</div> 
  • events-manager/trunk/templates/templates/ical.php

    r1488912 r1651260  
    4444         
    4545        //formats 
    46         $summary = $EM_Event->output($summary_format,'ical'); 
    47         $description = $EM_Event->output($description_format,'ical'); 
    48         $location = $geo = $apple_geo = $apple_location = $apple_location_title = $categories = false; 
     46        $summary = em_mb_ical_wordwrap('SUMMARY:'.$EM_Event->output($summary_format,'ical')); 
     47        $description = em_mb_ical_wordwrap('DESCRIPTION:'.$EM_Event->output($description_format,'ical')); 
     48        $url = 'URL:'.$EM_Event->get_permalink(); 
     49        $url = wordwrap($url, 74, "\n ", true); 
     50        $location = $geo = $apple_geo = $apple_location = $apple_location_title = $apple_structured_location = $categories = false; 
    4951        if( $EM_Event->location_id ){ 
    50             $location = $EM_Event->output($location_format, 'ical'); 
     52            $location = em_mb_ical_wordwrap('LOCATION:'.$EM_Event->output($location_format, 'ical')); 
    5153            if( $EM_Event->get_location()->location_latitude || $EM_Event->get_location()->location_longitude ){ 
    52                 $geo = $EM_Event->get_location()->location_latitude.";".$EM_Event->get_location()->location_longitude; 
     54                $geo = 'GEO:'.$EM_Event->get_location()->location_latitude.";".$EM_Event->get_location()->location_longitude; 
    5355            } 
    54             $apple_location = $EM_Event->output('#_LOCATIONFULLLINE, #_LOCATIONCOUNTRY', 'ical'); 
    55             $apple_location_title = $EM_Event->get_location()->location_name; 
    56             $apple_geo = !empty($geo) ? $geo:'0,0'; 
     56            if( !defined('EM_ICAL_APPLE_STRUCT') || !EM_ICAL_APPLE_STRUCT ){ 
     57                $apple_location = $EM_Event->output('#_LOCATIONFULLLINE, #_LOCATIONCOUNTRY', 'ical'); 
     58                $apple_location_title = $EM_Event->output('#_LOCATIONNAME', 'ical'); 
     59                $apple_geo = !empty($geo) ? $EM_Event->get_location()->location_latitude.",".$EM_Event->get_location()->location_longitude:'0,0'; 
     60                $apple_structured_location = "X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS={$apple_location};X-APPLE-RADIUS=100;X-TITLE={$apple_location_title}:geo:{$apple_geo}"; 
     61                $apple_structured_location = str_replace('"', '\"', $apple_structured_location); //google chucks a wobbly with these on this line 
     62                $apple_structured_location = em_mb_ical_wordwrap($apple_structured_location); 
     63            } 
    5764        } 
    5865        $categories = array(); 
     
    6572        $UID = $EM_Event->event_id . '@' . $site_domain; 
    6673        if( is_multisite() ) $UID = absint($EM_Event->blog_id) . '-' . $UID; 
     74        $UID = wordwrap("UID:".$UID, 74, "\r\n ", true); 
    6775         
    6876//output ical item       
    69 $output = " 
    70 BEGIN:VEVENT 
    71 UID:{$UID} 
     77$output = "\r\n"."BEGIN:VEVENT 
     78{$UID} 
    7279DTSTART{$dateStart} 
    7380DTEND{$dateEnd} 
    7481DTSTAMP:{$dateModified} 
    75 URL:{$EM_Event->get_permalink()} 
    76 SUMMARY:{$summary}"; 
     82{$url} 
     83{$summary}"; 
    7784//Description if available 
    7885if( $description ){ 
    79     $output .= " 
    80 DESCRIPTION:{$description}"; 
     86    $output .= "\r\n" . $description; 
    8187} 
    8288//add featured image if exists 
    8389if( $image ){ 
     90    $image = wordwrap("ATTACH;FMTTYPE=image/jpeg:".esc_url_raw($image), 74, "\n ", true); 
    8491    $output .= " 
    85 ATTACH;FMTTYPE=image/jpeg:".esc_url_raw($image); 
     92{$image}"; 
    8693} 
    8794//add categories if there are any 
    8895if( !empty($categories) ){ 
     96    $categories = wordwrap("CATEGORIES:".implode(',', $categories), 74, "\n ", true); 
    8997    $output .= " 
    90 CATEGORIES:".implode(',', $categories); 
     98{$categories}"; 
    9199} 
    92100//Location if there is one 
    93101if( $location ){ 
    94102    $output .= " 
    95 LOCATION:{$location}"; 
     103{$location}"; 
    96104    //geo coordinates if they exist 
    97105    if( $geo ){ 
    98106    $output .= " 
    99 GEO:{$geo}"; 
     107{$geo}"; 
    100108    } 
    101109    //create apple-compatible feature for locations 
     110    if( !empty($apple_structured_location) ){ 
    102111    $output .= " 
    103 X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS={$apple_location};X-APPLE-RADIUS=100;X-TITLE={$apple_location_title}:geo:{$apple_geo}"; 
     112{$apple_structured_location}"; 
     113    } 
    104114} 
    105115//end the event 
     
    122132 
    123133//calendar footer 
    124 $output = " 
    125 END:VCALENDAR"; 
     134$output = "\r\n"."END:VCALENDAR"; 
    126135echo preg_replace("/([^\r])\n/", "$1\r\n", $output); 
Note: See TracChangeset for help on using the changeset viewer.