/** * Returns the path to the library * * @return string */ static function path() { if (self::$path === null) { self::$path = dirname(__FILE__) . DIRECTORY_SEPARATOR; } return self::$path; }
static function get($operationName) { $lcname = strtolower($operationName); if (!isset(self::$cache[$lcname])) { $opClassName = "GDImage_Operation_" . $operationName; if (!class_exists($opClassName, false)) { $fileName = GDImage::path() . 'Operation/' . ucfirst($operationName) . '.php'; if (file_exists($fileName)) { require_once $fileName; } else { JError::raiseError(500, JText::sprintf('JLIB_GDIMAGE_ERROR_LOAD_OPERATION', $operationName)); return false; } } self::$cache[$lcname] = new $opClassName(); } return self::$cache[$lcname]; }
/** * Returns a mapper, based on the $uri and $format * * @param string $uri File URI * @param string $format File format (extension or mime-type) or null * @return GDImage_Mapper **/ static function selectMapper($uri, $format = null) { $format = self::determineFormat($uri, $format); if (array_key_exists($format, self::$mappers)) { return self::$mappers[$format]; } $mapperClassName = 'GDImage_Mapper_' . $format; if (!class_exists($mapperClassName, false)) { $mapperFileName = GDImage::path() . 'Mapper/' . $format . '.php'; if (file_exists($mapperFileName)) { require_once $mapperFileName; } } if (class_exists($mapperClassName, false)) { self::$mappers[$format] = new $mapperClassName(); return self::$mappers[$format]; } JError::raiseError(500, JText::sprintf('JLIB_GDIMAGE_ERROR_FORMAT_NOT_SUPPORTED', $format)); }