Documentation

Mage_Core_Helper_File_Storage_Database extends Mage_Core_Helper_Abstract
in package

Maho

Tags
copyright

Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)

copyright

Copyright (c) 2016-2024 The OpenMage Contributors (https://openmage.org)

license

https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

Table of Contents

Properties

$_databaseModel  : Mage_Core_Model_File_Storage_Database|null
Database storage model
$_layout  : Mage_Core_Model_Layout
Layout model object
$_mediaBaseDirectory  : string
Media dir
$_moduleName  : string
Helper module name
$_request  : Mage_Core_Controller_Request_Http
Request object
$_resourceModel  : Mage_Core_Model_Resource_File_Storage_Database|null
Storage resource model
$_useDb  : bool
Db usage flag
$modulesDisabled  : array<string|int, mixed>

Methods

__()  : string
Translate
checkDbUsage()  : bool
Check if we use DB storage Note: Disabled as not completed feature
copyFile()  : mixed
Copy file in DB storage
deleteFile()  : mixed
Deletes from DB files, which belong to one folder
deleteFolder()  : mixed
Deletes from DB files, which belong to one folder
escapeHtml()  : null|string|array<string|int, string>
Escape html entities
escapeScriptIdentifiers()  : string
Remove `javascript:`, `vbscript:`, `data:` words from the string.
escapeSpecial()  : string
Remove `\t`,`\n`,`\r`,`\0`,`\x0B:` symbols from the string.
escapeUrl()  : string
Escape html entities in url
fileExists()  : bool|null
Check whether file exists in DB
getLayout()  : Mage_Core_Model_Layout
Retrieve layout model object
getMediaBaseDir()  : string
Return Media base dir
getMediaRelativePath()  : string
Return relative uri for media content by full path
getResourceStorageModel()  : Mage_Core_Model_Resource_File_Storage_Database
Get storage model
getStorageDatabaseModel()  : Mage_Core_Model_File_Storage_Database
Get database storage model
getStorageFileModel()  : Mage_Core_Model_File_Storage_File
Get file storage model
getUniqueFilename()  : string
Get unique name for passed file in case this file already exists
hasTags()  : bool
Check for tags in multidimensional arrays
htmlEscape()  : null|string|array<string|int, string>
isModuleEnabled()  : bool
Check is module exists and enabled in global config.
isModuleOutputEnabled()  : bool
Check whether the module output is enabled in Configuration
jsQuoteEscape()  : string|array<string|int, string>
Escape quotes in java script
quoteEscape()  : string
Escape quotes inside html attributes Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc)
removeTags()  : string
Remove html tags, but leave "<" and ">" signs
renameFile()  : mixed
Rename file in DB storage
saveFile()  : mixed
Save file in DB storage
saveFileToFilesystem()  : bool
Save database file to file system
saveUploadedFile()  : string
Saves uploaded by Mage_Core_Model_File_Uploader file to DB with existence tests
setLayout()  : Mage_Core_Helper_Abstract
Declare layout
stripTags()  : string
Wrapper for standard strip_tags() function with extra functionality for html entities
translateArray()  : array<string|int, mixed>
Translate array
urlDecode()  : string
base64_decode() for URLs decoding
urlDecodeAndEscape()  : string
base64_decode() and escape quotes in url
urlEncode()  : string
base64_encode() for URLs encoding
urlEscape()  : string
_cleanCache()  : Mage_Core_Helper_Abstract
Cleaning cache
_getModuleName()  : string
Retrieve helper module name
_getRequest()  : Mage_Core_Controller_Request_Http
Retrieve request object
_getUrl()  : string
Retrieve url
_loadCache()  : mixed
Loading cache data
_removeAbsPathFromFileName()  : string
Convert full file path to local (as used by model) If not - returns just a filename
_removeCache()  : Mage_Core_Helper_Abstract
Removing cache
_saveCache()  : Mage_Core_Helper_Abstract
Saving cache

Properties

$_mediaBaseDirectory

Media dir

protected string $_mediaBaseDirectory

$_moduleName

Helper module name

protected string $_moduleName = 'Mage_Core'

$_useDb

Db usage flag

protected bool $_useDb = \null

$modulesDisabled

protected array<string|int, mixed> $modulesDisabled = []

Methods

__()

Translate

public __() : string
Return values
string

checkDbUsage()

Check if we use DB storage Note: Disabled as not completed feature

public checkDbUsage() : bool
Return values
bool

copyFile()

Copy file in DB storage

public copyFile(string $oldName, string $newName) : mixed
Parameters
$oldName : string
$newName : string

deleteFile()

Deletes from DB files, which belong to one folder

public deleteFile(string $filename) : mixed
Parameters
$filename : string

deleteFolder()

Deletes from DB files, which belong to one folder

public deleteFolder(string $folderName) : mixed
Parameters
$folderName : string

escapeHtml()

Escape html entities

public escapeHtml(string|array<string|int, string> $data[, array<string|int, mixed>|null $allowedTags = null ]) : null|string|array<string|int, string>
Parameters
$data : string|array<string|int, string>
$allowedTags : array<string|int, mixed>|null = null
Return values
null|string|array<string|int, string>

escapeScriptIdentifiers()

Remove `javascript:`, `vbscript:`, `data:` words from the string.

public escapeScriptIdentifiers(string $data) : string
Parameters
$data : string
Return values
string

escapeSpecial()

Remove `\t`,`\n`,`\r`,`\0`,`\x0B:` symbols from the string.

public escapeSpecial(string $data) : string
Parameters
$data : string
Return values
string

escapeUrl()

Escape html entities in url

