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


PHP F::Array_Str2Array方法代码示例

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


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

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

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

示例3: CheckLogin

 /**
  * Проверяет логин на корректность
  *
  * @param string $sLogin    Логин пользователя
  * @param int    $nError    Ошибка (если есть)
  *
  * @return bool
  */
 public function CheckLogin($sLogin, &$nError)
 {
     // проверка на допустимость логина
     $aDisabledLogins = F::Array_Str2Array(Config::Get('module.user.login.disabled'));
     if (F::Array_StrInArray($sLogin, $aDisabledLogins)) {
         $nError = self::USER_LOGIN_ERR_DISABLED;
         return false;
     } elseif (strpos(strtolower($sLogin), 'id-') === 0 || strpos(strtolower($sLogin), 'login-') === 0) {
         $nError = self::USER_LOGIN_ERR_DISABLED;
         return false;
     }
     $sCharset = Config::Get('module.user.login.charset');
     $nMin = intval(Config::Get('module.user.login.min_size'));
     $nMax = intval(Config::Get('module.user.login.max_size'));
     // Логин не может быть меньше 1
     if ($nMin < 1) {
         $nMin = 1;
     }
     $nError = 0;
     // поверка на длину логина
     if (!$nMax) {
         $bOk = mb_strlen($sLogin, 'UTF-8') >= $nMin;
         if (!$bOk) {
             $nError = self::USER_LOGIN_ERR_MIN;
         }
     } else {
         $bOk = mb_strlen($sLogin, 'UTF-8') >= $nMin && mb_strlen($sLogin, 'UTF-8') <= $nMax;
         if (!$bOk) {
             $nError = self::USER_LOGIN_ERR_LEN;
         }
     }
     if ($bOk && $sCharset) {
         // поверка на набор символов
         if (!preg_match('/^([' . $sCharset . ']+)$/iu', $sLogin)) {
             $nError = self::USER_LOGIN_ERR_CHARS;
             $bOk = false;
         }
     }
     return $bOk;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:48,代码来源:User.class.php

示例4: Str2Array

 /**
  * @param string $sStr
  * @param string $sSeparator
  * @param bool   $bSkipEmpty
  *
  * @return array
  */
 public static function Str2Array($sStr, $sSeparator = ',', $bSkipEmpty = false)
 {
     return F::Array_Str2Array($sStr, $sSeparator, $bSkipEmpty);
 }
开发者ID:hard990,项目名称:altocms,代码行数:11,代码来源:Main.php

示例5: EventAjaxUserList

 public function EventAjaxUserList()
 {
     E::ModuleViewer()->SetResponseAjax('json');
     if ($this->IsPost()) {
         $sList = trim($this->GetPost('invite_listmail'));
         if ($aList = F::Array_Str2Array($sList, "\n", true)) {
             $iSentCount = 0;
             foreach ($aList as $iKey => $sMail) {
                 if (F::CheckVal($sMail, 'mail')) {
                     $oInvite = E::ModuleUser()->GenerateInvite($this->oUserCurrent);
                     if (E::ModuleNotify()->SendInvite($this->oUserCurrent, $sMail, $oInvite)) {
                         unset($aList[$iKey]);
                         $iSentCount++;
                     }
                 }
             }
             E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('action.admin.invaite_mail_done', array('num' => $iSentCount)), null, true);
             if ($aList) {
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('action.admin.invaite_mail_err', array('num' => count($aList))), null, true);
             }
         }
     } else {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'));
     }
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:25,代码来源:ActionAdmin.class.php

