/** * Retrieves the supported MIME types from Thumber. * @return array The supported MIME types reported by the Thumber server. */ public function getMimeTypes() { if (!isset(self::$mime_types)) { $headers = array('Content-Type: application/json', 'Content-Length: 0'); $result = $this->sendToThumber('GET', self::getThumberUrl(self::ThumberServerMimeTypesPath), $headers); self::$mime_types = !array_key_exists('error', $result) ? json_decode($result['body'], true) : array(); } return self::$mime_types; }
/** * Retrieves the supported MIME types from Thumber that are also compatible with WordPress. * @return string[] The supported MIME types reported by the Thumber server. */ public function getMimeTypes() { global $dg_options; if (empty($dg_options['thumber-co']['mime_types'])) { // avoid values being removed as a result of current user but also include any MIME types // that are added outside of the default WP values $wp_types = array_merge(wp_get_mime_types(), get_allowed_mime_types()); $allowed = array_intersect($wp_types, parent::getMimeTypes()); $dg_options['thumber-co']['mime_types'] = array_keys($allowed); DocumentGallery::setOptions($dg_options); } return $dg_options['thumber-co']['mime_types']; }