本文整理汇总了PHP中Backend\Core\Engine\Language::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::getMessage方法的具体用法?PHP Language::getMessage怎么用?PHP Language::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Core\Engine\Language
的用法示例。
在下文中一共展示了Language::getMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadData
/**
* Load the data.
* This will also set some warnings if needed.
*/
private function loadData()
{
// inform that the module is not installed yet
if (!BackendModel::isModuleInstalled($this->currentModule)) {
$this->warnings[] = array('message' => BL::getMessage('InformationModuleIsNotInstalled'));
}
// fetch the module information
$moduleInformation = BackendExtensionsModel::getModuleInformation($this->currentModule);
$this->information = $moduleInformation['data'];
$this->warnings = $this->warnings + $moduleInformation['warnings'];
}
示例2: parseNumForms
/**
* Parse amount of forms sent for the datagrid
*
* @param int $formId Id of the form.
* @param int $sentForms Amount of sent forms.
* @return string
*/
public static function parseNumForms($formId, $sentForms)
{
// redefine
$formId = (int) $formId;
$sentForms = (int) $sentForms;
// one form sent
if ($sentForms == 1) {
$output = BL::getMessage('OneSentForm');
} elseif ($sentForms > 1) {
// multiple forms sent
$output = sprintf(BL::getMessage('SentForms'), $sentForms);
} else {
// no forms sent
$output = sprintf(BL::getMessage('SentForms'), $sentForms);
}
// check if data action is allowed
if (BackendAuthentication::isAllowedAction('Data', 'FormBuilder')) {
// output
$output = '<a href="' . BackendModel::createURLForAction('Data') . '&id=' . $formId . '" title="' . $output . '">' . $output . '</a>';
}
return $output;
}
示例3: getModuleInformation
/**
* Fetch the module information from the info.xml file.
*
* @param string $module
* @return array
*/
public static function getModuleInformation($module)
{
$pathInfoXml = BACKEND_MODULES_PATH . '/' . $module . '/info.xml';
$information = array('data' => array(), 'warnings' => array());
if (is_file($pathInfoXml)) {
try {
$infoXml = @new \SimpleXMLElement($pathInfoXml, LIBXML_NOCDATA, true);
$information['data'] = self::processModuleXml($infoXml);
if (empty($information['data'])) {
$information['warnings'][] = array('message' => BL::getMessage('InformationFileIsEmpty'));
}
// check if cronjobs are installed already
if (isset($information['data']['cronjobs'])) {
foreach ($information['data']['cronjobs'] as $cronjob) {
if (!$cronjob['active']) {
$information['warnings'][] = array('message' => BL::getError('CronjobsNotSet'));
}
break;
}
}
} catch (Exception $e) {
$information['warnings'][] = array('message' => BL::getMessage('InformationFileCouldNotBeLoaded'));
}
} else {
$information['warnings'][] = array('message' => BL::getMessage('InformationFileIsMissing'));
}
return $information;
}
示例4: parse
/**
* Parses the html for this filefield.
*
* @param \SpoonTemplate $template The template to parse the element in.
* @return string
* @throws \SpoonFormException
*/
public function parse($template = null)
{
// get upload_max_filesize
$uploadMaxFilesize = ini_get('upload_max_filesize');
if ($uploadMaxFilesize === false) {
$uploadMaxFilesize = 0;
}
// reformat if defined as an integer
if (\SpoonFilter::isInteger($uploadMaxFilesize)) {
$uploadMaxFilesize = $uploadMaxFilesize / 1024 . 'MB';
}
// reformat if specified in kB
if (strtoupper(substr($uploadMaxFilesize, -1, 1)) == 'K') {
$uploadMaxFilesize = substr($uploadMaxFilesize, 0, -1) . 'kB';
}
// reformat if specified in MB
if (strtoupper(substr($uploadMaxFilesize, -1, 1)) == 'M') {
$uploadMaxFilesize .= 'B';
}
// reformat if specified in GB
if (strtoupper(substr($uploadMaxFilesize, -1, 1)) == 'G') {
$uploadMaxFilesize .= 'B';
}
// name is required
if ($this->attributes['name'] == '') {
throw new \SpoonFormException('A name is required for a file field. Please provide a name.');
}
// start html generation
$output = '<input type="file"';
// add attributes
$output .= $this->getAttributesHTML(array('[id]' => $this->attributes['id'], '[name]' => $this->attributes['name'])) . ' />';
// add help txt if needed
if (!$this->hideHelpTxt) {
$output .= '<span class="helpTxt">' . sprintf(Language::getMessage('HelpImageFieldWithMaxFileSize', 'core'), $uploadMaxFilesize) . '</span>';
}
// parse to template
if ($template !== null) {
$template->assign('file' . \SpoonFilter::toCamelCase($this->attributes['name']), $output);
$template->assign('file' . \SpoonFilter::toCamelCase($this->attributes['name']) . 'Error', $this->errors != '' ? '<span class="formError">' . $this->errors . '</span>' : '');
}
return $output;
}
示例5: loadData
/**
* Load the data.
* This will also set some warnings if needed.
*/
private function loadData()
{
// inform that the theme is not installed yet
if (!BackendExtensionsModel::isThemeInstalled($this->currentTheme)) {
$this->warnings[] = array('message' => BL::getMessage('InformationThemeIsNotInstalled'));
}
// path to information file
$pathInfoXml = FRONTEND_PATH . '/Themes/' . $this->currentTheme . '/info.xml';
// information needs to exists
if (is_file($pathInfoXml)) {
try {
// load info.xml
$infoXml = @new \SimpleXMLElement($pathInfoXml, LIBXML_NOCDATA, true);
// convert xml to useful array
$this->information = BackendExtensionsModel::processThemeXml($infoXml);
// empty data (nothing useful)
if (empty($this->information)) {
$this->warnings[] = array('message' => BL::getMessage('InformationFileIsEmpty'));
}
} catch (\Exception $e) {
// warning that the information file is corrupt
$this->warnings[] = array('message' => BL::getMessage('InformationFileCouldNotBeLoaded'));
}
} else {
// warning that the information file is missing
$this->warnings[] = array('message' => BL::getMessage('InformationFileIsMissing'));
}
}
示例6: validateForm
/**
* Validate a submitted form and process it.
*/
private function validateForm()
{
// the form is submitted
if ($this->frm->isSubmitted()) {
// shorten field variables
/** @var $fileFile \SpoonFormFile */
$fileFile = $this->frm->getField('file');
// validate the file
if ($fileFile->isFilled(BL::err('FieldIsRequired'))) {
// only zip files allowed
if ($fileFile->isAllowedExtension(array('zip'), sprintf(BL::getError('ExtensionNotAllowed'), 'zip'))) {
// create ziparchive instance
$zip = new \ZipArchive();
// try and open it
if ($zip->open($fileFile->getTempFileName()) === true) {
// zip file needs to contain some files
if ($zip->numFiles > 0) {
// get first entry (= the theme folder)
$file = $zip->statIndex(0);
// name of the module we are trying to upload
$themeName = trim($file['name'], '/');
// find info.xml
$infoXml = $zip->getFromName($themeName . '/info.xml');
// add error if info.xml is not found
if ($infoXml === false) {
$fileFile->addError(sprintf(BL::getError('NoInformationFile'), $themeName));
} else {
// parse xml
try {
// load info.xml
$infoXml = @new \SimpleXMLElement($infoXml, LIBXML_NOCDATA, false);
// convert xml to useful array
$this->information = BackendExtensionsModel::processThemeXml($infoXml);
// empty data (nothing useful)
if (empty($this->information)) {
$fileFile->addError(BL::getMessage('InformationFileIsEmpty'));
}
// check if theme name in info.xml matches folder name
if ($this->information['name'] != $themeName) {
$fileFile->addError(BL::err('ThemeNameDoesntMatch'));
}
} catch (\Exception $e) {
// warning that the information file is corrupt
$fileFile->addError(BL::getMessage('InformationFileCouldNotBeLoaded'));
}
}
// wow wow, you are trying to upload an already existing theme
if (BackendExtensionsModel::existsTheme($themeName)) {
$fileFile->addError(sprintf(BL::getError('ThemeAlreadyExists'), $themeName));
}
// list of validated files (these files will actually be unpacked)
$files = array();
// check every file in the zip
for ($i = 0; $i < $zip->numFiles; $i++) {
// get the file name
$file = $zip->statIndex($i);
$fileName = $file['name'];
// yay, in a valid directory
if (stripos($fileName, $themeName . '/') === 0) {
// valid file, add to extraction-list
$files[] = $fileName;
}
}
} else {
// empty zip file
$fileFile->addError(BL::getError('FileIsEmpty'));
}
} else {
// something went very wrong, probably corrupted
$fileFile->addError(BL::getError('CorruptedFile'));
}
}
}
// passed all validation
if ($this->frm->isCorrect()) {
// unpack module files
$zip->extractTo(FRONTEND_PATH . '/Themes', $files);
// run installer
BackendExtensionsModel::installTheme($themeName);
// redirect with fireworks
$this->redirect(BackendModel::createURLForAction('Themes') . '&report=theme-installed&var=' . $themeName);
}
}
}