本文整理汇总了PHP中lang_pop函数的典型用法代码示例。如果您正苦于以下问题:PHP lang_pop函数的具体用法?PHP lang_pop怎么用?PHP lang_pop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lang_pop函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNotificationEmails
/**
* Builds notification emails for the selected customers about changes made in bugs reports they are linked to
*
* @param array $customer_ids the ids of the customer to notify
* @param string $from the start of the interval
* @param string $to the end of the interval
*
* @return array notified customers
*/
static function buildNotificationEmails($customer_ids, $from, $to)
{
$emails = array();
lang_push(plugin_config_get('email_notification_language'));
$fromDate = self::startOfDay(strtotime($from));
$toDate = self::endOfDay(strtotime($to));
$changedBugIds = CustomerManagementDao::findAllChangedBugIds($customer_ids, $fromDate, $toDate);
$dateFormat = config_get('short_date_format');
foreach ($customer_ids as $customer_id) {
$changesForCustomer = array();
foreach ($changedBugIds as $changedBugId) {
if ($changedBugId['customer_id'] == $customer_id) {
$changesForCustomer[] = array('bug' => bug_get($changedBugId['bug_id']));
}
}
if (count($changesForCustomer) > 0) {
$counter = 0;
$text = '';
foreach ($changesForCustomer as $changeForCustomer) {
$counter++;
$bugId = $changeForCustomer['bug']->id;
$text .= $counter . '. ';
$text .= sprintf(plugin_lang_get('email_notification_bug_header'), $changeForCustomer['bug']->id, $changeForCustomer['bug']->summary, date($dateFormat, $changeForCustomer['bug']->date_submitted), get_enum_element('status', $changeForCustomer['bug']->status));
$text .= "\n";
$reporterName = user_get_name($changeForCustomer['bug']->reporter_id);
$reporterEmail = user_get_email($changeForCustomer['bug']->reporter_id);
$text .= sprintf(plugin_lang_get('email_notification_bug_reported_by'), $reporterName, $reporterEmail);
$text .= "\n";
$text .= sprintf(plugin_lang_get('email_notification_bug_description'), $changeForCustomer['bug']->description);
$text .= "\n\n";
}
$customer = CustomerManagementDao::getCustomer($customer_id);
$email = new EmailData();
$email->email = $customer['email'];
$email->subject = sprintf(plugin_lang_get('email_notification_title'), $customer['name'], $from, $to);
$email->body = $text;
$email->metadata['priority'] = config_get('mail_priority');
$email->metadata['charset'] = 'utf-8';
array_push($emails, $email);
}
}
lang_pop();
return $emails;
}
示例2: error_handler
//.........这里部分代码省略.........
$t_method_array = config_get('display_errors');
if (isset($t_method_array[$p_type])) {
$t_method = $t_method_array[$p_type];
} else {
$t_method = 'none';
}
# build an appropriate error string
switch ($p_type) {
case E_WARNING:
$t_error_type = 'SYSTEM WARNING';
$t_error_description = $p_error;
break;
case E_NOTICE:
$t_error_type = 'SYSTEM NOTICE';
$t_error_description = $p_error;
break;
case E_USER_ERROR:
$t_error_type = "APPLICATION ERROR #{$p_error}";
$t_error_description = error_string($p_error);
break;
case E_USER_WARNING:
$t_error_type = "APPLICATION WARNING #{$p_error}";
$t_error_description = error_string($p_error);
break;
case E_USER_NOTICE:
# used for debugging
$t_error_type = 'DEBUG';
$t_error_description = $p_error;
break;
default:
#shouldn't happen, just display the error just in case
$t_error_type = '';
$t_error_description = $p_error;
}
$t_error_description = nl2br($t_error_description);
if ('halt' == $t_method) {
$t_old_contents = ob_get_contents();
# ob_end_clean() still seems to call the output handler which
# outputs the headers indicating compression. If we had
# PHP > 4.2.0 we could use ob_clean() instead but as it is
# we need to disable compression.
compress_disable();
if (ob_get_length()) {
ob_end_clean();
}
# don't send the page header information if it has already been sent
if ($g_error_send_page_header) {
html_page_top1();
if ($p_error != ERROR_DB_QUERY_FAILED) {
html_page_top2();
} else {
html_page_top2a();
}
}
print '<br /><div align="center"><table class="width50" cellspacing="1">';
print "<tr><td class=\"form-title\">{$t_error_type}</td></tr>";
print "<tr><td><p class=\"center\" style=\"color:red\">{$t_error_description}</p></td></tr>";
print '<tr><td><p class="center">';
if (null === $g_error_proceed_url) {
print lang_get('error_no_proceed');
} else {
print "<a href=\"{$g_error_proceed_url}\">" . lang_get('proceed') . '</a>';
}
print '</p></td></tr>';
if (ON == config_get('show_detailed_errors')) {
print '<tr><td>';
error_print_details($p_file, $p_line, $p_context);
print '</td></tr>';
print '<tr><td>';
error_print_stack_trace();
print '</td></tr>';
}
print '</table></div>';
if ($g_error_handled && !is_blank($t_old_contents)) {
print '<p>Previous non-fatal errors occurred. Page contents follow.</p>';
print '<div style="border: solid 1px black;padding: 4px">';
print $t_old_contents;
print '</div>';
}
if ($p_error != ERROR_DB_QUERY_FAILED) {
html_page_bottom1();
} else {
html_body_end();
html_end();
}
exit;
} else {
if ('inline' == $t_method) {
print "<p style=\"color:red\">{$t_error_type}: {$t_error_description}</p>";
} else {
# do nothing
}
}
if ($t_lang_pushed) {
lang_pop();
}
$g_error_parameters = array();
$g_error_handled = true;
$g_error_proceed_url = null;
}
示例3: get_enum_element
if (strcmp($f_access_level, $t_old_access_level)) {
$t_old_access_string = get_enum_element('access_levels', $t_old_access_level);
$t_new_access_string = get_enum_element('access_levels', $f_access_level);
$t_changes .= lang_get('access_level_label') . lang_get('word_separator') . $t_old_access_string . ' => ' . $t_new_access_string . "\n\n";
}
if (!empty($t_changes)) {
$t_subject = '[' . config_get('window_title') . '] ' . lang_get('email_user_updated_subject');
$t_updated_msg = lang_get('email_user_updated_msg');
$t_message = $t_updated_msg . "\n\n" . config_get('path') . 'account_page.php' . "\n\n" . $t_changes;
email_store($t_email, $t_subject, $t_message);
log_event(LOG_EMAIL, sprintf('Account update notification sent to ' . $f_username . ' (' . $t_email . ')'));
if (config_get('email_send_using_cronjob') == OFF) {
email_send_all();
}
}
lang_pop();
}
$t_redirect_url = 'manage_user_edit_page.php?user_id=' . $c_user_id;
form_security_purge('manage_user_update');
html_page_top(null, $result ? $t_redirect_url : null);
if ($f_protected && $t_old_protected) {
# PROTECTED
echo '<div class="failure-msg">';
echo lang_get('manage_user_protected_msg') . '<br />';
print_bracket_link($t_redirect_url, lang_get('proceed'));
echo '</div>';
} else {
if ($result) {
# SUCCESS
html_operation_successful($t_redirect_url);
}
示例4: error_handler
//.........这里部分代码省略.........
switch ($t_method) {
case DISPLAY_ERROR_HALT:
# disable any further event callbacks
if (function_exists('event_clear_callbacks')) {
event_clear_callbacks();
}
$t_oblen = ob_get_length();
if ($t_oblen > 0) {
$t_old_contents = ob_get_contents();
if (!error_handled()) {
# Retrieve the previously output header
if (false !== preg_match_all('|^(.*)(</head>.*$)|is', $t_old_contents, $t_result) && isset($t_result[1]) && isset($t_result[1][0])) {
$t_old_headers = $t_result[1][0];
unset($t_old_contents);
}
}
}
# We need to ensure compression is off - otherwise the compression headers are output.
compress_disable();
# then clean the buffer, leaving output buffering on.
if ($t_oblen > 0) {
ob_clean();
}
# If HTML error output was disabled, set an error header and stop
if (defined('DISABLE_INLINE_ERROR_REPORTING')) {
# @TODO Have a mapping for mantis error codes to appropiate HTTP error codes
header(' ', true, 400);
exit(1);
}
# don't send the page header information if it has already been sent
if ($g_error_send_page_header) {
if ($t_html_api) {
html_page_top1();
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_top2();
} else {
html_page_top2a();
}
} else {
echo '<html><head><title>', $t_error_type, '</title></head><body>';
}
} else {
# Output the previously sent headers, if defined
if (isset($t_old_headers)) {
echo $t_old_headers, "\n";
html_page_top2();
}
}
echo '<div id="error-msg">';
echo '<div class="error-type">' . $t_error_type . '</div>';
echo '<div class="error-description">', $t_error_description, '</div>';
echo '<div class="error-info">';
if (null === $g_error_proceed_url) {
echo lang_get('error_no_proceed');
} else {
echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>';
}
echo '</div>';
if (ON == config_get_global('show_detailed_errors')) {
echo '<div class="error-details">';
error_print_details($p_file, $p_line, $p_context);
echo '</div>';
echo '<div class="error-trace">';
error_print_stack_trace();
echo '</div>';
}
echo '</div>';
if (isset($t_old_contents)) {
echo '<div class="warning">Previous non-fatal errors occurred. Page contents follow.</div>';
echo '<div id="old-contents">';
echo $t_old_contents;
echo '</div>';
}
if ($t_html_api) {
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_bottom();
} else {
html_body_end();
html_end();
}
} else {
echo '</body></html>', "\n";
}
exit(1);
case DISPLAY_ERROR_INLINE:
if (!defined('DISABLE_INLINE_ERROR_REPORTING')) {
echo '<div class="error-inline">', $t_error_type, ': ', $t_error_description, '</div>';
}
$g_error_handled = true;
break;
default:
# do nothing - note we treat this as we've not handled an error, so any redirects go through.
}
}
if ($t_lang_pushed) {
lang_pop();
}
$g_error_parameters = array();
$g_error_proceed_url = null;
}
示例5: error_handler
//.........这里部分代码省略.........
$t_error_type = 'SYSTEM NOTICE';
$t_error_description = "'{$p_error}' in '{$p_file}' line {$p_line}";
break;
case E_USER_ERROR:
$t_error_type = "APPLICATION ERROR #{$p_error}";
$t_error_description = error_string($p_error);
break;
case E_USER_WARNING:
$t_error_type = "APPLICATION WARNING #{$p_error}";
$t_error_description = error_string($p_error);
break;
case E_USER_NOTICE:
# used for debugging
$t_error_type = 'DEBUG';
$t_error_description = $p_error;
break;
default:
# shouldn't happen, just display the error just in case
$t_error_type = '';
$t_error_description = $p_error;
}
$t_error_description = nl2br($t_error_description);
switch ($t_method) {
case 'halt':
# disable any further event callbacks
if (function_exists('event_clear_callbacks')) {
event_clear_callbacks();
}
$t_oblen = ob_get_length();
if (error_handled() && $t_oblen > 0) {
$t_old_contents = ob_get_contents();
}
# We need to ensure compression is off - otherwise the compression headers are output.
compress_disable();
# then clean the buffer, leaving output buffering on.
if ($t_oblen > 0) {
ob_clean();
}
# don't send the page header information if it has already been sent
if ($g_error_send_page_header) {
if ($t_html_api) {
html_page_top1();
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_top2();
} else {
html_page_top2a();
}
} else {
echo '<html><head><title>', $t_error_type, '</title></head><body>';
}
}
echo '<br /><div align="center"><table class="width50" cellspacing="1">';
echo '<tr><td class="form-title">', $t_error_type, '</td></tr>';
echo '<tr><td><p class="center" style="color:red">', $t_error_description, '</p></td></tr>';
echo '<tr><td><p class="center">';
if (null === $g_error_proceed_url) {
echo lang_get('error_no_proceed');
} else {
echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>';
}
echo '</p></td></tr>';
if (ON == config_get_global('show_detailed_errors')) {
echo '<tr><td>';
error_print_details($p_file, $p_line, $p_context);
echo '</td></tr>';
echo '<tr><td>';
error_print_stack_trace();
echo '</td></tr>';
}
echo '</table></div>';
if (isset($t_old_contents)) {
echo '<p>Previous non-fatal errors occurred. Page contents follow.</p>';
echo '<div style="border: solid 1px black;padding: 4px">';
echo $t_old_contents;
echo '</div>';
}
if ($t_html_api) {
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_bottom();
} else {
html_body_end();
html_end();
}
} else {
echo '</body></html>', "\n";
}
exit;
case 'inline':
echo '<p style="color:red">', $t_error_type, ': ', $t_error_description, '</p>';
$g_error_handled = true;
break;
default:
# do nothing - note we treat this as we've not handled an error, so any redirects go through.
}
if ($t_lang_pushed) {
lang_pop();
}
$g_error_parameters = array();
$g_error_proceed_url = null;
}
示例6: error_handler
//.........这里部分代码省略.........
$t_error_type = 'DEBUG';
$t_error_description = $p_error;
break;
default:
# shouldn't happen, just display the error just in case
$t_error_type = '';
$t_error_description = $p_error;
}
$t_error_description = nl2br($t_error_description);
switch ($t_method) {
case DISPLAY_ERROR_HALT:
# disable any further event callbacks
if (function_exists('event_clear_callbacks')) {
event_clear_callbacks();
}
$t_oblen = ob_get_length();
if ($t_oblen > 0) {
$t_old_contents = ob_get_contents();
if (!error_handled()) {
# Retrieve the previously output header
if (false !== preg_match_all('|^(.*)(</head>.*$)|is', $t_old_contents, $result)) {
$t_old_headers = $result[1][0];
unset($t_old_contents);
}
}
}
# We need to ensure compression is off - otherwise the compression headers are output.
compress_disable();
# then clean the buffer, leaving output buffering on.
if ($t_oblen > 0) {
ob_clean();
}
# don't send the page header information if it has already been sent
if ($g_error_send_page_header) {
if ($t_html_api) {
html_page_top1();
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_top2();
} else {
html_page_top2a();
}
} else {
echo '<html><head><title>', $t_error_type, '</title></head><body>';
}
} else {
# Output the previously sent headers, if defined
if (isset($t_old_headers)) {
echo $t_old_headers, "\n";
html_page_top2();
}
}
echo '<div id="error-msg">';
echo '<div class="error-type">' . $t_error_type . '</div>';
echo '<div class="error-description">', $t_error_description, '</div>';
echo '<div class="error-info">';
if (null === $g_error_proceed_url) {
echo lang_get('error_no_proceed');
} else {
echo '<a href="', $g_error_proceed_url, '">', lang_get('proceed'), '</a>';
}
echo '</div>';
if (ON == config_get_global('show_detailed_errors')) {
echo '<div class="error-details">';
error_print_details($p_file, $p_line, $p_context);
echo '</div>';
echo '<div class="error-trace">';
error_print_stack_trace();
echo '</div>';
}
echo '</div>';
if (isset($t_old_contents)) {
echo '<div class="warning">Previous non-fatal errors occurred. Page contents follow.</div>';
echo '<div id="old-contents">';
echo $t_old_contents;
echo '</div>';
}
if ($t_html_api) {
if ($p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true) {
html_page_bottom();
} else {
html_body_end();
html_end();
}
} else {
echo '</body></html>', "\n";
}
exit;
case DISPLAY_ERROR_INLINE:
echo '<div class="error-inline">', $t_error_type, ': ', $t_error_description, '</div>';
$g_error_handled = true;
break;
default:
# do nothing - note we treat this as we've not handled an error, so any redirects go through.
}
if ($t_lang_pushed) {
lang_pop();
}
$g_error_parameters = array();
$g_error_proceed_url = null;
}
示例7: email_user_mention
/**
* Send a notification to user or set of users that were mentioned in an issue
* or an issue note.
*
* @param integer $p_bug_id Issue for which the reminder is sent.
* @param array $p_mention_user_ids User id or list of user ids array.
* @param string $p_message Optional message to add to the e-mail.
* @param array $p_removed_mention_user_ids The users that were removed due to lack of access.
* @return array List of users ids to whom the reminder e-mail was actually sent
*/
function email_user_mention($p_bug_id, $p_mention_user_ids, $p_message, $p_removed_mention_user_ids = array())
{
if (OFF == config_get('enable_email_notification')) {
log_event(LOG_EMAIL_VERBOSE, 'email notifications disabled.');
return array();
}
$t_project_id = bug_get_field($p_bug_id, 'project_id');
$t_sender_id = auth_get_current_user_id();
$t_sender = user_get_name($t_sender_id);
$t_subject = email_build_subject($p_bug_id);
$t_date = date(config_get('normal_date_format'));
$t_user_id = auth_get_current_user_id();
$t_users_processed = array();
foreach ($p_removed_mention_user_ids as $t_removed_mention_user_id) {
log_event(LOG_EMAIL_VERBOSE, 'skipped mention email for U' . $t_removed_mention_user_id . ' (no access to issue or note).');
}
$t_result = array();
foreach ($p_mention_user_ids as $t_mention_user_id) {
# Don't trigger mention emails for self mentions
if ($t_mention_user_id == $t_user_id) {
log_event(LOG_EMAIL_VERBOSE, 'skipped mention email for U' . $t_mention_user_id . ' (self-mention).');
continue;
}
# Don't process a user more than once
if (isset($t_users_processed[$t_mention_user_id])) {
continue;
}
$t_users_processed[$t_mention_user_id] = true;
# Don't email mention notifications to disabled users.
if (!user_is_enabled($t_mention_user_id)) {
continue;
}
lang_push(user_pref_get_language($t_mention_user_id, $t_project_id));
$t_email = user_get_email($t_mention_user_id);
if (access_has_project_level(config_get('show_user_email_threshold'), $t_project_id, $t_mention_user_id)) {
$t_sender_email = ' <' . user_get_email($t_sender_id) . '> ';
} else {
$t_sender_email = '';
}
$t_complete_subject = sprintf(lang_get('mentioned_in'), $t_subject);
$t_header = "\n" . lang_get('on_date') . ' ' . $t_date . ', ' . $t_sender . ' ' . $t_sender_email . lang_get('mentioned_you') . "\n\n";
$t_contents = $t_header . string_get_bug_view_url_with_fqdn($p_bug_id) . " \n\n" . $p_message;
$t_id = email_store($t_email, $t_complete_subject, $t_contents);
if ($t_id !== null) {
$t_result[] = $t_mention_user_id;
}
log_event(LOG_EMAIL_VERBOSE, 'queued mention email ' . $t_id . ' for U' . $t_mention_user_id);
lang_pop();
}
return $t_result;
}