Plugin Directory

Changeset 2123207


Ignore:
Timestamp:
07/15/2019 12:43:55 PM (6 years ago)
Author:
lucastidio
Message:

add support for affiliate program

Location:
tidio-live-chat/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tidio-live-chat/trunk/readme.txt

    r2123166 r2123207  
    1171171. Live Chat - instantly reply to people who visit your website
    1181182. Intuitive Chat Panel - manage and monitor all conversations and visitors in one place
    119 3. Automations - set up automated messages triggered by predefined actions
     1193. Chatbots - set up automated messages triggered by predefined actions
    1201204. Dedicated app for mobile and desktop devices (iOS, Android, Chrome, Windows, OS X)
    121121
    122122== Changelog ==
     123
     124= 3.5.0 =
     125* Change domain to tidio.com in URL
     126* Change path in login URL
     127* Added ability to integrate with Tidio affiliate program
    123128
    124129= 3.4.0 =
  • tidio-live-chat/trunk/tidio-elements.php

    r2069325 r2123207  
    33/**
    44 * Plugin Name: Tidio Chat
    5  * Plugin URI: http://www.tidio.com
    6  * Description: Tidio Live Chat - Integrate live chat with your page in just a few seconds - just click, install and use!
    7  * Version: 3.4.0
     5 * Plugin URI: http://www.tidiochat.com
     6 * Description: Tidio Live Chat - Live chat for your website. No logging in, no signing up - integrates with your website in less than 20 seconds.
     7 * Version: 3.5.0
    88 * Author: Tidio Ltd.
    9  * Author URI: http://www.tidio.com
     9 * Author URI: http://www.tidiochat.com
    1010 * License: GPL2
    1111 */
    12 define('TIDIOCHAT_VERSION', '3.4.0');
     12define('TIDIOCHAT_VERSION', '3.5.0');
     13define('AFFILIATE_CONFIG_FILE_PATH', get_template_directory().'/tidio_affiliate_ref_id.txt');
    1314
    1415class TidioLiveChat
     
    136137    {
    137138
    138         if (function_exists('curl_version')) { // load trought curl
     139        if (function_exists('curl_version')) { // load through curl
    139140            $ch = curl_init();
    140141
     
    147148
    148149            return $data;
    149         } else { // load trought file get contents
     150        } else { // load through file get contents
    150151            return file_get_contents($url);
    151152        }
    152153    }
    153154
     155    public static function readRefIDFromFile() {
     156        try {
     157            $loadedRefIdFromFile = @file_get_contents(AFFILIATE_CONFIG_FILE_PATH);
     158            return trim($loadedRefIdFromFile);
     159        } catch (Exception $e){}
     160        return null;
     161    }
     162
    154163    public static function getAccessUrl()
    155164    {
    156         return TidioLiveChat::API_URL . '/access/external/create?url=' . urlencode(site_url()) . '&platform=wordpress&email=' . urlencode(get_option('admin_email')) . '&_ip=' . $_SERVER['REMOTE_ADDR'];
     165        $parameters = array(
     166            'url' => site_url(),
     167            'platform' => 'wordpress',
     168            'email' => get_option('admin_email'),
     169            '_ip' => $_SERVER['REMOTE_ADDR'],
     170        );
     171        $refIdFromFile = TidioLiveChat::readRefIDFromFile();
     172        if (isset($refIdFromFile)) {
     173            $parameters['ref_id'] = $refIdFromFile;
     174        }
     175        $accessUrlParameters = http_build_query($parameters);
     176        return TidioLiveChat::API_URL . '/access/external/create?'.$accessUrlParameters;
    157177    }
    158178
    159179    public static function getRedirectUrl($privateKey)
    160180    {
    161         return TidioLiveChat::CHAT_URL . '/access?' . http_build_query(
     181        return TidioLiveChat::CHAT_URL . '/panel/external-access?' . http_build_query(
    162182                array(
    163183                    'privateKey' => $privateKey,
Note: See TracChangeset for help on using the changeset viewer.