Plugin Directory

Changeset 1890469


Ignore:
Timestamp:
06/10/2018 02:29:55 PM (8 years ago)
Author:
wpdugi
Message:

minor update

Location:
overtok/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • overtok/trunk/overtok-init.php

    r1861993 r1890469  
    44Plugin URI: https://overtok.com
    55Description: This plugin will allow you to put your Overtok button on your website
    6 Author: Dagan Yaakov
    7 Version: 0.3
    8 Author URI: http://wp.dugi.co.il/
     6Author: overtok
     7Version: 0.4
     8Author URI: https://overtok.com/
    99*/
    1010
     
    1212    const OPTION_PREFIX = 'overtok_';
    1313    const A_SLUG_PREFIX = 'o5k_';
    14     const WEB_SDK_SRC   = 'https://assets.overtok-qa.com/web-sdk/overtok.js';
     14    const WEB_SDK_SRC   = ['https://assets.overtok.com/web-sdk/overtok.js','https://assets.overtok-qa.com/web-sdk/overtok.js'];
    1515   
    1616    private static $instance = null;
    1717   
     18    private $web_sdk_src = '';
    1819   
    1920    static function init() {
     
    2728   
    2829    private function __construct() {
     30        $this->web_sdk_src = (!empty(SELF::WEB_SDK_SRC[0])) ? SELF::WEB_SDK_SRC[0] : '';
     31       
    2932        add_action( 'admin_menu', [$this,'add_options_page'] );
    3033        add_action( 'admin_init', [$this,'save_options_page'] );
     
    3740        return get_option(self::OPTION_PREFIX .'global_code');
    3841    }
     42   
     43    public function get_overtok_code_sdk(){
     44       
     45        $sdk_i = (int)get_option(self::OPTION_PREFIX .'global_code_sdk_i');
     46       
     47        if (array_key_exists($sdk_i,SELF::WEB_SDK_SRC))
     48            $this->web_sdk_src = SELF::WEB_SDK_SRC[$sdk_i];
     49       
     50       
     51        return $this->web_sdk_src;
     52    }
     53   
    3954
    4055    public function build_overtok_script(){
     
    4358       
    4459        if ($code){
    45             $js_src = (defined('OVERTOK_WEB_SDK_SRC')) ? OVERTOK_WEB_SDK_SRC : self::WEB_SDK_SRC;
     60            $js_src = (defined('OVERTOK_WEB_SDK_SRC')) ? OVERTOK_WEB_SDK_SRC : $this->get_overtok_code_sdk();
    4661            return "<script>!function(){var e=function(){{$code}},t=document.createElement('script');t.type='text/javascript',t.src='{$js_src}',t.onreadystatechange=e,t.onload=e,document.getElementsByTagName('head')[0].appendChild(t)}();</script>";
    4762        }
     
    6176    public function embed_code_block(){
    6277        $overtok_method = get_option(self::OPTION_PREFIX .'global_method');
     78       
    6379       
    6480        if ($overtok_method == 'footer'){
     
    125141            }else{
    126142                update_option( self::OPTION_PREFIX .'global_code', $overtok_code );
     143               
     144                foreach ((array)SELF::WEB_SDK_SRC as $k=>$v){
     145                   
     146                    if( strpos( $_POST['overtok_code'], $v ) !== false )
     147                        update_option( self::OPTION_PREFIX .'global_code_sdk_i', $k );
     148                   
     149                   
     150                }
    127151            }
    128152           
  • overtok/trunk/readme.txt

    r1884403 r1890469  
    8282
    8383= Are call recorded? =
    84 Yes! You can easily listen to all conversations with your customers and even see a copy of your text messages in the business app.
     84Yes! we'll launch this option soon. stay tuned.
Note: See TracChangeset for help on using the changeset viewer.