Changeset 534 for trunk/lib/HTML.inc.php
- Timestamp:
- Jul 27, 2015 7:56:08 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/HTML.inc.php
r502 r534 154 154 } 155 155 156 /* 157 * 158 * 159 * @access public 160 * @param array $options Array of options, with keys: value, selected, text 161 * @param array $deselected Array of values to disable in options. 162 * @return array Same options, but those with a value matching an element in $deselected will have a 'disabled' element of true. 163 * @author Quinn Comendant <quinn@strangecode.com> 164 * @version 1.0 165 * @since 24 Jul 2015 01:41:33 166 */ 167 static public function disableSelectOptions($options, $deselected) 168 { 169 $app =& App::getInstance(); 170 $n = sizeof($options); 171 for ($i=0; $i < $n; $i++) { 172 $app->logMsg(sprintf('Disable check: %s == %s', $options[$i]['value'], getDump($deselected)), LOG_DEBUG, __FILE__, __LINE__); 173 $options[$i]['disabled'] = in_array($options[$i]['value'], $deselected); 174 } 175 return $options; 176 } 177 156 178 /** 157 179 * Prints option fields for a select form. Works only with enum or set … … 219 241 220 242 foreach ($options as $o) { 221 printf('<option value="%s"%s >%s</option>',243 printf('<option value="%s"%s%s>%s</option>', 222 244 oTxt($o['value']), 223 ($o['selected'] ? ' selected' : ''), 245 (isset($o['selected']) && $o['selected'] ? ' selected' : ''), 246 (isset($o['disabled']) && $o['disabled'] ? ' disabled' : ''), 224 247 oTxt($o['text']) 225 248 ); 226 249 } 227 250 } 251 252 /** 253 * Get a Gravatar URL for a specified email address. 254 * 255 * @param string $email The email address 256 * @param string $size Size in pixels, defaults to 80px [ 1 - 2048 ] 257 * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] 258 * @param string $r Maximum rating (inclusive) [ g | pg | r | x ] 259 * @return String containing a URL to a gravatar image. 260 * @source http://gravatar.com/site/implement/images/php/ 261 */ 262 static public function getGravatarURL($email, $size=80, $defset='mm', $rating='g') { 263 return sprintf('https://www.gravatar.com/avatar/%s?s=%s&d=%s&r=%s', 264 md5(strtolower(trim($email))), 265 $size, 266 $defset, 267 $rating 268 ); 269 } 228 270 }
Note: See TracChangeset
for help on using the changeset viewer.