/*
カスタム CSS 機能へようこそ。

使い方についてはこちらをご覧ください
(英語ドキュメンテーション)。http://wp.me/PEmnE-Bt
*/
.top-widget ul {
	float: right;
}

#menu-item-285 {
	background-color: #f98444;
}

textarea[name='olb_course'] {
    width: 75%;
    min-height: 12em;
}$administrator, \'subscriber\'=>$subscriber, \'author\'=>$author, \'editor\'=>$editor, \'contributor\'=>$contributor);
    $roles = array();
    $searches = array();

    foreach($rolelist as $key=>$value)
    {
        if($value == \'yes\'){
            array_push($roles, $key);
        }
    }

    if (empty($roles)){
        $roles = array(\'administrator\', \'subscriber\', \'author\', \'editor\', \'contributor\');
    }

    
    foreach ( $roles as $role ){
        $searches[] = "$wpdb->usermeta.meta_key = \'{$wpdb->prefix}capabilities\' AND $wpdb->usermeta.meta_value LIKE \'%$role%\'";
    }
    
    //create a string for use in a MySQL statement
    $meta_values = implode(\' OR \', $searches);

    return $meta_values;
}

function display_user_list() {
    global $wpdb;
    $onPage = get_query_var(\'page\');
    $limit = get_option(\'wpu_users_per\');
    $adjacents = get_option(\'wpu_pagination_adjacents\');
    
    
    //get all user roles to be shown
    $meta_values = wpu_get_roles();
    
    //how many rows we have in database
    $totalitems = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users WHERE ID = ANY (SELECT user_id FROM $wpdb->usermeta WHERE $meta_values)");
    $totalPages = ceil($totalitems / $limit);
    
    //if the user tryes to manipulate qury, set min and max..
    if(!$onPage || $onPage  $totalPages){
        $onPage = $totalPages;
    }
    
    
    //counting the offset
    $offset = ($onPage - 1) * $limit;

    //get the authors from the database ordered by user nicename
    $query = "SELECT $wpdb->users.ID, $wpdb->users.user_nicename FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $meta_values ORDER BY $wpdb->users.user_nicename LIMIT $offset, $limit";
    $author_ids = $wpdb->get_results($query);
    
    $userIdAsName = get_option(\'wpu_user_id_as_name\');
    //loop through each author
    foreach($author_ids as $author) {
        // Get user data
        $curauth = get_userdata($author->ID);
        $html .= get_user_listing($curauth, $userIdAsName);
    }

    //pagination string
    $html .= getPaginationString($totalitems, $limit, $onPage, $adjacents);
    
    echo $html;
}

function get_user_listing($curauth, $userIdAsName) {  
    global $post;
    $concat = wpu_concat();
    $link = get_permalink($post->ID) . $concat . "uid=";
    $link .= $userIdAsName == \'yes\' ? $curauth->display_name : $curauth->ID;
    
    $html = "n";
    
    //image
    if (get_option(\'wpu_image_list\')) {
        //avatar
        if(get_option(\'wpu_avatars\') == "gravatars") {
            $gravatar_type = get_option(\'wpu_gravatar_type\');
            $gravatar_size = get_option(\'wpu_gravatar_size\');
            $display_gravatar = get_avatar($curauth->user_email, $gravatar_size, $gravatar_type);
            $html .= "display_name">$display_gravatarn";
      
        //user photo
        }elseif (get_option(\'wpu_avatars\') == "userphoto" && function_exists(\'userphoto_the_author_photo\')) {
            $html .= "display_name">" . userphoto__get_userphoto($curauth->ID, USERPHOTO_THUMBNAIL_SIZE, "", "", array(), "") . "n";
        }
    }
    
    //name
    $html .= "display_name">$curauth->display_namen";
    
    //description
    if (get_option(\'wpu_description_list\')) {
        $description = $curauth->description;
        if ($description) {
            if (get_option(\'wpu_description_limit\')) {
                $desc_limit = get_option(\'wpu_description_limit\');
                $description = substr($description, 0, $desc_limit) . "...";
            } 

            $description = preg_replace(\'/n/\', \'\', $description);
            $html .=  "" . $description . "n";
        }
    }
    
    //edit profile link
    if (get_current_user_id() == $curauth->ID) {
        $html .= "".__("Edit profile", "user-list"). "";
    }
    
    $html .= "";
    return $html;
}

function get_userid_by_display_name($display_name){
    global $wpdb;
    
    $query = $wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users  WHERE $wpdb->users.display_name = \'%s\' LIMIT 1", $display_name);
    return $wpdb->get_var($query);
}

function get_userid(){
    if (isset($_GET[\'uid\'])) {
        $uid = $_GET[\'uid\'];
        
        $userIdAsName = get_option(\'wpu_user_id_as_name\');
        if($userIdAsName == \'yes\'){ 
            $uid = get_userid_by_display_name($uid); 
        }
        return  $uid;
    }
}

function display_user() {  
    global $post;

    if (isset($_GET[\'uid\'])) {
        $uid = get_userid();
        $curauth = get_userdata($uid);
    }

    if (!$curauth) {
        return;
    }
    
    $recent_posts = get_posts( array( \'numberposts\' => 10, \'author\' => $curauth->ID ) );
    $recent_comments = wpu_recent_comments($uid);
    $created = date("F jS, Y", strtotime($curauth->user_registered));

    $html = "ID) . ">« ".__(" ", "user-list")." ". get_the_title($post->ID) . " ". __("にもどる", "user-list") ."n";

    $html .= "$curauth->display_namen";

    if (get_option(\'wpu_image_profile\')) {
        if(get_option(\'wpu_avatars\') == "gravatars") {
            $html .= "" . get_avatar($curauth->user_email, \'96\', $gravatar) . "n";
        } elseif (get_option(\'wpu_avatars\') == "userphoto" && function_exists(\'userphoto_the_author_photo\')) {
            $html .= "" . userphoto__get_userphoto($curauth->ID, USERPHOTO_FULL_SIZE, "", "", array(), "") . "n";
        }
    }


    $html .= "".__("YEAH MATH!の指導をはじめた日", "user-list").":  " . $created . "";

    if (get_option(\'wpu_description_profile\')) {
        $description = $curauth->description;
        if ($curauth->description) {
            $description = preg_replace(\'/n/\', \'\', $description);
            $html .= "".__("プロフィール", "user-list").":n";
            $html .= "$descriptionn";
        }
    }

    if(get_option(\'wpu_user_files\') == \'yes\'){
        $html .= get_user_files($uid);
    }	


    if ($curauth->user_url && $curauth->user_url != "http://") {
        $html .= "".__("このチューターのレッスンを予約する", "user-list").": user_url" rel="nofollow">$curauth->user_urln";
    }


    if ($recent_posts) {
        $html .= "".__("Recent Posts by", "user-list")." $curauth->display_namen";
        $html .= "n";
        foreach( $recent_posts as $post )
        {
            setup_postdata($post);
            $html .= "ID) . ">" . $post->post_title . "";
        }
        $html .= "n";
    }

    wp_reset_query();

    if ($recent_comments) {
        $html .= "".__("Recent Comments by", "user-list")." $curauth->display_namen";
        $html .= "n";
        foreach($recent_comments as $key=>$comment)
        {
            $html .= """ . $comment->comment_content . "" ".__("on", "user-list")." comment_post_ID) . "#comment-" . $comment->comment_ID . ">" . get_the_title($comment->comment_post_ID) . "";
        }
        $html .= "n";
    }

    if (get_current_user_id() == $uid) {
        $html .= "".__("Edit profile", "user-list"). "";
    }
  
    echo "" . $html . "";
    
}															

function get_user_files(){
    $html = \'\';
    $upload_dir = wp_upload_dir();
    $user_id = func_get_arg(0);

    if(!$user_id){
       $user_id = get_userid();
    }

    if($user_id == 0){
        return;
    }


    $handle = @opendir($upload_dir[\'basedir\'].\'/file_uploads/\'.$user_id);
    if(!$handle){
      return;
    }
    
    $html .= "".__("Files", "user-list")."n";

    while (false !== ($file = readdir($handle))) {
        if ($file!= "." && $file != "..") {
            $filename = pathinfo($file, PATHINFO_FILENAME);
            $ext = pathinfo($file, PATHINFO_EXTENSION); 
            $dLink = \'/wp-content/uploads/file_uploads/\'.$user_id .\'/\'. $file;

            $html .= \' \'. $filename .\'\';	
        }
    }

    return $html;
}																

function wpu_recent_comments($uid){
    global $wpdb;

    $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_post_ID, SUBSTRING(comment_content, 1, 150) AS comment_content
    FROM $wpdb->comments
    WHERE user_id = %s
    ORDER BY comment_ID DESC
    LIMIT 10
    ", $uid));

    return $comments;
}


function noindex_users() {
    if(is_page(get_option(\'wpu_page_id\')) && get_option(\'wpu_noindex_users\') == \'yes\') {
        echo \'\';
    }
}

function wpu_styles() {
    if(is_page(get_option(\'wpu_page_id\'))) {
        echo \'\';
    }
}


function wpu_admin_menu() {  
    add_options_page(\'User List\', \'User List\', \'manage_options\', __FILE__, \'wpu_admin\');
}

function wpu_admin() {
    if($_POST[\'Submit\'] != \'\'){
        //Form data sent
        $pageid = $_POST[\'wpu_page_id\'];
        update_option(\'wpu_page_id\', $pageid);

        $usersperpage = $_POST[\'wpu_users_per\'];
        update_option(\'wpu_users_per\', $usersperpage);

        $avatars = $_POST[\'wpu_avatars\'];
        update_option(\'wpu_avatars\', $avatars);

        $gravatar_type = $_POST[\'wpu_gravatar_type\'];
        update_option(\'wpu_gravatar_type\', $gravatar_type);

        $gravatar_size = $_POST[\'wpu_gravatar_size\'];
        update_option(\'wpu_gravatar_size\', $gravatar_size);

        $noindex_users = $_POST[\'wpu_noindex_users\'];
        update_option(\'wpu_noindex_users\', $noindex_users);

        $roles_admin = $_POST[\'wpu_roles_admin\'];
        update_option(\'wpu_roles_admin\', $roles_admin);

        $roles_editor = $_POST[\'wpu_roles_editor\'];
        update_option(\'wpu_roles_editor\', $roles_editor);

        $roles_author = $_POST[\'wpu_roles_author\'];
        update_option(\'wpu_roles_author\', $roles_author);

        $roles_contributor = $_POST[\'wpu_roles_contributor\'];
        update_option(\'wpu_roles_contributor\', $roles_contributor);

        $roles_subscriber = $_POST[\'wpu_roles_subscriber\'];
        update_option(\'wpu_roles_subscriber\', $roles_subscriber);

        $image_list = $_POST[\'wpu_image_list\'];
        update_option(\'wpu_image_list\', $image_list);

        $description_list = $_POST[\'wpu_description_list\'];
        update_option(\'wpu_description_list\', $description_list);

        $image_profile = $_POST[\'wpu_image_profile\'];
        update_option(\'wpu_image_profile\', $image_profile);

        $description_profile = $_POST[\'wpu_description_profile\'];
        update_option(\'wpu_description_profile\', $description_profile);

        $desc_limit = $_POST[\'wpu_description_limit\'];
        update_option(\'wpu_description_limit\', $desc_limit);

        $user_files = $_POST[\'wpu_user_files\'];
        update_option(\'wpu_user_files\', $user_files); 
        
        $adjacents = $_POST[\'wpu_pagination_adjacents\'];
        update_option(\'wpu_pagination_adjacents\', $adjacents);
        
        $useridbyname = $_POST[\'wpu_user_id_as_name\'];
        update_option(\'wpu_user_id_as_name\', $useridbyname);
        
        ?>  
        
        
    
        
    
        






    : 
     


    : 
     


    : 
     


    : 
     


    
    


     


    


    
     


     
     


     


    :


    : 
      


    : 
     







    
        
        :
    


      


      


      


      


      


     


    


      


      


     


      


      


      


     


      


    
        : 
    







 1){
        $html .= "« ".__("prev", "user-list") ."";
    }else{
        $html .= "« ".__("prev", "user-list")."";
    }

    
    //pagination
    $startAt = max(1, min($totalPages - $adjacents, $onPage - ceil($adjacents / 2)));
    $endAt = $onPage + ceil($adjacents / 2);
    
    if($endAt > $totalPages){ $endAt = $totalPages; }
    
    //add the first page and dots after ...
    if($startAt != 1){
        $html .= "1...";
    }
    
    //add all the remaining pages, pagination
    for($i = $startAt; $i <= $endAt; $i++){
        //if we are on the current page, add the css class
        $currentCssClass = $i == $onPage ? " class="wpu-current"" : "";
        $html .= "".$i."";
    }
    
    //add the last page and dots before ...
    if($endAt != $totalPages){
        $html .= "...".$totalPages."";
    }
    
    //next button
    if($onPage $administrator, \'subscriber\'=>$subscriber, \'author\'=>$author, \'editor\'=>$editor, \'contributor\'=>$contributor);
    $roles = array();
    $searches = array();

    foreach($rolelist as $key=>$value)
    {
        if($value == \'yes\'){
            array_push($roles, $key);
        }
    }

    if (empty($roles)){
        $roles = array(\'administrator\', \'subscriber\', \'author\', \'editor\', \'contributor\');
    }

    
    foreach ( $roles as $role ){
        $searches[] = "$wpdb->usermeta.meta_key = \'{$wpdb->prefix}capabilities\' AND $wpdb->usermeta.meta_value LIKE \'%$role%\'";
    }
    
    //create a string for use in a MySQL statement
    $meta_values = implode(\' OR \', $searches);

    return $meta_values;
}

function display_user_list() {
    global $wpdb;
    $onPage = get_query_var(\'page\');
    $limit = get_option(\'wpu_users_per\');
    $adjacents = get_option(\'wpu_pagination_adjacents\');
    
    
    //get all user roles to be shown
    $meta_values = wpu_get_roles();
    
    //how many rows we have in database
    $totalitems = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users WHERE ID = ANY (SELECT user_id FROM $wpdb->usermeta WHERE $meta_values)");
    $totalPages = ceil($totalitems / $limit);
    
    //if the user tryes to manipulate qury, set min and max..
    if(!$onPage || $onPage  $totalPages){
        $onPage = $totalPages;
    }
    
    
    //counting the offset
    $offset = ($onPage - 1) * $limit;

    //get the authors from the database ordered by user nicename
    $query = "SELECT $wpdb->users.ID, $wpdb->users.user_nicename FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $meta_values ORDER BY $wpdb->users.user_nicename LIMIT $offset, $limit";
    $author_ids = $wpdb->get_results($query);
    
    $userIdAsName = get_option(\'wpu_user_id_as_name\');
    //loop through each author
    foreach($author_ids as $author) {
        // Get user data
        $curauth = get_userdata($author->ID);
        $html .= get_user_listing($curauth, $userIdAsName);
    }

    //pagination string
    $html .= getPaginationString($totalitems, $limit, $onPage, $adjacents);
    
    echo $html;
}

function get_user_listing($curauth, $userIdAsName) {  
    global $post;
    $concat = wpu_concat();
    $link = get_permalink($post->ID) . $concat . "uid=";
    $link .= $userIdAsName == \'yes\' ? $curauth->display_name : $curauth->ID;
    
    $html = "n";
    
    //image
    if (get_option(\'wpu_image_list\')) {
        //avatar
        if(get_option(\'wpu_avatars\') == "gravatars") {
            $gravatar_type = get_option(\'wpu_gravatar_type\');
            $gravatar_size = get_option(\'wpu_gravatar_size\');
            $display_gravatar = get_avatar($curauth->user_email, $gravatar_size, $gravatar_type);
            $html .= "display_name">$display_gravatarn";
      
        //user photo
        }elseif (get_option(\'wpu_avatars\') == "userphoto" && function_exists(\'userphoto_the_author_photo\')) {
            $html .= "display_name">" . userphoto__get_userphoto($curauth->ID, USERPHOTO_THUMBNAIL_SIZE, "", "", array(), "") . "n";
        }
    }
    
    //name
    $html .= "display_name">$curauth->display_namen";
    
    //description
    if (get_option(\'wpu_description_list\')) {
        $description = $curauth->description;
        if ($description) {
            if (get_option(\'wpu_description_limit\')) {
                $desc_limit = get_option(\'wpu_description_limit\');
                $description = substr($description, 0, $desc_limit) . "...";
            } 

            $description = preg_replace(\'/n/\', \'\', $description);
            $html .=  "" . $description . "n";
        }
    }
    
    //edit profile link
    if (get_current_user_id() == $curauth->ID) {
        $html .= "".__("Edit profile", "user-list"). "";
    }
    
    $html .= "";
    return $html;
}

function get_userid_by_display_name($display_name){
    global $wpdb;
    
    $query = $wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users  WHERE $wpdb->users.display_name = \'%s\' LIMIT 1", $display_name);
    return $wpdb->get_var($query);
}

function get_userid(){
    if (isset($_GET[\'uid\'])) {
        $uid = $_GET[\'uid\'];
        
        $userIdAsName = get_option(\'wpu_user_id_as_name\');
        if($userIdAsName == \'yes\'){ 
            $uid = get_userid_by_display_name($uid); 
        }
        return  $uid;
    }
}

function display_user() {  
    global $post;

    if (isset($_GET[\'uid\'])) {
        $uid = get_userid();
        $curauth = get_userdata($uid);
    }

    if (!$curauth) {
        return;
    }
    
    $recent_posts = get_posts( array( \'numberposts\' => 10, \'author\' => $curauth->ID ) );
    $recent_comments = wpu_recent_comments($uid);
    $created = date("F jS, Y", strtotime($curauth->user_registered));

    $html = "ID) . ">« ".__(" ", "user-list")." ". get_the_title($post->ID) . " ". __("にもどる", "user-list") ."n";

    $html .= "$curauth->display_namen";

    if (get_option(\'wpu_image_profile\')) {
        if(get_option(\'wpu_avatars\') == "gravatars") {
            $html .= "" . get_avatar($curauth->user_email, \'96\', $gravatar) . "n";
        } elseif (get_option(\'wpu_avatars\') == "userphoto" && function_exists(\'userphoto_the_author_photo\')) {
            $html .= "" . userphoto__get_userphoto($curauth->ID, USERPHOTO_FULL_SIZE, "", "", array(), "") . "n";
        }
    }


    $html .= "".__("YEAH MATH!の指導をはじめた日", "user-list").":  " . $created . "";

    if (get_option(\'wpu_description_profile\')) {
        $description = $curauth->description;
        if ($curauth->description) {
            $description = preg_replace(\'/n/\', \'\', $description);
            $html .= "".__("プロフィール", "user-list").":n";
            $html .= "$descriptionn";
        }
    }

    if(get_option(\'wpu_user_files\') == \'yes\'){
        $html .= get_user_files($uid);
    }	


    if ($curauth->user_url && $curauth->user_url != "http://") {
        $html .= "".__("このチューターのレッスンを予約する", "user-list").": user_url" rel="nofollow">$curauth->user_urln";
    }


    if ($recent_posts) {
        $html .= "".__("Recent Posts by", "user-list")." $curauth->display_namen";
        $html .= "n";
        foreach( $recent_posts as $post )
        {
            setup_postdata($post);
            $html .= "ID) . ">" . $post->post_title . "";
        }
        $html .= "n";
    }

    wp_reset_query();

    if ($recent_comments) {
        $html .= "".__("Recent Comments by", "user-list")." $curauth->display_namen";
        $html .= "n";
        foreach($recent_comments as $key=>$comment)
        {
            $html .= """ . $comment->comment_content . "" ".__("on", "user-list")." comment_post_ID) . "#comment-" . $comment->comment_ID . ">" . get_the_title($comment->comment_post_ID) . "";
        }
        $html .= "n";
    }

    if (get_current_user_id() == $uid) {
        $html .= "".__("Edit profile", "user-list"). "";
    }
  
    echo "" . $html . "";
    
}															

function get_user_files(){
    $html = \'\';
    $upload_dir = wp_upload_dir();
    $user_id = func_get_arg(0);

    if(!$user_id){
       $user_id = get_userid();
    }

    if($user_id == 0){
        return;
    }


    $handle = @opendir($upload_dir[\'basedir\'].\'/file_uploads/\'.$user_id);
    if(!$handle){
      return;
    }
    
    $html .= "".__("Files", "user-list")."n";

    while (false !== ($file = readdir($handle))) {
        if ($file!= "." && $file != "..") {
            $filename = pathinfo($file, PATHINFO_FILENAME);
            $ext = pathinfo($file, PATHINFO_EXTENSION); 
            $dLink = \'/wp-content/uploads/file_uploads/\'.$user_id .\'/\'. $file;

            $html .= \' \'. $filename .\'\';	
        }
    }

    return $html;
}																

function wpu_recent_comments($uid){
    global $wpdb;

    $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_post_ID, SUBSTRING(comment_content, 1, 150) AS comment_content
    FROM $wpdb->comments
    WHERE user_id = %s
    ORDER BY comment_ID DESC
    LIMIT 10
    ", $uid));

    return $comments;
}


function noindex_users() {
    if(is_page(get_option(\'wpu_page_id\')) && get_option(\'wpu_noindex_users\') == \'yes\') {
        echo \'\';
    }
}

function wpu_styles() {
    if(is_page(get_option(\'wpu_page_id\'))) {
        echo \'\';
    }
}


function wpu_admin_menu() {  
    add_options_page(\'User List\', \'User List\', \'manage_options\', __FILE__, \'wpu_admin\');
}

function wpu_admin() {
    if($_POST[\'Submit\'] != \'\'){
        //Form data sent
        $pageid = $_POST[\'wpu_page_id\'];
        update_option(\'wpu_page_id\', $pageid);

        $usersperpage = $_POST[\'wpu_users_per\'];
        update_option(\'wpu_users_per\', $usersperpage);

        $avatars = $_POST[\'wpu_avatars\'];
        update_option(\'wpu_avatars\', $avatars);

        $gravatar_type = $_POST[\'wpu_gravatar_type\'];
        update_option(\'wpu_gravatar_type\', $gravatar_type);

        $gravatar_size = $_POST[\'wpu_gravatar_size\'];
        update_option(\'wpu_gravatar_size\', $gravatar_size);

        $noindex_users = $_POST[\'wpu_noindex_users\'];
        update_option(\'wpu_noindex_users\', $noindex_users);

        $roles_admin = $_POST[\'wpu_roles_admin\'];
        update_option(\'wpu_roles_admin\', $roles_admin);

        $roles_editor = $_POST[\'wpu_roles_editor\'];
        update_option(\'wpu_roles_editor\', $roles_editor);

        $roles_author = $_POST[\'wpu_roles_author\'];
        update_option(\'wpu_roles_author\', $roles_author);

        $roles_contributor = $_POST[\'wpu_roles_contributor\'];
        update_option(\'wpu_roles_contributor\', $roles_contributor);

        $roles_subscriber = $_POST[\'wpu_roles_subscriber\'];
        update_option(\'wpu_roles_subscriber\', $roles_subscriber);

        $image_list = $_POST[\'wpu_image_list\'];
        update_option(\'wpu_image_list\', $image_list);

        $description_list = $_POST[\'wpu_description_list\'];
        update_option(\'wpu_description_list\', $description_list);

        $image_profile = $_POST[\'wpu_image_profile\'];
        update_option(\'wpu_image_profile\', $image_profile);

        $description_profile = $_POST[\'wpu_description_profile\'];
        update_option(\'wpu_description_profile\', $description_profile);

        $desc_limit = $_POST[\'wpu_description_limit\'];
        update_option(\'wpu_description_limit\', $desc_limit);

        $user_files = $_POST[\'wpu_user_files\'];
        update_option(\'wpu_user_files\', $user_files); 
        
        $adjacents = $_POST[\'wpu_pagination_adjacents\'];
        update_option(\'wpu_pagination_adjacents\', $adjacents);
        
        $useridbyname = $_POST[\'wpu_user_id_as_name\'];
        update_option(\'wpu_user_id_as_name\', $useridbyname);
        
        ?>  
        
        
    
        
    
        






    : 
     


    : 
     


    : 
     


    : 
     


    
    


     


    


    
     


     
     


     


    :


    : 
      


    : 
     







    
        
        :
    


      


      


      


      


      


     


    


      


      


     


      


      


      


     


      


    
        : 
    







 1){
        $html .= "« ".__("prev", "user-list") ."";
    }else{
        $html .= "« ".__("prev", "user-list")."";
    }

    
    //pagination
    $startAt = max(1, min($totalPages - $adjacents, $onPage - ceil($adjacents / 2)));
    $endAt = $onPage + ceil($adjacents / 2);
    
    if($endAt > $totalPages){ $endAt = $totalPages; }
    
    //add the first page and dots after ...
    if($startAt != 1){
        $html .= "1...";
    }
    
    //add all the remaining pages, pagination
    for($i = $startAt; $i <= $endAt; $i++){
        //if we are on the current page, add the css class
        $currentCssClass = $i == $onPage ? " class="wpu-current"" : "";
        $html .= "".$i."";
    }
    
    //add the last page and dots before ...
    if($endAt != $totalPages){
        $html .= "...".$totalPages."";
    }
    
    //next button
    if($onPage 111111111111111111111111111111111111111111