![]() |
||||||||
|
Free PHP Code Snippets At Blue Sky iSolutions, we develop solutions where none exist, or where existing solutions are over-priced and/or under-performing. We decided to make some of our more useful PHP functions available FREE to use by other developers. Please feel free to use any of the code snippets below for FREE, but without any warranty whatsoever.
PayPal Payments Pro Plugin For Wordpress
Installing the PayPal Payments Pro Wordpress plugin is easy: Note: The PayPal Payments Pro Wordpress plugin requires that you have a business account with PayPal, after which you will have the ability to request and access your PayPal API Credentials. Download the PayPal Pro Plugin for Wordpress See the PayPal Pro Plugin for Wordpress Installed. (PayPal test credit card required to complete payment.)
PHP Utility Functions PHP function sqlSafe: This function returns the parameter string after applying stripslashes and mysql_real_escape_string to the string. We use this when magik quotes is turned on, to clean POST/GET input before input into a database. function sqlSafe($in_string) { PHP function htmlSafe: This function returns the parameter string after applying stripslashes and htmlspecialchars with ENT_QUOTES to the string. We use this when magik quotes is turned on, to clean POST/GET input before display within HTML forms. We suggest that you always single-quote parameters in html tags and consitently use ENT_QUOTES for the htmlspecialchars() function. This function assumes that you follow this practice. If you prefer to double-quote HTML parameters, change ENT_QUOTES to ENT_NOQUOTES. If you vary single and double quotes around HTML parameters, don't use this function.
function htmlSafe($in_string) { PHP function validEmail: This function returns true or false depending on whether the parameter string is a valid email address (true) or not (false). function validEmail($email) { PHP function formSelect: This function returns an HTML form <select> element filled with the options provided, with an option selected (or not), and including the ability to add Javascript and/or style information to the <select> element. This function uses the htmlSafe function, above. The parameters for this function are as follows:
$var_name - Value for the "name" parameter of the <select> element
function formSelect($var_name, $selected, $options, $empty = "", $jscript="", $style="") { Example usage of function formSelect to create a select for credit card type: <php// Create an array of credit card types: $credit_cards = array(1=>"Visa",2=>"MasterCard",3=>"Discover",4=>"American Express"); // Create the select element with the name creditCartType, // with "Discover" selected, an empty option, // and with some javascript and styling thrown in: echo formSelect("creditCartType", 3, $credit_cards, "Select a Card", "onChange='alert(\"Hello World\");'", "color:blue;font-size:24px;"); ?> Example output of function formSelect:
PHP Function NewLatLong: This function returns an array of 2 elements: the new latitude and longitude after moving from an originating latitude/longitude to a new position at a given bearing and range. Use this function to determine the new latitude and longitude after moving a known bearing (direction) and range (distance). The parameters for this function are as follows:
$lat1 - Start latitude in decimal degrees Function NewLatLong() is large and uses several utility functions. The function and the required utility functions are available for download using the link below: Download PHP function NewLatLong() and supporting functions.
|
|||||||
|
|
||||||||