Changeset 1499694
- Timestamp:
- 09/21/2016 01:43:00 PM (10 years ago)
- Location:
- talkus
- Files:
-
- 3 added
- 2 edited
-
tags/1.0 (added)
-
tags/1.0/readme.txt (added)
-
tags/1.0/talkus.php (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/talkus.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
talkus/trunk/readme.txt
r1368262 r1499694 2 2 Contributors: perenoel, acemtp 3 3 Tags: livechat, talkus, support, plugin, widget, customer support, slack, help desk, helpdesk, chat, email, sms, phone 4 Stable tag: 0.44 Stable tag: 1.0 5 5 Requires at least: 4.2 6 6 Tested up to: 4.2.2 -
talkus/trunk/talkus.php
r1368257 r1499694 5 5 * Plugin URI: https://github.com/peernohell/wp-talkus 6 6 * 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.47 * Version: 1.0 8 8 * Author: Francois Lecroart / Talkus 9 9 **/ … … 20 20 var $db_version = 1; 21 21 22 function __construct() {22 function __construct() { 23 23 //add frontend wp_head hook 24 24 add_action( 'wp_head', array( $this, 'wp_head' ) ); … … 30 30 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 31 31 32 // Setting plugin defaults here:32 // Setting plugin defaults here: 33 33 $this->option_defaults = array( 34 34 'appId' => '', 35 'db_version' => $this->db_version,36 );35 'db_version' => $this->db_version, 36 ); 37 37 38 38 } … … 40 40 function wp_head() { 41 41 42 // Get options43 $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 ); 44 44 45 if ( isset ( $this->options['appId'] ) ) {45 if ( isset ( $this->options['appId'] ) ) { 46 46 47 $this->options['appId'] = esc_attr( $this->options['appId'] );47 $this->options['appId'] = esc_attr( $this->options['appId'] ); 48 48 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"); 51 51 52 talkus(" create", "' . $this->options['appId'] . '");52 talkus("init", "' . $this->options['appId'] . '"); 53 53 </script>'; 54 }54 } 55 55 } 56 56 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 ); 60 60 61 // Register Settings61 // Register Settings 62 62 $this->register_settings(); 63 63 } 64 64 65 function admin_menu() {65 function admin_menu() { 66 66 add_management_page( __('Talkus'), __('Talkus'), 'manage_options', 'talkus-settings', array( $this, 'talkus_settings' ) ); 67 67 } 68 68 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' ) ); 71 71 72 72 // The main section … … 100 100 101 101 function talkus_sanitize($input) { 102 $options = $this->options;102 $options = $this->options; 103 103 104 $input['db_version'] = $this->db_version;104 $input['db_version'] = $this->db_version; 105 105 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 } 109 109 110 110 return $output; … … 118 118 return $links; 119 119 } 120 121 120 } 122 121
Note: See TracChangeset
for help on using the changeset viewer.