Difference between revisions of "Template:Mainpage-rssfeeds"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
(RSS-Feed Mediawiki extension)
Line 7: Line 7:
 
http://meta.wikimedia.org/wiki/GISWiki/RSS
 
http://meta.wikimedia.org/wiki/GISWiki/RSS
  
 +
__NOTOC__
 
==RSS-Feed Mediawiki extension==
 
==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 <nowiki><rss>-tags for each feed. The rss section may contain parameters
 +
separated by a pipe ("|"), just like links and templates. These parameters are supported:
 +
</nowiki>
 +
 +
* 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:===
 +
<nowiki><rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss></nowiki>
 +
 +
<rss>http://slashdot.org/slashdot.rss|charset=UTF-8|short|max=5</rss>
 +
 
<pre><nowiki>
 
<pre><nowiki>
  

Revision as of 16:20, 29 July 2006

UNIQ7d48b77a4f0b7ffc-rss-00000000-QINU UNIQ7d48b77a4f0b7ffc-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>

ZTE Exports Ban May Mean No Google Apps, a Death Sentence For Its Smartphones

Fri, 20 Apr 2018 10:00:00

New submitter krazy1 shares a report from Ars Technica: The U.S. government is going after another Chinese Android device maker. After shutting down Huawei's carrier deals and retail partners, the government is now pursuing ZTE. The U.S. Department of Commerce has banned U.S. companies from selling parts and software to ZTE for seven years. ZTE was caught violating U.S. sanctions by illegally shipping telecommunications equipment to Iran and North Korea. The company then made things worse by "making false statements and obstructing justice, including through preventing disclosure to and affirmatively misleading the U.S. Government," according to the Department of Commerce. The latest news from Reuters raises even bigger issues for ZTE, though. A source told Reuters that "The Commerce Department decision means ZTE Corp may not be able to use Google's Android operating system in its mobile devices." Android is free and open source and will probably remain free for ZTE to use without Google's involvement. Reuters' source is probably referring to the Google apps, which aren't sold to device makers but are carefully licensed to them in exchange for other concessions. The Google apps package includes popular services like Gmail and Google Maps, and it also unlocks the Play Store, Google Play Services, and the entire Android app ecosystem. For a market-viable Android device, the Play Store is pretty much mandatory in every country other than China. So while ZTE could conceivably source hardware components from non-U.S. sources, being locked out of the Play Store would devastate ZTE's smartphones worldwide.

Share on Google+


Read more of this story at Slashdot.

Audit Approved of Facebook Policies, Even After Cambridge Analytica Leak

Fri, 20 Apr 2018 07:00:00

Nicholas Confessore reports via The New York Times: An auditing firm responsible for monitoring Facebook for federal regulators told them last year that the company had sufficient privacy protections in place, even after the social media giant lost control of a huge trove of user data that was improperly obtained by the political consulting firm Cambridge Analytica. The assertion, by PwC, came in a report submitted to the Federal Trade Commission in early 2017. The report, a redacted copy of which is available on the commission's website, is one of several periodic reviews of Facebook's compliance with a 2011 federal consent decree, which required Facebook to take wide-ranging steps to prevent the abuse of users' information and to inform them how it was being shared with other companies. The accounting firm, formerly known as PricewaterhouseCoopers, effectively gave Facebook a clean bill of health. "Facebook's privacy controls were operating with sufficient effectiveness to provide reasonable assurance to protect the privacy" of users, said the assessment, which stretched from February 2015 to February 2017. But during that period, Facebook was aware that a researcher based in Britain, Aleksandr Kogan, had provided Cambridge Analytica with private Facebook data from millions of users.

Share on Google+


Read more of this story at Slashdot.

Since 2016, Half of All Coral In the Great Barrier Reef Has Died

Fri, 20 Apr 2018 03:30:00

A new paper, published Wednesday in the journal Nature, reports that the Great Barrier Reef has lost more than half of its corals since 2016. The authors inspected every one of its reefs, surveying them on an almost species-by-species basis, and found the damage to be widespread across the entire ecosystem. "Two of its most recognizable creatures -- the amber-colored staghorn corals, and the flat, fanlike tabular corals -- suffered the worst casualties," reports The Atlantic. From the report: "On average, across the Great Barrier Reef, one in three corals died in nine months," said Terry Hughes, an author of the paper and the director of the ARC Center of Excellence for Coral Reef Studies, the Australian government's federal research program devoted to corals. "You could say [the ecosystem] has collapsed. You could say it has degraded. I wouldn't say that's wrong," Hughes said. "A more neutral way of putting it is that it has transformed into a completely new system that looks differently, and behaves differently, and functions differently, than how it was three years ago." In the summer months of 2017, warm waters again struck the reef and triggered another bleaching event. This time, the heat hit the reef's middle third. Hughes and his team have not published a peer-reviewed paper on that event, but he shared early survey results with me. Combined, he said, the back-to-back bleaching events killed one in every two corals in the Great Barrier Reef. It is a fact almost beyond comprehension: In the summer of 2015, more than 2 billion corals lived in the Great Barrier Reef. Half of them are now dead. What caused the devastation? Hughes was clear: human-caused global warming. The accumulation of heat-trapping pollution in the atmosphere has raised the world's average temperature, making the oceans hotter and less hospitable to fragile tropical corals.

