private function delete($id, $provider) { check_admin_referer('delete_link_' . $id); $storage = Amber::get_storage_instance($provider); if (!is_null($storage)) { $storage->delete(array('id' => $id)); } $status = Amber::get_status(); $status->delete($id, $provider); }
/** * Select and initialize an implementation of iAmberFetcher based on the backend ID * @param int $backend ID of the storage engine to use * @return iAmberFetcher */ public static function get_fetcher_instance($backend) { switch ($backend) { case AMBER_BACKEND_LOCAL: $fetcher = new AmberFetcher(Amber::get_storage_instance($backend), array('amber_max_file' => Amber::get_option('amber_max_file', 1000), 'header_text' => "You are viewing a snapshot of <a style='font-weight:bold !important; color:white !important' href='{{url}}'>{{url}}</a> created on {{date}}", 'amber_excluded_formats' => Amber::get_option("amber_excluded_formats", false) ? explode(",", Amber::get_option("amber_excluded_formats", "")) : array())); break; case AMBER_BACKEND_PERMA: $fetcher = new PermaFetcher(Amber::get_storage_instance($backend), array('perma_api_key' => Amber::get_option('amber_perma_api_key', ''), 'perma_archive_url' => Amber::get_option('amber_perma_server_url', 'http://perma.cc'), 'perma_api_url' => Amber::get_option('amber_perma_api_server_url', 'https://api.perma.cc', ''))); error_log(Amber::get_option('amber_perma_server_api_url', 'https://api.perma.cc', '')); break; case AMBER_BACKEND_INTERNET_ARCHIVE: $fetcher = new InternetArchiveFetcher(Amber::get_storage_instance($backend), array()); break; case AMBER_BACKEND_AMAZON_S3: $fetcher = new AmberFetcher(Amber::get_storage_instance($backend), array('amber_max_file' => 5000000, 'header_text' => "You are viewing a snapshot of <a style='font-weight:bold !important; color:white !important' href='{{url}}'>{{url}}</a> created on {{date}}", 'amber_excluded_formats' => Amber::get_option("amber_excluded_formats", false) ? explode(",", Amber::get_option("amber_excluded_formats", "")) : array())); break; default: $fetcher = null; } return $fetcher; }