public function initialize()
 {
     if (qa_opt('hw_enable_iflychat')) {
         //enable iflychat
         //moved to 'before_render_page' hook
         global $iflychat_userinfo;
         global $hw_iflychat;
         //iflychat instance
         if (!empty($iflychat_userinfo)) {
             $userdedetail = $iflychat_userinfo->getUserDetails();
             $iflychat_settings = new iFlyChatSettings();
             $hw_iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $userdedetail);
             $this->ifly_html_code = $hw_iflychat->getHtmlCode();
         }
     }
 }
Example #2
0
<?php

/**
 * Include iFlyChat PHP SDK files
 * Ensure that path to iFlyChat PHP SDK files are correct
 *
**/
require_once dirname(__FILE__) . '/iflychatsettings.php';
require_once dirname(__FILE__) . '/iflychatuserdetails.php';
require_once dirname(__FILE__) . '/iflychat.php';
/**
 * Use iFlyChat class to render browser based mobile chat application
 *
**/
global $iflychat_userinfo;
$iflychat_settings = new iFlyChatSettings();
$iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
$ifly_render_mobile_app = $iflychat->renderChatMobile();
/**
 * Print iFlyChat user chat code
 *
**/
header('Content-type: text/html');
print $ifly_render_mobile_app;
<?php

require_once dirname(__FILE__) . '/iflychatsettings.php';
require_once dirname(__FILE__) . '/iflychat.php';
require_once dirname(__FILE__) . '/iflychatuserdetails.php';
/*
 * Initialise iFlyChatSettings and iFlyChatUserDetails
 * $iflychat_settings = $iFlyChatSettings_obj->iflychat_settings;	
 * $iflychat_userinfo = $iFlyChatUserDetails_obj->getUserDetails();
 * $obj = new iFlyChat($iflychat_settings, $iflychat_userinfo)
 */
$iflychat_settings = new iFlyChatSettings();
$iflychat_userinfo = new iFlyChatUserDetails();
$iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
//, $iflychat_userinfo->getUserDetails());
//  get_currentuserinfo();
$iflychat->changeGuestName();
Example #4
0
 * Include iFlyChat PHP SDK files
 * Ensure that path to iFlyChat PHP SDK files are correct
 *
**/
require_once './iflychatsettings.php';
require_once './iflychatuserdetails.php';
require_once './iflychat.php';
/**
 *
 * Use iFlyChat class get_html_code() function to render chat HTML code.
 * This code should be printed on all pages where you want chat to be present.
 *
**/
global $iflychat_userinfo;
$iflychat_settings = new iFlyChatSettings();
$iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
$ifly_html_code = $iflychat->getHtmlCode();
?>
<html>
<head>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<h1>How to include iFlyChat code in a sample PHP page?</h1>
<!-- iFlyChat code begins -->
<?php 
print $ifly_html_code;
?>
<!-- iFlyChat code ends -->
<br>
Example #5
0
**/
// $user_details = array(
//   'name' => 'admin',
//   'id' => '1',
//   'is_admin' => TRUE,
//   'avatar_url' => '/path/to/my_picture.jpg',
//   'upl' => 'link_to_profile_of_current_user.php',
//   'room_roles' => array(),
//   'user_groups' => array(),
// );
/**
 *
 * Pass empty array if the user is not logged-in/unregistered/guest (anonymous user)
 *
 *
**/
//$user_details = array();
/**
 * Use iFlyChat class to render user chat code
 *
**/
global $iflychat_userinfo;
$iflychat_settings = new iFlyChatSettings();
$iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
$ifly_render_chat_code = $iflychat->renderChatAjax();
/**
 * Print iFlyChat user chat code
 *
**/
header('Content-type: application/json');
print $ifly_render_chat_code;
<?php

/**
 * Include iFlyChat PHP SDK files
 * Ensure that path to iFlyChat PHP SDK files are correct
 *
**/
require_once dirname(__FILE__) . '/iflychatsettings.php';
require_once dirname(__FILE__) . '/iflychat.php';
require_once dirname(__FILE__) . '/iflychatuserdetails.php';
/**
 *
 * Save iFlyChat settings. Call this function every time setting is updated.
 *
**/
global $iflychat_userinfo;
$iflychat_settings = new iFlyChatSettings();
$iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
$result = $iflychat->updateSettings();
if ($result->code == 200) {
    echo "iFlyChat settings have been successfully updated.";
} else {
    echo "Error occurred while updating iFlyChat settings. Try again.</br>";
    echo "Response Code: {$result->code}. Error : {$result->error}</br>";
    echo "Please contact iFlyChat team at iflychat.com.";
}
//print_r($result->code);