WordPress.org

Plugin Directory

Changeset 759510


Ignore:
Timestamp:
08/20/13 20:05:03 (8 months ago)
Author:
joedolson
Message:

Commit trunk version of 2.2.8; switch to trunk/tags svn repo; bug fixes; actions & filters!

Location:
my-calendar/trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • my-calendar/trunk/lang/my-calendar-sl_SI.po

    r745189 r759510  
    33msgid "" 
    44msgstr "" 
    5 "PO-Revision-Date: 2013-07-22 21:08:39+0000\n" 
     5"PO-Revision-Date: 2013-08-20 19:44:56+0000\n" 
    66"MIME-Version: 1.0\n" 
    77"Content-Type: text/plain; charset=UTF-8\n" 
     
    467467#: my-calendar-settings.php:503 
    468468msgid "Modify date and event link behaviors:" 
    469 msgstr "Spremeni obnašanje povezav datuma in dogodka:" 
     469msgstr "Spremeni vedenje povezav datuma in dogodka:" 
    470470 
    471471#: my-calendar-settings.php:516 
     
    881881#: my-calendar-behaviors.php:44 
    882882msgid "Behavior Settings saved" 
    883 msgstr "Nastavitve obnašanja shranjene" 
     883msgstr "Vedenjske nastavitve shranjene" 
    884884 
    885885#: my-calendar-behaviors.php:68 
     
    901901#: my-calendar-behaviors.php:86 
    902902msgid "Calendar Behaviors: Calendar View" 
    903 msgstr "Obnašanje koledarja: pogled koledarja" 
     903msgstr "Vedenje koledarja: pogled koledarja" 
    904904 
    905905#: my-calendar-behaviors.php:88 
     
    954954#: my-calendar-behaviors.php:118 
    955955msgid "Calendar Behaviors: List View" 
    956 msgstr "Obnašanje koledarja: pregled seznama" 
     956msgstr "Vedenje koledarja: pregled seznama" 
    957957 
    958958#: my-calendar-behaviors.php:120 
     
    962962#: my-calendar-behaviors.php:120 
    963963msgid "Disable List Javascript Effects" 
    964 msgstr "" 
     964msgstr "Onemogoči javascript efekte za sezname" 
    965965 
    966966#: my-calendar-behaviors.php:123 
    967967msgid "Edit the jQuery scripts for My Calendar in List format" 
    968 msgstr "" 
     968msgstr "Uredite jQuery skripte za format seznamov za My Calendar" 
    969969 
    970970#: my-calendar-behaviors.php:134 
    971971msgid "There have been updates to the list view scripts." 
    972 msgstr "" 
     972msgstr "Skripte za pregled seznamov so bile posodobljene." 
    973973 
    974974#: my-calendar-behaviors.php:149 
    975975msgid "Calendar Behaviors: Mini Calendar View" 
    976 msgstr "" 
     976msgstr "Vedenje koledarja: pogled majhnega koledarja" 
    977977 
    978978#: my-calendar-behaviors.php:151 
    979979msgid "Update/Reset the My Calendar Mini Format Javascript" 
    980 msgstr "" 
     980msgstr "Posodobite/resetirajte javascript formata majhnega koledarja" 
    981981 
    982982#: my-calendar-behaviors.php:151 
    983983msgid "Disable Mini Javascript Effects" 
    984 msgstr "" 
     984msgstr "Onemogoči javascript efekte majhnega koledarja" 
    985985 
    986986#: my-calendar-behaviors.php:154 
    987987msgid "Edit the jQuery scripts for My Calendar in Mini Calendar format" 
    988 msgstr "" 
     988msgstr "Uredi skripte jQuery za formate My Calendar in Mini Calendar" 
    989989 
    990990#: my-calendar-behaviors.php:165 
    991991msgid "There have been updates to the mini view scripts." 
    992 msgstr "" 
     992msgstr "Skripte za manjši pogled so bile posodobljene." 
    993993 
    994994#: my-calendar-behaviors.php:181 
    995995msgid "Calendar Behaviors: AJAX Navigation" 
    996 msgstr "" 
     996msgstr "Vedenje koledarja: AJAX navigacija" 
    997997 
    998998#: my-calendar-behaviors.php:183 
    999999msgid "Update/Reset the My Calendar AJAX Javascript" 
    1000 msgstr "" 
     1000msgstr "Posodobite/resetirajte javascript za My Calendar AJAX" 
    10011001 
    10021002#: my-calendar-behaviors.php:183 
    10031003msgid "Disable AJAX Effects" 
    1004 msgstr "" 
     1004msgstr "Onemogočite AJAX efekte" 
    10051005 
    10061006#: my-calendar-behaviors.php:186 
    10071007msgid "Edit the jQuery scripts for My Calendar AJAX navigation" 
    1008 msgstr "" 
     1008msgstr "Uredite JQuery skripte za My Calendar AJAX navigacijo" 
    10091009 
    10101010#: my-calendar-behaviors.php:197 
    10111011msgid "There have been updates to the AJAX scripts." 
    1012 msgstr "" 
     1012msgstr "AJAX skripte so bile posodobljene." 
    10131013 
    10141014#: my-calendar-behaviors.php:217 
    10151015msgid "Resetting JavaScript will set that script to the version currently distributed with the plug-in." 
    1016 msgstr "" 
     1016msgstr "Z ponastavljanjem javascript boste nastavili vse skripte na verzijo, ki je trenutno vključena v vtičnik." 
    10171017 
    10181018#: my-calendar-categories.php:109 
    10191019msgid "Category added successfully" 
    1020 msgstr "" 
     1020msgstr "Kategorija uspešno dodana" 
    10211021 
    10221022#: my-calendar-categories.php:111 
  • my-calendar/trunk/my-calendar-behaviors.php

    r714062 r759510  
    2222      update_option('mc_mini_javascript', ( empty($_POST['mini_javascript']) )?0:1 ); 
    2323      update_option('mc_ajax_javascript', ( empty($_POST['ajax_javascript']) )?0:1 ); 
    24       update_option('mc_draggable', ( empty($_POST['mc_draggable']) )?0:1 ); 
    2524      // set js 
    2625      update_option('mc_listjs',$mc_listjs); 
     
    6059     
    6160    $mc_show_js = stripcslashes(get_option('mc_show_js')); 
    62     $mc_draggable = get_option('mc_draggable'); 
    6361 
    6462  // Now we render the form 
     
    8280    <label for="mc_show_js"><?php _e('Insert scripts on these pages (comma separated post IDs)','my-calendar'); ?></label> <input type="text" id="mc_show_js" name="mc_show_js" value="<?php echo $mc_show_js; ?>" /> 
    8381    </p>   
    84     <p> 
    85     <input type="checkbox" id="mc_draggable" name="mc_draggable" value="1" <?php mc_is_checked('mc_draggable',1); ?> /> <label for="mc_draggable"><?php _e('Details boxes are draggable','my-calendar'); ?></label> 
    86     </p> 
    8782    <fieldset> 
    8883    <legend><?php _e('Calendar Behaviors: Calendar View','my-calendar'); ?></legend> 
  • my-calendar/trunk/my-calendar-categories.php

    r745189 r759510  
    7474 
    7575function my_calendar_manage_categories() { 
    76   global $wpdb; 
     76    global $wpdb; 
    7777    $mcdb = $wpdb;   
    78   $formats = array( '%s', '%s', '%s' ); 
    79   // My Calendar must be installed and upgraded before this will work 
    80   check_my_calendar(); 
     78    $formats = array( '%s', '%s', '%s' ); 
     79    // My Calendar must be installed and upgraded before this will work 
     80    check_my_calendar(); 
    8181?> 
    8282<div class="wrap jd-my-calendar"> 
    8383<?php  
    84 my_calendar_check_db(); 
    85 ?> 
    86 <?php 
    87   // We do some checking to see what we're doing 
     84    my_calendar_check_db();  
     85    // We do some checking to see what we're doing 
    8886    if ( !empty($_POST) ) { 
    8987        $nonce=$_REQUEST['_wpnonce']; 
     
    9290   
    9391    if (isset($_POST['mode']) && $_POST['mode'] == 'add') { 
    94      
    9592        $add = array( 
    9693        'category_name'=>$_POST['category_name'], 
     
    9996        'category_private'=>( (isset( $_POST['category_private'] ))?1:0 ) 
    10097        ); 
     98        // actions and filters 
     99        $add = apply_filters( 'mc_pre_add_category', $add, $_POST ); 
    101100        $results = $mcdb->insert( my_calendar_categories_table(), $add, $formats ); 
     101        do_action( 'mc_post_add_category', $add, $results, $_POST );     
     102         
    102103        if ( isset($_POST['mc_default_category']) ) { 
    103104            $cat_ID = $mcdb->insert_id; 
     
    108109            echo "<div class=\"updated\"><p><strong>".__('Category added successfully','my-calendar')." $append</strong></p></div>"; 
    109110        } else { 
    110             echo "<div class=\"updated error\"><p><strong>".__('Category addition failed.','my-calendar')."</strong></p></div>";       
     111            echo "<div class=\"updated error\"><p><strong>".__('Category addition failed.','my-calendar')."</strong></p></div>"; 
    111112        } 
    112113    } else if ( isset($_GET['mode']) && isset($_GET['category_id']) && $_GET['mode'] == 'delete' ) { 
     
    164165 
    165166function mc_edit_category_form($view='edit',$catID='') { 
    166 global $wpdb; 
     167    global $wpdb; 
    167168    $mcdb = $wpdb; 
     169    $cur_cat = false; 
    168170    if ( $catID != '' ) { 
    169171        $catID = (int) $catID;  
     
    171173        $cur_cat = $mcdb->get_row($sql); 
    172174    } 
    173 global $path, $wp_plugin_dir,$wp_plugin_url; 
     175    global $path, $wp_plugin_dir,$wp_plugin_url; 
    174176    if ( is_custom_icon() ) { 
    175177        $directory = str_replace('/my-calendar','',$wp_plugin_dir) . '/my-calendar-custom/'; 
     
    181183        $iconlist = my_dirlist($directory); 
    182184    } 
    183  
    184 ?> 
    185 <?php if ($view == 'add') { ?> 
     185    if ($view == 'add') { ?> 
    186186    <h2><?php _e('Add Category','my-calendar'); ?></h2> 
    187 <?php } else { ?> 
    188   <h2><?php _e('Edit Category','my-calendar'); ?></h2> 
    189 <?php } ?> 
     187    <?php } else { ?> 
     188    <h2><?php _e('Edit Category','my-calendar'); ?></h2> 
     189    <?php } ?> 
    190190 
    191191<div class="postbox-container" style="width: 70%"> 
     
    211211            <fieldset> 
    212212            <legend><?php if ($view == 'add') { _e('Add Category','my-calendar'); } else { _e('Edit Category','my-calendar'); } ?></legend> 
    213                 <label for="category_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="category_name" name="category_name" class="input" size="30" value="<?php if ( !empty($cur_cat) && is_object($cur_cat) ) echo stripslashes( esc_attr( $cur_cat->category_name ) ); ?>" /><br /> 
    214                 <label for="category_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="category_color" name="category_color" class="input" size="10" maxlength="7" value="<?php if ( !empty($cur_cat) &&  is_object($cur_cat) ) { echo (strpos($cur_cat->category_color,'#') !== 0)?'#':''; echo $cur_cat->category_color; } else { echo '#'; } ?>" /><br /> 
    215                 <label for="category_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="category_icon"> 
    216      
     213                <label for="cat_name"><?php _e('Category Name','my-calendar'); ?>:</label> <input type="text" id="cat_name" name="category_name" class="input" size="30" value="<?php if ( !empty($cur_cat) && is_object($cur_cat) ) echo stripslashes( esc_attr( $cur_cat->category_name ) ); ?>" /><br /> 
     214                <label for="cat_color"><?php _e('Category Color (Hex format)','my-calendar'); ?>:</label> <input type="text" id="cat_color" name="category_color" class="input" size="10" maxlength="7" value="<?php if ( !empty($cur_cat) &&  is_object($cur_cat) ) { echo (strpos($cur_cat->category_color,'#') !== 0)?'#':''; echo $cur_cat->category_color; } else { echo '#'; } ?>" /><br /> 
     215                <label for="cat_icon"><?php _e('Category Icon','my-calendar'); ?>:</label> <select name="category_icon" id="cat_icon"> 
    217216        <?php 
    218217        foreach ($iconlist as $value) { 
     
    224223            echo "<option value='$value'$selected style='background: url(".str_replace('my-calendar/','',$wp_plugin_url)."$path/$value) left 50% no-repeat;'>$value</option>"; 
    225224        } 
    226         ?>           
     225        ?> 
    227226                    </select> 
    228227                    <?php $checked = ( $view == 'add' )?'':mc_is_checked( 'mc_default_category',$cur_cat->category_id,'',true); ?> 
    229228                    <input type="checkbox" value="on" name="mc_default_category" id="mc_default_category"<?php echo $checked; ?> /> <label for="mc_default_category"><?php _e('Default category','my-calendar'); ?></label> 
    230                     <?php if ( $view == 'add' ) { $checked = ''; } else { if ( !empty($cur_cat) &&  is_object($cur_cat) && $cur_cat->category_private == 1 ) { $checked=' checked="checked"'; } else { $checked = ''; } } ?> 
    231                     <p><input type="checkbox" value="on" name="category_private" id="category_private"<?php echo $checked; ?> /> <label for="category_private"><?php _e('Private category (logged-in users only)','my-calendar'); ?></label></p> 
    232                      
     229                    <?php if ( $view == 'add' ) { $checked = ''; } else { if ( !empty($cur_cat) && is_object($cur_cat) && $cur_cat->category_private == 1 ) { $checked=' checked="checked"'; } else { $checked = ''; } } ?> 
     230                    <p><input type="checkbox" value="on" name="category_private" id="category_private"<?php echo $checked; ?> /> <label for="cat_private"><?php _e('Private category (logged-in users only)','my-calendar'); ?></label></p> 
    233231                </fieldset> 
    234232                <p> 
    235233                    <input type="submit" name="save" class="button-primary" value="<?php if ($view == 'add') {  _e('Add Category','my-calendar'); } else { _e('Save Changes','my-calendar'); } ?> &raquo;" /> 
    236234                </p> 
     235                <?php do_action( 'mc_post_category_form', $cur_cat, $view ); ?> 
    237236        </form> 
    238237    </div> 
     
    242241<p><a href="<?php echo admin_url('admin.php?page=my-calendar-categories'); ?>"><?php _e('Add a New Category','my-calendar'); ?> &raquo;</a></p> 
    243242<?php } ?> 
    244  
    245 <div class="ui-sortable meta-box-sortables"> 
    246 <div class="postbox"> 
    247 <h3><?php _e('Category List','my-calendar'); ?></h3> 
    248     <div class="inside">     
    249 <?php mc_manage_categories(); ?> 
    250     </div> 
     243    <div class="ui-sortable meta-box-sortables"> 
     244        <div class="postbox"> 
     245            <h3><?php _e('Category List','my-calendar'); ?></h3> 
     246            <div class="inside">     
     247                <?php mc_manage_categories(); ?> 
     248            </div> 
     249        </div> 
    251250    </div> 
    252251</div> 
    253  
    254252</div> 
    255 </div> 
    256     <?php jd_show_support_box(); ?> 
    257  
    258 <?php 
     253    <?php jd_show_support_box(); 
    259254} 
    260255 
     
    273268    // We pull the categories from the database  
    274269    $categories = $mcdb->get_results("SELECT * FROM " . my_calendar_categories_table() . " ORDER BY $cat_order ASC"); 
    275  
    276     if ( !empty($categories) ) { 
    277 ?> 
     270    if ( !empty($categories) ) { ?> 
    278271    <table class="widefat page fixed" id="my-calendar-admin-table"> 
    279     <thead>  
     272    <thead> 
    280273        <tr> 
    281274            <th class="manage-column" scope="col"><?php echo ($co==2)?"<a href='".admin_url("admin.php?page=my-calendar-categories&amp;co=1")."'>":''; ?><?php _e('ID','my-calendar') ?><?php echo ($co==2)?'</a>':''; ?></th> 
     
    288281        </tr> 
    289282    </thead> 
    290        <?php 
    291        $class = ''; 
    292        foreach ( $categories as $category ) { 
    293        $class = ($class == 'alternate') ? '' : 'alternate'; 
    294        $default = ( $category->category_id == get_option('mc_default_category') )?' default':''; 
    295            ?> 
    296         <tr class="<?php echo $class.$default; ?>"> 
    297         <th scope="row"><?php echo $category->category_id; ?></th> 
    298         <td><?php echo stripslashes( esc_attr( $category->category_name ) ); ?></td> 
    299         <td style="background-color:<?php echo (strpos($category->category_color,'#') !== 0)?'#':''; echo $category->category_color; ?>;">&nbsp;</td> 
    300         <td style="background-color:<?php echo (strpos($category->category_color,'#') !== 0)?'#':''; echo $category->category_color; ?>;"><img src="<?php echo str_replace('my-calendar/','',$wp_plugin_url). $path; ?>/<?php echo stripslashes( esc_attr( $category->category_icon ) ); ?>" alt="" /></td>       
    301         <td><?php echo ( $category->category_private == 1 )?__('Yes','my-calendar'):__('No','my-calendar'); ?></td> 
    302         <td><a href="<?php echo admin_url("admin.php?page=my-calendar-categories&amp;mode=edit&amp;category_id=$category->category_id"); ?>" class='edit'><?php _e('Edit','my-calendar'); ?></a></td> 
    303          <?php 
    304                if ($category->category_id == 1) { 
    305                     echo '<td>'.__('N/A','my-calendar').'</td>'; 
    306                } else { 
    307                    ?> 
    308                    <td><a href="<?php echo admin_url("admin.php?page=my-calendar-categories&amp;mode=delete&amp;category_id=$category->category_id"); ?>" class="delete" onclick="return confirm('<?php _e('Are you sure you want to delete this category?','my-calendar'); ?>')"><?php _e('Delete','my-calendar'); ?></a></td> 
    309                    <?php 
    310                } 
    311         ?> 
    312               </tr> 
    313                 <?php 
    314           } 
     283        <?php 
     284        $class = ''; 
     285        foreach ( $categories as $category ) { 
     286            $class = ($class == 'alternate') ? '' : 'alternate'; 
     287            $default = ( $category->category_id == get_option('mc_default_category') )?' default':''; 
     288            ?> 
     289            <tr class="<?php echo $class.$default; ?>"> 
     290            <th scope="row"><?php echo $category->category_id; ?></th> 
     291            <td><?php echo stripslashes( esc_attr( $category->category_name ) ); ?></td> 
     292            <td style="background-color:<?php echo (strpos($category->category_color,'#') !== 0)?'#':''; echo $category->category_color; ?>;">&nbsp;</td> 
     293            <td style="background-color:<?php echo (strpos($category->category_color,'#') !== 0)?'#':''; echo $category->category_color; ?>;"><img src="<?php echo str_replace('my-calendar/','',$wp_plugin_url). $path; ?>/<?php echo stripslashes( esc_attr( $category->category_icon ) ); ?>" alt="" /></td>       
     294            <td><?php echo ( $category->category_private == 1 )?__('Yes','my-calendar'):__('No','my-calendar'); ?></td> 
     295            <td><a href="<?php echo admin_url("admin.php?page=my-calendar-categories&amp;mode=edit&amp;category_id=$category->category_id"); ?>" class='edit'><?php _e('Edit','my-calendar'); ?></a></td> 
     296            <?php 
     297            if ($category->category_id == 1) { 
     298                echo '<td>'.__('N/A','my-calendar').'</td>'; 
     299            } else { ?> 
     300                <td><a href="<?php echo admin_url("admin.php?page=my-calendar-categories&amp;mode=delete&amp;category_id=$category->category_id"); ?>" class="delete" onclick="return confirm('<?php _e('Are you sure you want to delete this category?','my-calendar'); ?>')"><?php _e('Delete','my-calendar'); ?></a></td> 
     301            <?php 
     302            }  ?> 
     303            </tr> 
     304            <?php 
     305        } 
    315306      ?> 
    316307      </table> 
    317308      <?php 
    318    } else { 
    319      echo '<p>'.__('There are no categories in the database - something has gone wrong!','my-calendar').'</p>'; 
    320    } 
    321 ?> 
    322 <?php 
    323 } 
     309    } else { 
     310        echo '<p>'.__('There are no categories in the database - or something has gone wrong!','my-calendar').'</p>'; 
     311    } 
     312} 
  • my-calendar/trunk/my-calendar-core.php

    r745189 r759510  
    55    global $wp_rewrite, $wpdb; 
    66    $mcdb = $wpdb; 
     7    $changed = get_option( 'mc_modified_feeds' ); 
    78    if ( get_option('mc_show_rss') == 'true' ) { 
    89        add_feed( 'my-calendar-rss', 'my_calendar_rss' ); 
     
    1314    if ( get_option('mc_show_print') == 'true' ) { 
    1415        add_feed( 'my-calendar-print', 'my_calendar_print' ); 
    15     }    
     16    } 
     17    if ( $changed['prev'] != $changed['curr'] ) { flush_rewrite_rules(); update_option( 'mc_modified_feeds', array( 'prev'=>$changed['curr'], 'curr'=>$changed['curr'] ) ); } 
    1618} 
    1719 
     
    110112  global $wpdb, $wp_query; 
    111113    $mcdb = $wpdb; 
     114    $array = array(); 
    112115  // If the calendar isn't installed or upgraded this won't work 
    113116  check_my_calendar(); 
     
    123126        }  
    124127        if ( get_option( 'mc_show_css' ) != '' ) { 
    125         $array = explode( ",",get_option( 'mc_show_css' ) ); 
    126             if (!is_array($array)) { 
    127                 $array = array(); 
    128             } 
     128            $array = explode( ",",get_option( 'mc_show_css' ) ); 
    129129        } 
    130130        if ( @in_array( $id, $array ) || get_option( 'mc_show_css' ) == '' ) { 
     
    529529        switch ($upgrade) { 
    530530        // only upgrade db on most recent version 
     531            case '2.2.8': 
     532                delete_option( 'mc_draggable' ); 
     533                break; 
    531534            case '2.2.6': 
    532535                delete_option( 'mc_caching_enabled' ); // remove caching support via options. Filter only. 
     
    574577                update_option( 'mc_week_caption',"The week's events" ); 
    575578                update_option( 'mc_show_print','false' ); 
    576                 break; 
    577             case '1.9.3': 
    578                 update_option( 'mc_draggable', 0 ); 
    579579                break; 
    580580            case '1.9.1': 
     
    955955function my_calendar_fouc() { 
    956956global $wp_query; 
     957    $array = array(); 
    957958    if ( get_option('mc_calendar_javascript') != 1 || get_option('mc_list_javascript') != 1 || get_option('mc_mini_javascript') != 1 ) { 
    958959        $scripting = "\n<script type='text/javascript'>\n"; 
     
    967968            } 
    968969            if ( get_option( 'mc_show_js' ) != '' ) { 
    969             $array = explode( ",",get_option( 'mc_show_js' ) ); 
    970                 if ( !is_array( $array ) ) { 
    971                     $array = array(); 
    972                 } 
     970                $array = explode( ",",get_option( 'mc_show_js' ) ); 
    973971            } 
    974972            if ( @in_array( $id, $array ) || trim ( get_option( 'mc_show_js' ) ) == '' ) { 
     
    10471045     
    10481046    if ( current_user_can( 'mc_manage_events' ) ) { 
    1049             return true; 
    1050         } elseif ( $user_ID == $author_id ) { 
    1051             return true; 
    1052         } else { 
    1053             return false; 
    1054         } 
     1047        $return = true; 
     1048    } elseif ( $user_ID == $author_id ) { 
     1049        $return = true; 
     1050    } else { 
     1051        $return = false; 
     1052    } 
     1053    return apply_filters( 'mc_can_edit_event', $return, $author_id );    
    10551054} 
    10561055 
     
    10881087        $url = admin_url('admin.php?page=my-calendar'); 
    10891088        $args = array( 'id'=>'my-calendar','title'=>__('Add Event','my-calendar'),'href'=>$url ); 
    1090         $wp_admin_bar->add_menu($args); 
     1089        $wp_admin_bar->add_node($args); 
    10911090    } 
    10921091} 
    10931092 
    10941093// functions to route db queries 
    1095  
    10961094function my_calendar_table() { 
    10971095    $option = (int) get_site_option('mc_multisite'); 
     
    11571155 
    11581156// checks submitted events against akismet, if available, otherwise just returns false  
    1159 function mc_akismet( $event_url='', $description='' ) { 
    1160     global $akismet_api_host, $akismet_api_port, $user; 
     1157function mc_spam( $event_url='', $description='', $post=array() ) { 
     1158    global $akismet_api_host, $akismet_api_port, $current_user; 
     1159    get_currentuserinfo(); 
    11611160    if ( current_user_can( 'mc_manage_events' ) ) { // is a privileged user 
    11621161        return 0; 
    11631162    }  
     1163    $bs = $akismet = false; 
    11641164    $c = array(); 
     1165    // check for Akismet 
    11651166    if ( ! function_exists( 'akismet_http_post' ) || ! ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) ) { 
    1166         return 0; 
    1167     } 
    1168  
    1169     $c['blog'] = get_option( 'home' ); 
    1170     $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); 
    1171     $c['user_agent'] = $_SERVER['HTTP_USER_AGENT']; 
    1172     $c['referrer'] = $_SERVER['HTTP_REFERER']; 
    1173     $c['comment_type'] = 'my_calendar_event'; 
    1174     if ( $permalink = get_permalink() ) 
    1175         $c['permalink'] = $permalink; 
    1176          
    1177     if ( '' != $event_url ) 
    1178         $c['comment_author_url'] = $event_url; 
    1179     if ( '' != $description ) 
    1180         $c['comment_content'] = $description; 
    1181  
    1182     $ignore = array( 'HTTP_COOKIE' ); 
    1183  
    1184     foreach ( $_SERVER as $key => $value ) 
    1185         if ( ! in_array( $key, (array) $ignore ) ) 
    1186             $c["$key"] = $value; 
    1187  
    1188     $query_string = ''; 
    1189     foreach ( $c as $key => $data ) 
    1190         $query_string .= $key . '=' . urlencode( stripslashes( (string) $data ) ) . '&'; 
    1191  
    1192     $response = akismet_http_post( $query_string, $akismet_api_host, 
    1193         '/1.1/comment-check', $akismet_api_port ); 
    1194     if ( 'true' == $response[1] ) 
    1195         return 1; 
    1196     else 
    1197         return 0; 
     1167        // check for BotSmasher 
     1168        $bs = get_option( 'bs_options' ); 
     1169        if ( is_array( $bs ) ) { 
     1170            $bskey = $bs['bs_api_key']; 
     1171        } else { 
     1172            $bskey = ''; 
     1173        } 
     1174        if ( !function_exists( 'bs_checker' ) || $bskey == '' ) { 
     1175            return 0; // if neither exist 
     1176        } else { 
     1177            $bs = true; 
     1178        } 
     1179    } else { 
     1180        $akismet = true; 
     1181    } 
     1182    if ( $akismet ) { 
     1183        $c['blog'] = get_option( 'home' ); 
     1184        $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); 
     1185        $c['user_agent'] = $_SERVER['HTTP_USER_AGENT']; 
     1186        $c['referrer'] = $_SERVER['HTTP_REFERER']; 
     1187        $c['comment_type'] = 'my_calendar_event'; 
     1188        if ( $permalink = get_permalink() ) { $c['permalink'] = $permalink; } 
     1189        if ( '' != $event_url ) { $c['comment_author_url'] = $event_url; } 
     1190        if ( '' != $description ) { $c['comment_content'] = $description; } 
     1191        $ignore = array( 'HTTP_COOKIE' ); 
     1192 
     1193        foreach ( $_SERVER as $key => $value ) { 
     1194            if ( ! in_array( $key, (array) $ignore ) ) { $c["$key"] = $value; } 
     1195        } 
     1196        $query_string = ''; 
     1197        foreach ( $c as $key => $data ) { 
     1198            $query_string .= $key . '=' . urlencode( stripslashes( (string) $data ) ) . '&'; 
     1199        } 
     1200        $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port ); 
     1201        if ( 'true' == $response[1] ) { return 1; } else {return 0; } 
     1202    } 
     1203    if ( $bs ) { 
     1204        if ( is_user_logged_in() ) { 
     1205            $name = $current_user->user_login; 
     1206            $email = $current_user->user_email; 
     1207        } else { 
     1208            $name = $post['mcs_name']; 
     1209            $email = $post['mcs_email']; 
     1210        } 
     1211        $args = array(  
     1212            'ip'=>preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ),  
     1213            'email'=> $email,  
     1214            'name'=> $name,  
     1215            'action'=>'check' 
     1216        ); 
     1217        $args['ip'] = "216.152.251.41"; 
     1218        $response = bs_checker( $args ); 
     1219        if ( $response ) { return 1; } else { return 0; } 
     1220    } 
     1221    return 0; 
    11981222} 
    11991223 
     
    12251249function mc_addbuttons() { 
    12261250    global $mc_version; 
    1227     if (!current_user_can('edit_posts') && !current_user_can('edit_pages') ) { 
    1228         return; 
    1229     } 
     1251    if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) { return; } 
    12301252    if ( get_user_option('rich_editing') == 'true') { 
    12311253        add_filter( 'tiny_mce_version', 'mc_tiny_mce_version', 0 ); 
     
    12341256    } 
    12351257    // Register Hooks 
    1236     if (is_admin()) {    
     1258    if (is_admin()) { 
    12371259        // Add Quicktag 
    12381260        add_action( 'edit_form_advanced', 'mc_add_quicktags' ); 
  • my-calendar/trunk/my-calendar-event-manager.php

    r745189 r759510  
    126126        $sql .= ')'; 
    127127        $result = $mcdb->query($sql); 
    128         if ( $result !== 0 && $result !== false ) { 
     128        if ( $result == 0 || $result == false ) { 
     129            $message = "<div class='error'><p><strong>".__('Error','my-calendar').":</strong>".__('Your events have not been approved. Please investigate.','my-calendar')."</p></div>"; 
     130        } else { 
    129131            mc_delete_cache(); 
    130132            // argument: array of event IDs 
    131133            do_action( 'mc_mass_approve_events', $approved );        
    132134            $message = "<div class='updated'><p>".sprintf(__('%1$d events approved successfully out of %2$d selected','my-calendar'), $i, $total )."</p></div>"; 
    133         } else { 
    134             $message = "<div class='error'><p><strong>".__('Error','my-calendar').":</strong>".__('Your events have not been approved. Please investigate.','my-calendar')."</p></div>"; 
    135135        } 
    136136        echo $message; 
     
    289289    if ( ( $action == 'add' || $action == 'copy' ) && $proceed == true ) { 
    290290        $add = $output[2]; // add format here 
     291        $add = apply_filters( 'mc_before_save_insert', $add ); 
    291292        $result = $mcdb->insert(  
    292293                my_calendar_table(),  
     
    301302        } else { 
    302303            // do an action using the $action and processed event data 
    303             do_action( 'mc_save_event', $action, $add );                 
     304            $data = $add; 
     305            do_action( 'mc_save_event', $action, $data, $new_event );                
    304306            // Call mail function 
    305307            if ( get_option('mc_event_mail') == 'true' ) {               
     
    323325        if ( mc_can_edit_event( $event_author ) ) {  
    324326            $update = $output[2]; 
     327            $update = apply_filters( 'mc_before_save_update', $update, $event_id ); 
    325328            $date_changed = (  
    326329                    $update['event_begin'] != $_POST['prev_event_begin'] ||  
     
    377380                } else { 
    378381                    // do an action using the $action and processed event data 
    379                     do_action( 'mc_save_event', $action, $update );  
     382                    $data = $update; 
     383                    do_action( 'mc_save_event', $action, $data, $event_id );     
    380384                    do_action( 'mc_transition_event', (int) $_POST['prev_event_status'], (int) $_POST['event_approved'] ); 
    381385                    $message = "<div class='updated'><p>".__('Event updated successfully','my-calendar').".$url</p></div>"; 
     
    578582            <p> 
    579583            <label for='mc_twitter'><?php _e('Post to Twitter (via WP to Twitter)','my-calendar'); ?></label><br /> 
    580             <textarea cols='70' rows='2' id='mc_twitter' name='mc_twitter'></textarea> 
     584            <textarea cols='70' rows='2' id='mc_twitter' name='mc_twitter'><?php do_action( 'mc_twitter_text', $data ); ?></textarea> 
    581585            </p> 
    582586            <?php } ?> 
     
    765769            <input type="hidden" name="prev_event_repeats" value="<?php echo $data->event_repeats; ?>" /> 
    766770            <input type="hidden" name="prev_event_recur" value="<?php echo $data->event_recur; ?>" /> 
    767             <?php } ?> 
     771            <?php } else { 
     772                $recur = $every = false; 
     773            } ?> 
    768774            <fieldset> 
    769775            <legend><?php _e('Recurring Events','my-calendar'); ?></legend>  
     
    799805<div class="inside"> 
    800806            <fieldset> 
    801             <legend><?php _e('Event Registration Status','my-calendar'); ?></legend> 
    802             <p><em><?php _e('My Calendar does not manage event registrations. Use this for information only.','my-calendar'); ?></em></p> 
    803             <p> 
    804             <input type="radio" id="event_open" name="event_open" value="1" <?php if ($has_data) { echo jd_option_selected( $data->event_open,'1'); } ?> /> <label for="event_open"><?php _e('Open','my-calendar'); ?></label>  
    805             <input type="radio" id="event_closed" name="event_open" value="0" <?php if ($has_data) {  echo jd_option_selected( $data->event_open,'0'); } ?> /> <label for="event_closed"><?php _e('Closed','my-calendar'); ?></label> 
    806             <input type="radio" id="event_none" name="event_open" value="2" <?php if ($has_data) { echo jd_option_selected( $data->event_open, '2' ); } else { echo " checked='checked'"; } ?> /> <label for="event_none"><?php _e('Does not apply','my-calendar'); ?></label>   
    807             </p>     
    808             <p> 
    809             <input type="checkbox" name="event_group" id="event_group" <?php if ( $has_data ) { echo jd_option_selected( $data->event_group,'1'); } ?> /> <label for="event_group"><?php _e('If this event recurs, it can only be registered for as a complete series.','my-calendar'); ?></label> 
    810             </p>                 
     807            <legend><?php _e('Event Registration','my-calendar'); ?></legend> 
     808            <?php // need to add filters/actions to replace this. ?> 
     809            <?php do_action( 'mc_event_registration', $has_data, $data ); ?>         
    811810            </fieldset> 
    812811</div> 
     
    10471046    $items = $found_rows[0]; 
    10481047    ?> 
    1049         <?php if ( function_exists( 'akismet_http_post' ) ) { ?> 
     1048        <?php if ( function_exists( 'akismet_http_post' ) || function_exists( 'bs_checker' ) ) { ?> 
    10501049        <ul class="links"> 
    10511050            <li><a <?php echo ( isset($_GET['restrict']) && $_GET['restrict']=='flagged')?' class="active-link"':''; ?>  href="<?php echo admin_url('admin.php?page=my-calendar-manage&amp;restrict=flagged&amp;filter=1'); ?>"><?php _e('Spam','my-calendar'); ?></a></li> 
     
    11441143                            <?php if ( $event->event_approved == '1' )  { $mo = 'reject'; $te = __('Reject','my-calendar'); } else { $mo = 'publish'; $te = __('Approve','my-calendar'); } ?> 
    11451144                                <a href="<?php echo admin_url("admin.php?page=my-calendar-manage&amp;mode=$mo&amp;event_id=$event->event_id"); ?>" class='<?php echo $mo; ?>'><?php echo $te; ?></a> 
    1146                         <?php } else { ?> 
    1147                             <?php   // by Roland  
    1148                             if ( $event->event_approved == '1' )  {  
    1149                                 _e('Approved','my-calendar'); 
    1150                             } else if ($event->event_approved == '2' ) {  
    1151                                 _e('Rejected','my-calendar'); 
    1152                             } else {  
    1153                                 _e('Awaiting Approval','my-calendar');  
    1154                             }  
     1145                        <?php  
     1146                        } else {  
     1147                            switch( $event->event_approved ) { 
     1148                                case 1: _e('Approved','my-calendar'); break; 
     1149                                case 2: _e('Rejected','my-calendar'); break; 
     1150                                default: _e('Awaiting Approval','my-calendar');  
     1151                            } 
    11551152                        }  
    11561153                    } ?>     
     
    12141211        } 
    12151212*/ 
    1216     } else { 
    1217 ?> 
    1218         <p><?php _e("There are no events in the database meeting your current criteria.",'my-calendar') ?></p> 
    1219 <?php    
    1220     } 
    1221     } 
    1222 } 
    1223  
    1224 function mc_check_data($action,$post, $i) { 
     1213    } else { ?> 
     1214        <p><?php _e("There are no events in the database meeting your current criteria.",'my-calendar') ?></p><?php  
     1215    } 
     1216    } 
     1217} 
     1218 
     1219function mc_check_data( $action, $post, $i ) { 
     1220    $post = apply_filters( 'mc_pre_checkdata', $post, $action, $i ); 
    12251221    global $wpdb, $current_user, $users_entries; 
    12261222    $mcdb = $wpdb; 
     
    14461442                'event_approved'=>$approved, 
    14471443                'event_host'=>$host, 
    1448                 'event_flagged'=> mc_akismet( $linky, $desc ), 
     1444                'event_flagged'=> mc_spam( $linky, $desc, $post ), 
    14491445                'event_fifth_week'=>$event_fifth_week, 
    14501446                'event_holiday'=>$event_holiday, 
     
    14971493            $proceed = false; 
    14981494        } 
    1499     $data = array($proceed, $users_entries, $submit,$errors); 
     1495    $data = array($proceed, $users_entries, $submit, $errors ); 
    15001496 
    15011497    return $data; 
     
    15201516 
    15211517/* Event editing utilities */ 
    1522  
    15231518function mc_compare( $update, $id ) { 
    15241519    $event = mc_get_event_core( $id ); 
     
    15261521    //$comparison_test = array(); 
    15271522    foreach ( $update as $k=>$v ) { 
    1528         // event_recur and event_repeats always get set to single and 0; event_begin and event_end need to be checked elsewhere. 
     1523        // event_recur and event_repeats always set to single and 0; event_begin and event_end need to be checked elsewhere. 
    15291524        if ( $k != 'event_recur' && $k != 'event_repeats' && $k != 'event_begin' && $k != 'event_end' ) { 
    15301525            $update_string .= trim($v); 
     
    16661661    } 
    16671662} 
     1663 
     1664add_action( 'mc_event_registration', 'mc_standard_event', 10, 2 ); 
     1665function mc_standard_event( $has_data, $data ) { 
     1666    $form = " 
     1667            <p><em>".__('My Calendar does not manage event registrations. Use this for information only.','my-calendar')."</em></p> 
     1668            <p> 
     1669            <input type='radio' id='event_open' name='event_open' value='1'"; 
     1670        if ($has_data) { $form .= jd_option_selected( $data->event_open,'1'); } 
     1671    $form .= "/> <label for='event_open'>".__('Open','my-calendar')."</label>  
     1672            <input type='radio' id='event_closed' name='event_open' value='0'"; 
     1673        if ($has_data) {  $form .= jd_option_selected( $data->event_open,'0'); } 
     1674    $form .= "/> <label for='event_closed'>".__('Closed','my-calendar')."</label> 
     1675            <input type='radio' id='event_none' name='event_open' value='2'"; 
     1676        if ($has_data) {  
     1677            $form .= jd_option_selected( $data->event_open, '2' );  
     1678        } else {  
     1679            $form .= " checked='checked'";  
     1680        } 
     1681    $form .= "/> <label for='event_none'>".__('Does not apply','my-calendar')."</label>  
     1682            </p>     
     1683            <p> 
     1684            <input type='checkbox' name='event_group' id='event_group'"; 
     1685        if ( $has_data ) { $form .= jd_option_selected( $data->event_group,'1'); } 
     1686    $form .= "/> <label for='event_group'>".__('If this event recurs, it can only be registered for as a complete series.','my-calendar')."</label> 
     1687            </p>"; 
     1688    echo apply_filters( 'mc_event_registration_form', $form, $has_data, $data ); 
     1689} 
  • my-calendar/trunk/my-calendar-export.php

    r714062 r759510  
    4545END:VEVENT 
    4646END:VCALENDAR"; 
     47    $template = apply_filters( 'mc_single_ical_template', $template, $array ); 
    4748    $output = jd_draw_template($array, $template); 
    4849    return $output; 
  • my-calendar/trunk/my-calendar-group-manager.php

    r714062 r759510  
    5656                    $message = "<div class='error'><p><strong>".__('Error','my-calendar').":</strong>".__('Event not updated.','my-calendar')."$url</p></div>"; 
    5757                } else if ( $result === 0 ) { 
    58                     $message = "<div class='updated'><p>".__('Nothing was changed in that update.','my-calendar')."$url</p></div>"; 
     58                    $message = "<div class='updated'><p>#$event_id: ".__('Nothing was changed in that update.','my-calendar')."$url</p></div>"; 
    5959                } else { 
    60                     $message = "<div class='updated'><p>".__('Event updated successfully','my-calendar').".$url</p></div>"; 
     60                    $message = "<div class='updated'><p>#$event_id: ".__('Event updated successfully','my-calendar').".$url</p></div>"; 
    6161                } 
    6262        } 
     
    8282                    $message = "<div class='error'><p><strong>".__('Error','my-calendar').":</strong>".__('Event not grouped.','my-calendar')."</p></div>"; 
    8383                } else if ( $result === 0 ) { 
    84                     $message = "<div class='updated'><p>".__('Nothing was changed in that update.','my-calendar')."</p></div>"; 
     84                    $message = "<div class='updated'><p>#$event_id: ".__('Nothing was changed in that update.','my-calendar')."</p></div>"; 
    8585                } else { 
    86                     $message = "<div class='updated'><p>".__('Event grouped successfully','my-calendar')."</p></div>"; 
     86                    $message = "<div class='updated'><p>#$event_id: ".__('Event grouped successfully','my-calendar')."</p></div>"; 
    8787                } 
    8888        }    
     
    143143        if ( mc_can_edit_event( $event_author ) ) {  
    144144            $update = $output[2]; 
     145            $update = apply_filters( 'mc_update_group_data', $update, $event_author, $action, $event_id ); 
    145146            $formats = array(  
    146147                        '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', 
     
    157158            //$mcdb->print_error(); 
    158159            $url = ( get_option('mc_uri') != '' )?' '.sprintf(__('View <a href="%s">your calendar</a>.','my-calendar'),get_option('mc_uri') ):''; 
     160                do_action( 'mc_save_grouped_events', $result, $event_id, $update ); 
    159161                if ( $result === false ) { 
    160                     $message = "<div class='error'><p><strong>".__('Error','my-calendar').":</strong>".__('Your event was not updated.','my-calendar')."$url</p></div>"; 
     162                    $message = "<div class='error'><p><strong>#$event_id; ".__('Error','my-calendar').":</strong>".__('Your event was not updated.','my-calendar')."$url</p></div>"; 
    161163                } else if ( $result === 0 ) { 
    162                     $message = "<div class='updated'><p>".__('Nothing was changed in that update.','my-calendar')."$url</p></div>"; 
     164                    $message = "<div class='updated'><p>#$event_id: ".__('Nothing was changed in that update.','my-calendar')."$url</p></div>"; 
    163165                } else { 
    164                     $message = "<div class='updated'><p>".__('Event updated successfully','my-calendar').".$url</p></div>"; 
     166                    $message = "<div class='updated'><p>#$event_id: ".__('Event updated successfully','my-calendar').".$url</p></div>"; 
    165167                    mc_delete_cache(); 
    166168                } 
    167169        } else { 
    168             $message = "<div class='error'><p><strong>".__('You do not have sufficient permissions to edit that event.','my-calendar')."</strong></p></div>"; 
     170            $message = "<div class='error'><p><strong>#$event_id: ".__('You do not have sufficient permissions to edit that event.','my-calendar')."</strong></p></div>"; 
    169171        }            
    170172    } 
     
    521523 
    522524function mc_check_group_data( $action,$post ) { 
     525    $post = apply_filters( 'mc_groups_pre_checkdata', $post, $action ); 
    523526    global $wpdb, $current_user, $users_entries; 
    524527    $mcdb = $wpdb; 
  • my-calendar/trunk/my-calendar-help.php

    r745189 r759510  
    1313    <h3><?php _e('My Calendar Help','my-calendar'); ?></h3> 
    1414    <div class="inside"> 
     15    <?php do_action( 'mc_before_help' ); ?> 
    1516    <ul class="mc-settings"> 
    1617        <li><a href="#mc-shortcodes"><?php _e('Shortcodes','my-calendar'); ?></a></li> 
     
    330331        <dd><?php _e('Produces the hex code for the current event\'s category color.','my-calendar'); ?></dd> 
    331332 
    332         <dt><code>{category_id}</code></dt> 
     333        <dt><code>{cat_id}</code></dt> 
    333334        <dd><?php _e('Displays the ID for 
    334335         the category the event is in.','my-calendar'); ?></dd> 
     
    345346 
    346347        </dl> 
    347  
     348        <?php do_action( 'mc_after_help' ); ?> 
    348349        </div> 
    349350    </div> 
     
    351352 
    352353<div class="ui-sortable meta-box-sortables" id="get-support"> 
    353 <div class="postbox"> 
    354 <h3 id="support"><?php _e('Get Plug-in Support','my-calendar'); ?></h3> 
    355     <div class="inside"> 
    356     <?php if ( current_user_can('administrator') ) { ?> 
    357         <?php jcd_get_support_form(); ?> 
    358     <?php } else { ?> 
    359         <?php _e('My Calendar support requests can only be sent by administrators.','my-calendar'); ?> 
    360     <?php } ?>   
    361     </div> 
    362 </div> 
    363          
    364 <div class="ui-sortable meta-box-sortables" id="notes"> 
    365 <div class="postbox"> 
    366 <h3 id="help"><?php _e('Helpful Information','my-calendar'); ?></h3> 
    367     <div class="inside"> 
    368     <p> 
    369     <?php _e('<strong>Uninstalling the plugin</strong>: Although the WordPress standard and expectation is for plug-ins to delete any custom database tables when they\'re uninstalled, My Calendar <em>does not do this</em>. This was a conscious decision on my part -- the data stored in your My Calendar tables is yours; with the sole exception of the "General" category, you added every piece of it yourself. As such, I feel it would be a major disservice to you to delete this information if you uninstall the plug-in. As a result, if you wish to get rid of the plug-in completely, you\'ll need to remove those tables yourself. All your My Calendar settings will be deleted, however.','my-calendar'); ?> 
    370     </p> 
    371     <p> 
    372     <?php _e('<strong>Donations</strong>: I appreciate anything you can give. $2 may not seem like much, but it can really add up when thousands of people are using the software. Please note that I am not a non-profit organization, and your gifts are not tax deductible. Thank you!','my-calendar'); ?> 
    373     </p> 
    374     </div> 
    375 </div> 
    376 </div> 
     354    <div class="postbox"> 
     355    <h3 id="support"><?php _e('Get Plug-in Support','my-calendar'); ?></h3> 
     356        <div class="inside"> 
     357        <?php if ( current_user_can('administrator') ) { ?> 
     358            <?php jcd_get_support_form(); ?> 
     359        <?php } else { ?> 
     360            <?php _e('My Calendar support requests can only be sent by administrators.','my-calendar'); ?> 
     361        <?php } ?>   
     362        </div> 
     363    </div> 
     364             
     365    <div class="ui-sortable meta-box-sortables" id="notes"> 
     366        <div class="postbox"> 
     367        <h3 id="help"><?php _e('Helpful Information','my-calendar'); ?></h3> 
     368            <div class="inside"> 
     369            <p> 
     370            <?php _e('<strong>Uninstalling the plugin</strong>: Although the WordPress standard and expectation is for plug-ins to delete any custom database tables when they\'re uninstalled, My Calendar <em>does not do this</em>. This was a conscious decision on my part -- the data stored in your My Calendar tables is yours; with the sole exception of the "General" category, you added every piece of it yourself. As such, I feel it would be a major disservice to you to delete this information if you uninstall the plug-in. As a result, if you wish to get rid of the plug-in completely, you\'ll need to remove those tables yourself. All your My Calendar settings will be deleted, however.','my-calendar'); ?> 
     371            </p> 
     372            <p> 
     373            <?php _e('<strong>Donations</strong>: I appreciate anything you can give. $2 may not seem like much, but it can really add up when thousands of people are using the software. Please note that I am not a non-profit organization, and your gifts are not tax deductible. Thank you!','my-calendar'); ?> 
     374            </p> 
     375            </div> 
     376        </div> 
     377    </div> 
    377378 
    378379</div> 
  • my-calendar/trunk/my-calendar-ical.php

    r714062 r759510  
    1616    $to = "$y-$m-$d"; 
    1717} 
     18 
     19$from = apply_filters( 'mc_ical_download_from', $from, $p ); 
     20$to = apply_filters( 'mc_ical_download_to', $to, $p ); 
     21$atts = array( 'category'=>null, 'ltype'=>'', 'lvalue'=>'', 'source'=>'calendar', 'author'=>null, 'host'=> null ); 
     22$atts = apply_filters( 'mc_ical_attributes', $atts ); 
     23extract( $atts ); 
    1824 
    1925global $mc_version; 
     
    3743PRODID:-//Accessible Web Design//My Calendar//http://www.mywpcal.com//v'.$mc_version.'//EN'; 
    3844 
    39     $events = my_calendar_grab_events( $from, $to ); 
     45    $events = my_calendar_grab_events( $from, $to, $category, $ltype, $lvalue, $source, $author, $host ); 
    4046    if ( is_array($events) && !empty($events) ) { 
    4147        foreach ( array_keys($events) as $key) { 
  • my-calendar/trunk/my-calendar-install.php

    r745189 r759510  
    145145     $(this).parent().children().not(".trigger").toggle();  
    146146     }); 
    147   $(".mini-event .close").on("click", 
     147  $(document).on("click", ".mini-event .close", 
    148148     function(e) { 
    149149         e.preventDefault(); 
     
    417417    add_option( 'mc_uri','' );   
    418418    add_option( 'mc_show_event_vcal','false' ); 
    419     add_option( 'mc_draggable',0 ); 
    420419    add_option( 'mc_week_caption',"The week's events" ); 
    421420    add_option( 'mc_multisite_show', 0 ); 
  • my-calendar/trunk/my-calendar-locations.php

    r714062 r759510  
    88 
    99function my_calendar_manage_locations() { 
    10   global $wpdb; 
     10    global $wpdb; 
    1111    $mcdb = $wpdb; 
    12   // My Calendar must be installed and upgraded before this will work 
    13   check_my_calendar(); 
     12    // My Calendar must be installed and upgraded before this will work 
     13    check_my_calendar(); 
    1414    $formats = array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%d', '%s' ) 
    1515?> 
    1616<div class="wrap jd-my-calendar"> 
    17 <?php  
    18 my_calendar_check_db(); 
    19 ?> 
    20 <?php 
    21   // We do some checking to see what we're doing 
     17<?php my_calendar_check_db();  
     18    // We do some checking to see what we're doing 
    2219    if ( !empty($_POST) ) { 
    2320        $nonce=$_REQUEST['_wpnonce']; 
     
    2623    if (isset($_POST['mode']) && $_POST['mode'] == 'add') { 
    2724        $add = array( 
    28         'location_label'=>$_POST['location_label'], 
    29         'location_street'=>$_POST['location_street'], 
    30         'location_street2'=>$_POST['location_street2'], 
    31         'location_city'=>$_POST['location_city'], 
    32         'location_state'=>$_POST['location_state'], 
    33         'location_postcode'=>$_POST['location_postcode'], 
    34         'location_region'=>$_POST['location_region'], 
    35         'location_country'=>$_POST['location_country'], 
    36         'location_url'=>$_POST['location_url'], 
    37         'location_longitude'=>$_POST['location_longitude'], 
    38         'location_latitude'=>$_POST['location_latitude'], 
    39         'location_zoom'=>$_POST['location_zoom'], 
    40         'location_phone'=>$_POST['location_phone'] 
     25            'location_label'=>$_POST['location_label'], 
     26            'location_street'=>$_POST['location_street'], 
     27            'location_street2'=>$_POST['location_street2'], 
     28            'location_city'=>$_POST['location_city'], 
     29            'location_state'=>$_POST['location_state'], 
     30            'location_postcode'=>$_POST['location_postcode'], 
     31            'location_region'=>$_POST['location_region'], 
     32            'location_country'=>$_POST['location_country'], 
     33            'location_url'=>$_POST['location_url'], 
     34            'location_longitude'=>$_POST['location_longitude'], 
     35            'location_latitude'=>$_POST['location_latitude'], 
     36            'location_zoom'=>$_POST['location_zoom'], 
     37            'location_phone'=>$_POST['location_phone'] 
    4138        ); 
    4239        $results = $mcdb->insert( my_calendar_locations_table(), $add, $formats ); 
    43        
     40        do_action( 'mc_save_location', $results, $add ); 
    4441        if ($results) { 
    4542            echo "<div class=\"updated\"><p><strong>".__('Location added successfully','my-calendar')."</strong></p></div>"; 
     
    5047        $sql = "DELETE FROM " . my_calendar_locations_table() . " WHERE location_id=".(int)($_GET['location_id']); 
    5148        $results = $mcdb->query($sql); 
     49        do_action( 'mc_delete_location', $results, (int) $_GET['location_id'] );         
    5250        if ($results) { 
    5351            echo "<div class=\"updated\"><p><strong>".__('Location deleted successfully','my-calendar')."</strong></p></div>"; 
     
    301299         <tr class="<?php echo $class; ?>"> 
    302300         <th scope="row"><?php echo $location->location_id; ?></th> 
    303          <td><?php echo stripslashes($location->location_label) . "<br />" . stripslashes($location->location_street) . "<br />" . stripslashes($location->location_street2) . "<br />" . stripslashes($location->location_city) . ", " . stripslashes($location->location_state) . " " . stripslashes($location->location_postcode); ?></td> 
     301         <td><?php echo stripslashes($location->location_label) . "<br />" . stripslashes($location->location_street) . "<br />" . stripslashes($location->location_city) . ", " . stripslashes($location->location_state) . " " . stripslashes($location->location_postcode); ?></td> 
    304302         <td><a href="<?php echo admin_url("admin.php?page=my-calendar-locations&amp;mode=edit&amp;location_id=$location->location_id"); ?>" class='edit'><?php _e('Edit','my-calendar'); ?></a></td> 
    305303         <td><a href="<?php echo admin_url("admin.php?page=my-calendar-locations&amp;mode=delete&amp;location_id=$location->location_id"); ?>" class="delete" onclick="return confirm('<?php _e('Are you sure you want to delete this category?','my-calendar'); ?>')"><?php _e('Delete','my-calendar'); ?></a></td> 
  • my-calendar/trunk/my-calendar-output.php

    r745189 r759510  
    3838 
    3939function my_calendar_draw_events($events, $type, $process_date, $time, $template='') { 
    40   if ( $type == 'mini' && ( get_option('mc_open_day_uri') == 'true' || get_option('mc_open_day_uri') == 'listanchor' || get_option('mc_open_day_uri') == 'calendaranchor' ) ) return true; 
    41   // We need to sort arrays of objects by time 
    42   if ( is_array($events) ) { 
    43  //usort($events, "my_calendar_time_cmp"); 
    44  $output_array = array(); 
    45  $begin = $event_output = $end = ''; 
    46     if ($type == "mini" && count($events) > 0) { 
    47  
    48     $begin .= "<div id='date-$process_date' class='calendar-events'>"; 
    49         if ( get_option('mc_draggable') == '1' ) {  
    50             //$begin .= "<script>jQuery(document).ready(function($) { $('#date-$process_date').easydrag(); });</script>"; 
    51             $begin .= "<script>(function( $ ) { 'use strict'; $(function() { $('#date-$process_date').easydrag(); } ) }(jquery));</script>"; 
    52         } 
    53     } 
    54     // By default, skip no events. 
    55     $skipping = false; 
    56     foreach(array_keys($events) as $key ) { 
    57         $event =& $events[$key]; 
    58         $output_array[] = my_calendar_draw_event($event, $type, $process_date,$time,$template); 
    59     } 
    60     if ( is_array($output_array) ) { 
    61         foreach (array_keys($output_array) as $key) { 
    62             $value =& $output_array[$key];   
    63             $event_output .= $value; 
    64         } 
    65     }    
    66     if ( $event_output == '' ) { return; } 
    67     if ($type == "mini" && count($events) > 0) { $end .= "</div>"; } 
     40    if ( $type == 'mini' && ( get_option('mc_open_day_uri') == 'true' || get_option('mc_open_day_uri') == 'listanchor' || get_option('mc_open_day_uri') == 'calendaranchor' ) ) return true; 
     41    // We need to sort arrays of objects by time 
     42    if ( is_array($events) ) { 
     43        $output_array = array(); 
     44        $begin = $event_output = $end = ''; 
     45        if ($type == "mini" && count($events) > 0) { 
     46            $begin .= "<div id='date-$process_date' class='calendar-events'>"; 
     47        } 
     48        // By default, skip no events. 
     49        $skipping = false; 
     50        foreach(array_keys($events) as $key ) { 
     51            $event =& $events[$key]; 
     52            $output_array[] = my_calendar_draw_event( $event,$type,$process_date,$time,$template ); 
     53        } 
     54        if ( is_array($output_array) ) { 
     55            foreach (array_keys($output_array) as $key) { 
     56                $value =& $output_array[$key];   
     57                $event_output .= $value; 
     58            } 
     59        }    
     60        if ( $event_output == '' ) { return; } 
     61        if ( $type == "mini" && count($events) > 0 ) { $end .= "</div>"; } 
    6862        return $begin . $event_output . $end; 
    6963    } 
     
    7367    global $wpdb,$wp_plugin_url; 
    7468    $mcdb = $wpdb; 
    75       if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { $mcdb = mc_remote_db(); } 
     69    if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { $mcdb = mc_remote_db(); } 
    7670    // My Calendar must be updated to run this function 
    7771    check_my_calendar(); 
    7872    if ( $event->category_private == 1 && !is_user_logged_in() ) { return; } 
    79     $templates = get_option('mc_templates'); 
    80     $header_details = ''; 
    81     $body_details = ''; 
    82     $address = ''; 
    83     $output = ''; 
     73    $header_details = $body_details = $address = $output = ''; 
    8474    $date_format = ( get_option('mc_date_format') != '' )?get_option('mc_date_format'):get_option('date_format'); 
    85  
    8675    $data = event_as_array($event);  
    87     $details = false; 
    88     if ( $template != '' && file_exists( get_stylesheet_directory() . '/' . $template ) ) { 
    89         $template = @file_get_contents( get_stylesheet_directory() . '/' . $template ); 
    90         $details = jd_draw_template( $data, $template ); 
    91     } else { 
    92         switch ($type) { 
    93             case 'mini': 
    94                 $template = $templates['mini']; 
    95                 if ( get_option('mc_use_mini_template')==1 ) { 
    96                     $details = jd_draw_template( $data, $template ); 
    97                 } 
    98             break; 
    99             case 'list': 
    100                 $template = $templates['list']; 
    101                 if ( get_option('mc_use_list_template')==1 ) { 
    102                     $details = jd_draw_template( $data, $template ); 
    103                 } 
    104             break; 
    105             case 'single': 
    106                 $template = $templates['details']; 
    107                 if ( get_option('mc_use_details_template')==1 ) { 
    108                     $details = jd_draw_template( $data, $template ); 
    109                 } 
    110             break; 
    111             case 'calendar': 
    112             default: 
    113                 $template = $templates['grid']; 
    114                 if ( get_option('mc_use_grid_template')==1 ) { 
    115                     $details = jd_draw_template( $data, $template ); 
    116                 } 
    117             break; 
    118         } 
    119     } 
    120                           
     76    $details = apply_filters( 'mc_custom_template', false, $data, $event, $type, $process_date, $time, $template ); 
     77    if ( $details !== false ) { 
     78        $templates = get_option('mc_templates'); 
     79        if ( $template != '' && file_exists( get_stylesheet_directory() . '/' . $template ) ) { 
     80            $template = @file_get_contents( get_stylesheet_directory() . '/' . $template ); 
     81            $details = jd_draw_template( $data, $template ); 
     82        } else { 
     83            switch ($type) { 
     84                case 'mini': 
     85                    $template = $templates['mini']; 
     86                    if ( get_option('mc_use_mini_template')==1 ) { 
     87                        $details = jd_draw_template( $data, $template ); 
     88                    } 
     89                break; 
     90                case 'list': 
     91                    $template = $templates['list']; 
     92                    if ( get_option('mc_use_list_template')==1 ) { 
     93                        $details = jd_draw_template( $data, $template ); 
     94                    } 
     95                break; 
     96                case 'single': 
     97                    $template = $templates['details']; 
     98                    if ( get_option('mc_use_details_template')==1 ) { 
     99                        $details = jd_draw_template( $data, $template ); 
     100                    } 
     101                break; 
     102                case 'calendar': 
     103                default: 
     104                    $template = $templates['grid']; 
     105                    if ( get_option('mc_use_grid_template')==1 ) { 
     106                        $details = jd_draw_template( $data, $template ); 
     107                    } 
     108            } 
     109        } 
     110    } 
    121111    $mc_display_author  = get_option('mc_display_author'); 
    122112    $display_map        = get_option('mc_show_map'); 
     
    138128            $path = (is_custom_icon())?str_replace('my-calendar','',$wp_plugin_url).'/my-calendar-custom/':plugins_url('icons',__FILE__).'/'; 
    139129            $hex = (strpos($event->category_color,'#') !== 0)?'#':''; 
    140             $image = '<img src="'.$path.$event->category_icon.'" alt="'.__('Category','my-calendar').': '.esc_attr($event->category_name).'" class="category-icon" style="background:'.$hex.$event->category_color.';" />'; 
     130            $image = '<img src="'.$path.$event->category_icon.'" alt="'.__('Category','my-calendar').': '.esc_attr($event->category_name).'" class="category-icon" style="background:'.$hex.$event->category_color.'" />'; 
    141131        } else { 
    142132            $image = ""; 
    143133        } 
    144134    } 
    145     if ( $type == 'calendar' ) { 
    146         if ( get_option('mc_draggable') == '1' ) {  
    147     $header_details .= " 
    148 <script type='text/javascript'> 
    149 jQuery(document).ready(function($) { 
    150     $('#$uid-$day_id-$type-details').easydrag(); 
    151 }); 
    152 </script>"; 
    153         } 
    154     } 
    155 // move this div start for custom. 
     135    // move this div start for custom. 
    156136    $header_details .=  "<div id='$uid-$day_id-$type' class='$type-event $category vevent'>\n"; 
    157137    $templates = get_option('mc_templates'); 
     
    166146            $wrap = "<a href='#$uid-$day_id-$type-details'>"; $balance = "</a>";  
    167147        } 
    168     } else {  
    169         $wrap = $balance = '';  
     148    } else { 
     149        $wrap = $balance = ''; 
    170150    }    
    171151    $current_date = date_i18n($date_format,strtotime($process_date)); 
    172152    if ( $event->event_span == 1 ) { $group_class = ' multidate group'.$event->event_group_id; } else { $group_class = ''; } 
    173153    $header_details .= ( $type != 'single' && $type != 'list' )?"<h3 class='event-title summary$group_class'>$wrap$image".$mytitle."$balance</h3>\n":''; 
    174     $title = apply_filters( 'mc_before_event_title','',$event ); 
    175     $title .= ($type == 'single' )?"<h2 class='event-title summary'>$image $mytitle</h2>\n":''; 
    176     $title .= apply_filters( 'mc_after_event_title','',$event ); 
    177     $header_details .= apply_filters( 'mc_event_title',$title,$event ); 
     154    $title = ($type == 'single' )?"<h2 class='event-title summary'>$image $mytitle</h2>\n":''; 
     155    $title = apply_filters( 'mc_event_title', $title, $event, $mytitle, $image ); 
     156    $header_details .= $title; 
    178157     
    179158    $dateid = $event->occur_id;      
     
    296275        } 
    297276        $status = ($status != '')?"<p>$status</p>":''; 
     277        $status = apply_filters( 'mc_registration_state', $status, $event ); 
    298278        $return = ($type == 'single')?"<p><a href='".get_option('mc_uri')."'>".__('View full calendar','my-calendar')."</a></p>":''; 
    299279        // if we're opening in a new page, there's no reason to display any of that. Later, re-write this section to make this easier to skip. 
     
    315295    } 
    316296    // create edit links 
    317         if ( mc_can_edit_event( $event->event_author ) && get_option('mc_remote') != 'true' ) { 
    318             $groupedit = ( $event->event_group_id != 0 )?"<li><a href='".admin_url("admin.php?page=my-calendar-groups&amp;mode=edit&amp;event_id=$event->event_id&amp;group_id=$event->event_group_id")."' class='group'>".__('Edit Group','my-calendar')."</a></li>\n":'';  
    319             $recurs = str_split( $event->event_recur, 1 ); 
    320             $recur = $recurs[0]; 
    321             $every = ( isset($recurs[1]) )?$recurs[1]:1;     
    322             $referer = urlencode( mc_get_current_url() ); 
    323             if ( $recur == 'S' ) { 
    324                 $edit = " 
    325                 <div class='mc_edit_links'> 
    326                 <ul> 
    327                 <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;ref=$referer")."' class='edit'>".__('Edit','my-calendar')."</a></li> 
    328                 <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;ref=$referer")."' class='delete'>".__('Delete','my-calendar')."</a></li> 
    329                 $groupedit 
    330                 </ul> 
    331                 </div>"; 
    332             } else { 
    333                 $edit = "<div class='mc_edit_links'> 
    334                 <ul> 
    335                 <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;date=$dateid&amp;ref=$referer")."' class='edit'>".__('Edit This Date','my-calendar')."</a></li> 
    336                 <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;ref=$referer")."' class='edit'>".__('Edit All','my-calendar')."</a></li> 
    337                 <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;date=$dateid&amp;ref=$referer")."' class='delete'>".__('Delete This Date','my-calendar')."</a></li> 
    338                 <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;ref=$referer")."' class='delete'>".__('Delete All','my-calendar')."</a></li> 
    339                 $groupedit 
    340                 </ul> 
    341                 </div>";     
    342             } 
    343         } else { 
    344             $edit = '';  
    345         } 
     297    if ( mc_can_edit_event( $event->event_author ) && get_option('mc_remote') != 'true' ) { 
     298        $groupedit = ( $event->event_group_id != 0 )?"<li><a href='".admin_url("admin.php?page=my-calendar-groups&amp;mode=edit&amp;event_id=$event->event_id&amp;group_id=$event->event_group_id")."' class='group'>".__('Edit Group','my-calendar')."</a></li>\n":'';  
     299        $recurs = str_split( $event->event_recur, 1 ); 
     300        $recur = $recurs[0]; 
     301        $every = ( isset($recurs[1]) )?$recurs[1]:1;     
     302        $referer = urlencode( mc_get_current_url() ); 
     303        if ( $recur == 'S' ) { 
     304            $edit = " 
     305            <div class='mc_edit_links'> 
     306            <ul> 
     307            <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;ref=$referer")."' class='edit'>".__('Edit','my-calendar')."</a></li> 
     308            <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;ref=$referer")."' class='delete'>".__('Delete','my-calendar')."</a></li> 
     309            $groupedit 
     310            </ul> 
     311            </div>"; 
     312        } else { 
     313            $edit = "<div class='mc_edit_links'> 
     314            <ul> 
     315            <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;date=$dateid&amp;ref=$referer")."' class='edit'>".__('Edit This Date','my-calendar')."</a></li> 
     316            <li><a href='".admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id=$event->event_id&amp;ref=$referer")."' class='edit'>".__('Edit All','my-calendar')."</a></li> 
     317            <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;date=$dateid&amp;ref=$referer")."' class='delete'>".__('Delete This Date','my-calendar')."</a></li> 
     318            <li><a href='".admin_url("admin.php?page=my-calendar-manage&amp;mode=delete&amp;event_id=$event->event_id&amp;ref=$referer")."' class='delete'>".__('Delete All','my-calendar')."</a></li> 
     319            $groupedit 
     320            </ul> 
     321            </div>";     
     322        } 
     323    } else { 
     324        $edit = '';  
     325    } 
    346326    if ( $type == 'calendar' && get_option('mc_open_uri') == 'true' && $time != 'day' ) { $edit = ''; } 
    347          
     327    $details .= apply_filters( 'mc_details_append', '', $event, $type ); 
    348328    $details .= $edit; 
    349329    $details .= apply_filters('mc_after_event','',$event); 
    350330    $details .= "</div><!--ends .details--></div>"; 
    351     $details = apply_filters('mc_event_content',$details,$event); 
     331    $details = apply_filters('mc_event_content',$details,$event,$type); 
    352332     
    353     switch($type) { 
    354         case 'calendar':$details = apply_filters('mc_event_content_calendar',$details,$event); 
    355         break; 
    356         case 'mini':$details = apply_filters('mc_event_content_mini',$details,$event); 
    357         break; 
    358         case 'grid':$details = apply_filters('mc_event_content_grid',$details,$event); 
    359         break; 
    360         case 'single':$details = apply_filters('mc_event_content_single',$details,$event); 
    361         break; 
    362     } 
    363333    if ( get_option( 'mc_event_approve' ) == 'true' ) { 
    364334        if ( $event->event_approved == 1 ) {     
     
    689659// Actually do the printing of the calendar 
    690660function my_calendar( $name, $format, $category, $showkey, $shownav, $showjump, $toggle, $time='month', $ltype='', $lvalue='', $id='jd-calendar', $template='', $content='', $author=null, $host=null, $above='', $below='' ) { 
    691     check_my_calendar();     
     661    check_my_calendar(); 
     662    apply_filters("debug", "my_calendar( $name ) draw"); 
    692663    $mc_toporder = array( 'nav','toggle','jump','print','timeframe' ); 
    693664    $mc_bottomorder = array( 'key','feeds' ); 
     
    704675    } else { 
    705676        $deprecated = ''; 
    706     } 
    707     if ( get_option('mc_draggable') == '1' ) { 
    708         wp_enqueue_script('jquery.easydrag',plugins_url( 'js/jquery.easydrag.js', __FILE__ ), array('jquery') ); 
    709677    } 
    710678    if ( isset($_GET['time']) && in_array( $_GET['time'], array( 'day','week','month' ) )  && $format != 'mini' ) { 
     
    10501018                    $no_events = ( $content == '' )?__('There are no events scheduled during this period.','my-calendar'):$content; 
    10511019                    $my_calendar_body .= "<li class='no-events'>$no_events</li>"; 
    1052                 } else {     
     1020                } else { 
    10531021                    $start = strtotime($from); 
    10541022                    $end = strtotime($to); 
    1055                     do {     
    1056                      
    1057                     $date = date('Y-m-d',$start); 
    1058                     $enddate = date('Y-m-d',$end ); 
    1059                     $is_weekend = ( date( 'N',$start ) < 6 )?false:true; 
    1060              
     1023                    do { 
     1024                        $date = date('Y-m-d',$start); 
     1025                        $enddate = date('Y-m-d',$end ); 
     1026                        $is_weekend = ( date( 'N',$start ) < 6 )?false:true; 
    10611027                        if ( get_option('mc_show_weekends') == 'true' || ( get_option('mc_show_weekends') != 'true' && !$is_weekend ) ) { 
    10621028                            if ( date( 'N', $start ) == $start_of_week && $format != "list" ) { 
     
    10701036                            $week_date_format = date_i18n( $week_format,$start );                
    10711037                            $thisday_heading = ($time == 'week')?"<small>$week_date_format</small>":date( 'j',$start ); 
    1072                             $events = @$event_array[$date]; 
     1038                            $events = ( isset( $event_array[$date] ) )?$event_array[$date]:array(); 
    10731039                                if ( !empty($events) ) { 
    10741040                                    $event_output = my_calendar_draw_events($events, $format, $date, $time, $template, $holidays);                       
     
    11531119                    } while ( $start <= $end );                  
    11541120                } 
    1155                 if ( $format == "list" ) { 
    1156                     $my_calendar_body .= "\n</ul>"; 
    1157                 } else { 
    1158                     $my_calendar_body .= "\n</tbody>\n</table>"; 
    1159                 } 
     1121                $my_calendar_body .= ( $format == "list" )?"\n</ul>":"\n</tbody>\n</table>"; 
    11601122            } else { 
    11611123                $my_calendar_body .= __("Unrecognized calendar format. Please use one of 'list','calendar', or 'mini'.",'my-calendar')." '<code>$format</code>.'"; 
     
    11661128    // The actual printing is done by the shortcode function. 
    11671129    $my_calendar_body .= apply_filters('mc_after_calendar','',$args); 
     1130    apply_filters("debug", "my_calendar( $name ) draw completed"); 
    11681131    return $mc_wrapper . $my_calendar_body . $mc_closer; 
    11691132} 
  • my-calendar/trunk/my-calendar-rss.php

    r714062 r759510  
    33 
    44function my_calendar_rss() { 
    5 $offset = (60*60*get_option('gmt_offset')); 
    6 // establish template 
    7 if ( isset($_GET['mcat']) ) { $cat_id = (int) $_GET['mcat']; } else { $cat_id = false; } 
    8     $template = "\n<item> 
    9     <title>{title}</title> 
    10     <link>{link}</link> 
    11     <pubDate>{rssdate}</pubDate> 
    12     <dc:creator>{author}</dc:creator>    
    13     <description><![CDATA[{rss_description}]]></description> 
    14     <content:encoded><![CDATA[<div class='vevent'> 
    15     <h1 class='summary'>{rss_title}</h1> 
    16     <div class='description'>{rss_description}</div> 
    17     <p class='dtstart' title='{ical_start}'>Begins: {time} on {date}</p> 
    18     <p class='dtend' title='{ical_end}'>Ends: {endtime} on {enddate}</p>     
    19     <p>Recurrance: {recurs}</p> 
    20     <p>Repetition: {repeats} times</p> 
    21     <div class='location'>{rss_hcard}</div> 
    22     {link_title} 
    23     </div>]]></content:encoded> 
    24     <dc:format xmlns:dc='http://purl.org/dc/elements/1.1/'>text/html</dc:format> 
    25     <dc:source xmlns:dc='http://purl.org/dc/elements/1.1/'>".home_url()."</dc:source>    
    26     {guid} 
    27   </item>\n"; 
    28   if ( get_option( 'mc_use_rss_template' ) == 1 ) { $templates = get_option('mc_templates'); $template = $templates['rss']; } 
    29 // add RSS headers 
    30 $charset = get_bloginfo('charset'); 
    31 $output = '<?xml version="1.0" encoding="'.$charset.'"?> 
    32 <rss version="2.0" 
    33     xmlns:content="http://purl.org/rss/1.0/modules/content/" 
    34     xmlns:dc="http://purl.org/dc/elements/1.1/" 
    35     xmlns:atom="http://www.w3.org/2005/Atom" 
    36     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
    37     xmlns:slash="http://purl.org/rss/1.0/modules/slash/" 
    38     > 
    39 <channel> 
    40   <title>'. get_bloginfo('name') .' Calendar</title> 
    41   <link>'. home_url() .'</link> 
    42   <description>'. get_bloginfo('description') . ': My Calendar Events</description> 
    43   <language>'. get_bloginfo('language') .'</language> 
    44   <managingEditor>'. get_bloginfo('admin_email') .' (' . get_bloginfo('name') . ' Admin)</managingEditor> 
    45   <generator>My Calendar WordPress Plugin http://www.joedolson.com/articles/my-calendar/</generator> 
    46   <lastBuildDate>'. mysql2date('D, d M Y H:i:s +0000', time()+$offset) .'</lastBuildDate> 
    47   <atom:link href="'. mc_get_current_url() .'" rel="self" type="application/rss+xml" />'; 
     5    // establish template 
     6    if ( isset($_GET['mcat']) ) { $cat_id = (int) $_GET['mcat']; } else { $cat_id = false; } 
     7        $template = "\n<item> 
     8        <title>{title}</title> 
     9        <link>{link}</link> 
     10        <pubDate>{rssdate}</pubDate> 
     11        <dc:creator>{author}</dc:creator>    
     12        <description><![CDATA[{rss_description}]]></description> 
     13        <content:encoded><![CDATA[<div class='vevent'> 
     14        <h1 class='summary'>{rss_title}</h1> 
     15        <div class='description'>{rss_description}</div> 
     16        <p class='dtstart' title='{ical_start}'>Begins: {time} on {date}</p> 
     17        <p class='dtend' title='{ical_end}'>Ends: {endtime} on {enddate}</p>     
     18        <p>Recurrance: {recurs}</p> 
     19        <p>Repetition: {repeats} times</p> 
     20        <div class='location'>{rss_hcard}</div> 
     21        {link_title} 
     22        </div>]]></content:encoded> 
     23        <dc:format xmlns:dc='http://purl.org/dc/elements/1.1/'>text/html</dc:format> 
     24        <dc:source xmlns:dc='http://purl.org/dc/elements/1.1/'>".home_url()."</dc:source>    
     25        {guid} 
     26      </item>\n"; 
     27    if ( get_option( 'mc_use_rss_template' ) == 1 ) { $templates = get_option('mc_templates'); $template = $templates['rss']; } 
     28    // add RSS headers 
     29    $charset = get_bloginfo('charset'); 
     30    $output = '<?xml version="1.0" encoding="'.$charset.'"?> 
     31    <rss version="2.0" 
     32        xmlns:content="http://purl.org/rss/1.0/modules/content/" 
     33        xmlns:dc="http://purl.org/dc/elements/1.1/" 
     34        xmlns:atom="http://www.w3.org/2005/Atom" 
     35        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
     36        xmlns:slash="http://purl.org/rss/1.0/modules/slash/" 
     37        > 
     38    <channel> 
     39      <title>'. get_bloginfo('name') .' Calendar</title> 
     40      <link>'. home_url() .'</link> 
     41      <description>'. get_bloginfo('description') . ': My Calendar Events</description> 
     42      <language>'. get_bloginfo('language') .'</language> 
     43      <managingEditor>'. get_bloginfo('admin_email') .' (' . get_bloginfo('name') . ' Admin)</managingEditor> 
     44      <generator>My Calendar WordPress Plugin http://www.joedolson.com/articles/my-calendar/</generator> 
     45      <lastBuildDate>'. mysql2date('D, d M Y H:i:s +0000', current_time( 'timestamp' ) ) .'</lastBuildDate> 
     46      <atom:link href="'. mc_get_current_url() .'" rel="self" type="application/rss+xml" />'; 
    4847 
    49     $events = mc_get_rss_events( $cat_id ); 
    50     if ( is_array( $events) ) { 
    51         //print_r($events); 
    52     } 
    53     $groups = array(); 
    54     foreach ( array_keys($events) as $key ) { 
    55         $event =& $events[$key];     
    56         if ( !in_array( $event->occur_group_id, $groups ) ) { 
    57             $array = event_as_array($event); 
    58             $output .= jd_draw_template( $array, $template, 'rss' ); 
    59             if ( $event->event_span == 1 ) { 
    60                 $groups[] = $event->occur_group_id; 
    61             }        
     48        $events = mc_get_rss_events( $cat_id ); 
     49        if ( is_array( $events) ) { 
     50            //print_r($events); 
    6251        } 
    63     } 
    64 $output .= '</channel> 
    65 </rss>'; 
    66     header('Content-type: application/rss+xml'); 
    67     header("Pragma: no-cache"); 
    68     header("Expires: 0"); 
    69 echo mc_strip_to_xml($output); 
     52        $groups = array(); 
     53        foreach ( array_keys($events) as $key ) { 
     54            $event =& $events[$key];     
     55            if ( !in_array( $event->occur_group_id, $groups ) ) { 
     56                $array = event_as_array($event); 
     57                $output .= jd_draw_template( $array, $template, 'rss' ); 
     58                if ( $event->event_span == 1 ) { 
     59                    $groups[] = $event->occur_group_id; 
     60                }        
     61            } 
     62        } 
     63    $output .= '</channel> 
     64    </rss>'; 
     65        header('Content-type: application/rss+xml'); 
     66        header("Pragma: no-cache"); 
     67        header("Expires: 0"); 
     68    echo mc_strip_to_xml($output); 
    7069} 
    7170 
  • my-calendar/trunk/my-calendar-settings.php

    r745189 r759510  
    55function my_calendar_import() { 
    66    if ( get_option('ko_calendar_imported') != 'true' ) { 
    7     global $wpdb; 
    8     $mcdb = $wpdb; 
     7        global $wpdb; 
     8        $mcdb = $wpdb; 
    99        define('KO_CALENDAR_TABLE', $mcdb->prefix . 'calendar'); 
    1010        define('KO_CALENDAR_CATS', $mcdb->prefix . 'calendar_categories'); 
     
    8787            echo "<div class='updated fade'><ol>"; 
    8888            echo "<li>".__('Dropping occurrences database table','my-calendar')."</li>"; 
    89             mc_drop_table( 'my_calendar_event_table' ); 
    90             sleep(1); 
     89            mc_drop_table( 'my_calendar_event_table' ); sleep(1); 
    9190            echo "<li>".__('Reinstalling occurrences database table.','my-calendar')."</li>"; 
    92             mc_upgrade_db();  
    93             sleep(1); 
     91            mc_upgrade_db(); sleep(1); 
    9492            echo "<li>".__('Generating event occurrences.','my-calendar')."</li>"; 
    9593            mc_migrate_db(); 
     
    182180            $prev_show = get_option('mc_show_rss').'-'.get_option('mc_show_ical').'-'.get_option('mc_show_print'); 
    183181            $curr_show = "$mc_show_rss-$mc_show_ical-$mc_show_print"; 
     182            update_option( 'mc_modified_feeds', array( 'prev'=>$prev_show, 'curr'=>$curr_show ) ); 
    184183        update_option('mc_show_rss',$mc_show_rss); 
    185184        update_option('mc_show_ical',$mc_show_ical); 
    186185        update_option('mc_ical_utc',$mc_ical_utc); 
    187186        update_option('mc_show_print',$mc_show_print); 
    188         if ( $prev_show != $curr_show ) { $update_text = " ".sprintf(__('Visit your <a href="%s">permalinks settings</a> and re-save them.','my-calendar'),admin_url('options-permalink.php')); } else { $update_text = ''; }  
    189         echo "<div class=\"updated\"><p><strong>".__('Output Settings saved','my-calendar').".$update_text</strong></p></div>"; 
     187        echo "<div class=\"updated\"><p><strong>".__('Output Settings saved','my-calendar')."</strong></p></div>"; 
    190188    } 
    191189    // input 
     
    389387    <li><input type="checkbox" id="mc_event_approve" name="mc_event_approve" <?php mc_is_checked('mc_event_approve','true'); ?> /> <label for="mc_event_approve"><?php _e('Enable approval options.','my-calendar'); ?></label> </li> 
    390388    <?php 
    391     $caching = apply_filters( 'mc_caching_enabled', false, $category, $ltype, $lvalue, $author, $host );  
    392     if ( $caching ) { ?> 
     389    if ( apply_filters( 'mc_caching_clear', false ) ) { ?> 
    393390    <li><input type="checkbox" id="mc_clear_cache" name="mc_clear_cache" value="clear" /> <label for="mc_clear_cache"><?php _e('Clear current cache. (Necessary if you edit shortcodes to change displayed categories, for example.)','my-calendar'); ?></label> 
    394391    </li>    
  • my-calendar/trunk/my-calendar-shortcodes.php

    r745189 r759510  
    33 
    44function my_calendar_insert($atts,$content=null) { 
    5     $atts = apply_filters( 'mc_filter_calendar',$atts, $content ); 
    65    extract(shortcode_atts(array( 
    76                'name' => 'all', 
     
    2120                'above' => '', 
    2221                'below' => '' 
    23             ), $atts)); 
     22            ), $atts, 'my_calendar' )); 
    2423    if ( $format != 'mini' ) { 
    2524        if ( isset($_GET['format']) ) { 
     
    4342                'author' => 'default', 
    4443                'host' => 'default' 
    45             ), $atts)); 
     44            ), $atts, 'my_calendar_upcoming' ) ); 
    4645    return my_calendar_upcoming_events($before, $after, $type, $category, $template, $fallback, $order, $skip, $show_today, $author ); 
    4746} 
     
    5453                'template' => 'default', 
    5554                'fallback' => '' 
    56             ), $atts)); 
     55            ), $atts, 'my_calendar_today' )); 
    5756    return my_calendar_todays_events($category, $template, $fallback, $author); 
    5857} 
     
    6362                'type' => 'saved', 
    6463                'datatype' => 'name' 
    65             ), $atts)); 
     64            ), $atts, 'my_calendar_locations' ) ); 
    6665    return my_calendar_locations_list($show,$type,$datatype); 
    6766} 
     
    7271                'datatype' => 'name', 
    7372                'template' => '' 
    74             ), $atts)); 
     73            ), $atts, 'my_calendar_locations_list' ) ); 
    7574    return my_calendar_show_locations($show,$datatype,$template); 
    7675} 
     
    7978    extract(shortcode_atts(array( 
    8079                'show' => 'list' 
    81             ), $atts)); 
     80            ), $atts, 'my_calendar_categories' ) ); 
    8281    return my_calendar_categories_list( $show ); 
    8382} 
     
    9089                'before' => '<ul>', 
    9190                'after' => '</ul>' 
    92             ), $atts)); 
     91            ), $atts, 'my_calendar_event' ) ); 
    9392    return mc_instance_list( $event, false, $template, $list, $before, $after ); 
    9493} 
     
    9796    extract(shortcode_atts(array( 
    9897            'type' => 'simple' 
    99         ), $atts)); 
     98        ), $atts, 'my_calendar_search' ) ); 
    10099    return my_calendar_searchform($type); 
    101100} 
  • my-calendar/trunk/my-calendar-styles.php

    r714062 r759510  
    44 
    55function mc_get_style_path($filename,$type='path') { 
    6 $wp_plugin_url = plugin_dir_url( __FILE__ ); 
    7 $wp_plugin_dir = plugin_dir_path( __FILE__ ); 
    8         if ( strpos( $filename,'mc_custom_' ) === 0 ) { 
    9             $filename = str_replace('mc_custom_','',$filename); 
    10             $stylefile = ($type=='path')?str_replace('/my-calendar/','',$wp_plugin_dir).'/my-calendar-custom/styles/'.$filename:str_replace('/my-calendar/','',$wp_plugin_url).'/my-calendar-custom/styles/'.$filename; 
     6    $wp_plugin_url = plugin_dir_url( __FILE__ ); 
     7    $wp_plugin_dir = plugin_dir_path( __FILE__ ); 
     8    if ( strpos( $filename,'mc_custom_' ) === 0 ) { 
     9        $filename = str_replace('mc_custom_','',$filename); 
     10        $stylefile = ($type=='path')?str_replace('/my-calendar/','',$wp_plugin_dir).'/my-calendar-custom/styles/'.$filename:str_replace('/my-calendar/','',$wp_plugin_url).'/my-calendar-custom/styles/'.$filename; 
     11    } else { 
     12        $stylefile = ($type=='path')?dirname(__FILE__).'/styles/' . $filename:plugins_url('styles',__FILE__).'/'.$filename; 
     13    } 
     14    if ( $type == 'path' ) { 
     15        if ( is_file($stylefile) ) { 
     16        return $stylefile; 
    1117        } else { 
    12             $stylefile = ($type=='path')?dirname(__FILE__).'/styles/' . $filename:plugins_url('styles',__FILE__).'/'.$filename; 
    13         } 
    14         if ( $type == 'path' ) { 
    15             if ( is_file($stylefile) ) { 
    16             return $stylefile; 
    17             } else { 
    18             return false; 
    19             } 
    20         } else { 
    21             return $stylefile; 
    22         } 
     18        return false; 
     19        } 
     20    } else { 
     21        return $stylefile; 
     22    } 
    2323} 
    2424 
     
    5151 
    5252function mc_write_styles($stylefile, $my_calendar_style) { 
    53     if ( is_writeable( $stylefile ) ) { 
     53    if ( function_exists( 'wp_is_writable' ) ) { 
     54        $is_writable = wp_is_writable( $stylefile ); 
     55    } else { 
     56        $is_writable = is_writeable( $stylefile ); 
     57    } 
     58    if ( $is_writable ) { 
    5459        $f = fopen( $stylefile, 'w+' ); 
    5560        fwrite( $f, $my_calendar_style ); // number of bytes to write, max. 
     
    7883        $stylefile = mc_get_style_path($mc_css_file); 
    7984        $wrote_styles = ( $my_calendar_style !== false )?mc_write_styles($stylefile, $my_calendar_style):'disabled'; 
    80         if ($wrote_styles == true) { 
     85        if ( $wrote_styles == true ) { 
    8186            delete_option('mc_file_permissions'); 
    8287            delete_option('mc_style'); 
  • my-calendar/trunk/my-calendar-templates.php

    r745698 r759510  
    5353function mc_maplink( $event, $request='map', $source='event' ) { 
    5454    if ( $source == 'event' ) { 
    55         $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_region.' '.$event->event_postcode.' '.$event->event_country;   
     55        $map_string = $event->event_street.' '.$event->event_street2.' '.$event->event_city.' '.$event->event_state.' '.$event->event_postcode.' '.$event->event_country;    
    5656        if ( $request == 'gcal' ) { return $map_string; } 
    5757        $zoom = ( $event->event_zoom != 0 )?$event->event_zoom:'15';     
     
    6262        } 
    6363    } else { 
    64         $map_string = $event->location_street.' '.$event->location_street2.' '.$event->location_city.' '.$event->location_state.' '.$event->location_region.' '.$event->location_postcode.' '.$event->location_country;  
     64        $map_string = $event->location_street.' '.$event->location_street2.' '.$event->location_city.' '.$event->location_state.' '.$event->location_postcode.' '.$event->location_country;  
    6565        $zoom = ( $event->location_zoom != 0 )?$event->location_zoom:'15';   
    6666        $map_string = str_replace( " ","+",$map_string ); 
  • my-calendar/trunk/my-calendar-upgrade-db.php

    r714062 r759510  
    33 
    44function my_calendar_check_db() { 
    5 if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { return; } 
     5    if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { return; } 
    66    global $wpdb; 
    77    $mcdb = $wpdb; 
    8 $row = $mcdb->get_row( 'SELECT * FROM '.my_calendar_table() ); 
     8    $row = $mcdb->get_row( 'SELECT * FROM '.my_calendar_table() ); 
    99    if ( isset( $_POST['upgrade'] ) && $_POST['upgrade'] == 'true' ) { 
    1010        $upgraded = my_calendar_mc_upgrade_db(); 
    1111        ?> 
    1212            <div class='upgrade-db updated'> 
    13             <p> 
    14             <?php _e('My Calendar Database is updated.','my-calendar'); ?> 
    15             </p> 
     13                <p><?php _e('My Calendar Database is updated.','my-calendar'); ?></p> 
    1614            </div> 
    17             <?php 
     15        <?php 
    1816    } else if ( !isset( $row->event_hide_end ) && isset( $row->event_id ) ) { 
    1917        if ( $_GET['page'] == 'my-calendar-config' ) { ?> 
    20     <div class='upgrade-db error'> 
    21         <form method="post" action="<?php echo admin_url("admin.php?page=my-calendar-config"); ?>"> 
    22         <div> 
    23         <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('my-calendar-nonce'); ?>" /> 
    24         <input type="hidden" name="upgrade" value="true" /> 
     18        <div class='upgrade-db error'> 
     19            <form method="post" action="<?php echo admin_url("admin.php?page=my-calendar-config"); ?>"> 
     20                <div> 
     21                <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('my-calendar-nonce'); ?>" /> 
     22                <input type="hidden" name="upgrade" value="true" /> 
     23                </div> 
     24                <p> 
     25                <?php _e('The My Calendar database needs to be updated.','my-calendar'); ?> 
     26                <input type="submit" value="<?php _e('Update now','my-calendar'); ?>" name="update-calendar" class="button-primary" /> 
     27                </p> 
     28            </form> 
    2529        </div> 
    26         <p> 
    27         <?php _e('The My Calendar database needs to be updated.','my-calendar'); ?> 
    28         <input type="submit" value="<?php _e('Update now','my-calendar'); ?>" name="update-calendar" class="button-primary" /> 
    29         </p> 
    30         </form> 
    31     </div> 
    3230    <?php } else { ?> 
    3331    <div class='upgrade-db error'> 
  • my-calendar/trunk/my-calendar-user.php

    r714062 r759510  
    33 
    44function mc_user_profile() { 
    5         global $user_ID; 
    6         get_currentuserinfo(); 
    7         if ( isset($_GET['user_id']) ) {  
    8             $user_ID = (int) $_GET['user_id']; 
    9         }  
    10             $mc_us = get_user_meta( $user_ID, 'my_calendar_user_settings', true ); 
    11             $options = get_option('mc_user_settings'); 
    12             if ( is_array( $options ) ) { 
    13                 foreach ($options as $key=>$value) { 
    14                     if ( isset($value['enabled']) && $value['enabled'] == 'on') { 
    15                         $name = $key; 
    16                         $label = $value['label']; 
    17                         $values = $value['values']; 
    18                         $form = "<input type='hidden' name='mc_users' value='1' />"; 
    19                         $form .= " 
    20                         <tr> 
    21                         <th scope='row'><label for='my_calendar_user_settings'>$label</label></th> 
    22                         <td><select name='my_calendar_user_settings[$name]' id='my_calendar_user_settings'> 
    23                         <option value='none'>No preference</option>\n";      
    24                         foreach ($values as $optkey=>$optvalue) { 
    25                             if ( isset($mc_use[$name]) ) { 
    26                                 $selected = ($mc_us[$name]==$optkey)?" selected='selected'":''; 
    27                             } else { 
    28                                 $selected = ''; 
    29                             } 
    30                                 $form .= "<option value='$optkey'$selected>$optvalue</option>\n"; 
    31  
    32                         } 
    33                          
    34                         $form .= "</select></td> 
    35                         </tr>"; 
     5    global $user_ID; 
     6    get_currentuserinfo(); 
     7    if ( isset($_GET['user_id']) ) {  
     8        $user_ID = (int) $_GET['user_id']; 
     9    } 
     10    $mc_us = get_user_meta( $user_ID, 'my_calendar_user_settings', true ); 
     11    $options = get_option('mc_user_settings'); 
     12    if ( is_array( $options ) ) { 
     13        foreach ($options as $key=>$value) { 
     14            if ( isset($value['enabled']) && $value['enabled'] == 'on') { 
     15                $name = $key; 
     16                $label = $value['label']; 
     17                $values = $value['values']; 
     18                $form = "<input type='hidden' name='mc_users' value='1' />"; 
     19                $form .= " 
     20                <tr> 
     21                <th scope='row'><label for='my_calendar_user_settings'>$label</label></th> 
     22                <td><select name='my_calendar_user_settings[$name]' id='my_calendar_user_settings'> 
     23                <option value='none'>No preference</option>\n";      
     24                foreach ($values as $optkey=>$optvalue) { 
     25                    if ( isset($mc_use[$name]) ) { 
     26                        $selected = ($mc_us[$name]==$optkey)?" selected='selected'":''; 
     27                    } else { 
     28                        $selected = ''; 
    3629                    } 
    37                      
     30                        $form .= "<option value='$optkey'$selected>$optvalue</option>\n"; 
    3831                } 
    39             } 
    40          
     32                $form .= "</select></td> 
     33                </tr>"; 
     34            }    
     35        } 
     36    } 
     37    if ( get_option('mc_user_settings_enabled') == 'true' ) { ?> 
     38        <h3><?php _e('My Calendar User Settings', 'my-calendar'); ?></h3> 
     39        <table class="form-table"> 
     40        <?php  
     41            echo $form;  
     42            do_action( 'mc_update_user_form', $user_ID ); 
    4143        ?> 
    42         <?php if ( get_option('mc_user_settings_enabled') == 'true' ) { ?> 
    43         <h3><?php _e('My Calendar User Settings', 'my-calendar'); ?></h3> 
    44          
    45         <table class="form-table"> 
    46         <?php echo $form; ?>     
    4744        </table> 
    48         <?php } ?> 
    49          
    50 <?php 
     45    <?php }  
    5146} 
    5247 
     
    5449    global $user_ID; 
    5550    get_currentuserinfo(); 
    56     if ( isset($_POST['user_id']) ) {  
    57         $user_ID = (int) $_POST['user_id'];  
    58     }  
     51    if ( isset($_POST['user_id']) ) { $user_ID = (int) $_POST['user_id']; }  
    5952    if ( isset( $_POST['mc_users'] ) ) { 
    6053        update_user_meta($user_ID ,'my_calendar_user_settings' , $_POST['my_calendar_user_settings'] ); 
     54        do_action( 'mc_update_user_data', $_POST, $user_ID ); 
    6155    } 
    6256} 
  • my-calendar/trunk/my-calendar-widgets.php

    r745189 r759510  
    99        echo my_calendar_searchform('simple'); 
    1010    } 
    11     function form() { 
    12     } 
    13     function update() { 
     11    function form( $instance ) { 
     12    } 
     13    function update( $new_instance, $old_instance ) { 
    1414    } 
    1515} 
     
    1717class my_calendar_today_widget extends WP_Widget { 
    1818 
    19 function my_calendar_today_widget() { 
    20     parent::WP_Widget( false,$name=__('My Calendar: Today\'s Events','my-calendar') ); 
    21 } 
    22  
    23 function widget($args, $instance) { 
    24     extract($args); 
    25     $the_title = apply_filters('widget_title',$instance['my_calendar_today_title']); 
    26     $the_template = $instance['my_calendar_today_template']; 
    27     $the_substitute = $instance['my_calendar_no_events_text']; 
    28     $the_category = ($instance['my_calendar_today_category']=='')?'default':esc_attr($instance['my_calendar_today_category']); 
    29     $author = ( !isset($instance['my_calendar_today_author']) || $instance['my_calendar_today_author']=='')?'all':esc_attr($instance['my_calendar_today_author']); 
    30     $host = ( !isset($instance['mc_host']) || $instance['mc_host']=='')?'all':esc_attr($instance['mc_host']); 
    31     $widget_link = (!empty($instance['my_calendar_today_linked']) && $instance['my_calendar_today_linked']=='yes')?get_option('mc_uri'):''; 
    32     $widget_link = ( !empty($instance['mc_link']) )?esc_url($instance['mc_link']):$widget_link; 
    33     $widget_title = empty($the_title) ? '' : $the_title; 
    34     $offset = (60*60*get_option('gmt_offset')); 
    35     if ( strpos($widget_title,'{date}') !== false ) { $widget_title = str_replace( '{date}',date_i18n(get_option('mc_date_format'),time()+$offset),$widget_title ); }    
    36     $widget_title = ($widget_link=='') ? $widget_title : "<a href='$widget_link'>$widget_title</a>";     
    37     $widget_title = ($widget_title!='') ? $before_title . $widget_title . $after_title : ''; 
    38     $the_events = my_calendar_todays_events($the_category,$the_template,$the_substitute,$author, $host); 
    39         if ($the_events != '') { 
    40           echo $before_widget; 
    41           echo $widget_title; 
    42           echo $the_events; 
    43           echo $after_widget; 
    44         } 
    45 } 
    46  
    47 function form($instance) { 
    48     global $default_template; 
    49     $widget_title = (isset($instance['my_calendar_today_title']))?esc_attr($instance['my_calendar_today_title']):''; 
    50     $widget_template = (isset($instance['my_calendar_today_template']))?esc_attr($instance['my_calendar_today_template']):''; 
    51     if (!$widget_template) { $widget_template = $default_template; } 
    52     $widget_text = (isset($instance['my_calendar_no_events_text']))?esc_attr($instance['my_calendar_no_events_text']):''; 
    53     $widget_category = (isset($instance['my_calendar_today_category']))?esc_attr($instance['my_calendar_today_category']):''; 
    54     $widget_linked = (isset($instance['my_calendar_today_linked']))?esc_attr($instance['my_calendar_today_linked']):''; 
    55     if ( $widget_linked == 'yes' ) { $default_link = get_option('mc_uri'); } else { $default_link = ''; } 
    56     $widget_link = (!empty($instance['mc_link']))?esc_url($instance['mc_link']):$default_link; 
    57     $widget_author = (isset($instance['my_calendar_today_author']))?esc_attr($instance['my_calendar_today_author']):''; 
    58     $widget_host = (isset($instance['mc_host']))?esc_attr($instance['mc_host']):''; 
    59      
    60 ?> 
    61     <p> 
    62     <label for="<?php echo $this->get_field_id('my_calendar_today_title'); ?>"><?php _e('Title','my-calendar'); ?>:</label><br /> 
    63     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_title'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_title'); ?>" value="<?php echo $widget_title; ?>"/> 
    64     </p> 
    65     <p> 
    66     <label for="<?php echo $this->get_field_id('my_calendar_today_template'); ?>"><?php _e('Template','my-calendar'); ?></label><br /> 
    67     <textarea class="widefat" rows="8" cols="20" id="<?php echo $this->get_field_id('my_calendar_today_template'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_template'); ?>"><?php echo $widget_template; ?></textarea> 
    68     </p> 
    69     <?php if ( get_option('mc_uri') == '' ) { $disabled = " disabled='disabled'"; $warning = _e('Add calendar URL to use this option.','my-calendar');  } else { $disabled = $warning = ""; } ?> 
    70     <?php /* <p> 
    71     <label for="<?php echo $this->get_field_id('my_calendar_today_linked'); ?>"><?php _e('Link widget title to calendar:','my-calendar'); ?></label> <select<?php echo $disabled; ?> id="<?php echo $this->get_field_id('my_calendar_today_linked'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_linked'); ?>"> 
    72     <option value="no" <?php echo ($widget_linked == 'no')?'selected="selected"':''; ?>><?php _e('Not Linked','my-calendar') ?></option> 
    73     <option value="yes" <?php echo ($widget_linked == 'yes')?'selected="selected"':''; ?>><?php _e('Linked','my-calendar') ?></option> 
    74     </select> 
    75     </p> */ ?> 
    76     <p> 
    77     <label for="<?php echo $this->get_field_id('mc_link'); ?>"><?php _e('Widget title links to:','my-calendar'); ?></label><br /> 
    78     <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_link'); ?>" name="<?php echo $this->get_field_name('mc_link'); ?>" value="<?php echo $widget_link; ?>" /></textarea> 
    79     </p>     
    80     <p> 
    81     <label for="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>"><?php _e('Show this text if there are no events today:','my-calendar'); ?></label><br /> 
    82     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>" name="<?php echo $this->get_field_name('my_calendar_no_events_text'); ?>" value="<?php echo $widget_text; ?>" /></textarea> 
    83     </p> 
    84     <p> 
    85     <label for="<?php echo $this->get_field_id('my_calendar_today_category'); ?>"><?php _e('Category or categories to display:','my-calendar'); ?></label><br /> 
    86     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_category'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_category'); ?>" value="<?php echo $widget_category; ?>" /></textarea> 
    87     </p> 
    88     <p> 
    89     <label for="<?php echo $this->get_field_id('my_calendar_today_author'); ?>"><?php _e('Author or authors to show:','my-calendar'); ?></label><br /> 
    90     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_author'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_author'); ?>" value="<?php echo $widget_author; ?>" /></textarea> 
    91     </p> 
    92     <p> 
    93     <label for="<?php echo $this->get_field_id('mc_host'); ?>"><?php _e('Host or hosts to show:','my-calendar'); ?></label><br /> 
    94     <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_host'); ?>" name="<?php echo $this->get_field_name('mc_host'); ?>" value="<?php echo $widget_host; ?>" /></textarea> 
    95     </p>     
    96     <?php 
    97  
     19    function my_calendar_today_widget() { 
     20        parent::WP_Widget( false,$name=__('My Calendar: Today\'s Events','my-calendar') ); 
     21    } 
     22 
     23    function widget( $args, $instance ) { 
     24        extract($args); 
     25        $the_title = apply_filters('widget_title',$instance['my_calendar_today_title']); 
     26        $the_template = $instance['my_calendar_today_template']; 
     27        $the_substitute = $instance['my_calendar_no_events_text']; 
     28        $the_category = ($instance['my_calendar_today_category']=='')?'default':esc_attr($instance['my_calendar_today_category']); 
     29        $author = ( !isset($instance['my_calendar_today_author']) || $instance['my_calendar_today_author']=='')?'all':esc_attr($instance['my_calendar_today_author']); 
     30        $host = ( !isset($instance['mc_host']) || $instance['mc_host']=='')?'all':esc_attr($instance['mc_host']); 
     31        $widget_link = (!empty($instance['my_calendar_today_linked']) && $instance['my_calendar_today_linked']=='yes')?get_option('mc_uri'):''; 
     32        $widget_link = ( !empty($instance['mc_link']) )?esc_url($instance['mc_link']):$widget_link; 
     33        $widget_title = empty($the_title) ? '' : $the_title; 
     34        $offset = (60*60*get_option('gmt_offset')); 
     35        if ( strpos($widget_title,'{date}') !== false ) { $widget_title = str_replace( '{date}',date_i18n(get_option('mc_date_format'),time()+$offset),$widget_title ); }    
     36        $widget_title = ($widget_link=='') ? $widget_title : "<a href='$widget_link'>$widget_title</a>";     
     37        $widget_title = ($widget_title!='') ? $before_title . $widget_title . $after_title : ''; 
     38        $the_events = my_calendar_todays_events($the_category,$the_template,$the_substitute,$author, $host); 
     39            if ($the_events != '') { 
     40              echo $before_widget; 
     41              echo $widget_title; 
     42              echo $the_events; 
     43              echo $after_widget; 
     44            } 
     45    } 
     46 
     47    function form($instance) { 
     48        global $default_template; 
     49        $widget_title = (isset($instance['my_calendar_today_title']))?esc_attr($instance['my_calendar_today_title']):''; 
     50        $widget_template = (isset($instance['my_calendar_today_template']))?esc_attr($instance['my_calendar_today_template']):''; 
     51        if (!$widget_template) { $widget_template = $default_template; } 
     52        $widget_text = (isset($instance['my_calendar_no_events_text']))?esc_attr($instance['my_calendar_no_events_text']):''; 
     53        $widget_category = (isset($instance['my_calendar_today_category']))?esc_attr($instance['my_calendar_today_category']):''; 
     54        $widget_linked = (isset($instance['my_calendar_today_linked']))?esc_attr($instance['my_calendar_today_linked']):''; 
     55        if ( $widget_linked == 'yes' ) { $default_link = get_option('mc_uri'); } else { $default_link = ''; } 
     56        $widget_link = (!empty($instance['mc_link']))?esc_url($instance['mc_link']):$default_link; 
     57        $widget_author = (isset($instance['my_calendar_today_author']))?esc_attr($instance['my_calendar_today_author']):''; 
     58        $widget_host = (isset($instance['mc_host']))?esc_attr($instance['mc_host']):''; 
     59         
     60    ?> 
     61        <p> 
     62        <label for="<?php echo $this->get_field_id('my_calendar_today_title'); ?>"><?php _e('Title','my-calendar'); ?>:</label><br /> 
     63        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_title'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_title'); ?>" value="<?php echo $widget_title; ?>"/> 
     64        </p> 
     65        <p> 
     66        <label for="<?php echo $this->get_field_id('my_calendar_today_template'); ?>"><?php _e('Template','my-calendar'); ?></label><br /> 
     67        <textarea class="widefat" rows="8" cols="20" id="<?php echo $this->get_field_id('my_calendar_today_template'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_template'); ?>"><?php echo $widget_template; ?></textarea> 
     68        </p> 
     69        <?php if ( get_option('mc_uri') == '' ) { $disabled = " disabled='disabled'"; $warning = _e('Add calendar URL to use this option.','my-calendar');  } else { $disabled = $warning = ""; } ?> 
     70        <p> 
     71        <label for="<?php echo $this->get_field_id('mc_link'); ?>"><?php _e('Widget title links to:','my-calendar'); ?></label><br /> 
     72        <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_link'); ?>" name="<?php echo $this->get_field_name('mc_link'); ?>" value="<?php echo $widget_link; ?>" /></textarea> 
     73        </p>     
     74        <p> 
     75        <label for="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>"><?php _e('Show this text if there are no events today:','my-calendar'); ?></label><br /> 
     76        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>" name="<?php echo $this->get_field_name('my_calendar_no_events_text'); ?>" value="<?php echo $widget_text; ?>" /></textarea> 
     77        </p> 
     78        <p> 
     79        <label for="<?php echo $this->get_field_id('my_calendar_today_category'); ?>"><?php _e('Category or categories to display:','my-calendar'); ?></label><br /> 
     80        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_category'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_category'); ?>" value="<?php echo $widget_category; ?>" /></textarea> 
     81        </p> 
     82        <p> 
     83        <label for="<?php echo $this->get_field_id('my_calendar_today_author'); ?>"><?php _e('Author or authors to show:','my-calendar'); ?></label><br /> 
     84        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_today_author'); ?>" name="<?php echo $this->get_field_name('my_calendar_today_author'); ?>" value="<?php echo $widget_author; ?>" /></textarea> 
     85        </p> 
     86        <p> 
     87        <label for="<?php echo $this->get_field_id('mc_host'); ?>"><?php _e('Host or hosts to show:','my-calendar'); ?></label><br /> 
     88        <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_host'); ?>" name="<?php echo $this->get_field_name('mc_host'); ?>" value="<?php echo $widget_host; ?>" /></textarea> 
     89        </p>     
     90        <?php 
     91    }   
    9892 
    9993    function update($new_instance,$old_instance) { 
     
    109103        return $instance; 
    110104    } 
    111  
    112105} 
    113106 
    114107class my_calendar_upcoming_widget extends WP_Widget { 
    115108 
    116 function my_calendar_upcoming_widget() { 
    117     parent::WP_Widget( false,$name=__('My Calendar: Upcoming Events','my-calendar') ); 
    118 } 
    119  
    120 function widget($args, $instance) { 
    121     extract($args); 
    122     $the_title = apply_filters('widget_title',$instance['my_calendar_upcoming_title']); 
    123     $the_template = $instance['my_calendar_upcoming_template']; 
    124     $the_substitute = $instance['my_calendar_no_events_text']; 
    125     $before = ($instance['my_calendar_upcoming_before']!='')?esc_attr($instance['my_calendar_upcoming_before']):3; 
    126     $after = ($instance['my_calendar_upcoming_after']!='')?esc_attr($instance['my_calendar_upcoming_after']):3; 
    127     $skip = ($instance['my_calendar_upcoming_skip']!='')?esc_attr($instance['my_calendar_upcoming_skip']):0; 
    128     $show_today = ($instance['my_calendar_upcoming_show_today']=='no')?'no':'yes'; 
    129     $type = esc_attr($instance['my_calendar_upcoming_type']); 
    130     $order = esc_attr($instance['my_calendar_upcoming_order']); 
    131     $the_category = ($instance['my_calendar_upcoming_category']=='')?'default':esc_attr($instance['my_calendar_upcoming_category']); 
    132     $author = ( !isset($instance['my_calendar_upcoming_author']) || $instance['my_calendar_upcoming_author']=='')?'default':esc_attr($instance['my_calendar_upcoming_author']); 
    133     $host = ( !isset($instance['mc_host']) || $instance['mc_host']=='')?'default':esc_attr($instance['mc_host']); 
    134     $widget_link = ($instance['my_calendar_upcoming_linked']=='yes')?get_option('mc_uri'):''; 
    135     $widget_link = ( !empty($instance['mc_link']) )?esc_url($instance['mc_link']):$widget_link; 
    136     $widget_title = empty($the_title) ? '' : $the_title; 
    137     $widget_title = ($widget_link=='') ? $widget_title : "<a href='$widget_link'>$widget_title</a>"; 
    138     $widget_title = ($widget_title!='') ? $before_title . $widget_title . $after_title : ''; 
    139     $the_events = my_calendar_upcoming_events($before,$after,$type,$the_category,$the_template,$the_substitute, $order,$skip, $show_today,$author, $host); 
     109    function my_calendar_upcoming_widget() { 
     110        parent::WP_Widget( false,$name=__('My Calendar: Upcoming Events','my-calendar') ); 
     111    } 
     112 
     113    function widget($args, $instance) { 
     114        extract($args); 
     115        $the_title = apply_filters('widget_title',$instance['my_calendar_upcoming_title']); 
     116        $the_template = $instance['my_calendar_upcoming_template']; 
     117        $the_substitute = $instance['my_calendar_no_events_text']; 
     118        $before = ($instance['my_calendar_upcoming_before']!='')?esc_attr($instance['my_calendar_upcoming_before']):3; 
     119        $after = ($instance['my_calendar_upcoming_after']!='')?esc_attr($instance['my_calendar_upcoming_after']):3; 
     120        $skip = ($instance['my_calendar_upcoming_skip']!='')?esc_attr($instance['my_calendar_upcoming_skip']):0; 
     121        $show_today = ($instance['my_calendar_upcoming_show_today']=='no')?'no':'yes'; 
     122        $type = esc_attr($instance['my_calendar_upcoming_type']); 
     123        $order = esc_attr($instance['my_calendar_upcoming_order']); 
     124        $the_category = ($instance['my_calendar_upcoming_category']=='')?'default':esc_attr($instance['my_calendar_upcoming_category']); 
     125        $author = ( !isset($instance['my_calendar_upcoming_author']) || $instance['my_calendar_upcoming_author']=='')?'default':esc_attr($instance['my_calendar_upcoming_author']); 
     126        $host = ( !isset($instance['mc_host']) || $instance['mc_host']=='')?'default':esc_attr($instance['mc_host']); 
     127        $widget_link = ($instance['my_calendar_upcoming_linked']=='yes')?get_option('mc_uri'):''; 
     128        $widget_link = ( !empty($instance['mc_link']) )?esc_url($instance['mc_link']):$widget_link; 
     129        $widget_title = empty($the_title) ? '' : $the_title; 
     130        $widget_title = ($widget_link=='') ? $widget_title : "<a href='$widget_link'>$widget_title</a>"; 
     131        $widget_title = ($widget_title!='') ? $before_title . $widget_title . $after_title : ''; 
     132        $the_events = my_calendar_upcoming_events($before,$after,$type,$the_category,$the_template,$the_substitute,$order,$skip, $show_today,$author,$host); 
    140133        if ($the_events != '') { 
    141134            echo $before_widget; 
     
    144137            echo $after_widget; 
    145138        } 
    146 } 
    147  
    148  
    149 function form($instance) { 
    150     global $default_template; 
    151      
    152     $widget_title = (isset($instance['my_calendar_upcoming_title']) )?esc_attr($instance['my_calendar_upcoming_title']):''; 
    153     $widget_template = (isset($instance['my_calendar_upcoming_template']) )?esc_attr($instance['my_calendar_upcoming_template']):''; 
    154     if (!$widget_template) { $widget_template = $default_template; } 
    155     $widget_text = (isset($instance['my_calendar_no_events_text']) )?esc_attr($instance['my_calendar_no_events_text']):''; 
    156     $widget_category = (isset($instance['my_calendar_upcoming_category']) )?esc_attr($instance['my_calendar_upcoming_category']):''; 
    157     $widget_author = (isset($instance['my_calendar_upcoming_author']) )?esc_attr($instance['my_calendar_upcoming_author']):''; 
    158     $widget_host = (isset($instance['mc_host']) )?esc_attr($instance['mc_host']):''; 
    159     $widget_before = (isset($instance['my_calendar_upcoming_before']) )?esc_attr($instance['my_calendar_upcoming_before']):''; 
    160     $widget_after = (isset($instance['my_calendar_upcoming_after']) )?esc_attr($instance['my_calendar_upcoming_after']):''; 
    161     $widget_show_today = (isset($instance['my_calendar_upcoming_show_today']) )?esc_attr($instance['my_calendar_upcoming_show_today']):''; 
    162     $widget_type = (isset($instance['my_calendar_upcoming_type']) )?esc_attr($instance['my_calendar_upcoming_type']):''; 
    163     $widget_order = (isset($instance['my_calendar_upcoming_order']) )?esc_attr($instance['my_calendar_upcoming_order']):''; 
    164     $widget_linked = (isset($instance['my_calendar_upcoming_linked']) )?esc_attr($instance['my_calendar_upcoming_linked']):''; 
    165     if ( $widget_linked == 'yes' ) { $default_link = get_option('mc_uri'); } else { $default_link = ''; } 
    166     $widget_link = (!empty($instance['mc_link']))?esc_url($instance['mc_link']):$default_link; 
    167     $widget_skip = (isset($instance['my_calendar_upcoming_skip']) )?esc_attr($instance['my_calendar_upcoming_skip']):''; 
    168      
    169 ?> 
    170     <p> 
    171     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_title'); ?>"><?php _e('Title','my-calendar'); ?>:</label><br /> 
    172     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_title'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_title'); ?>" value="<?php echo $widget_title; ?>"/> 
    173     </p> 
    174     <p> 
    175     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_template'); ?>"><?php _e('Template','my-calendar'); ?></label><br /> 
    176     <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('my_calendar_upcoming_template'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_template'); ?>"><?php echo $widget_template; ?></textarea> 
    177     </p> 
    178     <fieldset> 
    179     <legend><?php _e('Widget Options','my-calendar'); ?></legend> 
    180     <?php $config_url = admin_url("admin.php?page=my-calendar-config"); ?> 
    181     <?php if ( get_option('mc_uri') == '' ) { $disabled = " disabled='disabled'";  _e('Add <a href="'.$config_url.'#mc_uri" target="_blank" title="Opens in new window">calendar URL in settings</a> to use this option.','my-calendar');  } else { $disabled=""; } ?> 
    182     <?php /* <p> 
    183     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_linked'); ?>"><?php _e('Link widget title to calendar:','my-calendar'); ?></label> <select<?php echo $disabled; ?> id="<?php echo $this->get_field_id('my_calendar_upcoming_linked'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_linked'); ?>"> 
    184     <option value="no" <?php echo ($widget_linked == 'no')?'selected="selected"':''; ?>><?php _e('Not Linked','my-calendar') ?></option> 
    185     <option value="yes" <?php echo ($widget_linked == 'yes')?'selected="selected"':''; ?>><?php _e('Linked','my-calendar') ?></option> 
    186     </select> 
    187     </p> */ ?> 
    188     <p> 
    189     <label for="<?php echo $this->get_field_id('mc_link'); ?>"><?php _e('Widget title links to:','my-calendar'); ?></label><br /> 
    190     <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_link'); ?>" name="<?php echo $this->get_field_name('mc_link'); ?>" value="<?php echo $widget_link; ?>" /></textarea> 
    191     </p>         
    192     <p> 
    193     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_type'); ?>"><?php _e('Display upcoming events by:','my-calendar'); ?></label> <select id="<?php echo $this->get_field_id('my_calendar_upcoming_type'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_type'); ?>"> 
    194     <option value="events" <?php echo ($widget_type == 'events')?'selected="selected"':''; ?>><?php _e('Events (e.g. 2 past, 3 future)','my-calendar') ?></option> 
    195     <option value="days" <?php echo ($widget_type == 'days')?'selected="selected"':''; ?>><?php _e('Dates (e.g. 4 days past, 5 forward)','my-calendar') ?></option> 
    196     <option value="month" <?php echo ($widget_type == 'month')?'selected="selected"':''; ?>><?php _e('Show current month','my-calendar') ?></option> 
    197     <option value="year" <?php echo ($widget_type == 'year')?'selected="selected"':''; ?>><?php _e('Show current year','my-calendar') ?></option> 
    198     </select> 
    199     </p> 
    200     <p> 
    201     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_skip'); ?>"><?php _e('Skip the first <em>n</em> events','my-calendar'); ?></label> <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_skip'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_skip'); ?>" value="<?php echo $widget_skip; ?>" /> 
    202     </p> 
    203     <p> 
    204     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_order'); ?>"><?php _e('Events sort order:','my-calendar'); ?></label> <select id="<?php echo $this->get_field_id('my_calendar_upcoming_order'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_order'); ?>"> 
    205     <option value="asc" <?php echo ($widget_order == 'asc')?'selected="selected"':''; ?>><?php _e('Ascending (near to far)','my-calendar') ?></option> 
    206     <option value="desc" <?php echo ($widget_order == 'desc')?'selected="selected"':''; ?>><?php _e('Descending (far to near)','my-calendar') ?></option> 
    207     </select> 
    208     </p> 
    209     <?php if ( !( $widget_type == 'month' || $widget_type == 'year' ) ) { ?> 
    210     <p> 
    211     <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_after'); ?>" value="<?php echo $widget_after; ?>" size="1" maxlength="3" /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>"><?php _e("$widget_type into the future;",'my-calendar'); ?></label><br /> 
    212     <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_before'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_before'); ?>" value="<?php echo $widget_before; ?>" size="1" maxlength="3" /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>"><?php _e("$widget_type from the past",'my-calendar'); ?></label> 
    213     </p> 
    214     <?php } ?> 
    215     <p> 
    216     <input type="checkbox" id="<?php echo $this->get_field_id('my_calendar_upcoming_show_today'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_show_today'); ?>" value="yes"<?php echo ($widget_show_today =='yes' || $widget_show_today == '' )?' checked="checked"':''; ?> /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_show_today'); ?>"><?php _e("Include today's events",'my-calendar'); ?></label> 
    217     </p> 
    218     <p> 
    219     <label for="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>"><?php _e('Show this text if there are no events meeting your criteria:','my-calendar'); ?></label><br /> 
    220     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>" name="<?php echo $this->get_field_name('my_calendar_no_events_text'); ?>" value="<?php echo $widget_text; ?>" /></textarea> 
    221     </p> 
    222     <p> 
    223     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_category'); ?>"><?php _e('Category or categories to display:','my-calendar'); ?></label><br /> 
    224     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_category'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_category'); ?>" value="<?php echo $widget_category; ?>" /></textarea> 
    225     </p> 
    226     <p> 
    227     <label for="<?php echo $this->get_field_id('my_calendar_upcoming_author'); ?>"><?php _e('Author or authors to show:','my-calendar'); ?></label><br /> 
    228     <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_author'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_author'); ?>" value="<?php echo $widget_author; ?>" /></textarea> 
    229     </p> 
    230     <p> 
    231     <label for="<?php echo $this->get_field_id('mc_host'); ?>"><?php _e('Host or hosts to show:','my-calendar'); ?></label><br /> 
    232     <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_host'); ?>" name="<?php echo $this->get_field_name('mc_host'); ?>" value="<?php echo $widget_host; ?>" /></textarea> 
    233     </p>     
    234     <?php 
    235  
     139    } 
     140 
     141    function form($instance) { 
     142        global $default_template; 
     143        $widget_title = (isset($instance['my_calendar_upcoming_title']) )?esc_attr($instance['my_calendar_upcoming_title']):''; 
     144        $widget_template = (isset($instance['my_calendar_upcoming_template']) )?esc_attr($instance['my_calendar_upcoming_template']):''; 
     145        if (!$widget_template) { $widget_template = $default_template; } 
     146        $widget_text = (isset($instance['my_calendar_no_events_text']) )?esc_attr($instance['my_calendar_no_events_text']):''; 
     147        $widget_category = (isset($instance['my_calendar_upcoming_category']) )?esc_attr($instance['my_calendar_upcoming_category']):''; 
     148        $widget_author = (isset($instance['my_calendar_upcoming_author']) )?esc_attr($instance['my_calendar_upcoming_author']):''; 
     149        $widget_host = (isset($instance['mc_host']) )?esc_attr($instance['mc_host']):''; 
     150        $widget_before = (isset($instance['my_calendar_upcoming_before']) )?esc_attr($instance['my_calendar_upcoming_before']):''; 
     151        $widget_after = (isset($instance['my_calendar_upcoming_after']) )?esc_attr($instance['my_calendar_upcoming_after']):''; 
     152        $widget_show_today = (isset($instance['my_calendar_upcoming_show_today']) )?esc_attr($instance['my_calendar_upcoming_show_today']):''; 
     153        $widget_type = (isset($instance['my_calendar_upcoming_type']) )?esc_attr($instance['my_calendar_upcoming_type']):''; 
     154        $widget_order = (isset($instance['my_calendar_upcoming_order']) )?esc_attr($instance['my_calendar_upcoming_order']):''; 
     155        $widget_linked = (isset($instance['my_calendar_upcoming_linked']) )?esc_attr($instance['my_calendar_upcoming_linked']):''; 
     156        if ( $widget_linked == 'yes' ) { $default_link = get_option('mc_uri'); } else { $default_link = ''; } 
     157        $widget_link = (!empty($instance['mc_link']))?esc_url($instance['mc_link']):$default_link; 
     158        $widget_skip = (isset($instance['my_calendar_upcoming_skip']) )?esc_attr($instance['my_calendar_upcoming_skip']):'';     
     159        ?> 
     160        <p> 
     161        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_title'); ?>"><?php _e('Title','my-calendar'); ?>:</label><br /> 
     162        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_title'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_title'); ?>" value="<?php echo $widget_title; ?>"/> 
     163        </p> 
     164        <p> 
     165        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_template'); ?>"><?php _e('Template','my-calendar'); ?></label><br /> 
     166        <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('my_calendar_upcoming_template'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_template'); ?>"><?php echo $widget_template; ?></textarea> 
     167        </p> 
     168        <fieldset> 
     169        <legend><?php _e('Widget Options','my-calendar'); ?></legend> 
     170        <?php $config_url = admin_url("admin.php?page=my-calendar-config"); ?> 
     171        <?php if ( get_option('mc_uri') == '' ) { $disabled = " disabled='disabled'";  _e('Add <a href="'.$config_url.'#mc_uri" target="_blank" title="Opens in new window">calendar URL in settings</a> to use this option.','my-calendar');  } else { $disabled=""; } ?> 
     172        <p> 
     173        <label for="<?php echo $this->get_field_id('mc_link'); ?>"><?php _e('Widget title links to:','my-calendar'); ?></label><br /> 
     174        <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_link'); ?>" name="<?php echo $this->get_field_name('mc_link'); ?>" value="<?php echo $widget_link; ?>" /></textarea> 
     175        </p>         
     176        <p> 
     177        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_type'); ?>"><?php _e('Display upcoming events by:','my-calendar'); ?></label> <select id="<?php echo $this->get_field_id('my_calendar_upcoming_type'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_type'); ?>"> 
     178        <option value="events" <?php echo ($widget_type == 'events')?'selected="selected"':''; ?>><?php _e('Events (e.g. 2 past, 3 future)','my-calendar') ?></option> 
     179        <option value="days" <?php echo ($widget_type == 'days')?'selected="selected"':''; ?>><?php _e('Dates (e.g. 4 days past, 5 forward)','my-calendar') ?></option> 
     180        <option value="month" <?php echo ($widget_type == 'month')?'selected="selected"':''; ?>><?php _e('Show current month','my-calendar') ?></option> 
     181        <option value="year" <?php echo ($widget_type == 'year')?'selected="selected"':''; ?>><?php _e('Show current year','my-calendar') ?></option> 
     182        </select> 
     183        </p> 
     184        <p> 
     185        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_skip'); ?>"><?php _e('Skip the first <em>n</em> events','my-calendar'); ?></label> <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_skip'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_skip'); ?>" value="<?php echo $widget_skip; ?>" /> 
     186        </p> 
     187        <p> 
     188        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_order'); ?>"><?php _e('Events sort order:','my-calendar'); ?></label> <select id="<?php echo $this->get_field_id('my_calendar_upcoming_order'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_order'); ?>"> 
     189        <option value="asc" <?php echo ($widget_order == 'asc')?'selected="selected"':''; ?>><?php _e('Ascending (near to far)','my-calendar') ?></option> 
     190        <option value="desc" <?php echo ($widget_order == 'desc')?'selected="selected"':''; ?>><?php _e('Descending (far to near)','my-calendar') ?></option> 
     191        </select> 
     192        </p> 
     193        <?php if ( !( $widget_type == 'month' || $widget_type == 'year' ) ) { ?> 
     194        <p> 
     195        <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_after'); ?>" value="<?php echo $widget_after; ?>" size="1" maxlength="3" /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>"><?php _e("$widget_type into the future;",'my-calendar'); ?></label><br /> 
     196        <input type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_before'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_before'); ?>" value="<?php echo $widget_before; ?>" size="1" maxlength="3" /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_after'); ?>"><?php _e("$widget_type from the past",'my-calendar'); ?></label> 
     197        </p> 
     198        <?php } ?> 
     199        <p> 
     200        <input type="checkbox" id="<?php echo $this->get_field_id('my_calendar_upcoming_show_today'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_show_today'); ?>" value="yes"<?php echo ($widget_show_today =='yes' || $widget_show_today == '' )?' checked="checked"':''; ?> /> <label for="<?php echo $this->get_field_id('my_calendar_upcoming_show_today'); ?>"><?php _e("Include today's events",'my-calendar'); ?></label> 
     201        </p> 
     202        <p> 
     203        <label for="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>"><?php _e('Show this text if there are no events meeting your criteria:','my-calendar'); ?></label><br /> 
     204        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_no_events_text'); ?>" name="<?php echo $this->get_field_name('my_calendar_no_events_text'); ?>" value="<?php echo $widget_text; ?>" /></textarea> 
     205        </p> 
     206        <p> 
     207        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_category'); ?>"><?php _e('Category or categories to display:','my-calendar'); ?></label><br /> 
     208        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_category'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_category'); ?>" value="<?php echo $widget_category; ?>" /></textarea> 
     209        </p> 
     210        <p> 
     211        <label for="<?php echo $this->get_field_id('my_calendar_upcoming_author'); ?>"><?php _e('Author or authors to show:','my-calendar'); ?></label><br /> 
     212        <input class="widefat" type="text" id="<?php echo $this->get_field_id('my_calendar_upcoming_author'); ?>" name="<?php echo $this->get_field_name('my_calendar_upcoming_author'); ?>" value="<?php echo $widget_author; ?>" /></textarea> 
     213        </p> 
     214        <p> 
     215        <label for="<?php echo $this->get_field_id('mc_host'); ?>"><?php _e('Host or hosts to show:','my-calendar'); ?></label><br /> 
     216        <input class="widefat" type="text" id="<?php echo $this->get_field_id('mc_host'); ?>" name="<?php echo $this->get_field_name('mc_host'); ?>" value="<?php echo $widget_host; ?>" /></textarea> 
     217        </p>     
     218        <?php 
     219    }   
    236220 
    237221    function update($new_instance,$old_instance) { 
     
    245229        $instance['my_calendar_upcoming_before'] = strip_tags($new_instance['my_calendar_upcoming_before']); 
    246230        $instance['my_calendar_upcoming_after'] = strip_tags($new_instance['my_calendar_upcoming_after']); 
    247         $instance['my_calendar_upcoming_show_today'] = ($new_instance['my_calendar_upcoming_show_today']=='yes')?'yes':'no';         
     231        $instance['my_calendar_upcoming_show_today'] = ($new_instance['my_calendar_upcoming_show_today']=='yes')?'yes':'no'; 
    248232        $instance['my_calendar_upcoming_type'] = strip_tags($new_instance['my_calendar_upcoming_type']); 
    249233        $instance['my_calendar_upcoming_order'] = strip_tags($new_instance['my_calendar_upcoming_order']); 
     
    257241// Widget upcoming events 
    258242function my_calendar_upcoming_events($before='default',$after='default',$type='default',$category='default',$template='default',$substitute='',$order='asc',$skip=0, $show_today='yes',$author='default',$host='default' ) { 
    259   global $wpdb,$default_template,$defaults; 
    260   $mcdb = $wpdb; 
    261   if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { $mcdb = mc_remote_db(); } 
    262   $output = ''; 
    263   $date_format = ( get_option('mc_date_format') != '' )?get_option('mc_date_format'):get_option('date_format'); 
    264   // This function cannot be called unless calendar is up to date 
     243    global $wpdb,$default_template,$defaults; 
     244    $mcdb = $wpdb; 
     245    if ( get_option( 'mc_remote' ) == 'true' && function_exists('mc_remote_db') ) { $mcdb = mc_remote_db(); } 
     246    $output = ''; 
     247    $date_format = ( get_option('mc_date_format') != '' )?get_option('mc_date_format'):get_option('date_format'); 
     248    // This function cannot be called unless calendar is up to date 
    265249    check_my_calendar(); 
    266250    $offset = (60*60*get_option('gmt_offset'));  
     
    285269        $temp_array = array(); 
    286270        $event_array = array(); 
    287             if ( $display_upcoming_type == "days" ) { 
    288                 $from = date( 'Y-m-d',strtotime("-$before days") ); 
    289                 $to = date( 'Y-m-d',strtotime("+$after days") ); 
    290             } 
    291             if ( $display_upcoming_type == "month" ) { 
    292                 $from = date( 'Y-m-1' ); 
    293                 $to = date( 'Y-m-t' ); 
    294             } 
    295             if ( $display_upcoming_type == "year" ) { 
    296                 $from = date( 'Y-1-1' ); 
    297                 $to = date( 'Y-12-31' ); 
    298             } 
    299             $events = my_calendar_grab_events( $from, $to, $category,'','','upcoming',$author, $host ); 
    300             if ( !get_option('mc_skip_holidays_category') || get_option('mc_skip_holidays_category') == '' ) {  
    301                 $holidays = array(); 
     271        if ( $display_upcoming_type == "days" ) { 
     272            $from = date( 'Y-m-d',strtotime("-$before days") ); 
     273            $to = date( 'Y-m-d',strtotime("+$after days") ); 
     274        } 
     275        if ( $display_upcoming_type == "month" ) { 
     276            $from = date( 'Y-m-1' ); 
     277            $to = date( 'Y-m-t' ); 
     278        } 
     279        if ( $display_upcoming_type == "year" ) { 
     280            $from = date( 'Y-1-1' ); 
     281            $to = date( 'Y-12-31' ); 
     282        } 
     283        $events = my_calendar_grab_events( $from, $to, $category,'','','upcoming',$author, $host ); 
     284        if ( !get_option('mc_skip_holidays_category') || get_option('mc_skip_holidays_category') == '' ) {  
     285            $holidays = array(); 
     286        } else { 
     287            $holidays = my_calendar_grab_events( $from, $to, get_option('mc_skip_holidays_category'),'','', 'upcoming', $author, $host ); 
     288            $holiday_array = mc_set_date_array( $holidays ); 
     289        } 
     290        // get events into an easily parseable set, keyed by date. 
     291        if ( is_array( $events ) && !empty($events) ) { 
     292            $no_events = false; 
     293            $event_array = mc_set_date_array( $events ); 
     294            if ( is_array( $holidays ) && count($holidays) > 0 ) { 
     295                $event_array = mc_holiday_limit( $event_array, $holiday_array ); // if there are holidays, rejigger. 
     296            }            
     297        }            
     298        if (count($event_array) != 0) { 
     299            foreach( $event_array as $key=>$value) { 
     300                if ( is_array($value) ) { 
     301                    foreach ( $value as $k => $v ) { 
     302                        $event = event_as_array( $v ); 
     303                        $temp_array[] = $event; 
     304                    } 
     305                } 
     306            } 
     307        } 
     308        $i = 0; 
     309        $last_item = ''; 
     310        $last_id = ''; 
     311        foreach ( reverse_array($temp_array, true, $order) as $details ) { 
     312            $item = jd_draw_template($details,$template); 
     313            if ( $i < $skip && $skip != 0 ) { 
     314                $i++; 
    302315            } else { 
    303                 $holidays = my_calendar_grab_events( $from, $to, get_option('mc_skip_holidays_category'),'','', 'upcoming', $author, $host ); 
    304                 $holiday_array = mc_set_date_array( $holidays ); 
    305             } 
    306             // get events into an easily parseable set, keyed by date. 
    307             if ( is_array( $events ) && !empty($events) ) { 
    308                 $no_events = false; 
    309                 $event_array = mc_set_date_array( $events ); 
    310                 if ( is_array( $holidays ) && count($holidays) > 0 ) { 
    311                     $event_array = mc_holiday_limit( $event_array, $holiday_array ); // if there are holidays, rejigger. 
    312                 }            
    313             }            
    314             if (count($event_array) != 0) { 
    315                 foreach( $event_array as $key=>$value) { 
    316                     if ( is_array($value) ) { 
    317                         foreach ( $value as $k => $v ) { 
    318                             $event = event_as_array( $v ); 
    319                             $temp_array[] = $event; 
    320                         } 
    321                     } 
    322                 } 
    323             } 
    324             $i = 0; 
    325             $last_item = ''; 
    326             $last_id = ''; 
    327             foreach ( reverse_array($temp_array, true, $order) as $details ) { 
    328                 $item = jd_draw_template($details,$template); 
    329                 if ( $i < $skip && $skip != 0 ) { 
    330                     $i++; 
    331                 } else { 
    332                     if ( $details['group'] !== $last_id || $details['group'] == '0' ) { 
    333                         $output .= ( $item == $last_item )?'':"<li>$item</li>";  
    334                     }                
    335                 } 
    336                 $last_id = $details['group']; // prevents grouped items from displaying in a row. Does not prevent if there are other intervening events. 
    337                 $last_item = $item; 
    338             } 
     316                if ( $details['group'] !== $last_id || $details['group'] == '0' ) { 
     317                    $output .= ( $item == $last_item )?'':"<li>$item</li>";  
     318                }                
     319            } 
     320            $last_id = $details['group']; // prevent group events from displaying in a row. Not if there are intervening events. 
     321            $last_item = $item; 
     322        } 
    339323    } else { 
    340         $caching = ( get_option('mc_caching_enabled') == 'true' )?true:false; 
     324        $caching = apply_filters( 'mc_cache_enabled', false ); 
    341325        if ( $caching ) {  
    342326            $cache = get_transient( 'mc_cache_upcoming' );  
     
    544528// Widget todays events 
    545529function my_calendar_todays_events($category='default',$template='default',$substitute='',$author='all', $host='all') { 
    546     $caching = ( get_option('mc_caching_enabled') == 'true' )?true:false; 
     530    $caching = apply_filters( 'mc_cache_enabled', false ); 
    547531    $todays_cache = ($caching)? get_transient('mc_todays_cache') :''; 
    548  
    549 if ( $caching && is_array($todays_cache) && @$todays_cache[$category] ) { return @$todays_cache[$category]; } 
     532    if ( $caching && is_array($todays_cache) && @$todays_cache[$category] ) { return @$todays_cache[$category]; } 
    550533    global $wpdb, $default_template; 
    551534    $mcdb = $wpdb; 
  • my-calendar/trunk/my-calendar.php

    r745698 r759510  
    66Author: Joseph C Dolson 
    77Author URI: http://www.joedolson.com 
    8 Version: 2.2.7 
     8Version: 2.2.8 
    99*/ 
    1010/*  Copyright 2009-2013  Joe Dolson (email : joe@joedolson.com) 
     
    2626if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    2727 
     28apply_filters("debug", "MC Started"); 
     29 
    2830global $mc_version, $wpdb; 
    29 $mc_version = '2.2.7'; 
     31$mc_version = '2.2.8'; 
    3032 
    3133// Define the tables used in My Calendar 
     
    111113add_filter('plugin_action_links', 'jd_calendar_plugin_action', -10, 2); 
    112114add_filter( 'wp_title','mc_event_filter',10,3 ); 
    113 /* needs work  
    114 add_filter( 'the_title', 'mc_title_filter', 10 ); 
    115  
    116 function mc_title_filter( $title, $id ) { 
    117     global $post; // causes problems with other filtering. 
    118     if ( isset($_GET['mc_id']) && $title == $post->post_title ) { 
    119         $id = (int) $_GET['mc_id']; 
    120         $event = mc_get_event( $id ); 
    121         $array = event_as_array( $event ); 
    122         $template = ( get_option( 'mc_detail_title_template' ) != '' )? stripslashes( get_option( 'mc_detail_title_template' ) ):"Details for &ldquo;{title}&rdquo;"; 
    123         return jd_draw_template( $array, $template ); 
    124     } else { 
    125         return $title; 
    126     } 
    127 } 
    128 */ 
    129115 
    130116function mc_event_filter( $title, $sep, $seplocation ) { 
     
    144130// produce admin support box 
    145131function jd_show_support_box( $show='', $add=false, $remove=false ) { 
    146 if ( current_user_can('mc_view_help') ) { 
    147 ?> 
     132    if ( current_user_can('mc_view_help') ) { ?> 
    148133    <div class="postbox-container" style="width:20%"> 
    149134    <div class="metabox-holder"> 
     
    322307        <dd><?php _e('Hex code for the event\'s category color.','my-calendar'); ?></dd> 
    323308 
    324         <dt><code>{category_id}</code></dt> 
     309        <dt><code>{cat_id}</code></dt> 
    325310        <dd><?php _e('ID of the category of the event.','my-calendar'); ?></dd> 
    326311        </dl> 
     
    337322// Function to deal with adding the calendar menus 
    338323function my_calendar_menu() { 
    339   global $wpdb; 
     324    global $wpdb; 
    340325    $mcdb = $wpdb;   
    341   check_my_calendar(); 
    342   $icon_path = plugins_url('/my-calendar/images'); 
     326    check_my_calendar(); 
     327    $icon_path = plugins_url('/my-calendar/images'); 
    343328    if ( function_exists('add_object_page') ) { 
    344329        if ( get_option( 'mc_remote' ) != 'true' ) { 
     
    383368} 
    384369 
    385 /* TESTING SECTION JCD */ 
    386  
    387370function mc_event_editing() { 
    388371    $option = 'mc_show_on_page'; 
    389       
    390372    $args = array( 
    391     'label' => 'Show these fields', 
    392     'default' => get_option('mc_input_options'), 
    393     'option' => 'mc_show_on_page' 
    394 ); 
    395   
    396 add_screen_option( $option, $args ); 
    397   
    398 } 
     373        'label' => 'Show these fields', 
     374        'default' => get_option('mc_input_options'), 
     375        'option' => 'mc_show_on_page' 
     376    ); 
     377    add_screen_option( $option, $args ); 
     378} 
     379 
    399380add_filter('screen_settings', 'mc_show_event_editing', 10, 2 ); 
    400381function mc_show_event_editing( $status, $args ) { 
    401     $return = ''; 
     382    $return = $status; 
    402383    if ( $args->base == 'toplevel_page_my-calendar' ) { 
    403384        $input_options = get_user_meta( get_current_user_id(), 'mc_show_on_page', true ); 
     
    418399        } 
    419400        $button = get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); 
    420     $return = " 
     401    $return .= " 
    421402    <fieldset> 
    422403    <legend>". __('Event editing fields to show','my-calendar') ."</legend> 
     
    448429    return $value; 
    449430} 
    450 /* END TESTING SECTION */ 
    451431 
    452432function mc_add_screen_option() { 
     
    462442 
    463443add_filter('set-screen-option', 'mc_set_screen_option', 10, 3); 
    464   
    465444function mc_set_screen_option($status, $option, $value) { 
    466445    //if ( 'mc_num_per_page' == $option ) return $value; 
     
    489468add_shortcode('my_calendar_event','my_calendar_show_event'); 
    490469add_shortcode('my_calendar_search','my_calendar_search'); 
     470 
     471apply_filters("debug", "MC Loaded"); 
  • my-calendar/trunk/readme.txt

    r745698 r759510  
    44Tags: calendar, dates, times, events, scheduling, event manager, event calendar 
    55Requires at least: 3.3.0 
    6 Tested up to: 3.6 beta 
     6Tested up to: 3.6 
    77License: GPLv2 or later 
    8 Stable tag: trunk 
     8Stable tag: 2.2.8 
    99 
    1010Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets. 
     
    4747    * event location 
    4848*   Email notification to administrator when events are scheduled or reserved 
    49 *   Post to Twitter when new events are created. (with [WP to Twitter](http://wordpress.org/extend/plugins/wp-to-twitter/)) 
    50 *   Location Manager for storing frequently used venues 
     49*   Post to Twitter when events are created. (with [WP to Twitter](http://wordpress.org/extend/plugins/wp-to-twitter/)) 
     50*   Location Manager for frequently used venues 
    5151*   Fetch events from a remote MySQL database. (Sharing events in a network of sites.) 
    5252*   Import from [Kieran O'Shea's Calendar plugin](http://wordpress.org/extend/plugins/calendar/) 
    5353*   Integrated Help page to guide in use of shortcodes and template tags 
     54*   New: [Developer Documentation](http://www.joedolson.com/articles/doc-category/my-calendar-3/) 
    5455 
    5556= Translations = 
     
    8586 
    8687== Changelog == 
     88 
     89= 2.2.8 = 
     90 
     91* Bug fix: Fix in mini calendar scripting with AJAX. 
     92* Bug fix: Strict error in My Calendar Search widget. 
     93* Bug fix: My Calendar screen options disabled other screen options. 
     94* Updated: Slovenian 
     95* Documentation error: cat_id, not category_id 
     96* Added support for <a href="http://wordpress.org/plugins/botsmasher/">BotSmasher</a> as a spam filter for events. 
     97* Removed location region from Google Maps string (Google Maps choked on that data.) 
     98* Removed EasyDrag jQuery plug-in due to compatibility issues. 
     99* Eliminated 4 filters: mc_event_content_{$type}; replaced with single filter mc_event_content with $type parameter. 
     100* Added support for WP 3.6 shortcode attribute filters. 
     101* Added more filters & actions. Lots and lots of filters. Actions. Yeah. 
     102* Maybe I'm the only one excited about the last thing. 
    87103 
    88104= 2.2.7 = 
     
    10861102== Upgrade Notice == 
    10871103 
    1088 = 2.2.0 = 
    1089 Lots of new features and bug fixes; check out the changelog! 
     1104= 2.2.8 = 
     1105Bug fixes and loads of new filters and actions for developers. 
Note: See TracChangeset for help on using the changeset viewer.