Beispiel #1
0
function ajax_link_download()
{
    // The $_REQUEST contains all the data sent via ajax
    if (isset($_POST)) {
        $post_id = $_POST['post_id'];
        echo json_encode(getFileByPostID($post_id));
    }
    die;
}
<?php

/*
Template Name: Download Detail
*/
$post_id = get_query_var('post_id');
$files = getFileByPostID($post_id);
$post = get_post($post_id);
//echo "<pre>";var_dump($post);exit;
global $download_post_name;
$download_post_name = $post->post_title;
$key_1_values = get_post_meta(get_the_ID(), '_infomation_name', true);
$key_2_values = get_post_meta(get_the_ID(), '_infomation_version', true);
$key_3_values = get_post_meta(get_the_ID(), '_infomation_manufacturers', true);
get_header();
?>
<div class="site-download">
	<div id="site-breadcrumbs">
		<?php 
NQD_breadcrumbs();
?>
	</div>
		<div class="post-container">
			<div class="post-info" itemscope itemtype="http://data-vocabulary.org/Recipe">
				<div class="post_thumb">
					<img itemprop="photo" src="<?php 
bloginfo('home');
?>
/media/resizer/57x57/r/<?php 
echo remove_http(catch_that_image());
?>
        $file_views = $file->file_views;
        $link_name = sanitize_title($file_name);
        $mylink = home_url('/') . 'download/' . $file_id . '/' . $link_name;
        if (!isset($_SESSION['file_views'][$file_id])) {
            $_SESSION['file_views'][$file_id] = $file_views + 1;
            updateFile(array('file_views' => $file_views + 1), array('file_id' => $file_id));
        }
        echo '<a class="button" href="' . $mylink . '" rel="nofollow">ANDROID</a>
						<span style="display:inline-block;vertical-align:middle;width:70px;height:70px;background: url("http://chart.apis.google.com/chart?cht=qr&amp;chs=100x100&amp;chl=' . $mylink . '") no-repeat center center;margin-left:6px;"></span>
						
						';
    }
} else {
    $Android = stripos($_SERVER['HTTP_USER_AGENT'], "Android");
    if ($Android) {
        $files = getFileByPostID(get_the_ID());
        foreach ($files as $file) {
            $file_id = $file->file_id;
            $post_id = $file->post_id;
            $file_name = $file->file_name;
            $file_url = $file->file;
            $file_des = $file->file_des;
            $file_size = formatBytes($file->file_size);
            $file_hits = $file->file_hits;
            $file_date = $file->file_date;
            $file_updated_date = $file->file_updated_date;
            $file_last_downloaded_date = $file->file_last_downloaded_date;
            $file_views = $file->file_views;
            $link_name = sanitize_title($file_name);
            $mylink = home_url('/') . 'download/' . $file_id . '/' . $link_name;
            if (!isset($_SESSION['file_views'][$file_id])) {