Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- search.php
- <?php
- /**
- * The template for displaying Search Results pages
- *
- * @package WordPress
- * @subpackage Twenty_Fourteen
- * @since Twenty Fourteen 1.0
- */
- get_header(); ?>
- <section id="primary" class="content-area">
- <div id="content" class="site-content" role="main">
- <?php if ( have_posts() ) : ?>
- <header class="page-header">
- <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
- </header><!-- .page-header -->
- <?php
- // Start the Loop.
- while ( have_posts() ) : the_post();
- /*
- * Include the post format-specific template for the content. If you want to
- * use this in a child theme, then include a file called called content-___.php
- * (where ___ is the post format) and that will be used instead.
- */
- get_template_part( 'content', get_post_format() );
- endwhile;
- // Previous/next post navigation.
- twentyfourteen_paging_nav();
- else : ?>
- <?php
- $rssbing = simplexml_load_file('http://www.bing.com/search?q=filetype:pdf+'.urlencode($s).'&count=10&format=rss');
- ?>
- <?php
- foreach ($rssbing->channel->item as $itembing) {
- $random_karakter = random_karakter();
- echo '<a href="'.$itembing->link.'"><h1>'.htmlspecialchars(strip_tags($itembing->title)).'</h1></a>';
- echo '<p>'.htmlspecialchars(strip_tags($itembing->description)).'</p>';
- echo "<a target='_blank' href='goto?".base64_encode("pdf=".$itembing->link."=".$random_karakter)."'>View</a>";
- echo '<p>'.$itembing->link.' - '.$itembing->pubDate.'</p>';
- }
- if (empty($itembing)) {
- echo '<small>Not Found</small>';
- }
- ?>
- <?php endif;
- ?>
- </div><!-- #content -->
- </section><!-- #primary -->
- <?php
- get_sidebar( 'content' );
- get_sidebar();
- get_footer();
- header2.php
- <?php
- /**
- * The Header for our theme
- *
- * Displays all of the <head> section and everything up till <div id="main">
- *
- * @package WordPress
- * @subpackage Twenty_Fourteen
- * @since Twenty Fourteen 1.0
- */
- ?><!DOCTYPE html>
- <!--[if IE 7]>
- <html class="ie ie7" <?php language_attributes(); ?>>
- <![endif]-->
- <!--[if IE 8]>
- <html class="ie ie8" <?php language_attributes(); ?>>
- <![endif]-->
- <!--[if !(IE 7) & !(IE 8)]><!-->
- <html <?php language_attributes(); ?>>
- <!--<![endif]-->
- <head>
- <meta charset="<?php bloginfo( 'charset' ); ?>">
- <meta name="viewport" content="width=device-width">
- <meta name="robots" content="noindex,nofollow" />
- <title><?php echo''.$title.''; ?> - <?php bloginfo( 'name' ); ?></title>
- <link rel="profile" href="http://gmpg.org/xfn/11">
- <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
- <!--[if lt IE 9]>
- <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
- <![endif]-->
- <?php wp_head(); ?>
- </head>
- <body <?php body_class(); ?>>
- <div id="page" class="hfeed site">
- <?php if ( get_header_image() ) : ?>
- <div id="site-header">
- <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
- <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
- </a>
- </div>
- <?php endif; ?>
- <header id="masthead" class="site-header" role="banner">
- <div class="header-main">
- <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
- <div class="search-toggle">
- <a href="#search-container" class="screen-reader-text"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
- </div>
- <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
- <button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
- <a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
- <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
- </nav>
- </div>
- <div id="search-container" class="search-box-wrapper hide">
- <div class="search-box">
- <?php get_search_form(); ?>
- </div>
- </div>
- </header><!-- #masthead -->
- <div id="main" class="site-main">
- docviewers.php
- <?php
- $decode_url = decode_url($_SERVER['REQUEST_URI']);
- $cookie = base64_decode($_COOKIE[base64_encode('random_karakter')]);
- $file = $decode_url['pdf'];
- $rss = new DOMDocument();
- $rss->load('http://www.bing.com/search?q=filetype:pdf+' . basename($file) . '&go=&form=QBLH&filt=all&format=rss');
- $feed = array();
- foreach ($rss->getElementsByTagName('item') as $node) {
- $item = array (
- 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
- 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
- );
- array_push($feed, $item);
- }
- $limit = 1; // ini adalah jumlah yang di ambil dari feed bing
- for($x=0;$x<$limit;$x++) {
- $title = str_replace(' & ', ' & ', $feed[$x]['title']);
- $link = $feed[$x]['link'];
- }
- ?>
- <?php
- /**
- * Template Name: doc viewers
- *
- * @package WordPress
- * @subpackage Twenty_Fourteen
- * @since Twenty Fourteen 1.0
- */
- include(TEMPLATEPATH.'/header2.php'); ?>
- <div id="main-content" class="main-content">
- <?php
- if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
- // Include the featured content template.
- get_template_part( 'featured-content' );
- }
- ?>
- <div id="primary" class="content-area">
- <div id="content" class="site-content" role="main">
- <?php
- echo '<h1>'.$title.'</h1>';
- echo ''.$link.'';
- echo '<iframe src="http://docs.google.com/gview?url='.$link.'&embedded=true" width="100%" height="750px" frameborder="0"></iframe>';
- ?>
- </div><!-- #content -->
- </div><!-- #primary -->
- </div><!-- #main-content -->
- <?php
- get_sidebar();
- get_footer();
- function.php
- <?php
- function random_karakter(){
- $karakter = array('a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z','1','2','3','4','5','6','7','8','9','0');
- $max = (count($karakter)-1);
- srand(((double)microtime()*1000000));
- $kar1 = $karakter[rand(0,$max)];
- $kar2 = $karakter[rand(0,$max)];
- $kar3 = $karakter[rand(0,$max)];
- $kar4 = $karakter[rand(0,$max)];
- $kar5 = $karakter[rand(0,$max)];
- $kar6 = $karakter[rand(0,$max)];
- $kar7 = $karakter[rand(0,$max)];
- $kar8 = $karakter[rand(0,$max)];
- $kar9 = $karakter[rand(0,$max)];
- //Anda bisa menambahkan variabe nya seperti $kar10 sampai seterusnya
- $random_karakter = $kar1.$kar2.$kar3.$kar4.$kar5.$kar6.$kar7.$kar8.$kar9;
- return $random_karakter;
- }
- //Membuat fungsi decode_url() untuk memecah dan menerjemahkan Request URL
- function decode_url($isi){
- $explode_1 = explode('?', $isi);
- $explode_2 = $explode_1[1];
- $explode_3 = explode('&', base64_decode($explode_2));
- for($i=0; $i<=count($explode_3)-1; $i++){
- $explode_4 = explode('=', $explode_3[$i]);
- $decode_url[$explode_4[0]] = $explode_4[1];
- $decode_url = str_replace($bloginfo, '', $decode_url);
- $decode_url = str_replace('/goto?=', '', $decode_url);
- }
- return $decode_url;
- }
Add Comment
Please, Sign In to add comment