
06-30-2009, 12:31 AM
|
|
|
Join Date: Jul 2008
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by T2x
Hey dave, very nice plugin.
I figured it out for you
Code:
<!--notranslatestart-->
Do not translate this text
<!--notranslateend-->
That is the syntax.
Change the plugin code to the following:
Code:
// Enable UTF-8 characters
if(isset($_GET['hl'])) {
require_once("translate.php");
$output = str_replace('lang="en"', 'lang="'.$_GET['hl'].'"', $output);
header ('Content-type: text/html; charset=utf-8');
// Keep remainders of <style and <script tags!
$time = time(); // Unique Tag Identifier!
preg_match_all('|<script[^>]*>(.*?)</script>|si', $output,$scripttags, PREG_SET_ORDER);
for($i=0;$i<count($scripttags);$i++)
{
$output = str_replace($scripttags[$i][0], "<a name=\"$i\"></a>",$output);
}
//preg_match_all("<style[^>]*>.*</style>",$buffer,$styletags);
preg_match_all('|<style[^>]*>(.*?)</style>|si',$output,$styletags);
for($i=0;$i<count($styletags);$i++)
{
$output = str_replace($styletags[1][$i], "<a name=\"s$i\"></a>",$output);
}
preg_match_all('|<!--notranslatestart-->(.*?)<!--notranslateend-->|si', $output,$notranslatetags, PREG_SET_ORDER);
for($i=0;$i<count($notranslatetags);$i++)
{
$output = str_replace($notranslatetags[$i][0], "<a name=\"t$i\"></a>",$output);
}
$output=callback($output);
// Place back remainders of <style and <script tags!
for($i=0;$i<count($styletags);$i++)
{
$output = str_replace("<a name=\"t$i\"></a>", $notranslatetags[$i][0], $output);
}
for($i=0;$i<count($styletags);$i++)
{
$output = str_replace("<a name=\"s$i\"></a>", $styletags[1][$i], $output);
}
for($i=0;$i<count($scripttags);$i++)
{
$output = str_replace("<a name=\"$i\"></a>",$scripttags[$i][0] ,$output);
}
//print_r($scripttags);
//die("c:".count($scripttags).":".count($styletags));
}
Also you are going to make google angry.
You need to add a
Code:
@curl_setopt($ch, CURLOPT_REFERER,"http://$_SERVER[SERVER_NAME]$_SERVER[VBSEO_URI]");
(this is vbseo only code)
according to google.
and adding an api key to the request doesn't hurt.
http://code.google.com/apis/ajaxsearch/signup.html
at http://code.google.com/apis/ajaxlanguage/documentation
it says:
so basically you just change the request to look like this
|
Can you tell us all how to implement this now please
|