Difference between revisions of "Template:Mainpage-rssfeeds"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Usage:)
Line 32: Line 32:
 
{|
 
{|
 
|-
 
|-
||charset=...   ||         The charset used by the feed. iconv is used to convert this.
+
|| <tt>charset = ...</tt>            ||The charset used by the feed. iconv is used to convert this.
 
|-
 
|-
|| short         ||         Do not show the description text for each news item.
+
|| <tt>short</tt>                  ||Do not show the description text for each news item.
 
|-
 
|-
|| max=x         ||         Shows x most recent headlines.
+
|| <tt>max = x</tt>                  ||Shows x most recent headlines.
 
|-
 
|-
|| highlight= term1 term2 || The terms separated by a space are highlighted.
+
|| <tt>highlight = term1 term2</tt>  ||The terms separated by a space are highlighted.
 
|-
 
|-
|| filter= term1 term2    ||Show only rss items containing at least one of the terms.
+
|| <tt>filter = term1 term2</tt>     ||Show only rss items containing at least one of the terms.
 
|-
 
|-
|| reverse                ||display the rss items in reverse order.
+
|| <tt>reverse</tt>                 ||display the rss items in reverse order.
 
|-
 
|-
|| title=x                ||display an alternative title instead of chanel name.
+
|| <tt>title = x</tt>                 ||display an alternative title instead of chanel name.
 
|-
 
|-
|| title = none            ||dont display any title.
+
|| <tt>title = none</tt>           ||dont display any title.
 
|}
 
|}
  
 
===Example:===  
 
===Example:===  
<nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki>
+
<tt><nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki></tt>
  
 
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
 
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
  
<pre><nowiki>
 
  
 
===rss.php===  
 
===rss.php===  
 
+
<pre><nowiki>
 
<?php
 
<?php
 
# RSS-Feed Mediawiki extension
 
# RSS-Feed Mediawiki extension

Revision as of 16:31, 29 July 2006

UNIQ8114426fa4d5f665-rss-00000000-QINU UNIQ8114426fa4d5f665-rss-00000001-QINU

GISWiki/RSS

Uses an extension from: http://meta.wikimedia.org/wiki/GISWiki/RSS

RSS-Feed Mediawiki extension

  • original by mutante 25.03.2005
  • extended by Duesentrieb 30.04.2005
  • extended by Rdb78 07.07.2005
  • extended by Mafs 10.07.2005, 24.07.2005
  • extended by User:Arcy 07.09.2005
  • Updated for MediaWiki 1.6 by User:piku 13.06.2006
  • Update for Wikicode output, by User:cogdog 14.jul.2006

Requires:

Installation:

  • put this file (rss.php) into the extension directory of your mediawiki installation
  • add the following to the end of LocalSettings.php: include("extensions/rss.php");
  • make sure magpie can be found by PHP.

Usage:

Use one section between <rss>-tags for each feed. The rss section may contain parameters separated by a pipe ("|"), just like links and templates. These parameters are supported:

charset = ... The charset used by the feed. iconv is used to convert this.
short Do not show the description text for each news item.
max = x Shows x most recent headlines.
highlight = term1 term2 The terms separated by a space are highlighted.
filter = term1 term2 Show only rss items containing at least one of the terms.
reverse display the rss items in reverse order.
title = x display an alternative title instead of chanel name.
title = none dont display any title.

Example:

<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>

Oscar Winners, Sports Stars and Bill Gates Are Building Lavish Bunkers

Fri, 30 Sep 2016 10:00:00

