Exemplo n.º 1
0
 public static function getUserURL($o)
 {
     $u = $o->getUser();
     if ($u instanceof UserReadOnly) {
         return '<a href="' . URLController::get($u) . '">' . $u->getUsername() . '</a>';
     } else {
         return 'Unknown';
     }
 }
Exemplo n.º 2
0
 function _wolframalpha($params)
 {
     $user = $params['user'];
     $channel = $params['channel'];
     $data = file_get_contents('http://www.wolframalpha.com/input/?i=' . urlencode($params['query']));
     preg_match_all('%<div\\s[^>]*class="pod\\s*".+?<h\\d>(?P<title>.+?):</h\\d>.*?(?P<image><img.+?' . '>)%si', $data, $podmatches, PREG_SET_ORDER);
     $output = Utils::cmdout($params);
     $index = 0;
     $slug = preg_replace('%\\W+%', '-', $params['query']);
     foreach ($podmatches as $pod) {
         $index++;
         if (preg_match('%\\bsrc\\s*=\\s*(?P<quote>["\'])(?P<src>.+?)\\1%', $pod['image'], $matches)) {
             $s3src = URLController::tos3($matches['src'], $slug . '-' . $index . '.gif');
             $output .= '<div><div class="podtitle">' . $pod['title'] . '</div><img class="s3ed" src="' . $s3src . '" onload="do_scroll();"></div>';
         } else {
             $output .= '<div><div class="podtitle">' . $pod['title'] . '</div>' . $pod['image'] . '</div>';
         }
     }
     Status::create()->data($output)->user_id($user->id)->channel($channel)->cssclass('wolframalpha')->insert();
     return true;
 }
Exemplo n.º 3
0
						<div class="meta">
							<?php 
        $author = $post->getUser();
        if ($author instanceof UserReadOnly) {
            // User exists
            ?>
								<div class="avatar">
									<img src="<?php 
            echo $author->getAvatar();
            ?>
" />
								</div>

								<div class="userinfo">
									<h2><a href="<?php 
            echo URLController::get($author);
            ?>
">
										<?php 
            echo $author->getUsername();
            ?>
									</a></h2>

									<time><?php 
            echo date('d.m.Y, H:i', $post->getDate());
            ?>
</time>
								</div>
							<?php 
        } else {
            ?>
Exemplo n.º 4
0
			<div class="count">
				<span><?php 
    echo $topic->getPostsCount();
    ?>
</span>
				POSTS
			</div>

			<div class="lastPost">
				<?php 
    $lastPost = $topic->getLastPost();
    if ($lastPost instanceof ForumPost) {
        ?>
				
					<a href="<?php 
        echo URLController::get($lastPost);
        ?>
"><b><?php 
        echo $lastPost->getTopic()->getShortTitle(32);
        ?>
</b></a>
					by <?php 
        echo ThemeFunctions::getUserURL($lastPost);
        ?>
<br />
					<small class="grey"><?php 
        echo $lastPost->getFormattedDate();
        ?>
</small>
					
				<?php