ajbrowe / wp-calendar

Imported from SVN http://plugins.svn.wordpress.org/wp-calendar/tags/1.5.3/
https://wordpress.org/plugins/wp-calendar/
0 stars 0 forks source link

Minor fixes to fsCalendar.php #1

Open rockymtnlinux opened 9 years ago

rockymtnlinux commented 9 years ago

Hello,

I don't know what your plans are for wp-calendar, but I would like to contribute some minor fixes. I tried several calendars and this is the only one that I found that I could use to link posts to events. Unfortunately it is in sad need of some updating and the original maintainer seems to have moved on to bigger and better things ( I hope. ). I thought about doing my own fork, but would rather not if there is already one available to which I can contribute. I'm attaching a patch file created from the diff utility against the 1.5.3 version of fsCalendar.php which contains my changes.

The changes are:

1) Added a call to do_shortcode so that short code will be evaluated on the single event page. With this I was able to add shortcode and use the FlexibleMap plugin to automatically include a map for all of my events for which a location is specified, like so: [flexiblemap width="100%" scrollwheel="true" hidepanning="false" directions="true" direction address="{event_location}"]

2) I reformatted the comments regarding filtering events by date -- mainly so I could make sense of it.

3) I added a fix to event list pagination which is broken on newer versions of WordPress.

Here is the patch:

--- fsCalendar.php  2015-01-31 19:14:24.887378970 -0700
+++ ../fsCalendar.php   2015-01-31 19:30:45.141140277 -0700
@@ -285,7 +285,7 @@
       * @return unknown_type
       */
      function hookFilterContent($content) {
-         return $this->filterContent($content);
+         return do_shortcode($this->filterContent($content));
      }

      /**
@@ -1258,17 +1258,26 @@
      /**
       * Returns all events in a certain state
       * For date selection, you can specify a start and/or an end timestamp.
-      * If both dates are specified, all events are returned, which are valid
-      * between this two dates in mode `ALL` (can start before and end after the
-      * corresponding dates. In mode `START` only events are returned, which start
-      * between this two dates. In mode `END` only events are returned, which end
-      * between this two dates.
-      * If only a start date is spefied, all Events are returned, which are valid
-      * after this date in mode `ALL` and all events are returned, which start
-      * after this date in mode `START`. Mode `END` corresponds to `ALL`.
-      * If only a end date is specified, all events are returned, which are valid
-      * before this date in mode `ALL` and all events are returnd, which end
-      * before this date in mode `END`. Mode `START` corresponds to `ALL`.
+          *
+      * If both dates are specified:
+ 
+          *    1).  In mode `ALL`, all events are returned that are valid between these two dates.
+          *         The event can start before and end after the corresponding dates. 
+          *    2).  In mode `START` only events are returned that start between these two dates. 
+          *    3).  In mode `END` only events are returned that end between these two dates.
+          *
+      * If only a start date is specified:
+          *
+          *    1).  All Events are returned, which are valid after this date in mode `ALL`. 
+          *    2).  All events are returned, which start after this date in mode `START`.
+          *    3).  Mode `END` corresponds to `ALL`.
+          *
+      * If only a end date is specified:
+          *
+          *    1).  All events are returned, which are valid before this date in mode `ALL`.
+          *    2).  All events are returnd, which end before this date in mode `END`. 
+          *    3).  Mode `START` corresponds to `ALL`.
+          *
       * @param $filter using the following keys: id_inc, id_exc, author, state, categories, datefrom, dateto, datemode
       * @param $sort_string Sort string
       * @return Array of event IDs
@@ -1743,6 +1752,7 @@

          $wp_args['base'] = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] ).'%_%';
          $wp_args['format'] = '?wpcal-page=%#%';
+         $wp_args['add_args'] = false;

          // Preserver other GET values
          foreach($_GET as $k => $v) {
ajbrowe commented 9 years ago

Hi

I created this fork to manage some changes I needed to make for a client. It was a while ago but I think it was only so that it would work properly in a child theme, glad you found it useful.

Your changes seem reasonable to me so I'll include them after I've had chance to give them a rudimentary test.