Plugin Directory

Changeset 485227


Ignore:
Timestamp:
01/05/2012 06:52:45 PM (14 years ago)
Author:
barclay_reg
Message:

added WP Calendar check and category parameter to the feed url

Location:
ical-for-wp-calendar/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ical-for-wp-calendar/trunk/ical-wp-calendar.php

    r430931 r485227  
    44Plugin URI: http://wordpress.org/extend/plugins/ical-for-wp-calendar/
    55Description: Creates an iCal feed for WP Calendar (http://www.faebusoft.ch/webentwicklung/wpcalendar/) at http://your-web-address/?wp-calendar-ical. Based on Gary King's iCal Posts (http://www.kinggary.com/archives/build-an-ical-feed-from-your-wordpress-posts-plugin) and modifications by Jerome (http://capacity.electronest.com/ical-for-ec-event-calendar/).
    6 Version: 1.0.3
     6Version: 1.1.0
    77Author: Robert Kleinschmager
    88Author URI: http://kleinschmager.net
     
    2626include_once(dirname(__FILE__) . "/ical-wp-calendar-admin.php");
    2727
     28add_action('plugins_loaded','icwpc_check_requirements');
     29
    2830add_action("admin_menu", "ical_wp_calendar_option_menu_init");
    2931add_filter('query_vars', "ical_wp_calendar_filter_query_vars");
    3032
    31 define('ICAL_WP_CALENDAR_QUERY_VARIABLE', 'wp-calendar-ical');
     33define("ICAL_WP_CALENDAR_QUERY_VARIABLE", "wp-calendar-ical");
     34define("ICAL_WP_CALENDAR_QUERY_PARAMETER_CATEGORY", "category");
     35
    3236
    3337
     
    109113        define("DEBUG", true);
    110114    }
     115
     116    if (isset($_GET[ICAL_WP_CALENDAR_QUERY_PARAMETER_CATEGORY]))
     117    {
     118        $category_parameter = $_GET[ICAL_WP_CALENDAR_QUERY_PARAMETER_CATEGORY];
     119    }
    111120   
    112121    if ( !function_exists('fse_get_events') )
    113122    {
    114         echo "Could not create iCal file, as Plugin WP Calendar is not active or not installed. Contact your site administrator.";
     123        echo "Could not create iCal file, as plugin WP Calendar is not active. Contact your wordpress administrator.";
     124        exit;
    115125    }
    116126    else
     
    128138            // $args["dateto"] = ... does not need to be defined, so all events in the future will be queried
    129139            $args['datemode'] = 1; // == FSE_DATE_MODE_ALL
    130             $args['number'] = 0; // == FSE_DATE_MODE_ALL
    131            
    132            
     140            $args['number'] = 0; // == FSE_DATE_MODE_ALL           
     141        }
     142
     143        if (isset($category_parameter))
     144        {
     145            $args['categories'] = array($category_parameter);
    133146        }
    134147       
     
    237250    }//end else if function exists fse_get_events
    238251}
     252
     253function icwpc_check_requirements() {
     254    //This works only if WP Calendar is installed (and activated) too - activation is not checked here (waiting for the WP dependency mechanism :)
     255    if ( !function_exists('fse_get_events') ) {
     256        add_action(
     257            'admin_notices',
     258            create_function(
     259                '',
     260                'echo \'<div id="message" class="error"><p>Plugin <strong>iCal for WP Calendar</strong> is activated but <a href="http://wordpress.org/extend/plugins/wp-calendar/">WP Calendar</a> is not installed. iCal for WP Calendar will not produce any iCal feed.</p></div>\';'
     261            )
     262        );
     263        return false;
     264    }
     265   
     266    return true;
     267}
    239268?>
  • ical-for-wp-calendar/trunk/readme.txt

    r430926 r485227  
    11=== iCal for WP Calendar ===
    22Contributors: Robert Kleinschmager
    3 Tags: ical, wp calendar, ical feed, feed, icalendar, calendar, events, event
     3Tags: ical, wp calendar, ical feed, feed, icalendar, calendar, events, event, category
    44Requires at least: 3.0
    55Tested up to: 3.2.1
     
    4040</ul>`
    4141
     42= How can the list of feeds be limited? =
     43
     44By adding 'category=1' to the feed url, you can limit to events, which are asssigned to the (post) category 1. The feed url will then look like
     45
     46http://your-web-address/?wp-calendar-ical&category=1
     47
    4248== Changelog ==
     49
     50= Version 1.1.0 - 05.01.2012 =
     51* added check if WP Calendar is activated
     52* added query parameter 'category' to limit events in the feed
    4353
    4454= Version 1.0.3 - 30.08.2011 =
     
    5868== ToDo ==
    5969
    60 * Add check, if WP Calendar is installed
    61 * Add warning to settings menu, of WP Calendar is not installed
    6270* Add option, to choose the datemode, when queried the events
    63 * Add option, to choose the category / or add this as parameter
    6471* add option, to choose the time method in iCal: UTC (default now), floating or th timezome, which is specified in wordpress itself
Note: See TracChangeset for help on using the changeset viewer.