source: trunk/www.guidonia.net/wp/wp-admin/includes/plugin-install.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 22.0 KB
Line 
1<?php
2/**
3 * WordPress Plugin Install Administration API
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/**
10 * Retrieve plugin installer pages from WordPress Plugins API.
11 *
12 * It is possible for a plugin to override the Plugin API result with three
13 * filters. Assume this is for plugins, which can extend on the Plugin Info to
14 * offer more choices. This is very powerful and must be used with care, when
15 * overridding the filters.
16 *
17 * The first filter, 'plugins_api_args', is for the args and gives the action as
18 * the second parameter. The hook for 'plugins_api_args' must ensure that an
19 * object is returned.
20 *
21 * The second filter, 'plugins_api', is the result that would be returned.
22 *
23 * @since 2.7.0
24 *
25 * @param string $action
26 * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
27 * @return mixed
28 */
29function plugins_api($action, $args = null) {
30
31 if( is_array($args) )
32 $args = (object)$args;
33
34 if ( !isset($args->per_page) )
35 $args->per_page = 24;
36
37 $args = apply_filters('plugins_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
38 $res = apply_filters('plugins_api', false, $action, $args); //NOTE: Allows a plugin to completely override the builtin WordPress.org API.
39
40 if ( ! $res ) {
41 $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
42 if ( is_wp_error($request) ) {
43 $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
44 } else {
45 $res = unserialize($request['body']);
46 if ( ! $res )
47 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
48 }
49 } elseif ( !is_wp_error($res) ) {
50 $res->external = true;
51 }
52
53 return apply_filters('plugins_api_result', $res, $action, $args);
54}
55
56/**
57 * Retrieve popular WordPress plugin tags.
58 *
59 * @since 2.7.0
60 *
61 * @param array $args
62 * @return array
63 */
64function install_popular_tags( $args = array() ) {
65 if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
66 add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.
67
68 if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
69 return $cache->cached;
70
71 $tags = plugins_api('hot_tags', $args);
72
73 if ( is_wp_error($tags) )
74 return $tags;
75
76 $cache = (object) array('timeout' => time(), 'cached' => $tags);
77
78 update_option('wporg_popular_tags', $cache);
79 wp_cache_set('popular_tags', $cache, 'api');
80
81 return $tags;
82}
83add_action('install_plugins_search', 'install_search', 10, 1);
84
85/**
86 * Display search results and display as tag cloud.
87 *
88 * @since 2.7.0
89 *
90 * @param string $page
91 */
92function install_search($page) {
93 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
94 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
95
96 $args = array();
97
98 switch( $type ){
99 case 'tag':
100 $args['tag'] = sanitize_title_with_dashes($term);
101 break;
102 case 'term':
103 $args['search'] = $term;
104 break;
105 case 'author':
106 $args['author'] = $term;
107 break;
108 }
109
110 $args['page'] = $page;
111
112 $api = plugins_api('query_plugins', $args);
113
114 if ( is_wp_error($api) )
115 wp_die($api);
116
117 add_action('install_plugins_table_header', 'install_search_form');
118
119 display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
120
121 return;
122}
123
124add_action('install_plugins_dashboard', 'install_dashboard');
125function install_dashboard() {
126 ?>
127 <p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p>
128
129 <h4><?php _e('Search') ?></h4>
130 <p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>
131 <?php install_search_form(); ?>
132
133 <h4><?php _e('Popular tags') ?></h4>
134 <p class="install-help"><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
135 <?php
136
137 $api_tags = install_popular_tags();
138
139 //Set up the tags in a way which can be interprated by wp_generate_tag_cloud()
140 $tags = array();
141 foreach ( (array)$api_tags as $tag )
142 $tags[ $tag['name'] ] = (object) array(
143 'link' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
144 'name' => $tag['name'],
145 'id' => sanitize_title_with_dashes($tag['name']),
146 'count' => $tag['count'] );
147 echo '<p class="popular-tags">';
148 echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
149 echo '</p><br class="clear" />';
150}
151
152/**
153 * Display search form for searching plugins.
154 *
155 * @since 2.7.0
156 */
157function install_search_form(){
158 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
159 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
160
161 ?><form id="search-plugins" method="post" action="<?php echo admin_url('plugin-install.php?tab=search'); ?>">
162 <select name="type" id="typeselector">
163 <option value="term"<?php selected('term', $type) ?>><?php _e('Term'); ?></option>
164 <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
165 <option value="tag"<?php selected('tag', $type) ?>><?php echo _x('Tag', 'Plugin Installer'); ?></option>
166 </select>
167 <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
168 <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label>
169 <input type="submit" id="plugin-search-input" name="search" value="<?php esc_attr_e('Search Plugins'); ?>" class="button" />
170 </form><?php
171}
172
173add_action('install_plugins_featured', 'install_featured', 10, 1);
174/**
175 * Display featured plugins.
176 *
177 * @since 2.7.0
178 *
179 * @param string $page
180 */
181function install_featured($page = 1) {
182 $args = array('browse' => 'featured', 'page' => $page);
183 $api = plugins_api('query_plugins', $args);
184 if ( is_wp_error($api) )
185 wp_die($api);
186 display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
187}
188
189add_action('install_plugins_popular', 'install_popular', 10, 1);
190/**
191 * Display popular plugins.
192 *
193 * @since 2.7.0
194 *
195 * @param string $page
196 */
197function install_popular($page = 1) {
198 $args = array('browse' => 'popular', 'page' => $page);
199 $api = plugins_api('query_plugins', $args);
200 display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
201}
202
203add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
204/**
205 * Upload from zip
206 * @since 2.8.0
207 *
208 * @param string $page
209 */
210function install_plugins_upload( $page = 1 ) {
211?>
212 <h4><?php _e('Install a plugin in .zip format') ?></h4>
213 <p class="install-help"><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
214 <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-plugin') ?>">
215 <?php wp_nonce_field( 'plugin-upload') ?>
216 <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
217 <input type="file" id="pluginzip" name="pluginzip" />
218 <input type="submit" class="button" value="<?php esc_attr_e('Install Now') ?>" />
219 </form>
220<?php
221}
222
223add_action('install_plugins_new', 'install_new', 10, 1);
224/**
225 * Display new plugins.
226 *
227 * @since 2.7.0
228 *
229 * @param string $page
230 */
231function install_new($page = 1) {
232 $args = array('browse' => 'new', 'page' => $page);
233 $api = plugins_api('query_plugins', $args);
234 if ( is_wp_error($api) )
235 wp_die($api);
236 display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
237}
238add_action('install_plugins_updated', 'install_updated', 10, 1);
239
240
241/**
242 * Display recently updated plugins.
243 *
244 * @since 2.7.0
245 *
246 * @param string $page
247 */
248function install_updated($page = 1) {
249 $args = array('browse' => 'updated', 'page' => $page);
250 $api = plugins_api('query_plugins', $args);
251 display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
252}
253
254/**
255 * Display plugin content based on plugin list.
256 *
257 * @since 2.7.0
258 *
259 * @param array $plugins List of plugins.
260 * @param string $page
261 * @param int $totalpages Number of pages.
262 */
263function display_plugins_table($plugins, $page = 1, $totalpages = 1){
264 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
265 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
266
267 $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),
268 'abbr' => array('title' => array()),'acronym' => array('title' => array()),
269 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(),
270 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
271
272?>
273 <div class="tablenav">
274 <div class="alignleft actions">
275 <?php do_action('install_plugins_table_header'); ?>
276 </div>
277 <?php
278 $url = esc_url($_SERVER['REQUEST_URI']);
279 if ( ! empty($term) )
280 $url = add_query_arg('s', $term, $url);
281 if ( ! empty($type) )
282 $url = add_query_arg('type', $type, $url);
283
284 $page_links = paginate_links( array(
285 'base' => add_query_arg('paged', '%#%', $url),
286 'format' => '',
287 'prev_text' => __('&laquo;'),
288 'next_text' => __('&raquo;'),
289 'total' => $totalpages,
290 'current' => $page
291 ));
292
293 if ( $page_links )
294 echo "\t\t<div class='tablenav-pages'>$page_links</div>";
295?>
296 <br class="clear" />
297 </div>
298 <table class="widefat" id="install-plugins" cellspacing="0">
299 <thead>
300 <tr>
301 <th scope="col" class="name"><?php _e('Name'); ?></th>
302 <th scope="col" class="num"><?php _e('Version'); ?></th>
303 <th scope="col" class="num"><?php _e('Rating'); ?></th>
304 <th scope="col" class="desc"><?php _e('Description'); ?></th>
305 <th scope="col" class="action-links"><?php _e('Actions'); ?></th>
306 </tr>
307 </thead>
308
309 <tfoot>
310 <tr>
311 <th scope="col" class="name"><?php _e('Name'); ?></th>
312 <th scope="col" class="num"><?php _e('Version'); ?></th>
313 <th scope="col" class="num"><?php _e('Rating'); ?></th>
314 <th scope="col" class="desc"><?php _e('Description'); ?></th>
315 <th scope="col" class="action-links"><?php _e('Actions'); ?></th>
316 </tr>
317 </tfoot>
318
319 <tbody class="plugins">
320 <?php
321 if( empty($plugins) )
322 echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>';
323
324 foreach( (array) $plugins as $plugin ){
325 if ( is_object($plugin) )
326 $plugin = (array) $plugin;
327
328 $title = wp_kses($plugin['name'], $plugins_allowedtags);
329 //Limit description to 400char, and remove any HTML.
330 $description = strip_tags($plugin['description']);
331 if ( strlen($description) > 400 )
332 $description = mb_substr($description, 0, 400) . '&#8230;';
333 //remove any trailing entities
334 $description = preg_replace('/&[^;\s]{0,6}$/', '', $description);
335 //strip leading/trailing & multiple consecutive lines
336 $description = trim($description);
337 $description = preg_replace("|(\r?\n)+|", "\n", $description);
338 //\n => <br>
339 $description = nl2br($description);
340 $version = wp_kses($plugin['version'], $plugins_allowedtags);
341
342 $name = strip_tags($title . ' ' . $version);
343
344 $author = $plugin['author'];
345 if( ! empty($plugin['author']) )
346 $author = ' <cite>' . sprintf( __('By %s'), $author ) . '.</cite>';
347
348 $author = wp_kses($author, $plugins_allowedtags);
349
350 if( isset($plugin['homepage']) )
351 $title = '<a target="_blank" href="' . esc_attr($plugin['homepage']) . '">' . $title . '</a>';
352
353 $action_links = array();
354 $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
355 '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox onclick" title="' .
356 esc_attr($name) . '">' . __('Install') . '</a>';
357
358 $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
359 ?>
360 <tr>
361 <td class="name"><?php echo $title; ?></td>
362 <td class="vers"><?php echo $version; ?></td>
363 <td class="vers">
364 <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])) ?>">
365 <div class="star star-rating" style="width: <?php echo esc_attr($plugin['rating']) ?>px"></div>
366 <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
367 <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
368 <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
369 <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
370 <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
371 </div>
372 </td>
373 <td class="desc"><?php echo $description, $author; ?></td>
374 <td class="action-links"><?php if ( !empty($action_links) ) echo implode(' | ', $action_links); ?></td>
375 </tr>
376 <?php
377 }
378 ?>
379 </tbody>
380 </table>
381
382 <div class="tablenav">
383 <?php if ( $page_links )
384 echo "\t\t<div class='tablenav-pages'>$page_links</div>"; ?>
385 <br class="clear" />
386 </div>
387
388<?php
389}
390
391add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
392
393/**
394 * Display plugin information in dialog box form.
395 *
396 * @since 2.7.0
397 */
398function install_plugin_information() {
399 global $tab;
400
401 $api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));
402
403 if ( is_wp_error($api) )
404 wp_die($api);
405
406 $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
407 'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
408 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
409 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
410 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
411 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
412 //Sanitize HTML
413 foreach ( (array)$api->sections as $section_name => $content )
414 $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
415 foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )
416 $api->$key = wp_kses($api->$key, $plugins_allowedtags);
417
418 $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
419 if( empty($section) || ! isset($api->sections[ $section ]) )
420 $section = array_shift( $section_titles = array_keys((array)$api->sections) );
421
422 iframe_header( __('Plugin Install') );
423 echo "<div id='$tab-header'>\n";
424 echo "<ul id='sidemenu'>\n";
425 foreach ( (array)$api->sections as $section_name => $content ) {
426
427 $title = $section_name;
428 $title = ucwords(str_replace('_', ' ', $title));
429
430 $class = ( $section_name == $section ) ? ' class="current"' : '';
431 $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
432 $href = esc_url($href);
433 $san_title = esc_attr(sanitize_title_with_dashes($title));
434 echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";
435 }
436 echo "</ul>\n";
437 echo "</div>\n";
438 ?>
439 <div class="alignright fyi">
440 <?php if ( ! empty($api->download_link) ) : ?>
441 <p class="action-button">
442 <?php
443 //Default to a "new" plugin
444 $type = 'install';
445 //Check to see if this plugin is known to be installed, and has an update awaiting it.
446 $update_plugins = get_transient('update_plugins');
447 if ( is_object( $update_plugins ) ) {
448 foreach ( (array)$update_plugins->response as $file => $plugin ) {
449 if ( $plugin->slug === $api->slug ) {
450 $type = 'update_available';
451 $update_file = $file;
452 break;
453 }
454 }
455 }
456 if ( 'install' == $type && is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
457 $installed_plugin = get_plugins('/' . $api->slug);
458 if ( ! empty($installed_plugin) ) {
459 $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
460 if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
461 $type = 'latest_installed';
462 } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
463 $type = 'newer_installed';
464 $newer_version = $installed_plugin[ $key ]['Version'];
465 } else {
466 //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
467 delete_transient('update_plugins');
468 $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
469 $type = 'update_available';
470 }
471 }
472 }
473
474 switch ( $type ) :
475 default:
476 case 'install':
477 if ( current_user_can('install_plugins') ) :
478 ?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
479 endif;
480 break;
481 case 'update_available':
482 if ( current_user_can('update_plugins') ) :
483 ?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file) ?>" target="_parent"><?php _e('Install Update Now') ?></a><?php
484 endif;
485 break;
486 case 'newer_installed':
487 if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
488 ?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
489 endif;
490 break;
491 case 'latest_installed':
492 if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
493 ?><a><?php _e('Latest Version Installed') ?></a><?php
494 endif;
495 break;
496 endswitch; ?>
497 </p>
498 <?php endif; ?>
499 <h2 class="mainheader"><?php _e('FYI') ?></h2>
500 <ul>
501<?php if ( ! empty($api->version) ) : ?>
502 <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
503<?php endif; if ( ! empty($api->author) ) : ?>
504 <li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li>
505<?php endif; if ( ! empty($api->last_updated) ) : ?>
506 <li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
507 printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
508<?php endif; if ( ! empty($api->requires) ) : ?>
509 <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li>
510<?php endif; if ( ! empty($api->tested) ) : ?>
511 <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
512<?php endif; if ( ! empty($api->downloaded) ) : ?>
513 <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
514<?php endif; if ( ! empty($api->slug) && empty($api->external) ) : ?>
515 <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
516<?php endif; if ( ! empty($api->homepage) ) : ?>
517 <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage &#187;') ?></a></li>
518<?php endif; ?>
519 </ul>
520 <?php if ( ! empty($api->rating) ) : ?>
521 <h2><?php _e('Average Rating') ?></h2>
522 <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">
523 <div class="star star-rating" style="width: <?php echo esc_attr($api->rating) ?>px"></div>
524 <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
525 <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
526 <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
527 <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
528 <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
529 </div>
530 <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
531 <?php endif; ?>
532 </div>
533 <div id="section-holder" class="wrap">
534 <?php
535 if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
536 echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
537
538 else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
539 echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
540
541 foreach ( (array)$api->sections as $section_name => $content ) {
542 $title = $section_name;
543 $title[0] = strtoupper($title[0]);
544 $title = str_replace('_', ' ', $title);
545
546 $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/');
547 $content = links_add_target($content, '_blank');
548
549 $san_title = esc_attr(sanitize_title_with_dashes($title));
550
551 $display = ( $section_name == $section ) ? 'block' : 'none';
552
553 echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n";
554 echo "\t\t<h2 class='long-header'>$title</h2>";
555 echo $content;
556 echo "\t</div>\n";
557 }
558 echo "</div>\n";
559
560 iframe_footer();
561 exit;
562}
Note: See TracBrowser for help on using the repository browser.