Ticket #17902: 17902.2.patch
File 17902.2.patch, 16.5 KB (added by , 13 years ago) |
---|
-
wp-admin/plugin-install.php
6 6 * @subpackage Administration 7 7 */ 8 8 // TODO route this pages via a specific iframe handler instead of the do_action below 9 if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab']) )9 if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( in_array( $_GET['tab'], array( 'plugin-information', 'plugin-readme' ) ) ) ) 10 10 define( 'IFRAME_REQUEST', true ); 11 11 12 12 /** WordPress Administration Bootstrap */ … … 28 28 $parent_file = 'plugins.php'; 29 29 30 30 wp_enqueue_script( 'plugin-install' ); 31 if ( 'plugin-information' != $tab)31 if ( !in_array( $tab, array('plugin-information', 'plugin-readme') ) ) 32 32 add_thickbox(); 33 33 34 34 $body_id = $tab; -
wp-admin/css/colors-classic.dev.css
583 583 } 584 584 585 585 div#media-upload-header, 586 div#plugin-information-header { 586 div#plugin-information-header, 587 div#plugin-readme-header { 587 588 background-color: #f9f9f9; 588 589 border-bottom-color: #dfdfdf; 589 590 } … … 1725 1726 border-right: 1px solid #fff; 1726 1727 } 1727 1728 1728 #plugin-information .fyi ul { 1729 #plugin-information .fyi ul, 1730 #plugin-readme .fyi ul { 1729 1731 background-color: #eaf3fa; 1730 1732 } 1731 1733 1732 #plugin-information .fyi h2.mainheader { 1734 #plugin-information .fyi h2.mainheader, 1735 #plugin-readme .fyi h2.mainheader { 1733 1736 background-color: #cee1ef; 1734 1737 } 1735 1738 1736 1739 #plugin-information pre, 1737 #plugin-information code { 1740 #plugin-information code, 1741 #plugin-readme pre, 1742 #plugin-readme code { 1738 1743 background-color: #ededff; 1739 1744 } 1740 1745 1741 #plugin-information pre { 1746 #plugin-information pre, 1747 #plugin-readme pre { 1742 1748 border: 1px solid #ccc; 1743 1749 } 1744 1750 -
wp-admin/css/colors-fresh.dev.css
591 591 } 592 592 593 593 div#media-upload-header, 594 div#plugin-information-header { 594 div#plugin-information-header, 595 div#plugin-readme-header { 595 596 background-color: #f9f9f9; 596 597 border-bottom-color: #dfdfdf; 597 598 } … … 1360 1361 border-right: 1px solid #f9f9f9; 1361 1362 } 1362 1363 1363 #plugin-information .fyi ul { 1364 #plugin-information .fyi ul, 1365 #plugin-readme .fyi ul { 1364 1366 background-color: #eaf3fa; 1365 1367 } 1366 1368 1367 #plugin-information .fyi h2.mainheader { 1369 #plugin-information .fyi h2.mainheader, 1370 #plugin-readme .fyi h2.mainheader { 1368 1371 background-color: #cee1ef; 1369 1372 } 1370 1373 1371 1374 #plugin-information pre, 1372 #plugin-information code { 1375 #plugin-information code, 1376 #plugin-readme pre, 1377 #plugin-readme code { 1373 1378 background-color: #ededff; 1374 1379 } 1375 1380 1376 #plugin-information pre { 1381 #plugin-information pre, 1382 #plugin-readme pre { 1377 1383 border: 1px solid #ccc; 1378 1384 } 1379 1385 -
wp-admin/css/wp-admin-rtl.dev.css
2159 2159 left: 0; 2160 2160 } 2161 2161 2162 #plugin-information ul#sidemenu { 2162 #plugin-information ul#sidemenu, 2163 #plugin-readme ul#sidemenu { 2163 2164 left: auto; 2164 2165 right: 0; 2165 2166 } 2166 2167 2167 #plugin-information h2 { 2168 #plugin-information h2, 2169 #plugin-readme h2 { 2168 2170 margin-right: 0; 2169 2171 margin-left: 200px; 2170 2172 } 2171 2173 2172 #plugin-information .fyi { 2174 #plugin-information .fyi, 2175 #plugin-readme .fyi { 2173 2176 margin-left: 5px; 2174 2177 margin-right: 20px; 2175 2178 } 2176 2179 2177 #plugin-information .fyi h2 { 2180 #plugin-information .fyi h2, 2181 #plugin-readme .fyi h2 { 2178 2182 margin-left: 0; 2179 2183 } 2180 2184 2181 #plugin-information .fyi ul { 2185 #plugin-information .fyi ul, 2186 #plugin-readme .fyi ul { 2182 2187 padding: 10px 7px 10px 5px; 2183 2188 } 2184 2189 … … 2189 2194 2190 2195 #plugin-information #section-screenshots ol, 2191 2196 #plugin-information .updated, 2192 #plugin-information pre { 2197 #plugin-information pre, 2198 #plugin-readme .updated, 2199 #plugin-readme pre { 2193 2200 margin-right: 0; 2194 2201 margin-left: 215px; 2195 2202 } 2196 2203 2197 2204 #plugin-information .updated, 2198 #plugin-information .error { 2205 #plugin-information .error, 2206 #plugin-readme .updated, 2207 #plugin-readme .error { 2199 2208 clear: none; 2200 2209 direction: rtl; 2201 2210 } -
wp-admin/css/wp-admin.dev.css
6852 6852 } 6853 6853 6854 6854 /* Header on thickbox */ 6855 #plugin-information-header { 6855 #plugin-information-header, 6856 #plugin-readme-header { 6856 6857 margin: 0; 6857 6858 padding: 0 5px; 6858 6859 font-weight: bold; … … 6861 6862 border-bottom-style: solid; 6862 6863 height: 2.5em; 6863 6864 } 6864 #plugin-information ul#sidemenu { 6865 #plugin-information ul#sidemenu, 6866 #plugin-readme ul#sidemenu { 6865 6867 font-weight: normal; 6866 6868 margin: 0 5px; 6867 6869 position: absolute; … … 6889 6891 line-height: 2em; 6890 6892 } 6891 6893 6892 #plugin-information h2 { 6894 #plugin-information h2, 6895 #plugin-readme h2 { 6893 6896 clear: none !important; 6894 6897 margin-right: 200px; 6895 6898 } 6896 6899 6897 #plugin-information .fyi { 6900 #plugin-information .fyi, 6901 #plugin-readme .fyi { 6898 6902 margin: 0 10px 50px; 6899 6903 width: 210px; 6900 6904 } 6901 6905 6902 #plugin-information .fyi h2 { 6906 #plugin-information .fyi h2, 6907 #plugin-readme .fyi h2 { 6903 6908 font-size: 0.9em; 6904 6909 margin-bottom: 0; 6905 6910 margin-right: 0; 6906 6911 } 6907 6912 6908 #plugin-information .fyi h2.mainheader { 6913 #plugin-information .fyi h2.mainheader, 6914 #plugin-readme .fyi h2.mainheader { 6909 6915 padding: 5px; 6910 6916 -webkit-border-top-left-radius: 3px; 6911 6917 border-top-left-radius: 3px; 6912 6918 } 6913 6919 6920 #plugin-readme .fyi ul, 6914 6921 #plugin-information .fyi ul { 6915 6922 padding: 10px 5px 10px 7px; 6916 6923 margin: 0; … … 6919 6926 border-bottom-left-radius: 3px; 6920 6927 } 6921 6928 6922 #plugin-information .fyi li { 6929 #plugin-information .fyi li, 6930 #plugin-readme .fyi li { 6923 6931 margin-right: 0; 6924 6932 } 6925 6933 6926 #plugin-information #section-holder { 6934 #plugin-information #section-holder, 6935 #plugin-readme #section-holder { 6927 6936 padding: 10px; 6928 6937 } 6929 6938 6930 6939 #plugin-information .section ul, 6931 #plugin-information .section ol { 6940 #plugin-information .section ol, 6941 #plugin-readme .section ul, 6942 #plugin-readme .section ol { 6932 6943 margin-left: 16px; 6933 6944 list-style-type: square; 6934 6945 list-style-image: none; … … 6954 6965 6955 6966 #plugin-information #section-screenshots ol, 6956 6967 #plugin-information .updated, 6957 #plugin-information pre { 6968 #plugin-information pre, 6969 #plugin-readme .updated, 6970 #plugin-readme pre { 6958 6971 margin-right: 215px; 6959 6972 } 6960 6973 6961 #plugin-information pre { 6974 #plugin-information pre, 6975 #plugin-readme pre { 6962 6976 padding: 7px; 6963 6977 overflow: auto; 6964 6978 } -
wp-admin/includes/class-wp-plugin-install-list-table.php
34 34 $tabs['popular'] = _x( 'Popular','Plugin Installer' ); 35 35 $tabs['new'] = _x( 'Newest','Plugin Installer' ); 36 36 37 $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.37 $nonmenu_tabs = array( 'plugin-information', 'plugin-readme' ); //Valid actions to perform which do not have a Menu item. 38 38 39 39 $tabs = apply_filters( 'install_plugins_tabs', $tabs ); 40 40 $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); -
wp-admin/includes/class-wp-plugins-list-table.php
427 427 $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>'; 428 428 $plugin_meta[] = sprintf( __( 'By %s' ), $author ); 429 429 } 430 $slug = basename( $plugin_file, '.php' ); 431 $plugin_meta[] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-readme&readme=true&plugin=' . $slug . 432 '&TB_iframe=true&width=600&height=550' ) . '" class="thickbox" title="' . 433 esc_attr( sprintf( __( 'More information about %s' ), "{$plugin_data['Name']} {$plugin_data['Version']}" ) ) . '">' . __( 'Details' ) . '</a>'; 430 434 if ( ! empty( $plugin_data['PluginURI'] ) ) 431 435 $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__( 'Visit plugin site' ) . '">' . __( 'Visit plugin site' ) . '</a>'; 432 436 -
wp-admin/includes/plugin-install.php
384 384 exit; 385 385 } 386 386 add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); 387 388 /** 389 * Get information from a plugin locally 390 * @param string $slug 391 * @since 3.4.0 392 */ 393 function local_plugin_api( $slug ) { 394 395 // Try to find the plugin file from the slug 396 $plugin_data = array(); 397 if ( file_exists( ABSPATH . PLUGINDIR . "/$slug.php" ) ) { 398 $plugin_data = get_plugin_data( ABSPATH . PLUGINDIR . "/$slug.php" ); 399 } elseif ( file_exists( ABSPATH . PLUGINDIR . "/$slug/$slug.php" ) ) { 400 $plugin_data = get_plugin_data( ABSPATH . PLUGINDIR . "/$slug/$slug.php" ); 401 } 402 403 // Try to load data from readme.txt 404 $readme_data = false; 405 if ( file_exists( ABSPATH . PLUGINDIR . "/$slug/readme.txt" ) ) { 406 407 // Get markddown library, turn off plugin functionality 408 if ( !defined( 'MARKDOWN_WP_POSTS' ) ) 409 define( 'MARKDOWN_WP_POSTS', false ); 410 if ( !defined( 'MARKDOWN_WP_COMMENTS' ) ) 411 define( 'MARKDOWN_WP_COMMENTS', false ); 412 if ( !class_exists( 'Markdown_Parser' ) ) 413 include_once( ABSPATH . 'wp-admin/includes/markdown.php' ); 414 415 include_once( ABSPATH . 'wp-admin/includes/class-wp-plugin-readme-parser.php' ); 416 $readme_parser = new wp_plugin_readme_parser(); 417 $readme_data = $readme_parser->parse_readme_file( ABSPATH . PLUGINDIR . "/$slug/readme.txt" ); 418 } 419 420 // If there's no readme (e.g. hello.php) create a fake structure 421 if ( empty( $readme_data ) ) { 422 $readme_data = array( 423 'contributors' => '', 424 'requires_at_least' => '', 425 'tested_up_to' => '', 426 'tags' => array(), 427 'sections' => array( 428 'description' => !empty( $plugin_data['Description'] ) ? $plugin_data['Description'] : '' 429 ) 430 ); 431 } 432 433 // Convert to an API-style response 434 $api = array( 435 'name' => !empty( $plugin_data['Name'] ) ? $plugin_data['Name'] : $slug, 436 'slug' => $slug, 437 'version' => !empty( $plugin_data['Version'] ) ? $plugin_data['Version'] : '', 438 'author' => !empty( $plugin_data['AuthorName'] ) ? $plugin_data['AuthorName'] : '', 439 'author_profile' => null, 440 'contributors' => $readme_data['contributors'], 441 'requires' => $readme_data['requires_at_least'], 442 'tested' => $readme_data['tested_up_to'], 443 'compatibility' => null, 444 'rating' => null, 445 'num_ratings' => null, 446 'downloaded' => null, 447 'last_updated' => null, 448 'added' => null, 449 'homepage' => !empty( $plugin_data['PluginURI'] ) ? $plugin_data['PluginURI'] : '', 450 'sections' => $readme_data['sections'], 451 'download_link' => null, 452 'tags' => $readme_data['tags'] 453 ); 454 455 // Done 456 return (object) $api; 457 } 458 459 /** 460 * Display local plugin information in dialog box form. 461 * Pull from the readme.txt file and the plugin header 462 * @since 3.4.0 463 */ 464 function plugin_readme_information() { 465 global $tab; 466 467 $api = local_plugin_api( stripslashes( $_REQUEST['plugin'] ) ); 468 469 if ( is_wp_error($api) ) 470 wp_die($api); 471 472 $plugins_allowedtags = array( 473 'a' => array( 474 'href' => array(), 475 'title' => array(), 476 'target' => array() 477 ), 478 'abbr' => array( 479 'title' => array() 480 ), 481 'acronym' => array( 482 'title' => array() 483 ), 484 'code' => array(), 485 'pre' => array(), 486 'em' => array(), 487 'strong' => array(), 488 'div' => array(), 489 'p' => array(), 490 'ul' => array(), 491 'ol' => array(), 492 'li' => array(), 493 'h1' => array(), 494 'h2' => array(), 495 'h3' => array(), 496 'h4' => array(), 497 'h5' => array(), 498 'h6' => array(), 499 'img' => array( 500 'src' => array(), 501 'class' => array(), 502 'alt' => array() 503 ) 504 ); 505 506 $plugins_section_titles = array( 507 'description' => _x('Description', 'Plugin installer section title'), 508 'installation' => _x('Installation', 'Plugin installer section title'), 509 'faq' => _x('FAQ', 'Plugin installer section title'), 510 'changelog' => _x('Changelog', 'Plugin installer section title'), 511 'other_notes' => _x('Other Notes', 'Plugin installer section title') 512 ); 513 514 // No screenshots at this time 515 if ( !empty( $api->sections['screenshots'] ) ) 516 unset( $api->sections['screenshots'] ); 517 518 // Sanitize HTML 519 foreach ( (array)$api->sections as $section_name => $content ) 520 $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags ); 521 foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) { 522 if ( isset( $api->$key ) ) 523 $api->$key = wp_kses( $api->$key, $plugins_allowedtags ); 524 } 525 526 // Default to the Description tab, Do not translate, API returns English. 527 $section = isset( $_REQUEST['section'] ) ? stripslashes( $_REQUEST['section'] ) : 'description'; 528 if ( empty($section) || ! isset($api->sections[ $section ]) ) 529 $section = array_shift( $section_titles = array_keys((array)$api->sections) ); 530 531 iframe_header( __( 'Plugin Details' ) ); 532 ?> 533 <div id="<?php echo $tab; ?>-header"> 534 <ul id="sidemenu"> 535 <?php foreach ( (array) $api->sections as $section_name => $content ) : ?> 536 <?php 537 if ( isset( $plugins_section_titles[ $section_name ] ) ) 538 $title = $plugins_section_titles[ $section_name ]; 539 else 540 $title = ucwords( str_replace( '_', ' ', $section_name ) ); 541 542 $class = ( $section_name == $section ) ? ' class="current"' : ''; 543 $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) ); 544 $href = esc_url($href); 545 $san_section = esc_attr( $section_name ); 546 ?> 547 <li><a name="<?php echo $san_section; ?>" href="<?php echo $href; ?>" <?php echo $class; ?>><?php echo $title; ?></a></li> 548 <?php endforeach ; ?> 549 </ul> 550 </div> 551 <div class="alignright fyi"> 552 <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI') ?></h2> 553 <ul> 554 <?php if ( !empty( $api->version ) ) : ?> 555 <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li> 556 <?php endif; ?> 557 <?php if ( !empty( $api->author ) ) : ?> 558 <li><strong><?php _e('Author:') ?></strong> <?php echo $api->author ?></li> 559 <?php endif; ?> 560 <?php if ( !empty( $api->requires ) ) : ?> 561 <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li> 562 <?php endif; ?> 563 <?php if ( !empty( $api->tested ) ) : ?> 564 <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li> 565 <?php endif; ?> 566 <?php if ( !empty( $api->homepage ) ) : ?> 567 <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage »') ?></a></li> 568 <?php endif; ?> 569 </ul> 570 </div> 571 <div id="section-holder" class="wrap"> 572 <?php 573 if ( !empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) 574 echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>'; 575 576 elseif ( !empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) 577 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>'; 578 579 foreach ( (array) $api->sections as $section_name => $content ) { 580 if ( isset( $plugins_section_titles[ $section_name ] ) ) 581 $title = $plugins_section_titles[ $section_name ]; 582 else 583 $title = ucwords( str_replace( '_', ' ', $section_name ) ); 584 585 $content = links_add_target($content, '_blank'); 586 $san_section = esc_attr( $section_name ); 587 $display = ( $section_name == $section ) ? 'block' : 'none'; 588 ?> 589 <div id="section-<?php echo $san_section; ?>" class="section" style="display: <?php echo $display; ?>;"> 590 <h2 class="long-header"><?php echo $title; ?></h2> 591 <?php echo $content; ?> 592 </div> 593 <?php 594 } 595 echo "</div>\n"; 596 iframe_footer(); 597 exit; 598 } 599 add_action('install_plugins_pre_plugin-readme', 'plugin_readme_information');