Browse files

Version 1.0

  • Loading branch information...
0 parents commit 871b02fb923e40ad9c8613a073164eca380ab216 @chipbennett committed Jan 25, 2011
Showing with 127 additions and 0 deletions.
  1. +70 −0 cbnet-manage-plugins-donate-link.php
  2. +57 −0 readme.txt
  3. BIN screenshot-1.png
70 cbnet-manage-plugins-donate-link.php
@@ -0,0 +1,70 @@
+<?php
+/*
+ * Plugin Name: cbnet Manage Plugins Donate Link
+ * Plugin URI: http://www.chipbennett.net/wordpress/plugins/cbnet-manage-plugins-donate-link/
+ * Description: Add a Donate link in the plugin_row_meta for each installed plugin on the Manage Plugins page.
+ * Version: 1.0
+ * Author: chipbennett
+ * Author URI: http://www.chipbennett.net/
+ *
+ * License: GNU General Public License, v2 (or newer)
+ * License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Thanks to andreasnrb for his assistance (and patience)
+ * with this plugin. And thanks also to all the other fine folks at the
+ * WPTavern Forum (http://www.wptavern.com/forum) for their help.
+ */
+
+class cbnetmpdl{
+ function cbnetmpdl(){
+ if(is_admin()){
+ add_filter('plugin_row_meta',array(&$this,'cbnet_display_donate_link'),99,2);
+ }
+ }
+
+ function cbnet_display_donate_link($links,$plugin_file){
+ $donate_link_already_exists = 'false';
+ $existing_links = $links;
+ foreach ($existing_links as $link){
+ if( $donate_link_already_exists == 'false' ) {
+ $other_donate_link = ( strpos(strtolower(trim($link)),'donate') !== false ? 'true' : 'false' );
+ if( $other_donate_link == 'true' ){
+ $donate_link_already_exists = 'true';
+ }
+ }
+ }
+ if( $donate_link_already_exists == 'false' ) {
+ $donate_uri = false;
+ $readmeFile = WP_PLUGIN_DIR.'/'.dirname($plugin_file).'/readme.txt';
+ if(file_exists($readmeFile)){
+ $readme = file($readmeFile,FILE_SKIP_EMPTY_LINES);
+ foreach ($readme as $line){
+ $donate_link_exists = ( stripos($line , 'donate' ) !== false ? 'true' : 'false' );
+ if( $donate_link_exists == 'true' ){
+ $donate_uri=trim(substr($line,strpos($line,':')+1));
+ $donate_link_text = 'Donate';
+ break;
+ }
+ }
+ }
+ if ( $donate_uri !== false) {
+ $donate_link = '<a href="' . $donate_uri . '" target="_blank">' . $donate_link_text . '</a>';
+ $links[] = $donate_link;
+ }
+ }
+ return $links;
+ }
+
+}
+new cbnetmpdl();
+?>
57 readme.txt
@@ -0,0 +1,57 @@
+=== cbnet Manage Plugins Donate Link ===
+Contributors: chipbennett
+Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QP3N9HUSYJPK6
+Tags: cbnet, plugin, plugins, manage, readme, readme.txt, Donate, Donate link, Donate URI
+Requires at least: 2.9
+Tested up to: 3.0.3
+Stable tag: 1.0
+
+Add a Donate link in the plugin_row_meta for each installed plugin on the Manage Plugins page.
+
+== Description ==
+
+This plugin provides a quick and convenient means to access the plugin author's Donate link for all installed plugins, by adding a 'Donate' link in the plugin_row_meta for each plugin on the Manage Plugins page. The link displays the Donate link from the plugin's readme.txt header information.
+
+This plugin is useful for WordPress users who wish to support plugin developers' work by sending donations, but who find it inconvenient and/or tedious to browse each plugin's wordpress.org Extend listing in order to find each plugin author's Donate link. Once this plugin is installed, all plugins for which the author has defined a Donate link will have that link appear in their listing on the Manage Plugins page in the Admin UI.
+
+== Installation ==
+
+Manual installation:
+
+1. Upload the `cbnet-manage-plugins-donate-link` folder to the `/wp-content/plugins/` directory
+
+Installation using "Add New Plugin"
+
+1. From your Admin UI (Dashboard), use the menu to select Plugins -> Add New
+2. Search for 'cbnet Manage Plugins Donate Link'
+3. Click the 'Install' button to open the plugin's repository listing
+4. Click the 'Install' button
+
+Activiation and Use
+
+1. Activate the plugin through the 'Plugins' menu in WordPress
+2. The plugin requires no configuration.
+
+== Frequently Asked Questions ==
+
+= I'm a plugin author, and I display my own Donate link. =
+
+The plugin checks to determine if a "Donate" link exists in plugin_row_meta. If such a link exists (e.g. because your plugin already filters plugin_row_meta to add your own Donate link), then this plugin doesn't add a duplicate link.
+
+= I'm a plugin author, and I don't want my readme.txt Donate link displayed on the Manage Plugins page. =
+
+Let me know, and I will try to filter for your plugins.
+
+== Screenshots ==
+
+1. **Donate** link added to the meta link list below the plugin description on the Manage Plugins page
+
+== Changelog ==
+
+= 1.0 =
+* Initial Release
+
+== Upgrade Notice ==
+
+= 1.0 =
+Initial Release.
BIN screenshot-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 871b02f

Please sign in to comment.