<?php

/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license GNU Affero General Public License
 * @link https://blueimp.net/ajax/
 */
// Show all errors:
error_reporting(E_ALL);
// Path to the chat directory:
define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/');
// Include custom libraries and initialization code:
require AJAX_CHAT_PATH . 'lib/custom.php';
// Include Class libraries:
require AJAX_CHAT_PATH . 'lib/classes.php';
$ajaxChat = new CustomAJAXChatShoutBox();
// Parse and return the shoutbox template content:
echo $ajaxChat->getShoutBoxContent();
Exemple #2
0
function getShoutBoxContent()
{
    global $bp, $current_user, $user_ID;
    // URL to the chat directory:
    if (!defined('AJAX_CHAT_URL')) {
        define('AJAX_CHAT_URL', get_bloginfo('wpurl') . '/wp-content/plugins/buddypress-ajax-chat/bp-chat/chat/');
    }
    // Path to the chat directory:
    if (!defined('AJAX_CHAT_PATH')) {
        define('AJAX_CHAT_PATH', realpath(dirname(__FILE__) . '/buddypress-ajax-chat/bp-chat/chat') . '/');
    }
    // Validate the path to the chat:
    if (@is_file(AJAX_CHAT_PATH . 'lib/classes.php')) {
        // Include custom libraries and initialization code:
        require AJAX_CHAT_PATH . 'lib/custom.php';
        // Include Class libraries:
        require_once AJAX_CHAT_PATH . 'lib/classes.php';
        // Initialize the shoutbox:
        $ajaxChat = new CustomAJAXChatShoutBox();
        // Parse and return the shoutbox template content:
        return $ajaxChat->getShoutBoxContent();
    }
    return null;
}
function getShoutBoxContent()
{
    // URL to the chat directory:
    if (!defined('AJAX_CHAT_URL')) {
        define('AJAX_CHAT_URL', './chat/');
    }
    // Path to the chat directory:
    if (!defined('AJAX_CHAT_PATH')) {
        define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/chat') . '/');
    }
    // Validate the path to the chat:
    if (@is_file(AJAX_CHAT_PATH . 'lib/classes.php')) {
        // Include Class libraries:
        require_once AJAX_CHAT_PATH . 'lib/classes.php';
        // Initialize the shoutbox:
        $ajaxChat = new CustomAJAXChatShoutBox();
        // Parse and return the shoutbox template content:
        return $ajaxChat->getShoutBoxContent();
    }
    return null;
}
function ajaxchat_getShoutBoxContent()
{
    global $scripturl, $modSettings;
    // Get the URL to the chat directory:
    if (!defined('AJAX_CHAT_URL')) {
        define('AJAX_CHAT_URL', str_replace("index.php", "chat/", $scripturl));
    }
    // Get the real path to the chat directory:
    if (!defined('AJAX_CHAT_PATH')) {
        define('AJAX_CHAT_PATH', dirname(dirname(__FILE__)) . '/chat/');
    }
    // Validate the path to the chat:
    if (@is_file(AJAX_CHAT_PATH . 'lib/classes.php')) {
        // Include Class libraries:
        require_once AJAX_CHAT_PATH . 'lib/classes.php';
        // Initialize the shoutbox:
        $ajaxChat = new CustomAJAXChatShoutBox();
        // Parse and return the shoutbox template content:
        return $ajaxChat->getShoutBoxContent(false);
    }
    return null;
}