PDA

View Full Version : Remove some single special character in url, like [, ], *, and others



basketmen
03-11-10, 01:27
Hi guys, need some help here


in vbseocp.php --> Character Replacement --> i set Replace Non-English Characters in URLs?, to Keep Non-English Characters in URLS like the vbet installation instruction


in the default language (english) i need to remove some characters that dont needed in urls, like [, ], * and other single character, because i am not comfort with these single character in the default language (english)



please help guys how to remove these single characters in url in the default language (english), but still using "Keep Non-English Characters in URLS" option






i tried to add [ and ] and * character in vbseocp.php --> Define Stopwords but its not working, or can its removed from vbseocp.php --> Define your Custom Character Replacements?

OR

if there is conditional code to "Replace Non-English Characters in URLs?" for default language only and "Keep Non-English Characters in URLS" for other languages" for other languages, maybe we can set the conditional code in vbseo/resources/xml/config.xml something like this just for example
if ($vbetlang==default)
{
Replace Non-English Characters in URLs?
}
if ($vbetlang!=default)
{
Keep Non-English Characters in URLS for other languages
}

basketmen
03-11-10, 01:45
for the first way i already know how to do it, thanks for Andrés Durán Hewitt in vbseo forum :


Hello,

You still can define character replacements regardless the 'Keep Non-English Characters in URLs' option. Please try to define the following custom characters replacements:



'['=>''
']'=>''
'*'=>''
And let me know how it goes.

Best regards.






but it is better if we can using the second way above, please let us know if anyone have information about that conditional, and i suggest you using the first way above if you using english/latin as default language (as almost we all use it)

vBET
04-11-10, 19:58
I'm reading it carefully now and give you answer soon :)

basketmen
04-11-10, 20:17
the example like this thread self url



http://www.vbenterprisetranslator.com/forum/general-discussions/1158-remove-some-single-special-character-url-like-%5B-%5D-%2A-others.html

it is better the url like this, Removed the special character [, ], and * in bold above, better for english forum


http://www.vbenterprisetranslator.com/forum/general-discussions/1158-remove-some-single-special-character-url-like-others.html




other urls example, that have some special character in the title and in the url
[Language: $language Do not add language BBCodes] in Quick Reply (http://www.vbenterprisetranslator.com/forum/feature-requests/73-%5Blanguage-%24language-do-not-add-language-bbcodes%5D-quick-reply.html)
&goto=newpost links don't redirect properly (http://www.vbenterprisetranslator.com/forum/bug-reporting/1135-goto%3Dnewpost-links-dont-redirect-properly.html)
langtitle=sk]F.. bug? (http://www.vbenterprisetranslator.com/forum/bug-reporting/755-langtitle%3Dsk%5Df-bug.html)
Showthread.php?p=x not rewritten (http://www.vbenterprisetranslator.com/forum/troubleshooting/1069-showthread-php-p%3Dx-not-rewritten.html)
"vbet_ flag-" issue (http://www.vbenterprisetranslator.com/forum/bug-reporting/265-vbet_-flag-issue.html)
Having 2 lang= bbcode... (http://www.vbenterprisetranslator.com/forum/bug-reporting/54-having-2-lang%3D-bbcode.html)

vBET
04-11-10, 20:37
OK so - you can do that also by vBET file:
1. Open vbenterprisetranslator_seo.php
2. Find:


$vbet_custom_char_replacement = array(
'"' => '',
'[langtitle=' => '',
'[/langtitle]' => '',
']' => '-'
);

3. Add there pairs similarly to vBSEO

You will have to add it again after each update, since your changes will be overwritten. So keeping it in vBSEO custom replacements seems to be better idea.

About your 2nd proposition. Such condition would look like this:


if ($_REQUEST['language'])
{
Keep Non-English Characters in URLS for other languages
} else {
Replace Non-English Characters in URLs?
}

We didn't test such solution so we advice to do this on some test instance not on real forum and check how it behaves. I do not believe it will work - I suppose that from config it taken simply value and attached to variable, so variable would treat this just as string value. I suppose - not tested. So such change should be tone in other place in place where variable takes value you could do:


$theVariable = $_REQUEST['language'] ? value for Keep Non-English : value for Replace Non-English


If variable is global (and if it is variable not constant) then you can overwrite it in /includes/vbenterprisetranslator_functions_seo.php file. There are 2 places where you have code like this:


if ($language) {
$text = vbet_filter_replace_text($text, VBSEO_SPACER, VBSEO_APPEND_CHAR);
} else {
$text = vbseo_filter_text($text, $allowcharsl, $filter_stop_words, $reversablee, $keep_tailspaces);
}

So you can change global variable value in else statement, before text is evaluated.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Integration with translations by vBET Translator 4.10.1