Changeset 787632
- Timestamp:
- 10/14/2013 02:37:31 PM (11 years ago)
- Location:
- dashboard/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
dashboard/trunk/css/activity.css
r787085 r787632 145 145 top: 0; 146 146 bottom: 0; 147 background: # 2ea2cc;147 background: #d54e21; 148 148 width: 4px; 149 149 } -
dashboard/trunk/dashboard-override.php
r787375 r787632 73 73 if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) 74 74 $help .= '<p>' . __( "<strong>Quick Draft</strong> - Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; 75 $help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="http://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>'; 75 if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) 76 $help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="http://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>'; 77 else 78 $help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="http://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>'; 76 79 if ( current_user_can( 'edit_theme_options' ) ) 77 80 $help .= '<p>' . __( '<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; -
dashboard/trunk/wpnews.php
r787085 r787632 10 10 */ 11 11 function add_wpnews_dashboard_widget() { 12 if ( is_blog_admin() )13 12 // Note it would be ideal to have this loaded by default in the right column 14 13 // Currently there is no way to set a $location arg in wp_add_dashboard_widget() … … 122 121 */ 123 122 function wp_widget_news_output( $rss, $args = array() ) { 124 123 125 124 // Regular RSS feeds 126 125 if ( isset( $args['type'] ) && 'plugins' != $args['type'] ) 127 126 return wp_widget_rss_output( $rss, $args ); 128 127 129 128 // Plugin feeds plus link to install them 130 $popular = fetch_feed( $args['url']['popular'] ); 131 $new = fetch_feed( $args['url']['new'] ); 132 133 if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { 134 $plugin_slugs = array_keys( get_plugins() ); 135 set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); 136 } 137 138 echo '<ul>'; 139 140 foreach ( array( 141 'popular' => __( 'Popular Plugin' ), 142 'new' => __( 'Newest Plugin' ) 143 ) as $feed => $label ) { 144 if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) 145 continue; 146 147 $items = $$feed->get_items(0, 5); 148 149 // Pick a random, non-installed plugin 150 while ( true ) { 151 // Abort this foreach loop iteration if there's no plugins left of this type 152 if ( 0 == count($items) ) 153 continue 2; 154 155 $item_key = array_rand($items); 156 $item = $items[$item_key]; 157 158 list($link, $frag) = explode( '#', $item->get_link() ); 159 160 $link = esc_url($link); 161 if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) 162 $slug = $matches[1]; 163 else { 164 unset( $items[$item_key] ); 129 if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { 130 $popular = fetch_feed( $args['url']['popular'] ); 131 $new = fetch_feed( $args['url']['new'] ); 132 133 if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { 134 $plugin_slugs = array_keys( get_plugins() ); 135 set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); 136 } 137 138 echo '<ul>'; 139 140 foreach ( array( 141 'popular' => __( 'Popular Plugin' ), 142 'new' => __( 'Newest Plugin' ) 143 ) as $feed => $label ) { 144 if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) 165 145 continue; 146 147 $items = $$feed->get_items(0, 5); 148 149 // Pick a random, non-installed plugin 150 while ( true ) { 151 // Abort this foreach loop iteration if there's no plugins left of this type 152 if ( 0 == count($items) ) 153 continue 2; 154 155 $item_key = array_rand($items); 156 $item = $items[$item_key]; 157 158 list($link, $frag) = explode( '#', $item->get_link() ); 159 160 $link = esc_url($link); 161 if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) 162 $slug = $matches[1]; 163 else { 164 unset( $items[$item_key] ); 165 continue; 166 } 167 168 // Is this random plugin's slug already installed? If so, try again. 169 reset( $plugin_slugs ); 170 foreach ( $plugin_slugs as $plugin_slug ) { 171 if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { 172 unset( $items[$item_key] ); 173 continue 2; 174 } 175 } 176 177 // If we get to this point, then the random plugin isn't installed and we can stop the while(). 178 break; 166 179 } 167 168 // Is this random plugin's slug already installed? If so, try again. 169 reset( $plugin_slugs ); 170 foreach ( $plugin_slugs as $plugin_slug ) { 171 if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { 172 unset( $items[$item_key] ); 173 continue 2; 174 } 175 } 176 177 // If we get to this point, then the random plugin isn't installed and we can stop the while(). 178 break; 180 181 // Eliminate some common badly formed plugin descriptions 182 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) 183 unset($items[$item_key]); 184 185 if ( !isset($items[$item_key]) ) 186 continue; 187 188 $title = esc_html( $item->get_title() ); 189 190 $description = esc_html( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); 191 192 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; 193 194 echo "<li><span>$label:</span> <a href='$link'>$title</a></h5> <span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>"; 195 196 $$feed->__destruct(); 197 unset( $$feed ); 179 198 } 180 181 // Eliminate some common badly formed plugin descriptions 182 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) 183 unset($items[$item_key]); 184 185 if ( !isset($items[$item_key]) ) 186 continue; 187 188 $title = esc_html( $item->get_title() ); 189 190 $description = esc_html( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); 191 192 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; 193 194 echo "<li><span>$label:</span> <a href='$link'>$title</a></h5> <span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>"; 195 196 $$feed->__destruct(); 197 unset( $$feed ); 198 } 199 200 echo '</ul>'; 199 200 echo '</ul>'; 201 } 201 202 } 202 203
Note: See TracChangeset
for help on using the changeset viewer.