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
/** | |
* Return a formated string from a date Object mimicking PHP's date() functionality | |
* | |
* format string "Y-m-d H:i:s" or similar PHP-style date format string | |
* date mixed Date Object, Datestring, or milliseconds | |
* | |
*/ | |
function dateFormat(format,date){ | |
if(!date || date === "") |
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
/** | |
* Validate and clean a DEA Registration ID | |
* @param string $enteredValue user supplied DEA ID | |
* @param string $lastname OPTIONAL extended validation requires first letter of users last name to match corresponding character in ID | |
* | |
* @return string|bool returns sanitized alphanumeric DEA Registration ID or FALSE | |
*/ | |
function cleanDEA(string $enteredValue, string $lastname = '') { | |
//if a " Supervisee Identifier" was supplied, just ignore it |
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
/** | |
* display a quick notification box that slides up from the bottom for a few seconds | |
*/ | |
function quickNotice(message,cssClass,timeOnScreen) | |
{ | |
cssClass = (cssClass) ? cssClass : 'is-success'; | |
timeOnScreen = (timeOnScreen) ? timeOnScreen : 3000; | |
var html = '<div id="quickNotice" style="position: absolute; z-index: 100; width: 100%" class="notification has-text-centered has-text-weight-semibold '+cssClass+'">'; | |
html+= message; |
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
/** | |
* use cURL to get the contents on a remote page uses redirect headers | |
* necessary when local server does not allow location | |
*/ | |
function curl($url,$recursive_attempt=0){ | |
if (!function_exists('curl_init')) { return false; } | |
$content = false; | |
$can_follow = ( ini_get('safe_mode') || ini_get('open_basedir') ) ? false : true; //cURL can't follow redirects in safe mode or if open_basedir is on |
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
/** | |
* display a styled jQuery UI dialog box in place of the native javascript alert() | |
* | |
* message string HTML message to display | |
* title string optional title text to display in header of confirmation box | |
* callback function optional function to trigger when user clicks "OK" | |
* | |
*/ | |
function uiAlert(settings) | |
{ |
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 | |
/** | |
* Read a CSV File an convert to JSON object | |
* Assumes first row is header data with column titles | |
* For Google Sheets, publish the sheet in csv format and use the provided URL | |
*/ | |
function csv2json($url) { | |
$csv = file_get_contents($url); | |
$rows = array_map("str_getcsv", explode("\n", $csv)); | |
$result = 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
var escEvents = new Array(); | |
// If something needs to listen for the "ESC" key to be pressed, pass that functionality here | |
// eventName STRING a name for this event, like "myPopupDialog" | |
// eventFunction FUNCTION what to do when the user hits the escape key | |
function setEscEvent(eventName, eventFunction){ | |
escEvents.push({ eventName: eventName, eventFunction: eventFunction }); | |
} | |
// When an item doesn't need to listen for the "ESC" key anymore, remove it |
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 | |
/** | |
* set the server directory that this application is stored in. | |
* if applicaiton is in the root directory, set to "/" | |
*/ | |
$_app_server_path = rtrim(str_replace('\\', '/', dirname(__FILE__)),"/")."/"; // eg: "/home/ubuntu/workspace/my-website/" | |
$web_app_path = str_replace(rtrim($_SERVER['DOCUMENT_ROOT'],"/"),'',$_app_server_path); // eg: "/my-website/" or just "/" if in root |
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
// make all user uploaded images responsive | |
$(".user_uploaded_content_wrapper img").each(function(){ | |
var oldWidth = ($(this).width() > 0) ? $(this).width()+"px" : '100%'; | |
$(this).css({width:'100%', height:'auto', maxWidth:oldWidth}); | |
}); |
NewerOlder