Plugin Directory

Changeset 1877831


Ignore:
Timestamp:
05/19/2018 10:20:16 PM (8 years ago)
Author:
paulq
Message:

2.1.1 version release

Location:
chatwee/trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • chatwee/trunk/chatwee-admin.php

    r1808954 r1877831  
    3131        $chatwee_settings = get_option("chatwee_settings");
    3232
    33         $chatwee_settings["chatwee_version"] = $_POST["chatwee_version"];
    3433        $chatwee_settings["chatwee_script"] = $_POST["chatwee_script"];
    3534        $chatwee_settings["disable_offline_users"] = isSet($_POST["disable_offline_users"]) ? true : false;
     
    5251        $chatwee_settings = get_option("chatwee_settings");
    5352        $keys = array(
    54                         "chatwee_version",
    5553                        "chatwee_script",
    5654                        "disable_offline_users",
     
    131129                            <form method="post">
    132130                                <table class="form-table chatwee-options-table">
    133                                     <tr>
    134                                         <th>
    135                                             <label for="chatwee_version">Chatwee version</label>
    136                                         </th>
    137                                         <td>
    138                                             <select id="chatwee_version" name="chatwee_version">
    139                                                 <option value="v1" <?php if ($chatwee_settings["chatwee_version"] === "v1") echo "selected"; ?>>Chatwee 1.0</option>
    140                                                 <option value="v2" <?php if ($chatwee_settings["chatwee_version"] === "v2") echo "selected"; ?>>Chatwee 2.0</option>
    141                                             </select>
    142                                         </td>
    143                                     </tr>
    144131                                    <tr>
    145132                                        <th>
  • chatwee/trunk/chatwee.php

    r1796149 r1877831  
    55    Plugin URI: https://chatwee.com/
    66    Description: WordPress Chat by Chatwee is fully customizable social chat & comment platform for websites and blogs. With Chatwee you can engage your online community and provide real-time communication.
    7     Version: 2.0.5
     7    Version: 2.1.1
    88    Author: Chatwee Ltd
    99    Author URI: https://chatwee.com/
     
    1818    require_once(dirname( __FILE__ ) . "/chatwee-admin.php");
    1919
    20     require_once(dirname( __FILE__ ) . "/lib/ChatweeV1_SDK/Chatwee.php");
    21 
    2220    require_once(dirname( __FILE__ ) . "/lib/ChatweeV2_SDK/Chatwee.php");
    2321
     
    2725    function get_default_chatwee_settings() {
    2826        return Array(
    29             "chatwee_version" => "v2",
    3027            "chatwee_script" => "",
    3128            "disable_offline_users" => false,
     
    120117    }
    121118
    122     function initialize_v1() {
    123         $chatwee_settings = get_option("chatwee_settings");
    124 
    125         ChatweeV1_Configuration::setChatId($chatwee_settings["chat_id"]);
    126         ChatweeV1_Configuration::setClientKey($chatwee_settings["client_key"]);
    127 
    128         if($chatwee_settings["disable_offline_users"] === true && $chatwee_settings["enable_sso"] === true && is_user_logged_in() === false && ChatweeV1_User::isLogged() === true) {
    129             logout_v1();
    130         }
    131 
    132         if($chatwee_settings["enable_sso"] === true && is_user_logged_in() === true && ChatweeV1_User::isLogged() === false) {
    133             login_v1(wp_get_current_user());
    134         }
    135     }
    136 
    137     function initialize_v2() {
     119    function initialize() {
    138120        $chatwee_settings = get_option("chatwee_settings");
    139121
    140122        ChatweeV2_Configuration::setChatId($chatwee_settings["chat_id"]);
    141123        ChatweeV2_Configuration::setClientKey($chatwee_settings["client_key"]);
    142         ChatweeV2_Configuration::setCustomUserAgent("Chatwee Wordpress Plugin 2.0.4");
     124        ChatweeV2_Configuration::setCustomUserAgent("Chatwee Wordpress Plugin 2.1.1");
    143125
    144126        if($chatwee_settings["disable_offline_users"] === true && $chatwee_settings["enable_sso"] === true && is_user_logged_in() === false && ChatweeV2_Session::isSessionSet() === true) {
    145             logout_v2();
     127            sso_logout();
    146128        }
    147129
     
    149131            if($chatwee_settings["enable_sso"] === true && is_user_logged_in() === true) {
    150132                if(ChatweeV2_Session::isSessionSet() === false) {
    151                     login_v2(wp_get_current_user());
     133                    sso_login(wp_get_current_user());
    152134                } else {
    153135                    $sessionId = ChatweeV2_Session::getSessionId();
     
    158140
    159141                    if($isSessionValid === false) {
    160                         login_v2(wp_get_current_user());
     142                        sso_login(wp_get_current_user());
    161143                    }
    162144                }
     
    172154        }
    173155
    174         $chatwee_settings = get_option("chatwee_settings");
    175 
    176         if($chatwee_settings["chatwee_version"] === "v1") {
    177             initialize_v1();
    178         }
    179         if($chatwee_settings["chatwee_version"] === "v2") {
    180             initialize_v2();
    181         }
     156        initialize();
    182157    }
    183158
    184159    add_action("init", "init_handler");
    185160
    186     function render_v1() {
     161    function render() {
    187162        $chatwee_settings = get_option("chatwee_settings");
    188163
     
    191166        }
    192167        if(is_page_enabled() === true) {
     168            $chatwee_settings = get_option("chatwee_settings");
     169
    193170            echo $chatwee_settings["chatwee_script"];
    194171        }
    195172    }
    196173
    197     function render_v2() {
    198         $chatwee_settings = get_option("chatwee_settings");
    199 
    200         if(is_user_logged_in() === false && $chatwee_settings["disable_offline_users"] === true) {
    201             return false;
    202         }
    203         if(is_page_enabled() === true) {
    204             $chatwee_settings = get_option("chatwee_settings");
    205 
    206             echo $chatwee_settings["chatwee_script"];
    207         }
    208     }
    209 
    210174    function wp_footer_handler() {
    211175        $chatwee_settings = get_option("chatwee_settings");
    212176
    213         if($chatwee_settings["chatwee_version"] === "v1") {
    214             render_v1();
    215         }
    216         if($chatwee_settings["chatwee_version"] === "v2") {
    217             render_v2();
    218         }
     177        render();
    219178    }
    220179
    221180    add_action("wp_footer", "wp_footer_handler");
    222181
    223     function login_v1($user) {
    224         $username = $user->display_name ? $user->display_name : $user->user_login;
    225 
    226         $chatwee_settings = get_option("chatwee_settings");
    227 
    228         try {
    229             $session_id = ChatweeV1_User::login(Array(
    230                 "login" => $username,
     182    function sso_login($user) {
     183        $chatwee_user_id = get_user_meta($user->ID, "chatwee_v2_user_id_" . ChatweeV2_Configuration::getChatId(), true);
     184
     185        if(!$chatwee_user_id) {
     186            $chatwee_user_id = sso_register($user);
     187        }
     188
     189        try {
     190            ChatweeV2_SsoUser::edit(Array(
     191                "userId" => $chatwee_user_id,
     192                "login" => $user->display_name ? $user->display_name : $user->user_login,
    231193                "avatar" => get_chatwee_avatar_url($user->ID),
    232194                "isAdmin" => does_user_belong_to_moderator_group($user->ID) || if_user_is_moderator($user->ID)
    233195            ));
    234196        } catch(Exception $exception) {
    235             add_log("Error while executing login_v1: " . $exception->getMessage());
    236         }
    237     }
    238 
    239     function login_v2($user) {
    240         $chatwee_user_id = get_user_meta($user->ID, "chatwee_v2_user_id_" . ChatweeV2_Configuration::getChatId(), true);
    241         if(!$chatwee_user_id) {
    242             $chatwee_user_id = register_v2($user);
    243         }
    244 
    245         $has_been_promoted_as_chatwee_moderator_on_wordpress = does_user_belong_to_moderator_group($user->ID) || if_user_is_moderator($user->ID);
    246         $has_been_set_as_moderator_on_chatwee = get_user_meta($user->ID, "has_been_set_as_moderator_on_chatwee", true) == 1 ? 1 : 0;
    247 
    248         if ($has_been_promoted_as_chatwee_moderator_on_wordpress == true && $has_been_set_as_moderator_on_chatwee == 0) {
    249             try {
    250                 ChatweeV2_SsoUser::edit(Array(
    251                     "userId" => $chatwee_user_id,
    252                     "login" => $user->display_name ? $user->display_name : $user->user_login,
    253                     "avatar" => get_chatwee_avatar_url($user->ID),
    254                     "isAdmin" => true
    255                 ));
    256                 update_user_meta($user->ID, "has_been_set_as_moderator_on_chatwee", 1);
    257             } catch(Exception $exception) {
    258                 add_log("Error: " . $exception->getMessage());
    259             }
    260         } elseif ($has_been_promoted_as_chatwee_moderator_on_wordpress == false && $has_been_set_as_moderator_on_chatwee == 1) {
    261             try {
    262                 ChatweeV2_SsoUser::edit(Array(
    263                     "userId" => $chatwee_user_id,
    264                     "login" => $user->display_name ? $user->display_name : $user->user_login,
    265                     "avatar" => get_chatwee_avatar_url($user->ID),
    266                     "isAdmin" => false
    267                 ));
    268                 update_user_meta($user->ID, "has_been_set_as_moderator_on_chatwee", 0);
    269             } catch(Exception $exception) {
    270                 add_log("Error: " . $exception->getMessage());
     197            if(strpos($exception->getMessage(), "User does not exist") !== false) {
     198                $chatwee_user_id = sso_register($user);
     199            } else {
     200                add_log("Error while executing sso_login: " . $exception->getMessage());
    271201            }
    272202        }
     
    277207            ));
    278208        } catch(Exception $exception) {
    279             add_log("Error while executing login_v2: " . $exception->getMessage());
     209            add_log("Error while executing sso_login: " . $exception->getMessage());
    280210        }
    281211    }
     
    284214        $chatwee_settings = get_option("chatwee_settings");
    285215
    286         if($chatwee_settings["chatwee_version"] === "v1") {
    287             login_v1($user);
    288         }
    289         if($chatwee_settings["chatwee_version"] === "v2") {
    290             login_v2($user);
    291         }
     216        sso_login($user);
    292217    }
    293218
     
    296221    }
    297222
    298     function logout_v1() {
    299         $chatwee_settings = get_option("chatwee_settings");
    300 
    301         try {
    302             ChatweeV1_User::logout();
    303         } catch(Exception $exception) {
    304             add_log("Error while executing logout_v1: " . $exception->getMessage());
    305         }
    306     }
    307 
    308     function logout_v2() {
     223    function sso_logout() {
    309224        $chatwee_settings = get_option("chatwee_settings");
    310225
     
    312227            ChatweeV2_SsoManager::logoutUser();
    313228        } catch(Exception $exception) {
    314             add_log("Error while executing logout_v2: " . $exception->getMessage());
     229            add_log("Error while executing sso_logout: " . $exception->getMessage());
    315230        }
    316231    }
     
    319234        $chatwee_settings = get_option("chatwee_settings");
    320235
    321         if($chatwee_settings["chatwee_version"] === "v1") {
    322             logout_v1();
    323         }
    324         if($chatwee_settings["chatwee_version"] === "v2") {
    325             logout_v2();
    326         }
     236        sso_logout();
    327237    }
    328238
     
    331241    }
    332242
    333     function register_v2($user) {
     243    function sso_register($user) {
    334244
    335245        $username = $user->display_name ? $user->display_name : $user->user_login;
     
    345255
    346256            update_user_meta($user->ID, "chatwee_v2_user_id_" . ChatweeV2_Configuration::getChatId(), $user_id);
    347             update_user_meta($user->ID, "has_been_set_as_moderator_on_chatwee", does_user_belong_to_moderator_group($user->ID) || if_user_is_moderator($user->ID));
    348257
    349258            return $user_id;
    350259        } catch(Exception $exception) {
    351             add_log("Error while executing register_v2: " . $exception->getMessage());
     260            add_log("Error while executing sso_register: " . $exception->getMessage());
    352261            return null;
    353262        }
     
    357266        $user = get_user_by("id", $user_id);
    358267
    359         register_v2($user);
     268        sso_register($user);
    360269    }
    361270
    362271    if($chatwee_settings["enable_sso"] === true) {
    363272        add_action("user_register", "user_register_handler", 10, 1);
    364     }
    365 
    366     function edit_v2($user) {
    367 
    368         $chatwee_settings = get_option("chatwee_settings");
    369 
    370         $chatwee_user_id = get_user_meta($user->ID, "chatwee_v2_user_id_" . ChatweeV2_Configuration::getChatId(), true);
    371 
    372         if(!$chatwee_user_id) {
    373             $chatwee_user_id = register_v2($user);
    374         }
    375 
    376         try {
    377             ChatweeV2_SsoManager::editUser(Array(
    378                 "userId" => $chatwee_user_id,
    379                 "login" => $user->display_name ? $user->display_name : $user->user_login,
    380                 "avatar" => get_chatwee_avatar_url($user->ID),
    381                 "isAdmin" => does_user_belong_to_moderator_group($user->ID) || if_user_is_moderator($user->ID)
    382             ));
    383             update_user_meta($user->ID, "has_been_set_as_moderator_on_chatwee", does_user_belong_to_moderator_group($user->ID) || if_user_is_moderator($user->ID));
    384         } catch(Exception $exception) {
    385             add_log("Error while executing edit_v2: " . $exception->getMessage());
    386         }
    387     }
    388 
    389     function user_edit_handler($user_id) {
    390         $user = get_user_by("id", $user_id);
    391 
    392         edit_v2($user);
    393     }
    394 
    395     if($chatwee_settings["enable_sso"] === true) {
    396         add_action("profile_update", 'user_edit_handler', 10, 2);
    397273    }
    398274
  • chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/SsoUser.php

    r1711815 r1877831  
    2222            "userId" => $parameters["userId"]
    2323        );
     24
     25        if(isSet($parameters["userIp"]))
     26        {
     27            if(filter_var($parameters["userIp"], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false)
     28            {
     29                $requestParameters["userIp"] = $parameters["userIp"];
     30            }
     31        }
    2432
    2533        $httpClient = new ChatweeV2_HttpClient();
  • chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/Utils.php

    r1564521 r1877831  
    1313        return $ip;
    1414    }
    15 
    16     public static function isMobileDevice() {
    17         $user_agent = strtolower ( $_SERVER['HTTP_USER_AGENT'] );
    18 
    19         if (preg_match("/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/", $user_agent)) {
    20             return true;
    21         } else if (preg_match("/mobile|pda;|avantgo|eudoraweb|minimo|netfront|brew|teleca|lg;|lge |wap;| wap /", $user_agent)) {
    22             return true;
    23         }
    24         return false;
    25     }
    2615}
  • chatwee/trunk/readme.txt

    r1712683 r1877831  
    11=== WordPress Chat by Chatwee ===
    22Plugin Name: WordPress Chat by Chatwee
    3 Contributors: paulq
     3Contributors: Wojciech Majerski
    44Tags: live chat, chat, chat plugin, chat widget, group chat, chat room, free chat, social chat, chat box, shout box, online community, community, engage, contact us, customer support, support, live support, live help, wordpress chat, wordpress live chat, chat system, website chat, comments system, user experience
    55Requires at least: 3.0.1
    6 Tested up to: 4.7.2
     6Tested up to: 4.9.6
    77Stable tag: 4.3
    88License: GPLv2 or later
     
    2525Chatwee can become your site’s social hub, a place where community members come together to interact, or serve as an add-on supporting comments section or a forum.
    2626
    27 Importantly, with our plugin, you actually gain access to two independent widgets, both of which you can test absolutely for free.
    28 
    2927Sign up with no commitments whatsoever and add a new, dynamic element to spark up your site. As proven by numerous sites using Chatwee, we’re among the leaders in providing solutions supporting online community growth.
    3028
    3129[See Chatwee 2.0 live](https://chatwee.com)
    3230
    33 [See Chatwee 1.0 live](https://v1.chatwee.com)
    34 
    3531= Key benefits of the Chatwee WordPress plugin: =
    36 *   two distinct products in one package - decide which one suits you best and go with it, or easily switch anytime
    3732*   extensive customization options
    3833*   user-friendly installation, including enabling Single Sign-on utilizing your WordPress user database
     
    4237*   To use the plugin, please [sign up](https://client.chatwee.com/v2/dashboard) with us first. It’s free and you’ll need access to the installation code, in order to get this plugin to work.
    4338*   [WordPress chat plugin installation instruction](https://chatwee.com/wordpress-chat-plugin-installation)
    44 *   [Chatwee 2.0 features](https://chatwee.com/full-features) / [Chatwee 1.0 features](https://v1.chatwee.com/features)
    45 *   [Chatwee 2.0 support center](https://chatwee.com/support) / [Chatwee 1.0 support center](https://support.chatwee.com)
     39*   [Chatwee features](https://chatwee.com/full-features) / [Chatwee 1.0 features](https://v1.chatwee.com/features)
     40*   [Chatwee support center](https://chatwee.com/support) / [Chatwee 1.0 support center](https://support.chatwee.com)
    4641*   Follow us on [Facebook](https://facebook.com/chatwee), [Twitter](https://twitter.com/Chatwee) and [Pinterest](https://pl.pinterest.com/chatwee/) for the latest updates
    4742*   Visit our [blog](http://blog.chatwee.com) for inspirational posts.
     
    5045== Installation ==
    5146
    52 By installing the Chatwee WordPress Chat plugin you gain access to two independent widgets. Once you’re done with the setup, you’ll be able to choose the one you wish to actually use from a dropdown menu. Follow the steps below to get the chat going in no time.
     47Follow the steps below to get the chat going in no time.
    5348
    5449Please note that in order to use the plugin, you have to [sign up](https://chatwee.com/) with us first. Don’t worry, the account is free and comes with absolutely no commitments.
     
    57522. Type Chatwee WordPress Chat into the search bar.
    58533. Once WordPress Directory shows you the search result, install the plugin and activate it.
    59 4. Next, log in to your [Chatwee Dashboard](https://client.chatwee.com/v2/dashboard) and copy the relevant installation code (1.0 or 2.0) into a box in the plugin settings page (the plugin will be listed in the left column of your WordPress admin panel). Save changes.
     544. Next, log in to your [Chatwee Dashboard](https://client.chatwee.com/v2/dashboard) and copy the relevant installation code into a box in the plugin settings page (the plugin will be listed in the left column of your WordPress admin panel). Save changes.
    60555. That’s it! Now go ahead and explore customization options in your [Chatwee Dashboard](https://client.chatwee.com/v2/customize) and the plugin settings page.
    6156
     
    135130*   Plugin GUI improved
    136131
     132= 2.1.1 =
     133
     134*   No longer supporting Chatwee 1.0
     135*   SSO user re-registered if no corresponding Chatwee user found
     136
    137137== Frequently Asked Questions ==
    138138
     
    147147= How much customization can I do? =
    148148
    149 Chatwee WordPress Chat plugin gives you access to two individual widgets. With Chatwee 1.0, you can customize things like the color of the background, border and text, choose font and its size, as well as select one of the three display modes available.
    150 Using Chatwee 2.0, you can click and drag the chat window to adjust its size to the one that fits you best. It also offers the option to set up multiple chat rooms with paid plans.
     149Using Chatwee you can click and drag the chat window to adjust its size to the one that fits you best. It also offers the option to set up multiple chat rooms with paid plans.
    151150There’s plenty more, though, and the best way to learn about Chatwee is to install it and explore it on your own. Essentially, these are two different products, and comparing them isn’t really fair, as they both offer unique features to their users.
    152151
     
    157156= Is Chatwee available in my language? =
    158157
    159 Chatwee 1.0 is currently available in: English, Spanish, Chinese, Arabic, Persian, Kurdish, Hebrew, Bengali, Telugu, Turkish, Portuguese, Russian, German, French, Danish, Finnish, Polish, Czech, Hungarian, Slovenian, Slovak, Thai, Dutch, Italian, Korean, Greek, Swedish, Norwegian, Hindi, Serbian, Croatian, Japanese, Romanian and Vietnamese.
    160 Chatwee 2.0 is still a relatively new product and is currently only available in English.
     158Chatwee is currently available in: English, Portuguese, Polish, Spanish, French, Bulgarian, Hebrew, Finnish, Czech, Indonesian, Turkish, Ukrainian, Russian, Norwegian, Japanese and German.
    161159Would you like to help us translate Chatwee? If so, [let us know](https://chatwee.com/contact) and we'll send you the array of phrases to translate from English. In exchange, we'll offer you a free, one-time upgrade to your current plan.
    162160
     
    171169= What types of media can Chatwee users share? =
    172170
    173 Our chat widget is all about rich, real time interaction. With Chatwee 1.0, you can upload files up to 2 MB that become available for download, as well as post videos and images, with previews generated based on their original URLs.
    174 Using Chatwee 2.0, you can upload files as well, and on top of that, you can easily share images and animated gifs simply by selecting the file from your phone or hard drive.
     171Using Chatwee you can upload files as well, and on top of that, you can easily share images and animated gifs simply by selecting the file from your phone or hard drive.
    175172
    176173= What payment methods do you accept? =
Note: See TracChangeset for help on using the changeset viewer.