本文整理汇总了PHP中Misc::lowercase方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::lowercase方法的具体用法?PHP Misc::lowercase怎么用?PHP Misc::lowercase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::lowercase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRemoteUserInfo
/**
* Retrieve information from LDAP
*
* @param string $uid login or email
* @return array
*/
public function getRemoteUserInfo($uid)
{
if (strpos($uid, '@') === false) {
$filter = Net_LDAP2_Filter::create('uid', 'equals', $uid);
} else {
$filter = Net_LDAP2_Filter::create('mail', 'equals', $uid);
}
if (!empty($this->user_filter_string)) {
$user_filter = Net_LDAP2_Filter::parse($this->user_filter_string);
$filter = Net_LDAP2_Filter::combine('and', array($filter, $user_filter));
}
$search = $this->connect()->search($this->basedn, $filter, array('sizelimit' => 1));
$entry = $search->shiftEntry();
if (!$entry || Misc::isError($entry)) {
return null;
}
$details = array('uid' => $entry->get_value('uid'), 'full_name' => Misc::trim($entry->get_value('cn')), 'emails' => Misc::trim(Misc::lowercase($entry->get_value('mail', 'all'))), 'customer_id' => Misc::trim($entry->get_value($this->customer_id_attribute)) ?: null, 'contact_id' => Misc::trim($entry->get_value($this->contact_id_attribute)) ?: null);
return $details;
}
示例2: getTableList
/**
* @param DbInterface $conn
* @return array
*/
function getTableList($conn)
{
$tables = $conn->getColumn('SHOW TABLES');
// FIXME: why lowercase neccessary?
$tables = Misc::lowercase($tables);
return $tables;
}
示例3: notify
/**
* Method used to send email notifications for a given issue.
*
* @param integer $issue_id The issue ID
* @param string $type The notification type
* @param int $entry_id The entries id that was changed
* @param bool $internal_only Whether the notification should only be sent to internal users or not
* @param array $extra_recipients
* @return bool
*/
public static function notify($issue_id, $type, $entry_id = null, $internal_only = false, $extra_recipients = null)
{
$prj_id = Issue::getProjectID($issue_id);
$extra = array();
if ($extra_recipients) {
foreach ($extra_recipients as $user) {
$extra[] = array('sub_usr_id' => $user, 'sub_email' => '');
}
}
$emails = array();
$users = self::getUsersByIssue($issue_id, $type);
if ($extra_recipients && count($extra) > 0) {
$users = array_merge($users, $extra);
}
$user_emails = Project::getUserEmailAssocList(Issue::getProjectID($issue_id), 'active', User::ROLE_CUSTOMER);
$user_emails = Misc::lowercase($user_emails);
foreach ($users as $user) {
if (empty($user['sub_usr_id'])) {
if ($internal_only == false || in_array(strtolower($user['sub_email']), array_values($user_emails))) {
$email = $user['sub_email'];
}
} else {
$prefs = Prefs::get($user['sub_usr_id']);
if (Auth::getUserID() == $user['sub_usr_id'] && (empty($prefs['receive_copy_of_own_action'][$prj_id]) || $prefs['receive_copy_of_own_action'][$prj_id] == false)) {
continue;
}
// if we are only supposed to send email to internal users, check if the role is lower than standard user
if ($internal_only == true && User::getRoleByUser($user['sub_usr_id'], Issue::getProjectID($issue_id)) < User::ROLE_USER) {
continue;
}
if ($type == 'notes' && User::isPartner($user['sub_usr_id']) && !Partner::canUserAccessIssueSection($user['sub_usr_id'], 'notes')) {
continue;
}
$email = User::getFromHeader($user['sub_usr_id']);
}
// now add it to the list of emails
if (!empty($email) && !in_array($email, $emails)) {
$emails[] = $email;
}
}
// prevent the primary customer contact from receiving two emails about the issue being closed
if ($type == 'closed') {
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
$stmt = 'SELECT
iss_customer_contact_id
FROM
{{%issue}}
WHERE
iss_id=?';
$customer_contact_id = DB_Helper::getInstance()->getOne($stmt, array($issue_id));
if (!empty($customer_contact_id)) {
try {
$contact = $crm->getContact($customer_contact_id);
$contact_email = $contact->getEmail();
} catch (CRMException $e) {
$contact_email = '';
}
foreach ($emails as $i => $email) {
$email = Mail_Helper::getEmailAddress($email);
if ($email == $contact_email) {
unset($emails[$i]);
$emails = array_values($emails);
break;
}
}
}
}
}
if (!$emails) {
return null;
}
$headers = false;
switch ($type) {
case 'closed':
$data = Issue::getDetails($issue_id);
$data['closer_name'] = User::getFullName(History::getIssueCloser($issue_id));
$subject = ev_gettext('Closed');
if ($entry_id) {
$data['reason'] = Support::getEmail($entry_id);
}
break;
case 'updated':
// this should not be used anymore
return false;
case 'notes':
$data = self::getNote($issue_id, $entry_id);
$headers = array('Message-ID' => $data['note']['not_message_id']);
if (@$data['note']['reference_msg_id'] != false) {
$headers['In-Reply-To'] = $data['note']['reference_msg_id'];
//.........这里部分代码省略.........
示例4: printOpenIssues
/**
* Method used to print the list of open issues.
*
* @param RemoteApi $client The connection resource
* @param array $auth Array of authentication information (email, password)
* @param string $show_all_issues Whether to show all open issues or just the ones assigned to the current user
* @param string $status The status that should be used to restrict the results
*/
public static function printOpenIssues($client, $auth, $show_all_issues, $status)
{
$project_id = self::promptProjectSelection($client, $auth);
// check the status option
// check if the given status is a valid option
if (!empty($status)) {
$statuses = $client->getAbbreviationAssocList($auth[0], $auth[1], $project_id, true);
$titles = Misc::lowercase(array_values($statuses));
$abbreviations = Misc::lowercase(array_keys($statuses));
if (!in_array(strtolower($status), $titles) && !in_array(strtolower($status), $abbreviations)) {
self::quit("Status '{$status}' could not be matched against the list of available statuses");
}
// if the user is passing an abbreviation, use the real title instead
if (in_array(strtolower($status), $abbreviations)) {
$status = $statuses[strtoupper($status)];
}
}
$issues = $client->getOpenIssues($auth[0], $auth[1], $project_id, $show_all_issues, $status);
if (!empty($status)) {
echo "The following issues are set to status '{$status}':\n";
} else {
echo "The following issues are still open:\n";
}
foreach ($issues as $issue) {
echo '- #' . $issue['issue_id'] . ' - ' . $issue['summary'] . ' (' . $issue['status'] . ')';
if (!empty($issue['assigned_users'])) {
echo ' - (' . $issue['assigned_users'] . ')';
} else {
echo ' - (unassigned)';
}
echo "\n";
}
}
示例5: isAllowedToEmail
/**
* Checks whether the given email address is allowed to send emails in the
* issue ID.
*
* @param integer $issue_id The issue ID
* @param string $sender_email The email address
* @return boolean
*/
public static function isAllowedToEmail($issue_id, $sender_email)
{
$prj_id = Issue::getProjectID($issue_id);
// check the workflow
$workflow_can_email = Workflow::canEmailIssue($prj_id, $issue_id, $sender_email);
if ($workflow_can_email != null) {
return $workflow_can_email;
}
$is_allowed = true;
$sender_usr_id = User::getUserIDByEmail($sender_email, true);
if (empty($sender_usr_id)) {
if (CRM::hasCustomerIntegration($prj_id)) {
// check for a customer contact with several email addresses
$crm = CRM::getInstance($prj_id);
try {
$contract = $crm->getContract(Issue::getContractID($issue_id));
$contact_emails = array_keys($contract->getContactEmailAssocList());
$contact_emails = Misc::lowercase($contact_emails);
} catch (CRMException $e) {
$contact_emails = array();
}
if (!in_array(strtolower($sender_email), $contact_emails) && !Authorized_Replier::isAuthorizedReplier($issue_id, $sender_email)) {
$is_allowed = false;
}
} else {
if (!Authorized_Replier::isAuthorizedReplier($issue_id, $sender_email)) {
$is_allowed = false;
}
}
} else {
// check if this user is not a customer and
// also not in the assignment list for the current issue and
// also not in the authorized repliers list
// also not the reporter
$details = Issue::getDetails($issue_id);
if ($sender_usr_id == $details['iss_usr_id']) {
$is_allowed = true;
} elseif (User::isPartner($sender_usr_id) && in_array(User::getPartnerID($sender_usr_id), Partner::getPartnerCodesByIssue($issue_id))) {
$is_allowed = true;
} elseif (!Issue::canAccess($issue_id, $sender_usr_id) && !Authorized_Replier::isAuthorizedReplier($issue_id, $sender_email)) {
$is_allowed = false;
} elseif (!Authorized_Replier::isAuthorizedReplier($issue_id, $sender_email) && !Issue::isAssignedToUser($issue_id, $sender_usr_id) && User::getRoleByUser($sender_usr_id, Issue::getProjectID($issue_id)) != User::ROLE_CUSTOMER) {
$is_allowed = false;
}
}
return $is_allowed;
}