Exemple #1
0
            $wiki_notification_content[$key] = str_replace("\\'", "'", $wiki_notification_content[$key]);
        }
        global $blog_id;
        $query = "SELECT * FROM " . $this->db_prefix . "wiki_subscriptions WHERE blog_id = {$blog_id} AND wiki_id = {$post->ID}";
        $subscription_emails = $wpdb->get_results($query, ARRAY_A);
        if (count($subscription_emails) > 0) {
            foreach ($subscription_emails as $subscription_email) {
                $loop_notification_content = $wiki_notification_content['user'];
                $loop_notification_content = $wiki_notification_content['user'];
                if ($subscription_email['user_id'] > 0) {
                    if ($subscription_email['user_id'] == $post->post_author) {
                        $loop_notification_content = $wiki_notification_content['author'];
                    }
                    $user = get_userdata($subscription_email['user_id']);
                    $subscription_to = $user->user_email;
                } else {
                    $subscription_to = $subscription_email['email'];
                }
                $loop_notification_content = str_replace("CANCEL_URL", $cancel_url . $subscription_email['ID'], $loop_notification_content);
                $subject_content = $blog_name . ': ' . __('Wiki Page Changes', 'wiki');
                $from_email = $admin_email;
                $message_headers = "MIME-Version: 1.0\n" . "From: " . $blog_name . " <{$from_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
                wp_mail($subscription_to, $subject_content, $loop_notification_content, $message_headers);
            }
        }
    }
}
$wiki = Wiki::get_instance();
if (file_exists($wiki->plugin_dir . 'premium/wiki-premium.php')) {
    require_once $wiki->plugin_dir . 'premium/wiki-premium.php';
}