Make WordPress Core

Ticket #12130: 12130.2.diff

File 12130.2.diff, 2.6 KB (added by Denis-de-Bernardy, 15 years ago)

best of both worlds.

  • wp-admin/includes/plugin.php

     
    4242 *              from the author.
    4343 *              'Author' - The author's name
    4444 *              'AuthorURI' - The authors web site address.
     45 *              'DonateURI' - Web address to donate to the plugin author.
    4546 *              'Version' - The plugin version number.
    4647 *              'PluginURI' - Plugin web site address.
    4748 *              'TextDomain' - Plugin's text domain for localization.
     
    7879                'Description' => 'Description',
    7980                'Author' => 'Author',
    8081                'AuthorURI' => 'Author URI',
     82                'DonateURI' => 'Donate link',
    8183                'TextDomain' => 'Text Domain',
    8284                'DomainPath' => 'Domain Path',
    8385                'Network' => 'Network',
     
    98100        //For backward compatibility by default Title is the same as Name.
    99101        $plugin_data['Title'] = $plugin_data['Name'];
    100102
     103        if ( $plugin_data['DonateURI'] === '' ) {
     104                // Read info in from readme.txt
     105                $readme_headers = array(
     106                        'DonateURI' => 'Donate link',
     107                );
     108
     109                $readme_file = plugin_dir_path( $plugin_file ) . 'readme.txt';
     110                if ( file_exists( $readme_file ) ) {
     111                        $readme_data = get_file_data( $readme_file, $readme_headers, 'readme' );
     112                        $plugin_data = array_merge( $readme_data, $plugin_data);
     113                }
     114        }
     115
    101116        if ( $markup || $translate )
    102117                $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate );
    103118
     
    113128                else
    114129                        load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
    115130
    116                 foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )
     131                foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version', 'DonateURI') as $field )
    117132                        $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
    118133        }
    119134
  • wp-admin/plugins.php

     
    620620                }
    621621                if ( ! empty($plugin_data['PluginURI']) )
    622622                        $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>';
    623 
     623                if ( ! empty($plugin_data['DonateURI']) )
     624                        $plugin_meta[] = '<a href="' . $plugin_data['DonateURI'] . '" title="' . __( 'Donate' ) . '">' . __('Donate') . '</a>';
     625                       
    624626                $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context);
    625627                echo implode(' | ', $plugin_meta);
    626628                echo "</td>