Exemplo n.º 1
0
function likebtn_review_notice()
{
    global $wpdb;
    $votes_level = 10;
    $likebtn_review = (int) get_option('likebtn_review');
    // Check
    if (_likebtn_is_stat_enabled() && !$likebtn_review) {
        $query_prepared = "\n            SELECT count(ID) \n            FROM " . $wpdb->prefix . LIKEBTN_TABLE_VOTE . " \n        ";
        $votes_count = $wpdb->get_var($query_prepared);
        if ((int) $votes_count > $votes_level) {
            $likebtn_review = 1;
            update_option('likebtn_review', $likebtn_review);
            $votes = floor($votes_count / 10) * 10;
        }
    }
    if ($likebtn_review > 0) {
        $msg = strtr('<strong>' . __(LIKEBTN_PLUGIN_TITLE, LIKEBTN_I18N_DOMAIN) . '</strong>: ' . __('Congrats!</strong> Your website crossed the <strong>%votes% votes</strong> – that’s awesome! If you like the plugin you can submit a review <a href="%url_review%" target="_blank">here</a>.', LIKEBTN_I18N_DOMAIN), array('%url_review%' => 'https://wordpress.org/support/view/plugin-reviews/likebtn-like-button?filter=5&rate=5#postform', '%votes%' => $votes));
        $msg .= '
            <p>
                <strong><a href="https://wordpress.org/support/view/plugin-reviews/likebtn-like-button?filter=5&rate=5#postform" target="_blank">' . __('Give 5 stars', LIKEBTN_I18N_DOMAIN) . '</a></strong> | <a href="#" class="likebtn_dismiss_review">' . __('Dismiss this notice', LIKEBTN_I18N_DOMAIN) . '</a>
                
            </p>
            <script type="text/javascript">
                jQuery(document).ready(function() {
                    jQuery(document).on("click", ".likebtn_review_notice .notice-dismiss, .likebtn_review_notice .likebtn_dismiss_review", function(e) {

                        e.preventDefault();
                        jQuery(".likebtn_review_notice").remove();
                        jQuery.ajax({
                            url: ajaxurl,
                            method: "POST",
                            data: {
                                action: "likebtn_dismiss_review",
                                likebtn_review: "' . $likebtn_review . '"
                            }
                        });
                    });
                });
            </script>
        ';
        _likebtn_notice($msg, 'updated is-dismissible likebtn_review_notice');
    }
}
Exemplo n.º 2
0
function likebtn_admin_statistics()
{
    global $likebtn_page_sizes;
    global $likebtn_post_statuses;
    global $wpdb;
    $query_parameters = array();
    $likebtn_entities = _likebtn_get_entities(true);
    // Custom item
    $likebtn_entities[LIKEBTN_ENTITY_CUSTOM_ITEM] = __('Custom item');
    // get parameters
    $entity_name = _likebtn_statistics_entity();
    // Process bulk actions
    //_likebtn_bulk_actions($entity_name);
    // Multisite - available for super admin only
    $blogs = array();
    $blog_list = array();
    $statistics_blog_id = '';
    $prefix_prepared = $wpdb->prefix;
    if (is_multisite() && is_super_admin()) {
        global $blog_id;
        $blog_list = $wpdb->get_results("\n            SELECT blog_id, domain\n            FROM {$wpdb->blogs}\n            WHERE site_id = '{$wpdb->siteid}'\n            AND spam = '0'\n            AND deleted = '0'\n            AND archived = '0'\n            ORDER BY blog_id\n        ");
        // Place current blog on the first place
        foreach ($blog_list as $blog) {
            if ($blog->blog_id == $blog_id) {
                $blogs["{$blog->blog_id}"] = get_blog_option($blog->blog_id, 'blogname') . ' - ' . $blog->domain;
                break;
            }
        }
        foreach ($blog_list as $blog) {
            if ($blog->blog_id != $blog_id) {
                $blogs["{$blog->blog_id}"] = get_blog_option($blog->blog_id, 'blogname') . ' - ' . $blog->domain;
            }
        }
        // Add all
        $blogs['all'] = __('All Sites');
        // Determine selected blog id
        if (isset($_GET['likebtn_blog_id'])) {
            if ($_GET['likebtn_blog_id'] == 'all') {
                $statistics_blog_id = $_GET['likebtn_blog_id'];
            } else {
                // Check if blog with ID exists
                foreach ($blog_list as $blog) {
                    if ($blog->blog_id == (int) $_GET['likebtn_blog_id']) {
                        $statistics_blog_id = (int) $_GET['likebtn_blog_id'];
                        break;
                    }
                }
            }
        }
        // Prepare prefix if this is not main blog
        if ($blog_id != 1) {
            $prefix_prepared = substr($wpdb->prefix, 0, strlen($wpdb->prefix) - strlen($blog_id) - 1);
        }
    }
    // add comment statuses
    $likebtn_post_statuses['0'] = __('Comment not approved', LIKEBTN_I18N_DOMAIN);
    $likebtn_post_statuses['1'] = __('Comment approved', LIKEBTN_I18N_DOMAIN);
    $sort_by = '';
    if (isset($_GET['likebtn_sort_by'])) {
        $sort_by = $_GET['likebtn_sort_by'];
    }
    if (!$sort_by) {
        $sort_by = 'likes';
    } elseif ($entity_name == LIKEBTN_ENTITY_CUSTOM_ITEM && $sort_by == 'post_id') {
        $sort_by = 'likes';
    }
    $page_size = LIKEBTN_STATISTIC_PAGE_SIZE;
    if (isset($_GET['likebtn_page_size'])) {
        $page_size = LIKEBTN_STATISTIC_PAGE_SIZE;
    }
    $post_id = '';
    if (isset($_GET['likebtn_post_id'])) {
        $post_id = trim(stripcslashes($_GET['likebtn_post_id']));
    }
    $post_title = '';
    if (isset($_GET['likebtn_post_title'])) {
        $post_title = trim(stripcslashes($_GET['likebtn_post_title']));
    }
    $post_status = '';
    if (isset($_GET['likebtn_post_status'])) {
        $post_status = trim($_GET['likebtn_post_status']);
    }
    // pagination
    require_once dirname(__FILE__) . '/likebtn_like_button_pagination.class.php';
    $pagination_target = "admin.php?page=likebtn_statistics";
    foreach ($_GET as $get_parameter => $get_value) {
        $pagination_target .= '&' . $get_parameter . '=' . stripcslashes($get_value);
    }
    $p = new LikeBtnLikeButtonPagination();
    $p->limit($page_size);
    // Limit entries per page
    $p->target($pagination_target);
    //$p->currentPage(); // Gets and validates the current page
    $p->prevLabel(__('Previous', LIKEBTN_I18N_DOMAIN));
    $p->nextLabel(__('Next', LIKEBTN_I18N_DOMAIN));
    if (!isset($_GET['paging'])) {
        $p->page = 1;
    } else {
        $p->page = $_GET['paging'];
    }
    // query for limit paging
    $query_limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    // query parameters
    $query_where = '';
    // Post type
    switch ($entity_name) {
        case LIKEBTN_ENTITY_COMMENT:
        case LIKEBTN_ENTITY_CUSTOM_ITEM:
        case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
        case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
        case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
        case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
        case LIKEBTN_ENTITY_BP_MEMBER:
        case LIKEBTN_ENTITY_BBP_POST:
        case LIKEBTN_ENTITY_BBP_USER:
            break;
        default:
            $query_where .= ' AND p.post_type = %s ';
            $query_parameters[] = $entity_name;
            break;
    }
    // Post ID
    if ($post_id) {
        switch ($entity_name) {
            case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
            case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
            case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
            case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
            case LIKEBTN_ENTITY_BP_MEMBER:
                $query_where .= ' AND p.id = %d ';
                break;
            case LIKEBTN_ENTITY_COMMENT:
                $query_where .= ' AND p.comment_ID = %d ';
                break;
            default:
                $query_where .= ' AND p.ID = %d ';
                break;
        }
        $query_parameters[] = $post_id;
    }
    if ($post_title) {
        switch ($entity_name) {
            case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
            case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
            case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
            case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
                $query_where .= ' AND LOWER(CONCAT(p.action, p.content)) LIKE "%%%s%%" ';
                break;
            case LIKEBTN_ENTITY_BP_MEMBER:
                $query_where .= ' AND LOWER(p.value) LIKE "%%%s%%" ';
                break;
            case LIKEBTN_ENTITY_BBP_USER:
                $query_where .= ' AND LOWER(CONCAT(p.user_login, p.display_name)) LIKE "%%%s%%" ';
                break;
            case LIKEBTN_ENTITY_COMMENT:
                $query_where .= ' AND LOWER(p.comment_content) LIKE "%%%s%%" ';
                break;
            case LIKEBTN_ENTITY_CUSTOM_ITEM:
                $query_where .= ' AND LOWER(p.identifier) LIKE "%%%s%%" ';
                break;
            default:
                $query_where .= ' AND LOWER(p.post_title) LIKE "%%%s%%" ';
                break;
        }
        $query_parameters[] = strtolower($post_title);
    }
    if ($post_status !== '') {
        if ($entity_name == LIKEBTN_ENTITY_COMMENT) {
            $query_where .= ' AND p.comment_approved = %s ';
        } elseif ($entity_name != LIKEBTN_ENTITY_CUSTOM_ITEM) {
            $query_where .= ' AND p.post_status = %s ';
        }
        $query_parameters[] = $post_status;
    }
    // order by
    switch ($sort_by) {
        case 'dislikes':
            $query_orderby = 'ORDER BY dislikes DESC';
            break;
        case 'likes_minus_dislikes':
            $query_orderby = 'ORDER BY likes_minus_dislikes DESC';
            break;
        case 'post_id':
            $query_orderby = 'ORDER BY post_id ASC';
            break;
        case 'post_title':
            $query_orderby = 'ORDER BY post_title ASC';
            break;
        case 'likes':
        default:
            $query_orderby = 'ORDER BY likes DESC';
            $sort_by = 'likes';
            break;
            /*case 'last_updated':
              $query_orderby = 'ORDER BY pm_likes.meta_id DESC';
              break;*/
    }
    // For Multisite
    $query = '';
    if ($statistics_blog_id && $statistics_blog_id != 1 && $statistics_blog_id != 'all') {
        $prefix = "{$prefix_prepared}{$statistics_blog_id}_";
        $query = _likebtn_get_statistics_sql($entity_name, $prefix, $query_where, $query_orderby, $query_limit);
        $query_prepared = $wpdb->prepare($query, $query_parameters);
    } else {
        if ($statistics_blog_id == 'all') {
            foreach ($blog_list as $blog) {
                if ($blog->blog_id == 1) {
                    $prefix = $prefix_prepared;
                } else {
                    $prefix = "{$prefix_prepared}{$blog->blog_id}_";
                }
                $query_list[] = $wpdb->prepare(_likebtn_get_statistics_sql($entity_name, $prefix, $query_where, '', '', $blog->blog_id . ' as blog_id, '), $query_parameters);
            }
            $query_prepared = ' SELECT SQL_CALC_FOUND_ROWS * from (' . implode(' UNION ', $query_list) . ") query {$query_orderby} {$query_limit} ";
        } else {
            $query = _likebtn_get_statistics_sql($entity_name, $prefix_prepared, $query_where, $query_orderby, $query_limit);
            $query_prepared = $wpdb->prepare($query, $query_parameters);
        }
    }
    // echo "<pre>";
    // echo $query_prepared;
    // echo $wpdb->prepare($query, $query_parameters);
    // $wpdb->show_errors();
    //exit();
    $statistics = $wpdb->get_results($query_prepared);
    $total_found = 0;
    if (isset($statistics[0])) {
        $query_found_rows = "SELECT FOUND_ROWS() as found_rows";
        $found_rows = $wpdb->get_results($query_found_rows);
        $total_found = (int) $found_rows[0]->found_rows;
        $p->items($total_found);
        $p->calculate();
        // Calculates what to show
        $p->parameterName('paging');
        $p->adjacents(1);
        // No. of page away from the current page
    }
    likebtn_admin_header();
    ?>

    <script type="text/javascript">
        var likebtn_msg_select_items = '<?php 
    _e("Please select item(s)", LIKEBTN_I18N_DOMAIN);
    ?>
';
        var likebtn_msg_upgrade = '<?php 
    _e("Upgrade your website to VIP to be able to use the feature", LIKEBTN_I18N_DOMAIN);
    ?>
';
    </script>
    <div>

        <?php 
    if (!_likebtn_is_stat_enabled() || get_option('likebtn_last_sync_message')) {
        ?>
            <span class="likebtn_error">
                <?php 
        echo strtr(__('Statistics not available, enable synchronization in order to view statistics:', LIKEBTN_I18N_DOMAIN), array('%url_sync%' => admin_url() . 'admin.php?page=likebtn_settings'));
        ?>
            </span>
            <?php 
        /*_e('To enable statistics:', LIKEBTN_I18N_DOMAIN)*/
        ?>
            <ol>
                <?php 
        if (get_option('likebtn_plan') < LIKEBTN_PLAN_PRO) {
            ?>
                    <li>
                        <?php 
            echo strtr(__('<a href="%url_upgrade%">Upgrade</a> your website to PRO or higher plan on LikeBtn.com.', LIKEBTN_I18N_DOMAIN), array('%url_upgrade%' => "javascript:likebtnPopup('" . __('http://likebtn.com/en/', LIKEBTN_I18N_DOMAIN) . "#plans_pricing')"));
            ?>
                    </li>
                <?php 
        }
        ?>
                <li>
                    <?php 
        echo strtr(__('Enable synchronization on <a href="%url_sync%">Synchronization</a> tab.', LIKEBTN_I18N_DOMAIN), array('%url_sync%' => admin_url() . 'admin.php?page=likebtn_settings'));
        ?>
                </li>
                <?php 
        /*<li><?php _e('Set your website tariff plan in Settings.', LIKEBTN_I18N_DOMAIN); ?></li>
          <li><?php _e('Enter E-mail and API key in Settings.', LIKEBTN_I18N_DOMAIN); ?></li>
          <li><?php _e('Set Synchronization interval in Settings.', LIKEBTN_I18N_DOMAIN); ?></li>*/
        ?>
                <?php 
        /* <li><?php _e('Run Synchronization test in Settings.', LIKEBTN_I18N_DOMAIN); ?></li> */
        ?>
            </ol>
        <?php 
    } else {
        ?>
            <p class="description">
                ● <?php 
        _e('Keep in mind that items appear in Statistics after receiving at least one vote.', LIKEBTN_I18N_DOMAIN);
        ?>
<br/>
                ● <?php 
        _e('Select <u>Custom item</u> content type to view votes of like buttons added using shortcode or HTML code.', LIKEBTN_I18N_DOMAIN);
        ?>
<br/>
                ● <?php 
        _e('To edit item votes click on a number of likes/dislikes in the statistics table.', LIKEBTN_I18N_DOMAIN);
        ?>
            </p>
        <?php 
    }
    ?>
        <br/>
        <form action="" method="get" id="statistics_form">
            <input type="hidden" name="page" value="likebtn_statistics" />

            <?php 
    if ($blogs) {
        ?>
                <label><?php 
        _e('Site', LIKEBTN_I18N_DOMAIN);
        ?>
:</label>
                <select name="likebtn_blog_id" >
                    <?php 
        foreach ($blogs as $blog_id_value => $blog_title) {
            ?>
                        <option value="<?php 
            echo $blog_id_value;
            ?>
" <?php 
            selected($statistics_blog_id, $blog_id_value);
            ?>
 ><?php 
            echo $blog_title;
            ?>
</option>
                    <?php 
        }
        ?>
                </select>
                &nbsp;&nbsp;
            <?php 
    }
    ?>

            <label><?php 
    _e('Content type', LIKEBTN_I18N_DOMAIN);
    ?>
:</label>
            <select name="likebtn_entity_name" >
                <?php 
    foreach ($likebtn_entities as $entity_name_value => $entity_title) {
        ?>
                    <option value="<?php 
        echo $entity_name_value;
        ?>
" <?php 
        selected($entity_name, $entity_name_value);
        ?>
 ><?php 
        _e($entity_title, LIKEBTN_I18N_DOMAIN);
        ?>
</option>
                <?php 
    }
    ?>
            </select>
            &nbsp;&nbsp;
            <label><?php 
    _e('Order by', LIKEBTN_I18N_DOMAIN);
    ?>
:</label>
            <select name="likebtn_sort_by" >
                <option value="likes" <?php 
    selected('likes', $sort_by);
    ?>
 ><?php 
    _e('Likes', LIKEBTN_I18N_DOMAIN);
    ?>
</option>
                <option value="dislikes" <?php 
    selected('dislikes', $sort_by);
    ?>
 ><?php 
    _e('Dislikes', LIKEBTN_I18N_DOMAIN);
    ?>
</option>
                <option value="likes_minus_dislikes" <?php 
    selected('likes_minus_dislikes', $sort_by);
    ?>
 ><?php 
    _e('Likes minus dislikes', LIKEBTN_I18N_DOMAIN);
    ?>
</option>
                <option value="post_id" <?php 
    selected('post_id', $sort_by);
    ?>
 ><?php 
    _e('ID', LIKEBTN_I18N_DOMAIN);
    ?>
</option>
                <option value="post_title" <?php 
    selected('post_title', $sort_by);
    ?>
 ><?php 
    _e('Title', LIKEBTN_I18N_DOMAIN);
    ?>
</option>
                <?php 
    /* <option value="last_updated" <?php selected('last_updated', $sort_by); ?> ><?php _e('Last updated', LIKEBTN_I18N_DOMAIN); ?></option> */
    ?>
            </select>

            &nbsp;&nbsp;
            <label><?php 
    _e('Per page', LIKEBTN_I18N_DOMAIN);
    ?>
:</label>
            <select name="likebtn_page_size" >
                <?php 
    foreach ($likebtn_page_sizes as $page_size_value) {
        ?>
                    <option value="<?php 
        echo $page_size_value;
        ?>
" <?php 
        selected($page_size, $page_size_value);
        ?>
 ><?php 
        echo $page_size_value;
        ?>
</option>
                <?php 
    }
    ?>

            </select>
            <br/><br/>
            <div class="postbox statistics_filter_container">
                <?php 
    /*<h3><?php _e('Filter', LIKEBTN_I18N_DOMAIN); ?></h3>*/
    ?>
                <div class="inside">
                    <label><?php 
    _e('ID', LIKEBTN_I18N_DOMAIN);
    ?>
:</label>
                    <input type="text" name="likebtn_post_id" value="<?php 
    echo htmlspecialchars($post_id);
    ?>
" size="5" />
                    &nbsp;&nbsp;
                    <label><?php 
    _e('Title');
    ?>
:</label>
                    <input type="text" name="likebtn_post_title" value="<?php 
    echo htmlspecialchars($post_title);
    ?>
" size="25"/>
                    &nbsp;&nbsp;
                    <label><?php 
    _e('Status', LIKEBTN_I18N_DOMAIN);
    ?>
:</label>
                    <select name="likebtn_post_status" >
                        <option value=""></option>
                        <?php 
    foreach ($likebtn_post_statuses as $post_status_value => $post_status_title) {
        ?>
                            <option value="<?php 
        echo $post_status_value;
        ?>
" <?php 
        selected($post_status, $post_status_value);
        ?>
 ><?php 
        echo _e($post_status_title);
        ?>
</option>
                        <?php 
    }
    ?>
                    </select>

                    &nbsp;&nbsp;
                    <input class="button-secondary" type="button" name="reset" value="<?php 
    _e('Reset filter', LIKEBTN_I18N_DOMAIN);
    ?>
" onClick="jQuery('.statistics_filter_container :input[type!=button]').val('');
                jQuery('#statistics_form').submit();"/>
                </div>
            </div>

            <input class="button-primary" type="submit" name="show" value="<?php 
    _e('View', LIKEBTN_I18N_DOMAIN);
    ?>
" /> 
        </form>
        <br/>
        <?php 
    _e('Total found', LIKEBTN_I18N_DOMAIN);
    ?>
: <strong><?php 
    echo $total_found;
    ?>
</strong>
        <br/>
        <form method="post" action="" id="stats_actions_form">
            <input type="hidden" name="bulk_action" value="" id="stats_bulk_action" />
        <?php 
    if (count($statistics) && $p->total_pages > 0) {
        ?>
            <div class="tablenav">
                <input type="button" class="button-secondary likebtn_ttip" onclick="likebtnStatsBulkAction('reset', '<?php 
        echo get_option('likebtn_plan');
        ?>
', '<?php 
        _e("The votes count can not be recovered after resetting. Are you sure you want to reset likes and dislikes for the selected item(s)?", LIKEBTN_I18N_DOMAIN);
        ?>
')" value="<?php 
        _e('Reset', LIKEBTN_I18N_DOMAIN);
        ?>
" title="<?php 
        _e('Set to zero number of likes and dislikes for selected items', LIKEBTN_I18N_DOMAIN);
        ?>
">
                
                <input type="button" class="button-secondary likebtn_ttip" onclick="likebtnStatsBulkAction('delete', '<?php 
        echo get_option('likebtn_plan');
        ?>
', '<?php 
        _e("The votes count can not be recovered after deleting. Are you sure you want to delete selected item(s) from statistics?", LIKEBTN_I18N_DOMAIN);
        ?>
')" value="<?php 
        _e('Delete', LIKEBTN_I18N_DOMAIN);
        ?>
" title="<?php 
        _e('Delete selected items from statistics: no posts, pages, comments, etc will be deleted, just their votes will be deleted from statistics', LIKEBTN_I18N_DOMAIN);
        ?>
">

                <div class="tablenav-pages">
                    <?php 
        echo $p->show();
        ?>
                </div>
            </div>
        <?php 
    }
    ?>
        <table class="widefat" id="statistics_container">
            <thead>
                <tr>
                    <th><input type="checkbox" onclick="statisticsItemsCheckbox(this)" value="all" style="margin:0"></th>
                    <?php 
    if ($entity_name != LIKEBTN_ENTITY_CUSTOM_ITEM) {
        ?>
                        <th>ID<?php 
        if ($sort_by == 'post_id') {
            ?>
&nbsp;↓<?php 
        }
        ?>
</th>
                    <?php 
    }
    ?>
                    <?php 
    if ($entity_name == LIKEBTN_ENTITY_POST) {
        ?>
                        <th><?php 
        _e('Featured image', LIKEBTN_I18N_DOMAIN);
        ?>
</th>
                    <?php 
    }
    ?>
                    <th width="100%"><?php 
    _e('Title', LIKEBTN_I18N_DOMAIN);
    if ($sort_by == 'post_title') {
        ?>
&nbsp;↓<?php 
    }
    ?>
</th>
                    <?php 
    if ($blogs && $statistics_blog_id == 'all') {
        ?>
                        <th><?php 
        _e('Site');
        ?>
</th>
                    <?php 
    }
    ?>
                    <th><?php 
    _e('Likes', LIKEBTN_I18N_DOMAIN);
    if ($sort_by == 'likes') {
        ?>
&nbsp;↓<?php 
    }
    ?>
</th>
                    <th><?php 
    _e('Dislikes', LIKEBTN_I18N_DOMAIN);
    if ($sort_by == 'dislikes') {
        ?>
&nbsp;↓<?php 
    }
    ?>
</th>
                    <th><?php 
    _e('Likes minus dislikes', LIKEBTN_I18N_DOMAIN);
    if ($sort_by == 'likes_minus_dislikes') {
        ?>
&nbsp;↓<?php 
    }
    ?>
</th>
                </tr>
            </thead>
            <tbody>
                <?php 
    foreach ($statistics as $statistics_item) {
        ?>
                    <?php 
        // URL
        if (!$blogs) {
            $post_url = _likebtn_get_entity_url($entity_name, $statistics_item->post_id, $statistics_item->url);
        } else {
            // Multisite
            switch ($entity_name) {
                case LIKEBTN_ENTITY_COMMENT:
                    $post_url = _likebtn_get_blog_comment_link($statistics_item->blog_id, $statistics_item->post_id);
                    break;
                case LIKEBTN_ENTITY_CUSTOM_ITEM:
                    $post_url = $statistics_item->url;
                    break;
                case LIKEBTN_ENTITY_BP_ACTIVITY_POST:
                case LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE:
                case LIKEBTN_ENTITY_BP_ACTIVITY_COMMENT:
                case LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC:
                    $post_url = bp_activity_get_permalink($statistics_item->post_id);
                    break;
                default:
                    $post_url = get_blog_permalink($statistics_item->blog_id, $statistics_item->post_id);
                    break;
            }
        }
        ?>

                    <?php 
        $statistics_item->post_title = _likebtn_prepare_title($entity_name, $statistics_item->post_title);
        ?>

                    <tr id="item_<?php 
        echo $statistics_item->post_id;
        ?>
">
                        <td><input type="checkbox" class="item_checkbox" value="<?php 
        echo $statistics_item->post_id;
        ?>
" name="item[]" <?php 
        if ($blogs && $statistics_item->blog_id != $blog_id) {
            ?>
disabled="disabled"<?php 
        }
        ?>
></td>
                        <?php 
        if ($entity_name != LIKEBTN_ENTITY_CUSTOM_ITEM) {
            ?>
                            <td><?php 
            echo $statistics_item->post_id;
            ?>
</td>
                        <?php 
        }
        ?>
                        <?php 
        if ($entity_name == LIKEBTN_ENTITY_POST) {
            ?>
                            <td><?php 
            echo get_the_post_thumbnail($statistics_item->post_id, array(32, 32));
            ?>
&nbsp;</td>
                        <?php 
        }
        ?>
                        <td><a href="<?php 
        echo $post_url;
        ?>
" target="_blank"><?php 
        echo htmlspecialchars($statistics_item->post_title);
        ?>
</a></td>
                        <?php 
        if ($blogs && $statistics_blog_id == 'all') {
            ?>
                            <td><?php 
            echo get_blog_option($statistics_item->blog_id, 'blogname');
            ?>
</td>
                        <?php 
        }
        ?>
                        <td>
                            <?php 
        if ($blogs && $statistics_item->blog_id != $blog_id) {
            ?>
                                <?php 
            echo $statistics_item->likes;
            ?>
                            <?php 
        } else {
            ?>
                                <a href="javascript:statisticsEdit('<?php 
            echo $entity_name;
            ?>
', '<?php 
            echo $statistics_item->post_id;
            ?>
', 'like', '<?php 
            echo get_option('likebtn_plan');
            ?>
', '<?php 
            _e('Enter new value:', LIKEBTN_I18N_DOMAIN);
            ?>
', '<?php 
            _e('Upgrade your website plan to the ULTRA plan to use the feature', LIKEBTN_I18N_DOMAIN);
            ?>
', '<?php 
            _e('Error occured. Please, try again later.', LIKEBTN_I18N_DOMAIN);
            ?>
');void(0);" title="<?php 
            _e('Click to change', LIKEBTN_I18N_DOMAIN);
            ?>
" class="item_like likebtn_ttip"><?php 
            echo $statistics_item->likes;
            ?>
</a>
                            <?php 
        }
        ?>
                        </td>
                        <td>
                            <?php 
        if ($blogs && $statistics_item->blog_id != $blog_id) {
            ?>
                                <?php 
            echo $statistics_item->dislikes;
            ?>
                            <?php 
        } else {
            ?>
                                <a href="javascript:statisticsEdit('<?php 
            echo $entity_name;
            ?>
', '<?php 
            echo $statistics_item->post_id;
            ?>
', 'dislike', '<?php 
            echo get_option('likebtn_plan');
            ?>
', '<?php 
            _e('Enter new value:', LIKEBTN_I18N_DOMAIN);
            ?>
', '<?php 
            _e('Upgrade your website plan to the ULTRA plan to use the feature', LIKEBTN_I18N_DOMAIN);
            ?>
', '<?php 
            _e('Error occured. Please, try again later.', LIKEBTN_I18N_DOMAIN);
            ?>
');void(0);" title="<?php 
            _e('Click to change', LIKEBTN_I18N_DOMAIN);
            ?>
" class="item_dislike likebtn_ttip"><?php 
            echo $statistics_item->dislikes;
            ?>
</a>
                            <?php 
        }
        ?>
                        </td>
                        <td><?php 
        echo $statistics_item->likes_minus_dislikes;
        ?>
</td>
                    </tr>
                <?php 
    }
    ?>
            </tbody>
        </table>
        </form>
        <?php 
    if (count($statistics) && $p->total_pages > 0) {
        ?>
            <div class="tablenav">
                <div class="tablenav-pages">
                    <?php 
        echo $p->show();
        ?>
                </div>
            </div>
        <?php 
    }
    ?>

    </div>

    <?php 
    _likebtn_admin_footer();
}