Filters and Pluggable Functions

Advanced Users Only Please

For those with a good grasp of wordpress, php , html and css, and some very unusual requirements,  there are a number of further options:

Some functions are ‘pluggable’ – ie you can totally write your own to replace those provided, so long as you return the expected sorts of values.

Before going this route, please consider whether you can achieve what you want with “list types” or your own custom “list html style” and realise that there is very limited free support for your own code (I am available for paid work).

Add your function to your own plugin and ensure that your plugin is activated before the events plugin (or add it to your themes functions.php – upgrade risk?)

Pluggable Formatting Functions:

Please see amr-pluggable.php for all latest pluggable functions.  Here are some:

  • amr_format_allday ($content)
  • amr_format_url ($url)
  • amr_format_attach ($attachments, $event);
  • amr_format_binary ($name,$item['binary']);
  • amr_format_taxonomies ($taxname ie ‘tag’, $content);
  • amr_format_taxonomy_link ($tax_name,$tax_term);
  • amr_format_organiser ($org)
  • amr_format_attendee ($attendee);
  • amr_format_PARTSTAT ($participation_status, $attendee);
  • amr_format_grouping ($grouping, $datestamp)

if an ICS component does not have a specific formatting function, the plugin will still check for one using it’s name:

if (function_exists ('amr_format_'.$k)) {
 $htmlcontent =(call_user_func('amr_format_'.$k, $content));
 }

IE: amr_format_summary($content) will also work.

If a function is not ‘pluggable’ and you think it should be, please puta request in at the support forum and I’ll see what I can do.

More Pluggable Functions:

  • amr_list_properties ($icals, $id, $class);
  • amr_list_events($components, $tid, $class, $show_views);
  • amr_derive_calprop_further (&$p); – setups the calendar properties is passed calendar array for modification of values.  return modified array;
  • amr_semi_paginate ();   can use global $amr_limits to pick up number of days, events etc. Return valid html please.
  • amrical_calendar_views (); return html with links that generate different views
  • amr_month_year_navigation ($start);
  • amr_weeks_caption ($start); is passed a datetime object – return html for caption or heading – see existing
  • amr_week_links ($start,$weeks) – return html for next and prev week
  • amr_month_year_links ($start,$months);
  • amr_monthyeardrop_down($start);
  • amr_derive_calprop_further (&$p);
  • amr_ical_showmap – receive address text, return html;
  • amr_show_refresh_option; no parameters
  • add_event_to_google ($e);  receive event instamce array, return html;
  • add_cal_to_google($icsurl); receive ics url, return html;
  • amr_derive_summary (&$e ); receive event, update it, and return html for event title
  • amr_subscribe_to_event_series ($e) ; receive event,and return html for event series subscription
  • amr_subscribe_to_event($e); receive event,and return html for event series subscription
  • amr_indicate_attendance ($e); receive event, return html or link to action;
  • …..more and also per request if you have an unusual requirement that cannot be met with the extensive customisation available.  See the amr-pluggables file in the includes section.

Filters:

Filters are another way that an advanced person can control what is displayed.

  • amr-ical-event-url – receive a url and a post id, return a url – allows you to change the event url used in a display list – default is that it would go to the event post.
  • amr_events_after_sort – receive events array, return events array – allows you to resort an array by your own criteria – use cautiously
  • amr_events_after_sort_and_constrain – receive events array, return events array – allows you to resort an array by your own criteria – use cautiously
  • amr_event_repeats – receive an integer (count of instances of an event series), – return an integer.  EG:used to only generate  only the ‘next’ from now  of a series, not all that are defined for that series
  • amr_attachment_title – receive the attachment url and array of (title, event) , return text to be used as link text.
  • amr_events_event_html – receive an array (rowhtml, event), return rowhtml (note global $amr_listtype available)
  • amr_events_column_html – receive an array (colhtml, colnumber), return colhtml
  • amr_events_table_caption – receive caption text, return modified caption text.
  • wordpress filters can also be used as the plugin will apply them to post content and excerpts.   To detect if a post or custom post is an event, before applying changes, check for post_meta of VEVENT = 1
  • More filters can be added if you have special requests