vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - vB Global Translator - Multiply your indexed pages & put search traffic on autopilot (https://vborg.vbsupport.ru/showthread.php?t=217329)

burlesque 06-30-2009 07:19 PM

Quote:

Originally Posted by NLP-er (Post 1840328)
In such case cache is an issue here. Can you PM to me some more details? I will gladly see what is gooing on :)

PM Sent :)

music legend 06-30-2009 07:52 PM

Quote:

Originally Posted by burlesque (Post 1840334)
PM Sent :)

let me know if yall figure out the problem because im sure its the same one i am having

Dave Hybrid 06-30-2009 08:25 PM

v2.1

* Meta description and meta keywords now translated in the output source code, better for SEO and search engine indexing
* Note no change to files

To update just replace your vB Global Translator plugin code with what is below.

Also change the Execution Order: to 50

Code:

// Enable UTF-8 characters
if(isset($_GET['hl'])) {
$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);
    }
 require_once("translate.php");
$output=callback($output);
// Place back remainders of <style and <script tags!
    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);
    }

// Translate META tags.
preg_match_all("|<meta[^>]+name=\"([^\"]*)\"[^>]" . "+content=\"([^\"]*)\"[^>]+>|i",$output, $out,PREG_PATTERN_ORDER);
$meta = array();
for ($i=0;$i < count($out[1]);$i++) {
        if (strtolower($out[1][$i]) == "keywords") $meta['keywords'] = $out[2][$i];
        if (strtolower($out[1][$i]) == "description") $meta['description'] = $out[2][$i];
    }

// Start replacing the original META tags with translated tags.
$output=str_replace("<meta name=\"description\" content=\"".$meta['description']."\" />","<meta name=\"description\" content=\"".html_entity_decode(callback($meta['description']))."\" />",$output);
$output=str_replace("<meta name=\"keywords\" content=\"".$meta['keywords']."\" />","<meta name=\"keywords\" content=\"".html_entity_decode(callback($meta['keywords']))."\" />",$output);
}


Sweeks 06-30-2009 08:37 PM

Nice one this mod just keeps getting better :up:

Dave Hybrid 06-30-2009 08:39 PM

Thank you, more to come. ;P

Dave Hybrid 06-30-2009 08:40 PM

Quote:

Originally Posted by NLP-er (Post 1840328)
In such case cache is an issue here. Can you PM to me some more details? I will gladly see what is gooing on :)

Thanks for helping out. :up:

Sweeks 06-30-2009 08:42 PM

Maybe throw in that API key option just to put everyone at peace if it doesnt have a performance hit :)

Geraldm 06-30-2009 09:44 PM

Hi just tried v2.1 and it's not translating the meta keywords or meta Description as described??

Dave, you know my forum as I've PMed you it in the past ... can you please take a look? :)

Thanks,
Gerald.

Dave Hybrid 06-30-2009 09:51 PM

Quote:

Originally Posted by Geraldm (Post 1840406)
Hi just tried v2.1 and it's not translating the meta keywords or meta Description as described??

Dave, you know my forum as I've PMed you it in the past ... can you please take a look? :)

Thanks,
Gerald.

You pasted the new plugin code and changed the Execution order?

PM me the url again please.

Dave Hybrid 06-30-2009 09:58 PM

Quote:

Originally Posted by Geraldm (Post 1840406)
Hi just tried v2.1 and it's not translating the meta keywords or meta Description as described??

Dave, you know my forum as I've PMed you it in the past ... can you please take a look? :)

Thanks,
Gerald.

I managed to find your old PM, it looks fine to me mate.


All times are GMT. The time now is 07:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01412 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete