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


PHP E类代码示例

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


在下文中一共展示了E类的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: 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

示例3: 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

示例4: SetSecurityKey

 public function SetSecurityKey()
 {
     $sCode = parent::SetSecurityKey();
     // LS-compatible
     E::ModuleViewer()->Assign('LIVESTREET_SECURITY_KEY', $sCode);
     return $sCode;
 }
开发者ID:hard990,项目名称:altocms,代码行数:7,代码来源:Security.class.php

示例5: Verify

 /**
  * @param string $sKeyString
  * @param string $sKeyName
  *
  * @return int
  */
 public function Verify($sKeyString, $sKeyName = null)
 {
     $iResult = 0;
     if (empty($sKeyString)) {
         $iResult = static::ERR_KEYSTRING_EMPTY;
     } elseif (!is_string($sKeyString)) {
         $iResult = static::ERR_KEYSTRING_NOT_STR;
     } else {
         if (!$sKeyName) {
             $sKeyName = $this->sKeyName;
         }
         $sSavedString = E::ModuleSession()->Get($sKeyName);
         // issue#342. При регистрации метод вызывается несколько раз в том
         // числе и при проверки формы аяксом при первой проверке значение
         // капчи сбрасывается и в дальнейшем проверка не проходит. Сброс капчи
         // теперь происходит только после успешной регистрации
         // E::ModuleSession()->Drop($sKeyName);
         if (empty($sSavedString) || !is_string($sSavedString)) {
             $iResult = static::ERR_KEYSTRING_NOT_DEFINED;
         } elseif ($sSavedString != $sKeyString) {
             $iResult = static::ERR_KEYSTRING_NOT_VALID;
         }
     }
     return $iResult;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:31,代码来源:Captcha.class.php

示例6: InjectProfileLink

 public function InjectProfileLink()
 {
     $sTemplatePath = Plugin::GetTemplatePath(__CLASS__) . 'inject_profile_link.tpl';
     if (E::ModuleViewer()->TemplateExists($sTemplatePath)) {
         return E::ModuleViewer()->Fetch($sTemplatePath);
     }
 }
开发者ID:shtrih,项目名称:altocms-plugin-drafts,代码行数:7,代码来源:HookAddlink.class.php

示例7: smarty_function_hook

/**
 * Плагин для смарти
 * Запускает хуки из шаблона на выполнение
 *
 * @param   array  $aParams
 * @param   Smarty $oSmarty
 *
 * @return  string
 */
function smarty_function_hook($aParams, &$oSmarty)
{
    if (empty($aParams['run'])) {
        trigger_error('Hook: missing "run" parametr', E_USER_WARNING);
        return;
    }
    $sReturn = '';
    if (strpos($aParams['run'], ',')) {
        $aHooks = F::Array_Str2Array($aParams['run']);
        unset($aParams['run']);
        foreach ($aHooks as $sHook) {
            $aParams['run'] = $sHook;
            $sReturn .= smarty_function_hook($aParams, $oSmarty);
        }
    } else {
        $sHookName = 'template_' . strtolower($aParams['run']);
        unset($aParams['run']);
        $aResultHook = E::ModuleHook()->Run($sHookName, $aParams);
        if (array_key_exists('template_result', $aResultHook)) {
            $sReturn = join('', $aResultHook['template_result']);
        }
        if (!empty($aParams['assign'])) {
            $oSmarty->assign($aParams['assign'], $sReturn);
            $sReturn = '';
        }
    }
    return $sReturn;
}
开发者ID:AntiqS,项目名称:altocms,代码行数:37,代码来源:function.hook.php

示例8: smarty_function_wgroup_show

/**
 * Plugin for Smarty
 * Display widget group
 *
 * @param   array                    $aParams
 * @param   Smarty_Internal_Template $oSmartyTemplate
 *
 * @return  string
 */
function smarty_function_wgroup_show($aParams, $oSmartyTemplate)
{
    if (isset($aParams['name'])) {
        if (!isset($aParams['group'])) {
            $aParams['group'] = $aParams['name'];
        } elseif (!isset($aParams['widget'])) {
            $aParams['widget'] = $aParams['name'];
        }
    }
    if (!isset($aParams['group'])) {
        $sError = 'Parameter "group" does not define in {wgroup_show ...} function';
        if ($oSmartyTemplate->template_resource) {
            $sError .= ' (template: ' . $oSmartyTemplate->template_resource . ')';
        }
        trigger_error($sError, E_USER_WARNING);
        return null;
    }
    $sWidgetGroup = $aParams['group'];
    $aWidgets = E::ModuleViewer()->GetWidgets();
    $sResult = '';
    if (isset($aWidgets[$sWidgetGroup])) {
        if (!function_exists('smarty_function_widget')) {
            F::IncludeFile('function.widget.php');
        }
        foreach ($aWidgets[$sWidgetGroup] as $oWidget) {
            $sResult .= smarty_function_widget(array('object' => $oWidget), $oSmartyTemplate);
        }
    }
    return $sResult;
}
开发者ID:hard990,项目名称:altocms,代码行数:39,代码来源:function.wgroup_show.php

示例9: EventRegistration

 public function EventRegistration()
 {
     /** @var ModuleCaptcha_EntityCaptcha $oCaptcha */
     $oCaptcha = E::ModuleCaptcha()->GetCaptcha();
     $oCaptcha->Display();
     exit;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:7,代码来源:ActionCaptcha.class.php

示例10: Deactivate

 /**
  * Деактивация плагина
  * @return bool
  */
 public function Deactivate()
 {
     $oMenu = E::ModuleMenu()->GetMenu('user');
     $oMenu->RemoveItemById('plugin.menutest.my_menu', true);
     E::ModuleMenu()->SaveMenu($oMenu);
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:11,代码来源:PluginMenutest.class.php

示例11: loadConfig

 /**
  * @param string $sType
  * @param bool   $bClear
  *
  * @throws Exception
  */
 public function loadConfig($sType = 'default', $bClear = true)
 {
     if ($bClear) {
         $this->tagsRules = array();
     }
     $aConfig = C::Get('qevix.' . $sType);
     if (is_array($aConfig)) {
         foreach ($aConfig as $sMethod => $aExec) {
             if ($sMethod == 'cfgSetAutoReplace') {
                 $this->aAutoReplace = $aExec;
                 continue;
             }
             foreach ($aExec as $aParams) {
                 call_user_func_array(array($this, $sMethod), $aParams);
             }
         }
         // * Хардкодим некоторые параметры
         unset($this->entities1['&']);
         // разрешаем в параметрах символ &
         if (C::Get('view.noindex') && isset($this->tagsRules['a'])) {
             $this->cfgSetTagParamDefault('a', 'rel', 'nofollow', true);
         }
     }
     if (C::Get('module.text.char.@')) {
         $this->cfgSetSpecialCharCallback('@', array(E::ModuleText(), 'CallbackTagAt'));
     }
     if ($aData = C::Get('module.text.autoreplace')) {
         $this->aAutoReplace = array(array_keys($aData), array_values($aData));
     }
 }
开发者ID:hard990,项目名称:altocms,代码行数:36,代码来源:TextParserQevix.class.php

示例12: smarty_function_widget_template

/**
 * Plugin for Smarty
 *
 * @param   array                    $aParams
 * @param   Smarty_Internal_Template $oSmartyTemplate
 *
 * @return  string|null
 */
function smarty_function_widget_template($aParams, $oSmartyTemplate)
{
    if (!isset($aParams['name'])) {
        trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING);
        return null;
    }
    $sWidgetName = $aParams['name'];
    $aWidgetParams = isset($aParams['params']) ? $aParams['params'] : array();
    $oEngine = Engine::getInstance();
    // Проверяем делигирование
    $sTemplate = E::ModulePlugin()->GetDelegate('template', $sWidgetName);
    if ($sTemplate) {
        if ($aWidgetParams) {
            foreach ($aWidgetParams as $sKey => $sVal) {
                $oSmartyTemplate->assign($sKey, $sVal);
            }
            if (!isset($aWidgetParams['params'])) {
                /* LS-compatible */
                $oSmartyTemplate->assign('params', $aWidgetParams);
            }
            $oSmartyTemplate->assign('aWidgetParams', $aWidgetParams);
        }
        $sResult = $oSmartyTemplate->fetch($sTemplate);
    } else {
        $sResult = null;
    }
    return $sResult;
}
开发者ID:ZeoNish,项目名称:altocms,代码行数:36,代码来源:function.widget_template.php

示例13: EventShutdown

 /**
  * Выполняется при завершении работы экшена
  *
  */
 public function EventShutdown()
 {
     /**
      * Загружаем в шаблон необходимые переменные
      */
     E::ModuleViewer()->Assign('sMenuHeadItemSelect', $this->sMenuHeadItemSelect);
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:11,代码来源:ActionTag.class.php

示例14: getTopicsForSitemap

 /**
  * Список опубликованых топиков в открытых блогах (с кешированием)
  *
  * @param int $iPage
  *
  * @return array
  */
 public function getTopicsForSitemap($iPage = 0)
 {
     $sCacheKey = "sitemap_topics_{$iPage}_" . C::Get('plugin.sitemap.items_per_page');
     if (false === ($aData = E::ModuleCache()->Get($sCacheKey))) {
         $aFilter = $this->GetNamedFilter('sitemap');
         $aTopics = E::ModuleTopic()->GetTopicsByFilter($aFilter, $iPage, C::Get('plugin.sitemap.items_per_page'), array('blog' => array('owner' => array())));
         $aData = array();
         $iIndex = 0;
         $aPriority = F::Array_Str2Array(C::Get('plugin.sitemap.type.topics.priority'));
         $nPriority = sizeof($aPriority) ? reset($aPriority) : null;
         $aChangeFreq = F::Array_Str2Array(C::Get('plugin.sitemap.type.topics.changefreq'));
         $sChangeFreq = sizeof($aChangeFreq) ? reset($aChangeFreq) : null;
         /** @var ModuleTopic_EntityTopic $oTopic */
         foreach ($aTopics['collection'] as $oTopic) {
             if ($aPriority) {
                 if (isset($aPriority[$iIndex])) {
                     $nPriority = $aPriority[$iIndex];
                 }
             }
             if ($aChangeFreq) {
                 if (isset($aChangeFreq[$iIndex])) {
                     $sChangeFreq = $aChangeFreq[$iIndex];
                 }
             }
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oTopic->getLink(), $oTopic->getDateLastMod(), $sChangeFreq, $nPriority);
             $iIndex += 1;
         }
         // тег 'blog_update' т.к. при редактировании блога его тип может измениться
         // с открытого на закрытый или наоборот
         E::ModuleCache()->Set($aData, $sCacheKey, array('topic_new', 'topic_update', 'blog_update'), C::Get('plugin.sitemap.type.topics.cache_lifetime'));
     }
     return $aData;
 }
开发者ID:Azany,项目名称:altocms,代码行数:40,代码来源:Topic.class.php

示例15: getComments

 public function getComments($iTopicId, $iPageNum, $iPageSize)
 {
     $sCacheKey = 'api_topic_' . $iTopicId;
     $oTopic = E::ModuleCache()->GetTmp($sCacheKey);
     if (!$oTopic) {
         $oTopic = E::ModuleTopic()->GetTopicById($iTopicId);
     }
     if (!$oTopic || !($oBlog = $oTopic->getBlog())) {
         return array();
     }
     $oBlogType = $oBlog->GetBlogType();
     if ($oBlogType) {
         $bCloseBlog = !$oBlog->CanReadBy(E::User());
     } else {
         // if blog type not defined then it' open blog
         $bCloseBlog = false;
     }
     if ($bCloseBlog) {
         return array();
     }
     $aComments = E::ModuleComment()->GetCommentsByTargetId($oTopic, 'topic', $iPageNum, $iPageSize);
     $aResult = array('total' => $oTopic->getCountComment(), 'list' => array());
     foreach ($aComments['comments'] as $oComment) {
         $aResult['list'][] = $oComment->getApiData();
     }
     return $aResult;
 }
开发者ID:altocms,项目名称:alto-plugin-api,代码行数:27,代码来源:ApiPosts.class.php


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