示例6: BuildFilter

 /**
  * Формирует из REQUEST массива фильтр для отбора писем
  *
  * @return array
  */
 protected function BuildFilter()
 {
     // * Текущий пользователь
     $aFilter = array('user_id' => $this->oUserCurrent->getId());
     // * Дата старта поиска
     if ($start = F::GetRequestStr('start')) {
         if (F::CheckVal($start, 'text', 6, 10) && substr_count($start, '.') == 2) {
             list($d, $m, $y) = explode('.', $start);
             if (@checkdate($m, $d, $y)) {
                 $aFilter['date_min'] = "{$y}-{$m}-{$d}";
             } else {
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('talk_filter_error_date_format'), E::ModuleLang()->Get('talk_filter_error'));
                 unset($_REQUEST['start']);
             }
         } else {
             E::ModuleMessage()->AddError(E::ModuleLang()->Get('talk_filter_error_date_format'), E::ModuleLang()->Get('talk_filter_error'));
             unset($_REQUEST['start']);
         }
     }
     // * Дата окончания поиска
     if ($end = F::GetRequestStr('end')) {
         if (F::CheckVal($end, 'text', 6, 10) && substr_count($end, '.') == 2) {
             list($d, $m, $y) = explode('.', $end);
             if (@checkdate($m, $d, $y)) {
                 $aFilter['date_max'] = "{$y}-{$m}-{$d} 23:59:59";
             } else {
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('talk_filter_error_date_format'), E::ModuleLang()->Get('talk_filter_error'));
                 unset($_REQUEST['end']);
             }
         } else {
             E::ModuleMessage()->AddError(E::ModuleLang()->Get('talk_filter_error_date_format'), E::ModuleLang()->Get('talk_filter_error'));
             unset($_REQUEST['end']);
         }
     }
     // * Ключевые слова в теме сообщения
     if (($sKeyRequest = F::GetRequest('keyword')) && is_string($sKeyRequest)) {
         $sKeyRequest = urldecode($sKeyRequest);
         preg_match_all('~(\\S+)~u', $sKeyRequest, $aWords);
         if (is_array($aWords[1]) && isset($aWords[1]) && count($aWords[1])) {
             $aFilter['keyword'] = '%' . implode('%', $aWords[1]) . '%';
         } else {
             unset($_REQUEST['keyword']);
         }
     }
     // * Ключевые слова в тексте сообщения
     if (($sKeyRequest = F::GetRequest('keyword_text')) && is_string($sKeyRequest)) {
         $sKeyRequest = urldecode($sKeyRequest);
         preg_match_all('~(\\S+)~u', $sKeyRequest, $aWords);
         if (is_array($aWords[1]) && isset($aWords[1]) && count($aWords[1])) {
             $aFilter['text_like'] = '%' . implode('%', $aWords[1]) . '%';
         } else {
             unset($_REQUEST['keyword_text']);
         }
     }
     // * Отправитель
     if (($sSender = F::GetRequest('sender')) && is_string($sSender)) {
         $aFilter['user_login'] = F::Array_Str2Array(urldecode($sSender), ',', true);
     }
     // * Адресат
     if (($sAddressee = F::GetRequest('addressee')) && is_string($sAddressee)) {
         $aFilter['user_login'] = F::Array_Str2Array(urldecode($sAddressee), ',', true);
     }
     // * Искать только в избранных письмах
     if (F::GetRequest('favourite')) {
         $aTalkIdResult = E::ModuleFavourite()->GetFavouritesByUserId($this->oUserCurrent->getId(), 'talk', 1, 500);
         // ограничиваем
         $aFilter['id'] = $aTalkIdResult['collection'];
         $_REQUEST['favourite'] = 1;
     } else {
         unset($_REQUEST['favourite']);
     }
     return $aFilter;
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:78,代码来源:ActionTalk.class.php

