Stacks Image 699

'; echo ''; echo ''; } if ($debug) { echo '
'; echo '

PHP Info

'. phpinfo(); echo '
'; } $start = ($current_page - 1) * $posts_per_page; if ($clear_cache) { // Clear Cache $clear_cache === 'all' ? clear_all_cache($cache_dir) : clear_cache_file($tumblr_domain, $post_id, $tag_name, $post_type, $posts_per_page, $start, $cache_dir); } // Go get our blog posts! $tumblrJson = get_tumblr_posts($tumblr_domain, $post_id, $tag_name, $post_type, $search_string, $posts_per_page, $start, $cache_dir, 60*$cache_min, $debug); // Get all the URLs that we might need $total_posts = isset($tumblrJson['total_posts']) ? $tumblrJson['total_posts'] : null; $url_string = build_url_string($pretty_url,$post_id,$tag_name,$search_string,$post_type,$current_page,$clear_cache,$total_posts,$posts_per_page); if (is_int($tumblrJson)) { // Switch statement for error mappings. The get_tumblr_posts function should return an integer for error codes. // HTTP Error Codes - http://www.w3.org/Protocols/HTTP/HTRESP.html $tumblr_error = true; echo '

'; switch ($tumblrJson) { case 100: echo $text_nocomm; break; case 404: echo $text_nodata; break; case 403: echo $text_nodata; break; default: echo $text_unknown; break; } echo '

'; // echo hidden error into the markup for debugging log_message("Tumblr Error Code: $tumblrJson"); } else { if ($debug) { echo '
'; echo '

Start Tumblr Debug Dump

'; echo '

Configured Tumblr Domain: http://extraordinarycontraptions.tumblr.com/

'; echo '
';
				print_r($tumblrJson);
			echo '
'; echo '
'; } echo '
'. ''. ''. '
'; echo ''; if ($pretty_url) { echo ''; } else { } // TODO: Verify if Tumblr adds this timezone back into the API else will need to be a new setting $timezone = isset($tumblrJson['blog']['timezone']) ? $tumblrJson['blog']['timezone'] : 'America/New_York'; date_default_timezone_set($timezone); if(is_array($tumblrJson['posts'])) { foreach($tumblrJson['posts'] as $post) { if(!array_key_exists('id',$post)) { // Strip the ID from the URL preg_match(':\S+/post/(\d+)(/\S)*:', $post['post_url'], $post_id_matches); $post['id'] = $post_id_matches[1]; } $post['local-page-url'] = $url_string['post_url'] . $post['id']; $post['external-page-url'] = $url_string['ext_post_url'] . $post['id']; $post['tag-url'] = $url_string['tag_url']; $post['comment-username'] = $comment_username; $post['comment-type'] = $comment_type; $post['social-buttons'] = $social_buttons; $post['text-comment'] = $text_comment; $post['blog-title'] = $tumblrJson['blog']['title']; $post['text-posted'] = $text_posted; $post['lang'] = substr($local_lang, 0, 2); // Set the global variable to Post Title. Since this is only used when one post is defined, we can do it here. $post_title = get_title($post); $post_url = $post['external-page-url']; echo '
'; echo get_post_date($post,$date_position); switch ($post['type']) { case 'text': echo get_text_post($post); break; case 'photo': if (count($post['photos']) > 1) { if (false === true) { echo get_photoset_gallery_post($post); } else { echo get_photoset_show_post($post); } } else { echo get_single_photo_post($post); } break; case 'link': echo get_link_post($post); break; case 'video': echo get_video_post($post); break; case 'quote': echo get_quote_post($post); break; case 'audio': $post['plays-text'] = $text_plays; $post['assetpath'] = $assetpath.'/tumblr-images'; echo get_audio_post($post); break; case 'chat': echo get_chat_post($post); break; case 'answer': $post['asking-from'] = $text_from; echo get_answer_post($post); break; default: echo get_text_post($post); break; } echo get_reblog_info($post, $text_reblog); echo get_post_footer($post); echo '
'; } if ($post_id) { // Would prefer to do this with PHP, if I can find a way. This will have to do for now. echo ''; } echo '
'; if (isset($url_string['old_post_url'])) { echo '

'. $text_older .'

'; } if (isset($url_string['new_post_url'])) { echo '

'. $text_newer .'

'; } echo '
'; echo '
'; } else { echo '

'. $text_nodata .'

'; } } ?>
'; echo '
'; echo '
'; } else { echo '
'; echo ''; } } elseif ($comment_username != null) { if ($comment_type == 'facebook' and !$social_buttons) { echo ''; } else { echo ''; } } } ?>

Custom Post Images