Skip to content

Commit

Permalink
Update paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanneculai committed Oct 24, 2016
1 parent 16d843e commit ded457d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/FroalaEditor/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace FroalaEditor;

use FroalaEditor\Utils\DiskManagement;

class File {
public static $defaultUploadOptions = array(
'fieldname' => 'file',
Expand Down Expand Up @@ -30,7 +32,7 @@ public static function upload($fileRoute, $options = NULL) {
$options = array_merge(File::$defaultUploadOptions, $options);
}

return \FroalaEditor_DiskManagement::upload($fileRoute, $options);
return DiskManagement::upload($fileRoute, $options);
}

/**
Expand All @@ -41,7 +43,7 @@ public static function upload($fileRoute, $options = NULL) {
*/
public static function delete($src) {

return \FroalaEditor_DiskManagement::delete($src);
return DiskManagement::delete($src);
}
}

Expand Down
6 changes: 4 additions & 2 deletions lib/FroalaEditor/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace FroalaEditor;

use FroalaEditor\Utils\DiskManagement;

class Image {
public static $defaultUploadOptions = array(
'fieldname' => 'file',
Expand Down Expand Up @@ -33,7 +35,7 @@ public static function upload($fileRoute, $options = NULL) {
}

// Upload image.
return \FroalaEditor_DiskManagement::upload($fileRoute, $options);
return DiskManagement::upload($fileRoute, $options);
}

/**
Expand All @@ -44,7 +46,7 @@ public static function upload($fileRoute, $options = NULL) {
*/
public static function delete($src) {
// Delete image.
return \FroalaEditor_DiskManagement::delete($src);
return DiskManagement::delete($src);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/FroalaEditor/Utils/DiskManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace FroalaEditor\Utils;

use FroalaEditor\Utils\Utils;

class DiskManagement {
/**
* Upload a file to the specified location.
Expand All @@ -20,14 +22,14 @@ public static function upload($fileRoute, $options) {
$fieldname = $options['fieldname'];

if (empty($fieldname) || empty($_FILES[$fieldname])) {
throw new Exception('Fieldname is not correct. It must be: ' . $fieldname);
throw new \Exception('Fieldname is not correct. It must be: ' . $fieldname);
}

if (
isset($options['validation']) &&
!Utils::isValid($options['validation'], $fieldname)
) {
throw new Exception('File does not meet the validation.');
throw new \Exception('File does not meet the validation.');
}

// Get filename.
Expand Down

0 comments on commit ded457d

Please sign in to comment.