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
img.alignright {float:right; margin:0 0 1em 1em} | |
img.alignleft {float:left; margin:0 1em 1em 0} | |
img.aligncenter {display: block; margin-left: auto; margin-right: auto} | |
.alignright {float:right; } | |
.alignleft {float:left; } | |
.aligncenter {display: block; margin-left: auto; margin-right: auto} |
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
function checkDateFormat($date) | |
{ | |
//match the format of the date | |
if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $date, $parts)) | |
{ | |
//check weather the date is valid of not | |
if(checkdate($parts[2],$parts[3],$parts[1])) | |
return true; | |
else | |
return false; |
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
function base64url_encode($plainText) { | |
$base64 = base64_encode($plainText); | |
$base64url = strtr($base64, '+/=', '-_,'); | |
return $base64url; | |
} | |
function base64url_decode($plainText) { | |
$base64url = strtr($plainText, '-_,', '+/='); | |
$base64 = base64_decode($base64url); | |
return $base64; |
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
$email = $_POST['email']; | |
if(preg_match("~([a-zA-Z0-9!#$%&'*+-/=?^_`{|}~])@([a-zA-Z0-9-]).([a-zA-Z0-9]{2,4})~",$email)) { | |
echo 'This is a valid email.'; | |
} else{ | |
echo 'This is an invalid email.'; | |
} |
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
The function below use the latitude and longitude of two locations, and calculate the distance between them in both miles and metric units. | |
function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { | |
$theta = $longitude1 - $longitude2; | |
$miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); | |
$miles = acos($miles); | |
$miles = rad2deg($miles); | |
$miles = $miles * 60 * 1.1515; | |
$feet = $miles * 5280; | |
$yards = $feet / 3; |
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
// Function for stripping out malicious bits | |
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 |
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 echo get_template_directory_uri(); ?> |
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
Method 1: | |
function get_excerpt_outside_loop($post_id) { | |
$post_excerpt = get_page($post_id) -> post_excerpt; | |
echo $post_excerpt; | |
} |
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
function webspec_get_featured_img($id){ | |
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $id), 'single-post-thumbnail' ); | |
echo $image[0]; | |
} |
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
function webspec_get_content($my_id){ | |
$post_id_5369 = get_post($my_id); | |
$content = $post_id_5369->post_content; | |
$content = apply_filters('the_content', $content); | |
$content = str_replace(']]>', ']]>', $content); |
NewerOlder