Пример #1
0
<?php

/**
 * The Getter object has one method:
 *
 * getItems($quantity, $hours, $scoring, $metadata)
 *
 * $quantity (int): Number of links desired. Default 20.
 * $hours (int): How far back to look for links. Default 24.
 * $scoring (bool): TRUE to employ  "freshness vs. quality" algorithm
 *   or FALSE to simply return most frequently tweeted links. Default TRUE.
 * $metadata (bool): TRUE to hydrate URLs with Embed.ly metadata.
 *   An API key must be set in config.php. Default FALSE.
 */
require __DIR__ . '../../init.php';
use OpenFuego\app\Getter;
$fuego = new Getter();
$items = $fuego->getItems(20, 24, TRUE, TRUE);
// quantity, hours, scoring, metadata
print '<pre>';
print_r($items);
print '</pre>';
Пример #2
0
<?php

/**
 * Slightly modified version of the Getter example that came with the Fuego installation
 *
 */
require __DIR__ . '../../init.php';
use OpenFuego\app\Getter;
$quantity = isset($_REQUEST['fuegoQuantity']) ? $_REQUEST['fuegoQuantity'] : 20;
$hours = isset($_REQUEST['fuegoHours']) ? $_REQUEST['fuegoHours'] : 24;
$scoring = isset($_REQUEST['fuegoScoring']) ? $_REQUEST['fuegoScoring'] : TRUE;
$metadata = isset($_REQUEST['feugoMetadata']) ? $_REQUEST['feugoMetadata'] : TRUE;
$fuego = new Getter();
$items = $fuego->getItems($quantity, $hours, $scoring, $metadata);
// quantity, hours, scoring, metadata
echo json_encode($items);
Пример #3
0
					</div>
					<div class="usa-intro bbg-page__header-text bbg-team__text">
						<h1 class="bbg-page__header-title">Trending</h1>
						<h3 class="bbg-page__header-description">An auto-generated stream of conversations and links from the international media, innovation and policy communities.</h3>
						<p>Powered by <a href="https://github.com/niemanlab/openfuego">Fuego</a></p>
					</div>
				</header><!-- .page-header -->
			</div>
			<div class="usa-grid multicolumn">
			<?php 
//require('../../fuego/init.php');
$linkDetailID = 0;
if (isset($_GET['linkID'])) {
    $linkDetailID = $_GET['linkID'];
}
$items = $fuego->getItems(20, 24, FALSE, TRUE, 2, $linkDetailID);
// quantity, hours, scoring, metadata
$counter = 0;
function twitterify($ret)
{
    $ret = str_replace("https://medium.com/@", "https://medium.com/", $ret);
    $ret = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2", $ret);
    $ret = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"https://\\2\" target=\"_blank\">\\2", $ret);
    $ret = preg_replace("/@(\\w+)/", "<a href=\"https://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $ret);
    $ret = preg_replace("/#(\\w+)/", "<a href=\"https://twitter.com/#\\1\" target=\"_blank\">#\\1</a>", $ret);
    return $ret;
}
function ago($time)
{
    $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
    $lengths = array("60", "60", "24", "7", "4.35", "12", "10");
Пример #4
0
		<input type='radio' name='algo' value='smart' <?php 
    echo "{$smartChecked}";
    ?>
 >Be Smart
		<input type='radio' name='algo' value='recent' <?php 
    echo "{$recentChecked}";
    ?>
 >Most Recent
		<BR><BR>

		<input type='submit' value='GO'>
	</form>
<?php 
    die;
}
$items = $fuego->getItems($maxItems, $hours, $requireQuality, TRUE, $minWeightedCount);
// quantity, hours, scoring, metadata
/*
	print "<a href='fuego.php'>BE SMART</a> | <a href='fuego.php?showAll'>MOST RECENT 20</a> | <a target='blank' href='fuego.php?showAll&rss'>RSS ALL</a> | <a target='blank' href='fuego.php?rss'>RSS SMART</a><BR><BR>";
	print '<pre>';
	print_r($items);
	print '</pre>';
*/
if ($displayFormat == 'json') {
    print '<pre>';
    print_r($items);
    print '</pre>';
} else {
    if ($displayFormat == 'human') {
        echo '
		<html>