本文整理匯總了PHP中CRM_Utils_String::match方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Utils_String::match方法的具體用法?PHP CRM_Utils_String::match怎麽用?PHP CRM_Utils_String::match使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Utils_String
的用法示例。
在下文中一共展示了CRM_Utils_String::match方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pushUserContext
/**
* Adds a userContext to the stack.
*
* @param string $userContext
* The url to return to when done.
* @param bool $check
* Should we do a dupe checking with the top element.
*
* @return void
*/
public function pushUserContext($userContext, $check = TRUE)
{
if (empty($userContext)) {
return;
}
$this->createScope(self::USER_CONTEXT);
// hack, reset if too big
if (count($this->_session[$this->_key][self::USER_CONTEXT]) > 10) {
$this->resetScope(self::USER_CONTEXT);
$this->createScope(self::USER_CONTEXT);
}
$topUC = array_pop($this->_session[$this->_key][self::USER_CONTEXT]);
// see if there is a match between the new UC and the top one. the match needs to be
// fuzzy since we use the referer at times
// if close enough, lets just replace the top with the new one
if ($check && $topUC && CRM_Utils_String::match($topUC, $userContext)) {
array_push($this->_session[$this->_key][self::USER_CONTEXT], $userContext);
} else {
if ($topUC) {
array_push($this->_session[$this->_key][self::USER_CONTEXT], $topUC);
}
array_push($this->_session[$this->_key][self::USER_CONTEXT], $userContext);
}
}
示例2: pushUserContext
/**
* adds a userContext to the stack
*
* @param string $userContext the url to return to when done
* @param boolean $check should we do a dupe checking with the top element
* @return void
*
* @access public
*
*/
function pushUserContext($userContext, $check = true)
{
if (empty($userContext)) {
return;
}
$this->createScope(CRM_CORE_SESSION_USER_CONTEXT);
// hack, reset if too big
if (count($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT]) > 10) {
$this->resetScope(CRM_CORE_SESSION_USER_CONTEXT);
$this->createScope(CRM_CORE_SESSION_USER_CONTEXT);
}
$topUC = array_pop($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT]);
// see if there is a match between the new UC and the top one. the match needs to be
// fuzzy since we use the referer at times
if ($check && $topUC && CRM_Utils_String::match($topUC, $userContext)) {
array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $topUC);
} else {
if ($topUC) {
array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $topUC);
}
array_push($this->_session[$this->_key][CRM_CORE_SESSION_USER_CONTEXT], $userContext);
}
// CRM_Core_Error::debug( 'UC', $this->_session[$this->_key][self::USER_CONTEXT] );
}