turkeydance quotes a report from Hollywood Reporter: Given the increased frequency of terrorist bombings and mass shootings and an under-lying sense of havoc fed by divisive election politics, it's no surprise that home security is going over the top and hitting luxurious new heights. Or, rather, new lows, as the average depth of a new breed of safe haven that occupies thousands of square feet is 10 feet under or more. Those who can afford to pull out all the stops for so-called self-preservation are doing so -- in a fashion that goes way beyond the submerged corrugated metal units adopted by reality show "preppers" -- to prepare for anything from nuclear bombings to drastic climate-change events. Gary Lynch, GM at Rising S Bunkers, a Texas-based company that specializes in underground bunkers and services scores of Los Angeles residences, says that sales at the most upscale end of the market -- mainly to actors, pro athletes and politicians (who require signed NDAs) -- have increased 700 percent this year compared with 2015, and overall sales have risen 150 percent. Any time there is a turbulent political landscape, we see a spike in our sales. Given this election is as turbulent as it is, "we are gearing up for an even bigger spike," says marketing director Brad Roberson of sales of bunkers that start at $39,000 and can run $8.35 million or more (FYI, a 12-stall horse shelter is $98,500). Adds Mike Peters, owner of Utah-based Ultimate Bunker, which builds high-end versions in California, Texas and Minnesota: "People are going for luxury [to] live underground because they see the future is going to be rough. Everyone I've talked to thinks we are doomed, no matter who is elected." Robert Vicino, founder of Del Mar, Calif.-based Vivos, which constructs upscale community bunkers in Indiana (he believes coastal flooding scenarios preclude bunkers being safely built west of the Rockies), says, "Bill Gates has huge shelters under every one of his homes, in Rancho Santa Fe and Washington. His head of security visited with us a couple years ago, and for these multibillionaires, a few million is nothing. It's really just the newest form of insurance."

Share on Google+


Read more of this story at Slashdot.

Rosetta Spacecraft Prepares To Land On Comet, Solve Lingering Mysteries

Fri, 30 Sep 2016 07:00:00

sciencehabit writes from a report via Science Magazine: All good things must come to an end, and so it will be tomorrow when the Rosetta spacecraft makes its planned soft landing onto the surface of comet 67P/Churyumov-Gerasimenko, the culmination of 2 years of close-up studies. Solar power has waned as 67P's orbit takes it and Rosetta farther from the sun, and so the mission team decided to go on a last data-gathering descent before the lights go out. This last data grab is a bonus after a mission that is already changing theorists' views about how comets and planets arose early in the solar system. Several Rosetta observations suggest that comets form not from jolting mergers of larger cometesimals, meters to kilometers across, but rather from the gentle coalescence of clouds of pebbles. And the detection of a single, feather-light, millimeter-sized particle -- preserved since the birth of the solar system -- should further the view of a quiet birth. The report concludes: "A slew of instruments will keep gathering data as Rosetta approaches the surface at the speed of a gentle stroll. For team members whose instruments have already been turned off to conserve power, the ending is bittersweet -- but their work is far from over. Most instrument teams have only examined their own data, and are just now thinking about combining data sets. "We've just started collaborating with other teams," [Holger Sierks of the Max Planck Institute for Solar System Research in Gottingen, Germany, chief of Rosetta's main camera,] says. "This is the beginning of the story, not the end."

Share on Google+


Read more of this story at Slashdot.

The Americas Are Now Officially 'Measles-Free'

Fri, 30 Sep 2016 03:30:00

An anonymous reader quotes a report from The Verge: The Americas are now free of measles and we have vaccines to thank, the Pan American Health Organization said earlier this week. This is the first region in the world to be declared measles-free, despite longtime efforts to eliminate the disease entirely. The condition -- which causes flu-like symptoms and a blotchy rash -- is one of the world's most infectious diseases. It's transmitted by airborne particles or direct contact with someone who has the disease and is highly contagious, especially among small children. To be clear, there are still people with measles in the Americas, but the only cases develop from strains picked up overseas. Still, the numbers are going down: in the U.S. this year, there have been 54 cases, down from 667 two years ago. The last case of measles that developed in the Americas was in 2002. (It took such a long time to declare the region measles-free because of various bureaucratic issues.) Health officials say that credit for this victory goes to efforts to vaccinate against the disease. Though the measles, mumps, and rubella (MMR) vaccine is recommended for all children and required by many states, anti-vaxxers have protested it due to since-discredited claims that vaccines can cause autism. NPR interviewed Dr. Seth Berkley, the CEO of GAVI, a Geneva-based nonprofit organization whose mission is to improve and provide vaccine and immunization coverage to children in the world's poorest countries. She says that 90 to 95 percent of people in a given region need to be vaccinated in order to stop transmission in a region. The rate worldwide is about 80 percent for measles, which means that 20 percent of people around the world are not covered.

