feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
98
modules/system/models/File.php
Normal file
98
modules/system/models/File.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php namespace System\Models;
|
||||
|
||||
use Url;
|
||||
use Config;
|
||||
use Storage;
|
||||
use Winter\Storm\Database\Attach\File as FileBase;
|
||||
use Backend\Controllers\Files;
|
||||
|
||||
/**
|
||||
* File attachment model
|
||||
*
|
||||
* @package winter\wn-system-module
|
||||
* @author Alexey Bobkov, Samuel Georges
|
||||
*/
|
||||
class File extends FileBase
|
||||
{
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
protected $table = 'system_files';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getThumb($width, $height, $options = [])
|
||||
{
|
||||
$url = '';
|
||||
$width = !empty($width) ? $width : 0;
|
||||
$height = !empty($height) ? $height : 0;
|
||||
|
||||
if (!$this->isPublic() && class_exists(Files::class)) {
|
||||
$options = $this->getDefaultThumbOptions($options);
|
||||
// Ensure that the thumb exists first
|
||||
parent::getThumb($width, $height, $options);
|
||||
|
||||
// Return the Files controller handler for the URL
|
||||
$url = Files::getThumbUrl($this, $width, $height, $options);
|
||||
} else {
|
||||
$url = parent::getThumb($width, $height, $options);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getPath(?string $fileName = null): string
|
||||
{
|
||||
$url = '';
|
||||
if (!$this->isPublic() && class_exists(Files::class)) {
|
||||
$url = Files::getDownloadUrl($this);
|
||||
} else {
|
||||
$url = parent::getPath($fileName);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the public address for the storage path.
|
||||
*/
|
||||
public function getPublicPath(): string
|
||||
{
|
||||
$uploadsPath = Config::get('cms.storage.uploads.path', '/storage/app/uploads');
|
||||
|
||||
if ($this->isPublic()) {
|
||||
$uploadsPath .= '/public';
|
||||
}
|
||||
else {
|
||||
$uploadsPath .= '/protected';
|
||||
}
|
||||
|
||||
return Url::asset($uploadsPath) . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the internal storage path.
|
||||
*/
|
||||
public function getStorageDirectory(): string
|
||||
{
|
||||
$uploadsFolder = Config::get('cms.storage.uploads.folder');
|
||||
|
||||
if ($this->isPublic()) {
|
||||
return $uploadsFolder . '/public/';
|
||||
}
|
||||
|
||||
return $uploadsFolder . '/protected/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the storage disk the file is stored on
|
||||
*/
|
||||
public function getDiskName(): string
|
||||
{
|
||||
return Config::get('cms.storage.uploads.disk');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user