public static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Returns sprite meta data * * @param string $imageName Image filename including extension * @return array Sprite meta data */ public function getSpriteMeta($imageName) { // return from cache if (isset($this->_spriteCache[$imageName])) { return $this->_spriteCache[$imageName]; } // sprite keys are base on imageURL $imageURL = $this->getImageURL($imageName, false); if (empty($imageURL)) { $this->_spriteCache[$imageName] = false; return false; } // load meta data, includes default images require_once "include/SugarTheme/SugarSprites.php"; $meta = SugarSprites::getInstance(); // add current theme dir $meta->loadSpriteMeta($this->dirName); // add parent theme dir if ($this->parentTheme && ($parent = SugarThemeRegistry::get($this->parentTheme))) { $meta->loadSpriteMeta($parent->dirName); } // add to cache if (isset($meta->sprites[$imageURL])) { $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; // add imageURL to cache //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; } else { $this->_spriteCache[$imageName] = false; $GLOBALS['log']->debug("Sprites: miss for {$imageURL}"); } return $this->_spriteCache[$imageName]; }