Changeset 758 for trunk/GoogleSearch
- Timestamp:
- 06/23/08 22:37:23 (17 months ago)
- Location:
- trunk/GoogleSearch/plugins/GoogleSearch
- Files:
-
- 4 added
- 7 modified
-
GoogleSearch.pl (modified) (1 diff)
-
lib/GoogleSearch/L10N.pm (modified) (1 diff)
-
lib/GoogleSearch/L10N/de.pm (added)
-
lib/GoogleSearch/L10N/en_us.pm (modified) (1 diff)
-
lib/GoogleSearch/L10N/es.pm (added)
-
lib/GoogleSearch/L10N/fr.pm (added)
-
lib/GoogleSearch/L10N/ja.pm (modified) (1 diff)
-
lib/GoogleSearch/L10N/nl.pm (added)
-
php/block.mtgooglesearch.php (modified) (4 diffs)
-
php/function.mtgooglesearchresult.php (modified) (2 diffs)
-
tmpl/config.tmpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/GoogleSearch/plugins/GoogleSearch/GoogleSearch.pl
r155 r758 1 # Movable Type (r) Open Source (C) 2005-2008 Six Apart, Ltd. 2 # This program is distributed under the terms of the 3 # GNU General Public License, version 2. 4 # 5 # $Id: GoogleSearch.pl 1174 2008-01-08 21:02:50Z bchoate $ 6 1 7 # GoogleSearch plugin for Movable Type 2 8 # Author: Six Apart (http://www.sixapart.com) 3 # Released under the Artistic License 4 # 5 # $Id: GoogleSearch.pl 32163 2006-06-23 14:05:22Z ytakayama $ 9 # Released under the Artistic and GPLv2 License 6 10 7 11 package MT::Plugin::GoogleSearch; -
trunk/GoogleSearch/plugins/GoogleSearch/lib/GoogleSearch/L10N.pm
r44 r758 1 # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. 2 # This program is distributed under the terms of the 3 # GNU General Public License, version 2. 4 # 5 # $Id: L10N.pm 1174 2008-01-08 21:02:50Z bchoate $ 6 1 7 # GoogleSearch plugin for Movable Type 2 8 # Author: Six Apart (http://www.sixapart.com) 3 # Released under the Artistic License 4 # 5 # $Id: L10N.pm 30952 2006-06-13 09:20:43Z jallen $ 9 # Released under the Artistic and GPLv2 License 6 10 7 11 package GoogleSearch::L10N; -
trunk/GoogleSearch/plugins/GoogleSearch/lib/GoogleSearch/L10N/en_us.pm
r44 r758 1 # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. 2 # This program is distributed under the terms of the 3 # GNU General Public License, version 2. 4 # 5 # $Id: en_us.pm 1174 2008-01-08 21:02:50Z bchoate $ 6 1 7 # GoogleSearch plugin for Movable Type 2 8 # Author: Six Apart (http://www.sixapart.com) 3 # Released under the Artistic License 4 # 5 # $Id: en_us.pm 30952 2006-06-13 09:20:43Z jallen $ 9 # Released under the Artistic and GPLv2 License 6 10 7 11 package GoogleSearch::L10N::en_us; -
trunk/GoogleSearch/plugins/GoogleSearch/lib/GoogleSearch/L10N/ja.pm
r44 r758 1 # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. 2 # This program is distributed under the terms of the 3 # GNU General Public License, version 2. 4 # 5 # $Id: ja.pm 1174 2008-01-08 21:02:50Z bchoate $ 6 1 7 # GoogleSearch plugin for Movable Type 2 8 # Author: Six Apart (http://www.sixapart.com) 3 # Released under the Artistic License 4 # 5 # $Id: ja.pm 30952 2006-06-13 09:20:43Z jallen $ 9 # Released under the Artistic and GPLv2 License 6 10 7 11 package GoogleSearch::L10N::ja; -
trunk/GoogleSearch/plugins/GoogleSearch/php/block.mtgooglesearch.php
r757 r758 1 1 <?php 2 function smarty_block_MTGoogleSearch($args, $content, &$ctx, &$repeat) { 2 # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. 3 # This program is distributed under the terms of the 4 # GNU General Public License, version 2. 5 # 6 # $Id$ 7 8 function smarty_block_mtgooglesearch($args, $content, &$ctx, &$repeat) { 3 9 $localvars = array('google_result_item', 'google_results', '_result_count'); 4 10 if (!isset($content)) { … … 24 30 $query = $entry['entry_title']; 25 31 } elseif ($args['excerpt']) { 26 $query = smarty_function_ MTEntryExcerpt(array(), $ctx);32 $query = smarty_function_mtentryexcerpt(array(), $ctx); 27 33 } elseif ($args['keywords']) { 28 34 $query = $entry['entry_keywords']; 35 } elseif ($args['tags']) { 36 $query = ""; 37 $tags = $ctx->mt->db->fetch_entry_tags(array('entry_id' => $entry['entry_id'], 'blog_id' => $blog->id)); 38 if (isset($tags)) { 39 foreach($tags as $tag) { 40 $query .= '"'.$tag['tag_name'].'" '; 41 } 42 } 29 43 } else { 30 44 $query = $args['query']; 31 45 } 32 46 47 if ($query == '') { 48 $query = $entry['entry_title']; 49 } 50 33 51 global $mt; 34 $lang = $mt->config ['DefaultLanguage'];52 $lang = $mt->config('DefaultLanguage'); 35 53 if ($lang == 'ja') { 36 $charset = $mt->config ['PublishCharset'];54 $charset = $mt->config('PublishCharset'); 37 55 $query = mb_convert_encoding($query, 'utf-8', $charset); 38 56 } … … 52 70 } 53 71 else { 54 return $ctx->error('You need a Google API key to use < MTGoogleSearch>');72 return $ctx->error('You need a Google API key to use <mtgooglesearch>'); 55 73 } 56 74 } 57 75 58 $wsdl = new SOAP_WSDL( $mt->config['PHPDir'].DIRECTORY_SEPARATOR."plugins".DIRECTORY_SEPARATOR."GoogleSearch.wsdl");76 $wsdl = new SOAP_WSDL(dirname(__FILE__).DIRECTORY_SEPARATOR."GoogleSearch.wsdl"); 59 77 $proxy = $wsdl->getProxy(); 60 78 $result = $proxy->doGoogleSearch( … … 78 96 } else { 79 97 // We have proper search results 80 foreach ($result->resultElements as $index => $item) { 81 $summary = $item->summary; 82 $url = $item->URL; 83 $snippet = $item->snippet; 84 $title = $item->title; 98 if ($result->resultElements) { 99 foreach ($result->resultElements as $index => $item) { 100 $summary = $item->summary; 101 $url = $item->URL; 102 $snippet = $item->snippet; 103 $title = $item->title; 85 104 86 $set = array(87 'summary' => $summary,88 'URL' => $url,89 'snippet' => $snippet,90 'title' => $title91 );105 $set = array( 106 'summary' => $summary, 107 'URL' => $url, 108 'snippet' => $snippet, 109 'title' => $title 110 ); 92 111 93 $google_results[] = $set; 112 $google_results[] = $set; 113 } 94 114 } 95 115 $ctx->stash('google_results', $google_results); -
trunk/GoogleSearch/plugins/GoogleSearch/php/function.mtgooglesearchresult.php
r757 r758 1 1 <?php 2 function smarty_function_MTGoogleSearchResult($args, &$ctx) { 2 # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. 3 # This program is distributed under the terms of the 4 # GNU General Public License, version 2. 5 # 6 # $Id$ 7 8 function smarty_function_mtgooglesearchresult($args, &$ctx) { 3 9 $result = $ctx->stash('google_result_item'); 4 10 $prop = $args['property']; … … 8 14 9 15 global $mt; 10 $lang = $mt->config ['DefaultLanguage'];16 $lang = $mt->config('DefaultLanguage'); 11 17 if ($lang == 'ja') { 12 $charset = $mt->config ['PublishCharset'];18 $charset = $mt->config('PublishCharset'); 13 19 $s = mb_convert_encoding($result[$prop], $charset, 'utf-8'); 14 20 }else{ -
trunk/GoogleSearch/plugins/GoogleSearch/tmpl/config.tmpl
r93 r758 1 <div class="setting"> 2 <div class="label"> 3 <label for="google_api_key"><MT_TRANS phrase="Google API Key:"></label> 4 </div> 5 <div class="field"> 1 <mtapp:setting 2 id="google_api_key" 3 label="<__trans phrase="Google API Key">" 4 hint="<__trans phrase="If you wish to use any of the Google API functionality, you will need a Google API key. Paste it in here.">"> 6 5 <input type="text" name="google_api_key" id="google_api_key" value="<TMPL_VAR NAME=GOOGLE_API_KEY ESCAPE=HTML>" /> 7 <p><MT_TRANS phrase="If you wish to use any of the Google API functionality, you will need a Google API key. Paste it in here."></p> 8 </div> 9 </div> 6 </mtapp:setting>
