Пример #1
0
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $top = cp_getAllPoints($instance['num'], get_option('cp_topfilter'));
     do_action('cp_topUsersWidget_before');
     echo apply_filters('cp_topUsersWidget_before', '<ul>');
     $line = apply_filters('cp_topUsersWidget_line', '<li class="cp_topUsersWidget top_%place%" style="%style%">%string%</li>');
     $line = str_replace('%style%', $instance['style'], $line);
     foreach ($top as $x => $y) {
         $user = get_userdata($y['id']);
         $string = str_replace('%string%', '', $instance['text']);
         $string = str_replace('%string%', $string, $line);
         $string = apply_filters('cp_displayUserInfo', $string, $y, $x + 1);
         echo $string;
     }
     echo apply_filters('cp_topUsersWidget_after', '</ul>');
     do_action('cp_topUsersWidget_after');
     echo $after_widget;
 }
Пример #2
0
$squares .= '<br>' . $rank_txt . '</div>';
echo '<div class="hwprofile-avatar" title="' . $tooltip . '">' . $avatar . $squares . '</div>';
echo '<div class="hwprofile-karma">Karma: <br><div class="hwprofile-karma-num">' . $karma . '</div></div>';
if ($displayname != "") {
    echo '<div id="subscribe-reloaded-displayname">' . __('<strong>' . $txt_subscr_name . '</strong>', 'subscribe-reloaded') . ': ' . $displayname . '</div>';
}
if ($show_email_address) {
    echo '<div id="subscribe-reloaded-email-p">' . __('<strong>Email</strong>', 'subscribe-reloaded') . ': ' . $email . '</div>';
}
if ($public_user_ID != 0) {
    echo '<div id="subscribe-reloaded-email-p">' . $txt_subscr_regdate . ': ' . $regdate . '</div>';
}
echo '<div id="subscribe-reloaded-email-p">' . $txt_subscr_language . ': ' . $user_language_flag . '</div>';
//Rank+Title info
if (function_exists('cp_getAllPoints')) {
    $allpoints = cp_getAllPoints(0, array("admin", "test"), 0);
}
$sumpoints = 0;
$highestpoints = 0;
foreach ($allpoints as $allpoint) {
    if ($allpoint['points'] > $highestpoints) {
        $highestpoints = $allpoint['points'];
    }
    $sumpoints += $allpoint['points'];
    /*
    $i++;
    print "<br> $i: ";
    print_r($allpoint);
    print "<br>".$allpoint['points'];
    //print "PTS: ". $allpoint => 'points';
    */
Пример #3
0
function cp_shortcode_top($atts)
{
    $num = (int) $atts['num'];
    if ($num < 1) {
        $num = 1;
    }
    $top = cp_getAllPoints($num, get_option('cp_topfilter'));
    if ($atts['class'] != '') {
        $class = ' class="' . $atts['class'] . '"';
    }
    if ($atts['style'] != '') {
        $style = ' style="' . $atts['style'] . '"';
    }
    switch ($atts['display']) {
        case 'custom':
            if ($atts['custom'] == null) {
                $atts['custom'] = '%user% (%points%)';
            }
            foreach ($top as $x => $i) {
                $text = apply_filters('cp_displayUserInfo', $atts['custom'], $i, $x + 1);
                $c .= $text;
            }
            break;
        case 'ol':
            $c = '<ol' . $class . $style . '>';
            if ($atts['custom'] == null) {
                $atts['custom'] = '<li>%user% (%points%)</li>';
            }
            foreach ($top as $x => $i) {
                $text = apply_filters('cp_displayUserInfo', $atts['custom'], $i, $x + 1);
                $c .= $text;
            }
            $c .= '</ol>';
            break;
        case 'table':
            $c = '<table' . $class . $style . '>';
            if ($atts['custom'] == null) {
                $atts['custom'] = '<tr><td>%user%</td><td>%points%</td></tr>';
            }
            foreach ($top as $x => $i) {
                $text = apply_filters('cp_displayUserInfo', $atts['custom'], $i, $x + 1);
                $c .= $text;
            }
            $c .= '</table>';
            break;
        default:
            $c = '<ul' . $class . $style . '>';
            if ($atts['custom'] == null) {
                $atts['custom'] = '<li>%user% (%points%)</li>';
            }
            foreach ($top as $x => $i) {
                $text = apply_filters('cp_displayUserInfo', $atts['custom'], $i, $x + 1);
                $c .= $text;
            }
            $c .= '</ul>';
            break;
    }
    return $c;
}