diff options
| -rwxr-xr-x | bin/respondtime.sh | 16 | ||||
| -rw-r--r-- | resources/curlinfo.txt | 8 | ||||
| -rw-r--r-- | wordpress/functions.php | 24 |
3 files changed, 48 insertions, 0 deletions
diff --git a/bin/respondtime.sh b/bin/respondtime.sh new file mode 100755 index 0000000..de0731b --- /dev/null +++ b/bin/respondtime.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# use cURL to measure the time until the webpage loads + +CURLINFOTEXT="$(dirname $0)/../resources/curlinfo.txt" + +if [ ! -f "$CURLINFOTEXT" ]; then + echo "$(tput setaf 1)$(tput bold)Failure. $(tput sgr0)No Info Text for cURL given." 1>&2 + exit 1 +fi + +if [ -z "$1" ]; then + echo "$(tput setaf 1)$(tput bold)Failure. $(tput sgr0)Missing URL or Hostname" 1>&2 + exit 1 +fi + +curl -w "@$CURLINFOTEXT" -o /dev/null -s "$1" diff --git a/resources/curlinfo.txt b/resources/curlinfo.txt new file mode 100644 index 0000000..fa9ec7f --- /dev/null +++ b/resources/curlinfo.txt @@ -0,0 +1,8 @@ + time_namelookup: %{time_namelookup}\n + time_connect: %{time_connect}\n + time_appconnect: %{time_appconnect}\n + time_pretransfer: %{time_pretransfer}\n + time_redirect: %{time_redirect}\n + time_starttransfer: %{time_starttransfer}\n + ----------\n + time_total: %{time_total}\n diff --git a/wordpress/functions.php b/wordpress/functions.php new file mode 100644 index 0000000..464d9a3 --- /dev/null +++ b/wordpress/functions.php @@ -0,0 +1,24 @@ +<?php + +// Replace jquery through the CDN version and move it to the footer +function movejquerytofooter(){ + if(!is_admin()){ + wp_deregister_script('jquery'); + wp_register_script('jquery', '//code.jquery.com/jquery-2.1.1.min.js', false, '1.3.2', true); + + wp_enqueue_script('jquery'); + } +} + +// Disable W3TC footer comment for everyone but Admins (single site & network mode) +if ( !current_user_can( 'activate_plugins' ) ) { + add_filter( 'w3tc_can_print_comment', function( $w3tc_setting ) { return false; }, 10, 1 ); +} + +// Add piwik tracking script without the plugin +function var_piwik() { + if (!is_admin()) { + wp_register_script( 'piwik', get_template_directory_uri() . '/js/piwik.js','',null,true); + wp_enqueue_script('piwik'); + } +} |
