本文整理汇总了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] );
}