Jump to content
  • 0

pomoc Google Translator + NoFollow all


Hashiri

Dotaz

Zdravím,

na svých stránkách jsem se rozhodl vyměnit Microsoft transtalor za Google translator, jen bych se chtěl zeptat na tento kód:

openside("Translate");
echo "<div id=\"google_translate_element\"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'cz,sk'
}, 'google_translate_element');
}
</script><script src=\"//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit\"></script>";
closeside();

 

Přesnějí řádek:

pageLanguage: 'cz,sk'

Jestli to takhle může být a jestli se budou stránky cz i sk ignorovat a či nenastanou nějaké problémy. (PHP je pro mě španělská vesnice).

Dále bych potřeboval všechny externí odkazy opatřit nofollow atributem bohužel však jsou odkazy i v iframe/javascriptu tudíž ho tímto atributem nemohu opatřit jen tak,

chtěl bych se tedy zeptat jestli se nedají všechny externí odkazy omezit(Funkce nofollow) či nějak tento atribut těmto odkazům přiřadit, 1 a půl jsem hledal na google avšak bez úspěchu.

Jedná se o RS: PHP-Fusion 7.02.xx

Předem děkuji za reakci.

Link to comment
Share on other sites

2 odpovědí na tuto otázku

Recommended Posts

  • 0

Prvni cast nechapu a s google translate jsem nikdy nedelal :)

 

To, co chces v druhe casti je mozne, ale spomali to nacitani webu. Muzes si chytnout cely output buffer a v nem pote upravit vsechny odkazy.

 

Jeste zvaz, jestli to opravdu chces pouzit, protoze, jak uz jsem rikal, spomalis si web a navic se to pri updatu PHP-Fusionu rozbije. Chces-li to opravdu pouzit, zkus index.php vymenit za tento kus kodu:

 

<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: index.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
ob_start();
require_once "maincore.php";
redirect($settings['opening_page']);
mysql_close($db_connect);
$content = ob_get_clean();
preg_match_all("/<a[^>]+>/", $content, $matches);
foreach($matches[0] as $match) {
$content = str_replace($match, add_nofollow($match), $content);
}
// print contents
echo($content);
function add_nofollow($content) {
$content =
preg_replace_callback('~<(a\s[^>]+)>~isU', "cb2", $content);
return $content;
}
function cb2($match) {
list($original, $tag) = $match; // regex match groups
$domain = "mujweb.cz";

if (strpos($tag, "nofollow")) {
 return $original;
} else if(strpos($tag, $domain)) {
 return $original;
} else {
 return "<$tag rel='nofollow'>";
}
}

 

EDIT: nejak mi to tady zprehazelo formatovani, opravovat to nebudu. Nezapomen nahradit "mujweb.cz" za domenu Tveho webu

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...