当前位置: 首页>>代码示例>>PHP>>正文


PHP BL::getMessage方法代码示例

本文整理汇总了PHP中BL::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP BL::getMessage方法的具体用法?PHP BL::getMessage怎么用?PHP BL::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BL的用法示例。


在下文中一共展示了BL::getMessage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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 (SpoonFile::exists($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) {
             $this->warnings[] = array('message' => BL::getMessage('InformationFileCouldNotBeLoaded'));
         }
     } else {
         $this->warnings[] = array('message' => BL::getMessage('InformationFileIsMissing'));
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:30,代码来源:detail_theme.php

示例2: loadDataGrid

 /**
  * Load the datagrid
  */
 private function loadDataGrid()
 {
     // init vars
     $langWidth = 80 / count($this->filter['language']);
     // get all the translations for the selected languages
     $translations = BackendLocaleModel::getTranslations($this->filter['application'], $this->filter['module'], $this->filter['type'], $this->filter['language'], $this->filter['name'], $this->filter['value']);
     // create datagrids
     $this->dgLabels = new BackendDataGridArray(isset($translations['lbl']) ? $translations['lbl'] : array());
     $this->dgMessages = new BackendDataGridArray(isset($translations['msg']) ? $translations['msg'] : array());
     $this->dgErrors = new BackendDataGridArray(isset($translations['err']) ? $translations['err'] : array());
     $this->dgActions = new BackendDataGridArray(isset($translations['act']) ? $translations['act'] : array());
     // put the datagrids (references) in an array so we can loop them
     $dataGrids = array('lbl' => &$this->dgLabels, 'msg' => &$this->dgMessages, 'err' => &$this->dgErrors, 'act' => &$this->dgActions);
     // loop the datagrids (as references)
     foreach ($dataGrids as $type => &$dataGrid) {
         // set sorting
         $dataGrid->setSortingColumns(array('module', 'name'), 'name');
         // disable paging
         $dataGrid->setPaging(false);
         // set header label for reference code
         $dataGrid->setHeaderLabels(array('name' => SpoonFilter::ucfirst(BL::lbl('ReferenceCode'))));
         // set column attributes for each language
         foreach ($this->filter['language'] as $lang) {
             // add a class for the inline edit
             $dataGrid->setColumnAttributes($lang, array('class' => 'translationValue'));
             // add attributes, so the inline editing has all the needed data
             $dataGrid->setColumnAttributes($lang, array('data-id' => '{language: \'' . $lang . '\', application: \'' . $this->filter['application'] . '\', module: \'[module]\', name: \'[name]\', type: \'' . $type . '\'}'));
             // escape the double quotes
             $dataGrid->setColumnFunction(array('SpoonFilter', 'htmlentities'), array('[' . $lang . ']', null, ENT_QUOTES), $lang, true);
             if ($type == 'act') {
                 $dataGrid->setColumnFunction('urldecode', array('[' . $lang . ']'), $lang, true);
             }
             // set header labels
             $dataGrid->setHeaderLabels(array($lang => SpoonFilter::ucfirst(BL::getMessage(strtoupper($lang)))));
             // set column attributes
             $dataGrid->setColumnAttributes($lang, array('style' => 'width: ' . $langWidth . '%'));
             // hide translation_id column (only if only one language is selected because the key doesn't exist if more than 1 language is selected)
             if (count($this->filter['language']) == 1) {
                 $dataGrid->setColumnHidden('translation_id');
             }
             // only 1 language selected?
             if (count($this->filter['language']) == 1) {
                 // check if this action is allowed
                 if (BackendAuthentication::isAllowedAction('edit')) {
                     // add edit button
                     $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit', null, null, null) . '&id=[translation_id]' . $this->filterQuery);
                 }
                 // check if this action is allowed
                 if (BackendAuthentication::isAllowedAction('add')) {
                     // add copy button
                     $dataGrid->addColumnAction('copy', null, BL::lbl('Copy'), BackendModel::createURLForAction('add', null, null) . '&id=[translation_id]' . $this->filterQuery, array('class' => 'button icon iconCopy linkButton'));
                 }
             }
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:59,代码来源:index.php

示例3: loadData

 /**
  * Load the data.
  * This will also set some warnings if needed.
  */
 private function loadData()
 {
     // inform that the module is not installed yet
     if (!BackendExtensionsModel::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'];
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:15,代码来源:detail_module.php

示例4: parseNumForms

 /**
  * Parse amount of forms sent for the datagrid
  *
  * @return	string
  * @param	int $formId			Id of the form.
  * @param	int $sentForms		Amount of sent forms.
  */
 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) {
         $output = sprintf(BL::getMessage('SentForms'), $sentForms);
     } else {
         $output = sprintf(BL::getMessage('SentForms'), $sentForms);
     }
     // output
     return '<a href="' . BackendModel::createURLForAction('data') . '&amp;id=' . $formId . '" title="' . $output . '">' . $output . '</a>';
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:23,代码来源:index.php

示例5: 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) {
         $output = sprintf(BL::getMessage('SentForms'), $sentForms);
     } else {
         $output = sprintf(BL::getMessage('SentForms'), $sentForms);
     }
     // check if data action is allowed
     if (BackendAuthentication::isAllowedAction('data', 'form_builder')) {
         // output
         $output = '<a href="' . BackendModel::createURLForAction('data') . '&amp;id=' . $formId . '" title="' . $output . '">' . $output . '</a>';
     }
     return $output;
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:27,代码来源:index.php

示例6: parse

 /**
  * Parses the html for this filefield.
  *
  * @param SpoonTemplate[optional] $template The template to parse the element in.
  * @return string
  */
 public function parse(SpoonTemplate $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) {
         if (isset($this->attributes['extension'])) {
             $output .= '<span class="helpTxt">' . sprintf(BL::getMessage('HelpFileFieldWithMaxFileSize', 'core'), $this->attributes['extension'], $uploadMaxFilesize) . '</span>';
         } else {
             $output .= '<span class="helpTxt">' . sprintf(BL::getMessage('HelpMaxFileSize'), $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;
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:52,代码来源:form.php

示例7: getModuleInformation

 /**
  * Fetch the module information from the info.xml file.
  *
  * @param string $module
  * @return array
  */
 public static function getModuleInformation($module)
 {
     // path to information file
     $pathInfoXml = BACKEND_MODULES_PATH . '/' . $module . '/info.xml';
     // the module information
     $information = array('data' => array(), 'warnings' => array());
     // information needs to exists
     if (SpoonFile::exists($pathInfoXml)) {
         try {
             // load info.xml
             $infoXml = @new SimpleXMLElement($pathInfoXml, LIBXML_NOCDATA, true);
             // convert xml to useful array
             $information['data'] = self::processModuleXml($infoXml);
             // empty data (nothing useful)
             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;
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:40,代码来源:model.php

示例8: loadData

 /**
  * Load the data.
  * This will also set some warnings if needed.
  */
 private function loadData()
 {
     // inform that the module is not installed yet
     if (!BackendExtensionsModel::isModuleInstalled($this->currentModule)) {
         $this->warnings[] = array('message' => BL::getMessage('InformationModuleIsNotInstalled'));
     }
     // path to information file
     $pathInfoXml = BACKEND_MODULES_PATH . '/' . $this->currentModule . '/info.xml';
     // information needs to exists
     if (SpoonFile::exists($pathInfoXml)) {
         try {
             // load info.xml
             $infoXml = @new SimpleXMLElement($pathInfoXml, LIBXML_NOCDATA, true);
             // convert xml to useful array
             $this->information = BackendExtensionsModel::processModuleXml($infoXml);
             // empty data (nothing useful)
             if (empty($this->information)) {
                 $this->warnings[] = array('message' => BL::getMessage('InformationFileIsEmpty'));
             }
             // check if cronjobs are installed already
             if (isset($this->information['cronjobs'])) {
                 foreach ($this->information['cronjobs'] as $cronjob) {
                     if (!$cronjob['active']) {
                         $this->warnings[] = array('message' => BL::getError('CronjobsNotSet'));
                     }
                     break;
                 }
             }
         } catch (Exception $e) {
             $this->warnings[] = array('message' => BL::getMessage('InformationFileCouldNotBeLoaded'));
         }
     } else {
         $this->warnings[] = array('message' => BL::getMessage('InformationFileIsMissing'));
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:39,代码来源:detail_module.php

示例9: validateForm

 /**
  * Validate a submitted form and process it.
  */
 private function validateForm()
 {
     // the form is submitted
     if ($this->frm->isSubmitted()) {
         // shorten field variables
         $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) {
                                 $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 {
                         $fileFile->addError(BL::getError('FileIsEmpty'));
                     }
                 } else {
                     $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);
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:83,代码来源:upload_theme.php


注:本文中的BL::getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。