x-systems /
epesi-filestorage
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Epesi\FileStorage; |
||||||
| 4 | |||||||
| 5 | use Epesi\FileStorage\Models\File; |
||||||
| 6 | use Epesi\Core\Helpers\Utils; |
||||||
| 7 | |||||||
| 8 | class FileStorageUI |
||||||
| 9 | { |
||||||
| 10 | |||||||
| 11 | public static function fileLabel($id, $nolink = false, $icon = true, $action_urls = null, $label = null, $inline = false) |
||||||
| 12 | { |
||||||
| 13 | $fileExists = File::exists($id); |
||||||
| 14 | |||||||
| 15 | if ($icon) { |
||||||
| 16 | $icon_file = $fileExists ? 'z-attach.png': 'z-attach-off.png'; |
||||||
| 17 | $img_src = Base_ThemeCommon::get_template_file(self::module_name(), $icon_file); |
||||||
|
0 ignored issues
–
show
The type
Epesi\FileStorage\Base_ThemeCommon was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 18 | $icon_img = '<img src="' . $img_src . '" style="vertical-align:bottom">'; |
||||||
| 19 | } |
||||||
| 20 | else { |
||||||
| 21 | $icon_img = ''; |
||||||
| 22 | } |
||||||
| 23 | |||||||
| 24 | $file = File::get($id); |
||||||
|
0 ignored issues
–
show
The method
atk4\data\Model::get() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 25 | |||||||
| 26 | if (! $fileName = $label) { |
||||||
| 27 | $fileName = ($file['name']?? '') ?: '[' . __('missing file name') . ']'; |
||||||
|
0 ignored issues
–
show
Are you sure
__('missing file name') of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 28 | } |
||||||
| 29 | |||||||
| 30 | if ($nolink || ! $file) { |
||||||
| 31 | return $fileName . ($fileExists ? '': ' [' . __('missing file') . ']'); |
||||||
|
0 ignored issues
–
show
Are you sure
__('missing file') of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | $link_href = ''; |
||||||
| 35 | if ($fileExists) { |
||||||
| 36 | $filesize = filesize_hr($file['file']); |
||||||
|
0 ignored issues
–
show
The function
filesize_hr was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 37 | $filetooltip = __('File size: %s', array($filesize)) . '<hr>' . |
||||||
|
0 ignored issues
–
show
Are you sure
__('File size: %s', array($filesize)) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 38 | __('Uploaded by: %s', array(Base_UserCommon::get_user_label($file['created_by'], true))) . '<br/>' . |
||||||
|
0 ignored issues
–
show
The type
Epesi\FileStorage\Base_UserCommon was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
Are you sure
__('Uploaded by: %s', ar...['created_by'], true))) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 39 | __('Uploaded on: %s', array(Base_RegionalSettingsCommon::time2reg($file['created_on']))) . '<br/>' . |
||||||
|
0 ignored issues
–
show
The type
Epesi\FileStorage\Base_RegionalSettingsCommon was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
Are you sure
__('Uploaded on: %s', ar...($file['created_on']))) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 40 | __('Number of downloads: %d', array(self::get_downloads_count($id))); |
||||||
|
0 ignored issues
–
show
Are you sure
__('Number of downloads:..._downloads_count($id))) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The method
get_downloads_count() does not exist on Epesi\FileStorage\FileStorageUI.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 41 | $link_href = Utils_TooltipCommon::open_tag_attrs($filetooltip) . ' ' |
||||||
|
0 ignored issues
–
show
The type
Epesi\FileStorage\Utils_TooltipCommon was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 42 | . Utils_FileStorage_FileLeightbox::get_file_leightbox($file, $action_urls); |
||||||
|
0 ignored issues
–
show
The type
Epesi\FileStorage\Utils_FileStorage_FileLeightbox was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 43 | } else { |
||||||
| 44 | if (isset($file['hash'])) { |
||||||
| 45 | $tooltip_text = __('Missing file: %s', array(substr($file['hash'], 0, 32) . '...')); |
||||||
| 46 | $link_href = Utils_TooltipCommon::open_tag_attrs($tooltip_text); |
||||||
| 47 | } |
||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | $ret = '<a ' . $link_href . '>' . $icon_img . '<span class="file_name">' . $fileName . '</span></a>'; |
||||||
| 51 | |||||||
| 52 | return $inline? $ret: '<div class="file_link">'.$ret.'</div>'; |
||||||
| 53 | } |
||||||
| 54 | } |
||||||
| 55 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.