Plugin Directory

Changeset 1499694


Ignore:
Timestamp:
09/21/2016 01:43:00 PM (10 years ago)
Author:
perenoel
Message:

Update to beta + tag 1.0

Location:
talkus
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • talkus/trunk/readme.txt

    r1368262 r1499694  
    22Contributors: perenoel, acemtp
    33Tags: livechat, talkus, support, plugin, widget, customer support, slack, help desk, helpdesk, chat, email, sms, phone
    4 Stable tag: 0.4
     4Stable tag: 1.0
    55Requires at least: 4.2
    66Tested up to: 4.2.2
  • talkus/trunk/talkus.php

    r1368257 r1499694  
    55 *  Plugin URI: https://github.com/peernohell/wp-talkus
    66 *  Description: With Talkus, Slack becomes the place for your team to communicate with customers, personally, on your website by live chat or by email, phone or SMS.
    7  *  Version: 0.4
     7 *  Version: 1.0
    88 *  Author: Francois Lecroart / Talkus
    99 **/
     
    2020    var $db_version = 1;
    2121
    22   function __construct() {
     22    function __construct() {
    2323        //add frontend wp_head hook
    2424        add_action( 'wp_head', array( $this, 'wp_head' ) );
     
    3030        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
    3131
    32     // Setting plugin defaults here:
     32        // Setting plugin defaults here:
    3333        $this->option_defaults = array(
    3434            'appId' => '',
    35       'db_version' => $this->db_version,
    36     );
     35            'db_version' => $this->db_version,
     36        );
    3737
    3838    }
     
    4040    function wp_head() {
    4141
    42     // Get options
    43     $this->options = wp_parse_args( get_option( 'talkus_options' ), $this->option_defaults );
     42        // Get options
     43        $this->options = wp_parse_args( get_option( 'talkus_options' ), $this->option_defaults );
    4444
    45     if ( isset ( $this->options['appId'] ) ) {
     45        if ( isset ( $this->options['appId'] ) ) {
    4646
    47         $this->options['appId'] = esc_attr( $this->options['appId'] );
     47            $this->options['appId'] = esc_attr( $this->options['appId'] );
    4848
    49         echo '<script type="text/javascript">
    50             (function(t,a,l,k,u,s,_){if(!t[u]){t[u]=function(){(t[u].q=t[u].q||[]).push(arguments)},t[u].l=1*new Date();s=a.createElement(l),_=a.getElementsByTagName(l)[0];s.async=1;s.src=k;_.parentNode.insertBefore(s,_)}})(window,document,"script","//www.talkus.io/plugin.js","talkus");
     49                echo '<script type="text/javascript">
     50                (function(t,a,l,k,u,s,e){if(!t[u]){t[u]=function(){(t[u].q=t[u].q||[]).push(arguments)},t[u].l=1*new Date();s=a.createElement(l),e=a.getElementsByTagName(l)[0];s.async=1;s.src=k;e.parentNode.insertBefore(s,e)}})(window,document,"script","//www.talkus.io/plugin.beta.js","talkus");
    5151
    52             talkus("create", "' . $this->options['appId'] . '");
     52            talkus("init", "' . $this->options['appId'] . '");
    5353            </script>';
    54     }
     54        }
    5555    }
    5656
    57   function admin_init() {
    58     //Fetch and set up options.
    59     $this->options = wp_parse_args( get_option( 'talkus_options' ), $this->option_defaults );
     57    function admin_init() {
     58        //Fetch and set up options.
     59        $this->options = wp_parse_args( get_option( 'talkus_options' ), $this->option_defaults );
    6060
    61     // Register Settings
     61        // Register Settings
    6262        $this->register_settings();
    6363    }
    6464
    65   function admin_menu() {
     65    function admin_menu() {
    6666        add_management_page( __('Talkus'), __('Talkus'), 'manage_options', 'talkus-settings', array( $this, 'talkus_settings' ) );
    6767    }
    6868
    69   function register_settings() {
    70     register_setting( 'talkus', 'talkus_options', array( $this, 'talkus_sanitize' ) );
     69    function register_settings() {
     70        register_setting( 'talkus', 'talkus_options', array( $this, 'talkus_sanitize' ) );
    7171
    7272        // The main section
     
    100100
    101101    function talkus_sanitize($input) {
    102     $options = $this->options;
     102        $options = $this->options;
    103103
    104     $input['db_version'] = $this->db_version;
     104        $input['db_version'] = $this->db_version;
    105105
    106     foreach ($options as $key=>$value) {
    107       $output[$key] = sanitize_text_field($input[$key]);
    108     }
     106        foreach ($options as $key=>$value) {
     107            $output[$key] = sanitize_text_field($input[$key]);
     108        }
    109109
    110110        return $output;
     
    118118        return $links;
    119119    }
    120 
    121120}
    122121
Note: See TracChangeset for help on using the changeset viewer.