Esempio n. 1
0
/**
 * Smarty {rsslink} function plugin
 *
 * Type:     function<br>
 * Name:     rsslink<br>
 * Purpose:  create an rss link
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_rsslink($params, &$smarty)
{
    $loc = $smarty->getTemplateVars('__loc');
    if (!isset($params['module'])) {
        $params['module'] = $loc->mod;
    }
    if (!isset($params['src'])) {
        $params['src'] = $loc->src;
    }
    if (!isset($params['int'])) {
        $params['int'] = $loc->int;
    }
    echo expCore::makeRSSLink($params);
}
Esempio n. 2
0
 /** exdoc
  * Output <link /> elements for each RSS feed on the site
  *
  * @node Subsystems:Theme
  */
 public static function advertiseRSS()
 {
     if (defined('ADVERTISE_RSS') && ADVERTISE_RSS == 1) {
         echo "\n\t<!-- RSS Feeds -->\n";
         $rss = new expRss();
         $feeds = $rss->getFeeds();
         foreach ($feeds as $feed) {
             if ($feed->enable_rss) {
                 $title = empty($feed->feed_title) ? 'RSS' : htmlspecialchars($feed->feed_title, ENT_QUOTES);
                 $params['module'] = $feed->module;
                 $params['src'] = $feed->src;
                 echo "\t" . '<link rel="alternate" type="application/rss+xml" title="' . $title . '" href="' . expCore::makeRSSLink($params) . "\" />\n";
             }
         }
         // now for the old school module rss feeds
         global $db;
         $modules = $db->selectObjects("sectionref", "refcount > 0");
         // get all the modules being using
         $feeds = array();
         foreach ($modules as $module) {
             if (isset($feeds[$module->source])) {
                 continue;
             }
             $location->mod = $module->module;
             $location->src = $module->source;
             $location->int = $module->internal;
             if (!expModules::controllerExists($module->module)) {
                 //get the module's config data
                 $config = $db->selectObject($module->module . "_config", "location_data='" . serialize($location) . "'");
                 if (!empty($config->enable_rss)) {
                     $title = empty($config->feed_title) ? 'RSS' : htmlspecialchars($config->feed_title, ENT_QUOTES);
                     $params['module'] = $module->module;
                     $params['src'] = $module->source;
                     if (!empty($module->internal)) {
                         $params['int'] = $module->internal;
                     }
                     echo "\t" . '<link rel="alternate" type="application/rss+xml" title="' . $title . '" href="' . expCore::makeRSSLink($params) . "\" />\n";
                     $feeds[$module->source] = $title;
                 }
             }
         }
     }
 }