コード例 #1
0
 function cron_email()
 {
     $nxtw_options = get_option('nxtw_options');
     if ($nxtw_options['cron_email'] == 1) {
         $last_email = $nxtw_options['cron_last_email_date'];
         $emails = getAllAdmins();
         $sql = "SELECT post_title, guid FROM " . $nxtdb->prefix . "posts WHERE post_modifiyed > " . $last_email;
         $subject = "Wiki Change";
         $results = $nxtdb->get_results($sql);
         $message = " The following Wiki Pages has been modified on '" . get_option('home') . "' \n\r ";
         if ($results) {
             foreach ($results as $result) {
                 $pageTitle = $result->post_title;
                 $pagelink = $result->guid;
                 $message .= "Page title is " . $pageTitle . ". \n\r To visit this page <a href='" . $pagelink . "'> click here</a>.\n\r\n\r";
                 //exit(print_r($emails, true));
                 foreach ($emails as $email) {
                     nxt_mail($email, $subject, $message);
                 }
             }
         }
         $nxtw_options['cron_last_email_date'] = date('Y-m-d G:i:s');
         update_option('nxtw_options', serialize($nxtw_options));
     }
 }
コード例 #2
0
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
    global $bp;
    $friendship = new BP_Friends_Friendship($friendship_id, false, false);
    $friend_name = bp_core_get_user_displayname($friend_id);
    if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
        return false;
    }
    $ud = get_userdata($initiator_id);
    $friend_link = bp_core_get_user_domain($friend_id);
    $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
    $settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications';
    // Set up and send the message
    $to = $ud->user_email;
    $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
    $subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name);
    $message = sprintf(__('%1$s accepted your friend request.

To view %2$s\'s profile: %3$s

---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
    $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    /* Send the message */
    $to = apply_filters('friends_notification_accepted_request_to', $to);
    $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name);
    $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link);
    nxt_mail($to, $subject, $message);
    do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id);
}
コード例 #3
0
function messages_notification_new_message($args)
{
    global $bp;
    extract($args);
    $email_subject = $email_content = $args = '';
    $sender_name = bp_core_get_user_displayname($sender_id);
    foreach ($recipients as $recipient) {
        if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
            continue;
        }
        // User data and links
        $ud = get_userdata($recipient->user_id);
        $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
        $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
        $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
        // Sender info
        $sender_name = stripslashes($sender_name);
        $subject = stripslashes(nxt_filter_kses($subject));
        $content = stripslashes(nxt_filter_kses($content));
        // Set up and send the message
        $email_to = $ud->user_email;
        $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
        $email_subject = '[' . $sitename . '] ' . sprintf(__('New message from %s', 'buddypress'), $sender_name);
        $email_content = sprintf(__('%s sent you a new message:

Subject: %s

"%s"

To view and read your messages please log in and visit: %s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
        $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        // Send the message
        $email_to = apply_filters('messages_notification_new_message_to', $email_to);
        $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name);
        $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link);
        nxt_mail($email_to, $email_subject, $email_content);
    }
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
コード例 #4
0
/**
 * Sends the email notification to the user when an Achievement is unlocked.
 *
 * @global object $bp BuddyPress global settings
 * @global nxtdb $nxtdb NXTClass database object
 * @param int $achievement_id
 * @param int $user_id
 * @since 2.0
 */
