Ejemplo n.º 1
0
 /**
  * Provides information on a specific guild.
  * @access      public
  * @param       string      $guildName              The guilds' name.
  * @param       string      $realmName              The guilds' realm name.
  * @return      array       $result                 Returns an array containing guildData if $guildName and $realmName are valid, otherwise FALSE.
  */
 public function getGuildData($guildName = NULL, $realmName = NULL)
 {
     $this->cacheID = "g" . md5($guildName . $realmName);
     $cached = $this->getCachedData($this->cacheID);
     if (!is_array($cached)) {
         $cached = parent::getGuildData($guildName, $realmName);
         if ($this->cacheID && is_array($cached)) {
             $scached = serialize($cached);
             $this->setCachedData($this->cacheID, $scached);
             unset($this->cacheID);
         } else {
             return FALSE;
         }
         return $cached;
     } else {
         return $cached;
     }
 }
Ejemplo n.º 2
0
 /**
  * getGuildData
  *
  * Attempts to fetch a cached version of the requested
  * guild. Otherwise, it calls the parent function.
  *
  * @return string[]                  An associative array
  * @param string     $guild          The name of the guild
  * @param string     $realm          The guild's realm
  */
 public function getGuildData($guildName = NULL, $realmName = NULL)
 {
     if ($guildName == NULL && $this->guildName) {
         $guildName = $this->guildName;
     }
     if ($realmName == NULL && $this->realmName) {
         $realm = $this->realmName;
     }
     $this->cacheID = "g" . md5($guildName . $realmName);
     $cached = $this->cacheFetch($this->cacheID);
     if (!is_array($cached)) {
         $cached = parent::getGuildData($guildName, $realmName);
         if ($this->cacheID) {
             $scached = serialize($cached);
             $this->cacheSave($this->cacheID, $scached);
             unset($this->cacheID);
         }
         return $cached;
     } else {
         return $cached;
     }
 }
Ejemplo n.º 3
0
/**
 * phpArmory5 test case
 *
 * A test case to derive a new class object from the phpArmory5 class.
 * @package phpArmory
 * @subpackage tests
 */
// Include the phpArmory class library
require_once '../phpArmory.class.php';
$areaName = 'eu';
$guildName = "Divinitas";
$guildRealmName = "Madmortem";
$sapi_type = substr(php_sapi_name(), 0, 3);
// Instantiate the class library
if ($armory = new phpArmory5($areaName = $areaName)) {
    $guildData = $armory->getGuildData($guildName, $guildRealmName);
    if ($sapi_type == 'cli') {
        var_dump($guildData);
    } else {
        // Define some variables
        $guildName = $guildData['guildinfo']['guild']['name'];
        $guildMemberCount = $guildData['guildinfo']['guild']['members']['membercount'];
        $guildCharacters = $guildData['guildinfo']['guild']['members']['character'];
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php 
        echo $guildName;
        ?>