1

Add files via upload

This commit is contained in:
Evan Pratten 2017-09-12 19:48:05 -04:00 committed by GitHub
parent 7807797ef5
commit 4824587b45
3 changed files with 91 additions and 31 deletions

39
community/getrss.php Normal file

@ -0,0 +1,39 @@
<?php
$xml=("http://www.rssmix.com/u/8252161/rss.xml");
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
//get elements from "<channel>"
$channel=$xmlDoc->getElementsByTagName('channel')->item(0);
$channel_title = $channel->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$channel_link = $channel->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$channel_desc = $channel->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;
//output elements from "<channel>"
echo("<p><a href='" . $channel_link
. "'>" . $channel_title . "</a>");
echo("<br>");
echo($channel_desc . "</p>");
//get and output "<item>" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=2; $i++) {
$item_title=$x->item($i)->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$item_link=$x->item($i)->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$item_desc=$x->item($i)->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;
echo ("<p><a href='" . $item_link
. "'>" . $item_title . "</a>");
echo ("<br>");
echo ($item_desc . "</p>");
}
?>

@ -79,7 +79,7 @@
</div>
<br>
<div style="padding:6px; background-color:#ff0000; border-radius:8px;">
<a href="https://www.youtube.com/channel/UCxzARKt0_U0sLHbF4pDN1Pw?sub_confirmation=1">Subscribe to RetryLife Official</a>
<a href="https://www.youtube.com/channel/UCxzARKt0_U0sLHbF4pDN1Pw?sub_confirmation=1">Subscribe to Nathan Desjardins</a>
</div>
<br>
@ -97,36 +97,30 @@
<div class="rantlist-bg">
<ul class="rantlist">
<?php
$files = glob('content/*.{json}', GLOB_BRACE);
foreach($files as $file) {
//do your work here
$url = $file;
$content = file_get_contents($url);
$json = json_decode($content, true);
echo '<li class="rant-comment-row-widget" data-id="829770" data-type="rant" style="background-color:#243447;color:white;"><div class="rantlist-title-text" >';
echo $json{title};
echo " - ";
echo $json{author};
echo '</div> <';
echo $json{type};
echo ' src="';
echo $json{src}; echo '" href="';
echo $json{href};
echo '" width=100%>';
echo $json{body};
echo '</';
echo $json{type};
echo '>';
echo '</li>';
}
?>
<script>
function showRSS(str) {
if (str.length==0) {
document.getElementById("rssOutput").innerHTML="";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
document.getElementById("rssOutput").innerHTML=this.responseText;
}
}
xmlhttp.open("GET","getrss.php?q="+str,true);
xmlhttp.send();
}
</script>
<div id="rssOutput">RSS-feed will be listed here...</div>
</div>
<div class="clearfix"></div>
</div>

@ -0,0 +1,27 @@
<?php
$files = glob('content/*.{json}', GLOB_BRACE);
foreach($files as $file) {
//do your work here
$url = $file;
$content = file_get_contents($url);
$json = json_decode($content, true);
echo '<li class="rant-comment-row-widget" data-id="829770" data-type="rant" style="background-color:#243447;color:white;"><div class="rantlist-title-text" >';
echo $json{title};
echo " - ";
echo $json{author};
echo '</div> <';
echo $json{type};
echo ' src="';
echo $json{src}; echo '" href="';
echo $json{href};
echo '" width=100%>';
echo $json{body};
echo '</';
echo $json{type};
echo '>';
echo '</li>';
}
?>