function dpa_achievement_unlocked_notification($achievement_id, $user_id)
{
    global $achievements_template, $bp, $nxtdb;
    if ('no' == get_user_meta($user_id, 'notification_dpa_unlock_achievement', true)) {
        return;
    }
    $recipient = get_userdata($user_id);
    $settings_link = bp_core_get_user_domain($user_id) . bp_get_settings_slug() . '/notifications/';
    $achievements_link = bp_core_get_user_domain($user_id) . DPA_SLUG . '/';
    $email_subject = sprintf(__('[%1$s] Achievement unlocked: %2$s', 'dpa'), nxt_specialchars_decode(get_blog_option(BP_ROOT_BLOG, 'blogname'), ENT_QUOTES), dpa_get_achievement_name());
    $email_content = sprintf(__('
You have unlocked an Achievement: %1$s

To review this and see all of your Achievements, go to %2$s

---------------------
To disable these notifications please log in and go to: %3$s', 'dpa'), dpa_get_achievement_name(), $achievements_link, $settings_link);
    // Send the message
    $email_to = apply_filters('dpa_unlock_achievement_notification_to', $recipient->user_email, $achievement_id);
    $email_subject = apply_filters('dpa_unlock_achievement_notification_subject', $email_subject, $achievement_id);
    $email_content = apply_filters('dpa_unlock_achievement_notification_message', $email_content, $achievement_id, $achievements_link, $settings_link);
    nxt_mail($email_to, $email_subject, $email_content);
}
コード例 #5
0
ファイル: Minify.php プロジェクト: nxtclass/NXTClass
 /**
  * Send E-mail notification when error occured
  *
  * @return boolean
  */
 function _send_notification()
 {
     $from_email = 'nxtclass@' . w3_get_domain($_SERVER['SERVER_NAME']);
     $from_name = get_option('blogname');
     $to_name = $to_email = get_option('admin_email');
     $body = @file_get_contents(W3TC_INC_DIR . '/email/minify_error_notification.php');
     $headers = array(sprintf('From: "%s" <%s>', addslashes($from_name), $from_email), sprintf('Reply-To: "%s" <%s>', addslashes($to_name), $to_email), 'Content-Type: text/html; charset=UTF-8');
     @set_time_limit($this->_config->get_integer('timelimit.email_send'));
     $result = @nxt_mail($to_email, 'W3 Total Cache Error Notification', $body, implode("\n", $headers));
     return $result;
 }
コード例 #6
0
ファイル: bp-core-filters.php プロジェクト: nxtclass/NXTClass
function bp_core_activation_signup_user_notification($user, $user_email, $key, $meta)
{
    $activate_url = bp_get_activation_page() . "?key={$key}";
    $activate_url = esc_url($activate_url);
    $admin_email = get_site_option('admin_email');
    if (empty($admin_email)) {
        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    }
    // If this is an admin generated activation, add a param to email the
    // user login details
    $email = is_admin() ? '&e=1' : '';
    $from_name = '' == get_site_option('site_name') ? 'NXTClass' : esc_html(get_site_option('site_name'));
    $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress'), $activate_url . $email);
    $subject = '[' . $from_name . '] ' . __('Activate Your Account', 'buddypress');
    // Send the message
    $to = apply_filters('bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta);
    $subject = apply_filters('bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta);
    $message = apply_filters('bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta);
    nxt_mail($to, $subject, $message, $message_headers);
    do_action('bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta);
    // Return false to stop the original nxtMU function from continuing
    return false;
}
コード例 #7
0
ファイル: upgrade.php プロジェクト: nxtclass/NXTClass
 /**
  * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param string $blog_title Blog title.
  * @param string $blog_url Blog url.
  * @param int $user_id User ID.
  * @param string $password User's Password.
  */
 function nxt_new_blog_notification($blog_title, $blog_url, $user_id, $password)
 {
     $user = new nxt_User($user_id);
     $email = $user->user_email;
     $name = $user->user_login;
     $message = sprintf(__("Your new NXTClass site has been successfully set up at:\n\n%1\$s\n\nYou can log in to the administrator account with the following information:\n\nUsername: %2\$s\nPassword: %3\$s\n\nWe hope you enjoy your new site. Thanks!\n\n--The NXTClass Team\nhttp://nxtclass.org/\n"), $blog_url, $name, $password);
     @nxt_mail($email, __('New NXTClass Site'), $message);
 }
コード例 #8
0
ファイル: user-new.php プロジェクト: nxtclass/NXTClass
    } else {
        if (isset($_POST['noconfirmation']) && is_super_admin()) {
            add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role']));
            $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
        } else {
            $newuser_key = substr(md5($user_id), 0, 5);
            add_option('new_user_' . $newuser_key, array('user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST['role']));
            /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */
            $message = __('Hi,

You\'ve been invited to join \'%1$s\' at
%2$s with the role of %3$s.

Please click the following link to confirm the invite:
%4$s');
            nxt_mail($new_user_email, sprintf(__('[%s] Joining confirmation'), get_option('blogname')), sprintf($message, get_option('blogname'), site_url(), $_REQUEST['role'], site_url("/newbloguser/{$newuser_key}/")));
            $redirect = add_query_arg(array('update' => 'add'), 'user-new.php');
        }
    }
    nxt_redirect($redirect);
    die;
} elseif (isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action']) {
    check_admin_referer('create-user', '_nxtnonce_create-user');
    if (!current_user_can('create_users')) {
        nxt_die(__('Cheatin&#8217; uh?'));
    }
    if (!is_multisite()) {
        $user_id = add_user();
        if (is_nxt_error($user_id)) {
            $add_user_errors = $user_id;
        } else {
コード例 #9
0
ファイル: ms.php プロジェクト: nxtclass/NXTClass
function send_confirmation_on_profile_email()
{
    global $errors, $nxtdb;
    $current_user = nxt_get_current_user();
    if (!is_object($errors)) {
        $errors = new nxt_Error();
    }
    if ($current_user->ID != $_POST['user_id']) {
        return false;
    }
    if ($current_user->user_email != $_POST['email']) {
        if (!is_email($_POST['email'])) {
            $errors->add('user_email', __("<strong>ERROR</strong>: The e-mail address isn't correct."), array('form-field' => 'email'));
            return;
        }
        if ($nxtdb->get_var($nxtdb->prepare("SELECT user_email FROM {$nxtdb->users} WHERE user_email=%s", $_POST['email']))) {
            $errors->add('user_email', __("<strong>ERROR</strong>: The e-mail address is already used."), array('form-field' => 'email'));
            delete_option($current_user->ID . '_new_email');
            return;
        }
        $hash = md5($_POST['email'] . time() . mt_rand());
        $new_user_email = array('hash' => $hash, 'newemail' => $_POST['email']);
        update_option($current_user->ID . '_new_email', $new_user_email);
        $content = apply_filters('new_user_email_content', __("Dear user,\n\nYou recently requested to have the email address on your account changed.\nIf this is correct, please click on the following link to change it:\n###ADMIN_URL###\n\nYou can safely ignore and delete this email if you do not want to\ntake this action.\n\nThis email has been sent to ###EMAIL###\n\nRegards,\nAll at ###SITENAME###\n###SITEURL###"), $new_user_email);
        $content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail=' . $hash)), $content);
        $content = str_replace('###EMAIL###', $_POST['email'], $content);
        $content = str_replace('###SITENAME###', get_site_option('site_name'), $content);
        $content = str_replace('###SITEURL###', network_home_url(), $content);
        nxt_mail($_POST['email'], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content);
        $_POST['email'] = $current_user->user_email;
    }
}
コード例 #10
0
function groups_notification_group_invites(&$group, &$member, $inviter_user_id)
{
    global $bp;
    $inviter_ud = bp_core_get_core_userdata($inviter_user_id);
    $inviter_name = bp_core_get_userlink($inviter_user_id, true, false, true);
    $inviter_link = bp_core_get_user_domain($inviter_user_id);
    $group_link = bp_get_group_permalink($group);
    if (!$member->invite_sent) {
        $invited_user_id = $member->user_id;
        // Post a screen notification first.
        bp_core_add_notification($group->id, $invited_user_id, 'groups', 'group_invite');
        if ('no' == bp_get_user_meta($invited_user_id, 'notification_groups_invite', true)) {
            return false;
        }
        $invited_ud = bp_core_get_core_userdata($invited_user_id);
        $settings_link = bp_core_get_user_domain($invited_user_id) . bp_get_settings_slug() . '/notifications/';
        $invited_link = bp_core_get_user_domain($invited_user_id);
        $invites_link = $invited_link . bp_get_groups_slug() . '/invites';
        // Set up and send the message
        $to = $invited_ud->user_email;
        $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
        $subject = '[' . $sitename . '] ' . sprintf(__('You have an invitation to the group: "%s"', 'buddypress'), $group->name);
        $message = sprintf(__('One of your friends %1$s has invited you to the group: "%2$s".

To view your group invites visit: %3$s

To view the group visit: %4$s

To view %5$s\'s profile visit: %6$s

---------------------
', 'buddypress'), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('groups_notification_group_invites_to', $to);
        $subject = apply_filters_ref_array('groups_notification_group_invites_subject', array($subject, &$group));
        $message = apply_filters_ref_array('groups_notification_group_invites_message', array($message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link));
        nxt_mail($to, $subject, $message);
        do_action('bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group);
    }
}
コード例 #11
0
ファイル: ms-delete-site.php プロジェクト: nxtclass/NXTClass
}
$title = __('Delete Site');
$parent_file = 'tools.php';
require_once './admin-header.php';
echo '<div class="wrap">';
screen_icon();
echo '<h2>' . esc_html($title) . '</h2>';
if (isset($_POST['action']) && $_POST['action'] == 'deleteblog' && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1') {
    check_admin_referer('delete-blog');
    $hash = nxt_generate_password(20, false);
    update_option('delete_blog_hash', $hash);
    $url_delete = esc_url(admin_url('ms-delete-site.php?h=' . $hash));
    $content = apply_filters('delete_site_email_content', __("Dear User,\nYou recently clicked the 'Delete Site' link on your site and filled in a\nform on that page.\nIf you really want to delete your site, click the link below. You will not\nbe asked to confirm again so only click this link if you are absolutely certain:\n###URL_DELETE###\n\nIf you delete your site, please consider opening a new site here\nsome time in the future! (But remember your current site and username\nare gone forever.)\n\nThanks for using the site,\nWebmaster\n###SITE_NAME###"));
    $content = str_replace('###URL_DELETE###', $url_delete, $content);
    $content = str_replace('###SITE_NAME###', $current_site->site_name, $content);
    nxt_mail(get_option('admin_email'), "[ " . get_option('blogname') . " ] " . __('Delete My Site'), $content);
    ?>

	<p><?php 
    _e('Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ');
    ?>
</p>

<?php 
} else {
    ?>
	<p><?php 
    printf(__('If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name);
    ?>
</p>
	<p><?php 
コード例 #12
0
ファイル: 1.5.php プロジェクト: nxtclass/NXTClass-Plugin
/**
 * Send an email and a BP notification on receipt of an @-mention in a group
 *
 * @deprecated 1.5
 * @deprecated Deprecated in favor of the more general bp_activity_at_message_notification()
 */
function groups_at_message_notification($content, $poster_user_id, $group_id, $activity_id)
{
    global $bp;
    _deprecated_function(__FUNCTION__, '1.5', 'bp_activity_at_message_notification()');
    /* Scan for @username strings in an activity update. Notify each user. */
    $pattern = '/[@]+([A-Za-z0-9-_\\.@]+)/';
    preg_match_all($pattern, $content, $usernames);
    /* Make sure there's only one instance of each username */
    if (!($usernames = array_unique($usernames[1]))) {
        return false;
    }
    $group = new BP_Groups_Group($group_id);
    foreach ((array) $usernames as $username) {
        if (!($receiver_user_id = bp_core_get_userid($username))) {
            continue;
        }
        /* Check the user is a member of the group before sending the update. */
        if (!groups_is_user_member($receiver_user_id, $group_id)) {
            continue;
        }
        // Now email the user with the contents of the message (if they have enabled email notifications)
        if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
            $poster_name = bp_core_get_user_displayname($poster_user_id);
            $message_link = bp_activity_get_permalink($activity_id);
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
            $poster_name = stripslashes($poster_name);
            $content = bp_groups_filter_kses(stripslashes($content));
            // Set up and send the message
            $ud = bp_core_get_core_userdata($receiver_user_id);
            $to = $ud->user_email;
            $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
            $subject = '[' . $sitename . '] ' . sprintf(__('%1$s mentioned you in the group "%2$s"', 'buddypress'), $poster_name, $group->name);
            $message = sprintf(__('%1$s mentioned you in the group "%2$s":

"%3$s"

To view and respond to the message, log in and visit: %4$s

---------------------
', 'buddypress'), $poster_name, $group->name, $content, $message_link);
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            /* Send the message */
            $to = apply_filters('groups_at_message_notification_to', $to);
            $subject = apply_filters('groups_at_message_notification_subject', $subject, $group, $poster_name);
            $message = apply_filters('groups_at_message_notification_message', $message, $group, $poster_name, $content, $message_link, $settings_link);
            nxt_mail($to, $subject, $message);
        }
    }
    do_action('bp_groups_sent_mention_email', $usernames, $subject, $message, $content, $poster_user_id, $group_id, $activity_id);
}
コード例 #13
0
ファイル: pluggable.php プロジェクト: nxtclass/NXTClass
 /**
  * Notify the blog admin of a new user, normally via email.
  *
  * @since 2.0
  *
  * @param int $user_id User ID
  * @param string $plaintext_pass Optional. The user's plaintext password
  */
 function nxt_new_user_notification($user_id, $plaintext_pass = '')
 {
     $user = new nxt_User($user_id);
     $user_login = stripslashes($user->user_login);
     $user_email = stripslashes($user->user_email);
     // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     // we want to reverse this for the plain text arena of emails.
     $blogname = nxt_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
     $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
     @nxt_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     if (empty($plaintext_pass)) {
         return;
     }
     $message = sprintf(__('Username: %s'), $user_login) . "\r\n";
     $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
     $message .= nxt_login_url() . "\r\n";
     nxt_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
 }
コード例 #14
0
/* 10. Horizontal Rule / Divider - hr - divider
/*-----------------------------------------------------------------------------------*/
/*
Description: Use to separate text.
*/
function woo_shortcode_hr($atts, $content = null)
{
    return '<div class="woo-sc-hr"></div>';
}
add_shortcode('hr', 'woo_shortcode_hr');
function woo_shortcode_divider($atts, $content = null)
{
    return '<div class="woo-sc-divider"></div>';
}
add_shortcode('divider', 'woo_shortcode_divider');
function woo_shortcode_divider_flat($atts, $content = null)
{
    return '<div class="woo-sc-divider flat"></div>';
}
add_shortcode('divider_flat', 'woo_shortcode_divider_flat');
/*-----------------------------------------------------------------------------------*/
/* 11. Quote - quote
/*-----------------------------------------------------------------------------------*/
/*
Optional arguments:
 - style: boxed
 - float: left, right
*/
function woo_shortcode_quote($atts, $content = null)
{
    extract(shortcode_atts(array('style' => '', 'float' => ''), $atts));
    $class = '';
    if ($style) {
        $class .= ' ' . $style;
    }
    if ($float) {
        $class .= ' ' . $float;
    }
    return '<div class="woo-sc-quote' . $class . '"><p>' . woo_remove_nxtautop($content) . '</p></div>';
}
add_shortcode('quote', 'woo_shortcode_quote');
/*-----------------------------------------------------------------------------------*/
/* 12. Icon links - ilink
/*-----------------------------------------------------------------------------------*/
/*
Optional arguments:
 - style: download, note, tick, info, alert
 - url: the url for your link
 - icon: add an url to a custom icon
 - title: optional title attribute
*/
function woo_shortcode_ilink($atts, $content = null)
{
    extract(shortcode_atts(array('style' => 'info', 'url' => '', 'icon' => '', 'title' => ''), $atts));
    $atts = '';
    if ($icon != '') {
        $atts .= ' style="background: url( ' . $icon . ') no-repeat left 40%;"';
    }
    if ($title != '') {
        $atts .= ' title="' . esc_attr($title) . '"';
    }
    return '<span class="woo-sc-ilink"><a class="' . $style . '" href="' . $url . '"' . $atts . '>' . woo_remove_nxtautop($content) . '</a></span>';
}
add_shortcode('ilink', 'woo_shortcode_ilink');
/*-----------------------------------------------------------------------------------*/
/* 13. jQuery Toggle
/*-----------------------------------------------------------------------------------*/
/*
}
Optional arguments:
 - title: The text in the main trigger
 - hide: Hide the toggle box on load
 - display_main_trigger: Display the main trigger on the toggle
*/
function woo_shortcode_toggle($atts, $content = null)
{
    // Instruct the shortcode JavaScript to load.
    if (!defined('WOO_SHORTCODE_JS')) {
        define('WOO_SHORTCODE_JS', 'load');
    }
    $defaults = array('title_open' => __('Hide the Content', 'woothemes'), 'title_closed' => __('Show the Content', 'woothemes'), 'hide' => 'yes', 'display_main_trigger' => 'yes', 'style' => 'default', 'border' => 'yes', 'excerpt_length' => '0', 'include_excerpt_html' => 'no', 'read_more_text' => __('Read More', 'woothemes'), 'read_less_text' => __('Read Less', 'woothemes'));
    extract(shortcode_atts($defaults, $atts));
    $title = '';
    $class = '';
    $class_open = ' toggle-' . sanitize_title($title_open);
    $class_closed = ' toggle-' . sanitize_title($title_closed);
    if ($hide == 'yes') {
        $class .= $class_closed . ' closed';
        $title = $title_closed;
    } else {
        $class .= $class_open . ' open';
        $title = $title_open;
    }
    // End IF Statement
    $main_trigger = '';
    if ($display_main_trigger == 'yes') {
        $main_trigger = '<h4 class="toggle-trigger"><a href="#">' . $title . '</a></h4>' . "\n";
    }
    // End IF Statement
    // Add the alternate style to the CSS class.
    $class .= ' ' . $style;
    // Add the border class, if necessary.
    if ($border == 'yes') {
        $class .= ' border';
    }
    // End IF Statement
    // If the excerpt length is greater than 0, apply the excerpt logic.
    $excerpt_length = intval($excerpt_length);
    if ($excerpt_length > 0) {
        $orig_content = $content;
        if ($include_excerpt_html == 'no') {
            $content = strip_tags($content);
        }
        $excerpt = substr($content, 0, $excerpt_length);
        $more_link = '<a href="#read-more" class="more-link read-more" readless="' . esc_attr($read_less_text) . '">' . $read_more_text . '</a>';
        $content = '<span class="excerpt">' . $excerpt . '</span><!--/.excerpt-->' . "\n" . $more_link . "\n" . '<span class="more-text closed">' . substr($content, $excerpt_length, strlen($content)) . '</span><!--/.more-text-->' . "\n";
    }
    return '<div class="shortcode-toggle' . $class . '">' . $main_trigger . '<div class="toggle-content">' . do_shortcode($content) . '</div><!--/.toggle-content-->' . "\n" . '<input type="hidden" name="title_open" value="' . esc_attr($title_open) . '" /><input type="hidden" name="title_closed" value="' . esc_attr($title_closed) . '" />' . '</div><!--/.shortcode-toggle-->';
}
// End woo_shortcode_toggle()
add_shortcode('toggle', 'woo_shortcode_toggle', 99);
/*-----------------------------------------------------------------------------------*/
/* 14. Facebook Share Button - fbshare
/*-----------------------------------------------------------------------------------*/
/*
Source: http://developers.facebook.com/docs/share
Optional arguments:
 - type: box_count, button_count, button (default), icon_link, or icon
 - float: none, left, right (default: left)
*/
function woo_shortcode_fbshare($atts, $content = null)
{
    extract(shortcode_atts(array('url' => '', 'type' => 'button', 'float' => 'left'), $atts));
    global $post;
    if (isset($url) && $url == '' && isset($post)) {
        $url = get_permalink($post->ID);
    }
    // End IF Statement
    $output = '
<div class="woo-fbshare ' . $float . '">
<a name="fb_share" type="' . $type . '" share_url="' . $url . '">' . woo_remove_nxtautop($content) . '</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
        type="text/javascript">
</script>
</div>
	';
    return $output;
}
add_shortcode('fbshare', 'woo_shortcode_fbshare');
/*-----------------------------------------------------------------------------------*/
/* 15. Advanced Contact Form - contact_form
/*-----------------------------------------------------------------------------------*/
/*
Optional arguments:
 - email: The e-mail address to which the form will send (defaults to woo_contactform_email).
 - subject: The subject of the e-mail (defaults to "Message via the contact form".
 - button_text: Optionally change the text of the "submit" button.
 - Advanced form fields functionality, for creating dynamic form fields:
 --- Text Input: text_fieldname="Text Field Label|Optional Default Text"
 --- Select Box: select_fieldname="Select Box Label|key=value,key=value,key=value"
 --- Textarea Input: textarea_fieldname="Textarea Field Label|Optional Default Text|Optional Number of Rows|Optional Number of Columns"
 --- Checkbox Input: checkbox_fieldname="Checkbox Field Label|Value of the Checkbox|Checked By Default"
 --- Radio Button Input: radio_fieldname="Radio Field Label|key=value,key=value,key=value|Optional Default Value"
*/
function woo_shortcode_contactform($atts, $content = null)
{
    $defaults = array('email' => get_option('woo_contactform_email'), 'subject' => __('Message via the contact form', 'woothemes'), 'button_text' => apply_filters('woo_contact_form_button_text', __('Submit', 'woothemes')));
    extract(shortcode_atts($defaults, $atts));
    // Extract the dynamic fields as well, if they don't have a value in $defaults.
    $html = '';
    $dynamic_atts = array();
    $formatted_dynamic_atts = array();
    $error_messages = array();
    if (is_array($atts)) {
        foreach ($atts as $k => $v) {
            ${$k} = $v;
            $dynamic_atts[$k] = ${$k};
        }
        // End FOREACH Loop
    }
    // End IF Statement
    // Parse dynamic fields.
    if (count($dynamic_atts)) {
        foreach ($dynamic_atts as $k => $v) {
            /* Parse the radio buttons.
				--------------------------------------------------*/
            if (substr($k, 0, 6) == 'radio_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The options.
                if (array_key_exists(1, $params)) {
                    $options_string = $params[1];
                } else {
                    $options_string = '';
                }
                // End IF Statement
                // The default value.
                if (array_key_exists(2, $params)) {
                    $default_value = $params[2];
                } else {
                    $default_value = '';
                }
                // End IF Statement
                // Format the options.
                $options = array();
                if ($options_string) {
                    $options_raw = explode(',', $options_string);
                    if (count($options_raw)) {
                        foreach ($options_raw as $o) {
                            $o = trim($o);
                            $is_formatted = strpos($o, '=');
                            // It's not formatted how we'd like it, so just add the value is both the value and label.
                            if ($is_formatted === false) {
                                $options[$o] = $o;
                                // That's more like it. A separate value and label.
                            } else {
                                $option_data = explode('=', $o);
                                $options[$option_data[0]] = $option_data[1];
                            }
                            // End IF Statement
                        }
                        // End FOREACH Loop
                    }
                    // End IF Statement
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'options' => $options, 'default_value' => $default_value);
            }
            // End IF Statement
            /* Parse the radio buttons.
				--------------------------------------------------*/
            if (substr($k, 0, 6) == 'radio_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The options.
                if (array_key_exists(1, $params)) {
                    $options_string = $params[1];
                } else {
                    $options_string = '';
                }
                // End IF Statement
                // The default value.
                if (array_key_exists(2, $params)) {
                    $default_value = $params[2];
                } else {
                    $default_value = '';
                }
                // End IF Statement
                // Format the options.
                $options = array();
                if ($options_string) {
                    $options_raw = explode(',', $options_string);
                    if (count($options_raw)) {
                        foreach ($options_raw as $o) {
                            $o = trim($o);
                            $is_formatted = strpos($o, '=');
                            // It's not formatted how we'd like it, so just add the value is both the value and label.
                            if ($is_formatted === false) {
                                $options[$o] = $o;
                                // That's more like it. A separate value and label.
                            } else {
                                $option_data = explode('=', $o);
                                $options[$option_data[0]] = $option_data[1];
                            }
                            // End IF Statement
                        }
                        // End FOREACH Loop
                    }
                    // End IF Statement
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'options' => $options, 'default_value' => $default_value);
            }
            // End IF Statement
            /* Parse the checkbox inputs.
				--------------------------------------------------*/
            if (substr($k, 0, 9) == 'checkbox_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The value of the checkbox.
                if (array_key_exists(1, $params)) {
                    $value = $params[1];
                } else {
                    $value = '';
                }
                // End IF Statement
                // Checked by default?
                if (array_key_exists(1, $params)) {
                    $checked = $params[2];
                } else {
                    $checked = '';
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'value' => $value, 'checked' => $checked);
            }
            // End IF Statement
            /* Parse the text inputs.
				--------------------------------------------------*/
            if (substr($k, 0, 5) == 'text_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The default text.
                if (array_key_exists(1, $params)) {
                    $default_text = $params[1];
                } else {
                    $default_text = '';
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'default_text' => $default_text);
            }
            // End IF Statement
            /* Parse the select boxes.
				--------------------------------------------------*/
            if (substr($k, 0, 7) == 'select_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The options.
                if (array_key_exists(1, $params)) {
                    $options_string = $params[1];
                } else {
                    $options_string = '';
                }
                // End IF Statement
                // Format the options.
                $options = array();
                if ($options_string) {
                    $options_raw = explode(',', $options_string);
                    if (count($options_raw)) {
                        foreach ($options_raw as $o) {
                            $o = trim($o);
                            $is_formatted = strpos($o, '=');
                            // It's not formatted how we'd like it, so just add the value is both the value and label.
                            if ($is_formatted === false) {
                                $options[$o] = $o;
                                // That's more like it. A separate value and label.
                            } else {
                                $option_data = explode('=', $o);
                                $options[$option_data[0]] = $option_data[1];
                            }
                            // End IF Statement
                        }
                        // End FOREACH Loop
                    }
                    // End IF Statement
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'options' => $options);
            }
            // End IF Statement
            /* Parse the textarea inputs.
				--------------------------------------------------*/
            if (substr($k, 0, 9) == 'textarea_') {
                // Separate the parameters.
                $params = explode('|', $v);
                // The title.
                if (array_key_exists(0, $params)) {
                    $label = $params[0];
                } else {
                    $label = $k;
                }
                // End IF Statement
                // The default text.
                if (array_key_exists(1, $params)) {
                    $default_text = $params[1];
                } else {
                    $default_text = '';
                }
                // End IF Statement
                // The number of rows.
                if (array_key_exists(2, $params)) {
                    $number_of_rows = $params[2];
                } else {
                    $number_of_rows = 10;
                }
                // End IF Statement
                // The number of columns.
                if (array_key_exists(3, $params)) {
                    $number_of_columns = $params[3];
                } else {
                    $number_of_columns = 10;
                }
                // End IF Statement
                // Remove this field from the array, as we're done with it.
                unset($dynamic_atts[$k]);
                $formatted_dynamic_atts[$k] = array('label' => $label, 'default_text' => $default_text, 'number_of_rows' => $number_of_rows, 'number_of_columns' => $number_of_columns);
            }
            // End IF Statement
        }
        // End FOREACH Loop
    }
    // End IF Statement
    /*--------------------------------------------------
		 * Form Processing.
		 *
		 * Here is where we validate the POST'ed data and
		 * format it for sending in an e-mail.
		 *
		 * We then send the e-mail and notify the user.
		--------------------------------------------------*/
    $emailSent = false;
    if (count($_POST) > 3 && isset($_POST['submitted'])) {
        $fields_to_skip = array('checking', 'submitted', 'sendCopy');
        $default_fields = array('contactName' => '', 'contactEmail' => '', 'contactMessage' => '');
        $error_responses = array('contactName' => __('Please enter your name', 'woothemes'), 'contactEmail' => __('Please enter your email address (and please make sure it\'s valid)', 'woothemes'), 'contactMessage' => __('Please enter your message', 'woothemes'));
        $posted_data = $_POST;
        // Check for errors.
        foreach (array_keys($default_fields) as $d) {
            if (!isset($_POST[$d]) || $_POST[$d] == '' || $d == 'contactEmail' && !is_email($_POST[$d])) {
                $error_messages[$d] = $error_responses[$d];
            }
            // End IF Statement
        }
        // End FOREACH Loop
        // If we have errors, don't do anything. Otherwise, run the processing code.
        if (count($error_messages)) {
        } else {
            // Setup e-mail variables.
            $message_fromname = $default_fields['contactName'];
            $message_fromemail = strtolower($default_fields['contactEmail']);
            $message_subject = $subject;
            $message_body = $default_fields['contactMessage'] . "\n\r\n\r";
            // Filter out skipped fields and assign default fields.
            foreach ($posted_data as $k => $v) {
                if (in_array($k, $fields_to_skip)) {
                    unset($posted_data[$k]);
                }
                // End IF Statement
                if (in_array($k, array_keys($default_fields))) {
                    $default_fields[$k] = $v;
                    unset($posted_data[$k]);
                }
                // End IF Statement
            }
            // End FOREACH Loop
            // Okay, so now we're left with only the dynamic fields. Assign to a fresh variable.
            $dynamic_fields = $posted_data;
            // Format the default fields into the $message_body.
            foreach ($default_fields as $k => $v) {
                if ($v == '') {
                } else {
                    $message_body .= str_replace('contact', '', $k) . ': ' . $v . "\n\r";
                }
                // End IF Statement
            }
            // End FOREACH Loop
            // Format the dynamic fields into the $message_body.
            foreach ($dynamic_fields as $k => $v) {
                if ($v == '') {
                } else {
                    $value = '';
                    if (substr($k, 0, 7) == 'select_' || substr($k, 0, 6) == 'radio_') {
                        $message_body .= $formatted_dynamic_atts[$k]['label'] . ': ' . $formatted_dynamic_atts[$k]['options'][$v] . "\n\r";
                    } else {
                        $message_body .= $formatted_dynamic_atts[$k]['label'] . ': ' . $v . "\n\r";
                    }
                    // End IF Statement
                }
                // End IF Statement
            }
            // End FOREACH Loop
            // Send the e-mail.
            $headers = __('From: ', 'woothemes') . $default_fields['contactName'] . ' <' . $default_fields['contactEmail'] . '>' . "\r\n" . __('Reply-To: ', 'woothemes') . $default_fields['contactEmail'];
            $emailSent = nxt_mail($email, $subject, $message_body, $headers);
            // Send a copy of the e-mail to the sender, if specified.
            if (isset($_POST['sendCopy']) && $_POST['sendCopy'] == 'true') {
コード例 #15
0
ファイル: ms-functions.php プロジェクト: nxtclass/NXTClass
/**
 * Notify a user that her account activation has been successful.
 *
 * Filter 'nxtmu_welcome_user_notification' to disable or bypass.
 *
 * Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to
 * modify the content and subject line of the notification email.
 *
 * @since MU
 *
 * @param int $user_id
 * @param string $password
 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
 * @return bool
 */
function nxtmu_welcome_user_notification($user_id, $password, $meta = '')
{
    global $current_site;
    if (!apply_filters('nxtmu_welcome_user_notification', $user_id, $password, $meta)) {
        return false;
    }
    $welcome_email = get_site_option('welcome_user_email');
    $user = new nxt_User($user_id);
    $welcome_email = apply_filters('update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
    $welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
    $welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
    $welcome_email = str_replace('PASSWORD', $password, $welcome_email);
    $welcome_email = str_replace('LOGINLINK', nxt_login_url(), $welcome_email);
    $admin_email = get_site_option('admin_email');
    if ($admin_email == '') {
        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    }
    $from_name = get_site_option('site_name') == '' ? 'NXTClass' : esc_html(get_site_option('site_name'));
    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    $message = $welcome_email;
    if (empty($current_site->site_name)) {
        $current_site->site_name = 'NXTClass';
    }
    $subject = apply_filters('update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login));
    nxt_mail($user->user_email, $subject, $message, $message_headers);
    return true;
}
コード例 #16
0
            $hasError = true;
        } else {
            $comments = stripslashes(trim($_POST['comments']));
        }
        //If there is no error, send the email
        if (!isset($hasError)) {
            $emailTo = get_option('woo_contactform_email');
            $subject = __('Contact Form Submission from ', 'woothemes') . $name;
            $sendCopy = trim($_POST['sendCopy']);
            $body = __("Name: {$name} \n\nEmail: {$email} \n\nComments: {$comments}", 'woothemes');
            $headers = __('From: ', 'woothemes') . "{$name} <{$email}>" . "\r\n" . __('Reply-To: ', 'woothemes') . $email;
            nxt_mail($emailTo, $subject, $body, $headers);
            if ($sendCopy == true) {
                $subject = __('You emailed ', 'woothemes') . get_bloginfo('title');
                $headers = __('From: ', 'woothemes') . "{$name} <{$emailTo}>";
                nxt_mail($email, $subject, $body, $headers);
            }
            $emailSent = true;
        }
    }
}
?>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery(document).ready(function() {
	jQuery( 'form#contactForm').submit(function() {
		jQuery( 'form#contactForm .error').remove();
		var hasError = false;
		jQuery( '.requiredField').each(function() {
			if(jQuery.trim(jQuery(this).val()) == '') {
				var labelText = jQuery(this).prev( 'label').text();
コード例 #17
0
ファイル: site-new.php プロジェクト: nxtclass/NXTClass
        $user_id = nxtmu_create_user($domain, $password, $email);
        if (false == $user_id) {
            nxt_die(__('There was an error creating the user.'));
        } else {
            nxt_new_user_notification($user_id, $password);
        }
    }
    $nxtdb->hide_errors();
    $id = nxtmu_create_blog($newdomain, $path, $title, $user_id, array('public' => 1), $current_site->id);
    $nxtdb->show_errors();
    if (!is_nxt_error($id)) {
        if (!is_super_admin($user_id) && !get_user_option('primary_blog', $user_id)) {
            update_user_option($user_id, 'primary_blog', $id, true);
        }
        $content_mail = sprintf(__("New site created by %1s\n\nAddress: %2s\nName: %3s"), $current_user->user_login, get_site_url($id), stripslashes($title));
        nxt_mail(get_site_option('admin_email'), sprintf(__('[%s] New Site Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option('admin_email') . '>');
        nxtmu_welcome_notification($id, $user_id, $password, $title, array('public' => 1));
        nxt_redirect(add_query_arg(array('update' => 'added', 'id' => $id), 'site-new.php'));
        exit;
    } else {
        nxt_die($id->get_error_message());
    }
}
if (isset($_GET['update'])) {
    $messages = array();
    if ('added' == $_GET['update']) {
        $messages[] = sprintf(__('Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>'), esc_url(get_admin_url(absint($_GET['id']))), network_admin_url('site-info.php?id=' . absint($_GET['id'])));
    }
}
$title = __('Add New Site');
$parent_file = 'sites.php';
コード例 #18
0
function bp_core_signup_send_validation_email($user_id, $user_email, $key)
{
    $activate_url = bp_get_activation_page() . "?key={$key}";
    $activate_url = esc_url($activate_url);
    $from_name = '' == get_option('blogname') ? __('BuddyPress', 'buddypress') : esc_html(get_option('blogname'));
    $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress'), $activate_url);
    $subject = '[' . $from_name . '] ' . __('Activate Your Account', 'buddypress');
    // Send the message
    $to = apply_filters('bp_core_signup_send_validation_email_to', $user_email, $user_id);
    $subject = apply_filters('bp_core_signup_send_validation_email_subject', $subject, $user_id);
    $message = apply_filters('bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url);
    nxt_mail($to, $subject, $message);
    do_action('bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key);
}
コード例 #19
0
/**
 * Sends an email notification and a BP notification when someone mentions you in an update
 *
 * @since 1.2.0
 *
 * @param int $comment_id The comment id
 * @param int $commenter_id The unique user_id of the user who posted the comment
 * @param array $params {@link bp_activity_new_comment()}
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_get_user_meta()
 * @uses bp_core_get_user_displayname()
 * @uses bp_activity_get_permalink()
 * @uses bp_core_get_user_domain()
 * @uses bp_get_settings_slug()
 * @uses bp_activity_filter_kses()
 * @uses bp_core_get_core_userdata()
 * @uses nxt_specialchars_decode()
 * @uses get_blog_option()
 * @uses bp_get_root_blog_id()
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook
 * @uses nxt_mail()
 * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook
 * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook
 * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook
 */
function bp_activity_new_comment_notification($comment_id, $commenter_id, $params)
{
    global $bp;
    extract($params);
    $original_activity = new BP_Activity_Activity($activity_id);
    if ($original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta($original_activity->user_id, 'notification_activity_new_reply', true)) {
        $poster_name = bp_core_get_user_displayname($commenter_id);
        $thread_link = bp_activity_get_permalink($activity_id);
        $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
        $settings_link = bp_core_get_user_domain($original_activity->user_id) . $settings_slug . '/notifications/';
        $poster_name = stripslashes($poster_name);
        $content = bp_activity_filter_kses(stripslashes($content));
        // Set up and send the message
        $ud = bp_core_get_core_userdata($original_activity->user_id);
        $to = $ud->user_email;
        $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
        $subject = '[' . $sitename . '] ' . sprintf(__('%s replied to one of your updates', 'buddypress'), $poster_name);
        $message = sprintf(__('%1$s replied to one of your updates:

"%2$s"

To view your original update and all comments, log in and visit: %3$s

---------------------
', 'buddypress'), $poster_name, $content, $thread_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('bp_activity_new_comment_notification_to', $to);
        $subject = apply_filters('bp_activity_new_comment_notification_subject', $subject, $poster_name);
        $message = apply_filters('bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link);
        nxt_mail($to, $subject, $message);
        do_action('bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params);
    }
    /***
     * If this is a reply to another comment, send an email notification to the
     * author of the immediate parent comment.
     */
    if ($activity_id == $parent_id) {
        return false;
    }
    $parent_comment = new BP_Activity_Activity($parent_id);
    if ($parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta($parent_comment->user_id, 'notification_activity_new_reply', true)) {
        $poster_name = bp_core_get_user_displayname($commenter_id);
        $thread_link = bp_activity_get_permalink($activity_id);
        $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
        $settings_link = bp_core_get_user_domain($parent_comment->user_id) . $settings_slug . '/notifications/';
        // Set up and send the message
        $ud = bp_core_get_core_userdata($parent_comment->user_id);
        $to = $ud->user_email;
        $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
        $subject = '[' . $sitename . '] ' . sprintf(__('%s replied to one of your comments', 'buddypress'), $poster_name);
        $poster_name = stripslashes($poster_name);
        $content = bp_activity_filter_kses(stripslashes($content));
        $message = sprintf(__('%1$s replied to one of your comments:

"%2$s"

To view the original activity, your comment and all replies, log in and visit: %3$s

---------------------
', 'buddypress'), $poster_name, $content, $thread_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('bp_activity_new_comment_notification_comment_author_to', $to);
        $subject = apply_filters('bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name);
        $message = apply_filters('bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link);
        nxt_mail($to, $subject, $message);
        do_action('bp_activity_sent_reply_to_reply_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params);
    }
}
コード例 #20
0
/**
 * Create the Achievements admin page.
 *
 * @global object $bp BuddyPress global settings
 * @global int $screen_layout_columns Number of columns shown on this admin page
 * @see dpa_admin_screen_layout_columns()
 * @since 2.0
 */
function dpa_admin_screen()
{
    global $bp, $screen_layout_columns;
    if (!($settings = get_blog_option(BP_ROOT_BLOG, 'achievements'))) {
        update_blog_option(BP_ROOT_BLOG, 'achievements', array());
    }
    $is_support_tab = false;
    if (!empty($_GET['tab']) && DPA_SLUG_ADMIN_SUPPORT == stripslashes($_GET['tab'])) {
        $is_support_tab = true;
    }
    // Email contact form
    if (!empty($_POST['contact_body']) && !empty($_POST['contact_type']) && !empty($_POST['contact_email'])) {
        $body = force_balance_tags(nxt_filter_kses(stripslashes($_POST['contact_body'])));
        $type = force_balance_tags(nxt_filter_kses(stripslashes($_POST['contact_type'])));
        $email = sanitize_email(force_balance_tags(nxt_filter_kses(stripslashes($_POST['contact_email']))));
        if ($body && $type && $email && is_email($email)) {
            $email_sent = nxt_mail(array('*****@*****.**', $email), "Achievements support request: " . $type, $body);
        }
    }
    ?>
	<div id="bp-admin">
		<div id="dpa-admin-metaboxes-general" class="wrap">

			<div id="bp-admin-header">
				<h3><?php 
    _e('BuddyPress', 'dpa');
    ?>
</h3>
				<h4><?php 
    _e('Achievements', 'dpa');
    ?>
</h4>
			</div>

			<div id="bp-admin-nav">
				<ol>
					<li <?php 
    if (!$is_support_tab) {
        echo 'class="current"';
    }
    ?>
><a href="<?php 
    echo site_url('nxt-admin/admin.php?page=' . $bp->achievements->id, 'admin');
    ?>
"><?php 
    _e('Configure', 'dpa');
    ?>
</a></li>
					<li <?php 
    if ($is_support_tab) {
        echo 'class="current"';
    }
    ?>
><a href="<?php 
    echo site_url('nxt-admin/admin.php?page=' . $bp->achievements->id . '&amp;tab=' . DPA_SLUG_ADMIN_SUPPORT, 'admin');
    ?>
"><?php 
    _e('Support', 'dpa');
    ?>
</a></li>
				</ol>
			</div>

			<?php 
    if (!empty($_GET['updated'])) {
        ?>
				<div id="message" class="updated">
					<p><?php 
        _e('Your Achievements settings have been saved.', 'dpa');
        ?>
</p>
				</div>
			<?php 
    }
    ?>

			<?php 
    if (isset($email_sent)) {
        ?>
				<div id="message" class="updated">
					<p><?php 
        _e("Thanks, we've recieved your message and have emailed you a copy for your records. We'll be in touch soon!", 'dpa');
        ?>
</p>
				</div>
			<?php 
    }
    ?>

			<div class="dpa-spacer">
				<?php 
    if (!$is_support_tab) {
        ?>
					<p><?php 
        _e("Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points. For information, support, premium enhancements and developer documentation, visit <a href='http://achievementsapp.nxtclass.com/'>our website</a>.", 'dpa');
        ?>
</p>
					<p><?php 
        printf(__("To create and manage Achievements, visit the <a href='%s'>Achievements Directory</a>.", 'dpa'), dpa_get_achievements_permalink());
        ?>
</p>
				<?php 
    } else {
        ?>
					<p><?php 
        printf(__("Have you found a bug or do you have a great idea for the next release? Please make a report on <a href='%s'>BuddyPress.org</a>, or use the form below to get in contact. We're listening.", 'dpa'), 'http://buddypress.org/community/groups/achievements/forum/');
        ?>
</p>
				<?php 
    }
    ?>
			</div>

			<?php 
    if (!$is_support_tab) {
        ?>
				<form method="post" action="options.php" id="achievements">
				<?php 
        nxt_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
				<?php 
        nxt_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        ?>
				<?php 
        settings_fields('dpa-settings-group');
        ?>
			<?php 
    }
    ?>

				<div id="poststuff" class="metabox-holder<?php 
    echo 2 == $screen_layout_columns ? ' has-right-sidebar' : '';
    ?>
">
					<div id="side-info-column" class="inner-sidebar">
						<?php 
    if ($is_support_tab) {
        do_meta_boxes('buddypress_page_achievements-support', 'side', $settings);
    } else {
        do_meta_boxes('buddypress_page_achievements', 'side', $settings);
    }
    ?>
					</div>
					<div id="post-body" class="has-sidebar">
						<div id="post-body-content" class="has-sidebar-content">
							<?php 
    if ($is_support_tab) {
        do_meta_boxes('buddypress_page_achievements-support', 'normal', $settings);
    } else {
        do_meta_boxes('buddypress_page_achievements', 'normal', $settings);
    }
    ?>
						</div>

						<?php 
    if (!$is_support_tab) {
        ?>
							<p><input type="submit" class="button-primary" value="<?php 
        _e('Save Settings', 'dpa');
        ?>
" /></p>
						<?php 
    }
    ?>
					</div>
				</div>

			<?php 
    if (!$is_support_tab) {
        ?>
			</form>
			<?php 
    }
    ?>

		</div><!-- #dpa-admin-metaboxes-general -->
	</div><!-- #bp-admin -->
<?php 
}
コード例 #21
0
 /**
  * Send support request action
  *
  * @return void
  */
 function action_support_request()
 {
     require_once W3TC_LIB_W3_DIR . '/Request.php';
     $request_type = W3_Request::get_string('request_type');
     $payment = W3_Request::get_boolean('payment');
     $request_id = W3_Request::get_string('request_id');
     $url = W3_Request::get_string('url');
     $name = W3_Request::get_string('name');
     $email = W3_Request::get_string('email');
     $twitter = W3_Request::get_string('twitter');
     $phone = W3_Request::get_string('phone');
     $subject = W3_Request::get_string('subject');
     $description = W3_Request::get_string('description');
     $templates = W3_Request::get_array('templates');
     $forum_url = W3_Request::get_string('forum_url');
     $nxt_login = W3_Request::get_string('nxt_login');
     $nxt_password = W3_Request::get_string('nxt_password');
     $ftp_host = W3_Request::get_string('ftp_host');
     $ftp_login = W3_Request::get_string('ftp_login');
     $ftp_password = W3_Request::get_string('ftp_password');
     $params = array('request_type' => $request_type, 'payment' => $payment, 'url' => $url, 'name' => $name, 'email' => $email, 'twitter' => $twitter, 'phone' => $phone, 'subject' => $subject, 'description' => $description, 'forum_url' => $forum_url, 'nxt_login' => $nxt_login, 'nxt_password' => $nxt_password, 'ftp_host' => $ftp_host, 'ftp_login' => $ftp_login, 'ftp_password' => $ftp_password);
     foreach ($templates as $template_index => $template) {
         $template_key = sprintf('templates[%d]', $template_index);
         $params[$template_key] = $template;
     }
     if (!isset($this->_request_types[$request_type])) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_type')));
     }
     $required = array('bug_report' => 'url,name,email,subject,description', 'new_feature' => 'url,name,email,subject,description', 'email_support' => 'url,name,email,subject,description', 'phone_support' => 'url,name,email,subject,description,phone', 'plugin_config' => 'url,name,email,subject,description,nxt_login,nxt_password', 'theme_config' => 'url,name,email,subject,description,nxt_login,nxt_password,ftp_host,ftp_login,ftp_password', 'linux_config' => 'url,name,email,subject,description,nxt_login,nxt_password,ftp_host,ftp_login,ftp_password');
     if (strstr($required[$request_type], 'url') !== false && $url == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_url')));
     }
     if (strstr($required[$request_type], 'name') !== false && $name == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_name')));
     }
     if (strstr($required[$request_type], 'email') !== false && !preg_match('~^[a-z0-9_\\-\\.]+@[a-z0-9-\\.]+\\.[a-z]{2,5}$~', $email)) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_email')));
     }
     if (strstr($required[$request_type], 'phone') !== false && !preg_match('~^[0-9\\-\\.\\ \\(\\)\\+]+$~', $phone)) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_phone')));
     }
     if (strstr($required[$request_type], 'subject') !== false && $subject == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_subject')));
     }
     if (strstr($required[$request_type], 'description') !== false && $description == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_description')));
     }
     if (strstr($required[$request_type], 'nxt_login') !== false && $nxt_login == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_nxt_login')));
     }
     if (strstr($required[$request_type], 'nxt_password') !== false && $nxt_password == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_nxt_password')));
     }
     if (strstr($required[$request_type], 'ftp_host') !== false && $ftp_host == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_host')));
     }
     if (strstr($required[$request_type], 'ftp_login') !== false && $ftp_login == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_login')));
     }
     if (strstr($required[$request_type], 'ftp_password') !== false && $ftp_password == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_password')));
     }
     /**
      * Add attachments
      */
     $attachments = array();
     $attach_files = array(w3_get_nxt_config_path(), W3TC_CONFIG_PATH, W3TC_CONFIG_PREVIEW_PATH, W3TC_CONFIG_MASTER_PATH, W3TC_MINIFY_LOG_FILE, w3_get_pgcache_rules_core_path(), w3_get_pgcache_rules_cache_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404nxt_path(), w3_get_minify_rules_core_path(), w3_get_minify_rules_cache_path());
     foreach ($attach_files as $attach_file) {
         if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) {
             $attachments[] = $attach_file;
         }
     }
     /**
      * Attach server info
      */
     $server_info = print_r($this->get_server_info(), true);
     $server_info = str_replace("\n", "\r\n", $server_info);
     $server_info_path = W3TC_TMP_DIR . '/server_info.txt';
     if (@file_put_contents($server_info_path, $server_info)) {
         $attachments[] = $server_info_path;
     }
     /**
      * Attach phpinfo
      */
     ob_start();
     phpinfo();
     $php_info = ob_get_contents();
     ob_end_clean();
     $php_info_path = W3TC_TMP_DIR . '/php_info.html';
     if (@file_put_contents($php_info_path, $php_info)) {
         $attachments[] = $php_info_path;
     }
     /**
      * Attach self-test
      */
     ob_start();
     $this->action_self_test();
     $self_test = ob_get_contents();
     ob_end_clean();
     $self_test_path = W3TC_TMP_DIR . '/self_test.html';
     if (@file_put_contents($self_test_path, $self_test)) {
         $attachments[] = $self_test_path;
     }
     /**
      * Attach templates
      */
     foreach ($templates as $template) {
         if (!empty($template)) {
             $attachments[] = $template;
         }
     }
     /**
      * Attach other files
      */
     if (!empty($_FILES['files'])) {
         $files = (array) $_FILES['files'];
         for ($i = 0, $l = count($files); $i < $l; $i++) {
             if (isset($files['tmp_name'][$i]) && isset($files['name'][$i]) && isset($files['error'][$i]) && $files['error'][$i] == UPLOAD_ERR_OK) {
                 $path = W3TC_TMP_DIR . '/' . $files['name'][$i];
                 if (@move_uploaded_file($files['tmp_name'][$i], $path)) {
                     $attachments[] = $path;
                 }
             }
         }
     }
     $data = array();
     if (!empty($nxt_login) && !empty($nxt_password)) {
         $data['nxt Admin login'] = $nxt_login;
         $data['nxt Admin password'] = $nxt_password;
     }
     if (!empty($ftp_host) && !empty($ftp_login) && !empty($ftp_password)) {
         $data['SSH / FTP host'] = $ftp_host;
         $data['SSH / FTP login'] = $ftp_login;
         $data['SSH / FTP password'] = $ftp_password;
     }
     /**
      * Store request data for future access
      */
     if (count($data)) {
         $hash = md5(microtime());
         $request_data = get_option('w3tc_request_data', array());
         $request_data[$hash] = $data;
         update_option('w3tc_request_data', $request_data);
         $request_data_url = sprintf('%s/w3tc_request_data/%s', w3_get_home_url(), $hash);
     } else {
         $request_data_url = null;
     }
     /**
      * Get body contents
      */
     ob_start();
     include W3TC_INC_DIR . '/email/support_request.php';
     $body = ob_get_contents();
     ob_end_clean();
     /**
      * Send email
      */
     $subject = sprintf('[W3TC %s] #%s: %s', $this->_request_types[$request_type], $request_id, $subject);
     $headers = array(sprintf('From: "%s" <%s>', addslashes($name), $email), sprintf('Reply-To: "%s" <%s>', addslashes($name), $email), 'Content-Type: text/html; charset=UTF-8');
     $this->_phpmailer_sender = $email;
     add_action('phpmailer_init', array(&$this, 'phpmailer_init'));
     @set_time_limit($this->_config->get_integer('timelimit.email_send'));
     $result = @nxt_mail(W3TC_EMAIL, $subject, $body, implode("\n", $headers), $attachments);
     /**
      * Remove temporary files
      */
     foreach ($attachments as $attachment) {
         if (strstr($attachment, W3TC_TMP_DIR) !== false) {
             @unlink($attachment);
         }
     }
     if ($result) {
         $this->redirect(array('tab' => 'general', 'w3tc_note' => 'support_request'));
     } else {
         $this->redirect(array_merge($params, array('request_type' => $request_type, 'w3tc_error' => 'support_request')));
     }
 }
コード例 #22
0
    }
}
if (!isset($_SESSION['et_first_digit'])) {
    $_SESSION['et_first_digit'] = $et_first_digit = rand(1, 15);
} else {
    $et_first_digit = $_SESSION['et_first_digit'];
}
if (!isset($_SESSION['et_second_digit'])) {
    $_SESSION['et_second_digit'] = $et_second_digit = rand(1, 15);
} else {
    $et_second_digit = $_SESSION['et_second_digit'];
}
if (!$et_contact_error) {
    $et_email_to = isset($et_ptemplate_settings['et_email_to']) && !empty($et_ptemplate_settings['et_email_to']) ? $et_ptemplate_settings['et_email_to'] : get_site_option('admin_email');
    $et_site_name = is_multisite() ? $current_site->site_name : get_bloginfo('name');
    nxt_mail($et_email_to, sprintf('[%s] ' . esc_html($_POST['et_contact_subject']), $et_site_name), esc_html($_POST['et_contact_message']), 'From: "' . esc_html($_POST['et_contact_name']) . '" <' . esc_html($_POST['et_contact_email']) . '>');
    $et_error_message = '<p>' . esc_html__('Thanks for contacting us', 'Modest') . '</p>';
}
?>

<?php 
get_header();
?>
	
	<?php 
get_template_part('includes/top_info');
?>
	
	<div id="left-area">
	<?php 
if (have_posts()) {