Share on Google+


Read more of this story at Slashdot.

The Psychological Reasons Behind Risky Password Practices

Fri, 30 Sep 2016 01:50:00

Orome1 quotes a report from Help Net Security: Despite high-profile, large-scale data breaches dominating the news cycle -- and repeated recommendations from experts to use strong passwords -- consumers have yet to adjust their own behavior when it comes to password reuse. A global Lab42 survey, which polled consumers across the United States, Germany, France, New Zealand, Australia and the United Kingdom, highlights the psychology around why consumers develop poor password habits despite understanding the obvious risk, and suggests that there is a level of cognitive dissonance around our online habits. When it comes to online security, personality type does not inform behavior, but it does reveal how consumers rationalize poor password habits. My personal favorite: password paradox. "The survey revealed that the majority of respondents understand that their digital behavior puts them at risk, but do not make efforts to change it," reports Help Net Security. "Only five percent of respondents didn't know the characteristics of a secure password, with the majority of respondents understanding that passwords should contain uppercase and lowercase letters, numbers and symbols. Furthermore, 91 percent of respondents said that there is inherent risk associated with reusing passwords, yet 61 percent continue to use the same or similar passwords anyway, with more than half (55 percent) doing so while fully understanding the risk." The report also found that when attempting to create secure passwords, "47 percent of respondents included family names or initials," while "42 percent contain significant dates or numbers and 26 percent use the family pet."

Share on Google+


Read more of this story at Slashdot.

IBM Buys Promontory Financial Group

Fri, 30 Sep 2016 01:20:00

An anonymous reader quotes a report from ZDNet: IBM said Thursday it plans to acquire compliance consulting firm Promontory Financial Group to bring more financial regulatory expertise to Watson's cognitive computing platform. Promontory is a global consulting operation with an aim of helping banks manage the ever-increasing regulation and risk management requirements in the financial sector. With that in mind, IBM wants to use the industry expertise of Promontory's workforce -- which is made up of ex-regulators and banking executives -- to teach Watson all about regulation, risk and compliance. IBM is also using the deal to create a new subsidiary called Watson Financial Services, which will build cognitive tools for things things like tracking regulatory obligations, financial risk modeling, surveillance, anti-money laundering detection systems. "This is a workload ideally suited for Watson's cognitive capabilities intended to allow financial institutions to absorb the regulatory changes, understand their obligations, and close gaps in systems and practices to address compliance requirements more quickly and efficiently," IBM said in a press release.

Share on Google+


Read more of this story at Slashdot.


rss.php

<?php
# RSS-Feed Mediawiki extension
# 
# original by mutante 25.03.2005
# extended by Duesentrieb 30.04.2005
# extended by Rdb78 07.07.2005
# extended by Mafs  10.07.2005, 24.07.2005
# extended by User:Arcy  07.09.2005
# Updated for MediaWiki 1.6 by User:piku 13.06.2006
# Update for Wikicode output, by User:cogdog 14.jul.2006
#
# Requires: 
#  * magpie rss parser <http://magpierss.sourceforge.net/>
#  * iconv <http://www.gnu.org/software/libiconv/>, see also <http://www.php.net/iconv>
#
# Installation:
#  * put this file (rss.php) into the extension directory of your mediawiki installation 
#  * add the following to the end of LocalSettings.php: include("extensions/rss.php");
#  * make sure magpie can be found by PHP.
#
# Usage:
#  Use one section between <rss>-tags for each feed. The rss section may contain parameters
#  separated by a pipe ("|"), just like links and templates. These parameters are supported:
#
#    * charset=...             The charset used by the feed. iconv is used to convert this.
#    * short                   Do not show the description text for each news item.
#    * max=x                   Shows x most recent headlines.
#    * highlight= term1 term2  The terms separated by a space are highlighted.
#    * filter= term1 term2     Show only rss items containing at least one of the terms.
#    * reverse                 display the rss items in reverse order.
#    * title=x                 display an alternative title instead of chanel name.
#    * title = none            dont display any title.
#
# Example: 
#    <rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
#

