Options configuration panel Version: 4.4 Author: AskApache Author URI: http://www.askapache.com */ /* == Installation == 1. Upload zip to the /wp-content/plugins/ directory 2. Unzip into its own folder /wp-content/plugins/askapache-google-404/askapache-google-404.php 3. Activate the plugin through the 'Plugins' menu in WordPress by clicking "AskApache Google 404" 4. Go to your Options Panel and open the "AskApache Google 404" submenu. /wp-admin/options-general.php?page=askapache-google-404.php 5. Enter in your google Ajax API Key and hit "Update" Button. 6. Add the code to your 404.php template page by including in your main content area. */ /* /--------------------------------------------------------------------\ | | | License: GPL | | | | AskApache Google 404 Plugin - Adds Ajax Powered Search to 404 Page | | Copyright (C) 2007, AskApache, www.askapache.com | | All rights reserved. | | | | 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. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the | | Free Software Foundation, Inc. | | 51 Franklin Street, Fifth Floor | | Boston, MA 02110-1301, USA | | | \--------------------------------------------------------------------/ */ $aa_disallowed_words=array('about','after','ago','all','almost','along','alot','test','also','and','answer','any','anybody','anybodys','anywhere','are','arent','around','askd','because','been','before','being','best','better','between','big','btw','but','can','come','could','couldnt','did','didnt','does','doesnt','dont','etc','either','ever','everybody','everybodys','everyone','far','for','found','game','going','good','got','gotten','had','has','have','havent','having','her','here','hers','him','his','how','hows','ive','isnt','its','just','know','large','less','like','liked','little','looking','look','looked','looking','lot','maybe','many','more','most','much','must','mustnt','near','need','never','new','news','none','not','nothing','now','off','often','old','once','only','oops','other','our','ours','out','over','please','put','question','questions','questioned','quote','rather','really','recent','said','saw','say','says','she','see','sees','should','small','some','something','sometime','somewhere','soon','take','than','thank','that','thatd','thats','the','their','theirs','theres','theirs','them','then','there','these','they','theyll','theyd','theyre','this','those','though','through','thus','too','under','until','untrue','upon','very','via','want','was','way','well','went','were','werent','what','when','where','which','whom','whose','why','wide','will','with','within','without','wont','world','worse','worst','would','wrote','yes','yet','you','youd','youll','your','youre','yours'); // aa_google_404_options_setup //--------------------------- function aa_google_404_options_setup() { global $aa_G404; add_options_page($aa_G404['plugin_data']['Name'], 'AA Google 404', 8, basename(__FILE__), 'aa_google_404_page'); }//===================================================================================== // aa_google_404 //--------------------------- function aa_google_404(){ $aa_google_404_code_html = get_option('aa_google_404_code_html'); echo '

Related Pages to the Request

'; aa_related_posts_404(2,40); echo $aa_google_404_code_html; echo '

More Related Pages to the Request

'; aa_related_posts_404(6,60); }//===================================================================================== // aa_google_404_page //--------------------------- function aa_google_404_page() { global $aa_G404,$aa_google_404_api_key,$aa_google_404_code_js,$aa_google_404_code_css,$aa_google_404_code_html,$aa_status; if (! user_can_access_admin_page()) wp_die( __('You do not have sufficient permissions to access this page.') ); ?>

[ : - : - : ]



" method="post">












More Info from Google



Successfully Updated Code.

'; if(isset($_POST['aaresetgooglecode'])) { aa_google_404_activate(); $aa_status = '

Successfully Reset Plugin Options.

'; } } if(strpos($aa_google_404_api_key, 'askapache')!==false){ $aa_status = '

Warning: You need to get a free Google API Key before this plugin will fully work.

'; } $aa_google_404_code_html = get_option('aa_google_404_code_html'); $aa_google_404_code_js = get_option('aa_google_404_code_js'); $aa_google_404_code_css = get_option('aa_google_404_code_css'); $aa_google_404_api_key = get_option('aa_google_404_api_key'); $aa_label='+askapache'; $aa_execute=aa_get_keywords('|'); $aa_mysite=str_replace('www.','',$_SERVER['HTTP_HOST']); echo "\n\n".''."\n"; echo ''; echo "\n".''."\n"; echo $aa_google_404_code_js; echo $aa_google_404_code_css; echo "\n".''."\n\n"; }//===================================================================================== // aa_google_404_header //--------------------------- function aa_google_404_header(){ global $aa_google_404_api_key,$aa_google_404_code_js,$aa_google_404_code_css,$aa_google_404_code_html; $fixold=array('aalabel','aamysite','aaexecute'); $fixnew=array('aa_LABEL','aa_MYSITE','aa_XX'); if(is_404()) { $aa_google_404_code_html = get_option('aa_google_404_code_html'); $aa_google_404_code_js = get_option('aa_google_404_code_js'); $aa_google_404_code_css = get_option('aa_google_404_code_css'); $aa_google_404_api_key = get_option('aa_google_404_api_key'); $aa_google_404_code_js=str_replace($fixold,$fixnew,$aa_google_404_code_js); $aa_google_404_code_html=str_replace($fixold,$fixnew,$aa_google_404_code_html); $aa_label=get_option('blogname'); $aa_execute=aa_get_keywords('|',6); $aa_best_guess_keywords=aa_get_keywords(' ',2); $aa_best_guess='OR allinurl:'.$aa_best_guess_keywords; $aa_mysite=str_replace('www.','',$_SERVER['HTTP_HOST']); echo "\n\n".''."\n"; echo ''; echo "\n".''."\n"; echo $aa_google_404_code_js; echo $aa_google_404_code_css; echo "\n".''."\n\n"; } }//===================================================================================== // aa_related_posts_404 //--------------------------- function aa_related_posts_404($limit,$len,$class='relinkt') { global $wpdb; $terms=aa_get_keywords(' '); $time_difference = get_settings('gmt_offset'); $now = gmdate("Y-m-d H:i:s",(time()+($time_difference*3600))); $sql = "SELECT ID, post_title, post_content," . "MATCH (post_name, post_content) " . "AGAINST ('$terms') AS score " . "FROM $wpdb->posts WHERE " . "MATCH (post_name, post_content) " . "AGAINST ('$terms') " . "AND post_date <= '$now' " . "AND (post_status IN ( 'publish', 'static' )) AND post_password ='' "; $sql .= "ORDER BY score DESC LIMIT $limit"; $results = $wpdb->get_results($sql); if(!empty($class))$output = "