{@inheritdoc}

@throws \Dropbox_Exception
544931
public function write($key, $content)
    {
        $resource = tmpfile();
        fwrite($resource, $content);
        fseek($resource, 0);

        try {
            $this->client->putFile($key, $resource);
        } catch (\Exception $e) {
            fclose($resource);

            throw $e;
        }

        fclose($resource);

        return Util\Size::fromContent($content);
    }
1140170
public function write($showDebug = false, $forceInsert = false, $forceWrite = false, $writeComponents = false)
    {
        //throw new Exception("{$this->ClassName} can not be written back to the database.");
        // NOTE: we need to fail silently on writes because writing is part of the cloud upload process
        if ($this->storeRecord) {
            $this->storeRecord->write($showDebug, $forceInsert, $forceWrite, $writeComponents);
        }
    }
1141161
public function render()
    {
        $dropzoneAttributes = array_diff_key($this->field->attributes, array_flip(['class']));

        if (!isset($dropzoneAttributes['container'])) {
            throw new RuntimeException('Invalid Dropzone Container Id');
        }
        $this->field->attributes = ['class' => $this->field->attributes['class']];

        $id             = $dropzoneAttributes['container'];
        $view           = isset($dropzoneAttributes['view']) ? $dropzoneAttributes['view'] : 'antares/foundation::widgets.forms.dropzone';
        $name           = $dropzoneAttributes['paramName'];
        $successDefault = <<<CBALL
        this.on("success", function(file,response) {        
            $('#$id').parent().find('input[name=$name]').val(response.path);
            %s 
            %s    
        }); 
CBALL;
        $afterLoad      = isset($dropzoneAttributes['previewsContainer']) ? $this->onSuccessDefault($id) : '';
        $onSuccess      = isset($dropzoneAttributes['onSuccess']) ? $dropzoneAttributes['onSuccess'] : '';
        $afterUpload    = sprintf($successDefault, $afterLoad, $onSuccess);


        $params = array_merge([
            'autoProcessQueue' => true,
            'uploadMultiple'   => false,
            'maxFiles'         => 100,
            'thumbnailWidth'   => 120,
            'thumbnailHeight'  => 120,
            'parallelUploads'  => 20,
            'init'             => new JavaScriptExpression(sprintf($this->onInit($dropzoneAttributes), $afterUpload))], $dropzoneAttributes);


        $cball        = <<<CBALL
(function(window,$){Dropzone.autoDiscover = false; Dropzone.options.%s = %s; %s })(window,jQuery);

CBALL;
        $attach       = <<<CBALL
                     $('#{$id}').dropzone(Dropzone.options.$id);
CBALL;
        $inlineScript = sprintf($cball, $id, JavaScriptDecorator::decorate(array_except($params, ['view', 'container', 'onSuccess'])), $attach);
        $this->asset->container('antares/foundation::scripts')->inlineScript('dropzone-' . $id, $inlineScript);
        $attributes   = $this->html->decorate($this->field->get('attributes'), ['class' => 'form-control']);
        $input        = $this->form->input('hidden', $params['paramName'], $this->field->get('value'), ['id' => $id . 'Container']);
        return view($view, ['field' => $this->field, 'attributes' => $attributes, 'params' => $params, 'input' => $input, 'id' => $id]);
    }
962005
@EventHandler("drop")
    private void onDrop(DropEvent event) {
        BaseComponent dragged = event.getRelatedTarget();
        
        if (dragged instanceof DropContainer) {
            getParent().addChild(dragged, this);
        }
    }
417463
function(dropbox_obj, cb){
      
      var oauth = { 
                    consumer_key: dropbox_config.app_key
                  , consumer_secret: dropbox_config.app_secret
                  , token: dropbox_obj.oauth.access_token
                  , token_secret: dropbox_obj.oauth.access_token_secret
                  }

      request.get({url: ACCOUNT_INFO_URI, oauth:oauth}, function (e, r, b) {

        if(e) return cb(e,null)

        return cb(null,b)

      }) // end request.post()

      
    }
1372252
public function update(Dropzone $dropzone, array $data)
    {
        $this->crud->update('Claroline\DropZoneBundle\Entity\Dropzone', $data);

        $uow = $this->om->getUnitOfWork();
        $uow->computeChangeSets();
        $changeSet = $uow->getEntityChangeSet($dropzone);

        $this->eventDispatcher->dispatch('log', new LogDropzoneConfigureEvent($dropzone, $changeSet));

        return $dropzone;
    }
768392
public function serialize(Dropzone $dropzone)
    {
        return [
            'id' => $dropzone->getUuid(),
            'instruction' => $dropzone->getInstruction(),
            'parameters' => $this->serializeParameters($dropzone),
            'display' => $this->serializeDisplay($dropzone),
            'planning' => $this->serializePlanning($dropzone),
            'notifications' => $this->serializeNotifications($dropzone),
        ];
    }
