예제 #1
0
    if ($stats_display['viewed_most_post'] == 1) {
        $content .= '<p><strong>' . sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)) . '</strong></p>' . "\n";
        $content .= '<ul>' . "\n";
        $content .= get_most_viewed('post', $stats_mostlimit, 0, false);
        $content .= '</ul>' . "\n";
    }
    if ($stats_display['viewed_most_page'] == 1) {
        $content .= '<p><strong>' . sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)) . '</strong></p>' . "\n";
        $content .= '<ul>' . "\n";
        $content .= get_most_viewed('page', $stats_mostlimit, 0, false);
        $content .= '</ul>' . "\n";
    }
    return $content;
}
### Function: Increment Post Views
increment_views();
function increment_views()
{
    global $wpdb;
    $post_id = intval($_GET['postviews_id']);
    if ($post_id > 0 && defined('WP_CACHE') && WP_CACHE) {
        $post_views = get_post_custom($post_id);
        $post_views = intval($post_views['views'][0]);
        if (!update_post_meta($post_id, 'views', $post_views + 1)) {
            add_post_meta($post_id, 'views', 1, true);
        }
    }
}
### Function Show Post Views Column in WP-Admin
add_action('manage_posts_custom_column', 'add_postviews_column_content', 5, 2);
add_filter('manage_posts_columns', 'add_postviews_column', 5, 2);
예제 #2
0
파일: ajax.php 프로젝트: yukisky/clipbucket
     $direc = mysql_clean($_POST['direction']);
     $t = $_POST['type'];
     switch ($t) {
         case "videos":
         case "video":
         case "v":
             //$N_item = $cbvideo->collection->get_next_prev_item($item_id,$cid,$direc);
             //increment_views($N_item[0]['videoid'],'video');
             //$ajax['key'] = $N_item[0]['videokey'];
             //$ajax['cid'] = $N_item[0]['collection_id'];
             break;
         case "photos":
         case "photo":
         case "p":
             $N_item = $cbphoto->collection->get_next_prev_item($item_id, $cid, $direc);
             increment_views($N_item[0]['photo_id'], 'photo');
             $ajax['key'] = $N_item[0]['photo_key'];
             $ajax['cid'] = $N_item[0]['collection_id'];
             break;
     }
     if ($N_item) {
         assign('type', $t);
         assign('user', $userquery->get_user_details($N_item[0]['userid']));
         assign('object', $N_item[0]);
         $ajax['content'] = Fetch('view_item.html');
         echo json_encode($ajax);
     } else {
         return false;
     }
     break;
 case "load_more_items":
예제 #3
0
 function UpdateVideoViews($vkey)
 {
     increment_views($vkey, 'video');
 }
예제 #4
0
                     $Cbucket->show_page = false;
                 }
             } else {
                 e(lang("item_not_exist"));
                 $Cbucket->show_page = false;
             }
             break;
         case "photos":
         case "p":
             global $cbphoto;
             $photo = $cbphoto->get_photo($item);
             if ($photo) {
                 $info = $cbphoto->collection->get_collection_item_fields($cid, $photo['photo_id'], 'ci_id');
                 if ($info) {
                     $photo = array_merge($photo, $info[0]);
                     increment_views($photo['photo_id'], 'photo');
                     assign('object', $photo);
                     assign('user', $userquery->get_user_details($photo['userid']));
                     assign('c', $collect);
                     subtitle($photo['photo_title'] . ' &laquo; ' . $collect['collection_name']);
                 } else {
                     e(lang("item_not_exist"));
                     $Cbucket->show_page = false;
                 }
             } else {
                 e(lang("item_not_exist"));
                 $Cbucket->show_page = false;
             }
             break;
     }
 }
예제 #5
0
/**
 * Funcion used to call functions
 * when user view collection
 * ie in view_collection.php
 */
function call_view_collection_functions($cdetails)
{
    $funcs = get_functions('view_collection_functions');
    if (is_array($funcs) && count($funcs) > 0) {
        foreach ($funcs as $func) {
            if (function_exists($func)) {
                $func($cdetails);
            }
        }
    }
    increment_views($cdetails['collection_id'], "collection");
}