<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12905] trunk/wp-admin/my-sites.php: Move 'My Blogs' into its own file.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12905">12905</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-29 23:21:33 +0000 (Fri, 29 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move 'My Blogs' into its own file. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmysitesphp">trunk/wp-admin/my-sites.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmysitesphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/my-sites.php (0 => 12905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/my-sites.php         (rev 0)
+++ trunk/wp-admin/my-sites.php        2010-01-29 23:21:33 UTC (rev 12905)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+<?php
+
+require_once('admin.php');
+
+if ( !is_multisite() )
+        wp_die( __('Multisite support is not enabled.') );
+
+if ( ! current_user_can('read') )
+        wp_die(__('You do not have sufficient permissions to view this page.'));
+
+$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
+
+$blogs = get_blogs_of_user( $current_user->id );
+
+if ( empty( $blogs ) )
+        wp_die( __( 'You must be a member of at least one site to use this page.' ) );
+
+$updated = false;
+if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
+        check_admin_referer('update-my-sites');
+        // @todo Validate primary blog.
+        update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
+        $updated = true;
+}
+
+$title = __('My Sites');
+$parent_file = 'index.php';
+require_once('admin-header.php');
+
+if ( $updated ) { ?>
+                <div id="message" class="updated fade"><p><strong><?php _e( 'Your site preferences have been updated.' ); ?></strong></p></div>
+<?php } ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo esc_html($title); ?></h2>
+<form id="myblogs" action="" method="post">
+        <?php
+        choose_primary_blog();
+        do_action( 'myblogs_allblogs_options' );
+        ?><table class='widefat'> <?php
+        $settings_html = apply_filters( 'myblogs_options', '', 'global' );
+        if ( $settings_html != '' ) {
+                echo "<tr><td valign='top'><h3>" . __( 'Global Settings' ) . "</h3></td><td>";
+                echo $settings_html;
+                echo "</td></tr>";
+        }
+        reset( $blogs );
+        $num = count( $blogs );
+        $cols = 1;
+        if ( $num >= 20 )
+                $cols = 4;
+        elseif ( $num >= 10 )
+                $cols = 2;
+        $num_rows = ceil($num/$cols);
+        $split = 0;
+        for ( $i = 1; $i <= $num_rows; $i++ ) {
+                $rows[] = array_slice( $blogs, $split, $cols );
+                $split = $split + $cols;
+        }
+
+        $c = '';
+        foreach ( $rows as $row ) {
+                $c = $c == "alternate" ? '' : 'alternate';
+                echo "<tr class='$c'>";
+                $t = '';
+                foreach ( $row as $user_blog ) {
+                        $t = $t == 'border-right: 1px solid #ccc;' ? '' : 'border-right: 1px solid #ccc;';
+                        echo "<td valign='top' style='$t; width:50%'>";
+                        echo "<h3>{$user_blog->blogname}</h3>";
+                        echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='{$user_blog->siteurl}'>" . __( 'Visit' ) . "</a> | <a href='{$user_blog->siteurl}/wp-admin/'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
+                        echo apply_filters( 'myblogs_options', '', $user_blog );
+                        echo "</td>";
+                }
+                echo "</tr>";
+        }?>
+        </table>
+        <input type="hidden" name="action" value="updateblogsettings" />
+        <?php wp_nonce_field('update-my-sites'); ?>
+        <p>
+         <input type="submit" class="button-primary" value="<?php _e('Update Options') ?>" name="submit" />
+        </p>
+        </form>
+        </div>
+<?php
+include('admin-footer.php');
+
+?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/my-sites.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre>
</div>
</div>
</body>
</html>