WordPress.org

Plugin Directory

Changeset 859129


Ignore:
Timestamp:
02/17/14 00:40:55 (19 months ago)
Author:
joedolson
Message:

Commit dev version.

Location:
my-calendar/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • my-calendar/trunk/my-calendar-api.php

    r857615 r859129  
    44function my_calendar_api() { 
    55    if ( isset( $_GET['my-calendar-api'] ) ) { 
    6         $format = ( isset( $_GET['my-calendar-api'] ) ) ? $_GET['my-calendar-api'] : 'json'; 
    7         $from = ( isset( $_GET['from'] ) ) ? $_GET['from'] : date( 'Y-m-d', current_time( 'timestamp' ) ); 
    8         $to = ( isset( $_GET['to'] ) ) ? $_GET['to'] : date( 'Y-m-d', strtotime( current_time( 'timestamp' ).apply_filters('mc_api_auto_date',' + 7 days') ) ); 
    9         $category = ( isset( $_GET['mcat'] ) ) ? $_GET['mcat'] : '' ; 
    10         $ltype = ( isset( $_GET['ltype'] ) ) ? $_GET['ltype'] : '' ; 
    11         $lvalue = ( isset( $_GET['lvalue'] ) ) ? $_GET['lvalue'] : '' ; 
    12         $author = ( isset( $_GET['author'] ) ) ? $_GET['author'] : '' ; 
    13         $host = ( isset( $_GET['host'] ) ) ? $_GET['host'] : '' ; 
    14          
    15         $data = my_calendar_events( $from, $to, $category, $ltype, $lvalue, 'api', $author, $host ); 
     6        if ( get_option( 'mc_api_enabled' ) == 'true' ) { 
     7            $format = ( isset( $_GET['my-calendar-api'] ) ) ? $_GET['my-calendar-api'] : 'json'; 
     8            $from = ( isset( $_GET['from'] ) ) ? $_GET['from'] : date( 'Y-m-d', current_time( 'timestamp' ) ); 
     9            $to = ( isset( $_GET['to'] ) ) ? $_GET['to'] : date( 'Y-m-d', strtotime( current_time( 'timestamp' ).apply_filters('mc_api_auto_date',' + 7 days') ) ); 
     10            $category = ( isset( $_GET['mcat'] ) ) ? $_GET['mcat'] : '' ; 
     11            $ltype = ( isset( $_GET['ltype'] ) ) ? $_GET['ltype'] : '' ; 
     12            $lvalue = ( isset( $_GET['lvalue'] ) ) ? $_GET['lvalue'] : '' ; 
     13            $author = ( isset( $_GET['author'] ) ) ? $_GET['author'] : '' ; 
     14            $host = ( isset( $_GET['host'] ) ) ? $_GET['host'] : '' ; 
     15             
     16            $data = my_calendar_events( $from, $to, $category, $ltype, $lvalue, 'api', $author, $host ); 
    1617 
    17         $output = mc_format_api( $data, $format ); 
    18         // if json, encode as json 
    19         // if xml, encode as xml 
    20         echo $output; 
    21         die; 
     18            $output = mc_format_api( $data, $format ); 
     19            // if json, encode as json 
     20            // if xml, encode as xml 
     21            echo $output; 
     22            die; 
     23        } else { 
     24            _e( 'The My Calendar API is not enabled.','my-calendar' ); 
     25        }            
    2226    } 
     27 
    2328} 
    2429 
  • my-calendar/trunk/my-calendar-event-manager.php

    r857615 r859129  
    88    } 
    99    if ( $action == 'edit' ) { 
    10         if ( $_POST['event_post'] == 0 ) {  
     10        if ( $_POST['event_post'] == 0 ) { 
    1111            $post_id = mc_create_event_post( $data, $event_id );  
    1212        } else { 
     
    459459                    jd_doTwitterAPIPost( stripslashes($_POST['mc_twitter']) ); 
    460460                } 
    461                 $message = "<div class='updated notice'><p>". __('Event added. It will now show on the calendar.','my-calendar') . "</p></div>"; 
     461                if ( get_option( 'mc_uri' ) != '' ) {  
     462                    $event_ids = mc_get_occurrences( $event_id ); 
     463                    $event_link = mc_build_url( array( 'mc_id'=>$event_ids[0]->occur_event_id ), array( 'page' ), get_option( 'mc_uri' ) );  
     464                } else { 
     465                    $event_link = false; 
     466                } 
     467                $message = "<div class='updated notice'><p>".__('Event added. It will now show on the calendar.','my-calendar'); 
     468                if ( $event_link !== false ) {  
     469                    $message .= sprintf( __(' <a href="%s">View Event</a>', 'my-calendar' ), $event_link ); 
     470                } 
     471                $message .= "</p></div>"; 
    462472            } 
    463473            mc_delete_cache(); 
     
    817827        <?php if ( mc_show_edit_block( 'event_link' ) ) { ?> 
    818828        <p> 
    819         <label for="event_link"><?php _e( 'URL','my-calendar' ); ?></label> <input type="text" id="event_link" name="event_link" class="input" size="40" value="<?php if ( $has_data ) { echo esc_url( $data->event_link ); } ?>" /> <input type="checkbox" value="1" id="event_link_expires" name="event_link_expires"<?php if ( $has_data && $data->event_link_expires == '1' ) { echo " checked=\"checked\""; } else if ( $has_data && $data->event_link_expires == '0' ) { echo ""; } else if ( get_option( 'mc_event_link_expires') == 'true' ) { echo " checked=\"checked\""; } ?> /> <label for="event_link_expires"><?php _e('Link will expire after event','my-calendar'); ?></label> 
     829        <label for="event_link"><?php _e( 'URL','my-calendar' ); ?></label> <input type="text" id="event_link" name="event_link" class="input" size="40" value="<?php if ( $has_data ) { echo esc_url( $data->event_link ); } ?>" /> <input type="checkbox" value="1" id="event_link_expires" name="event_link_expires"<?php if ( $has_data && $data->event_link_expires == '1' ) { echo " checked=\"checked\""; } else if ( $has_data && $data->event_link_expires == '0' ) { echo ""; } else if ( get_option( 'mc_event_link_expires') == 'true' ) { echo " checked=\"checked\""; } ?> /> <label for="event_link_expires" class=><?php _e('Link will expire after event','my-calendar'); ?></label> 
    820830        </p> 
    821831    <?php } ?> 
     
    905915            <?php } ?> 
    906916            </div> 
    907             </fieldset> 
    908         <p> 
    909             <input type="submit" name="save" class="button-primary" value="<?php _e('Save Event','my-calendar'); ?>" /> 
    910         </p>             
     917            </fieldset>          
    911918        </div> 
    912919        </div> 
     
    11771184            <?php } ?> 
    11781185        <p> 
    1179             <input type="submit" name="save" class="button-secondary" value="<?php _e('Save Event','my-calendar'); ?>" /> 
     1186            <input type="submit" name="save" class="button-primary" value="<?php _e('Save Event','my-calendar'); ?>" /> 
    11801187        </p> 
    11811188</form>  
  • my-calendar/trunk/my-calendar-events.php

    r857615 r859129  
    136136    $time = date( 'H:i:s',strtotime( $event->occur_begin ) ); 
    137137    if ( $type == 'object' ) { 
    138     return $event; 
     138        return $event; 
    139139    } else { 
    140140        $value = "  <div id='mc_event'>".my_calendar_draw_event( $event,'single',$date,$time,'single' )."</div>\n"; 
     
    152152    $result = $mcdb->get_var($sql); 
    153153    return $result; 
     154} 
     155 
     156function mc_get_occurrences( $id ) { 
     157    global $wpdb; 
     158    $id = (int) $id; 
     159    if ( $id === 0 ) { return array(); } 
     160    $sql = "SELECT * FROM ".my_calendar_event_table()." WHERE occur_event_id=$id"; 
     161    $results = $wpdb->get_results( $sql ); 
     162    return $results; 
    154163} 
    155164 
  • my-calendar/trunk/my-calendar-locations.php

    r857615 r859129  
    297297    $this_field = trim($this_field); 
    298298    $controls = get_option( 'mc_location_controls' ); 
     299    if ( !is_array( $controls ) || empty( $controls ) ) { return false; } 
    299300    $controlled = array_keys( $controls ); 
    300301    if ( in_array( 'event_'.$this_field, $controlled ) && !empty( $controls['event_'.$this_field] ) ) { 
  • my-calendar/trunk/my-calendar-settings.php

    r857615 r859129  
    177177        $clear = ''; 
    178178        $mc_event_approve = ( !empty($_POST['mc_event_approve']) && $_POST['mc_event_approve']=='on')?'true':'false'; 
     179        $mc_api_enabled = ( !empty($_POST['mc_api_enabled']) && $_POST['mc_api_enabled']=='on')?'true':'false'; 
     180         
    179181        $mc_remote = ( !empty($_POST['mc_remote']) && $_POST['mc_remote']=='on')?'true':'false'; 
    180182        if ( isset($_POST['mc_clear_cache']) && $_POST['mc_clear_cache'] == 'clear' ) { mc_delete_cache(); $clear = __('My Calendar Cache cleared','my-calendar'); } 
    181183        update_option('mc_event_approve',$mc_event_approve); 
     184        update_option('mc_api_enabled',$mc_api_enabled); 
     185         
    182186        update_option('mc_remote',$mc_remote); 
    183187        update_option('mc_default_sort',$_POST['mc_default_sort']); 
     
    419423    <h3><?php _e('My Calendar Settings','my-calendar'); ?></h3> 
    420424    <div class="inside"> 
    421     <ul class="mc-settings"> 
     425    <ul class="mc-settings checkboxes"> 
    422426        <li><a href="#my-calendar-manage"><?php _e('Management','my-calendar'); ?></a></li> 
    423427        <li><a href="#my-calendar-text"><?php _e('Customizable Text','my-calendar'); ?></a></li> 
     
    457461    <?php } ?> 
    458462    <li><?php mc_settings_field ( 'mc_event_approve', __('Enable approval options.','my-calendar'), '', '', array(), 'checkbox-single' ); ?></li> 
     463    <li><?php mc_settings_field ( 'mc_api_enabled', __('Enable external API.','my-calendar'), '', '', array(), 'checkbox-single' ); ?></li>  
    459464    <?php 
    460465    if ( apply_filters( 'mc_caching_clear', false ) ) { ?> 
  • my-calendar/trunk/readme.txt

    r857615 r859129  
    112112* New feature: filter events by available accessibility services 
    113113* New feature: Combined filter shortcode to group all filters into a single form. [mc_filters show='locations,categories,access'] 
    114 * New feature: new filter feature for adding custom fields to events. 
     114* New feature: new API for adding custom fields to events. 
    115115* New feature: data API to fetch event data in JSON or RSS formats.  
    116116* New feature: Archive events to hide from admin events list.  
     
    133133* iCal output in multiple-month view outputs all displayed months. 
    134134* {map} template tag to display a Google Map using the Google Maps API. (Not available in pop-up displays.) 
    135 * Planned removal of showkey, shownav, toggle, and showjump shortcode attributes. 
     135* Scheduled removal of showkey, shownav, toggle, and showjump shortcode attributes. 
    136136 
    137137= 2.2.13 = 
     
    11681168= This plug-in is really complicated. Why can't you personally help me figure out how to use it? = 
    11691169 
    1170 I can! Just not in person. I've written a User's Guide for My Calendar, which you can [purchase at my web site](https://www.joedolson.com/articles/my-calendar/users-guide/) for $23. ($19 if you're not interested in getting updates.) This helps defray the thousand plus hours I've spent in developing the plug-in and providing support. Please, consider buying the User's Guide or [making a donation](https://www.joedolson.com/donate.php) before asking for support! 
     1170I can! Just not in person. I've written a User's Guide for My Calendar, which you can [purchase at my web site](https://www.joedolson.com/articles/my-calendar/users-guide/) for $25. This helps defray the thousand plus hours I've spent in developing the plug-in and providing support. Please, consider buying the User's Guide or [making a donation](https://www.joedolson.com/donate.php) before asking for support! 
    11711171 
    11721172= How can my site visitors or members submit events? = 
Note: See TracChangeset for help on using the changeset viewer.