當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserList::use_list_template方法代碼示例

本文整理匯總了PHP中UserList::use_list_template方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::use_list_template方法的具體用法?PHP UserList::use_list_template怎麽用?PHP UserList::use_list_template使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserList的用法示例。


在下文中一共展示了UserList::use_list_template方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: explode


//.........這裏部分代碼省略.........
         }
         echo "/> " . __('No', 'subscribe2');
         echo "</label></p>";
     }
     // submit
     echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"submit\" value=\"" . __("Update Preferences", 'subscribe2') . " &raquo;\" /></p>";
     echo "</form>\r\n";
     // list of subscribed blogs on wordpress mu
     if ($this->s2_mu) {
         global $blog_id;
         $blogs = get_blog_list(0, 'all');
         $blogs_subscribed = array();
         $blogs_notsubscribed = array();
         foreach ($blogs as $key => $blog) {
             // switch to blog
             switch_to_blog($blog['blog_id']);
             // check that the plugin is active on the current blog
             $current_plugins = get_option('active_plugins');
             if (!is_array($current_plugins)) {
                 $current_plugins = (array) $current_plugins;
             }
             if (!in_array('subscribe2/subscribe2.php', $current_plugins)) {
                 continue;
             }
             // check if we're subscribed to the blog
             $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
             $blogname = get_bloginfo('name');
             if (strlen($blogname) > 30) {
                 $blog['blogname'] = wp_html_excerpt($blogname, 30) . "..";
             } else {
                 $blog['blogname'] = $blogname;
             }
             $blog['description'] = get_bloginfo('description');
             if (defined('AUTHOR_AVATARS_VERSION')) {
                 if (!class_exists('UserList')) {
                     include_once ABSPATH . 'wp-content/plugins/author-avatars/lib/UserList.class.php';
                 }
                 $userlist = new UserList();
                 $userlist->roles = array('Administrator', 'Editor', 'Subscriber');
                 $userlist->blogs = array($blog['blog_id']);
                 $userlist->avatar_size = 30;
                 $userlist->use_list_template();
                 $blog['users'] = $userlist->get_output();
             }
             $blog['blogurl'] = get_bloginfo('url');
             $blog['subscribe_page'] = get_bloginfo('url') . "/wp-admin/users.php?page=subscribe2/subscribe2.php";
             $key = strtolower($blog['blogname'] . "-" . $blog['blog_id']);
             if (!empty($subscribed)) {
                 $blogs_subscribed[$key] = $blog;
             } else {
                 $blogs_notsubscribed[$key] = $blog;
             }
             restore_current_blog();
         }
         if (!empty($blogs_subscribed)) {
             ksort($blogs_subscribed);
             echo '<h2>' . __('Subscribed Blogs', 'subscribe2') . '</h2>' . "\r\n";
             echo "<ul class=\"s2_blogs\">\r\n";
             foreach ($blogs_subscribed as $blog) {
                 echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\" title=\"" . $blog['description'] . "\">" . $blog['blogname'] . "</a></span>\r\n";
                 if ($blog_id == $blog['blog_id']) {
                     echo "<span class=\"buttons\">" . __('Viewing Settings Now', 'subscribe2') . "</span>\r\n";
                 } else {
                     echo "<span class=\"buttons\">";
                     if (is_blog_user($blog['blog_id'])) {
                         echo "<a href=\"" . $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
                     }
                     echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_unsubscribe=" . $blog['blog_id'] . "\">" . __('Unsubscribe', 'subscribe2') . "</a></span>\r\n";
                 }
                 echo "<div class=\"additional_info\"><span class=\"description\">" . $blog['description'] . "</span>" . $blog['users'] . "</div>\r\n";
                 echo "</li>";
             }
             echo "</ul>\r\n";
         }
         if (!empty($blogs_notsubscribed)) {
             ksort($blogs_notsubscribed);
             echo "<h2>" . __('Subscribe to new blogs', 'subscribe2') . "</h2>\r\n";
             echo "<ul class=\"s2_blogs\">";
             foreach ($blogs_notsubscribed as $blog) {
                 echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\" title=\"" . $blog['description'] . "\">" . $blog['blogname'] . "</a></span>\r\n";
                 if ($blog_id == $blog['blog_id']) {
                     echo "<span class=\"buttons\">" . __('Viewing Settings Now', 'subscribe2') . "</span>\r\n";
                 } else {
                     echo "<span class=\"buttons\">";
                     if (is_blog_user($blog['blog_id'])) {
                         echo "<a href=\"" . $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
                     }
                     echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_subscribe=" . $blog['blog_id'] . "\">" . __('Subscribe', 'subscribe2') . "</a></span>\r\n";
                 }
                 echo "<div class=\"additional_info\"><span class=\"description\">" . $blog['description'] . "</span>" . $blog['users'] . "</div>\r\n";
                 echo "</li>";
             }
             echo "</ul>\r\n";
         }
     }
     echo "</div>\r\n";
     include ABSPATH . 'wp-admin/admin-footer.php';
     // just to be sure
     die;
 }
開發者ID:CarterNelms,項目名稱:www.engineeredcomfort.net,代碼行數:101,代碼來源:subscribe2.php


注:本文中的UserList::use_list_template方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。