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


PHP E::ModuleLang方法代码示例

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


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

示例1: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue    Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if (is_array($sValue)) {
         return $this->getMessage(E::ModuleLang()->Get('validate_tags_empty', null, false), 'msg', array('min' => $this->min, 'max' => $this->max));
     }
     if ($this->allowEmpty && $this->isEmpty($sValue)) {
         return true;
     }
     $aTags = explode($this->sep, trim($sValue, "\r\n\t\v ."));
     $aTagsNew = array();
     $aTagsNewLow = array();
     foreach ($aTags as $sTag) {
         $sTag = trim($sTag, "\r\n\t\v .");
         $iLength = mb_strlen($sTag, 'UTF-8');
         if ($iLength >= $this->min and $iLength <= $this->max and !in_array(mb_strtolower($sTag, 'UTF-8'), $aTagsNewLow)) {
             $aTagsNew[] = $sTag;
             $aTagsNewLow[] = mb_strtolower($sTag, 'UTF-8');
         }
     }
     $iCount = count($aTagsNew);
     if ($iCount > $this->count) {
         return $this->getMessage(E::ModuleLang()->Get('validate_tags_count_more', null, false), 'msg', array('count' => $this->count));
     } elseif (!$iCount) {
         return $this->getMessage(E::ModuleLang()->Get('validate_tags_empty', null, false), 'msg', array('min' => $this->min, 'max' => $this->max));
     }
     /**
      * Если проверка от сущности, то возвращаем обновленное значение
      */
     if ($this->oEntityCurrent) {
         $this->setValueOfCurrentEntity($this->sFieldCurrent, join($this->sep, $aTagsNew));
     }
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:40,代码来源:ValidatorTags.entity.class.php

示例2: ValidateTarget

 /**
  * Валидация пользователя
  *
  * @param string $sValue     Значение
  * @param array  $aParams    Параметры
  *
  * @return bool
  */
 public function ValidateTarget($sValue, $aParams)
 {
     if (($oUserTarget = E::ModuleUser()->GetUserById($sValue)) && $this->getUserId() != $oUserTarget->getId()) {
         return true;
     }
     return E::ModuleLang()->Get('user_note_target_error');
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:15,代码来源:Note.entity.class.php

示例3: LoadFromXml

 /**
  * @param string $sSkinXML
  * @param array $aData
  */
 public function LoadFromXml($sSkinXML, $aData = null)
 {
     if (Is_null($aData)) {
         $aData = array();
     }
     $oXml = @simplexml_load_string($sSkinXML);
     if (!$oXml) {
         $sXml = '<?xml version="1.0" encoding="UTF-8"?>
             <skin>
                 <name><lang name="default">' . (isset($aData['id']) ? $aData['id'] : '') . '</lang></name>' . '</skin>';
         $oXml = @simplexml_load_string($sXml);
     }
     // Обрабатываем данные манифеста
     $sLang = E::ModuleLang()->GetLang();
     $this->_xlang($oXml, 'name', $sLang);
     $this->_xlang($oXml, 'author', $sLang);
     $this->_xlang($oXml, 'description', $sLang, true);
     //$oXml->homepage = E::ModuleText()->Parser((string)$oXml->homepage);
     $oXml->homepage = filter_var((string) $oXml->homepage, FILTER_SANITIZE_URL);
     if ($sId = (string) $oXml->id) {
         $aData['id'] = $sId;
     }
     $aData['property'] = $oXml;
     $this->setProps($aData);
 }
开发者ID:hard990,项目名称:altocms,代码行数:29,代码来源:Skin.entity.class.php

示例4: SubmitComment

 protected function SubmitComment()
 {
     /**
      * Проверям авторизован ли пользователь
      */
     if (!E::ModuleUser()->IsAuthorization()) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('need_authorization'), E::ModuleLang()->Get('error'));
         return;
     }
     $xResult = E::Module('PluginMagicrules\\Rule')->CheckRuleAction('create_comment', $this->oUserCurrent);
     if (true === $xResult) {
         $xResult = E::Module('PluginMagicrules\\Rule')->CheckRuleCreateAction('comment', $this->oUserCurrent);
     }
     if (true === $xResult) {
         return parent::SubmitComment();
     } else {
         if (is_string($xResult)) {
             E::ModuleMessage()->AddErrorSingle($xResult, E::ModuleLang()->Get('attention'));
             return;
         } else {
             E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('plugin.magicrules.check_rule_action_error'), E::ModuleLang()->Get('attention'));
             return;
         }
     }
 }
开发者ID:andrey-v,项目名称:alto-plugin-magicrules,代码行数:25,代码来源:ActionBlog.class.php

示例5: _text

 protected function _text($sText)
 {
     $sText = (string) $sText;
     if ($sText && substr($sText, 0, 2) == '{{' && substr($sText, -2) == '}}') {
         $sText = E::ModuleLang()->Get('plugin.magicrules.' . substr($sText, 2, strlen($sText) - 4));
     }
     return $sText;
 }
