I added some new changes o my class to make the class work with eu.wowarmory.com using Spanish, French or German language, and English UK too.
First i use a new lang var
/** * the language items get fetched * courtesy from flokohlert * @var de/en/fr/es */ var $lang = "en";
then
new methods to choose the language
/* * * setlang and getlang for multilanguage suport * en/de/es/fr/uk */ function setlang($l) { switch($l) { case 'de': $this->lang = 'de'; $this->armory = 'http://eu.wowarmory.com/'; break; case 'es': $this->lang = 'es'; $this->armory = 'http://eu.wowarmory.com/'; break;
case 'fr': $this->lang = 'fr'; $this->armory = 'http://eu.wowarmory.com/'; break; case 'uk': $this->lang = 'en'; $this->armory = 'http://eu.wowarmory.com/'; break; }
} /* * GET LANG */ function getlang(){ return $this->lang; }
And the itemNameFetch
function itemnameFetch($itemNAME){
// Fix for the "-" Minux character $itemNAME = str_replace("-", "+ ",$itemNAME); if ($lang != 'en') { // url encode and utf8 for öäëáéíãñ characters $itemNAME = urlencode(utf8_encode($itemNAME)); } $url = $this->armory."search.xml?searchQuery=".str_replace(" ", "+",$itemNAME)."&searchType=items"; //return $this->xmlToArray($this->xmlFetch($url)); $item_ary = $this->xmlToArray($this->xmlFetch($url)); $item_ary_value = $item_ary['armorysearch']['searchresults']['items']['item']; if (is_array($item_ary_value[0])) { foreach($item_ary_value as $x_item) { if (isset($x_item['name'])) { if ($lang != 'en') //again decode the characters to check if item name exist { $x_item['name'] = utf8_decode($x_item['name']); $itemNAME = urldecode(utf8_decode($itemNAME)); } //check if item name. if (strtoupper($x_item['name']) == strtoupper($itemNAME)) $url = $this->armory."item-tooltip.xml?i=".$x_item['id']; } } } else $url = $this->armory."item-tooltip.xml?i=".$item_ary_value['id'];
return $this->xmlToArray($this->xmlFetch($url));
}
for using the data if ($armory->getlang() != 'en') { $item['name'] = utf8_decode($item['name']); }
with my mod for phbbb its working fine.
Log in to post a comment.
I added some new changes o my class to make the class work with eu.wowarmory.com using Spanish, French or German language, and English UK too.
First i use a new lang var
/**
* the language items get fetched
* courtesy from flokohlert
* @var de/en/fr/es
*/
var $lang = "en";
then
new methods to choose the language
/*
*
* setlang and getlang for multilanguage suport
* en/de/es/fr/uk
*/
function setlang($l) {
switch($l)
{
case 'de':
$this->lang = 'de';
$this->armory = 'http://eu.wowarmory.com/';
break;
case 'es':
$this->lang = 'es';
$this->armory = 'http://eu.wowarmory.com/';
break;
case 'fr':
$this->lang = 'fr';
$this->armory = 'http://eu.wowarmory.com/';
break;
case 'uk':
$this->lang = 'en';
$this->armory = 'http://eu.wowarmory.com/';
break;
}
}
/*
* GET LANG
*/
function getlang(){
return $this->lang;
}
And the itemNameFetch
function itemnameFetch($itemNAME){
// Fix for the "-" Minux character
$itemNAME = str_replace("-", "+ ",$itemNAME);
if ($lang != 'en')
{
// url encode and utf8 for öäëáéíãñ characters
$itemNAME = urlencode(utf8_encode($itemNAME));
}
$url = $this->armory."search.xml?searchQuery=".str_replace(" ", "+",$itemNAME)."&searchType=items";
//return $this->xmlToArray($this->xmlFetch($url));
$item_ary = $this->xmlToArray($this->xmlFetch($url));
$item_ary_value = $item_ary['armorysearch']['searchresults']['items']['item'];
if (is_array($item_ary_value[0]))
{
foreach($item_ary_value as $x_item)
{
if (isset($x_item['name']))
{
if ($lang != 'en') //again decode the characters to check if item name exist
{
$x_item['name'] = utf8_decode($x_item['name']);
$itemNAME = urldecode(utf8_decode($itemNAME));
} //check if item name.
if (strtoupper($x_item['name']) == strtoupper($itemNAME))
$url = $this->armory."item-tooltip.xml?i=".$x_item['id'];
}
}
}
else
$url = $this->armory."item-tooltip.xml?i=".$item_ary_value['id'];
return $this->xmlToArray($this->xmlFetch($url));
}
for using the data
if ($armory->getlang() != 'en')
{
$item['name'] = utf8_decode($item['name']);
}
with my mod for phbbb its working fine.