Plugin Directory

Changeset 2336842


Ignore:
Timestamp:
07/07/2020 05:30:01 PM (6 years ago)
Author:
onwebchat_dev
Message:

Javascript api support

Location:
onwebchat
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • onwebchat/tags/3.1.0/onwebchat.php

    r2180552 r2336842  
    55Description: onWebChat is a live chat system, that helps you communicate with your website's visitors.
    66Author: onWebChat
    7 Version: 3.0.5
     7Version: 3.1.0
    88Author URI: https://www.onwebchat.com
    99*/
     
    4545
    4646function onwebchat_setup_menu() {
    47     add_menu_page( 'onWebChat Settings', 'onWebChat', 'administrator', 'onwebchat_settings', 'onwebchat_init_menu_page', ONWEBCHAT_SMALL_LOGO);
     47    add_menu_page( 'onWebChat Settings', 'onWebChat', 'administrator', 'onwebchat_settings', 'onwebchat_init_menu_page', ONWEBCHAT_SMALL_LOGO);
    4848}
    4949
     
    5656
    5757
    58     $options = get_option('onwebchat_plugin_option');
    59     $chatId = $options['text_string'];
    60 
    61     $isConnected = false;
    62     if($chatId !="") {
    63         $isConnected = true;
    64     }
    65 
    66 
    67     /*****************************************************************
    68     * Ask server for chatId
    69     *****************************************************************/
    70     if ( isset( $_POST["action"] ) && $_POST["action"] == "login" ) {
    71 
    72         $options = get_option('onwebchat_plugin_option');
    73         $chatId = $options['text_string'];
    74         //****************************
    75 
    76         // get username, password and chatId
    77         $userName = $_POST["onWebChatUser"];
    78         $userPass = $_POST["onWebChatPass"];
    79         $chatId = $_POST["chatId"];
    80         $isSecondPage = $_POST["isSecondPage"];
    81 
    82         $pagesSelect = $_POST["pages-select"];
    83         $showOnPages = $_POST["showonpages"];
    84         $hideOnPages = $_POST["hideonpages"];
    85 
    86         if(isChatIdValid($chatId)) {
    87 
    88             //----------- update chatId option ------------
    89             $my_options = get_option('onwebchat_plugin_option');
    90 
    91             $my_options['text_string'] = $chatId;
    92 
    93             //Update entire array
    94             update_option('onwebchat_plugin_option', $my_options);
    95             //-----------------------------------------------
    96 
    97             // remove user email from db
    98             if(!$isSecondPage) {
    99                 update_option( 'onwebchat_plugin_option_user', '');
    100                 update_option( 'onwebchat_plugin_option_pages_select', 1);
    101 
    102             } else {
    103 
    104                 update_option( 'onwebchat_plugin_option_pages_select', $pagesSelect);
    105 
    106                 if ($pagesSelect==2){
    107                     update_option( 'onwebchat_plugin_option_show_pages', $showOnPages);
    108                 } else if ($pagesSelect==3){
    109                     update_option( 'onwebchat_plugin_option_hide_pages', $hideOnPages);
    110                 }
    111 
    112             }
    113 
    114             // move to next page
    115             print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    116 
    117         } else {
    118 
    119             // save username at options
    120             update_option( 'onwebchat_plugin_option_user', $userName );
    121 
    122             // ask server for chatId
    123             $response = wp_remote_post(ONWEBCHAT_SERVER_URL, array(
    124                 'method' => 'POST',
    125                 'timeout' => 45,
    126                 'redirection' => 5,
    127                 'httpversion' => '1.0',
    128                 'blocking' => true,
    129                 'headers' => array(),
    130                 'body' => array( 'email' => $userName, 'pass' => $userPass ),
    131                 'cookies' => array()
    132             ));
    133 
    134             if ( is_wp_error( $response ) ) {
    135                 $error_message = $response->get_error_message();
    136 
    137             } else {
    138                 // If no chatId returned
    139                 if($response['body'] == '-1') {
    140                     // display an error for wrong credentials
    141                     onwebchat_login_error(true);
    142 
    143                 } else {
    144 
    145                     //----------- update chatId
    146                     $my_options = get_option('onwebchat_plugin_option');
    147 
    148                     $my_options['text_string'] = $response['body'];
    149 
    150                     update_option('onwebchat_plugin_option', $my_options);
    151                     update_option( 'onwebchat_plugin_option_pages_select', 1);
    152                     //--------------------------------------------
    153 
    154                     // move to next page
    155                     print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    156                 }
    157             }
    158         }
    159 
    160         update_option('onwebchat_plugin_option_hide', $_POST['onwebchat_plugin_option_hide']); //an einai stin proti selida tote to kanei keno (opote by default den einai epilegmeno)
    161     }
    162 
    163     //********************************************************************
    164 
    165 
    166     /*********************************************************************
    167     * Disconnect account
    168     *********************************************************************/
    169     if( isset($_GET["action"]) && $_GET["action"] == "deactivate" && $isConnected) {
    170         $isConnected = false;
    171 
    172         $my_options = get_option('onwebchat_plugin_option');
    173 
    174         $my_options['text_string'] = '';
    175 
    176         update_option('onwebchat_plugin_option', $my_options);
    177         update_option( 'onwebchat_plugin_option_pages_select', 1);
    178 
    179         $chatIdOption = get_option('onwebchat_plugin_option');
    180         $chatId = $chatIdOption['text_string'];
    181 
    182         print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    183 
    184     }
    185     //***********************************************************************
    186 
    187 
    188 
    189     ?>
    190     <div>
    191         <h2 style="font-size:22px; color:#59808c">onWebChat <?php ($isConnected == true) ? print 'Settings' :  print 'Activation'; ?> </h2>
    192 
    193         <form action="admin.php?page=onwebchat_settings" method="post">
    194             <input type="hidden" name="action" value="login">
    195             <?php
    196 
    197             // Login Page
    198             if($isConnected != true) {
    199 
    200                 $chatId = get_option( 'onwebchat_plugin_option' );
    201                 $chatId = $chatId['text_string'];
    202                 ?>
    203 
    204                 <hr class="small-hr2">
    205 
    206                 <h3 class="header-1">Connect with your onWebChat account</h3>
    207 
    208 
    209 
    210                 <div class="username-div">
    211                     <strong>Email: </strong><input class="username-text-field" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
    212                 </div>
    213                 <div class="password-div">
    214                     <strong>Password: </strong><input class="password-text-field" type="password" name="onWebChatPass" value="<?php echo get_option( 'onWebChatPass' ); ?>"/>
    215                 </div>
    216 
    217                 <div style="width: 560px; height: 10px; border-bottom: 1px solid #bfbfbf; text-align: center; margin-top:30px">
     58    $options = get_option('onwebchat_plugin_option');
     59    $chatId = $options['text_string'];
     60
     61    $isConnected = false;
     62    if($chatId !="") {
     63        $isConnected = true;
     64    }
     65
     66    $isSecondPage = false;
     67
     68
     69    /*****************************************************************
     70     * Ask server for chatId
     71     *****************************************************************/
     72    if ( isset( $_POST["action"] ) && $_POST["action"] == "login" ) {
     73
     74        $options = get_option('onwebchat_plugin_option');
     75        $chatId = $options['text_string'];
     76        //****************************
     77
     78        // get username, password and chatId
     79        $userName = $_POST["onWebChatUser"];
     80
     81        if(isset($_POST["onWebChatPass"])) {
     82            $userPass = $_POST["onWebChatPass"];
     83        }
     84
     85        $chatId = $_POST["chatId"];
     86
     87
     88        if( isset($_POST["pages-select"])) {
     89            $pagesSelect = $_POST["pages-select"];
     90        }
     91
     92        if( isset($_POST["showonpages"])) {
     93            $showOnPages = $_POST["showonpages"];
     94        }
     95
     96        if(isset($_POST["hideonpages"])) {
     97            $hideOnPages = $_POST["hideonpages"];
     98        }
     99
     100        if(isset($_POST["onwebchat-api"])) {
     101            $onwebchatApi = $_POST["onwebchat-api"];
     102        }
     103
     104
     105        if(isChatIdValid($chatId)) {
     106
     107            if ( isset($_POST["isSecondPage"])){
     108                $isSecondPage = $_POST["isSecondPage"];
     109            }
     110
     111            //----------- update chatId option ------------
     112            $my_options = get_option('onwebchat_plugin_option');
     113
     114            $my_options['text_string'] = $chatId;
     115
     116            //Update entire array
     117            update_option('onwebchat_plugin_option', $my_options);
     118            //-----------------------------------------------
     119
     120            // remove user email from db
     121            if(!$isSecondPage) {
     122                update_option( 'onwebchat_plugin_option_user', '');
     123                update_option( 'onwebchat_plugin_option_pages_select', 1);
     124
     125            } else {
     126
     127                update_option( 'onwebchat_plugin_option_pages_select', $pagesSelect);
     128
     129                if ($pagesSelect==2){
     130                    update_option( 'onwebchat_plugin_option_show_pages', $showOnPages);
     131                } else if ($pagesSelect==3){
     132                    update_option( 'onwebchat_plugin_option_hide_pages', $hideOnPages);
     133                }
     134
     135                //TODO update textarea
     136                update_option( 'onwebchat_plugin_option_api_code', $onwebchatApi);
     137            }
     138
     139            // move to next page
     140            print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     141
     142        } else {
     143
     144            // save username at options
     145            update_option( 'onwebchat_plugin_option_user', $userName );
     146
     147            // ask server for chatId
     148            $response = wp_remote_post(ONWEBCHAT_SERVER_URL, array(
     149                'method' => 'POST',
     150                'timeout' => 45,
     151                'redirection' => 5,
     152                'httpversion' => '1.0',
     153                'blocking' => true,
     154                'headers' => array(),
     155                'body' => array( 'email' => $userName, 'pass' => $userPass ),
     156                'cookies' => array()
     157            ));
     158
     159            if ( is_wp_error( $response ) ) {
     160                $error_message = $response->get_error_message();
     161
     162            } else {
     163                // If no chatId returned
     164                if($response['body'] == '-1') {
     165                    // display an error for wrong credentials
     166                    onwebchat_login_error(true);
     167
     168                } else {
     169
     170                    //----------- update chatId
     171                    $my_options = get_option('onwebchat_plugin_option');
     172
     173                    $my_options['text_string'] = $response['body'];
     174
     175                    update_option('onwebchat_plugin_option', $my_options);
     176                    update_option( 'onwebchat_plugin_option_pages_select', 1);
     177                    //--------------------------------------------
     178
     179                    // move to next page
     180                    print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     181                }
     182            }
     183        }
     184
     185        $m_option_hide = false;
     186        if(isset($_POST['onwebchat_plugin_option_hide'])) {
     187            $m_option_hide = $_POST['onwebchat_plugin_option_hide'];
     188        }
     189
     190        update_option('onwebchat_plugin_option_hide', $m_option_hide); //an einai stin proti selida tote to kanei keno (opote by default den einai epilegmeno)
     191
     192    }
     193
     194    //********************************************************************
     195
     196
     197    /*********************************************************************
     198     * Disconnect account
     199     *********************************************************************/
     200    if( isset($_GET["action"]) && $_GET["action"] == "deactivate" && $isConnected) {
     201        $isConnected = false;
     202
     203        $my_options = get_option('onwebchat_plugin_option');
     204
     205        $my_options['text_string'] = '';
     206
     207        update_option('onwebchat_plugin_option', $my_options);
     208        update_option( 'onwebchat_plugin_option_pages_select', 1);
     209
     210        $chatIdOption = get_option('onwebchat_plugin_option');
     211        $chatId = $chatIdOption['text_string'];
     212
     213        print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     214
     215    }
     216    //***********************************************************************
     217
     218
     219
     220    ?>
     221    <div>
     222        <h2 style="font-size:22px; color:#59808c">onWebChat <?php ($isConnected == true) ? print 'Settings' :  print 'Activation'; ?> </h2>
     223
     224        <form action="admin.php?page=onwebchat_settings" method="post">
     225            <input type="hidden" name="action" value="login">
     226            <?php
     227
     228            // Login Page
     229            if($isConnected != true) {
     230
     231                $chatId = get_option( 'onwebchat_plugin_option' );
     232                $chatId = $chatId['text_string'];
     233                ?>
     234
     235                <hr class="small-hr2">
     236
     237                <h3 class="header-1">Connect with your onWebChat account</h3>
     238
     239
     240
     241                <div class="username-div">
     242                    <strong>Email: </strong><input class="username-text-field" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
     243                </div>
     244                <div class="password-div">
     245                    <strong>Password: </strong><input class="password-text-field" type="password" name="onWebChatPass" value="<?php echo get_option( 'onWebChatPass' ); ?>"/>
     246                </div>
     247
     248                <div style="width: 560px; height: 10px; border-bottom: 1px solid #bfbfbf; text-align: center; margin-top:30px">
    218249                    <span class="header-or" style="font-size: 23px; background-color: #f1f1f1; padding: 0 10px;">
    219250                        OR
    220251                    </span>
    221                 </div>
    222 
    223 
    224                 <h3 class="header-2">Paste your onWebChat Chat Id</h3>
    225                 <div class="chatid-div">
    226                     <strong>Chat Id:</strong> <input class="chatid-text-field" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
    227                 </div>
    228 
    229                 <hr class="small-hr2">
    230 
    231                 <div class="new-account-link">
    232                     <span class="info-star">*</span> If you don't have an account on onWebChat live chat service, you should create one <a href="https://www.onwebchat.com/signup.php" target="_blank">here</a>
    233                 </div>
    234 
    235 
    236                 <?php
    237             }
    238 
    239             // 2nd Page
    240             else {
    241                 $options = get_option('onwebchat_plugin_option_user');
    242 
    243                 // display user email
    244                 if($options!=''){
    245                     $html = '<br><h3 class="header-1-p2">Activated for onWebChat account: </h3>';
    246                     $html .= "<strong class='account-id'>$options</strong> ";
    247                 }
    248 
    249                 // display chatId
    250                 else {
    251                     $chatId = get_option( 'onwebchat_plugin_option' );
    252                     $chatId = $chatId['text_string'];
    253                     $html = '<br><h3 class="header-1-p2">Activated for onWebChat Chat Id: </h3>';
    254                     $html .= "<strong class='account-id'>$chatId</strong> ";
    255                 }
    256                 $html .= ' <a href="admin.php?page=onwebchat_settings&amp;action=deactivate">Deactivate</a>';
    257                 $html .= ' <div class="admin-login-info"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>';
    258                 echo $html;
    259 
    260                 $options = get_option('onwebchat_plugin_option_hide');
    261 
    262                 $chatId = get_option( 'onwebchat_plugin_option' );
    263                 $chatId = $chatId['text_string'];
    264 
    265                 ?>
    266                 <div class="hide-div">
    267                     <strong>Hide Chat Widget:</strong> <input type="checkbox" id="plugin_text_checkbox" name="onwebchat_plugin_option_hide" value="1" <?php checked( $options, 1 ); ?> />
    268                 </div>
    269 
    270                 <div class="hide-div">
    271                     <select id="pages-select" name="pages-select" onchange="onwc_select_change()">
    272                         <option value="1" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 1 ); ?>>Show chat widget on all pages</option>
    273                         <option value="2" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 2 ); ?>>Show on the following pages:</option>
    274                         <option value="3" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 3 ); ?>>Hide on the following pages:</option>
    275                     </select>
    276                 </div>
    277 
    278                 <div id="onwc_show_on_pages_div" style="display:none">
    279                     <input id="showonpages" name="showonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_show_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
    280                 </div>
    281                 <div id="onwc_hide_on_pages_div" style="display:none">
    282                     <input id="hideonpages" name="hideonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_hide_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
    283                 </div>
    284 
    285                 <div id="help">
    286                     <span>You can insert multiple pages seperated by space. You can insert a part of the page or URL. e.g. &nbsp; index pric contact.php blog/</span>
    287                 </div>
    288 
    289                 <div>
    290                     <br /><br />
    291                 </div>
    292 
    293                 <!-- hiden fields -->
    294                 <input class="chatid-text-field-hide" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
    295                 <input class="chatid-text-field-hide" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
    296                 <input class="chatid-text-field-hide" type="text" name="isSecondPage" value="1"/>
    297                 <?php
    298             }
    299 
    300             // Display the Save Button
    301             $html = '<input class="button button-primary" style="margin-left: 230px;" type="submit" value="Save Changes"/>';
    302             echo $html;
    303             ?>
    304         </form>
    305     </div>
    306 
    307     <script type="text/javascript">
    308 
    309 
    310     function onwc_select_change() {
    311         var e = document.getElementById("pages-select");
    312         var selected = e.options[e.selectedIndex].value;
    313         if (selected==1){
    314             document.getElementById("onwc_show_on_pages_div").style.display = "none";
    315             document.getElementById("onwc_hide_on_pages_div").style.display = "none";
    316         } else if (selected==2){
    317             document.getElementById("onwc_show_on_pages_div").style.display = "block";
    318             document.getElementById("onwc_hide_on_pages_div").style.display = "none";
    319         } else if (selected==3){
    320             document.getElementById("onwc_show_on_pages_div").style.display = "none";
    321             document.getElementById("onwc_hide_on_pages_div").style.display = "block";
    322         }
    323 
    324     }
    325     document.addEventListener('DOMContentLoaded', function() {
    326        onwc_select_change();
    327     }, false);
    328 </script>
    329 <?php
     252                </div>
     253
     254
     255                <h3 class="header-2">Paste your onWebChat Chat Id</h3>
     256                <div class="chatid-div">
     257                    <strong>Chat Id:</strong> <input class="chatid-text-field" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
     258                </div>
     259
     260                <hr class="small-hr2">
     261
     262                <div class="new-account-link">
     263                    <span class="info-star">*</span> If you don't have an account on onWebChat live chat service, you should create one <a href="https://www.onwebchat.com/signup.php" target="_blank">here</a>
     264                </div>
     265
     266
     267                <?php
     268            }
     269
     270            // 2nd Page
     271            else {
     272                $options = get_option('onwebchat_plugin_option_user');
     273
     274                // display user email
     275                if($options!=''){
     276                    $html = '<br><h3 class="header-1-p2">Activated for onWebChat account: </h3>';
     277                    $html .= "<strong class='account-id'>$options</strong> ";
     278                }
     279
     280                // display chatId
     281                else {
     282                    $chatId = get_option( 'onwebchat_plugin_option' );
     283                    $chatId = $chatId['text_string'];
     284                    $html = '<br><h3 class="header-1-p2">Activated for onWebChat Chat Id: </h3>';
     285                    $html .= "<strong class='account-id'>$chatId</strong> ";
     286                }
     287                $html .= ' <a href="admin.php?page=onwebchat_settings&amp;action=deactivate">Deactivate</a>';
     288                //$html .= ' <div class="admin-login-info"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>';
     289                echo $html;
     290
     291                $options = get_option('onwebchat_plugin_option_hide');
     292
     293                $chatId = get_option( 'onwebchat_plugin_option' );
     294                $chatId = $chatId['text_string'];
     295
     296                //TODO get correct value
     297                $onwebchatApi = get_option('onwebchat_plugin_option_api_code');
     298                $onwebchatApi = str_replace('\\','',$onwebchatApi);
     299                ?>
     300                <!--                <div class="hide-div">-->
     301                <!--                    <strong>Hide Chat Widget:</strong> <input type="checkbox" id="plugin_text_checkbox" name="onwebchat_plugin_option_hide" value="1" --><?php //checked( $options, 1 ); ?><!-- />-->
     302                <!--                </div>-->
     303
     304
     305
     306                <div class="hide-div">
     307                    <select id="pages-select" name="pages-select" onchange="onwc_select_change()">
     308                        <option value="1" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 1 ); ?>>Show chat widget on all pages</option>
     309                        <option value="2" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 2 ); ?>>Show on the following pages:</option>
     310                        <option value="3" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 3 ); ?>>Hide on the following pages:</option>
     311                        <option value="4" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 4 ); ?>>Hide chat widget from all pages:</option>
     312                    </select>
     313                </div>
     314
     315                <div id="onwc_show_on_pages_div" style="display:none">
     316                    <input id="showonpages" name="showonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_show_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
     317                </div>
     318                <div id="onwc_hide_on_pages_div" style="display:none">
     319                    <input id="hideonpages" name="hideonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_hide_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
     320                </div>
     321
     322                <div id="help">
     323                    <span>You can insert multiple pages seperated by space. You can insert a part of the page or URL. e.g. &nbsp; index pric contact.php blog/</span>
     324                </div>
     325
     326                <h3 class="header-2">Write your onWebChat Chat API code</h3>
     327                <div class="chatid-div">
     328                    <strong>onWebChat API:</strong>
     329                    <br>
     330                    <textarea class="chatid-text-field" style="margin-left: 0px;" rows="10" name="onwebchat-api"><?php echo $onwebchatApi; ?></textarea>
     331                    <br>
     332                    <br>
     333                </div>
     334
     335                <div>
     336                    <br /><br />
     337                </div>
     338
     339                <!-- hiden fields -->
     340                <input class="chatid-text-field-hide" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
     341                <input class="chatid-text-field-hide" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
     342                <input class="chatid-text-field-hide" type="text" name="isSecondPage" value="1"/>
     343
     344                <div class="new-account-link"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>
     345                <?php
     346
     347
     348            }
     349
     350            // Display the Save Button
     351            $html = '<input class="button button-primary" style="margin-left: 230px;" type="submit" value="Save Changes"/>';
     352            echo $html;
     353            ?>
     354        </form>
     355    </div>
     356
     357    <script type="text/javascript">
     358
     359
     360        function onwc_select_change() {
     361            var e = document.getElementById("pages-select");
     362            var selected = e.options[e.selectedIndex].value;
     363            if (selected == 1){
     364                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     365                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     366            } else if (selected == 2){
     367                document.getElementById("onwc_show_on_pages_div").style.display = "block";
     368                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     369            } else if (selected == 3){
     370                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     371                document.getElementById("onwc_hide_on_pages_div").style.display = "block";
     372            } else if (selected == 4){
     373                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     374                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     375            }
     376
     377        }
     378        document.addEventListener('DOMContentLoaded', function() {
     379            onwc_select_change();
     380        }, false);
     381    </script>
     382    <?php
    330383}
    331384
     
    336389
    337390function register_plugin_styles() {
    338     wp_register_style( 'onwebchat', plugins_url( 'onwebchat/css/onwebchat.css' ) );
    339     wp_enqueue_style( 'onwebchat' );
     391    wp_register_style( 'onwebchat', plugins_url( 'onwebchat/css/onwebchat.css' ) );
     392    wp_enqueue_style( 'onwebchat' );
    340393}
    341394
     
    347400function onwebchat_register_setttings() {
    348401
    349     /******************** Account Tab ************************/
    350     //* register the Chat Id
    351     register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option');
    352 
    353     //* register the username
    354     register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_user');
    355 
    356     //* register the hide (checkbox)
    357     register_setting( 'onwebchat_plugin_option_checkbox', 'onwebchat_plugin_option_hide');
     402    /******************** Account Tab ************************/
     403    //* register the Chat Id
     404    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option');
     405
     406    //* register the username
     407    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_user');
     408
     409    //* register the hide (checkbox)
     410    register_setting( 'onwebchat_plugin_option_checkbox', 'onwebchat_plugin_option_hide');
     411
     412    //TODO api code
     413    //* register the api code
     414    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_api_code');
    358415}
    359416
     
    366423function onwebchat_add_script_at_footer() {
    367424
    368     $options = get_option('onwebchat_plugin_option');
    369     $chatId = $options['text_string'];
    370     $hideWidget = get_option('onwebchat_plugin_option_hide');
    371 
    372     $widgetCode = "<script type='text/javascript'>var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==='undefined'){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement('script'); ga.type = 'text/javascript';ga.async=1;ga.src='//www.onwebchat.com/clientchat/$chatId';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})()}</script>";
    373 
    374     $apiCode = get_option('onwebchat_plugin_option_api');
    375 
    376     $widgetCode .= $apiCode;
    377 
    378 
    379     //check if user is logged if yes get username, email
    380     if ( is_user_logged_in() ) {
    381 
    382         global $current_user;
    383         get_currentuserinfo();
    384 
    385         // get user name
    386         $onwebchat_user = $current_user->user_login;
    387 
    388         // get user email
    389         $onwebchat_email = $current_user->user_email;
    390 
    391         //add api info
    392         if ($onwebchat_user != null && $onwebchat_user != "" && $onwebchat_user != "guest" && $onwebchat_user != "Guest") {
    393             if ($onwebchat_email != null && $onwebchat_email != ""){
    394                 $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');onWebChat.set('email','$onwebchat_email'); </script>";
    395             } else {
    396                 $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');</script>";
    397             }
    398         }
    399     }
    400 
    401     $currentPage = substr( strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos( strtolower($_SERVER['SERVER_PROTOCOL']), "/") );
    402     $currentPage .= ( empty($_SERVER['HTTPS']) ? NULL : ( ($_SERVER['HTTPS'] == "on") ? "s" : NULL) );
    403     $currentPage .= "://" . $_SERVER['SERVER_NAME'];
    404     $currentPage .= ( $_SERVER['SERVER_PORT'] == 80 ? "" : ":".$_SERVER['SERVER_PORT'] );
    405     $currentPage .= $_SERVER['REQUEST_URI'];
    406 
    407     $pagesSelect = get_option('onwebchat_plugin_option_pages_select');
    408     $showPages = get_option('onwebchat_plugin_option_show_pages');
    409     $showPages = explode(' ', $showPages);
    410     $hidePages = get_option('onwebchat_plugin_option_hide_pages');
    411     $hidePages = explode(' ', $hidePages);
    412 
    413     $showSelect=true;
    414     if ($pagesSelect==1){
    415 
    416     } else if ($pagesSelect==2){
    417         $showSelect=false;
    418         foreach ($showPages as $page){
    419             if ($page !== "") {
    420                 if (strpos($currentPage, $page) !== false) {
    421                     $showSelect = true;
    422                 }
    423             }
    424         }
    425     } else if ($pagesSelect==3){
    426         $showSelect=true;
    427         foreach ($hidePages as $page){
    428             if ($page !== "") {
    429                 if (strpos($currentPage, $page) !== false) {
    430                     $showSelect = false;
    431                 }
    432             }
    433         }
    434     }
    435 
    436     if(!$hideWidget && $showSelect) {
    437         echo $widgetCode;
    438     }
     425    $options = get_option('onwebchat_plugin_option');
     426    $chatId = $options['text_string'];
     427    //$hideWidget = get_option('onwebchat_plugin_option_hide');
     428    $hideWidget = false;
     429
     430    $widgetCode = "<script type='text/javascript'>var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==='undefined'){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement('script'); ga.type = 'text/javascript';ga.async=1;ga.src='//www.onwebchat.com/clientchat/$chatId';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})()}</script>";
     431
     432    $apiCode = get_option('onwebchat_plugin_option_api_code');
     433
     434    $apiCode = str_replace('\\','',$apiCode);
     435
     436    $apiCode =  "<script type='text/javascript'>$apiCode</script>";
     437
     438    $widgetCode .= $apiCode;
     439
     440
     441    //check if user is logged if yes get username, email
     442    if ( is_user_logged_in() ) {
     443
     444        global $current_user;
     445        get_currentuserinfo();
     446
     447        // get user name
     448        $onwebchat_user = $current_user->user_login;
     449
     450        // get user email
     451        $onwebchat_email = $current_user->user_email;
     452
     453        //add api info
     454        if ($onwebchat_user != null && $onwebchat_user != "" && $onwebchat_user != "guest" && $onwebchat_user != "Guest") {
     455            if ($onwebchat_email != null && $onwebchat_email != ""){
     456                $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');
     457                onWebChat.set('email','$onwebchat_email'); </script>";
     458            } else {
     459                $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');</script>";
     460            }
     461        }
     462    }
     463
     464    $currentPage = substr( strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos( strtolower($_SERVER['SERVER_PROTOCOL']), "/") );
     465    $currentPage .= ( empty($_SERVER['HTTPS']) ? NULL : ( ($_SERVER['HTTPS'] == "on") ? "s" : NULL) );
     466    $currentPage .= "://" . $_SERVER['SERVER_NAME'];
     467    $currentPage .= ( $_SERVER['SERVER_PORT'] == 80 ? "" : ":".$_SERVER['SERVER_PORT'] );
     468    $currentPage .= $_SERVER['REQUEST_URI'];
     469
     470    $pagesSelect = get_option('onwebchat_plugin_option_pages_select');
     471    $showPages = get_option('onwebchat_plugin_option_show_pages');
     472    $showPages = explode(' ', $showPages);
     473    $hidePages = get_option('onwebchat_plugin_option_hide_pages');
     474    $hidePages = explode(' ', $hidePages);
     475
     476    $showSelect=true;
     477    if ($pagesSelect==1){
     478
     479    } else if ($pagesSelect==2){
     480        $showSelect=false;
     481        foreach ($showPages as $page){
     482            if ($page !== "") {
     483                if (strpos($currentPage, $page) !== false) {
     484                    $showSelect = true;
     485                }
     486            }
     487        }
     488    } else if ($pagesSelect==3){
     489        $showSelect=true;
     490        foreach ($hidePages as $page){
     491            if ($page !== "") {
     492                if (strpos($currentPage, $page) !== false) {
     493                    $showSelect = false;
     494                }
     495            }
     496        }
     497    } else if($pagesSelect == 4) {
     498        //TODO we hide chat widget from all pages
     499        $hideWidget = true;
     500    }
     501
     502    if(!$hideWidget && $showSelect) {
     503        echo $widgetCode;
     504    }
    439505
    440506}
    441507
    442508/************************************************************************
    443 * display error function
    444 ***********************************************************************/
     509 * display error function
     510 ***********************************************************************/
    445511function onwebchat_login_error($contition = false) {
    446     if($contition) {
    447         ?>
    448         <div class="error">
    449             <p><strong>Wrong credentials!</strong> Please enter correct <u>email and password</u> <strong>OR</strong> a valid <u>Chat Id</u>.</p>
    450         </div>
    451         <?php
    452     }
    453     else {
    454         //display nothing
    455     }
     512    if($contition) {
     513        ?>
     514        <div class="error">
     515            <p><strong>Wrong credentials!</strong> Please enter correct <u>email and password</u> <strong>OR</strong> a valid <u>Chat Id</u>.</p>
     516        </div>
     517        <?php
     518    }
     519    else {
     520        //display nothing
     521    }
    456522}
    457523
    458524/************************************************************************
    459 * Validate Chat Id function
    460 ***********************************************************************/
     525 * Validate Chat Id function
     526 ***********************************************************************/
    461527function isChatIdValid($input) {
    462     return preg_match('/^[a-f0-9]{32,40}+[\\/]?+[0-9]{0,2}+[\\/]?+[0-9]{0,2}$/i', $input);
     528    return preg_match('/^[a-f0-9]{32,40}+[\\/]?+[0-9]{0,2}+[\\/]?+[0-9]{0,2}$/i', $input);
    463529}
    464530
  • onwebchat/tags/3.1.0/readme.txt

    r2301410 r2336842  
    22Contributors: onwebchat_dev
    33Tags: live chat, live support, wordpress live chat, chat, support plugin, online support, live help, online chat, live chat plugin
    4 Tested up to: 5.4.1
     4Tested up to: 5.4.2
    55Stable tag: trunk
    66
     
    5050<li>Hide/show live chat widget on mobiles</li>
    5151<li>Easy File Sharing with your visitors</li>
     52<li>Javascript chat api</li>
    5253<li>Visitor consent (GDPR compliance)</li>
    5354<li>SSL/Data security</li>
     
    123124== Changelog ==
    124125
     126= onWebChat Live Chat (Chat version 3.1.0) =
     127* Javascript api commands support
     128
    125129= onWebChat Live Chat (Chat version 3.0.4) =
    126130* bug fix
  • onwebchat/trunk/onwebchat.php

    r2180552 r2336842  
    55Description: onWebChat is a live chat system, that helps you communicate with your website's visitors.
    66Author: onWebChat
    7 Version: 3.0.5
     7Version: 3.1.0
    88Author URI: https://www.onwebchat.com
    99*/
     
    4545
    4646function onwebchat_setup_menu() {
    47     add_menu_page( 'onWebChat Settings', 'onWebChat', 'administrator', 'onwebchat_settings', 'onwebchat_init_menu_page', ONWEBCHAT_SMALL_LOGO);
     47    add_menu_page( 'onWebChat Settings', 'onWebChat', 'administrator', 'onwebchat_settings', 'onwebchat_init_menu_page', ONWEBCHAT_SMALL_LOGO);
    4848}
    4949
     
    5656
    5757
    58     $options = get_option('onwebchat_plugin_option');
    59     $chatId = $options['text_string'];
    60 
    61     $isConnected = false;
    62     if($chatId !="") {
    63         $isConnected = true;
    64     }
    65 
    66 
    67     /*****************************************************************
    68     * Ask server for chatId
    69     *****************************************************************/
    70     if ( isset( $_POST["action"] ) && $_POST["action"] == "login" ) {
    71 
    72         $options = get_option('onwebchat_plugin_option');
    73         $chatId = $options['text_string'];
    74         //****************************
    75 
    76         // get username, password and chatId
    77         $userName = $_POST["onWebChatUser"];
    78         $userPass = $_POST["onWebChatPass"];
    79         $chatId = $_POST["chatId"];
    80         $isSecondPage = $_POST["isSecondPage"];
    81 
    82         $pagesSelect = $_POST["pages-select"];
    83         $showOnPages = $_POST["showonpages"];
    84         $hideOnPages = $_POST["hideonpages"];
    85 
    86         if(isChatIdValid($chatId)) {
    87 
    88             //----------- update chatId option ------------
    89             $my_options = get_option('onwebchat_plugin_option');
    90 
    91             $my_options['text_string'] = $chatId;
    92 
    93             //Update entire array
    94             update_option('onwebchat_plugin_option', $my_options);
    95             //-----------------------------------------------
    96 
    97             // remove user email from db
    98             if(!$isSecondPage) {
    99                 update_option( 'onwebchat_plugin_option_user', '');
    100                 update_option( 'onwebchat_plugin_option_pages_select', 1);
    101 
    102             } else {
    103 
    104                 update_option( 'onwebchat_plugin_option_pages_select', $pagesSelect);
    105 
    106                 if ($pagesSelect==2){
    107                     update_option( 'onwebchat_plugin_option_show_pages', $showOnPages);
    108                 } else if ($pagesSelect==3){
    109                     update_option( 'onwebchat_plugin_option_hide_pages', $hideOnPages);
    110                 }
    111 
    112             }
    113 
    114             // move to next page
    115             print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    116 
    117         } else {
    118 
    119             // save username at options
    120             update_option( 'onwebchat_plugin_option_user', $userName );
    121 
    122             // ask server for chatId
    123             $response = wp_remote_post(ONWEBCHAT_SERVER_URL, array(
    124                 'method' => 'POST',
    125                 'timeout' => 45,
    126                 'redirection' => 5,
    127                 'httpversion' => '1.0',
    128                 'blocking' => true,
    129                 'headers' => array(),
    130                 'body' => array( 'email' => $userName, 'pass' => $userPass ),
    131                 'cookies' => array()
    132             ));
    133 
    134             if ( is_wp_error( $response ) ) {
    135                 $error_message = $response->get_error_message();
    136 
    137             } else {
    138                 // If no chatId returned
    139                 if($response['body'] == '-1') {
    140                     // display an error for wrong credentials
    141                     onwebchat_login_error(true);
    142 
    143                 } else {
    144 
    145                     //----------- update chatId
    146                     $my_options = get_option('onwebchat_plugin_option');
    147 
    148                     $my_options['text_string'] = $response['body'];
    149 
    150                     update_option('onwebchat_plugin_option', $my_options);
    151                     update_option( 'onwebchat_plugin_option_pages_select', 1);
    152                     //--------------------------------------------
    153 
    154                     // move to next page
    155                     print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    156                 }
    157             }
    158         }
    159 
    160         update_option('onwebchat_plugin_option_hide', $_POST['onwebchat_plugin_option_hide']); //an einai stin proti selida tote to kanei keno (opote by default den einai epilegmeno)
    161     }
    162 
    163     //********************************************************************
    164 
    165 
    166     /*********************************************************************
    167     * Disconnect account
    168     *********************************************************************/
    169     if( isset($_GET["action"]) && $_GET["action"] == "deactivate" && $isConnected) {
    170         $isConnected = false;
    171 
    172         $my_options = get_option('onwebchat_plugin_option');
    173 
    174         $my_options['text_string'] = '';
    175 
    176         update_option('onwebchat_plugin_option', $my_options);
    177         update_option( 'onwebchat_plugin_option_pages_select', 1);
    178 
    179         $chatIdOption = get_option('onwebchat_plugin_option');
    180         $chatId = $chatIdOption['text_string'];
    181 
    182         print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
    183 
    184     }
    185     //***********************************************************************
    186 
    187 
    188 
    189     ?>
    190     <div>
    191         <h2 style="font-size:22px; color:#59808c">onWebChat <?php ($isConnected == true) ? print 'Settings' :  print 'Activation'; ?> </h2>
    192 
    193         <form action="admin.php?page=onwebchat_settings" method="post">
    194             <input type="hidden" name="action" value="login">
    195             <?php
    196 
    197             // Login Page
    198             if($isConnected != true) {
    199 
    200                 $chatId = get_option( 'onwebchat_plugin_option' );
    201                 $chatId = $chatId['text_string'];
    202                 ?>
    203 
    204                 <hr class="small-hr2">
    205 
    206                 <h3 class="header-1">Connect with your onWebChat account</h3>
    207 
    208 
    209 
    210                 <div class="username-div">
    211                     <strong>Email: </strong><input class="username-text-field" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
    212                 </div>
    213                 <div class="password-div">
    214                     <strong>Password: </strong><input class="password-text-field" type="password" name="onWebChatPass" value="<?php echo get_option( 'onWebChatPass' ); ?>"/>
    215                 </div>
    216 
    217                 <div style="width: 560px; height: 10px; border-bottom: 1px solid #bfbfbf; text-align: center; margin-top:30px">
     58    $options = get_option('onwebchat_plugin_option');
     59    $chatId = $options['text_string'];
     60
     61    $isConnected = false;
     62    if($chatId !="") {
     63        $isConnected = true;
     64    }
     65
     66    $isSecondPage = false;
     67
     68
     69    /*****************************************************************
     70     * Ask server for chatId
     71     *****************************************************************/
     72    if ( isset( $_POST["action"] ) && $_POST["action"] == "login" ) {
     73
     74        $options = get_option('onwebchat_plugin_option');
     75        $chatId = $options['text_string'];
     76        //****************************
     77
     78        // get username, password and chatId
     79        $userName = $_POST["onWebChatUser"];
     80
     81        if(isset($_POST["onWebChatPass"])) {
     82            $userPass = $_POST["onWebChatPass"];
     83        }
     84
     85        $chatId = $_POST["chatId"];
     86
     87
     88        if( isset($_POST["pages-select"])) {
     89            $pagesSelect = $_POST["pages-select"];
     90        }
     91
     92        if( isset($_POST["showonpages"])) {
     93            $showOnPages = $_POST["showonpages"];
     94        }
     95
     96        if(isset($_POST["hideonpages"])) {
     97            $hideOnPages = $_POST["hideonpages"];
     98        }
     99
     100        if(isset($_POST["onwebchat-api"])) {
     101            $onwebchatApi = $_POST["onwebchat-api"];
     102        }
     103
     104
     105        if(isChatIdValid($chatId)) {
     106
     107            if ( isset($_POST["isSecondPage"])){
     108                $isSecondPage = $_POST["isSecondPage"];
     109            }
     110
     111            //----------- update chatId option ------------
     112            $my_options = get_option('onwebchat_plugin_option');
     113
     114            $my_options['text_string'] = $chatId;
     115
     116            //Update entire array
     117            update_option('onwebchat_plugin_option', $my_options);
     118            //-----------------------------------------------
     119
     120            // remove user email from db
     121            if(!$isSecondPage) {
     122                update_option( 'onwebchat_plugin_option_user', '');
     123                update_option( 'onwebchat_plugin_option_pages_select', 1);
     124
     125            } else {
     126
     127                update_option( 'onwebchat_plugin_option_pages_select', $pagesSelect);
     128
     129                if ($pagesSelect==2){
     130                    update_option( 'onwebchat_plugin_option_show_pages', $showOnPages);
     131                } else if ($pagesSelect==3){
     132                    update_option( 'onwebchat_plugin_option_hide_pages', $hideOnPages);
     133                }
     134
     135                //TODO update textarea
     136                update_option( 'onwebchat_plugin_option_api_code', $onwebchatApi);
     137            }
     138
     139            // move to next page
     140            print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     141
     142        } else {
     143
     144            // save username at options
     145            update_option( 'onwebchat_plugin_option_user', $userName );
     146
     147            // ask server for chatId
     148            $response = wp_remote_post(ONWEBCHAT_SERVER_URL, array(
     149                'method' => 'POST',
     150                'timeout' => 45,
     151                'redirection' => 5,
     152                'httpversion' => '1.0',
     153                'blocking' => true,
     154                'headers' => array(),
     155                'body' => array( 'email' => $userName, 'pass' => $userPass ),
     156                'cookies' => array()
     157            ));
     158
     159            if ( is_wp_error( $response ) ) {
     160                $error_message = $response->get_error_message();
     161
     162            } else {
     163                // If no chatId returned
     164                if($response['body'] == '-1') {
     165                    // display an error for wrong credentials
     166                    onwebchat_login_error(true);
     167
     168                } else {
     169
     170                    //----------- update chatId
     171                    $my_options = get_option('onwebchat_plugin_option');
     172
     173                    $my_options['text_string'] = $response['body'];
     174
     175                    update_option('onwebchat_plugin_option', $my_options);
     176                    update_option( 'onwebchat_plugin_option_pages_select', 1);
     177                    //--------------------------------------------
     178
     179                    // move to next page
     180                    print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     181                }
     182            }
     183        }
     184
     185        $m_option_hide = false;
     186        if(isset($_POST['onwebchat_plugin_option_hide'])) {
     187            $m_option_hide = $_POST['onwebchat_plugin_option_hide'];
     188        }
     189
     190        update_option('onwebchat_plugin_option_hide', $m_option_hide); //an einai stin proti selida tote to kanei keno (opote by default den einai epilegmeno)
     191
     192    }
     193
     194    //********************************************************************
     195
     196
     197    /*********************************************************************
     198     * Disconnect account
     199     *********************************************************************/
     200    if( isset($_GET["action"]) && $_GET["action"] == "deactivate" && $isConnected) {
     201        $isConnected = false;
     202
     203        $my_options = get_option('onwebchat_plugin_option');
     204
     205        $my_options['text_string'] = '';
     206
     207        update_option('onwebchat_plugin_option', $my_options);
     208        update_option( 'onwebchat_plugin_option_pages_select', 1);
     209
     210        $chatIdOption = get_option('onwebchat_plugin_option');
     211        $chatId = $chatIdOption['text_string'];
     212
     213        print('<script>window.location.href="admin.php?page=onwebchat_settings"</script>');
     214
     215    }
     216    //***********************************************************************
     217
     218
     219
     220    ?>
     221    <div>
     222        <h2 style="font-size:22px; color:#59808c">onWebChat <?php ($isConnected == true) ? print 'Settings' :  print 'Activation'; ?> </h2>
     223
     224        <form action="admin.php?page=onwebchat_settings" method="post">
     225            <input type="hidden" name="action" value="login">
     226            <?php
     227
     228            // Login Page
     229            if($isConnected != true) {
     230
     231                $chatId = get_option( 'onwebchat_plugin_option' );
     232                $chatId = $chatId['text_string'];
     233                ?>
     234
     235                <hr class="small-hr2">
     236
     237                <h3 class="header-1">Connect with your onWebChat account</h3>
     238
     239
     240
     241                <div class="username-div">
     242                    <strong>Email: </strong><input class="username-text-field" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
     243                </div>
     244                <div class="password-div">
     245                    <strong>Password: </strong><input class="password-text-field" type="password" name="onWebChatPass" value="<?php echo get_option( 'onWebChatPass' ); ?>"/>
     246                </div>
     247
     248                <div style="width: 560px; height: 10px; border-bottom: 1px solid #bfbfbf; text-align: center; margin-top:30px">
    218249                    <span class="header-or" style="font-size: 23px; background-color: #f1f1f1; padding: 0 10px;">
    219250                        OR
    220251                    </span>
    221                 </div>
    222 
    223 
    224                 <h3 class="header-2">Paste your onWebChat Chat Id</h3>
    225                 <div class="chatid-div">
    226                     <strong>Chat Id:</strong> <input class="chatid-text-field" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
    227                 </div>
    228 
    229                 <hr class="small-hr2">
    230 
    231                 <div class="new-account-link">
    232                     <span class="info-star">*</span> If you don't have an account on onWebChat live chat service, you should create one <a href="https://www.onwebchat.com/signup.php" target="_blank">here</a>
    233                 </div>
    234 
    235 
    236                 <?php
    237             }
    238 
    239             // 2nd Page
    240             else {
    241                 $options = get_option('onwebchat_plugin_option_user');
    242 
    243                 // display user email
    244                 if($options!=''){
    245                     $html = '<br><h3 class="header-1-p2">Activated for onWebChat account: </h3>';
    246                     $html .= "<strong class='account-id'>$options</strong> ";
    247                 }
    248 
    249                 // display chatId
    250                 else {
    251                     $chatId = get_option( 'onwebchat_plugin_option' );
    252                     $chatId = $chatId['text_string'];
    253                     $html = '<br><h3 class="header-1-p2">Activated for onWebChat Chat Id: </h3>';
    254                     $html .= "<strong class='account-id'>$chatId</strong> ";
    255                 }
    256                 $html .= ' <a href="admin.php?page=onwebchat_settings&amp;action=deactivate">Deactivate</a>';
    257                 $html .= ' <div class="admin-login-info"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>';
    258                 echo $html;
    259 
    260                 $options = get_option('onwebchat_plugin_option_hide');
    261 
    262                 $chatId = get_option( 'onwebchat_plugin_option' );
    263                 $chatId = $chatId['text_string'];
    264 
    265                 ?>
    266                 <div class="hide-div">
    267                     <strong>Hide Chat Widget:</strong> <input type="checkbox" id="plugin_text_checkbox" name="onwebchat_plugin_option_hide" value="1" <?php checked( $options, 1 ); ?> />
    268                 </div>
    269 
    270                 <div class="hide-div">
    271                     <select id="pages-select" name="pages-select" onchange="onwc_select_change()">
    272                         <option value="1" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 1 ); ?>>Show chat widget on all pages</option>
    273                         <option value="2" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 2 ); ?>>Show on the following pages:</option>
    274                         <option value="3" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 3 ); ?>>Hide on the following pages:</option>
    275                     </select>
    276                 </div>
    277 
    278                 <div id="onwc_show_on_pages_div" style="display:none">
    279                     <input id="showonpages" name="showonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_show_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
    280                 </div>
    281                 <div id="onwc_hide_on_pages_div" style="display:none">
    282                     <input id="hideonpages" name="hideonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_hide_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
    283                 </div>
    284 
    285                 <div id="help">
    286                     <span>You can insert multiple pages seperated by space. You can insert a part of the page or URL. e.g. &nbsp; index pric contact.php blog/</span>
    287                 </div>
    288 
    289                 <div>
    290                     <br /><br />
    291                 </div>
    292 
    293                 <!-- hiden fields -->
    294                 <input class="chatid-text-field-hide" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
    295                 <input class="chatid-text-field-hide" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
    296                 <input class="chatid-text-field-hide" type="text" name="isSecondPage" value="1"/>
    297                 <?php
    298             }
    299 
    300             // Display the Save Button
    301             $html = '<input class="button button-primary" style="margin-left: 230px;" type="submit" value="Save Changes"/>';
    302             echo $html;
    303             ?>
    304         </form>
    305     </div>
    306 
    307     <script type="text/javascript">
    308 
    309 
    310     function onwc_select_change() {
    311         var e = document.getElementById("pages-select");
    312         var selected = e.options[e.selectedIndex].value;
    313         if (selected==1){
    314             document.getElementById("onwc_show_on_pages_div").style.display = "none";
    315             document.getElementById("onwc_hide_on_pages_div").style.display = "none";
    316         } else if (selected==2){
    317             document.getElementById("onwc_show_on_pages_div").style.display = "block";
    318             document.getElementById("onwc_hide_on_pages_div").style.display = "none";
    319         } else if (selected==3){
    320             document.getElementById("onwc_show_on_pages_div").style.display = "none";
    321             document.getElementById("onwc_hide_on_pages_div").style.display = "block";
    322         }
    323 
    324     }
    325     document.addEventListener('DOMContentLoaded', function() {
    326        onwc_select_change();
    327     }, false);
    328 </script>
    329 <?php
     252                </div>
     253
     254
     255                <h3 class="header-2">Paste your onWebChat Chat Id</h3>
     256                <div class="chatid-div">
     257                    <strong>Chat Id:</strong> <input class="chatid-text-field" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
     258                </div>
     259
     260                <hr class="small-hr2">
     261
     262                <div class="new-account-link">
     263                    <span class="info-star">*</span> If you don't have an account on onWebChat live chat service, you should create one <a href="https://www.onwebchat.com/signup.php" target="_blank">here</a>
     264                </div>
     265
     266
     267                <?php
     268            }
     269
     270            // 2nd Page
     271            else {
     272                $options = get_option('onwebchat_plugin_option_user');
     273
     274                // display user email
     275                if($options!=''){
     276                    $html = '<br><h3 class="header-1-p2">Activated for onWebChat account: </h3>';
     277                    $html .= "<strong class='account-id'>$options</strong> ";
     278                }
     279
     280                // display chatId
     281                else {
     282                    $chatId = get_option( 'onwebchat_plugin_option' );
     283                    $chatId = $chatId['text_string'];
     284                    $html = '<br><h3 class="header-1-p2">Activated for onWebChat Chat Id: </h3>';
     285                    $html .= "<strong class='account-id'>$chatId</strong> ";
     286                }
     287                $html .= ' <a href="admin.php?page=onwebchat_settings&amp;action=deactivate">Deactivate</a>';
     288                //$html .= ' <div class="admin-login-info"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>';
     289                echo $html;
     290
     291                $options = get_option('onwebchat_plugin_option_hide');
     292
     293                $chatId = get_option( 'onwebchat_plugin_option' );
     294                $chatId = $chatId['text_string'];
     295
     296                //TODO get correct value
     297                $onwebchatApi = get_option('onwebchat_plugin_option_api_code');
     298                $onwebchatApi = str_replace('\\','',$onwebchatApi);
     299                ?>
     300                <!--                <div class="hide-div">-->
     301                <!--                    <strong>Hide Chat Widget:</strong> <input type="checkbox" id="plugin_text_checkbox" name="onwebchat_plugin_option_hide" value="1" --><?php //checked( $options, 1 ); ?><!-- />-->
     302                <!--                </div>-->
     303
     304
     305
     306                <div class="hide-div">
     307                    <select id="pages-select" name="pages-select" onchange="onwc_select_change()">
     308                        <option value="1" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 1 ); ?>>Show chat widget on all pages</option>
     309                        <option value="2" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 2 ); ?>>Show on the following pages:</option>
     310                        <option value="3" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 3 ); ?>>Hide on the following pages:</option>
     311                        <option value="4" <?php selected( get_option('onwebchat_plugin_option_pages_select'), 4 ); ?>>Hide chat widget from all pages:</option>
     312                    </select>
     313                </div>
     314
     315                <div id="onwc_show_on_pages_div" style="display:none">
     316                    <input id="showonpages" name="showonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_show_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
     317                </div>
     318                <div id="onwc_hide_on_pages_div" style="display:none">
     319                    <input id="hideonpages" name="hideonpages" class="showhidepages" type="text" value="<?php echo get_option( 'onwebchat_plugin_option_hide_pages' ); ?>" /><a href="#" style="text-decoration: none;" onmouseover="document.getElementById('help').style.visibility = 'visible'"; ONMOUSEOUT="document.getElementById('help').style.visibility = 'hidden'"><strong><font size="4" face="Arial"> ? </font></strong></a>
     320                </div>
     321
     322                <div id="help">
     323                    <span>You can insert multiple pages seperated by space. You can insert a part of the page or URL. e.g. &nbsp; index pric contact.php blog/</span>
     324                </div>
     325
     326                <h3 class="header-2">Write your onWebChat Chat API code</h3>
     327                <div class="chatid-div">
     328                    <strong>onWebChat API:</strong>
     329                    <br>
     330                    <textarea class="chatid-text-field" style="margin-left: 0px;" rows="10" name="onwebchat-api"><?php echo $onwebchatApi; ?></textarea>
     331                    <br>
     332                    <br>
     333                </div>
     334
     335                <div>
     336                    <br /><br />
     337                </div>
     338
     339                <!-- hiden fields -->
     340                <input class="chatid-text-field-hide" type="text" name="chatId" value="<?php echo $chatId; ?>"/>
     341                <input class="chatid-text-field-hide" type="text" name="onWebChatUser" value="<?php echo get_option( 'onwebchat_plugin_option_user' ); ?>"/>
     342                <input class="chatid-text-field-hide" type="text" name="isSecondPage" value="1"/>
     343
     344                <div class="new-account-link"> <span>*</span> To connect to onWebChat Operator Console click <a target="_blank" href="https://www.onwebchat.com/login.php">here</a> </div>
     345                <?php
     346
     347
     348            }
     349
     350            // Display the Save Button
     351            $html = '<input class="button button-primary" style="margin-left: 230px;" type="submit" value="Save Changes"/>';
     352            echo $html;
     353            ?>
     354        </form>
     355    </div>
     356
     357    <script type="text/javascript">
     358
     359
     360        function onwc_select_change() {
     361            var e = document.getElementById("pages-select");
     362            var selected = e.options[e.selectedIndex].value;
     363            if (selected == 1){
     364                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     365                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     366            } else if (selected == 2){
     367                document.getElementById("onwc_show_on_pages_div").style.display = "block";
     368                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     369            } else if (selected == 3){
     370                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     371                document.getElementById("onwc_hide_on_pages_div").style.display = "block";
     372            } else if (selected == 4){
     373                document.getElementById("onwc_show_on_pages_div").style.display = "none";
     374                document.getElementById("onwc_hide_on_pages_div").style.display = "none";
     375            }
     376
     377        }
     378        document.addEventListener('DOMContentLoaded', function() {
     379            onwc_select_change();
     380        }, false);
     381    </script>
     382    <?php
    330383}
    331384
     
    336389
    337390function register_plugin_styles() {
    338     wp_register_style( 'onwebchat', plugins_url( 'onwebchat/css/onwebchat.css' ) );
    339     wp_enqueue_style( 'onwebchat' );
     391    wp_register_style( 'onwebchat', plugins_url( 'onwebchat/css/onwebchat.css' ) );
     392    wp_enqueue_style( 'onwebchat' );
    340393}
    341394
     
    347400function onwebchat_register_setttings() {
    348401
    349     /******************** Account Tab ************************/
    350     //* register the Chat Id
    351     register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option');
    352 
    353     //* register the username
    354     register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_user');
    355 
    356     //* register the hide (checkbox)
    357     register_setting( 'onwebchat_plugin_option_checkbox', 'onwebchat_plugin_option_hide');
     402    /******************** Account Tab ************************/
     403    //* register the Chat Id
     404    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option');
     405
     406    //* register the username
     407    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_user');
     408
     409    //* register the hide (checkbox)
     410    register_setting( 'onwebchat_plugin_option_checkbox', 'onwebchat_plugin_option_hide');
     411
     412    //TODO api code
     413    //* register the api code
     414    register_setting( 'onwebchat_plugin_option', 'onwebchat_plugin_option_api_code');
    358415}
    359416
     
    366423function onwebchat_add_script_at_footer() {
    367424
    368     $options = get_option('onwebchat_plugin_option');
    369     $chatId = $options['text_string'];
    370     $hideWidget = get_option('onwebchat_plugin_option_hide');
    371 
    372     $widgetCode = "<script type='text/javascript'>var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==='undefined'){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement('script'); ga.type = 'text/javascript';ga.async=1;ga.src='//www.onwebchat.com/clientchat/$chatId';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})()}</script>";
    373 
    374     $apiCode = get_option('onwebchat_plugin_option_api');
    375 
    376     $widgetCode .= $apiCode;
    377 
    378 
    379     //check if user is logged if yes get username, email
    380     if ( is_user_logged_in() ) {
    381 
    382         global $current_user;
    383         get_currentuserinfo();
    384 
    385         // get user name
    386         $onwebchat_user = $current_user->user_login;
    387 
    388         // get user email
    389         $onwebchat_email = $current_user->user_email;
    390 
    391         //add api info
    392         if ($onwebchat_user != null && $onwebchat_user != "" && $onwebchat_user != "guest" && $onwebchat_user != "Guest") {
    393             if ($onwebchat_email != null && $onwebchat_email != ""){
    394                 $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');onWebChat.set('email','$onwebchat_email'); </script>";
    395             } else {
    396                 $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');</script>";
    397             }
    398         }
    399     }
    400 
    401     $currentPage = substr( strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos( strtolower($_SERVER['SERVER_PROTOCOL']), "/") );
    402     $currentPage .= ( empty($_SERVER['HTTPS']) ? NULL : ( ($_SERVER['HTTPS'] == "on") ? "s" : NULL) );
    403     $currentPage .= "://" . $_SERVER['SERVER_NAME'];
    404     $currentPage .= ( $_SERVER['SERVER_PORT'] == 80 ? "" : ":".$_SERVER['SERVER_PORT'] );
    405     $currentPage .= $_SERVER['REQUEST_URI'];
    406 
    407     $pagesSelect = get_option('onwebchat_plugin_option_pages_select');
    408     $showPages = get_option('onwebchat_plugin_option_show_pages');
    409     $showPages = explode(' ', $showPages);
    410     $hidePages = get_option('onwebchat_plugin_option_hide_pages');
    411     $hidePages = explode(' ', $hidePages);
    412 
    413     $showSelect=true;
    414     if ($pagesSelect==1){
    415 
    416     } else if ($pagesSelect==2){
    417         $showSelect=false;
    418         foreach ($showPages as $page){
    419             if ($page !== "") {
    420                 if (strpos($currentPage, $page) !== false) {
    421                     $showSelect = true;
    422                 }
    423             }
    424         }
    425     } else if ($pagesSelect==3){
    426         $showSelect=true;
    427         foreach ($hidePages as $page){
    428             if ($page !== "") {
    429                 if (strpos($currentPage, $page) !== false) {
    430                     $showSelect = false;
    431                 }
    432             }
    433         }
    434     }
    435 
    436     if(!$hideWidget && $showSelect) {
    437         echo $widgetCode;
    438     }
     425    $options = get_option('onwebchat_plugin_option');
     426    $chatId = $options['text_string'];
     427    //$hideWidget = get_option('onwebchat_plugin_option_hide');
     428    $hideWidget = false;
     429
     430    $widgetCode = "<script type='text/javascript'>var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==='undefined'){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement('script'); ga.type = 'text/javascript';ga.async=1;ga.src='//www.onwebchat.com/clientchat/$chatId';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})()}</script>";
     431
     432    $apiCode = get_option('onwebchat_plugin_option_api_code');
     433
     434    $apiCode = str_replace('\\','',$apiCode);
     435
     436    $apiCode =  "<script type='text/javascript'>$apiCode</script>";
     437
     438    $widgetCode .= $apiCode;
     439
     440
     441    //check if user is logged if yes get username, email
     442    if ( is_user_logged_in() ) {
     443
     444        global $current_user;
     445        get_currentuserinfo();
     446
     447        // get user name
     448        $onwebchat_user = $current_user->user_login;
     449
     450        // get user email
     451        $onwebchat_email = $current_user->user_email;
     452
     453        //add api info
     454        if ($onwebchat_user != null && $onwebchat_user != "" && $onwebchat_user != "guest" && $onwebchat_user != "Guest") {
     455            if ($onwebchat_email != null && $onwebchat_email != ""){
     456                $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');
     457                onWebChat.set('email','$onwebchat_email'); </script>";
     458            } else {
     459                $widgetCode = $widgetCode."<script type='text/javascript'>onWebChat.set('name','$onwebchat_user');</script>";
     460            }
     461        }
     462    }
     463
     464    $currentPage = substr( strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos( strtolower($_SERVER['SERVER_PROTOCOL']), "/") );
     465    $currentPage .= ( empty($_SERVER['HTTPS']) ? NULL : ( ($_SERVER['HTTPS'] == "on") ? "s" : NULL) );
     466    $currentPage .= "://" . $_SERVER['SERVER_NAME'];
     467    $currentPage .= ( $_SERVER['SERVER_PORT'] == 80 ? "" : ":".$_SERVER['SERVER_PORT'] );
     468    $currentPage .= $_SERVER['REQUEST_URI'];
     469
     470    $pagesSelect = get_option('onwebchat_plugin_option_pages_select');
     471    $showPages = get_option('onwebchat_plugin_option_show_pages');
     472    $showPages = explode(' ', $showPages);
     473    $hidePages = get_option('onwebchat_plugin_option_hide_pages');
     474    $hidePages = explode(' ', $hidePages);
     475
     476    $showSelect=true;
     477    if ($pagesSelect==1){
     478
     479    } else if ($pagesSelect==2){
     480        $showSelect=false;
     481        foreach ($showPages as $page){
     482            if ($page !== "") {
     483                if (strpos($currentPage, $page) !== false) {
     484                    $showSelect = true;
     485                }
     486            }
     487        }
     488    } else if ($pagesSelect==3){
     489        $showSelect=true;
     490        foreach ($hidePages as $page){
     491            if ($page !== "") {
     492                if (strpos($currentPage, $page) !== false) {
     493                    $showSelect = false;
     494                }
     495            }
     496        }
     497    } else if($pagesSelect == 4) {
     498        //TODO we hide chat widget from all pages
     499        $hideWidget = true;
     500    }
     501
     502    if(!$hideWidget && $showSelect) {
     503        echo $widgetCode;
     504    }
    439505
    440506}
    441507
    442508/************************************************************************
    443 * display error function
    444 ***********************************************************************/
     509 * display error function
     510 ***********************************************************************/
    445511function onwebchat_login_error($contition = false) {
    446     if($contition) {
    447         ?>
    448         <div class="error">
    449             <p><strong>Wrong credentials!</strong> Please enter correct <u>email and password</u> <strong>OR</strong> a valid <u>Chat Id</u>.</p>
    450         </div>
    451         <?php
    452     }
    453     else {
    454         //display nothing
    455     }
     512    if($contition) {
     513        ?>
     514        <div class="error">
     515            <p><strong>Wrong credentials!</strong> Please enter correct <u>email and password</u> <strong>OR</strong> a valid <u>Chat Id</u>.</p>
     516        </div>
     517        <?php
     518    }
     519    else {
     520        //display nothing
     521    }
    456522}
    457523
    458524/************************************************************************
    459 * Validate Chat Id function
    460 ***********************************************************************/
     525 * Validate Chat Id function
     526 ***********************************************************************/
    461527function isChatIdValid($input) {
    462     return preg_match('/^[a-f0-9]{32,40}+[\\/]?+[0-9]{0,2}+[\\/]?+[0-9]{0,2}$/i', $input);
     528    return preg_match('/^[a-f0-9]{32,40}+[\\/]?+[0-9]{0,2}+[\\/]?+[0-9]{0,2}$/i', $input);
    463529}
    464530
  • onwebchat/trunk/readme.txt

    r2301410 r2336842  
    22Contributors: onwebchat_dev
    33Tags: live chat, live support, wordpress live chat, chat, support plugin, online support, live help, online chat, live chat plugin
    4 Tested up to: 5.4.1
     4Tested up to: 5.4.2
    55Stable tag: trunk
    66
     
    5050<li>Hide/show live chat widget on mobiles</li>
    5151<li>Easy File Sharing with your visitors</li>
     52<li>Javascript chat api</li>
    5253<li>Visitor consent (GDPR compliance)</li>
    5354<li>SSL/Data security</li>
     
    123124== Changelog ==
    124125
     126= onWebChat Live Chat (Chat version 3.1.0) =
     127* Javascript api commands support
     128
    125129= onWebChat Live Chat (Chat version 3.0.4) =
    126130* bug fix
Note: See TracChangeset for help on using the changeset viewer.