当前位置: 首页>>代码示例>>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;未经允许,请勿转载。