class ActionUploadInit in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Action for processing upload init request.
Hierarchy
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\AAction
- class \Drupal\n1ed\Flmngr\FileUploaderServer\lib\action\ActionUploadInit
Expanded class hierarchy of ActionUploadInit
1 file declares its use of ActionUploadInit
- Actions.php in src/
Flmngr/ FileUploaderServer/ lib/ Actions.php
File
- src/
Flmngr/ FileUploaderServer/ lib/ action/ ActionUploadInit.php, line 12
Namespace
Drupal\n1ed\Flmngr\FileUploaderServer\lib\actionView source
class ActionUploadInit extends AAction {
/**
* {@inheritdoc}
*/
public function getName() {
return "uploadInit";
}
/**
* {@inheritdoc}
*/
public function run($req) {
$alphabeth = "abcdefghijklmnopqrstuvwxyz0123456789";
do {
$id = "";
for ($i = 0; $i < 6; $i++) {
$charNumber = rand(0, strlen($alphabeth) - 1);
$id .= substr($alphabeth, $charNumber, 1);
}
$dir = $this->config
->getTmpDir() . DIRECTORY_SEPARATOR . $id;
} while (file_exists($dir));
if (!mkdir($dir)) {
throw new MessageException(Message::createMessage(Message::UNABLE_TO_CREATE_UPLOAD_DIR));
}
return new RespUploadInit($id, $this->config);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AAction:: |
protected | property | ||
AAction:: |
public | function | Sets a config. | |
AAction:: |
protected | function | Validates boolean and returns default value if null. | |
AAction:: |
protected | function | Validates integer and returns default value if null. | |
AAction:: |
protected | function | Validates string and returns default value if null. | |
ActionUploadInit:: |
public | function |
Returnes name of action. Overrides AAction:: |
|
ActionUploadInit:: |
public | function |
Runs action. Overrides AAction:: |