Adding new Custom rss feed
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 6 Jun 2019 17:23:15 +0000 (13:23 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 6 Jun 2019 17:23:15 +0000 (13:23 -0400)
Custom feed requested by third party for meetmtp.com

index.php
models/admin/ajax/customRssFeed.php [new file with mode: 0644]
models/front/events/baseAction.php
models/front/events/customRssFeed.php [new file with mode: 0644]
setup/validActions.php
views/front/events/customRssFeed.xml [new file with mode: 0644]

index 4974065..3df06d2 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Associate - Events Add-On
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.7.24
+ * Version: 1.7.25
  * Author: Chuck Scott
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.7.24
+ * @version 1.7.25
  */
 
 // Check that we're being called by WordPress.
@@ -43,7 +43,7 @@ if (!defined('ABSPATH')) {
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.24');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.25');
 define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.14');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
diff --git a/models/admin/ajax/customRssFeed.php b/models/admin/ajax/customRssFeed.php
new file mode 100644 (file)
index 0000000..0cf5b37
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * PDF Output by admin-ajax
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/customRssFeed.php';
+/**
+ * Steve Note...
+ *
+ * You can get to this using the following URL.
+ *
+ *  {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=pdfOutput&mystuff=THIS
+ *
+ * You should be able to do this as POST or GET and should be able to add and read additional parameters.
+ * I added a "mystuff" parameter to the URL above and it does output from the code in the
+ * modelAction() function below.
+ *
+ * To add another model under models/admin/ajax all you need to do is create it and add it to the
+ * setup/validActions.php file.
+ *
+ */
+
+// Load Members data abstract
+// require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php';
+
+/**
+ * This class performs the work of handling images passed to it via
+ * an AJAX call that goes through the WorPress AJAX Handler.
+ *
+ */
+class GlmMembersAdmin_ajax_customRssFeed extends GlmMembersFront_events_customRssFeed
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+}
index 3c85489..6974afc 100644 (file)
@@ -217,7 +217,7 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents
      * @access public
      * @return array events
      */
-    public function getModelEventsData( $event_config )
+    public function getModelEventsData( $event_config = null )
     {
         // Initialize $is_name_search to false.
         $is_name_search = false;
diff --git a/models/front/events/customRssFeed.php b/models/front/events/customRssFeed.php
new file mode 100644 (file)
index 0000000..cf17fde
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/**
+ * detail.php
+ *
+ * This is the Member Event Plugin model for the front detail shortcode.
+ * Handles the view of the detail pages.
+ */
+
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php';
+
+/**
+ * GLmMembersFront_event_detail
+ *
+ * @uses      GlmDataEvents
+ * @package   GlmMemberEvents
+ * @version   0.0.1
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @license   PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
+class GlmMembersFront_events_customRssFeed extends GlmMembersFront_events_baseAction
+{
+    /**
+     * modelAction
+     *
+     * @param bool $actionData Action Data passed to the modelAction
+     *
+     * @access public
+     * @return void
+     */
+    public function modelAction($actionData = false)
+    {
+        $action = '';
+        $fromDate = date('Y-m-d');
+        $this->dateRange = "start_time >= '{$fromDate}'";
+
+        $output = '';
+        header("Content-Type: application/xml\n");
+
+        $this->postAddLocations = true;
+        $events = $this->getModelEventsData();
+        $this->postAddLocations = false;
+
+        // Load Smarty Template support
+        $smarty = new smartyTemplateSupport();
+
+        $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
+        $smarty->template->setTemplateDir($viewPath);
+
+        // Get the main event page
+        $eventListPageId = get_option('glm_members_database_option_event_list_id');
+
+        $smarty->templateAssign('eventUrlBase', get_bloginfo('url') . '/event-detail/');
+        $smarty->templateAssign('imageUrlBase', GLM_MEMBERS_PLUGIN_MEDIA_URL .  '/images/medium/' );
+
+        $smarty->templateAssign('items', $events);
+
+        // Add standard parameters
+        require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+
+        $viewFile = 'front/events/customRssFeed.xml';
+
+        // Generate output from model data and view
+        $output = $smarty->template->fetch($viewFile);
+        echo $output;
+        exit;
+    }
+}
index 7d6128a..a0cf12c 100644 (file)
@@ -37,6 +37,7 @@ $glmMembersEventsAddOnValidActions = array(
             'nameSearch'         => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'icalFeed'           => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'rssFeed'            => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+            'customRssFeed'      => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'eventsCalMonthAJAX' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'icalFeedImport'     => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'eventsListExport'   => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
diff --git a/views/front/events/customRssFeed.xml b/views/front/events/customRssFeed.xml
new file mode 100644 (file)
index 0000000..1c0203b
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<items>
+    {foreach $items as $item}
+    <item>
+        <title><![CDATA[{$item.name}]]></title>
+        <link>{$eventUrlBase}{$item.name_slug}/</link>
+        {if $item.image}
+            <image>{$imageUrlBase}{$item.image}</image>
+        {/if}
+        <description><![CDATA[{$item.intro|strip_tags}]]></description>
+        <fulltext><![CDATA[{$item.descr|strip_tags}]]></fulltext>
+        {if $item.hide_address.name == 'No'}
+            {if $item.locations}
+                <location>
+                    {if $item.locations.name}{$item.locations.name}{/if}
+                    {if $item.locations.address} {$item.locations.address} {/if}
+                    {if $item.locations.city.name}{$item.locations.city.name}{/if}{if $item.locations.state.value}, {$item.locations.state.value} {/if}
+                    {if $item.locations.zip} {$item.locations.zip} {/if}
+                </location>
+            {/if}
+            {if $item.member && $item.use_member_location}
+                <location>
+                    {if $item.member.member} {$item.member.member} {/if}
+                    {if $item.member.addr1} {$item.member.addr1} {/if}
+                    {if $item.member.city}{$item.member.city}{/if}{if $item.member.state.value}, {$item.member.state.value}{/if}
+                    {if $item.member.zip} {$item.member.zip} {/if}
+                </location>
+            {/if}
+        {/if}
+        <startdatetime>{$item.starting_timestamp|date_format:"%Y-%m-%dT%T"}</startdatetime>
+        <enddatetime>{$item.ending_timestamp|date_format:"%Y-%m-%dT%T"}</enddatetime>
+        <guid>{$item.id}</guid>
+    </item>
+    {/foreach}
+</items>