/** * Returns instance of the Zend_Cache_Core configured with the options from the application configuration. * * @param string $name, optional The name of the cache - general by default. This name is used in the configuration. * @return Zend_Cache_Core */ public static function getCache($name = self::GENERAL_CACHE) { static $instances = array(); if (!isset($instances[$name])) { $manager = OpenSKOS_Application_BootstrapAccess::getBootstrap()->getPluginResource('cachemanager')->getCacheManager(); $instances[$name] = $manager->getCache($name); } return $instances[$name]; }
/** * Builds the path to the concept scheme icon. * Returns empty string if the file does not exist. * * @param srtring $uuid * @param OpenSKOS_Db_Table_Row_Tenant $tenant optional, Default null. If not set the currently logged one will be used. * @return string */ public static function buildIconPath($uuid, $tenant = null) { $editorOptions = OpenSKOS_Application_BootstrapAccess::getBootstrap()->getOption('editor'); if (null === $tenant) { $tenant = OpenSKOS_Db_Table_Tenants::fromIdentity(); } // We always need tenant for getting icon path. if (null !== $tenant) { if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['assignPath'])) { $iconsAssignPath = APPLICATION_PATH . $editorOptions['schemeIcons']['assignPath'] . '/' . $tenant->code; } else { $iconsAssignPath = APPLICATION_PATH . Editor_Forms_UploadIcon::DEFAULT_ASSIGN_PATH . '/' . $tenant->code; } if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['assignHttpPath'])) { $iconsAssignHttpPath = $editorOptions['schemeIcons']['assignHttpPath'] . '/' . $tenant->code; } else { $iconsAssignHttpPath = Editor_Forms_UploadIcon::DEFAULT_ASSIGN_HTTP_PATH . '/' . $tenant->code; } if (isset($editorOptions['schemeIcons']) && isset($editorOptions['schemeIcons']['extension'])) { $iconsExtension = $editorOptions['schemeIcons']['extension']; } else { $iconsExtension = 'png'; } if (is_file($iconsAssignPath . '/' . $uuid . '.' . $iconsExtension)) { return $iconsAssignHttpPath . '/' . $uuid . '.' . $iconsExtension . '?nocache=' . time(); } else { return ''; } } else { return ''; } }