<?php date_default_timezone_set('America/Los_Angeles'); include __DIR__ . '/../../pokemonshowdown.com/news/include.php'; echo json_encode(array(getNewsId(), renderNews()));
$apps = get_magic_quotes_gpc() ? stripslashes($apps) : $apps; $app = json_decode($apps); $app = $app[0]; // this App doesn't support batchedRequests $provider = array_key_exists('context', $app) && array_key_exists('provider', $app->context) && array_key_exists($app->context->provider, $PROVIDERS) ? $app->context->provider : $DEFAULT_PROVIDER; $symbol = array_key_exists('context', $app) && array_key_exists('symbol', $app->context) ? $app->context->symbol : $DEFAULT_SYMBOL; $serverPath = (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off" ? "https://" : "http://") . $_SERVER["SERVER_NAME"] . str_replace("news.php", "", $_SERVER["SCRIPT_NAME"]); // read in the news $xml_source = file_get_contents($PROVIDERS[$provider]['feed'] . $symbol); $doc = simplexml_load_string($xml_source); $newsItems = array(); foreach ($doc->channel->item as $item) { $newsItems[] = array('title' => $item->title, 'desc' => $item->description, 'link' => $item->link, 'date' => $item->pubDate); } // create the AppManifest object $a = array("scripts" => array($serverPath . "appclass.js"), "styles" => array($serverPath . "app.css"), "apps" => array(array("html" => join('', array('<div>', renderNews($newsItems), renderSettings(), '</div>'))))); // output the jsonp header("Content-type: application/javascript"); echo "F2_jsonpCallback_com_openf2_examples_php_news(" . json_encode($a, JSON_HEX_TAG) . ")"; /** * Renders the news articles * @method renderNews * @param {Array} $newsItems The list of articles * @return {string} The News HTML */ function renderNews($newsItems) { global $MAX_ARTICLES; global $PROVIDERS; global $provider; global $doc;
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.5.7/slick.css"/> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.8/slick-theme.min.css" /> <?php define("BASE_PATH", './'); require_once 'render_util.php'; renderBeginPage('home'); renderHero(); renderNews(); renderEvents(); renderEndPage(); function renderHero() { $markup = <<<MARKUP <div class='hero'> <div class='header'><b>rescue</b> the mistreated | <b>save</b> the injured | <b>love</b> the abandoned</div> <div class="adoptable"></div> </div> MARKUP; echo $markup; } function renderNews() { $markup = <<<MARKUP <div class="news"> <img class="faq-button" src="./images/faq_button.png" width="168" height="158"> <div class="header"> <img src="./images/recent_news_header.png" width="386" height="77"> </div> <div class="body"> <div class="featured"></div>