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
/*---------------------------- | |
wordpress function to add | |
users to database programatically | |
-----------------------------*/ | |
function fb_wp_insert_user() { | |
$user_data = array( | |
'ID' => '', | |
'user_pass' => wp_generate_password(), | |
'user_login' => 'dummy', | |
'user_nicename' => 'Dummy', |
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
// put in functions.php | |
function auto_login( $user ) { | |
$username = $user; | |
if ( !is_user_logged_in() ) { | |
$user = get_userdatabylogin( $username ); | |
$user_id = $user->ID; | |
wp_set_current_user( $user_id, $user_login ); | |
wp_set_auth_cookie( $user_id ); | |
do_action( 'wp_login', $user_login ); |
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
<script> | |
jQuery(document).ready(function($) { | |
/*---------------------------- | |
make entire div clickable | |
-----------------------------*/ | |
$(".myBox").click(function(){ | |
window.location=$(this).find("a").attr("href"); | |
return false; |
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
function ordinal($cdnl){ | |
$test_c = abs($cdnl) % 10; | |
$ext = ((abs($cdnl) %100 < 21 && abs($cdnl) %100 > 4) ? 'th' | |
: (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) | |
? 'th' : 'st' : 'nd' : 'rd' : 'th')); | |
return $cdnl.$ext; | |
} | |
for($i=1;$i<100;$i++){ | |
echo ordinal($i).'<br>'; | |
} |
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
function cleanInput($input) { | |
$search = array( | |
'@<script[^>]*?>.*?</script>@si', // Strip out javascript | |
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags | |
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly | |
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments | |
); | |
$output = preg_replace($search, '', $input); |
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
<div class="tabbable"> | |
<ul class="nav nav-tabs"> | |
<li class="active"><a href="#1" data-toggle="tab">Section 1</a></li> | |
<li class=""><a href="#2" data-toggle="tab">Section 2</a></li> | |
<li class=""><a href="#3" data-toggle="tab">Section 3</a></li> | |
</ul> | |
<div class="tab-content"> | |
<div class="tab-pane active" id="1"> | |
<p>You are watching section 1.</p> | |
</div><!-- /end tab1 --> |
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
<style> | |
h1 { | |
font-size: 3.0vw; | |
} | |
p.lead { | |
font-size: 2.5vh; | |
} | |
p { | |
font-size: 2vmin; | |
} |
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
<script> | |
$(document).ready(function(){ | |
resizeDiv(); | |
}); | |
window.onresize = function(event) { | |
resizeDiv(); | |
} | |
/** |
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
/************************* | |
/* function: get current url | |
/*************************/ | |
function curPageURL() { | |
$pageURL = 'http'; | |
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} | |
$pageURL .= "://"; | |
if ($_SERVER["SERVER_PORT"] != "80") { | |
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; |
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 | |
/************************* | |
/* copy master files to the farm | |
/*************************/ | |
function full_copy( $source, $target ) | |
{ | |
if ( is_dir( $source ) ) { | |
@mkdir( $target ); $d = dir( $source ); | |
while ( FALSE !== ( $entry = $d->read() ) ) { | |
if ( $entry == '.' || $entry == '..' ) { continue; } |
NewerOlder