本文整理汇总了PHP中get_site_domain函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_domain函数的具体用法?PHP get_site_domain怎么用?PHP get_site_domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeAttributes
protected function initializeAttributes()
{
parent::initializeAttributes();
$this->siteDomain = get_site_domain($CONFIG->site_guid);
$this->site = elgg_get_site_entity();
$this->approvedDomains = ['forces.gc.ca', 'test.gc.ca'];
}
示例2: phpmailer_extract_from_email
/**
* Determine the best from email address
*
* @return string with email address
*/
function phpmailer_extract_from_email()
{
global $CONFIG;
$from_email = '';
$site = get_entity($CONFIG->site_guid);
// If there's an email address, use it - but only if its not from a user.
if (isset($from->email) && !$from instanceof ElggUser) {
$from_email = $from->email;
// Has the current site got a from email address?
} else {
if ($site && isset($site->email)) {
$from_email = $site->email;
// If we have a url then try and use that.
} else {
if (isset($from->url)) {
$breakdown = parse_url($from->url);
$from_email = 'noreply@' . $breakdown['host'];
// Handle anything with a url
// If all else fails, use the domain of the site.
} else {
$from_email = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
}
}
return $from_email;
}
示例3: html_email_handler_notification_handler
function html_email_handler_notification_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
{
if (!$from) {
$msg = elgg_echo("NotificationException:MissingParameter", array("from"));
throw new NotificationException($msg);
}
if (!$to) {
$msg = elgg_echo("NotificationException:MissingParameter", array("to"));
throw new NotificationException($msg);
}
if ($to->email == "") {
$msg = elgg_echo("NotificationException:NoEmailAddress", array($to->guid));
throw new NotificationException($msg);
}
// To
$to = html_email_handler_make_rfc822_address($to);
// From
$site = elgg_get_site_entity();
// If there's an email address, use it - but only if its not from a user.
if (!$from instanceof ElggUser && !empty($from->email)) {
$from = html_email_handler_make_rfc822_address($from);
} elseif (!empty($site->email)) {
// Use email address of current site if we cannot use sender's email
$from = html_email_handler_make_rfc822_address($site);
} else {
// If all else fails, use the domain of the site.
if (!empty($site->name)) {
$name = $site->name;
if (strstr($name, ',')) {
$name = '"' . $name . '"';
// Protect the name with quotations if it contains a comma
}
$name = '=?UTF-8?B?' . base64_encode($name) . '?=';
// Encode the name. If may content nos ASCII chars.
$from = $name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$from = "noreply@" . get_site_domain($site->getGUID());
}
}
// generate HTML mail body
$html_message = html_email_handler_make_html_body($subject, $message);
// set options for sending
$options = array("to" => $to, "from" => $from, "subject" => '=?UTF-8?B?' . base64_encode($subject) . '?=', "html_message" => $html_message, "plaintext_message" => $message);
if (!empty($params) && is_array($params)) {
$options = array_merge($options, $params);
}
return html_email_handler_send_email($options);
}
示例4: spam_login_filter_notify_admin
function spam_login_filter_notify_admin($blockedEmail, $blockedIp, $reason)
{
if (elgg_get_plugin_setting('notify_by_mail', 'spam_login_filter') == "yes") {
//Notify spam tentative to administrator
$site = elgg_get_site_entity();
if ($site && isset($site->email)) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
$message = sprintf(elgg_echo('spam_login_filter:notify_message'), $blockedEmail, $blockedIp, $reason);
$to = elgg_get_plugin_setting('notify_mail_address', 'spam_login_filter');
if (!is_email_address($to)) {
return;
}
elgg_send_email($from, $to, elgg_echo('spam_login_filter:notify_subject'), $message);
}
}
示例5: uservalidationbyadmin_request_validation
/**
* Request user validation email.
* Send email out to the address and request a confirmation.
*
* @param int $user_guid The user's GUID
* @param bool $admin_requested Was it requested by admin
* @return mixed
*/
function uservalidationbyadmin_request_validation($user_guid, $admin_requested = FALSE)
{
$site = elgg_get_site_entity();
if ($site && $site->email) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
$user_guid = (int) $user_guid;
$user = get_entity($user_guid);
//notify admins
if ($user && $user instanceof ElggUser) {
// Work out validate link
$code = uservalidationbyadmin_generate_code($user_guid, $user->email);
$link = "{$site->url}uservalidationbyadmin/confirm?u={$user_guid}&c={$code}";
// IP detection
$ip_address = $_SERVER['REMOTE_ADDR'];
/*$geoloc = "https://secure.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=".$ip_address;
$geotags = get_meta_tags($geoloc);
$geocountry = $geotags['country'];
$georegion = $geotags['region'];
$geocity = $geotags['city'];
$geocertainty = $geotags['certainty'];*/
$geostring = $ip_address;
//." ; ".$geocountry." ; ".$georegion." ; ".$geocity." ; ".$geocertainty;
// Send validation email
$subject = elgg_echo('email:validate:subject', array($user->name, $site->name));
$body = elgg_echo('email:validate:body', array($user->name, $user->email, $ip_address, $geostring, $link, $site->name, $site->url));
$emails = elgg_get_plugin_setting('emails', 'uservalidationbyadmin');
$admin_mails = explode(",", $emails);
$sent_total = 0;
foreach ($admin_mails as $mail) {
if (elgg_send_email($from, $mail, $subject, $body)) {
$sent_total++;
}
}
// Atleast 1 mail sent
if ($sent_total > 0 && !$admin_requested) {
system_message(elgg_echo('uservalidationbyadmin:registerok'));
}
return $result;
}
return FALSE;
}
示例6: send_user_password_mail
/**
* Send password for new user who is registered using facebook connect
*
* @param $email
* @param $name
* @param $username
* @param $password
*/
function send_user_password_mail($email, $name, $username, $password)
{
$site = elgg_get_site_entity();
$email = trim($email);
// send out other email addresses
if (!is_email_address($email)) {
return false;
}
$message = elgg_echo('facebook_connect:email:body', array($name, $site->name, $site->url, $username, $email, $password, $site->name, $site->url));
$subject = elgg_echo('facebook_connect:email:subject', array($name));
// create the from address
$site = get_entity($site->guid);
if ($site && isset($site->email)) {
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($site->guid);
}
elgg_send_email($from, $email, $subject, $message);
}
示例7: group_tools_invite_email
function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
$result = false;
if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && ($loggedin_user = elgg_get_logged_in_user_entity())) {
// get site secret
$site_secret = get_site_secret();
// generate invite code
$invite_code = md5($site_secret . $email . $group->getGUID());
if (!group_tools_check_group_email_invitation($invite_code, $group->getGUID()) || $resend) {
// make site email
$site = elgg_get_site_entity();
if (!empty($site->email)) {
if (!empty($site->name)) {
$site_from = $site->name . " <" . $site->email . ">";
} else {
$site_from = $site->email;
}
} else {
// no site email, so make one up
if (!empty($site->name)) {
$site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$site_from = "noreply@" . get_site_domain($site->getGUID());
}
}
if (!$resend) {
// register invite with group
$group->annotate("email_invitation", $invite_code, ACCESS_LOGGED_IN, $group->getGUID());
}
// make subject
$subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
// make body
$body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register", elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
$result = elgg_send_email($site_from, $email, $subject, $body);
} else {
$result = null;
}
}
return $result;
}
示例8: event_manager_send_registration_validation_email
function event_manager_send_registration_validation_email($event, $object)
{
$subject = elgg_echo("event_manager:registration:confirm:subject", array($event->title));
$message = elgg_echo("event_manager:registration:confirm:message", array($object->name, $event->title, event_manager_get_registration_validation_url($event->getGUID(), $object->getGUID())));
$site = elgg_get_site_entity();
// send confirmation mail
if (elgg_instanceof($object, "user")) {
notify_user($object->getGUID(), $site->getGUID(), $subject, $message, null, "email");
} else {
$from = $site->email;
if (empty($from)) {
$from = "noreply@" . get_site_domain($site->getGUID());
}
if (!empty($site->name)) {
$site_name = $site->name;
if (strstr($site_name, ',')) {
$site_name = '"' . $site_name . '"';
// Protect the name with quotations if it contains a comma
}
$site_name = '=?UTF-8?B?' . base64_encode($site_name) . '?=';
// Encode the name. If may content nos ASCII chars.
$from = $site_name . " <" . $from . ">";
}
elgg_send_email($from, $object->email, $subject, $message);
}
}
示例9: izap_get_video_name_prefix
function izap_get_video_name_prefix()
{
global $CONFIG;
$domain = get_site_domain($CONFIG->site_guid);
$domain = preg_replace('/[^A-Za-z0-9]+/', '_', $domain);
return $domain . '_izap_videos_';
}
示例10: array
// try to find a registration
$options = array("type" => "object", "subtype" => EventRegistration::SUBTYPE, "owner_guid" => $entity->getGUID(), "limit" => 1, "metadata_name_value_pairs" => array("name" => "email", "value" => $email, "case_sensitive" => false));
if ($registrations = elgg_get_entities_from_metadata($options)) {
$registration = $registrations[0];
// generate unsubscribe code
$unsubscribe_code = event_manager_create_unsubscribe_code($registration, $entity);
$unsubscribe_link = elgg_normalize_url("events/unsubscribe/confirm/" . $registration->getGUID() . "/" . $unsubscribe_code);
// make a message with further instructions
$subject = elgg_echo("event_manager:unsubscribe:confirm:subject", array($entity->title));
$message = elgg_echo("event_manager:unsubscribe:confirm:message", array($registration->name, $entity->title, $entity->getURL(), $unsubscribe_link));
// nice e-mail addresses
$site = elgg_get_site_entity();
if ($site->email) {
$from = $site->name . " <" . $site->email . ">";
} else {
$from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
}
$to = $registration->name . " <" . $registration->email . ">";
if (elgg_send_email($from, $to, $subject, $message)) {
elgg_clear_sticky_form("event_unsubscribe");
$forward_url = $entity->getURL();
system_message(elgg_echo("event_manager:action:unsubscribe:success"));
} else {
register_error(elgg_echo("event_manager:action:unsubscribe:error:mail"));
}
} else {
register_error(elgg_echo("event_manager:action:unsubscribe:error:no_registration"));
}
} else {
register_error(elgg_echo("ClassException:ClassnameNotClass", array($guid, elgg_echo("item:object:" . Event::SUBTYPE))));
}
示例11: html_email_handler_send_email
/**
*
* This function sends out a full HTML mail. It can handle several options
*
* This function requires the options 'to' and ('html_message' or 'plaintext_message')
*
* @param $options Array in the format:
* to => STR|ARR of recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* from => STR of senden in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* subject => STR with the subject of the message
* html_message => STR with the HTML version of the message
* plaintext_message STR with the plaintext version of the message
* cc => NULL|STR|ARR of CC recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* bcc => NULL|STR|ARR of BCC recipients in RFC-2822 format (http://www.faqs.org/rfcs/rfc2822.html)
* date => NULL|UNIX timestamp with the date the message was created
*
* @return BOOL true|false
*/
function html_email_handler_send_email(array $options = null)
{
$result = false;
$site = elgg_get_site_entity();
// make site email
if (!empty($site->email)) {
$sendmail_from = $site->email;
$site_from = html_email_handler_make_rfc822_address($site);
} else {
// no site email, so make one up
$sendmail_from = "noreply@" . get_site_domain($site->getGUID());
$site_from = $sendmail_from;
if (!empty($site->name)) {
$site_name = $site->name;
if (strstr($site_name, ',')) {
$site_name = '"' . $site_name . '"';
// Protect the name with quotations if it contains a comma
}
$site_name = '=?UTF-8?B?' . base64_encode($site_name) . '?=';
// Encode the name. If may content nos ASCII chars.
$site_from = $site_name . " <" . $sendmail_from . ">";
}
}
$sendmail_options = html_email_handler_get_sendmail_options();
// set default options
$default_options = array("to" => array(), "from" => $site_from, "subject" => "", "html_message" => "", "plaintext_message" => "", "cc" => array(), "bcc" => array(), "date" => null);
// merge options
$options = array_merge($default_options, $options);
// check options
if (!empty($options["to"]) && !is_array($options["to"])) {
$options["to"] = array($options["to"]);
}
if (!empty($options["cc"]) && !is_array($options["cc"])) {
$options["cc"] = array($options["cc"]);
}
if (!empty($options["bcc"]) && !is_array($options["bcc"])) {
$options["bcc"] = array($options["bcc"]);
}
// can we send a message
if (!empty($options["to"]) && (!empty($options["html_message"]) || !empty($options["plaintext_message"]))) {
// start preparing
$boundary = uniqid($site->name);
// start building headers
$headers = "";
if (!empty($options["from"])) {
$headers .= "From: " . $options["from"] . PHP_EOL;
} else {
$headers .= "From: " . $site_from . PHP_EOL;
}
// check CC mail
if (!empty($options["cc"])) {
$headers .= "Cc: " . implode(", ", $options["cc"]) . PHP_EOL;
}
// check BCC mail
if (!empty($options["bcc"])) {
$headers .= "Bcc: " . implode(", ", $options["bcc"]) . PHP_EOL;
}
// add a date header
if (!empty($options["date"])) {
$headers .= "Date: " . date("r", $options["date"]) . PHP_EOL;
}
$headers .= "X-Mailer: PHP/" . phpversion() . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: multipart/alternative; boundary=\"" . $boundary . "\"" . PHP_EOL . PHP_EOL;
// start building the message
$message = "";
// TEXT part of message
if (!empty($options["plaintext_message"])) {
$message .= "--" . $boundary . PHP_EOL;
$message .= "Content-Type: text/plain; charset=\"utf-8\"" . PHP_EOL;
$message .= "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL;
$message .= chunk_split(base64_encode($options["plaintext_message"])) . PHP_EOL . PHP_EOL;
}
// HTML part of message
if (!empty($options["html_message"])) {
$message .= "--" . $boundary . PHP_EOL;
$message .= "Content-Type: text/html; charset=\"utf-8\"" . PHP_EOL;
$message .= "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL;
$message .= chunk_split(base64_encode($options["html_message"])) . PHP_EOL;
}
// Final boundry
$message .= "--" . $boundary . "--" . PHP_EOL;
//.........这里部分代码省略.........
示例12: simplesaml_get_user_attributes
/**
* Get the user attributes for the provided IDendtity Provider (IDP) configuration.
*
* These attributes will be send to an external Service Provider.
*
* @param string $idp_auth_id the name of the IDP configuration
*
* @return array an array with all the configured attributes
*/
function simplesaml_get_user_attributes($idp_auth_id)
{
$result = null;
$user = elgg_get_logged_in_user_entity();
if (!empty($idp_auth_id) && !empty($user)) {
$field_configuration = elgg_get_plugin_setting("idp_" . $idp_auth_id . "_attributes", "simplesaml");
$site = elgg_get_site_entity();
$result = array("uid" => array($user->username . "@" . get_site_domain($site->getGUID())));
if (!empty($field_configuration)) {
$field_configuration = json_decode($field_configuration, true);
foreach ($field_configuration as $profile_field => $attribute_name) {
if (!empty($attribute_name)) {
$value = $user->{$profile_field};
if (!empty($value)) {
if (!is_array($value)) {
$value = array($value);
}
$result[$attribute_name] = $value;
}
}
}
}
$params = array("user" => $user, "idp_auth_id" => $idp_auth_id, "attributes" => $result);
$result = elgg_trigger_plugin_hook("idp_attributes", "simplesaml", $params, $result);
}
return $result;
}
示例13: sprintf
$message = sprintf(elgg_echo('invitefriends:email'), $CONFIG->site->name, $_SESSION['user']->name, $emailmessage, $link);
// **** this should be replaced by a core function for sending emails to people who are not members
$site = get_entity($CONFIG->site_guid);
// If there's an email address, use it - but only if its not from a user.
if ($site && isset($site->email)) {
// Has the current site got a from email address?
$from = $site->email;
} else {
if (isset($from->url)) {
// If we have a url then try and use that.
$breakdown = parse_url($from->url);
$from = 'noreply@' . $breakdown['host'];
// Handle anything with a url
} else {
// If all else fails, use the domain of the site.
$from = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
}
if (is_callable('mb_internal_encoding')) {
mb_internal_encoding('UTF-8');
}
$site = get_entity($CONFIG->site_guid);
$sitename = $site->name;
if (is_callable('mb_encode_mimeheader')) {
$sitename = mb_encode_mimeheader($site->name, "UTF-8", "B");
}
$header_eol = "\r\n";
if (isset($CONFIG->broken_mta) && $CONFIG->broken_mta) {
// Allow non-RFC 2822 mail headers to support some broken MTAs
$header_eol = "\n";
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:invite.php
示例14: group_tools_invite_email
/**
* Invite a new user by email to a group
*
* @param ElggGroup $group the group to be invited for
* @param string $email the email address to be invited
* @param string $text (optional) extra text in the invitation
* @param boolean $resend should existing invitations be resend
*
* @return boolean|NULL true is invited, false on failure, null when already send
*/
function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
$result = false;
$loggedin_user = elgg_get_logged_in_user_entity();
if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && !empty($loggedin_user)) {
// generate invite code
$invite_code = group_tools_generate_email_invite_code($group->getGUID(), $email);
if (!empty($invite_code)) {
$found_group = group_tools_check_group_email_invitation($invite_code, $group->getGUID());
if (empty($found_group) || $resend) {
// make site email
$site = elgg_get_site_entity();
if (!empty($site->email)) {
if (!empty($site->name)) {
$site_from = $site->name . " <" . $site->email . ">";
} else {
$site_from = $site->email;
}
} else {
// no site email, so make one up
if (!empty($site->name)) {
$site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
} else {
$site_from = "noreply@" . get_site_domain($site->getGUID());
}
}
if (empty($found_group)) {
// register invite with group
$group->annotate("email_invitation", $invite_code . "|" . $email, ACCESS_LOGGED_IN, $group->getGUID());
}
// make subject
$subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
// make body
$body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register?group_invitecode=" . $invite_code, elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
$params = array("group" => $group, "inviter" => $loggedin_user, "invitee" => $email);
$body = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $body);
$result = elgg_send_email($site_from, $email, $subject, $body);
} else {
$result = null;
}
}
}
return $result;
}
示例15: form_send_invitations
function form_send_invitations($invite_box_name, $form_data_id)
{
global $CONFIG;
$contacts = trim(get_input($invite_box_name . '_contacts', ''));
if ($contacts) {
$user_message = trim(get_input($invite_box_name . '_message', ''));
$url = $CONFIG->wwwroot . 'mod/form/display_object.php?d=' . $form_data_id;
$message = sprintf(elgg_echo('form:invite_message'), $_SESSION['user']->name, $url);
if ($user_message) {
$message .= sprintf(elgg_echo('form:user_message'), $user_message);
}
$user_list = array();
$email_address_list = array();
// handle comma separators
$contacts2 = explode(",", $contacts);
// handle new line separators as well
$contact_list = array();
foreach ($contacts2 as $contact) {
$contact_list = array_merge($contact_list, explode("\n", $contact));
}
foreach ($contact_list as $contact) {
$contact = trim($contact);
if (strpos($contact, '@') === false) {
$user = get_user_by_username($contact);
if ($user && ($user_id = $user->getGUID())) {
$user_list[] = $user_id;
}
} else {
$email_address_list[] = $contact;
}
}
$subject = sprintf(elgg_echo('form:invite_subject'), $_SESSION['user']->name);
if ($user_list) {
$from = $_SESSION['user']->getGUID();
//print_r($user_list);
//print $subject;
//print $message;
// need to force email for now as Elgg 1 notification does not seem to work without it
notify_user($user_list, $from, $subject, $message, null, array('email'));
}
if ($email_address_list) {
$site = get_entity($CONFIG->site_guid);
if ($site->email) {
// this should be defined as of Elgg 1.1
$from = $site->email;
} else {
$from = 'noreply@' . get_site_domain($CONFIG->site_guid);
}
form_send_email($email_address_list, $from, $subject, $message);
}
}
}