Skip to content

Instantly share code, notes, and snippets.

<?php
$countries =
array(
"ae" => "United Arab Emirates",
"ao" => "Angola",
"bf" => "Burkina Faso",
"bi" => "Burundi",
"bj" => "Benin",
"bw" => "Botswana",
<?php
$countries =
array(
"ae" => "United Arab Emirates",
"ao" => "Angola",
"bf" => "Burkina Faso",
"bi" => "Burundi",
"bj" => "Benin",
"bw" => "Botswana",
<?php
function country_dropdown ( $name="country", $top_countries=array(), $selection=NULL, $show_all=TRUE ) {
// You may want to pull this from an array within the helper
$countries = config_item('countries');
$html = "<select name='{$name}' id='{$name}'>";
$selected = NULL;
if(in_array($selection,$top_countries)) {
$top_selection = $selection;
$all_selection = NULL;
#Ruby
Area = '555' # My area code
Tz = -8 # Time zone (GMT-8)
# Speed dial entries. Format: "key" => "number"
Speeddial = {
'0' => '555-5555', # Home
'1' => '1 555 555-5555', # Another Number
<?
function checkPhone($int_dial_code, $area_code, $local_number) {
//try to check and reformat australian numbers
if ($int_dial_code == "61") {
//combine the area code and local number
$full_phone = $area_code.$local_number;
//strip spaces and hyphens
$full_phone = str_replace(array(" ", "-"), "", $full_phone);
<?php
$db_host='dbserver';
$db_name='dbame';
$db_user='dbuser';
$db_passwd='dbpassword';
mysql_connect($db_host, $db_user, $db_passwd)
or die('Could not connect: ' . mysql_error());
mysql_select_db($db_name) or die('Could not select database');
<?php
function country_dropdown ( $name="country", $top_countries=array(), $selection=NULL, $show_all=TRUE ) {
// You may want to pull this from an array within the helper
$countries = config_item('countries');
$html = "<select name='{$name}' id='{$name}'>";
$selected = NULL;
if(in_array($selection,$top_countries)) {
$top_selection = $selection;
$all_selection = NULL;
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
<?
function checkPhone($int_dial_code, $area_code, $local_number) {
//try to check and reformat australian numbers
if ($int_dial_code == "61") {
//combine the area code and local number
$full_phone = $area_code.$local_number;
//strip spaces and hyphens
$full_phone = str_replace(array(" ", "-"), "", $full_phone);
<?php
add_action( 'wp_enqueue_scripts', 'wps_enqueue_lt_ie9' );
/**
* Conditionally Enqueue Script for IE browsers less than IE 9
*
* @link http://php.net/manual/en/function.version-compare.php
* @uses wp_check_browser_version()
*/
function wps_enqueue_lt_ie9() {
global $is_IE;