/** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; include_once CARL_UTIL_INC . 'basic/misc.php'; reason_include_once('classes/mvc.php'); reason_include_once('classes/object_cache.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_model_class_names'][reason_basename(__FILE__)] = 'ReasonOembedTwitterFeedModel'; /** * ReasonOebmedTwitterFeedModel returns the oEmbed JSON version of a single tweet from the Twitter API v1.1. * * By default, we use a 10 minute cache, and include the necessary javascript inline in the response from twitter. * * It requires twitter_api_settings.php to be populated with valid credentials. * * User Configurables * * - tweet_id * - cache_duration * - omit_script * * @author Nathan White */
<?php /** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; reason_include_once('classes/mvc.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_view_class_names'][reason_basename(__FILE__)] = 'ReasonSocialProfileLinksView'; /** * ReasonSocialProfileLinksView displays data from models that provide an array of profile link information structured like this: * * ID -> * - icon * - text * - href * * @author Nathan White */ class ReasonSocialProfileLinksView extends ReasonMVCView { function get() { $profile_links = $this->data(); if (!empty($profile_links)) {
/** * Include a file if needed - we allow a relative path from minisite_templates/modules/ or an absolute path. */ private final function _setup_mvc($type, $params = NULL) { if (!in_array($type, array('controller', 'model', 'view'))) { trigger_warning('The type passed (' . $type . ') to _setup_mvc must be "controller", "model", or "view"', 1); return NULL; } if (!empty($params['file']) || !empty($this->{$type})) { if (empty($params['file']) || !empty($this->{$type})) { $params['file'] = $this->{$type}; } if (reason_file_exists('minisite_templates/modules/' . $params['file'])) { reason_include_once('minisite_templates/modules/' . $params['file']); $full_path = reason_resolve_path('minisite_templates/modules/' . $params['file']); } elseif (reason_file_exists($params['file'])) { reason_include_once($params['file']); $full_path = reason_resolve_path($params['file']); } elseif (file_exists($params['file'])) { include_once $params['file']; $full_path = realpath($params['file']); } else { trigger_error('The mvc module was unable to load the ' . $type . ' (' . $params['file'] . ')', FATAL); } if (isset($GLOBALS['_reason_mvc_' . $type . '_class_names'][reason_basename($full_path)])) { $class_name = $GLOBALS['_reason_mvc_' . $type . '_class_names'][reason_basename($full_path)]; } else { trigger_error('The mvc module was unable to determine the class name for the ' . $type . ' (' . $params['file'] . ') - check that the file properly registers itself.', FATAL); } unset($params['file']); } else { if ($type == 'controller') { $class_name = 'ReasonMVCController'; } // setup the default controller } // instantiate and return it. if (isset($class_name)) { $obj = new $class_name(); $this->configure_mvc($type, $obj, $params); return $obj; } }
<?php /** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; reason_include_once('classes/mvc.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_view_class_names'][reason_basename(__FILE__)] = 'ReasonSimplepieDefaultFeedView'; /** * ReasonSimplepieDefaultFeedView shows feed items and supports a few optional parameters. * * This class assumes that the models used return a SimplePie feed object. * * - num_to_show (int default 4) * - randomize (boolean default false) * * @author Nathan White */ class ReasonSimplepieDefaultFeedView extends ReasonMVCView { var $config = array('num_to_show' => 4, 'randomize' => false, 'title' => NULL, 'description' => NULL); function get() { $feed = $this->data();
/** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; include_once CARL_UTIL_INC . 'basic/misc.php'; reason_include_once('classes/mvc.php'); reason_include_once('classes/object_cache.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_model_class_names'][reason_basename(__FILE__)] = 'YouTubeLatestUserVideosFeedModel'; /** * YouTubeLatestUserVideosFeedModel returns links to the url and thumbnail for the last 25 videos YouTube user. * * By default, we use a 10 minute cache. * * User Configurables * * - user_id * - cache_duration * * @author Nathan White */ class YouTubeLatestUserVideosFeedModel extends ReasonMVCModel { /**
<?php /** * @package reason * @subpackage classes */ /** * Include the base class */ include_once( 'reason_header.php' ); reason_include_once( 'classes/mvc.php' ); /** * Register MVC component with Reason */ $GLOBALS[ '_reason_mvc_view_class_names' ][ reason_basename(__FILE__) ] = 'ReasonTwitterDefaultFeedView'; /** * ReasonTwitterDefaultFeedView displays data from the twitter model. * * We support these params: * * - num_to_show (int default 4) * - randomize (boolean default false) * - title (string default NULL) * - description (string default NULL) * * Pass in an empty string for title or description to suppress it. This display is very bare bones. It is very likely that you'll want to create a local * version of this file that does some different styling, or just create your own default feed view that does what you want. Ultimately, the goal is for this * to use the current oembed HTML along with the twitter widget.js file. Sadly, twitter makes you do one API call per tweet to get the oembed markup, making * that approach untenable.
<?php /** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; reason_include_once('classes/mvc.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_view_class_names'][reason_basename(__FILE__)] = 'ReasonOembedTwitterFeedView'; /** * ReasonOembedTwitterFeedView displays an ombed tweet. * * @author Nathan White */ class ReasonOembedTwitterFeedView extends ReasonMVCView { function get() { $tweet_json = $this->data(); if (!empty($tweet_json)) { $str = json_decode($tweet_json); return $str->html; } else { return ''; }
<?php /** * @package reason * @subpackage classes */ /** * Include the base class */ include_once 'reason_header.php'; reason_include_once('classes/mvc.php'); include_once 'simplepie/autoloader.php'; /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_model_class_names'][reason_basename(__FILE__)] = 'ReasonSimplepieFeedModel'; /** * ReasonSimplepieModel uses our configurables and returns a SimplePie object. * * User Configurables * * - url * - cache_duration * - cache_directory * * @author Nathan White */ class ReasonSimplepieFeedModel extends ReasonMVCModel { /** * Sets a few configuration defaults
/** * @package reason * @subpackage classes */ /** * Include dependencies */ include_once 'reason_header.php'; include_once CARL_UTIL_INC . 'basic/misc.php'; reason_include_once('classes/mvc.php'); reason_include_once('classes/object_cache.php'); reason_include_once('classes/social.php'); /** * Register MVC component with Reason */ $GLOBALS['_reason_mvc_model_class_names'][reason_basename(__FILE__)] = 'ReasonSocialProfileLinksModel'; /** * ReasonSocialProfileLinksModel returns structured data containing social profile links for those social accounts * that support the SocialAccountProfileLinks interface defined in classes/social.php. * * The data returned is a PHP array indexed by the id of the social account entity, with the following components: * * - icon_small * - icon_large * - text * - src * * User Configurables * * - site_id *