Share on Google+


Read more of this story at Slashdot.

Cloudflare: FOSTA Was a 'Very Bad Bill' That's Left the Internet's Infrastructure Hanging

Fri, 20 Apr 2018 02:05:00

Last week, President Donald Trump signed the Fight Online Sex Trafficking Act (FOSTA) into law. It's a bill that penalizes any platform found "facilitating prostitution," and has caused many advocacy groups to come out against the bill, saying that it undermines essential internet freedoms. The most recent entity to decry FOSTA is Cloudflare, which recently decided to terminate its content delivery network services for an alternative, decentralized social media platform called Switter. Motherboard talked to Cloudflare's general counsel, Doug Kramer, about the bill and he said that FOSTA was an ill-consider bill that's now become a dangerous law: "[Terminating service to Switter] is related to our attempts to understand FOSTA, which is a very bad law and a very dangerous precedent," he told me in a phone conversation. "We have been traditionally very open about what we do and our roles as an internet infrastructure company, and the steps we take to both comply with the law and our legal obligations -- but also provide security and protection, let the internet flourish and support our goals of building a better internet." Cloudflare lobbied against FOSTA, Kramer said, urging lawmakers to be more specific about how infrastructure companies like internet service providers, registrars and hosting and security companies like Cloudflare would be impacted. Now, he said, they're trying to figure out how customers like Switter will be affected, and how Cloudflare will be held accountable for them. "We don't deny at all that we have an obligation to comply with the law," he said. "We tried in this circumstance to get a law that would make sense for infrastructure companies... Congress didn't do the hard work of understanding how the internet works and how this law should be crafted to pursue its goals without unintended consequences. We talked to them about this. A lot of groups did. And it was hard work that they decided not do." He said the company hopes, going forward, that there will be more clarity from lawmakers on how FOSTA is applied to internet infrastructure. But until then, he and others there are having to figure it out along with law enforcement and customers. "Listen, we've been saying this all along and I think people are saying now, this is a very bad law," Kramer said. "We think, for now, it makes the internet a different place and a little less free today as a result. And there's a real-world implication of this that people are just starting to grapple with."

Share on Google+


Read more of this story at Slashdot.

AMD 2nd Gen Ryzen Processors Launched and Benchmarked

Fri, 20 Apr 2018 01:25:00

MojoKid writes: AMD launched its 2nd Generation Ryzen processors today, based on a refined update to the company's Zen architecture, dubbed Zen+. The chips offer higher clocks, lower latencies, and a more intelligent Precision Boost 2 algorithm that improves performance, system responsiveness, and power efficiency characteristics. These new CPUs still leverage the existing AM4 infrastructure and are compatible with the same socket, chipsets, and motherboards as AMD's first-generation products, with a BIOS/UEFI update. There are four processors arriving today, AMD's Ryzen 7 2700X, the Ryzen 7 2700, the Ryzen 5 2600X, and the Ryzen 5 2600. Ryzen 7 chips are still 8-core CPUs with 20MB of cache but now top out at 4.3GHz, while Ryzen 5 chips offer 6 cores with 19MB of cache and peak at 4.2GHz. AMD claims 2nd Gen Ryzen processors offer reductions in L1, L2, and L3 cache latencies of approximately 13%, 34%, and 16%, respectively. Memory latency is reportedly reduced by about 11% and all of those improvements result in an approximate 3% increase in IPC (instructions per clock). The processors now also have official support for faster DDR4-2933 memory as well. In the benchmarks, 2nd Gen Ryzen CPUs outpaced AMD's first gen chips across the board with better single and multithreaded performance, closing the gap even further versus Intel, often with better or similar performance at lower price points. AMD 2nd Gen Ryzen processors, and new X470 chipset motherboards that support them, are available starting today and the CPUs range from $199 to $299.

Share on Google+


Read more of this story at Slashdot.


<?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;
}

?>