/** * Assemble the in-memory representation of the (read-only) Optional Upload MIME Types * * @since 1.40 * * @return boolean Success (true) or failure (false) of the operation */ private static function _get_optional_upload_mime_templates() { if (NULL != self::$mla_optional_upload_mime_templates) { return true; } self::$mla_optional_upload_mime_templates = array(); $template_array = MLAData::mla_load_template('mla-default-mime-types.tpl'); if (isset($template_array['mla-optional-mime-types'])) { $mla_mime_types = preg_split('/[\\r\\n]+/', $template_array['mla-optional-mime-types']); $ID = 0; foreach ($mla_mime_types as $mla_type) { $array = explode(',', $mla_type); $slug = $array[0]; if ($matched_type = self::mla_get_upload_mime($slug)) { $core_type = $matched_type['core_type']; $mla_type = $matched_type['mla_type']; } else { $core_type = ''; $mla_type = ''; } self::$mla_optional_upload_mime_templates[++$ID] = array('ID' => $ID, 'slug' => $slug, 'mime_type' => $array[1], 'core_type' => $core_type, 'mla_type' => $mla_type, 'description' => $array[2]); } } return true; }
/** * Assemble the in-memory representation of the (read-only) Optional Upload MIME Types * * @since 1.40 * * @return boolean Success (true) or failure (false) of the operation */ private static function _get_optional_upload_mime_templates() { if (NULL != self::$mla_optional_upload_mime_templates) { return true; } self::$mla_optional_upload_mime_templates = array(); $template_array = MLACore::mla_load_template('mla-default-mime-types.tpl'); if (isset($template_array['mla-optional-mime-types'])) { $mla_mime_types = preg_split('/[\\r\\n]+/', $template_array['mla-optional-mime-types']); $ID = 0; foreach ($mla_mime_types as $mla_type) { // Ignore blank lines if (empty($mla_type)) { continue; } $array = explode(',', $mla_type); // Bypass damaged entries if (3 > count($array)) { MLACore::mla_debug_add(__LINE__ . " _get_upload_mime_templates mla-default-mime-types.tpl section mla-optional-mime-types( {$ID} '{$mla_type}' ) \$array = " . var_export($array, true), MLACore::MLA_DEBUG_CATEGORY_ANY); continue; } $slug = $array[0]; if ($matched_type = self::mla_get_upload_mime($slug)) { $core_type = $matched_type['core_type']; $mla_type = $matched_type['mla_type']; } else { $core_type = ''; $mla_type = ''; } self::$mla_optional_upload_mime_templates[++$ID] = array('ID' => $ID, 'slug' => $slug, 'mime_type' => $array[1], 'core_type' => $core_type, 'mla_type' => $mla_type, 'description' => $array[2]); } } return true; }