Changeset 2154497
- Timestamp:
- 09/10/2019 11:57:32 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
recent-topics-for-ipboard/tags/1.0.0/ipbrecent.php
r1804744 r2154497 104 104 105 105 if ($args['widget'] || ($this->params['mode'] != 'widget')) { 106 $this->prefix = $this->getOption(' dbprefix');106 $this->prefix = $this->getOption('prefix'); 107 107 $forums = $this->getOption('forums', array()); 108 108 $ptags = $this->getOption('ptags'); … … 202 202 $text = preg_replace('/[[\/\!]*?[^\[\]]*?]/si', '', strip_tags(html_entity_decode($data['post_text'], ENT_QUOTES, 'UTF-8'), "{$ptags}")); 203 203 $text = $this->processText($text, $this->getOption('plength')); 204 204 205 205 if (!$data['avatar']) { 206 206 $email = md5(strtolower(trim($data['email']))); 207 $default = $url."/ public/style_images/master/profile/default_large.png";207 $default = $url."/applications/core/interface/email/default_photo.png"; 208 208 $avatar = "https://www.gravatar.com/avatar/".$email."?d=".urlencode($default)."&s=100"; 209 } elseif ((strlen($data['avatar']) == 6) && preg_match("/([a-f0-9]{3}){1,2}\b/i", $data['avatar'])) { 210 $avatar = 'data:image/svg+xml,'.rawurlencode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" style="background:#'.$data['avatar'].'"><g><text text-anchor="middle" dy=".35em" x="512" y="512" fill="#ffffff" font-size="700" font-family="-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif">'.mb_convert_case(mb_substr($aname, 0, 1), MB_CASE_TITLE, 'UTF-8').'</text></g></svg>'); 209 211 } elseif (!preg_match("/https?:\/\//", $data['avatar'])) { 210 $avatar = $url."/uploads/".$data['avatar']; 212 $avatar = $url."/uploads/".$data['avatar']; 211 213 } else { 212 214 $avatar = $data['avatar']; … … 347 349 public function convertFormat($format, $to = 'date') 348 350 { 349 $pairs = array( 350 'D' => '%a', // Short day of the week 351 'l' => '%A', // Full day of the week 352 'd' => '%d', // Day of the month with leading zeroes 353 'j' => '%e', // Day of the month without leading zeroes 354 'z' => '%j', // Day of the year 355 'N' => '%u', // Number of the day of the week from 1 to 7 356 'w' => '%w', // Number of the day of the week from 0 to 7 357 'W' => '%W', // Full week of the year 358 'M' => '%b', // Short month 359 'M' => '%h', // Short month 360 'F' => '%B', // Full month 361 'm' => '%m', // Month number with leading zeroes 362 'n' => '%m', // Month number without leading zeroes 363 'o' => '%G', // Four digit representation of the year going by ISO-8601:1988 standards 364 'y' => '%y', // Two digit representation of the year 365 'Y' => '%Y', // Four digit representation of the year 366 'H' => '%H', // Hour in 24-hour format with leading zeroes 367 'G' => '%k', // Hour in 24-hour format without leading zeroes 368 'h' => '%I', // Hour in 12-hour format with leading zeroes 369 'g' => '%l', // Hour in 12-hour format without leading zeroes 370 'a' => '%P', // am or pm 371 'A' => '%p', // AM or PM 372 'i' => '%M', // Minutes with leading zeroes 373 's' => '%S', // Seconds with leading zeroes 374 'S' => '%O', // Ordinary suffix: st, nd, rd, th 375 'U' => '%s', // Unix Epoch Time timestamp 376 'O' => '%z', // Timezone offset 377 'T' => '%Z', // Timezone abbreviation 378 ); 351 $date = array('D', 'l', 'd', 'j', 'z', 'N', 'w', 'W', 'M', 'M', 'F', 'm', 'n', 'o', 'y', 'Y', 'H', 'G', 'h', 'g', 'a', 'A', 'i', 's', 'U', 'O', 'T'); 352 $strftime = array('%a', '%A', '%d', '%e', '%j', '%u', '%w', '%W', '%b', '%h', '%B', '%m', '%m', '%G', '%y', '%Y', '%H', '%k', '%I', '%l', '%P', '%p', '%M', '%S', '%s', '%z', '%Z'); 379 353 380 $cleanformat = str_split($format); 381 382 foreach ($cleanformat as $key => $char) { 383 if (($to == 'date') && array_search($char, $pairs)) $cleanformat[$key] = array_search($char, $pairs); 384 elseif (($to == 'strftime') && isset($pairs[$char])) $cleanformat[$key] = $pairs[$char]; 385 } 386 387 $format = implode('', $cleanformat); 354 if ($to == 'date') $format = str_replace($strftime, $date, $format); 355 elseif ($to == 'strftime') $format = str_replace($date, $strftime, $format); 388 356 389 357 return $format;
Note: See TracChangeset
for help on using the changeset viewer.