123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?php
- remove_action('wp_head', 'index_rel_link' );
- remove_action('wp_head', 'rel_canonical');
- remove_action('wp_head', 'start_post_rel_link', 10, 0 );
- remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
- remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );
- remove_action('wp_head', 'parent_post_rel_link', 10, 0 );
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wlwmanifest_link');
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'feed_links_extra', 3 );
- remove_action('wp_head', 'feed_links', 2 );
- function dw_remove_wp_ver_css_js( $src ) {
- if ( strpos( $src, 'ver=' ) )
- $src = remove_query_arg( 'ver', $src );
- return $src;
- }
- add_filter( 'style_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
- add_filter( 'script_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
- add_action( 'admin_head', 'dw_hide' );
- function dw_hide() {
- ?>
- <style type="text/css" media="screen">
- #footer {display:none;}
- #contextual-help-link-wrap {display: none;}
- #wpadminbar {display: none;}
- body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
- html.wp-toolbar{padding-top:0;}
- #postexcerpt p {display: none;}
- </style>
- <?php }
- add_filter('wp_mail_from', 'dw_fromemail');
- function dw_fromemail($email) {
- $wpfrom = get_option('admin_email');
- return $wpfrom;
- }
- add_filter('wp_mail_from_name', 'dw_fromname');
- function dw_fromname($email){
- $wpfrom = get_option('blogname');
- return $wpfrom;
- }
- add_filter( 'embed_oembed_html', 'dw_oembed_filter', 10, 4 ) ;
- function dw_oembed_filter($html, $url, $attr, $post_ID) {
- $return = '<div class="video-container">'.$html.'</div>';
- $return = str_replace('frameborder="0" allowfullscreen', 'style="border:none"', $return);
- return $return;
- }
- add_filter( 'embed_oembed_html', 'dw_embed_oembed_html' );
- function dw_embed_oembed_html( $html ) {
- return preg_replace( '@src="https?:@', 'src="', $html );
- }
- add_action( 'admin_menu', 'daw_is_online_add_admin_menu' );
- add_action( 'admin_init', 'daw_is_online_settings_init' );
- function daw_is_online_add_admin_menu( ) {
- add_options_page( 'DW Status', 'DAW Online', 'manage_options', 'daw_is_online', 'daw_is_online_options_page' );
- }
- function daw_is_online_settings_init( ) {
- register_setting( 'dwstatus', 'daw_is_online_settings' );
- add_settings_section('daw_is_online_pluginPage_section', __( 'DAW Online', 'wordpress' ), 'daw_is_online_settings_section_callback', 'dwstatus');
- add_settings_field( 'daw_is_online_select_field_0', __( 'Am I Online ?', 'wordpress' ), 'daw_is_online_select_field_0_render', 'dwstatus', 'daw_is_online_pluginPage_section' );
- }
- function daw_is_online_select_field_0_render( ) {
- $options = get_option( 'daw_is_online_settings' ); ?>
- <select name='daw_is_online_settings[daw_is_online_select_field_0]'>
- <option value='1' <?php selected( $options['daw_is_online_select_field_0'], 1 ); ?>>Yes</option>
- <option value='2' <?php selected( $options['daw_is_online_select_field_0'], 2 ); ?>>No</option>
- </select>
- <?php }
- function daw_is_online_settings_section_callback( ) {
- echo __( 'This sets my online status', 'wordpress' );
- }
- function daw_is_online_options_page( ) { ?>
- <form action='options.php' method='post'>
- <?php settings_fields( 'dwstatus' );
- do_settings_sections( 'dwstatus' );
- submit_button(); ?>
- </form>
- <?php }
- function dw_online_get_status() {
- $dw_status = get_option('daw_is_online_settings');
- if( $dw_status['daw_is_online_select_field_0'] == '1' ) { ?>
- <script type="text/javascript">
- var i;i = 0;
- $(function(){
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
- var msg; msg = Messenger().post({
- message: 'I am currently online', type: 'success',
- actions: {retry: {label: 'Connect', delay: 30,
- action: function(){
- txt_dave();
- var msg_return; msg_return = Messenger().run({
- errorMessage: 'Please wait a moment while I am texted a message to get connected with you.',
- successMessage: 'Connecting Now!',
- action: function(opts) {
- msg.hide();
- if (++i < 2) {
- return opts.error({status: 500,readyState: 0,responseText: 0});
- }
- else {
- window.location.href = 'contact/chat';
- return msg.update({message: 'Redirect to Chat', hideAfter: 20, type: 'success', actions: false});
-
- }
- }
- });
- }
- },
- cancel: {
- label: 'No Thanks',
- action: function() {
- return msg.update({message: 'Maybe Next Time', hideAfter: 1, type: 'error', actions: false});
- }
- }
- }
- });
- });
- function txt_dave() {
- $.ajax({
- url: 'https://davidawindham.com/wha/phony/sms',
- dataType: 'json',
- success: function(data){},
- });
- }
- </script>
- <?php }
- }
- function dw_online_get_chat() {
- $dw_status = get_option('daw_is_online_settings');
- if( $dw_status['daw_is_online_select_field_0'] == '1' ) { ?>
- <script type="text/javascript">
- var i;i = 0;
- $(function(){
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
- var msg_return; msg_return = Messenger().run({
- id: 'one',
- errorMessage: 'Looking for David...',
- action: function(opts) {
- if (++i < 2) {
- get_dave();
- return opts.error({status: 500,readyState: 0,responseText: 0});
- }
- }
- });
- });
-
- function get_dave() {
- $(function poll() {
- var x = 0;
- var countTimer = setInterval(function () {
- if(x > 5){clearInterval(countTimer)}
- else if(x == 5){dave_not_available()}
- else{
- var URLchatAPI = "http://macs.local:8080/status";
- var request = $.ajax({
- url: URLchatAPI,
- dataType: 'json',
- cache: false,
- success: function (data) {
- online = data.online;
- if(online=='yes'){
- $('.chat').modal('show');
- x = x+5;
- };
- if(online=='no'){
- dave_connecting();
- };
- },
- error: function ( xhr, tStatus, err ) {
- dave_error();
- x = x+5;
- }
- });
-
- x++;
- }
- }, 5000);
- });
- }
- function dave_connecting(){
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
- var y;y = 0;
- var msg_waiting; msg_waiting = Messenger().run({
- id: 'one',
- hideAfter: 4,
- errorMessage: 'Waiting on David...',
- action: function(opts) {
- if (++y < 2) {
- get_dave();
- return opts.error({status: 500,readyState: 0,responseText: 0});
- }
- }
- });
- }
- function dave_not_available(){
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
- var msg_error; msg_error = Messenger().post({
- message: 'Sorry, but I am busy.',
- type: 'error',
- id: 'one',
- showCloseButton: true,
- actions:{
- cancel: {
- label: '<a href="../">Leave me a message</a>',
- action: function(){
- window.location.href = '../';
- }
- }
- }
- });
- }
-
- function dave_error(){
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
- var msg_error; msg_error = Messenger().post({
- message: 'Oops. Something has gone wrong.',
- type: 'error',
- id: 'one',
- showCloseButton: true,
- actions:{
- cancel: {
- label: '<a href="../">Leave me a message</a>',
- action: function(){
- window.location.href = '../';
- }
- }
- }
- });
- }
- $(function() {
- if (window.location.hash.indexOf("chat") !== -1) {
- $('.chat').modal('show');
- }
- });
- </script>
- <?php }
- }
- ?>
|