示例#1
0
    public function wp_footer()
    {
        $settings = WPHTSettings::getSettings();
        if ($settings['token'] != '') {
            if ($settings['latest'] == "1" || $settings['latest'] == "") {
                $url = "http://api.handtalk.me/handtalk_init.js";
            } else {
                $url = "http://api.handtalk.me/libs/" . $settings['version'] . "/handtalk.min.js ";
            }
            ?>
			<script type="text/javascript">
			var _hta = {'_setToken': '<?php 
            echo $settings['token'];
            ?>
','_htException': '<?php 
            echo $settings['exceptions'] == "" ? "HandTalk_EXCECAO" : $settings['exceptions'];
            ?>
'};
			(function() {
			var ht = document.createElement('script'); ht.type = 'text/javascript'; ht.async = true;
			ht.src = '<?php 
            echo $url;
            ?>
';
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.appendChild(ht);
			})();
			</script>
			<?php 
        }
    }
示例#2
0
 public function admin()
 {
     $settings = WPHTSettings::getSettings();
     register_setting('wpht-group', 'wpht', array(&$this, 'wpht_validate'));
     add_settings_section('wpht_section', __('Hand Talk Configuration', 'wpht'), array(&$this, 'wpht_section'), 'wpht');
     add_settings_field('wpht_token', __('Security Token', 'wpht'), array(&$this, 'text_input'), 'wpht', 'wpht_section', array('name' => 'token', 'value' => $settings['token']));
     add_settings_field('wpht_latest', '', array(&$this, 'text_checkbox'), 'wpht', 'wpht_section', array('name' => 'latest', 'value' => $settings['latest'], 'text' => __('Use latest version', 'wpht')));
     add_settings_field('wpht_versions', __('Version', 'wpht'), array(&$this, 'text_input'), 'wpht', 'wpht_section', array('name' => 'version', 'value' => $settings['version'], 'helper' => __('Available versions: 1.0, 1.1. Please use just one.', 'wpht')));
     add_settings_field('wpht_exceptions', __('Exceptions', 'wpht'), array(&$this, 'text_input'), 'wpht', 'wpht_section', array('name' => 'exceptions', 'value' => $settings['exceptions'], 'helper' => __('Comma separated options', 'wpht')));
 }