520790
public function rmdirR($dir)
    {
        $finder = $this->finder->create();
        $files = $finder->notRecursive()->find($dir);
        foreach ($files as $file) {
            if (! $file->isExists()) continue;

            if ($file->isDir()) {
                $this->rmdirR("{$file}/*");
                if ($file->isWritable()) {
                    rmdir($file);
                } else {
                    throw new Exception("Can not delete this directory. -> {$file}");
                }
            } else {
                if ($file->isWritable()) {
                    unlink($file);
                } else {
                    throw new Exception("Can not delete this file. -> {$file}");
                }
            }
        }
    }
1146743
public function makeModelFromResponse(DropboxResponse $response)
    {
        //Get the Decoded Body
        $body = $response->getDecodedBody();

        if (is_null($body)) {
            $body = [];
        }

        //Make and Return the Model
        return ModelFactory::make($body);
    }
933007
public function set_option($options = []) {
        if (!empty($options['dropbox_key'])) {
            set_config('dropbox_key', trim($options['dropbox_key']), 'dropbox');
            unset($options['dropbox_key']);
        }
        if (!empty($options['dropbox_secret'])) {
            set_config('dropbox_secret', trim($options['dropbox_secret']), 'dropbox');
            unset($options['dropbox_secret']);
        }
        if (!empty($options['dropbox_cachelimit'])) {
            $this->cachelimit = (int) trim($options['dropbox_cachelimit']);
            set_config('dropbox_cachelimit', $this->cachelimit, 'dropbox');
            unset($options['dropbox_cachelimit']);
        }

        return parent::set_option($options);
    }
1332546
public function setDropzone(\Innova\CollecticielBundle\Entity\Dropzone $dropzone)
    {
        $this->dropzone = $dropzone;

        return $this;
    }
1050910
public function closeDropzoneOpenedDrops(Dropzone $dropzone, $force = false)
    {
        if ($force || $this->isDropzoneDropTimeIsUp($dropzone)) {
            $dropRepo = $this->em->getRepository('IcapDropzoneBundle:Drop');
            $dropRepo->closeUnTerminatedDropsByDropzone($dropzone->getId());
            $dropzone->setAutoCloseState(Dropzone::AUTO_CLOSED_STATE_CLOSED);
        }
    }
611349
public function set($token, $type)
    {
        if ($type != 'request_token' && $type != 'access_token') {
            throw new \Dropbox\Exception("Expected a type of either 'request_token' or 'access_token', got '$type'");
        } elseif ($type == 'request_token') {
            parent::set($token, $type);
        } else {
            $token = $this->encrypt($token);
            $file = $this->getTokenFilePath();
            file_put_contents($file, $token);
            $_SESSION[$this->namespace][$this->userID][$type] = $token;
        }
    }
223574
public function execAction()
    {
        //no action defined
        if(!$this->action) {
            throw new \Exception(sprintf('no action defined for subject %s', $this->name));
        }
        //exec method
        try {
            $this->checkTraitsInjections();
            $this->traitsInit();
            $this->{'exec'.$this->sanitizeAction($this->action)}();
        } catch(Exception $exception) {
        //no method defined
            throw new Exception(sprintf('no method for handling %s %s %s', AREA, $this->name, $this->action));
        }
    }
1215610
public void setDropZoneElement(Element dropZone) {

        if (m_allowUploads && (dropZone != null) && (m_uploadDropZone == null)) {
            m_uploadDropZone = dropZone;
            initUploadZone(m_uploadDropZone);
            m_uploadDropZone.setTitle(
                org.opencms.ade.upload.client.Messages.get().key(
                    org.opencms.ade.upload.client.Messages.GUI_UPLOAD_DRAG_AND_DROP_ENABLED_0));
            m_uploadDropZone.addClassName(I_CmsLayoutBundle.INSTANCE.galleryFieldCss().uploadDropZone());
        }
    }
560039
protected function registerBindings()
    {
        $this->app->bind('dropbox.connection', function (Container $app) {
            $manager = $app['dropbox'];

            return $manager->connection();
        });

        $this->app->alias('dropbox.connection', Client::class);
    }
1272688
function drop() {
		if( isset( $this->current_field ) ) {
			// Drop the current field
			logMsg( "Dropping field '{$this->current_field}' from table '{$this->name}'" );
			// $this->drop_field[$this->current_field] = $xmls->dict->DropColumnSQL( $this->name, $this->current_field );
			$this->drop_field[$this->current_field] = $this->current_field;
		} else {
			// Drop the current table
			logMsg( "Dropping table '{$this->name}'" );
			// $this->drop_table = $xmls->dict->DropTableSQL( $this->name );
			$this->drop_table = TRUE;
		}
	}