public function parse($name, $args = array())
 {
     if (trim($name) == '') {
         return false;
     }
     $cache = new wowhead_cache();
     $this->lang = !array_key_exists('lang', $args) ? WHP_LANG : $args['lang'];
     $this->language->loadLanguage($this->lang);
     if (!($result = $cache->getObject($name, 'achievement', $this->lang))) {
         // not in cache
         if (is_numeric($name)) {
             $result = $this->_getAchievementByID($name);
         } else {
             $result = $this->_getAchievementByName($name);
         }
         if (!$result) {
             // not found
             $cache->close();
             return $this->_notfound($this->language->words['achievement'], $name);
         } else {
             $cache->saveObject($result);
             $cache->close();
             return $this->generateHTML($result, 'achievement');
         }
     } else {
         $cache->close();
         return $this->generateHTML($result, 'achievement');
     }
 }
Esempio n. 2
0
 /**
  * Parses Items
  * @access public
  **/
 public function parse($name, $args = array())
 {
     global $item_show_icon;
     if (trim($name) == '') {
         return false;
     }
     $this->lang = !array_key_exists('lang', $args) ? WHP_LANG : $args['lang'];
     // load the language pack
     $this->language->loadLanguage($this->lang);
     $cache = new wowhead_cache();
     if ($item_show_icon == true || array_key_exists('icon', $args)) {
         $this->show_icon = true;
         $this->type = 'item_icon';
     }
     // check if its already in the cache
     if (!($result = $cache->getObject($name, $this->type, $this->lang))) {
         // not in the cache
         if (!($result = $this->_getItemInfo($name))) {
             // item not found
             $cache->close();
             return $this->_notfound($this->language->words['item'], $name);
         } else {
             $cache->saveObject($result);
             // save it to cache
             $cache->close();
             if (array_key_exists('gems', $args) || array_key_exists('enchant', $args)) {
                 $enhance = $this->_buildEnhancement($args);
                 return $this->generateHTML($result, $this->type, '', '', $enhance);
             } else {
                 return $this->generateHTML($result, $this->type);
             }
         }
     } else {
         $cache->close();
         if (array_key_exists('gems', $args) || array_key_exists('enchant', $args)) {
             $enhance = $this->_buildEnhancement($args);
             return $this->generateHTML($result, $this->type, '', '', $enhance);
         } else {
             return $this->generateHTML($result, $this->type);
         }
     }
 }
Esempio n. 3
0
 public function parse($name, $args = array())
 {
     if (trim($name) == '') {
         return false;
     }
     $this->lang = array_key_exists('lang', $args) ? $args['lang'] : WHP_LANG;
     $this->language->loadLanguage($this->lang);
     $cache = new wowhead_cache();
     if (!($result = $cache->getObject($name, 'object', $this->lang))) {
         $result = is_numeric($name) ? $this->getObjectByID($name) : $this->getObjectByName($name);
         if (!$result) {
             $cache->close();
             return $this->_notFound($this->language->words['object'], $name);
         } else {
             $cache->saveObject($result);
             $cache->close();
             return $this->generateHTML($result, 'object');
         }
     } else {
         $cache->close();
         return $this->generateHTML($result, 'object');
     }
 }
Esempio n. 4
0
 /**
  * Parse Item Icons
  * @access public
  **/
 public function parse($name, $args = array())
 {
     if (trim($name) == '') {
         return false;
     }
     $size = !array_key_exists('size', $args) ? 'medium' : $args['size'];
     $this->lang = !array_key_exists('lang', $args) ? WHP_LANG : $args['lang'];
     $this->language->loadLanguage($this->lang);
     $cache = new wowhead_cache();
     if (!($result = $cache->getObject($name, 'itemico', $this->lang, '', $size))) {
         if (!($result = $this->_getItemIcon($name, $size))) {
             $cache->close();
             return $this->_notfound($this->language->words['item'], $name);
         } else {
             $cache->saveObject($result);
             $cache->close();
             return $this->generateHTML($result, 'itemico', $size);
         }
     } else {
         $cache->close();
         return $this->generateHTML($result, 'itemico', $size);
     }
 }
Esempio n. 5
0
 /**
  * Parses information
  * @access public
  **/
 public function parse($name, $args = array())
 {
     if (trim($name) == '') {
         return false;
     }
     $this->lang = !array_key_exists('lang', $args) ? WHP_LANG : $args['lang'];
     $this->language->loadLanguage($this->lang);
     $rank = !array_key_exists('rank', $args) ? '' : $args['rank'];
     $cache = new wowhead_cache();
     if (!($result = $cache->getObject($name, 'spell', $this->lang, $rank))) {
         $result = is_numeric($name) ? $this->_getSpellByID($name) : $this->_getSpellByName($name, $rank);
         if (!$result) {
             $cache->close();
             return $this->_notfound($this->language->words['spell'], $name);
         } else {
             $cache->saveObject($result);
             $cache->close();
             return $this->generateHTML($result, 'spell', '', $rank);
         }
     } else {
         $cache->close();
         return $this->generateHTML($result, 'spell', '', $rank);
     }
 }