This class save the translations from a modul in a file
and get it from file.
Saves the Modul-Input in a file (input.php) and
Modul-Output in a file(output.php).
All moduls of a clients are in [frontend]/modules/.
Methods
Construct for the class cModuleHandler.
__construct(int $idmodul, bool $static) : void
With this class you can
make a new Modul, rename a Modul. You can save a Output from Modul and
Input in a
file. The save rules are [Modulname] (is uneque) the files input and
output will be named
[Modulname]_input.php , [Modulname]_output.php
Parameters
$idmodul
int
$static
bool
if true it will load once the translation from file
Exceptions
Set the new modul name.
changeModuleName($name)
Inherited
var |
string |
inherited_from |
\cModuleHandler::changeModuleName() |
Parameters
$name
Make in all clients the module directory
createAllMainDirectories() : void
Inherited
inherited_from |
\cModuleHandler::createAllMainDirectories() |
Exceptions
\cException |
if the frontend path can not be found or the module
directory cann ot be created |
Make a new module into the modul dir.
createModule($input, $output) : bool
Inherited
The modul name will be [ModulName] example
Contact_Form or GoogleMaps2.
inherited_from |
\cModuleHandler::createModule() |
Parameters
$input
$output
Returns
bool
if modul exist or mkdir and saveInput and saveOutput success
return true.
Else if the mkdir or saveInput or saveOutput not success return
false.
Make and save new file
createModuleFile(string $type, string $fileName, string $content)
Inherited
inherited_from |
\cModuleHandler::createModuleFile() |
Parameters
$type
string
css | js | template directory of the file
$fileName
string
file name
$content
string
content of the file
Delete file
deleteFile(string $type, string $fileName)
Inherited
inherited_from |
\cModuleHandler::deleteFile() |
Parameters
$type
string
js |template | css directory of the file
$fileName
string
file name
Removes this module from the filesystem.
eraseModule() : bool
Inherited
Also deletes the version files.
inherited_from |
\cModuleHandler::eraseModule() |
Returns
bool
true on success or false on failure
Check if exist a file
existFile(string $type, string $fileName)
Inherited
inherited_from |
\cModuleHandler::existFile() |
Parameters
$type
string
js | template | css the directory of the file
$fileName
string
file name
Get all files from a module directory
getAllFilesFromDirectory(string $moduleDirectory) : array
Inherited
inherited_from |
\cModuleHandler::getAllFilesFromDirectory() |
Parameters
$moduleDirectory
string
template css or js...
Returns
array
Get the cleaned name
getCleanName($name, $defaultChar)
InheritedStatic
inherited_from |
\cModuleHandler::getCleanName() |
Parameters
$name
$defaultChar
Get the main css file modulenam.css
getCssFileName() : string
Inherited
inherited_from |
\cModuleHandler::getCssFileName() |
Returns
string
Get the css path of the modul
getCssPath() : string
Inherited
inherited_from |
\cModuleHandler::getCssPath() |
Returns
string
getEncoding()
getEncoding()
InheritedStatic
inherited_from |
\cModuleHandler::getEncoding() |
Get the content of file, modul js or css or template or php
getFilesContent(string $directory, string $fileTyp, $fileName)
Inherited
inherited_from |
\cModuleHandler::getFilesContent() |
Parameters
$directory
string
where in module should we look
$fileName
Get the name of the main js file (modulname.js)
getJsFileName() : string
Inherited
inherited_from |
\cModuleHandler::getJsFileName() |
Returns
string
the name of the js file
Get the js path of the modul
getJsPath() : string
Inherited
inherited_from |
\cModuleHandler::getJsPath() |
Returns
string
Get the lang array.
getLangArray() : array
Get the Modul Path also cms path + module + module name.
getModulePath() : string
Inherited
inherited_from |
\cModuleHandler::getModulePath() |
Returns
string
Get the php path of the modul
getPhpPath() : string
Inherited
inherited_from |
\cModuleHandler::getPhpPath() |
Returns
string
Get the template path.
getTemplatePath(string $file) : string
Inherited
If file is set it will
return the complete paht + file
inherited_from |
\cModuleHandler::getTemplatePath() |
Parameters
$file
string
Returns
string
Get the translations array.
getTranslationArray() : array
Init the vars of the class.
initWithDatabaseRow($db)
Inherited
inherited_from |
\cModuleHandler::initWithDatabaseRow() |
Parameters
$db
Can write/create a file
isWritable(string $fileName, string $directory) : \bool,
Inherited
inherited_from |
\cModuleHandler::isWritable() |
Parameters
$fileName
string
file name
$directory
string
directory where is the file
Returns
\bool,
success true else false
Show if the Modul with the modul name exist in modul dir.
modulePathExists()
Inherited
return bool if the modul exist return true, else false
inherited_from |
\cModuleHandler::modulePathExists() |
Exist the modulname in directory
modulePathExistsInDirectory(string $name)
Inherited
inherited_from |
\cModuleHandler::modulePathExistsInDirectory() |
Parameters
$name
string
Read the output of the file _output.php
readOutput() : string
Inherited
inherited_from |
\cModuleHandler::readOutput() |
Returns
string
Contents of the Module file( _output.php)
Rename a modul and the input and output files.
renameModul(string $old, string $new) : bool
Inherited
inherited_from |
\cModuleHandler::renameModul() |
Parameters
$old
string
old name of the modul
$new
string
new name of the modul
Returns
bool
true if success
Rename a file
renameModuleFile(string $type, string $oldFileName, string $newFileName) : boolean
Inherited
inherited_from |
\cModuleHandler::renameModuleFile() |
Parameters
$type
string
css | js | template directory of the file
$oldFileName
string
old name of the file
$newFileName
string
the new name of the file
Returns
boolean
by success return true
saveAllTranslations()
saveAllTranslations()
Save a content in the file, use for css/js
saveContentToFile(\unknown_type $templateName, \unknown_type $fileType, \unknown_type $fileContent, $saveDirectory) : false
Inherited
inherited_from |
\cModuleHandler::saveContentToFile() |
Parameters
$templateName
\unknown_type
$fileType
\unknown_type
$fileContent
\unknown_type
$saveDirectory
Returns
false
or string
This method save a xml file with modul information.
saveInfoXML(string $moduleName, string $description, string $type, $alias) : true
Inherited
If the params not set, get the value from this
inherited_from |
\cModuleHandler::saveInfoXML() |
Parameters
$moduleName
string
name of the modul
$description
string
description of the modul
$type
string
type of the modul
$alias
Returns
true
if success else false
Save a string into the file (_output.php).
saveOutput(string $output) : bool
Inherited
inherited_from |
\cModuleHandler::saveOutput() |
Parameters
$output
string
Returns
bool
if the action (save contents into the file _output.php is
success) return true else false
Save the contents of the wordListArray in file.
saveTranslationArray(array $wordListArray) : boolean
Parameters
$wordListArray
array
Returns
boolean
true if success else false
Save the hole translations for a idmod and lang.
saveTranslations() : void
Save all translations from db in Filesystem.
saveTranslationsFromDbToFile()
Warning let run once, twice will be erase the translation witch are
there.
setEncoding()
setEncoding($encoding)
InheritedStatic
inherited_from |
\cModuleHandler::setEncoding() |
Parameters
$encoding
Init the vars of the class, make a query to the Db
_initByModule(int $idmod)
Inherited
inherited_from |
\cModuleHandler::_initByModule() |
Parameters
$idmod
int
the id of the modul
_initWithDatabaseRow()
_initWithDatabaseRow($db)
Inherited
inherited_from |
\cModuleHandler::_initWithDatabaseRow() |
Parameters
$db
Make main module directory.
_makeModuleDirectory() : boolean
Inherited
inherited_from |
\cModuleHandler::_makeModuleDirectory() |
Returns
boolean
Make a directory template/css/image/js/php if not exist
createModuleDirectory(string $type)
Inherited
inherited_from |
\cModuleHandler::createModuleDirectory() |
Parameters
$type
string
Returns random characters
getRandomCharacters(integer $count) : string
Inherited
inherited_from |
\cModuleHandler::getRandomCharacters() |
Parameters
$count
integer
amount of characters
Returns
string
Get the value of a item from properties db.
_getValueFromProperties(string $type, string $name) : string
Parameters
$type
string
$name
string
Returns
string
value
_rec_rmdir()
_rec_rmdir($path)
Inherited
inherited_from |
\cModuleHandler::_rec_rmdir() |
Parameters
$path
This method serialize a array.
_serializeArray(array $wordListArray) : string
$key.[Divider].$value."\r\n"
Parameters
$wordListArray
array
Returns
string
This method unserialize a string.
_unserializeArray(string $string) : array
The contents of file looks like original String [Divider] Translation
String.
If divider is =
Example: Hello World=Hallo Welt
Parameters
$string
string
the contents of the file
Returns
array
Properties
$originalTranslationDivider
$_cfg : array
Inherited
inherited_from |
\cModuleHandler::$$_cfg |
$_cfgClient : array
Inherited
inherited_from |
\cModuleHandler::$$_cfgClient |
$_client : int
Inherited
inherited_from |
\cModuleHandler::$$_client |
$_description : string
Inherited
inherited_from |
\cModuleHandler::$$_description |
$_directories : array
Inherited
inherited_from |
\cModuleHandler::$$_directories |
$_encoding : string
Inherited
inherited_from |
\cModuleHandler::$$_encoding |
$_encodingStore
Inherited
inherited_from |
\cModuleHandler::$$_encodingStore |
$_fileEncoding : string
Inherited
..)
getEffectiveSetting('encoding', 'file_encoding','UTF-8')
inherited_from |
\cModuleHandler::$$_fileEncoding |
$_idlang : int
Inherited
inherited_from |
\cModuleHandler::$$_idlang |
$_idmod : int
Inherited
inherited_from |
\cModuleHandler::$$_idmod |
$_moduleAlias : string
Inherited
inherited_from |
\cModuleHandler::$$_moduleAlias |
$_output : string
Inherited
inherited_from |
\cModuleHandler::$$_output |
$_overrideEncoding
Inherited
inherited_from |
\cModuleHandler::$$_overrideEncoding |
$_type : string
Inherited
inherited_from |
\cModuleHandler::$$_type |
$_db : \DB_Contenido
Inherited
inherited_from |
\cModuleHandler::$$_db |
$_moduleName : string
Inherited
inherited_from |
\cModuleHandler::$$_moduleName |
$_path : string
Inherited
inherited_from |
\cModuleHandler::$$_path |