86 lines
4.0 KiB
PHP
86 lines
4.0 KiB
PHP
<?php
|
|
include_once('top-cache.php');
|
|
date_default_timezone_set('America/Phoenix');
|
|
$uname = 'bateworld';
|
|
#Get offset from URL
|
|
$key = 'z4bjeUiHPQ5WdDYl724RNeXwLO8PGh8ciGfAYHBsofQfSLx46w' ;
|
|
$limit=3;
|
|
$offset=0;
|
|
#Generate Tumblr URL
|
|
$request = 'https://api.tumblr.com/v2/blog/'.$uname.'.tumblr.com/posts/video/?api_key='.$key.'&offset='.$offset.'&limit='.$limit ;
|
|
?>
|
|
|
|
<div class="header">Bateworld on tumblr</div>
|
|
<div class="wh-pad">
|
|
<?php
|
|
|
|
#Get Tumblr JSON
|
|
$ci = curl_init($request);
|
|
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
|
|
$input = curl_exec($ci);
|
|
#Puts JSON into Array
|
|
$value = json_decode($input,true);
|
|
#Check if Tumblr JSON is correct
|
|
if ($value['meta']['msg'] == 'OK'){
|
|
#Process JSON Array
|
|
$posts = $value['response']['posts'];
|
|
$pCount = $value['response']['blog']['posts'];
|
|
#Create Post Dump
|
|
for($i='0';$i<($limit - 0);$i++){
|
|
$inf = $posts[$i];
|
|
?>
|
|
<?php
|
|
if (array_key_exists('player', $inf)) {
|
|
if(isset($inf['video_url'])){
|
|
echo '<div style="position:relative;"><a class="jackbox" href="'.$inf['video_url'].'" style="margin-left:0px;" data-group="tumblr" data-autoplay="true" data-title="<a href='.$inf['post_url'].' target=\'_blank\'>bateworld tumblr feed</a>" data-description="#hp_tumblr_desc"><div class="jackbox-hover jackbox-hover-black jackbox-hover-play" style=""></div> <img src="'.$inf['thumbnail_url'].'" style="width:100%;height:auto;margin-bottom:1px;" /></a></div>';
|
|
|
|
echo '<div id="hp_tumblr_desc" style="display:none;">'.$inf['caption'].'</div>';
|
|
break;
|
|
}
|
|
};
|
|
};
|
|
#Page turn
|
|
} else { ?>
|
|
<p>I Apolgise, but Tumblr appears to be offline. Please check back in a bit</p>
|
|
<?php }; ?>
|
|
|
|
<?php $limit=2;
|
|
$request = 'https://api.tumblr.com/v2/blog/'.$uname.'.tumblr.com/posts/photo/?api_key='.$key.'&offset='.$offset.'&limit='.$limit ;
|
|
#Get Tumblr JSON
|
|
$ci = curl_init($request);
|
|
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
|
|
$input = curl_exec($ci);
|
|
#Puts JSON into Array
|
|
$value = json_decode($input,true);
|
|
|
|
#Check if Tumblr JSON is correct
|
|
if ($value['meta']['msg'] == 'OK'){
|
|
|
|
#Process JSON Array
|
|
$posts = $value['response']['posts'];
|
|
$pCount = $value['response']['blog']['posts'];
|
|
|
|
|
|
#Create Post Dump
|
|
|
|
for($i='0';$i<($limit - 0);$i++){
|
|
$inf = $posts[$i];
|
|
?>
|
|
|
|
<?php
|
|
//var_dump($inf);
|
|
if (array_key_exists('photos', $inf)) { ?>
|
|
<?php //echo count($inf['photos'][0]['alt_sizes']);
|
|
for($p=0;$p < count($inf['photos'][0]['alt_sizes']);$p++)
|
|
{
|
|
if($inf['photos'][0]['alt_sizes'][$p]['width'] < 600){
|
|
?>
|
|
|
|
<div style="position:relative;"><a class="jackbox" href="<?php echo $inf['photos'][0]['original_size']['url'];?>" style="margin-left:0px;" data-group="tumblr" data-autoplay="true" data-title="<a href='<?php echo $inf['post_url'];?>' target=\'_blank\'>bateworld tumblr feed</a>" data-description=""><div class="jackbox-hover jackbox-hover-black jackbox-hover-magnify" style=""></div>
|
|
<img src="<?php echo($inf['photos'][0]['alt_sizes'][$p]['url']); ?>" style="width:100%;height:auto;">
|
|
</a></div></div>
|
|
<?php
|
|
include_once('bottom-cache.php');
|
|
exit(); ?>
|
|
|
|
<?php }}};}}?>
|