public function delete_objects($bucket, $objects, $options = null)
{
//options
$this->validate_options($options);
if (!$options) {
$options = array();
}
//bucket
$this->is_empty($bucket, OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//objects
if (!is_array($objects) || !$objects) {
throw new OSS_Exception('The ' . __FUNCTION__ . ' method requires the "objects" option to be set as an array.');
}
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'delete';
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Delete></Delete>');
// Quiet mode?
if (isset($options['quiet'])) {
$quiet = 'false';
if (is_bool($options['quiet'])) {
//Boolean
$quiet = $options['quiet'] ? 'true' : 'false';
} elseif (is_string($options['quiet'])) {
// String
$quiet = $options['quiet'] === 'true' ? 'true' : 'false';
}
$xml->addChild('Quiet', $quiet);
}
// Add the objects
foreach ($objects as $object) {
$xobject = $xml->addChild('Object');
$object = $this->s_replace($object);
$xobject->addChild('Key', $object);
}
$options[self::OSS_CONTENT] = $xml->asXML();
return $this->auth($options);
}