/** * Initialize model for person model * @param Document $csvDocument csv document * @param unknown $authData auth xml * @param unknown $duplicateHandle how to manage duplicate * @param unknown $lang lang * @param unknown $serviceManager tags * @return void */ public function __construct($csvDocument, $authData, $duplicateHandle, $lang, $serviceManager) { $this->personModel = $serviceManager->get('MoveIn4Person\\Model\\Person'); $this->referenceModel = $serviceManager->get('MoveIn4ReferenceList\\Model\\ReferenceList'); //$this->customAttributeModel = $serviceManager->get('MoveIn4CustomAttribute\Document\CustomAttributeDocument'); //$this->customListItemModel = $serviceManager->get('\MoveIn4CustomList\Document\CustomListItemDocument'); $this->dm = $serviceManager; $this->language = $lang; $this->authData = $authData; $this->duplicateHandle = $duplicateHandle; $this->csvDocument = $csvDocument; }
/** * Cart constructor * * @param StorageInterface $store The interface for storing the cart data * @param IdentifierInterface $identifier The interface for storing the identifier */ public function __construct(StorageInterface $store, IdentifierInterface $identifier) { $this->store = $store; $this->identifier = $identifier; // Generate/retrieve identifier $this->id = $this->identifier->get(); // Restore the cart from a saved version if (method_exists($this->store, 'restore')) { $this->store->restore($this->id); } // Let our storage class know which cart we're talking about $this->store->setIdentifier($this->id); }
/** * Paginate the given criteria * @param Builder $criteria * @param unknown $columns * @return \App\Core\PaginatorCore */ public function paginate($criteria, $columns = ['*']) { if ($criteria instanceof Illuminate\Database\Eloquent\Builder) { $builder = $criteria->getQuery(); } else { $builder = $criteria; } $pageName = 'page'; $sortColumn = ''; $sortOrder = ''; $default = config('system.page_limit'); $total = $builder->getCountForPagination(); if (!is_null($this->request) && $this->request->has('page_limit')) { $perPage = $this->request->has('page_limit') ? $this->request->get('page_limit') : $default; $page = $this->request->has($pageName) ? $this->request->get($pageName) : null; $sortColumn = $this->request->has('sort') ? $this->request->get('sort') : ''; $sortOrder = $this->request->has('order') ? $this->request->get('order') : ''; } else { $perPage = $default; } $builder->forPage($page = Paginator::resolveCurrentPage($pageName), $perPage); if ($sortColumn) { $sortOrder = $sortOrder ? $sortOrder : $this->defaultSort; $criteria = $builder->orderBy($sortColumn, $sortOrder); } return new PaginatorCore($builder->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName, 'sortColumn' => $sortColumn, 'sortOrder' => $sortOrder]); }
/** * undocumented function * * @return void * @access public */ function report($conditions = array(), $returnRaw = false) { if (!$this->connected() && !$this->login()) { return false; } if (is_int($conditions)) { $conditions = array('profile' => $conditions); } elseif (is_string($conditions)) { $conditions = array('report' => $conditions); } $defaults = array('profile' => null, 'report' => 'Dashboard', 'from' => date('Y-m-d', time() - 1 * MONTH), 'to' => date('Y-m-d'), 'query' => array(), 'tab' => 0, 'format' => 'xml', 'compute' => 'average', 'view' => 0); $conditions = am($defaults, $conditions); $formats = array('pdf' => 0, 'xml' => 1, 'csv' => 2, 'tsv' => 3); foreach (array('from', 'to') as $condition) { if (is_string($conditions[$condition])) { $conditions[$condition] = strtotime($conditions[$condition]); } } $conditions['profile'] = $this->profileId($conditions['profile']); $query = array('fmt' => isset($formats[$conditions['format']]) ? $formats[$conditions['format']] : $conditions['format'], 'id' => $conditions['profile'], 'pdr' => date('Ymd', $conditions['from']) . '-' . date('Ymd', $conditions['to']), 'tab' => $conditions['tab'], 'cmp' => $conditions['compute'], 'view' => $conditions['view'], 'rpt' => $conditions['report'] . 'Report'); $query = am($query, $conditions['query']); $report = $this->Http->get('https://www.google.com/analytics/reporting/export', $query); if ($returnRaw == true || $query['fmt'] != 1) { return $report; } uses('Xml'); $ReportXml =& new XML($report); return $this->xmltoArray($ReportXml); }
/** * 数据签名 * @param unknown $data * @return string */ function sign($data) { $data = $this->filterParameter($data); ksort($data); reset($data); $str = $this->toString($data) . '&key=' . $this->_system->get('key', 'weixin'); $str = strtoupper(md5($str)); return $str; }
/** * @todo wrong integration when using cli application! * * @param unknown $request * * @return unknown */ public function getRoute($request) { if ($this->rewriteEnabled) { $route = $request->getRequestPathSuffix(); } else { $route = $request->get('route', false); } return $route; }
/** * Clear data filter from session * @param string $key */ protected function clear($key = '') { $data = $this->session->get('filters'); if ($this->request->has('clear_filter')) { if (isset($data[$this->request->getPathInfo()])) { $this->session->set('filters.' . $this->request->getPathInfo(), ''); } } elseif ($key) { if (isset($data[$this->request->getPathInfo()][$key])) { unset($data[$this->request->getPathInfo()][$key]); $this->session->set('filters', $data); } } }
/** * 参数加密 * @param unknown $parameter * @return string */ function sign($parameter, $sign_type = '') { $parameter = $this->toString($parameter) . $this->_system->get('key', 'alipay'); $sign_type = trim(strtoupper(empty($sign_type) ? $this->_config['sign_type'] : $sign_type)); switch ($sign_type) { case 'MD5': $parameter = md5($parameter); break; case 'RSA': $private_key = $this->_system->get('rsaprivatekey', 'alipay'); return $this->encryptRSA($parameter, $private_key); break; case 'DSA': break; default: break; } return $parameter; }
/** * * @param unknown $sl */ public function getIdentityResult($sl) { $user = $sl->get('User\\Identity'); return $user->userIdentityInstance($this->user['id']); }
/** * Defaults * @param unknown $query */ function orbis_tasks_pre_get_posts($query) { $post_type = $query->get('post_type'); if ('orbis_task' == $post_type) { // Order $orderby = $query->get('orderby'); $order = $query->get('order'); if (empty($orderby)) { // Default = Due At $query->set('orderby', 'orbis_task_due_at'); if (empty($order)) { if (is_admin()) { // Default = Descending $query->set('order', 'DESC'); } else { // Default = Ascending $query->set('order', 'ASC'); } } } // Completed if ($query->is_post_type_archive('orbis_task') && !is_admin()) { $completed = $query->get('orbis_task_completed'); if (empty($completed)) { // Default = Not completed $query->set('orbis_task_completed', 'no'); } } } }
/** * 获取memcache缓存项 * @see Star_Cache_Interface::get() */ public function get($key) { return $this->memcache->get($key); }
/** * * @param unknown $poIdentity * @param unknown $psUrlFrom */ public function authentication($poAuthService, $poIdentity, $psUrlFrom = null, $poForm = null, $psType = 'onion') { $lsStatus = null; if ($poIdentity->getActive() == 1) { $laUserContext = null; if ($poIdentity->get('stIpContext') !== null) { $lsUserAgent = '*'; if ($poIdentity->get('stUserAgent') !== null) { $lsUserAgent = $poIdentity->get('stUserAgent'); } $laUserContext = array($poIdentity->get('stIpContext') => array('denied' => $poIdentity->get('isContextDenied'), $lsUserAgent => $poIdentity->get('stRegistrationToken'))); } if (Context::hasContextAccess($laUserContext)) { $loSession = new Session(); $loSession->clearRegister('OnionAuth'); $loSession->clearRegister('storage', 'Zend_Auth'); $poIdentity->getObject(); $poIdentity->set('stPassword', 'nono'); $poIdentity->set('stPasswordSalt', ''); $poIdentity->set('stAnswer', ''); $loSession->setRegister('OnionAuth', $poIdentity); $loIdentity = $loSession->getRegister('OnionAuth'); $poAuthService->getStorage()->write($poIdentity); if ($poForm->get('rememberme')->getValue() == 1) { $laOptions = Config::getAppOptions('settings'); $loSessionManager = new SessionManager(); $loSessionManager->rememberMe($laOptions['sessionLifeTime']); } Debug::debug($poIdentity->getUsername() . " [SUCCESS by {$psType}]"); Access::log($poIdentity, "SUCCESS by " . $psType); if ($psUrlFrom !== null) { if ('/' !== $psUrlFrom) { $psUrlFrom = base64_decode($psUrlFrom); } Debug::debug("Redirect to: ({$psUrlFrom})"); $this->redirect()->toUrl($psUrlFrom); } } else { $poForm->get('stUsername')->setMessages(array("Permissão negada para o contexto de acesso!")); $lsStatus = "CONTEXT DENIED"; } } else { $poForm->get('stUsername')->setMessages(array("Usuário desativado!")); $lsStatus = "USER DISABLED"; } return $lsStatus; }
/** * Set behaviour parameters where required based on the type if request received * @param unknown $objBehaviour * @return array */ private function setBehaviourRequestFormParams($objBehaviour) { $arr_params = array('behaviour' => $objBehaviour->get('behaviour'), 'beh_action' => $objBehaviour->get('action')); //set additional params based on behaviour and its action where applicable switch (strtolower(str_replace("_", "", $arr_params['behaviour']))) { case "formfields": $arr_params['form_id'] = $objBehaviour->get('fk_form_id'); $arr_params['field_id'] = $objBehaviour->get('fk_fields_all_id'); break; } //end switch return $arr_params; }
/** * 获取redis缓存项 */ public function get($key) { return $this->redis->get($key); }
/** * Defaults * @param unknown $query */ function orbis_deals_pre_get_posts($query) { $post_type = $query->get('post_type'); if ('orbis_deal' == $post_type) { // Status $status = $query->get('orbis_deal_status'); if ($status) { $meta_query = $query->get('meta_query'); if (!is_array($meta_query)) { $meta_query = array(); } $meta_query[] = array('key' => '_orbis_deal_status', 'value' => $status); $query->set('meta_query', $meta_query); } } }
/** * To respect the design, 3 searches will be executed: * 1st: retrieves the main facet (Text / Media / Portfolio / Users / Group) and the count for each of them * 2nd: - retrieves the results of the first non empty facet term for display in the tab * - retrieves the secondary facet to enable / disable the filter items * 3nd: - retrieves the results with all filters applied * @param unknown $query_string * @param unknown $limit * @param unknown $offset * @param unknown $options * @param unknown $mainfacetterm * @param unknown $USER * @return multitype:number boolean unknown Ambigous <boolean, NULL> Ambigous <boolean, unknown> multitype:multitype:string number Ambigous <string, unknown> |multitype:multitype: */ public static function search($query_string, $limit, $offset, $options, $mainfacetterm, $USER) { $result = array('count' => 0, 'limit' => $limit, 'offset' => $offset, 'data' => false, 'selected' => isset($mainfacetterm) && strlen($mainfacetterm) > 0 ? $mainfacetterm : false, 'totalresults' => 0, 'facets' => array(array('term' => "Text", 'count' => 0, 'display' => "Text"), array('term' => "Media", 'count' => 0, 'display' => "Media"), array('term' => "Portfolio", 'count' => 0, 'display' => "Portfolio"), array('term' => "User", 'count' => 0, 'display' => "Users"), array('term' => "Group", 'count' => 0, 'display' => "Group")), 'content-filter' => array(array('term' => "all", 'count' => 0, 'display' => "All"), array('term' => "Audio", 'count' => 0, 'display' => "Audio"), array('term' => "Comment", 'count' => 0, 'display' => "Comment"), array('term' => "Document", 'count' => 0, 'display' => "Document"), array('term' => "Folder", 'count' => 0, 'display' => "Folder"), array('term' => "Forum", 'count' => 0, 'display' => "Forum"), array('term' => "Forumpost", 'count' => 0, 'display' => "Forum post"), array('term' => "Image", 'count' => 0, 'display' => "Image"), array('term' => "Journal", 'count' => 0, 'display' => "Journal"), array('term' => "Journalentry", 'count' => 0, 'display' => "Journal entry"), array('term' => "Note", 'count' => 0, 'display' => "Note"), array('term' => "Plan", 'count' => 0, 'display' => "Plan"), array('term' => "Profile", 'count' => 0, 'display' => "Profile"), array('term' => "Resume", 'count' => 0, 'display' => "Résumé"), array('term' => "Video", 'count' => 0, 'display' => "Video"), array('term' => "Wallpost", 'count' => 0, 'display' => "Wall post"), array('term' => "Collection", 'count' => 0, 'display' => "Collection"), array('term' => "Page", 'count' => 0, 'display' => "Page")), 'content-filter-selected' => isset($options['secfacetterm']) && strlen($options['secfacetterm']) > 0 ? $options['secfacetterm'] : 'all', 'owner-filter' => array(array('term' => "all", 'count' => 0, 'display' => "All"), array('term' => "me", 'count' => 0, 'display' => "Me"), array('term' => "others", 'count' => 0, 'display' => "Others")), 'owner-filter-selected' => isset($options['owner']) && strlen($options['owner']) > 0 ? $options['owner'] : 'all', 'tagsonly' => isset($options['tagsonly']) && $options['tagsonly'] == true ? true : Null, 'sort' => isset($options['sort']) && strlen($options['sort']) > 0 ? $options['sort'] : 'score', 'license' => isset($options['license']) && strlen($options['license']) > 0 ? $options['license'] : 'all'); if (strlen($query_string) <= 0) { return $result; } // 1- Get main facet // ------------------------------------------------------------------------------------------ $records = array(); $elasticaClient = PluginSearchElasticsearch::make_client(); $elasticaIndex = $elasticaClient->getIndex(get_config_plugin('search', 'elasticsearch', 'indexname')); $elasticaQueryString = new \Elastica\Query\QueryString(); $elasticaAnalyzer = get_config_plugin('search', 'elasticsearch', 'analyzer'); $elasticaQueryString->setAnalyzer($elasticaAnalyzer); $elasticaQueryString->setDefaultOperator('AND'); $elasticaQueryString->setQuery($query_string); // if tags only => set fields to tags if ($result['tagsonly'] === true) { $elasticaQueryString->setFields(array('tags')); } // Create the $elasticaQuery object $elasticaQuery = new \Elastica\Query(); $elasticaQuery->setFrom($offset); $elasticaQuery->setLimit($limit); $elasticaQuery->setQuery($elasticaQueryString); $elasticaFilterAnd = new \Elastica\Filter\BoolAnd(); // Apply ACL filters $elasticaFilterACL = new ElasticsearchFilterAcl($USER); $elasticaFilterAnd->addFilter($elasticaFilterACL); $elasticaQuery->setFilter($elasticaFilterAnd); // Define a new facet: mainFacetTerm - WARNING: don't forget to apply the same filter to the facet $elasticaFacet = new \Elastica\Facet\Terms('mainFacetTerm'); $elasticaFacet->setField('mainfacetterm'); $elasticaFacet->setOrder('count'); $elasticaFacet->setFilter($elasticaFilterAnd); $elasticaQuery->addFacet($elasticaFacet); $elasticaResultSet = $elasticaIndex->search($elasticaQuery); $result['totalresults'] = $elasticaResultSet->getTotalHits(); $elasticaFacets = $elasticaResultSet->getFacets(); $facets = self::process_facets($elasticaFacets['mainFacetTerm']['terms']); if (count($facets) == 0) { return $result; } array_walk($result['facets'], 'self::process_tabs', $facets); if ($result['selected'] === false || $facets[$result['selected']] == 0) { $result['selected'] = self::get_selected_facet($result['facets']); } // 2- Retrieve results of selected facet // ------------------------------------------------------------------------------------------ $elasticaFilterType = new \Elastica\Filter\Term(array('mainfacetterm' => $result['selected'])); $elasticaFilterAnd->addFilter($elasticaFilterType); $elasticaQuery->setFilter($elasticaFilterAnd); // Define a new facet: secFacetTerm - WARNING: don't forget to apply the same filter to the facet $elasticaFacet = new \Elastica\Facet\Terms('secFacetTerm'); $elasticaFacet->setField('secfacetterm'); $elasticaFacet->setOrder('count'); $elasticaFacet->setFilter($elasticaFilterAnd); $elasticaQuery->addFacet($elasticaFacet); // Sorting // Sorting is defined on a per field level, so we must make sure the field exists in the mapping $sort = explode('_', $result['sort']); if ($sort[0] == 'score') { $sort[0] = '_score'; } // set the second column to sort by the score (to break any 'ties'). $elasticaQuery->setSort(array(array($sort[0] => array('order' => isset($sort[1]) ? $sort[1] : 'desc')), array('_score' => array('order' => 'desc')))); $elasticaResultSet = $elasticaIndex->search($elasticaQuery); $result['count'] = $elasticaResultSet->getTotalHits(); $elasticaFacets = $elasticaResultSet->getFacets(); $facets = $elasticaFacets['secFacetTerm']['terms']; $facets = self::process_facets($elasticaFacets['secFacetTerm']['terms']); array_walk($result['content-filter'], 'self::process_tabs', $facets); // set the count of "all" to the total hits $result['content-filter'][0]['count'] = $result['count']; // 3- Apply filters and retrieve final results // ------------------------------------------------------------------------------------------ // Apply Content filter if different from "all" if ($result['content-filter-selected'] != 'all') { $elasticaFilterContent = new \Elastica\Filter\Term(array('secfacetterm' => $result['content-filter-selected'])); $elasticaFilterAnd->addFilter($elasticaFilterContent); } // Apply Owner filter if different from "all" if ($result['owner-filter-selected'] != 'all') { $uid = $USER->get('id'); $elasticaFilterOwner = new \Elastica\Filter\Term(array('owner' => $uid)); if ($result['owner-filter-selected'] == 'others') { $elasticaFilterOwner = new \Elastica\Filter\BoolNot($elasticaFilterOwner); } $elasticaFilterAnd->addFilter($elasticaFilterOwner); } // Apply license filter if different from "all" if ($result['license'] != 'all') { $elasticaFilterLicense = new \Elastica\Filter\Term(array('license' => $result['license'])); $elasticaFilterAnd->addFilter($elasticaFilterLicense); } $elasticaQuery->setFilter($elasticaFilterAnd); $elasticaResultSet = $elasticaIndex->search($elasticaQuery); $elasticaResults = $elasticaResultSet->getResults(); $result['count'] = $elasticaResultSet->getTotalHits(); foreach ($elasticaResults as $elasticaResult) { $tmp = array(); $tmp['type'] = $elasticaResult->getType(); $ES_class = 'ElasticsearchType_' . $tmp['type']; $tmp = $tmp + $elasticaResult->getData(); // Get all the data from the DB table $dbrec = $ES_class::getRecordDataById($tmp['type'], $tmp['id']); if ($dbrec) { $tmp['db'] = $dbrec; $tmp['db']->deleted = false; } else { // If the record has been deleted, so just pass the cached data // from the search result. Let the template decide how to handle // it. $tmp['db'] = (object) $tmp; $tmp['db']->deleted = true; } $records[] = $tmp; } $result['data'] = $records; return $result; }
/** * 会員登録確認画面が確認する * @param unknown $request */ protected function isEntryConfirm($request) { $mode = $request->get('mode'); $Customer = $this->app['eccube.repository.customer']->newCustomer(); $EntryForm = $this->app['form.factory']->createBuilder('entry', $Customer)->getForm(); $EntryForm->handleRequest($request); // confirmの場合はメールマガジン送付を入力不可にする if ($mode == 'confirm' && $EntryForm->isValid()) { return true; } return false; }
/** * 获取数据 * @param string $key */ public function getMain($key = '') { return $this->cacheWrite->get($key); }