From: Steve Sutton Date: Thu, 6 Jun 2019 17:23:15 +0000 (-0400) Subject: Adding new Custom rss feed X-Git-Tag: v1.7.25^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=238bc181e6fbb32cf70a69c6856d1a498f2a29f7;p=WP-Plugins%2Fglm-member-db-events.git Adding new Custom rss feed Custom feed requested by third party for meetmtp.com --- diff --git a/index.php b/index.php index 4974065..3df06d2 100755 --- 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 * @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 index 0000000..0cf5b37 --- /dev/null +++ b/models/admin/ajax/customRssFeed.php @@ -0,0 +1,59 @@ + + * @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; + +} diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php index 3c85489..6974afc 100644 --- a/models/front/events/baseAction.php +++ b/models/front/events/baseAction.php @@ -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 index 0000000..cf17fde --- /dev/null +++ b/models/front/events/customRssFeed.php @@ -0,0 +1,69 @@ + + * @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; + } +} diff --git a/setup/validActions.php b/setup/validActions.php index 7d6128a..a0cf12c 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -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 index 0000000..1c0203b --- /dev/null +++ b/views/front/events/customRssFeed.xml @@ -0,0 +1,36 @@ + + + + {foreach $items as $item} + + <![CDATA[{$item.name}]]> + {$eventUrlBase}{$item.name_slug}/ + {if $item.image} + {$imageUrlBase}{$item.image} + {/if} + + + {if $item.hide_address.name == 'No'} + {if $item.locations} + + {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} + + {/if} + {if $item.member && $item.use_member_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} + + {/if} + {/if} + {$item.starting_timestamp|date_format:"%Y-%m-%dT%T"} + {$item.ending_timestamp|date_format:"%Y-%m-%dT%T"} + {$item.id} + + {/foreach} +