public escapeUrl(string $data) : string
Parameters
$data : string
Return values
string

fileExists()

Check whether file exists in DB

public fileExists(string $filename) : bool|null
Parameters
$filename : string

can be both full path or partial (like in DB)

Return values
bool|null

getMediaBaseDir()

Return Media base dir

public getMediaBaseDir() : string
Return values
string

getMediaRelativePath()

Return relative uri for media content by full path

public getMediaRelativePath(string $fullPath) : string
Parameters
$fullPath : string
Return values
string

getUniqueFilename()

Get unique name for passed file in case this file already exists

public getUniqueFilename(string $directory, string $filename) : string
Parameters
$directory : string
  • can be both full path or partial (like in DB)
$filename : string
  • not just a filename. Can have directory chunks. return will have this form
Return values
string

hasTags()

Check for tags in multidimensional arrays

public hasTags(string|array<string|int, mixed> $data[, array<string|int, mixed> $arrayKeys = [] ][, bool $skipTags = true ]) : bool
Parameters
$data : string|array<string|int, mixed>
$arrayKeys : array<string|int, mixed> = []

keys of the array being checked that are excluded and included in the check

$skipTags : bool = true

skip transferred array keys, if false then check only them

Return values
bool

htmlEscape()

public htmlEscape(string|array<string|int, string> $data[, array<string|int, mixed>|null $allowedTags = null ]) : null|string|array<string|int, string>

after 1.4.0.0-rc1

Parameters
$data : string|array<string|int, string>
$allowedTags : array<string|int, mixed>|null = null
Tags
see
self::escapeHtml()
Return values
null|string|array<string|int, string>

isModuleEnabled()

Check is module exists and enabled in global config.

public isModuleEnabled([string $moduleName = null ]) : bool
Parameters
$moduleName : string = null

the full module name, example Mage_Core

Return values
bool

isModuleOutputEnabled()

Check whether the module output is enabled in Configuration

public isModuleOutputEnabled([string $moduleName = null ]) : bool
Parameters
$moduleName : string = null

Full module name

Return values
bool

jsQuoteEscape()

Escape quotes in java script

public jsQuoteEscape(string|array<string|int, string> $data[, string $quote = ''' ]) : string|array<string|int, string>
Parameters
$data : string|array<string|int, string>
$quote : string = '''
Return values
string|array<string|int, string>

quoteEscape()

Escape quotes inside html attributes Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc)

public quoteEscape(string $data[, bool $addSlashes = false ]) : string
Parameters
$data : string
$addSlashes : bool = false
Return values
string

removeTags()

Remove html tags, but leave "<" and ">" signs

public removeTags(string $html) : string
Parameters
$html : string
Return values
string

renameFile()

Rename file in DB storage

public renameFile(string $oldName, string $newName) : mixed
Parameters
$oldName : string
$newName : string

saveFile()

Save file in DB storage

public saveFile(string $filename) : mixed
Parameters
$filename : string

saveFileToFilesystem()

Save database file to file system

public saveFileToFilesystem(string $filename) : bool
Parameters
$filename : string
Return values
bool

saveUploadedFile()

Saves uploaded by Mage_Core_Model_File_Uploader file to DB with existence tests

public saveUploadedFile([array<string|int, mixed> $result = [] ]) : string

param $result should be result from Mage_Core_Model_File_Uploader::save() method Checks in DB, whether uploaded file exists ($result['file']) If yes, renames file on FS (!!!!!) Saves file with unique name into DB If passed file exists returns new name, file was renamed to (in the same context) Otherwise returns $result['file']

Parameters
$result : array<string|int, mixed> = []
Return values
string

stripTags()

Wrapper for standard strip_tags() function with extra functionality for html entities

public stripTags(string $data[, null|string|array<string|int, string> $allowableTags = null ][, bool $escape = false ]) : string
Parameters
$data : string
$allowableTags : null|string|array<string|int, string> = null
$escape : bool = false
Return values
string

translateArray()

Translate array

public translateArray([mixed $arr = [] ]) : array<string|int, mixed>

@param array $arr

Parameters
$arr : mixed = []
Return values
array<string|int, mixed>

urlDecode()

base64_decode() for URLs decoding

public urlDecode(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

urlDecodeAndEscape()

base64_decode() and escape quotes in url

public urlDecodeAndEscape(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

urlEncode()

base64_encode() for URLs encoding

public urlEncode(mixed $url) : string

@param string $url

Parameters
$url : mixed
Return values
string

urlEscape()

public urlEscape(string $data) : string

after 1.4.0.0-rc1

Parameters
$data : string
Tags
see
self::escapeHtml()
Return values
string

_getModuleName()

Retrieve helper module name

protected _getModuleName() : string
Return values
string

_getUrl()

Retrieve url

protected _getUrl(string $route[, array<string|int, mixed> $params = [] ]) : string
Parameters
$route : string
$params : array<string|int, mixed> = []
Return values
string

_loadCache()

Loading cache data

protected _loadCache(string $id) : mixed
Parameters
$id : string

_removeAbsPathFromFileName()

Convert full file path to local (as used by model) If not - returns just a filename

protected _removeAbsPathFromFileName(string $filename) : string
Parameters
$filename : string
Return values
string

_saveCache()

Saving cache

protected _saveCache(mixed $data, string $id[, array<string|int, mixed> $tags = [] ][, null|false|int $lifeTime = false ]) : Mage_Core_Helper_Abstract
Parameters
$data : mixed
$id : string
$tags : array<string|int, mixed> = []
$lifeTime : null|false|int = false
Return values
Mage_Core_Helper_Abstract

        
On this page

Search results