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
<!-- | |
Usage: | |
initDialog("Add a Staff Member",true,updateContact); | |
appendForm($( "#dialog-form" ),"addStaff","?module=staff&mode=add"); | |
appendDetail($( "#addStaff_id" ),"First Name:","first_name",""); | |
appendDetail($( "#addStaff_id" ),"Last Name:","last_name",""); | |
openDialog(); | |
initDialog: (form title str, destroyOnClose, submitCallback) | |
appendForm: (id to append to - will make this deprecated, will always be this ojbect |
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 getQueryVariable(variable,fromSrc) { | |
fromSrc = fromSrc || false; | |
if (fromSrc) { | |
var myScript = document.currentScript; | |
var query = myScript.src.replace(/^[^\?]+\??/,''); | |
} | |
else { | |
var query = window.location.search.substring(1); | |
} | |
var vars = query.split('&'); |
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 hasAlpha(val,upper) { | |
if (upper) { | |
for (var i in val) { | |
if ((val.charCodeAt(i)>=65) && (val.charCodeAt(i)<=90)) return true; | |
} | |
} | |
else { | |
for (var i in val) { | |
if ((val.charCodeAt(i)>=97) && (val.charCodeAt(i)<=122)) return true; | |
} |
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 hasNum(val) { | |
for (var i in val) { | |
if (!isNaN(parseInt(val[parseInt(i)]))) return true; | |
} | |
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 fakeClick(event, anchorObj) { | |
if ((typeof(anchorObj)!="undefined") && (typeof(anchorObj.click)!="undefined")) { | |
anchorObj.click() | |
} | |
else if(document.createEvent) { | |
if(event.target !== anchorObj) { | |
var evt = document.createEvent("MouseEvents"); | |
evt.initMouseEvent("click", true, true, window, | |
0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
var allowDefault = anchorObj.dispatchEvent(evt); |
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 getURLContent($url) { | |
$ch = curl_init(); | |
$timeout = 5; | |
curl_setopt($ch,CURLOPT_URL,$url); | |
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | |
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return $data; | |
} |
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 getCustomTypeData($name) { | |
global $wpdb; | |
$returnValues = array(); | |
$sql = "SELECT id, post_title, post_status, post_author, post_content FROM wp_posts WHERE post_title<>'Auto Draft' AND post_status='publish' AND post_type='$name'"; | |
$customPosts= $wpdb->get_results($sql); | |
$count = 0; | |
foreach ($customPosts as $post) { | |
$returnValues[$count]["id"] = $post->id; | |
$returnValues[$count]["title"] = $post->post_title; | |
$returnValues[$count]["content"] = $post->post_content; |
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 sortCustom($data,$field,$datatype="text",$direction="desc") { | |
$cycle = false; | |
for ($i=0;$i<(count($data)-1);$i++) { | |
switch($datatype) { | |
case "date": | |
$arrDate1 = explode("-", $data[$i][$field]); | |
$mkDate1 = mktime(1,1,1,$arrDate1[1],$arrDate1[2],$arrDate1[0]); | |
$arrDate2 = explode("-", $data[$i+1][$field]); | |
$mkDate2 = mktime(1,1,1,$arrDate2[1],$arrDate2[2],$arrDate2[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
function splitn($string, $needle, $offset) { | |
$newString = $string; | |
$totalPos = 0; | |
$length = strlen($needle); | |
for($i = 0; $i < $offset; $i++) { | |
$pos = strpos($newString, $needle); | |
// If you run out of string before you find all your needles | |
if($pos === false) | |
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
Option Explicit | |
'Icmp constants converted from' | |
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_pingstatus.asp' | |
Private Const ICMP_SUCCESS As Long = 0 | |
Private Const ICMP_STATUS_BUFFER_TO_SMALL = 11001 'Buffer Too Small' | |
Private Const ICMP_STATUS_DESTINATION_NET_UNREACH = 11002 'Destination Net Unreachable' | |
Private Const ICMP_STATUS_DESTINATION_HOST_UNREACH = 11003 'Destination Host Unreachable' | |
Private Const ICMP_STATUS_DESTINATION_PROTOCOL_UNREACH = 11004 'Destination Protocol Unreachable' |
OlderNewer