开发者ID:altocms,项目名称:alto-plugin-magicrules,代码行数:8,代码来源:Rule.class.php

示例6: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue    Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if ($this->allowEmpty && $this->isEmpty($sValue)) {
         return true;
     }
     if (!$this->strict && $sValue != $this->trueValue && $sValue != $this->falseValue || $this->strict && $sValue !== $this->trueValue && $sValue !== $this->falseValue) {
         return $this->getMessage(E::ModuleLang()->Get('validate_boolean_invalid', null, false), 'msg', array('true' => $this->trueValue, 'false' => $this->falseValue));
     }
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:17,代码来源:ValidatorBoolean.entity.class.php

示例7: getLangText

 public function getLangText($sTextTemplate, $sLang = NULL)
 {
     return preg_replace_callback('~(\\{\\{\\S*\\}\\})~', function ($sTextTemplatePart) {
         $sTextTemplatePart = array_shift($sTextTemplatePart);
         if (!is_null($sText = E::ModuleLang()->Get(substr($sTextTemplatePart, 2, strlen($sTextTemplatePart) - 4)))) {
             return $sText;
         }
         return $sTextTemplatePart;
     }, $sTextTemplate);
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:10,代码来源:ItemOptions.entity.class.php

示例8: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue    Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if ($this->allowEmpty && $this->isEmpty($sValue)) {
         return true;
     }
     if (E::ModuleCaptcha()->Verify(mb_strtolower($sValue)) !== 0) {
         return $this->getMessage(E::ModuleLang()->Get('validate_captcha_not_valid', null, false), 'msg');
     }
     return E::ModuleCaptcha()->Verify(mb_strtolower($sValue)) === 0;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:17,代码来源:ValidatorCaptcha.entity.class.php

示例9: EventDownloadFile

 public function EventDownloadFile()
 {
     $this->SetTemplate(false);
     $sTopicId = $this->GetParam(0);
     $sFieldId = $this->GetParam(1);
     E::ModuleSecurity()->ValidateSendForm();
     if (!($oTopic = E::ModuleTopic()->GetTopicById($sTopicId))) {
         return parent::EventNotFound();
     }
     if (!($this->oType = E::ModuleTopic()->GetContentType($oTopic->getType()))) {
         return parent::EventNotFound();
     }
     if (!($oField = E::ModuleTopic()->GetContentFieldById($sFieldId))) {
         return parent::EventNotFound();
     }
     if ($oField->getContentId() != $this->oType->getContentId()) {
         return parent::EventNotFound();
     }
     //получаем объект файла
     $oFile = $oTopic->getFieldFile($oField->getFieldId());
     //получаем объект поля топика, содержащий данные о файле
     $oValue = $oTopic->getField($oField->getFieldId());
     if ($oFile && $oValue) {
         if (preg_match("/^(http:\\/\\/)/i", $oFile->getFileUrl())) {
             $sFullPath = $oFile->getFileUrl();
             R::Location($sFullPath);
         } else {
             $sFullPath = Config::Get('path.root.dir') . $oFile->getFileUrl();
         }
         $sFilename = $oFile->getFileName();
         /*
          * Обновляем данные
          */
         $aFileObj = array();
         $aFileObj['file_name'] = $oFile->getFileName();
         $aFileObj['file_url'] = $oFile->getFileUrl();
         $aFileObj['file_size'] = $oFile->getFileSize();
         $aFileObj['file_extension'] = $oFile->getFileExtension();
         $aFileObj['file_downloads'] = $oFile->getFileDownloads() + 1;
         $sText = serialize($aFileObj);
         $oValue->setValue($sText);
         $oValue->setValueSource($sText);
         //сохраняем
         E::ModuleTopic()->UpdateContentFieldValue($oValue);
         /*
          * Отдаем файл
          */
         header('Content-type: ' . $oFile->getFileExtension());
         header('Content-Disposition: attachment; filename="' . $sFilename . '"');
         F::File_PrintChunked($sFullPath);
     } else {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('content_download_file_error'));
         return R::Action('error');
     }
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:55,代码来源:ActionDownload.class.php

示例10: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue    Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if ($this->requiredValue !== null) {
         if (!$this->strict && $sValue != $this->requiredValue || $this->strict && $sValue !== $this->requiredValue) {
             return $this->getMessage(E::ModuleLang()->Get('validate_required_must_be', null, false), 'msg', array('value' => $this->requiredValue));
         }
     } else {
         if ($this->isEmpty($sValue, true)) {
             return $this->getMessage(E::ModuleLang()->Get('validate_required_cannot_blank', null, false), 'msg');
         }
     }
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:20,代码来源:ValidatorRequired.entity.class.php

示例11: EventConfig

 public function EventConfig()
 {
     $sFile = Plugin::GetPath(__CLASS__) . 'config/sphinx-src.conf';
     $sText = F::File_GetContents($sFile);
     $sPath = F::File_NormPath(Config::Get('plugin.sphinx.path') . '/');
     $sDescription = E::ModuleLang()->Get('plugin.sphinx.conf_description', array('path' => $sPath, 'prefix' => Config::Get('plugin.sphinx.prefix')));
     $sDescription = preg_replace('/\\s\\s+/', ' ', str_replace("\n", "\n## ", $sDescription));
     $sTitle = E::ModuleLang()->Get('plugin.sphinx.conf_title');
     $aData = array('{{title}}' => $sTitle, '{{description}}' => $sDescription, '{{db_type}}' => Config::Get('db.params.type') == 'postgresql' ? 'pgsql' : 'mysql', '{{db_host}}' => Config::Get('db.params.host'), '{{db_user}}' => Config::Get('db.params.user'), '{{db_pass}}' => Config::Get('db.params.pass'), '{{db_name}}' => Config::Get('db.params.dbname'), '{{db_port}}' => Config::Get('db.params.port'), '{{db_prefix}}' => Config::Get('db.table.prefix'), '{{db_socket}}' => Config::Get('plugin.sphinx.db_socket'), '{{spinx_prefix}}' => Config::Get('plugin.sphinx.prefix'), '{{spinx_path}}' => $sPath);
     $sText = str_replace(array_keys($aData), array_values($aData), $sText);
     echo '<pre>';
     echo $sText;
     echo '</pre>';
     exit;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:15,代码来源:ActionSphinx.class.php

示例12: ValidatePid

 /**
  * Валидация родительского сообщения
  *
  * @param string $sValue     Проверяемое значение
  * @param array  $aParams    Параметры
  *
  * @return bool|string
  */
 public function ValidatePid($sValue, $aParams)
 {
     if (!$sValue) {
         $this->setPid(null);
         return true;
     } elseif ($oParentWall = $this->GetPidWall()) {
         /**
          * Если отвечаем на сообщение нужной стены и оно корневое, то все ОК
          */
         if ($oParentWall->getWallUserId() == $this->getWallUserId() and !$oParentWall->getPid()) {
             return true;
         }
     }
     return E::ModuleLang()->Get('wall_add_pid_error');
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:23,代码来源:Wall.entity.class.php

示例13: EventAdd

 protected function EventAdd()
 {
     $xResult = E::Module('PluginMagicrules\\Rule')->CheckRuleAction('create_topic', $this->oUserCurrent);
     if ($xResult === true) {
         return parent::EventAdd();
     } else {
         if (is_string($xResult)) {
             E::ModuleMessage()->AddErrorSingle($xResult, E::ModuleLang()->Get('attention'));
             return Router::Action('error');
         } else {
             E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('plugin.magicrules.check_rule_action_error'), E::ModuleLang()->Get('attention'));
             return Router::Action('error');
         }
     }
 }
开发者ID:altocms,项目名称:alto-plugin-magicrules,代码行数:15,代码来源:ActionContent.class.php

示例14: EventWallAdd

 /**
  * Добавление записи на стену
  */
 public function EventWallAdd()
 {
     // * Устанавливаем формат Ajax ответа
     E::ModuleViewer()->SetResponseAjax('json');
     // * Пользователь авторизован?
     if (!E::IsUser()) {
         return parent::EventNotFound();
     }
     $xResult = E::Module('PluginMagicrules\\Rule')->CheckRuleAction('create_wall', E::User());
     if ($xResult === true) {
         return parent::EventWallAdd();
     } else {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('plugin.magicrules.check_rule_action_error'), E::ModuleLang()->Get('attention'));
         return Router::Action('error');
     }
 }
开发者ID:altocms,项目名称:alto-plugin-magicrules,代码行数:19,代码来源:ActionProfile.class.php

示例15: validate

 /**
  * Запуск валидации
  *
  * @param mixed $sValue    Данные для валидации
  *
  * @return bool|string
  */
 public function validate($sValue)
 {
     if (is_array($sValue)) {
         return $this->getMessage(E::ModuleLang()->Get('validate_regexp_invalid_pattern', null, false), 'msg');
     }
     if ($this->allowEmpty && $this->isEmpty($sValue)) {
         return true;
     }
     if ($this->pattern === null) {
         return $this->getMessage(E::ModuleLang()->Get('validate_regexp_invalid_pattern', null, false), 'msg');
     }
     if (!$this->not && !preg_match($this->pattern, $sValue) || $this->not && preg_match($this->pattern, $sValue)) {
         return $this->getMessage(E::ModuleLang()->Get('validate_regexp_not_valid', null, false), 'msg');
     }
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:23,代码来源:ValidatorRegexp.entity.class.php


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