Changeset 406612
- Timestamp:
- 07/08/2011 07:15:37 AM (15 years ago)
- Location:
- external-related-posts/trunk
- Files:
-
- 2 added
- 2 deleted
- 3 edited
-
ExternalRelatedPosts.php (deleted)
-
class-external-related-posts-options.php (added)
-
class-external-related-posts.php (added)
-
external-related-posts.php (modified) (1 diff)
-
license.txt (deleted)
-
readme.txt (modified) (7 diffs)
-
screenshot-2.jpg (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
external-related-posts/trunk/external-related-posts.php
r291505 r406612 2 2 /* 3 3 Plugin Name: External Related Posts 4 Plugin URI: http:// www.gabrielkoen.com/wordpress/wordpress-plugins/external-related-posts/4 Plugin URI: http://gabrielkoen.com/wordpress-plugins/external-related-posts/ 5 5 Description: Grabs related links from Google Blog Search, inserts a link to them into your post and gives them a pingback. 6 Version: 1. 16 Version: 1.2 7 7 Author: Gabriel Koen 8 Author URI: http://www.gabrielkoen.com/ 8 Author URI: http://gabrielkoen.com/ 9 License: GPL2 9 10 */ 10 11 11 if( !class_exists( 'ExternalRelatedPosts' ) ) { 12 require_once('ExternalRelatedPosts.php'); 12 /* Copyright 2011 Gabriel Koen (email : gabriel.koen@gmail.com) 13 14 This program is free software; you can redistribute it and/or modify 15 it under the terms of the GNU General Public License, version 2, as 16 published by the Free Software Foundation. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 */ 27 28 // Plugin is not needed when doing ajax calls 29 if ( !defined('DOING_AJAX') || !DOING_AJAX ) { 30 // Plugin directory needs to be the same as the plugin filename 31 $plugin_path = dirname( __FILE__ ); 32 33 include_once $plugin_path . '/class-external-related-posts-options.php'; 34 add_action('plugins_loaded', 'external_related_posts_options_loader'); 35 36 include_once $plugin_path . '/class-external-related-posts.php'; 37 add_action('plugins_loaded', 'external_related_posts_loader'); 13 38 } 14 39 15 if( class_exists( 'ExternalRelatedPosts' ) ) { 16 set_time_limit(0); 17 $external_related_posts = new ExternalRelatedPosts; 18 register_activation_hook(__FILE__, array(&$external_related_posts, 'activate')); 19 add_action('publish_post', array(&$external_related_posts, 'save_post')); 20 add_action('admin_menu', 'erp_admin_menu'); 21 add_action('admin_init', 'erp_admin_init'); 40 /** 41 * For loading ExternalRelatedPosts via WordPress action 42 * 43 * @since 1.2 44 * @version 1.2 45 */ 46 function external_related_posts_loader() { 47 new ExternalRelatedPosts(); 48 } 22 49 23 function erp_admin_menu() { 24 add_options_page("External Related Posts Settings", "External Related Posts", 1, __FILE__, "erp_settings_admin"); 25 } 50 /** 51 * For loading ExternalRelatedPosts_Options via WordPress action 52 * 53 * @since 1.2 54 * @version 1.2 55 */ 56 function external_related_posts_options_loader() { 57 ExternalRelatedPosts_Options::instance(); 58 } 26 59 27 function erp_admin_init() { 28 register_setting('erp_settings', 'erp_options', 'erp_settings_validate'); 29 } 30 31 function erp_settings_validate($options) { 32 global $wpdb; 33 34 $erp_related_links_title = trim($options['erp_related_links_title']); 35 36 $erp_related_links_title_current = $options['erp_related_links_title_current']; 37 $update_titles = $options['update_titles']; 38 39 if( !empty($erp_related_links_title) && $erp_related_links_title != $erp_related_links_title_current && $update_titles=='true' ) { 40 $sql = "UPDATE " . $wpdb->prefix . "posts SET post_content=REPLACE(post_content,'" . $wpdb->escape($erp_related_links_title_current) . "','" . $wpdb->escape($erp_related_links_title) . "') WHERE post_type='post' AND post_status='publish'"; 41 42 $wpdb->query( $sql ); 43 } 44 45 return $options; 46 } 47 48 function erp_settings_admin() { 49 $options = get_option('erp_options'); 50 ?> 51 <div class="wrap"> 52 <h2>External Related Posts Settings</h2> 53 <form name="erp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 54 <?php settings_fields('erp_settings'); ?> 55 <p>Related links title: 56 <input type="text" name="erp_options[erp_related_links_title]" value="<?php echo $options['erp_related_links_title']; ?>" /><br /> 57 <i>Example: <h4>Related External Links<h4></i><br /> 58 <input type="checkbox" name="update_titles" value="true" checked="checked" /><input type="hidden" name="erp_related_links_title_current" value="<?php echo $erp_related_links_title; ?>" /> Update existing posts with the new title 59 </p> 60 <p>Use: 61 <input type="radio" name="erp_options[erp_use]" value="tag" <?php checked('tag', $options['erp_use']); ?> /> Tag 62 <input type="radio" name="erp_options[erp_use]" value="title" <?php checked('title', $options['erp_use']); ?> /> Title 63 <input type="radio" name="erp_options[erp_use]" value="category" <?php checked('category', $options['erp_use']); ?> /> Category</p> 64 <br /> 65 66 <p>Chance of Running: 67 <input type="radio" name="erp_options[erp_chance]" value="0" <?php checked('0', $options['erp_chance']); ?> /> 0% 68 <input type="radio" name="erp_options[erp_chance]" value="25" <?php checked('25', $options['erp_chance']); ?> /> 25% 69 <input type="radio" name="erp_options[erp_chance]" value="50" <?php checked('50', $options['erp_chance']); ?> /> 50% 70 <input type="radio" name="erp_options[erp_chance]" value="100" <?php checked('100', $options['erp_chance']); ?> /> 100%</p> 71 <br /> 72 <p>Maximum number of links to show: <input type="text" name="erp_options[erp_max_links]" size="6" value="<?php echo $options['erp_max_links']; ?>" /> 73 <p>Number of results to get from Blog Search: <input type="text" name="erp_options[erp_results]" size="6" value="<?php echo $options['erp_results']; ?>" /><br /> 74 <i>This slows down posting, but ensures that every link returned accepts pingbacks.</i></p> 75 76 <p>Number of links to make: <input type="text" name="erp_options[erp_linkcount]" size="6" value="<?php echo $options['erp_linkcount']; ?>" /><br />Note: If using tags or categories, you will get this many links per tag/category. For example, if you set this value to 3 and your post has 2 tags you will get up to 6 links.</p> 77 <br /> 78 <br /> 79 80 <p>Verify blog is accepting pingbacks <input type="checkbox" name="erp_options[erp_verify]" value="true" <?php checked('true', $options['erp_verify']); ?> /></p> 81 82 <p class="submit"><input type="submit" name="Submit" value="Update Options" /></p> 83 </form> 84 <p><strong>Help</strong></p> 85 <p>Note that note every post will return results, so even with External Related Posts activating on every post you publish you may have posts with fewer links and pingbacks than you have set. Because posts just don't exist for your settings, the only way around this is to a) change your External Related Posts settings to use different search criteria (e.g., if you're set to use "tags" then use "category" instead); b) uncheck "verify blog is accepting pingbacks" in the External Related Posts settings; or c) go back and re-publish your post at a later date and hope that someone has a post that matches your criteria. </p> 86 </div> 87 <?php 88 } 89 } 60 //EOF -
external-related-posts/trunk/readme.txt
r291505 r406612 1 1 === External Related Posts === 2 Contributors: Josh Team, Eli of Blue Hat SEO, Contempt, James Clawson and Klint Finley, Mike Gogulski2 Contributors: mintindeed 3 3 Tags: pingback, trackback, automated links, seo, post, related posts 4 Requires at least: 2.8.65 Tested up to: 2.9.26 Stable tag: 1. 14 Requires at least: 3.2 5 Tested up to: 3.2 6 Stable tag: 1.2 7 7 8 8 Grabs related links from Google Blog Search, inserts a link to them into your post and gives them a pingback. … … 10 10 == Description == 11 11 12 External Related Posts takes either your post title, category or tags and searches Google Blog Search for related blogs. External Related Posts then adds a link to that blog to your post and pings them, letting them know you made a relevant post on their subject. 12 ** This plugin now works! ** It broke shortly after I originally uploaded it last year. People are still downloading it, so I decided to make it work. I revamped it and made it totally compatible with the latest version of WordPress. 13 14 External Related Posts takes the category, tags or custom taxonomy from your post (or custom post type) and searches Google Blog Search for related posts. External Related Posts then adds a link to that blog to your post and pings them, letting them know you made a relevant post on their subject. 13 15 14 16 Controls exist for how many blogs to search for, whether to only post links to blogs that accept pingbacks, how many pingbacks to perform, and a randomizer for how often External Related Posts activates (e.g., every post, 50% of your posts, 25% of your posts). … … 19 21 20 22 == Changelog == 23 = 1.2 = 24 * Updated Google Blog Search URL 25 * Made sure it works with WordPress 3.2 26 * Support for custom taxonomies 27 * Support for custom post types 28 * No longer requires its own table, now stores its cache in the WordPress options table 29 21 30 = 1.1 = 22 31 * Final update … … 32 41 = The links I'm getting suck, they're barely relevant at all. = 33 42 34 External Related Posts uses either your post's tags, categories, or title to search for related blogs. Try changing your tags, categories or title -- this will also change the results you get. Alternatively, change the External Related Posts settings so that it uses something different for the blog search. 35 36 Also try turning off the "Verify blog is accepting pingbacks" option. You may not get a pingback but your link quality will likely go up. 43 External Related Posts uses either your post's tags, categories, or title to search for related blogs. Try changing your tags, categories or title -- this will also change the results you get. 37 44 38 45 … … 43 50 * Chance of running 44 51 External Related Posts contains a setting that determines how frequently it runs. If "Chance of running" is not 100%, then not every post will activate External Related Posts. 45 * Use tags, categories, or title46 External Related Posts uses either your post's tags, categories, or titleto search for related blogs. If you're not getting many results, try changing which one you use.52 * Use tags, categories, or a custom taxonomy 53 External Related Posts uses either your post's tags, categories, or custom taxonomy to search for related blogs. If you're not getting many results, try changing which one you use. 47 54 * Search criteria 48 Try using different tags/categories/t itle. For example, if External Related Posts is searching by tags, try changing which tags you're using. Do your own manual Google Blog Search with your terms and see what results come up.55 Try using different tags/categories/taxonomy term. For example, if External Related Posts is searching by tags, try changing which tags you're using. Do your own manual Google Blog Search with your terms and see what results come up. 49 56 * Verify blog is accepting pingbacks 50 Not every blog accepts pingbacks. If you have this setting checked, try unchecking it.You may not get pingbacks, but you will get links.57 Not every blog accepts pingbacks. You may not get pingbacks, but you will get links. 51 58 * Wait a few days and try again 52 59 Google Blog Search is always indexing new posts. If you're not getting any results, go back and re-publish your post at a later date and hope that someone has a post that matches your criteria. … … 56 63 = Why does it take so long to post articles now? = 57 64 58 External Related Posts needs to fetch and process a lot of web pages in order to do its job.65 External Related Posts needs to fetch and process Google search results in order to do its job. 59 66 60 67 = Why do I get a "Page not found" error when posting? = … … 65 72 66 73 * Increase PHP's `max_execution_time` and/or `memory_limit` in your php.ini, or 67 * reduce the "Maximum number of links to show", "Number of results to get from Blog Search", Number of links to make", and/or "Verify blog is accepting pingbacks".74 * Reduce the "Number of links to make" 68 75 69 76 = How can I prevent External Related Posts from running on a given post? =
Note: See TracChangeset
for help on using the changeset viewer.