#change this according to your magpie installation!
require_once('rss_fetch.inc'); 

#install extension hook
$wgExtensionFunctions[] = "wfRssExtension"; 

#extension hook callback function
function wfRssExtension() { 
  global $wgParser;

  #install parser hook for <rss> tags
  $wgParser->setHook( "rss", "renderRss" );
}

#parser hook callback function
function renderRss($input, $argv, $parser = null) {
  if (!$parser) $parser =& $GLOBALS['wgParser'];
  global $wgOutputEncoding;

  $DefaultEncoding = "ISO-8859-1";
  $DisableCache = true;

  # $input = mysql_escape_string($input);

  if (!$input) return ""; #if <rss>-section is empty, return nothing

  #parse fields in rss-section
  $fields= explode("|",$input);
  $url= @$fields[0];

  $args= array();
  for ($i=1; $i<sizeof($fields); $i++) {
    $f= $fields[$i];

    if (strpos($f,"=")===False) $args[strtolower(trim($f))]= False;
    else {
      list($k,$v)= explode("=",$f,2);
      if (trim($v)==False) $args[strtolower(trim($k))] = False; 
      else $args[strtolower(trim($k))]= trim($v);
    }
  }

  #get charset from argument-array    
  $charset= @$args["charset"];
  if (!$charset) $charset= $DefaultEncoding;

  #get max number of headlines from argument-array
  $maxheads = @$args["max"];
  $headcnt = 0;

  #get short-flag from argument-array
  #if short is set, no description text is printed
  if (isset($args["short"])) $short = True; else $short = False;

  #get reverse-flag from argument-array
  if (isset($args["reverse"])) $reverse = True; else $reverse = False;

  #get highlight terms from argument-array    
  $rssHighlight= @$args["highlight"];
  $rssHighlight= str_replace("  "," ", $rssHighlight);
  $rssHighlight= explode(" ", trim($rssHighlight));

  #get filter terms from argument-array    
  $rssFilter= @$args["filter"];
  $rssFilter= str_replace("  "," ", $rssFilter);
  $rssFilter= explode(" ", trim($rssFilter));    

  #fetch rss. may be cached locally.
  #Refer to the documentation of magpie for details.
  $rss = @fetch_rss($url);


  #check for errors.
  if ($rss->ERROR) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url: ".$rss->ERROR."</div>"; #localize...
  }

  if (!is_array($rss->items)) {
     # return "Feed error"; #localize...
      #return "<div>Failed to load RSS feed from $url!</div>"; #localize...
  }

  #Bild title line    
  #get title from argument-array    
  
  $rssTitle= @$args["title"];
  $rssTitle= trim($rssTitle);

  if ($rssTitle !=='none') {
    if ($rssTitle=='') {
        $title= iconv($charset,$wgOutputEncoding,$rss->channel['title']);
        if ($rss->channel['link']) $title= "[".$rss->channel['link']." $title]";
        $output = "=== $title ===\n";
    }
    else
    {
      $title= "[".$rss->channel['link']." $rssTitle]";
      $output="=== $title ===\n";
    }
  } else {
      $output="\n\n\n";
  }
  
  if ($reverse) $rss->items = array_reverse($rss->items);

  $description = False; 
  foreach ($rss->items as $item) {
      if ($item['description']) {$description = True; break;}
  }

  #Bild items
  if (!$short and $description) { #full item list

    $output.="";
    foreach ($rss->items as $item) {

      $d_text = true;
      $d_title = true;

      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

      $d_title = wfRssFilter ($title, $rssFilter);
      $title= wfRssHighlight($title, $rssHighlight);

      #bild description text if desired
      if ($item["description"]) {
        $text= trim(iconv($charset,$wgOutputEncoding,$item['description']));

        #avoid pre-tags
        $text= str_replace("\r"," ",$text);
        $text= str_replace("\n"," ",$text);
        $text= str_replace("\t"," ",$text);

        $d_text = wfRssFilter ($text, $rssFilter);
        $text= wfRssHighlight($text, $rssHighlight);

        $display = $d_text or $d_title;

      }
        else   {
          $text = "";
          $display = $d_title;
        }       

      if ($display) {
        $output.="* [$href $title]";
        if ($text) $output.="<br>$text";
        $output .= "\n";
      }

    #Cut off output when maxheads is reached:
    if (++$headcnt == $maxheads)  break;

    }
    # $output.="</dl>";
  }
  else { #short item list
   #  $output.="<ul>";
    foreach ($rss->items as $item) {
      $href = trim(iconv($charset,$wgOutputEncoding,$item['link']));
      $title = trim(iconv($charset,$wgOutputEncoding,$item['title']));

        $d_title = wfRssFilter ($title, $rssFilter);
        $title= wfRssHighlight($title, $rssHighlight);

        if ($d_title ) $output.="* [$href $title]\n";

      #Cut off output when maxheads is reached:
      if (++$headcnt == $maxheads)  break;
    }
    # $output.="</ul>";
  }


  if ($DisableCache) {

    global $wgVersion;

    # Do not cache this wiki page.
    # for details see http://public.kitware.com/Wiki/User:Barre/MediaWiki/Extensions
    global $wgTitle, $wgDBprefix;
    $ts = mktime();
    $now = gmdate("YmdHis", $ts + 120);
    $ns = $wgTitle->getNamespace();
    $ti = wfStrencode($wgTitle->getDBkey());

    $version = preg_replace("/^([1-9]).([1-9]).*/", "\\1\\2", $wgVersion);
    if ($version>14) $sql = "UPDATE $wgDBprefix"."page SET page_touched='$now' WHERE page_namespace=$ns AND page_title='$ti'";
    else             $sql = "UPDATE $wgDBprefix"."cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";

    wfQuery($sql, DB_WRITE, "");
  }

  $out = $parser->parse ($output, $parser->mTitle,$parser->mOptions, true, false);
  return $out->getText();
}


