function kklike_admin_content() { global $wpdb, $kkLikeOptions; ?> <div class="kkadmin-box"> <div class="kkadmin-top"> <?php include 'head.php'; ?> </div> <div class="kkadmin-content"> <div class="kkadmin-text"> <div class="kkadmin-text-wew"> <?php $kkLikeSettings = get_option('kklikesettings'); if (empty($kkLikeSettings['like_text']) || $kkLikeSettings['like_text'] == null) { ?> <div class="kkpb-alert kkpb-alert-error"><?php echo __('<strong>Plugin is not configured. It may not work correctly.</strong> Go to settings, make your selection and save settings.', 'lang-kklike'); ?> </div> <?php } ?> <h2><?php echo __('The last ten activities', 'lang-kklike'); ?> :</h2> <div class="kklike-list-box"> <?php $db = new kkDataBase(); $dane = $db->getInformation('10'); if (!empty($dane)) { foreach ($dane as $row) { ?> <div class="kklike-list-box-element"> <div class="kklike-list-ico"></div> <div class="kklike-list-text"> At <strong><?php echo date('H:i', strtotime($row['date'])); ?> </strong> on <strong><?php echo date('d-m-Y', strtotime($row['date'])); ?> </strong>, user <strong><?php echo $row['user']; ?> </strong> liked article "<strong><?php echo $row['post_name']; ?> </strong>". <div class="kklike-ip">IP: <?php echo $row['ip']; ?> </div> </div> <div class="kkclear"></div> </div> <?php } } else { ?> <div class="kklike-list-box-element"> <div class="kklike-list-text"> <?php echo __('I\'m sorry, at this moment there is no data to display', 'lang-kklike'); ?> </div> <div class="kkclear"></div> </div> <?php } ?> </div> <div class="one-half"> <h2><?php echo __('Likes per day', 'lang-kklike'); ?> :</h2> <div class="kkadmin-chart-desc"> <?php echo __('The number of likes within last few days.', 'lang-kklike'); ?> </div> <?php require_once 'number-likes.php'; ?> </div> <div class="one-half-last"> <h2><?php echo __('Most liked', 'lang-kklike'); ?> :</h2> <div class="kkadmin-chart-desc"> <?php echo __('The most often liked aticles within last few days.', 'lang-kklike'); ?> </div> <?php require_once 'top-liked.php'; ?> </div> <div class="kkclear"></div> </div> </div> <div class="kkadmin-sidebar"> <?php include 'menu.inc.php'; ?> <?php include 'sidebar.php'; ?> </div> <div class="kkclear"></div> <div class="kklike-msg"> Hi, If you are interested in developing my plugin, you can help by providing me with a feedback on how it works for you. Suggestions or errors can be reported <a href="http://wordpress.org/support/plugin/kk-i-like-it" target="_blank">HERE</a>. I will be really grateful for any information. Best regards </div> </div> </div> <?php }
function widget($args, $instance) { // outputs the content of the widget if (is_user_logged_in()) { global $kkLikeSettings; $current_user = wp_get_current_user(); $i = 1; extract($args); $title = apply_filters('widget_title', $instance['title']); $items = esc_attr($instance['items']); $like = new kkDataBase(); $posts = $like->getInformation($items, $current_user->ID); echo $before_widget; echo $before_title; echo $title; echo $after_title; if ($posts) { echo '<ul class="kklike-widget kklike-most-liked">'; foreach ($posts as $post) { // if($i == '1'){ // $cls = 'kklike-big-heart'; // }else if($i == '2' || $i == '3'){ // $cls = 'kklike-small-heart'; // }else{ // $cls = 'kklike-big-heart'; // } $cls = 'kklike-big-heart'; ?> <li> <span class="<?php echo $cls; ?> "></span> <span class="kklike-wg-text"> <span class="kklike-wg-title"><a href="<?php echo get_permalink($post['ID']); ?> "><?php echo $post['post_name']; ?> </a></span> <span class="kklike-wg-rating"><?php echo __('Liked:', 'lang-kklike'); ?> <?php echo $post['liked']; ?> </span> <span class="kklike-wg-date"><?php echo __('Date:', 'lang-kklike'); ?> <?php echo date('d-m-Y', strtotime($post['date'])); ?> </span> </span> <span class="kkclear"></span> </li> <?php $i++; } echo '</ul>'; } else { echo '<div class="kklike-empty-list">' . __('Do not have favorite items.', 'lang-kklike') . '</div>'; } echo $after_widget; } }
function kklike_most_liked_widget_function() { ?> <div class="kklike-list-box"> <?php $db = new kkDataBase(); $dane = $db->getTopPosts('5'); $numberLikes = $db->getLikesNumber(); if (!empty($dane) && $numberLikes > 0) { $i = 1; foreach ($dane as $row) { $perc = floor($row->meta_value / $numberLikes * 100); ?> <div class="kklike-list-box-element kklike-stat"> <div class="kklike-list-text" style="width: 100%;"> <strong><span class=""><?php echo $i; ?> .</span> <a href="<?php echo get_permalink($row->ID); ?> " target="_blank"><?php echo $row->post_title; ?> </a></strong>. </div> <div class="kklike-likes"><?php echo $row->meta_value . ' ' . __('likes', 'lang-kklike'); ?> </div> <div class="kklike-stat-bg" style="width: <?php echo $perc; ?> %;"></div> <div class="kkclear"></div> </div> <?php $i++; } } else { ?> <div class="kklike-list-box-element"> <div class="kklike-list-text"> <?php echo __('I\'m sorry, at this moment there are no data to display', 'lang-kklike'); ?> </div> <div class="kkclear"></div> </div> <?php } ?> </div> <?php }