PluginProbe
WebberZone Top 10 — Popular Posts / 1.2
WebberZone Top 10 — Popular Posts v1.2
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
top-10 / top-10-counter.js.php

top-10-counter.js.php in WebberZone Top 10 — Popular Posts 1.2, at top-10-counter.js.php

40 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 //"top-10-counter.js.php" Display number of page views
3 Header("content-type: application/x-javascript");
4
5 if (!function_exists('add_action')) {
6 $wp_root = '../../..';
7 if (file_exists($wp_root.'/wp-load.php')) {
8 require_once($wp_root.'/wp-load.php');
9 } else {
10 require_once($wp_root.'/wp-config.php');
11 }
12 }
13
14 // Display counter using Ajax
15 function tptn_disp_count() {
16 global $wpdb;
17
18 $table_name = $wpdb->prefix . "top_ten";
19 $table_name_daily = $wpdb->prefix . "top_ten_daily";
20 $tptn_settings = tptn_read_options();
21 $count_disp_form = htmlspecialchars(stripslashes($tptn_settings[count_disp_form]));
22
23 $id = intval($_GET['top_ten_id']);
24 if($id > 0) {
25
26 $resultscount = $wpdb->get_row("select postnumber, cntaccess from $table_name WHERE postnumber = $id");
27 $cntaccess = number_format((($resultscount) ? $resultscount->cntaccess : 0));
28 $count_disp_form = str_replace("%totalcount%", $cntaccess, $count_disp_form);
29
30 // Now process daily count
31 $resultscount = $wpdb->get_row("select postnumber, cntaccess from $table_name_daily WHERE postnumber = $id");
32 $cntaccess = number_format((($resultscount) ? $resultscount->cntaccess : 0));
33 $count_disp_form = str_replace("%dailycount%", $cntaccess, $count_disp_form);
34
35 echo 'document.write("'.$count_disp_form.'")';
36 }
37 }
38 tptn_disp_count();
39 ?>
40