本文整理汇总了PHP中ClusterTool类的典型用法代码示例。如果您正苦于以下问题:PHP ClusterTool类的具体用法?PHP ClusterTool怎么用?PHP ClusterTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClusterTool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isUserTokenValid
/**
* @param $token
* @return bool
*/
public static function isUserTokenValid($token)
{
//get secret seed and add date (20140703)
$secretSeed = self::getFormSecretSeed();
//get user id (anonymous or current logged user)
$userId = MMUsers::getCurrentUserId() != -1 ? MMUsers::getCurrentUserId() : MMUsers::getAnonymousUserId();
//cluster identifier
$clusterIdentifier = ClusterTool::clusterIdentifier();
if(sha1($secretSeed . date('Ymd') . $userId . $clusterIdentifier) == $token)
{
return true;
}
//yesterday date
else if(sha1($secretSeed . date('Ymd', time() - 60 * 60 * 24) . $userId . $clusterIdentifier) == $token)
{
return true;
}
else
{
return false;
}
}
示例2: additionalSolrFilters
public function additionalSolrFilters()
{
return array(
sprintf('-attr_exclude_from_search_%s_b:1', ClusterTool::clusterIdentifier()),
'-attr_hide_in_search_b:true'
);
}
示例3: loadConfiguration
/**
* @return bool
*/
private static function loadConfiguration()
{
if( !empty( self::$fields ) )
{
return false;
}
$db = MMDB::instance();
$clusterIdentifier = ClusterTool::clusterIdentifier();
$query = 'SELECT f.business_name, f.attribute_type, l.default_value,
CASE WHEN l.control_type_identifier IS NULL THEN f.control_type_identifier ELSE l.control_type_identifier END AS control_type_identifier,
CASE WHEN l.control_type_value IS NULL THEN f.control_type_value ELSE l.control_type_value END AS control_type_value
FROM uump_field AS f INNER JOIN uump_localized_field AS l ON l.field_id = f.id AND l.cluster_identifier = "%s"
ORDER BY f.business_name';
$results = $db->arrayQuery( sprintf( $query, $clusterIdentifier ) );
foreach( $results as $result )
{
self::$fields[$result['business_name']] = array(
'control_type_identifier' => $result['control_type_identifier'],
'control_type_value' => $result['control_type_value'],
'attribute_type' => $result['attribute_type'],
'default_value' => $result['default_value']
);
}
return true;
}
示例4: processOptions
function processOptions($options)
{
if ($options['clusterIdentifier'] == null)
{
throw new Exception("No clusters given. Should pass argument clusterIdentifier with value 'all' if all clusters are requested");
}
$allClusters = ClusterTool::getAllClusters();
if ($options['clusterIdentifier'] == 'all')
{
$clusters = $allClusters;
} else
{
$clusters = explode(',', $options['clusterIdentifier']);
$clusters = array_filter($clusters, function($v) use ($allClusters) {
return in_array($v, $allClusters);
});
}
$exclude = isset($options['exclude']) ? filter_var($options['exclude'], FILTER_VALIDATE_BOOLEAN) : false;
if ($exclude)
{
$clusters = array_diff($allClusters, $clusters);
}
$parsedOptions = array(
'clusters' => $clusters,
'exclude' => $exclude,
);
return $parsedOptions;
}
示例5: render
/**
* Renders the block (returns HTML)
*
* @return string HTML
**/
public function render()
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'name', $this->name );
$tpl->setVariable( 'banners', $this->fetchBanners() );
$tpl->setVariable( 'cluster_identifier', ClusterTool::clusterIdentifier() );
return $tpl->fetch( 'design:presenters/block/channel.tpl' );
}
示例6: fetchByClusterIdentifier
/**
* @param string $clusterIdentifier
* @return SystemLocale[]
*/
static public function fetchByClusterIdentifier( $clusterIdentifier = null )
{
return self::fetchObjectList(
self::definition(),
null,
array( 'cluster_identifier' => is_null( $clusterIdentifier ) ? ClusterTool::clusterIdentifier() : $clusterIdentifier )
);
}
示例7: parseOptions
function parseOptions(array $options)
{
$parsedOptions = array();
$parsedOptions['clusterIdentifier'] = isset($options['clusterIdentifier']) ? explode(',', $options['clusterIdentifier']) : ClusterTool::globCluster();
$parsedOptions['path'] = isset($options['path']) ? $options['path'] : DEFAULT_BANNER_PATH;
$parsedOptions['convertPath'] = isset($options['convertPath']) ? $options['convertPath'] : eZINI::instance('image.ini')->variable('ImageMagick', 'ExecutablePath');
return $parsedOptions;
}
示例8: validateToU
/**
* @return string
*/
protected function validateToU()
{
if( !self::user() )
return false;
self::user()->toUValidated(true);
$context = ContextTool::instance()->backUrl();
$context = isset( $_POST['context'] ) ? $_POST['context'] : '/';
// @todo: update ESB by sending validation status
$esbResult = new ESBResult();
$userService = ESBFactory::getUserService();
if(SolrSafeOperatorHelper::featureIsActive('UUMP'))
{
$result = $userService->read(self::user()->attribute('uuid'));
ServiceLoginUUMP::populateESBResult($esbResult, $result);
}
else
{
$result = ServiceLogin::readCall(self::user()->attribute('uuid'), $esbResult);
ServiceLogin::populateESBResult($esbResult, $result);
}
$esbResult->userName = self::user()->attribute('uuid');
$esbResult->termsOfUse = 'Y';
$esbResult->privacyPolicy = 'Y';
if( SolrSafeOperatorHelper::featureIsActive('UUMP') || (ClusterTool::clusterIdentifier() == "cluster_at") )
{
$esbResult->termsOfUse = '1';
$esbResult->privacyPolicy = '1';
}
$esbResult->countryOfRegistration = self::user()->attribute( 'country' );
$userService->write($esbResult->toServiceAgreementTicket());
// if the ESB call fails, we still validate the user input to let him access the content
$esbResult->forceToUValidated = true;
$esbResult->sessionID = $_COOKIE[self::iniMerck()->variable('TIBCOCookieSettings', 'TIBCOCookieName')];
$loginResult = MMUserLogin::esbLogin( self::user()->attribute('uuid'), $esbResult, false, $context );
if ( $loginResult )
{
// Stringify params
$strParams = json_encode( $loginResult['params'] );
// Encrypts params
$encryptedParams = MMUserLogin::encryptText( $strParams );
// Redirect to PHP-ESI
$redirectURL = ContextTool::instance()->domain()."/loginActions.php?context=" . urlencode( $loginResult['destUrl'] ) . "¶ms=" . urlencode( $encryptedParams );
return $redirectURL;
}
}
示例9: dailyValue
/**
* @param string $name
* @param mixed $value
* @param string $cacheFileName
* @return mixed|null
*/
public static function dailyValue( $name, $value = null, $cacheFileName = null )
{
if ( $value === null && isset($memoryCache[$name]) && $cacheFileName === null )
{
return self::$memoryCache[$name];
}
else
{
if (is_null($cacheFileName))
{
$cacheFileName = self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier();
}
$cache = new eZPHPCreator(
eZSys::cacheDirectory(),
$cacheFileName . '.php',
'',
array()
);
$expiryTime = time() - 24 * 3600;
// reading
if ($cache->canRestore($expiryTime))
{
$values = $cache->restore(array('cacheTable' => 'cacheTable'));
if (is_null($value))
{
if (isset($values['cacheTable'][$name]))
{
return $values['cacheTable'][$name];
}
else
{
return null;
}
}
}
else
{
$values = array('cacheTable' => array());
}
$values['cacheTable'][$name] = $value;
if ( $cacheFileName == self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier() )
self::$memoryCache = $values['cacheTable'];
// writing
$cache->addVariable('cacheTable', $values['cacheTable']);
$cache->store(true);
$cache->close();
}
return null;
}
示例10: fetchByClusterIdentifier
/**
* @return TouPpPopin
*/
public static function fetchByClusterIdentifier()
{
$conditions = array(
"cluster_identifier" => ClusterTool::clusterIdentifier(),
);
$results = self::fetchObjectList(self::definition(), null, $conditions, null, 1);
return !is_null($results) ? array_pop($results) : null;
}
示例11: getFetchParams
/**
* @return array
*/
public static function getFetchParams()
{
return array(
'indent' => 'on',
'q' => '',
'start' => 0,
'rows' => 10,
'fl' => 'meta_node_id_si, attr_view_counter_'.ClusterTool::clusterIdentifier().'_i, attr_content_rating_'.ClusterTool::clusterIdentifier().'_f',
'qt' => 'ezpublish',
'explainOther' => '',
'hl.fl' => '',
'sort' => 'attr_online_date_dt desc, attr_headline_lc_s asc'
);
}
示例12: parseOptions
function parseOptions(array $options)
{
$parsedOptions = array();
$existingClusters = ClusterTool::globCluster();
if (empty($options['clusterIdentifier'])) {
$parsedOptions['clusters'] = $existingClusters;
} else {
$clusterList = explode(',', $options['clusterIdentifier']);
$clusterList = array_intersect($clusterList, $existingClusters);
$parsedOptions['clusters'] = $clusterList;
}
return $parsedOptions;
}
示例13: htmlBuildListResult
public function htmlBuildListResult()
{
$this->resultHandler->parseRequestParams();
$this->pushResult('cluster_identifier', ClusterTool::clusterIdentifier());
$this->pushResult('class_identifiers' , $this->resultHandler->contentClassIdentifiers);
$this->pushResult('is_logged_in' , (bool)$this->user());
$this->pushResult('tou_validated' , ($this->user() && $this->user()->toUValidated()));
$this->pushResult('num_found' , 0);
$this->pushResult('sort_list' , $this->resultHandler->sortList);
$this->pushResult('facets' , $this->getFacetsAsArray());
if ( $this->applicationObject && !empty($this->applicationObject->configurationContentService) )
$this->pushResult('content_service_configuration', $this->applicationObject->configurationContentService);
}
示例14: getApplicationTemplate
/**
* @param int $applicationTypeId
* @return ApplicationTemplate
*/
public static function getApplicationTemplate( $applicationTypeId )
{
$conditionList = ClusterTool::clusterOverride( array('application_type_id' => $applicationTypeId ) );
foreach ( $conditionList as $condition )
{
$applicationTemplate = self::fetchObject( self::definition(), null, $condition );
if ( $applicationTemplate instanceof self )
{
return $applicationTemplate;
}
}
return null;
}
示例15: getStaticConfiguration
/**
* @param int $applicationId
* @return ApplicationStaticConfiguration
*/
static public function getStaticConfiguration( $applicationId )
{
$conditionList = ClusterTool::clusterOverride( array('application_id' => $applicationId) );
foreach ( $conditionList as $condition )
{
$staticConfiguration = self::fetchObject( self::definition(), null, $condition );
if ( $staticConfiguration instanceof self )
{
return $staticConfiguration;
}
}
return null;
}