- Timestamp:
- Feb 13, 2020 4:48:01 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/HTML.inc.php
r685 r713 255 255 } 256 256 257 /* 258 * Print select options for a list of US states. 259 * 260 * @access public 261 * @param string $preselected the currently selected value of the menu. compared to the $val_column 262 * @return void 263 * @author Quinn Comendant <quinn@strangecode.com> 264 * @since 12 Feb 2020 22:26:34 265 */ 266 static public function printStatesSelectOptions($preselected='', $first=false) 267 { 268 $options = ['AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'DC' => 'District Of Columbia', 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming']; 269 270 if (true === $first) { 271 // Include a blank first option. 272 $options = array_merge(['' => ''], $options); 273 } else if (is_array($first)) { 274 // When the 'blank' first option needs a specific key->val pair. 275 foreach ($first as $key => $val) { 276 $options = array_merge([$key => $val], $options); 277 } 278 } 279 280 foreach ($options as $value => $text) { 281 printf('<option value="%s"%s>%s</option>', 282 $value, 283 $preselected == $value ? ' selected="selected"' : '', 284 $text 285 ); 286 } 287 } 288 257 289 /** 258 290 * Get a Gravatar URL for a specified email address. … … 260 292 * @param string $email The email address 261 293 * @param string $size Size in pixels, defaults to 80px [ 1 - 2048 ] 262 * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] 294 * @param string $d Default imageset to use [ 404 | mp | identicon | monsterid | wavatar | retro | robohash | blank ] 295 * See what defaults look like at https://en.gravatar.com/site/implement/images/ 263 296 * @param string $r Maximum rating (inclusive) [ g | pg | r | x ] 264 297 * @return String containing a URL to a gravatar image. 265 298 * @source http://gravatar.com/site/implement/images/php/ 266 299 */ 267 static public function getGravatarURL($email, $size=80, $defset='m m', $rating='g') {300 static public function getGravatarURL($email, $size=80, $defset='mp', $rating='pg') { 268 301 return sprintf('https://www.gravatar.com/avatar/%s?s=%s&d=%s&r=%s', 269 302 md5(strtolower(trim($email))),
Note: See TracChangeset
for help on using the changeset viewer.