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 clear($input) | |
{ | |
global $link; | |
if(get_magic_quotes_gpc()) | |
{ | |
//Remove slashes that were used to escape characters in post. | |
$input = stripslashes($input); | |
} | |
//Remove ALL HTML tags to prevent XSS and abuse of the system. |
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 type="text/javascript"> | |
var unavailableDates = ["11-1-2013","12-1-2013","13-1-2013"]; | |
function unavailable(date) { | |
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear(); | |
if ($.inArray(dmy, unavailableDates) < 0) { | |
return [true,"","Book Now"]; | |
} else { | |
return [false,"","Booked Out"]; | |
} |
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 restafechas($startDate,$endDate){ | |
list($year, $month, $day) = explode("-", $startDate); | |
$startDate = mktime(0, 0, 0, $month, $day, $year); | |
list($year, $month, $day) = explode("-", $endDate); | |
$endDate = mktime(0, 0, 0, $month, $day, $year); | |
$totalDays = ($endDate - $startDate)/(60 * 60 * 24); |
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 | |
preg_match('/\<div id\=[\"]{0,1}ad_content[\"]{0,1}\>(.*?)\<\/div\>/s', $content['content_body'], $matches); | |
$content['content_body'] = $matches[1]; | |
?> |
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 | |
/* | |
DATA ARRAY EXAMPLE | |
$form_data = array( | |
'first_name' => $first_name, | |
'last_name' => $last_name, | |
'email' => $email, | |
'address1' => $address1, | |
'address2' => $address2, | |
'address3' => $address3, |
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 check_email_address($email) { | |
// First, we check that there's one @ symbol, and that the lengths are right | |
if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email)) { | |
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols. | |
return false; | |
} | |
// Split it into sections to make life easier | |
$email_array = explode("@", $email); | |
$local_array = explode(".", $email_array[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
<?php | |
function createDateRangeArray($strDateFrom,$strDateTo) | |
{ | |
// takes two dates formatted as YYYY-MM-DD and creates an | |
// inclusive array of the dates between the from and to dates. | |
// could test validity of dates here but I'm already doing | |
// that in the main script | |
$aryRange=array(); |
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
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES | |
(1, 1, 'BDS', 'Badakhshan'), | |
(2, 1, 'BDG', 'Badghis'), | |
(3, 1, 'BGL', 'Baghlan'), | |
(4, 1, 'BAL', 'Balkh'), | |
(5, 1, 'BAM', 'Bamian'), | |
(6, 1, 'FRA', 'Farah'), | |
(7, 1, 'FYB', 'Faryab'), | |
(8, 1, 'GHA', 'Ghazni'), | |
(9, 1, 'GHO', 'Ghowr'), |
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 | |
add_action( 'after_setup_theme', 'bootstrap_setup' ); | |
if ( ! function_exists( 'bootstrap_setup' ) ): | |
function bootstrap_setup(){ | |
add_action( 'init', 'register_menu' ); | |
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
# Create background noise profile from mp3 | |
/usr/bin/sox noise.mp3 -n noiseprof noise.prof | |
# Remove noise from mp3 using profile | |
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21 | |
# Remove silence from mp3 | |
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5% | |
# Remove noise and silence in a single command |
OlderNewer