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


PHP api_Utils::IsPhoneSearch方法代码示例

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


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

示例1: GetContactItemsCount

    /**
     * @param int $iUserId
     * @param string $sSearch
     * @param int $iGroupId
     * @param int $iSharedTenantId = null
     * @param bool $bAll = false
     * @return string
     */
    public function GetContactItemsCount($iUserId, $sSearch, $sFirstCharacter, $iGroupId, $iSharedTenantId = null, $bAll = false)
    {
        $sGroupAdd = '';
        if (0 < $iGroupId) {
            $sGroupAdd = sprintf('
INNER JOIN %sawm_addr_groups_contacts AS gr_cnt ON gr_cnt.id_addr = book.id_addr AND gr_cnt.id_group = %d', $this->prefix(), $iGroupId);
        }
        $sSearchAdd = '';
        $sFirstCharacter = 0 < strlen(trim($sFirstCharacter)) ? trim($sFirstCharacter) : '';
        if (!empty($sFirstCharacter)) {
            $sSearch = '\'' . $this->escapeString($sFirstCharacter, true, true) . '%\'';
            $sSearchAdd = sprintf('book.fullname LIKE %s OR book.firstname LIKE %s OR book.surname LIKE %s OR book.nickname LIKE %s OR book.h_email LIKE %s OR book.b_email LIKE %s OR book.other_email LIKE %s', $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch);
        }
        if (0 < strlen($sSearch)) {
            $bPhone = api_Utils::IsPhoneSearch($sSearch);
            $sPhoneSearch = $bPhone ? api_Utils::ClearPhoneSearch($sSearch) : '';
            $sSearch = '\'%' . $this->escapeString($sSearch, true, true) . '%\'';
            $sMainSearch = sprintf('book.fullname LIKE %s OR book.firstname LIKE %s OR book.surname LIKE %s OR book.nickname LIKE %s OR book.h_email LIKE %s OR book.b_email LIKE %s OR book.other_email LIKE %s', $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch);
            if (0 < strlen($sPhoneSearch)) {
                $sPhoneSearch = '\'%' . $this->escapeString($sPhoneSearch, true, true) . '%\'';
                $sMainSearch .= sprintf(' OR ' . '(b_phone <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(b_phone, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s) OR ' . '(h_phone <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(h_phone, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s) OR ' . '(h_mobile <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(h_mobile, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s)', $sPhoneSearch, $sPhoneSearch, $sPhoneSearch);
            }
            $sSearchAdd = 0 === strlen($sSearchAdd) ? $sMainSearch : '(' . $sSearchAdd . ') AND (' . $sMainSearch . ')';
        }
        $sUserWhere = $this->sharedItemsSqlHelper($iUserId, $iGroupId, is_int($iSharedTenantId), 0 < $iGroupId, 'book.', $bAll);
        $sSql = 'SELECT COUNT(book.id_addr) AS cnt FROM %sawm_addr_book as book%s
WHERE %s AND book.deleted = 0 AND book.hide_in_gab = 0 AND book.auto_create = 0%s';
        return sprintf($sSql, $this->prefix(), $sGroupAdd, $sUserWhere, 0 < strlen($sSearchAdd) ? ' AND (' . $sSearchAdd . ')' : '');
    }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:37,代码来源:command_creator.php


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