This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
grep -E "Server(Name|Alias)" httpd.conf | sort | uniq | cut -d " " -f 6 | tr "\n" " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip1='FILL-SOURCE-IP'; ip2='FILL-DEST-IP'; host='FILL-HOSTNAME'; curl http://$host | grep -o '<a.*href=.*>' | grep "http://$host" | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' > links.txt; for link in `cat links.txt`; do path=`echo -n $link | cut -d "/" -f 4-`; curl --header "Host: $host" "http://$ip1/$path" > ip1.html; curl --header "Host: $host" "http://$ip2/$path" > ip2.html; echo; echo "Diff http://$ip1/$path"; echo; diff ip1.html ip2.html; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force www | |
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ | |
RewriteCond %{HTTPS}s ^on(s)| | |
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if a given ip is in a network | |
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1 | |
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed | |
* @return boolean true if the ip is in this range / false if not. | |
*/ | |
function ip_in_range( $ip, $range ) { | |
if ( strpos( $range, '/' ) == false ) { | |
$range .= '/32'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate that a given path is a child of the WP_CONTENT_DIR | |
* @param string $path path to check | |
* @return boolean true/false | |
*/ | |
function sav_path_is_valid( $path ) { | |
if ( !defined( WP_CONTENT_DIR ) ) | |
return false; | |
$start = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'robots_txt', 'sav_add_sitemap_to_robots' ); | |
function sav_add_sitemap_to_robots( $robots ) { | |
$robots .= 'Sitemap: ' . site_url( 'sitemap_index.xml' ); | |
return $robots; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'clean_url', 'sav_force_mapped_url' ); | |
function sav_force_mapped_url( $url ) { | |
if ( ! is_admin() ) { | |
if ( function_exists( 'get_original_url' ) && strpos( '/wp-admin', $url ) === false ) { | |
$original = preg_replace( '#^https?://#', '', get_original_url('') ); | |
$new = preg_replace( '#^https?://#', '', site_url() ); | |
$url = str_ireplace( $original, $new, $url ); | |
} | |
} | |
return $url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'http_request_args', 'force_referer_for_import' ); | |
function force_referer_for_import( $r ) { | |
if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) { | |
$r['headers']['Referer'] = 'http://<referer>/'; | |
} | |
return $r; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tott_enable_menu_export() { | |
global $wp_post_types; | |
$wp_post_types['nav_menu_item']->_builtin = false; | |
} | |
add_action( 'load-export.php', 'tott_enable_menu_export' ); |