示例7: GetConfig

 /**
  * Returns uploader config section for file by config key
  *
  * @param string $sFile
  * @param string $sConfigKey
  *
  * @return array
  */
 public function GetConfig($sFile, $sConfigKey = 'default')
 {
     if (!$sConfigKey) {
         $sConfigKey = 'default';
     }
     $sExtension = $this->_extensionMime($sFile);
     if (!$sExtension) {
         $sExtension = '*';
     }
     $sTmpConfigKey = '-' . str_replace('.', '-', $sConfigKey) . '-' . $sExtension;
     $aConfig = $this->aModConfig[$sTmpConfigKey];
     if (is_null($aConfig)) {
         $aConfig = array();
         $aImageExtensions = array();
         // Gets local config
         if ($sConfigKey) {
             if (isset($this->aModConfig[$sConfigKey])) {
                 $aConfig = $this->aModConfig[$sConfigKey];
                 $aImageExtensions = (array) $aConfig['image_extensions'];
             } elseif (strpos($sConfigKey, '.')) {
                 if (strpos($sConfigKey, 'images.') === 0) {
                     $aConfig = $this->aModConfig['images.default'];
                     $aImageExtensions = (array) $aConfig['image_extensions'];
                 } else {
                     $sConfigKey = 'default';
                 }
             }
         }
         if (!$aConfig && $sConfigKey != 'default') {
             // Checks key 'images.<type>' and valid image extension
             if ($aConfig = $this->aModConfig['images.' . $sConfigKey]) {
                 if ($sExtension != '*') {
                     $aImageExtensions = (array) $aConfig['image_extensions'];
                     if (!$aImageExtensions || !in_array($sExtension, $aImageExtensions)) {
                         $aConfig = array();
                     }
                 }
             }
             // If this is not image then checks config for file specified type
             if (!$aConfig) {
                 $aConfig = $this->aModConfig['files.' . $sConfigKey];
             }
         }
         if (!$aConfig) {
             // Config section not found, sets default
             $aImageExtensions = (array) $this->aModConfig['images.default.image_extensions'];
             if ($aImageExtensions && in_array($sExtension, $aImageExtensions)) {
                 $aConfig = $this->aModConfig['images.default'];
             } else {
                 $aConfig = $this->aModConfig['files.default'];
             }
         }
         /* Copy MIME specified config into 'transform' section
          * INPUT:
          * $aConfig = array(
          *     'transform' => array(
          *         '@mime(jpeg,other)' => array(
          *             'quality' => 80,
          *         ),
          *     ),
          * );
          * $aImageExtensions = 'jpg';
          *
          * OUTPUT:
          * $aConfig = array(
          *     'transform' => array(
          *         'quality' => 80,
          *         'mime-jpeg,mime-jpg' => array(
          *             'quality' => 80,
          *         ),
          *     ),
          * );
          */
         if ($sExtension != '*' && $aImageExtensions && !empty($aConfig['transform'])) {
             foreach ($aConfig['transform'] as $sKey => $aVal) {
                 if (strpos($sKey, '@mime(') === 0) {
                     $sMimeFound = null;
                     if (preg_match('/@mime\\s*\\(([\\w,]+)\\)/', $sKey, $aM)) {
                         $aKeys = F::Array_Str2Array($aM[1]);
                         foreach ($aKeys as $sMimeKey) {
                             $sMime = $this->_extensionMime($sMimeKey);
                             if ($sMime == $sExtension) {
                                 $sMimeFound = $sMime;
                                 break;
                             }
                         }
                     }
                     if ($sMimeFound) {
                         if (in_array($sMimeFound, $aImageExtensions)) {
                             foreach ($aVal as $sMimeCfgKey => $sMimeCfgVal) {
                                 $aConfig['transform'][$sMimeCfgKey] = $sMimeCfgVal;
                             }
//.........这里部分代码省略.........
开发者ID:AntiqS,项目名称:altocms,代码行数:101,代码来源:Uploader.class.php

示例8: EventShowBlogs

 /**
  * Отображение списка блогов
  */
 protected function EventShowBlogs()
 {
     // * По какому полю сортировать
     $sOrder = F::GetRequestStr('order', 'blog_rating');
     // * В каком направлении сортировать
     $sOrderWay = F::GetRequestStr('order_way', 'desc');
     $aAllowBlogTypes = E::ModuleBlog()->GetAllowBlogTypes(E::User(), 'list', true);
     // * Фильтр выборки блогов
     $aFilter = array();
     if ($sIncludeType = F::GetRequestStr('include_type')) {
         $aFilter['include_type'] = array_intersect(array_merge($aAllowBlogTypes, ['personal']), F::Array_Str2Array($sIncludeType));
     }
     if ($sExcludeType = F::GetRequestStr('exclude_type')) {
         $aFilter['exclude_type'] = F::Array_Str2Array($sExcludeType);
     }
     if (!$aFilter) {
         $aFilter = array('include_type' => $aAllowBlogTypes);
     }
     if ($sOrder == 'blog_title') {
         $aFilter['order'] = array('blog_title' => $sOrderWay);
     } else {
         $aFilter['order'] = array($sOrder => $sOrderWay, 'blog_title' => 'asc');
     }
     // * Передан ли номер страницы
     $iPage = preg_match('/^\\d+$/i', $this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1;
     // * Получаем список блогов
     $aResult = E::ModuleBlog()->GetBlogsByFilter($aFilter, $iPage, Config::Get('module.blog.per_page'));
     $aBlogs = $aResult['collection'];
     // * Формируем постраничность
     $aPaging = E::ModuleViewer()->MakePaging($aResult['count'], $iPage, Config::Get('module.blog.per_page'), Config::Get('pagination.pages.count'), R::GetPath('blogs'), array('order' => $sOrder, 'order_way' => $sOrderWay));
     //  * Загружаем переменные в шаблон
     E::ModuleViewer()->Assign('aPaging', $aPaging);
     E::ModuleViewer()->Assign('aBlogs', $aBlogs);
     E::ModuleViewer()->Assign('sBlogOrder', htmlspecialchars($sOrder));
     E::ModuleViewer()->Assign('sBlogOrderWay', htmlspecialchars($sOrderWay));
     E::ModuleViewer()->Assign('sBlogOrderWayNext', $sOrderWay == 'desc' ? 'asc' : 'desc');
     E::ModuleViewer()->Assign('sShow', 'collective');
     E::ModuleViewer()->Assign('sBlogsRootPage', R::GetPath('blogs'));
     // * Устанавливаем title страницы
     E::ModuleViewer()->AddHtmlTitle(E::ModuleLang()->Get('blog_menu_all_list'));
     // * Устанавливаем шаблон вывода
     $this->SetTemplateAction('index');
 }
开发者ID:anp135,项目名称:altocms,代码行数:46,代码来源:ActionBlogs.class.php


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