This file contains hidden or 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
define('WP_DEBUG', true); | |
/** | |
* When debug mode is enabled, you can enable logging to store errors in wp-content/debug.log | |
* This is useful for finding errors that might not get displayed on screen | |
* | |
* The next conditional section will make sure errors are not shown to users when logging is enabled | |
* This helps with quick troubleshooting on live sites | |
*/ | |
define('WP_DEBUG_LOG', true); |
This file contains hidden or 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 | |
//Create a shortcode that encrypts the given text and adds a tag around the text that will lated be used to find the text on the client side | |
add_shortcode( 'nospam', function ( $atts, $content = null ) { | |
return '<em class="tsp-nospam">'.base64_encode($content).'</em>'; | |
}); | |
add_action('wp_head', function(){ ?> | |
<script>/* js base64 decode modified/condensed from http://www.webtoolkit.info/javascript-base64.html*/function wptspdecode(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d,e,f,g,h,i,j,k=0,l="",m=c1=c2=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(k<a.length){g=b.indexOf(a.charAt(k++));h=b.indexOf(a.charAt(k++));i=b.indexOf(a.charAt(k++));j=b.indexOf(a.charAt(k++));d=g<<2|h>>4;e=(h&15)<<4|i>>2;f=(i&3)<<6|j;c+=String.fromCharCode(d);i!=64&&(c+=String.fromCharCode(e));j!=64&&(c+=String.fromCharCode(f))}k=0;while(k<c.length){m=c.charCodeAt(k);if(m<128){l+=String.fromCharCode(m);k++}else if(m>191&&m<224){c2=c.charCodeAt(k+1);l+=String.fromCharCode((m&31)<<6|c2&6 |
This file contains hidden or 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 | |
//This will make the user an editor instead of admin for a new site | |
add_action('wpmu_new_blog','change_new_blog_role',100,6); | |
function change_new_blog_role($blog_id, $user_id, $domain, $path, $site_id, $meta) { | |
remove_user_from_blog($blog_id, $user_id); | |
add_user_to_blog($blog_id, $user_id, 'editor'); | |
} |
This file contains hidden or 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 | |
# Usage: $ ./gitarchivemaster.sh http://url/to/repo.git dest-folder | |
url=$1 | |
name=$2 | |
#Clone repo (delete existing) | |
rm -fR ${name} | |
git clone ${url} ${name} |
This file contains hidden or 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 githubOrigin() { | |
function netMatch($CIDR,$IP) { | |
list ($net, $mask) = explode ('/', $CIDR); | |
return ( ip2long ($IP) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($net); | |
} | |
return (netMatch("204.232.175.64/27",$_SERVER['REMOTE_ADDR']) || netMatch("192.30.252.0/22",$_SERVER['REMOTE_ADDR'])); | |
} |
This file contains hidden or 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 | |
//Only allow requests from Github (see: https://gist.github.com/webtekk/6326465) | |
if (!githubOrigin()) die('Unauthorized'); | |
$data = json_decode($_POST['payload'],true); | |
//Only continue if this commit is on the master branch | |
if (!$data['ref'] == 'refs/heads/master') die('Not a master branch commit'); |
This file contains hidden or 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 remove_signup_option(){ | |
//Predefine what kind of registration is happening. wp-signup.php won't show the option if one is declared | |
global $active_signup; | |
$active_signup='blog'; | |
} | |
add_action('signup_hidden_fields','remove_signup_option'); |
This file contains hidden or 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 | |
add_action('wpmu_activate_blog','remove_user_from_primary_site',999,5); | |
function remove_user_from_primary_site($blog_id, $user_id, $password, $title, $meta){ | |
remove_user_from_blog($user_id,1); | |
} |
This file contains hidden or 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 | |
add_action('admin_head', 'custom_admin_css'); | |
function custom_admin_css() { ?> | |
<style> | |
label[for=siteurl], input[name=siteurl], label[for=home], input[name=home], input[name=home] + p.description { | |
display: none; | |
} | |
</style> | |
<?php |
OlderNewer