function wfRssFilter ($text, $rssFilter) {

  $display = true;

  if (is_array($rssFilter)) {
    foreach($rssFilter as $term) {

      if ($term) {
        $display = false;
        if (preg_match("|$term|i", $text, $a))  {  $display = true; return $display; }
      }
    if ($display) break;
    }
  }
  return $display;
}


function wfRssHighlight($text, $rssHighlight) {

  $i=0;
  $starttag = "v8x5u3t3u8h";
  $endtag   = "q8n4f6n4n4x";

  $color[]="coral";
  $color[]="greenyellow";
  $color[]="lightskyblue";
  $color[]="gold";
  $color[]="violet";

  $count_color = count($color);

  if (is_array($rssHighlight)) {
    foreach($rssHighlight as $term) {
      if ($term) {
        $text = preg_replace("|\b(\w*?".$term."\w*?)\b|i", "$starttag"."_".$i."\\1$endtag", $text);
        $i++;
        if ($i == $count_color) $i=0;
        }
      }
    }
  # to avoid trouble should someone wants to highlight the terms "span", "style", ...
  for ($i=0; $i<5; $i++) {
    $text = preg_replace("|$starttag"."_".$i."|", "<span style=\"background-color:".$color[$i]."; font-weight: bold;\">", $text);
    $text = preg_replace("|$endtag|", "</span>", $text);
    }

  return $text;
}

?>