|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright 2019 Amin Yazdanpanah<http://www.aminyazdanpanah.com>. |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the MIT License; |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* https://opensource.org/licenses/MIT |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
use AYazdanpanah\SaveUploadedFiles\Helper; |
|
20
|
|
|
use AYazdanpanah\SaveUploadedFiles\Upload; |
|
21
|
|
|
use AYazdanpanah\SaveUploadedFiles\Filter; |
|
22
|
|
|
|
|
23
|
|
|
if (! function_exists('uploads')) { |
|
24
|
|
|
/** |
|
25
|
|
|
* @param $config_files |
|
26
|
|
|
* @return mixed |
|
27
|
|
|
* @throws \AYazdanpanah\SaveUploadedFiles\Exception\SaveExceptionInterface |
|
28
|
|
|
*/ |
|
29
|
|
|
function uploads($config_files): Filter |
|
30
|
|
|
{ |
|
31
|
|
|
return Upload::files($config_files); |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
if (! function_exists('str_random')) { |
|
36
|
|
|
/** |
|
37
|
|
|
* @param int $length |
|
38
|
|
|
* @return string |
|
39
|
|
|
*/ |
|
40
|
|
|
function str_random($length = 10): string |
|
41
|
|
|
{ |
|
42
|
|
|
return Helper::str_random($length); |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
if (! function_exists('is_type')) { |
|
47
|
|
|
/** |
|
48
|
|
|
* @param $type |
|
49
|
|
|
* @param $filename |
|
50
|
|
|
* @return bool |
|
51
|
|
|
*/ |
|
52
|
|
|
|
|
53
|
|
|
function is_type($type, $filename): bool |
|
54
|
|
|
{ |
|
55
|
|
|
return Helper::isType($type,$filename); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
if (! function_exists('video_types')) { |
|
60
|
|
|
/** |
|
61
|
|
|
* @return mixed |
|
62
|
|
|
*/ |
|
63
|
|
|
function video_types(): array |
|
64
|
|
|
{ |
|
65
|
|
|
return Helper::videoTypes(); |
|
66
|
|
|
} |
|
67
|
|
|
} |