function _linkify_html_callback($matches) { if (isset($matches[2])) { return $matches[2]; } return linkify($matches[1]); }
function __get($k) { if ($k == 'editKey') { return substr($this->auth, 20, 10); } else { if ($k == 'stale') { $cutoff = time() - 365 * (24 * 60 * 60); $stamp = strtotime($this->updated); return $stamp < $cutoff; } else { if ($k == 'descriptionHtml') { return hashlinks(linkify(htmlify($this->description))); } else { if ($k == 'descriptionSummary') { return htmlify(substr_replace($this->description, ' ...', 140), false); } else { if ($k == 'rssDate') { // TODO: Is there a better way to handle the timezone? Mysql times are // GMT and have to be parsed as such. $oldtz = date_default_timezone_get(); date_default_timezone_set('GMT'); return date('D, d M Y H:i:s T', strtotime($this->updated)); date_default_timezone_set($oldtz); } } } } } return parent::__get($k); }
function twitter_generate_output($user, $number, $callback = '', $step_callback = '', $before = false, $after = false) { $tweets = twitter_get_tweets($user); if (is_null($tweets)) { return 'Twitter is not configured.'; } $number = min(20, $number); $tweets = array_slice($tweets, 0, $number); if (!empty($callback)) { return call_user_func($callback, $tweets); } $output = $before === false ? '<div class="tt_twitter"><ul class="twitter">' : $before; $time = time(); $last = count($tweets) - 1; foreach ($tweets as $i => $tweet) { $date = $tweet->created_at; $date = date_parse($date); $date = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']); $date = $time - $date; $seconds = (int) $date; $date = floor($date / 60); $minutes = (int) $date; if ($minutes) { $date = floor($date / 60); $hours = (int) $date; if ($hours) { $date = floor($date / 24); $days = (int) $date; if ($days) { $date = floor($date / 7); $weeks = (int) $date; if ($weeks) { $date = $weeks . ' week' . (1 === $weeks ? '' : 's') . ' ago'; } else { $date = $days . ' day' . (1 === $days ? '' : 's') . ' ago'; } } else { $date = $hours . ' hour' . (1 === $hours ? '' : 's') . ' ago'; } } else { $date = $minutes . ' minute' . (1 === $minutes ? '' : 's') . ' ago'; } } else { $date = 'less than a minute ago'; } $output .= $step_callback === '' ? '<li' . ($i === $last ? ' class="last"' : '') . '>' . linkify($tweet->text) . '<span class="date">' . $date . '</span>' . '</li>' : call_user_func($step_callback, $i, linkify($tweet->text), $date); } $output .= $after === false ? '</ul></div>' : $after; return $output; }
function get_program_list_from_gdoc($source_url) { $handle = @fopen($source_url, 'r'); if (!$handle) { return FALSE; // failed } $program_list = array(); while (($PROG = fgetcsv($handle)) !== FALSE) { $program = make_program($PROG); if (!validate_program_data($program)) { continue; } // use strtotime to convert to unix timestamp. $program['from'] = strtotime($program['from']); $program['to'] = strtotime($program['to']); // empty string or NULL will get 0 $program['room'] = intval($program['room']); $program['type'] = intval($program['type']); $program['community'] = intval($program['community']); if (isset($program['bio'])) { $program['bio'] = Markdown_Without_Markup(linkify($program['bio'])); } if (isset($program['abstract'])) { $program['abstract'] = Markdown_Without_Markup(linkify($program['abstract'])); } if (isset($program['youtube'])) { $videos = array(); foreach (explode("\n", $program['youtube']) as $url) { if (trim($url)) { $videos[] = preg_replace('/^.+v=([^"&?\\/ ]{11}).*$/', '$1', trim($url)); // only get the ID } } $program['youtube'] = $videos; } // setting room = -1 and leaving speaker empty indicate a break session $program['isBreak'] = $program['room'] < 0 && !isset($program['speaker']) ? true : false; $program_list[] = $program; } fclose($handle); return $program_list; }
/** * Fetches twitter messages * * @return The twitter messages * @param string $username * @param int $messages[optional] */ function wk_twitter_update($username, $messages = 1) { //the link to fetch $link = 'http://search.twitter.com/search.rss?q=from:' . $username . '&rpp=' . $messages; $data = fetch_page($link); //include necessary files include_once 'linkify.php'; //find twit $twitExtract = "/(?<=<title>).*(?=<\\/title>)/i"; preg_match_all($twitExtract, $data, $twits, PREG_SET_ORDER); for ($i = 0; $i < $messages; $i++) { //save twits and linkify $mytwits[$i] = linkify($twits[$i + 1][0]); } //find time $timeExtract = "/(?<=<pubDate>).*(?=<\\/pubDate>)/i"; preg_match_all($timeExtract, $data, $times, PREG_SET_ORDER); for ($i = 0; $i < $messages; $i++) { //save times $mytimes[$i] = $times[$i + 1][0]; } // if ($mytwits[0] != '') { //add option to db, if it exists, it does nothing add_option('wk_twitter', ''); $alltwits = ''; $alltimes = ''; for ($i = 0; $i < $messages; $i++) { $alltwits .= $mytwits[$i]; $alltimes .= $mytimes[$i]; //if not last twit and time, add the seperator if ($i + 1 != $messages) { $alltwits .= '|'; $alltimes .= '|'; } } $mytime = date('G') * 60 + date('i'); update_option('wk_twitter', $mytime . '~' . $alltwits . '~' . $alltimes); } }
function get_sponsors_list_from_gdoc($source_url) { $handle = @fopen($source_url, 'r'); if (!$handle) { return FALSE; // failed } $SPONS = array(); // name, level, url, logoUrl, desc, enName, enDesc, zhCnName, zhCnDesc while (($SPON = fgetcsv($handle)) !== FALSE) { $sponsor = make_sponsor($SPON); if (!validate_sponsor_data($sponsor)) { continue; } $level = strtolower($sponsor['level']); if (!isset($SPONS[$level])) { $SPONS[$level] = array(); } // Create JSON object $SPON_obj = array('name' => array('zh-tw' => $sponsor['name']), 'desc' => array('zh-tw' => Markdown_Without_Markup($sponsor['desc'])), 'url' => $sponsor['url'], 'logoUrl' => MARKSITE_ABSOLUTE_PATH . SPONSOR_LOGO_RELATIVE_PATH . $sponsor['logoUrl']); if ($sponsor['enName']) { $SPON_obj['name']['en'] = $sponsor['enName']; } if ($sponsor['enDesc']) { $SPON_obj['desc']['en'] = Markdown_Without_Markup($sponsor['enDesc']); } if ($sponsor['zhCnName']) { $SPON_obj['name']['zh-cn'] = $sponsor['zhCnName']; } if ($sponsor['zhCnDesc']) { $SPON_obj['desc']['zh-cn'] = Markdown_Without_Markup(linkify($sponsor['zhCnDesc'])); } array_push($SPONS[$level], $SPON_obj); } fclose($handle); return $SPONS; }
function get_the_tweets($user = '******', $count = 1) { $consumerkey = 'MrdVKnm7tucOHuCoyZgqRt4lN'; $consumersecret = '0Wi6rdalvoHTCAlmwhKjPr3fUWwACvehu8tgXR3jOS59ZUyv64'; $accesstoken = '942820224-8du6x1ncSvpFeTft6hvFfNxTRfpDssutBXHg6Xaj'; $accesstokensecret = '7LJBQKyYkGUyzQwwc9UeIM8Lxz4ZwsIRQLysQeqaKtCqP'; $connection = new TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret); $tweets = $connection->get("statuses/user_timeline", array("screen_name" => $user, "count" => $count, "exclude_replies" => true)); if ($tweets) { foreach ($tweets as $tweet) { $name = $tweet->user->screen_name; $text = linkify($tweet->text); $time = _time_ago($tweet->created_at); $link = 'https://twitter.com/' . $name; $output = '<div class="inner"> <i class="fa fa-twitter"></i> <div class="name">@' . $name . '</div> <div class="tweet">' . $text . ' <span class="timeago">• ' . $time . '</span></div> <a href="' . $link . '" target="_blank" class="btn btn-follow-us">follow us</a> </div>'; } } return $output; }
} echo '<form method="post" action="submit_task.php' . $crisisFilterString . '" onsubmit="return validateInput()">'; $userID = getUserID(); $crisisID = null; if (isset($_GET["crisisid"])) { $crisisID = intval($_GET["crisisid"]); } $task = getTask($crisisID, $userID); if (is_null($task)) { echo '<div class="panel"><h2>Thank you</h2><div class="subpanel">There are no more documents to label. Please check back later.</div></div>'; } else { echo '<h2>Document</h2>'; echo '<div id="document" class="panel text">'; echo '<input type="hidden" name="crisisID" value="' . $crisisID . '" />'; echo '<input type="hidden" name="documentID" value="' . $task->documentID . '" />'; echo "<div class=\"subpanel\">" . linkify($task->getText()) . "</div>"; echo '</div>'; echo '<h2>Labels</h2>'; echo '<div id="options" class="panel">'; foreach ($task->attributeInfo as $attribute) { $attributeID = $attribute->{'id'}; $attributeName = $attribute->{'name'}; $labels = $attribute->{'labels'}; echo '<div class="subpanel label-list">'; echo "<h3>{$attributeName}</h3>"; echo '<div><ul>'; $dontknowID = $attributeID . "_" . $dontknow; foreach ($labels as $label) { $id = $attributeID . '_' . $label->{'id'}; echo '<li><input type="radio" name="attribute_' . $attributeID . '" value="' . $label->{'id'} . '" id="' . $id . '" />'; echo '<label for="' . $id . '" title="' . $label->{'description'} . '">' . $label->{'name'} . '</label></li>';
public function toArray() { $array = parent::toArray(); // small modifications $array["unixtime"] = strtotime($array["created_at"]); $array["edited"] = strtotime($array["updated_at"]); $array["timeago"] = time_ago($array["created_at"]); $array["time"] = modding_link(rtrim($array["time"])); $array["text"] = linkify(modding_link($array["text"])); $array["icon"] = $array["is_resolved"] ? $this->icons["resolved"] : (@$this->icons[$array["type"]] ?: ""); // renames $array["id"] = $array["item_id"]; $array["beatmap"] = $array["beatmap_id"]; $array["resolved"] = $array["is_resolved"]; // unsets unset($array["item_id"]); unset($array["beatmapset_id"]); unset($array["beatmap_id"]); unset($array["is_resolved"]); unset($array["created_at"]); unset($array["updated_at"]); if (!$array["deleted_at"]) { unset($array["deleted_at"]); } return $array; }
<?php foreach ($contents as $line) { $line = htmlentities($line); $proto = trim(substr($line, 0, strpos($line, ':'))); $target = between($line, ' : ', ' ->'); switch ($proto) { case 'SNMP': $user = '******'; $password = padpw(between($line, '-> COMMUNITY:', 'INFO:')); $info = between($line, 'INFO:', false); PrintCapItem($proto, $target, $user, $password, $info); break; case 'HTTP': $user = between($line, 'USER:'******'PASS:'******'PASS: '******' INFO:')); $info = linkify(between($line, 'INFO:', false)); PrintCapItem($proto, $target, $user, $password, $info); break; case 'TELNET': $user = between($line, 'USER:'******'PASS:'******'PASS:'******'POP': $user = between($line, 'USER:'******'PASS:'******'PASS:'******'FTP': $user = between($line, 'USER:'******'PASS:'******'PASS:', false));
/** * @return array */ public function broadcastWith() { return ['shout' => ['message' => nl2br(linkify(htmlentities($this->shout->shout))), 'username' => $this->user->username, 'id' => $this->user->id, 'name' => htmlentities($this->user->displayName()), 'admin' => $this->user->isAdmin(), 'profile_pic' => $this->user->getGravatarLink(40), 'created_at' => $this->shout->created_at->diffForHumans()]]; }
?> " title="Subscribe to <?php echo SITE_TITLE; ?> via RSS"><img src="themes/mellow/i/rss.png" alt="Feed Icon"></a></div> <ul id="updatelist"> <?php $i = 0; foreach ($tweets as $tweet) { $tweet->tagify(); $cleantext = $tweet->message; //$tweet->clean(); echo "<li id=\"tweet-" . $tweet->id . "\" class=\"tweet" . ($i % 2 == 0 ? " altrow" : "") . "\">\n"; echo "<div class=\"userpic\"><a href=\"http://twitter.com/" . $tweet->screen_name . "\"><img src=\"" . $tweet->userpic . "\" alt=\"\" /></a></div>\n"; echo "<div class=\"tweet-meta\"><a href=\"http://twitter.com/" . $tweet->screen_name . "\">" . $tweet->name . "</a> " . relativeTime(strtotime($tweet->published)) . "</div>"; echo "<div class=\"tweet-body\">" . linkify($cleantext) . ' <a href="' . $tweet->permalink() . '" class="permalink">∞</a></div>'; echo "</li>\n"; $i++; } ?> </ul> <?php if ($tweets) { echo Paginator::paginate($offset, Tweet::count($tag), PAGE_LIMIT, "index.php?" . ($tag ? 'tag=' . urlencode($tag) . '&' : '') . "offset="); } else { echo "<div class=\"tweetless\">\n"; echo "No tweets.\n"; echo "</div>\n"; } ?> </div>
function formatText($text) { return "<tt>" . linkify(str_replace("\n", "<br>\n", ereg_replace("^ ", " ", str_replace("\n ", "\n ", preg_replace("/( *) /e", "str_replace(' ',' ','\\1').' '", htmlentities($text)))))) . "</tt>"; }
function get() { if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) { notice(t('Public access denied.') . EOL); return; } $observer = get_observer_hash(); $globaldir = get_directory_setting($observer, 'globaldir'); // override your personal global search pref if we're doing a navbar search of the directory if (intval($_REQUEST['navsearch'])) { $globaldir = 1; } $safe_mode = get_directory_setting($observer, 'safemode'); $pubforums = get_directory_setting($observer, 'pubforums'); $o = ''; nav_set_selected('directory'); if (x($_POST, 'search')) { $search = notags(trim($_POST['search'])); } else { $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : ''; } if (strpos($search, '=') && local_channel() && get_pconfig(local_channel(), 'feature', 'expert')) { $advanced = $search; } $keywords = $_GET['keywords'] ? $_GET['keywords'] : ''; // Suggest channels if no search terms or keywords are given $suggest = local_channel() && x($_REQUEST, 'suggest') ? $_REQUEST['suggest'] : ''; if ($suggest) { $r = suggestion_query(local_channel(), get_observer_hash()); // Remember in which order the suggestions were $addresses = array(); $common = array(); $index = 0; foreach ($r as $rr) { $common[$rr['xchan_addr']] = $rr['total']; $addresses[$rr['xchan_addr']] = $index++; } // Build query to get info about suggested people $advanced = ''; foreach (array_keys($addresses) as $address) { $advanced .= "address=\"{$address}\" "; } // Remove last space in the advanced query $advanced = rtrim($advanced); } $tpl = get_markup_template('directory_header.tpl'); $dirmode = intval(get_config('system', 'directory_mode')); if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) { $url = z_root() . '/dirsearch'; } if (!$url) { $directory = find_upstream_directory($dirmode); if (!$directory || !array_key_exists('url', $directory) || !$directory['url']) { logger('CRITICAL: No directory server URL'); } $url = $directory['url'] . '/dirsearch'; } $token = get_config('system', 'realm_token'); logger('mod_directory: URL = ' . $url, LOGGER_DEBUG); $contacts = array(); if (local_channel()) { $x = q("select abook_xchan from abook where abook_channel = %d", intval(local_channel())); if ($x) { foreach ($x as $xx) { $contacts[] = $xx['abook_xchan']; } } } if ($url) { $numtags = get_config('system', 'directorytags'); $kw = intval($numtags) > 0 ? intval($numtags) : 50; if (get_config('system', 'disable_directory_keywords')) { $kw = 0; } $query = $url . '?f=&kw=' . $kw . ($safe_mode != 1 ? '&safe=' . $safe_mode : ''); if ($token) { $query .= '&t=' . $token; } if (!$globaldir) { $query .= '&hub=' . \App::get_hostname(); } if ($search) { $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search); } if (strpos($search, '@')) { $query .= '&address=' . urlencode($search); } if ($keywords) { $query .= '&keywords=' . urlencode($keywords); } if ($advanced) { $query .= '&query=' . urlencode($advanced); } if (!is_null($pubforums)) { $query .= '&pubforums=' . intval($pubforums); } $directory_sort_order = get_config('system', 'directory_sort_order'); if (!$directory_sort_order) { $directory_sort_order = 'date'; } $sort_order = x($_REQUEST, 'order') ? $_REQUEST['order'] : $directory_sort_order; if ($sort_order) { $query .= '&order=' . urlencode($sort_order); } if (\App::$pager['page'] != 1) { $query .= '&p=' . \App::$pager['page']; } logger('mod_directory: query: ' . $query); $x = z_fetch_url($query); logger('directory: return from upstream: ' . print_r($x, true), LOGGER_DATA); if ($x['success']) { $t = 0; $j = json_decode($x['body'], true); if ($j) { if ($j['results']) { $entries = array(); $photo = 'thumb'; foreach ($j['results'] as $rr) { $profile_link = chanlink_url($rr['url']); $pdesc = $rr['description'] ? $rr['description'] . '<br />' : ''; $connect_link = local_channel() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : ''; // Checking status is disabled ATM until someone checks the performance impact more carefully //$online = remote_online_status($rr['address']); $online = ''; if (in_array($rr['hash'], $contacts)) { $connect_link = ''; } $location = ''; if (strlen($rr['locale'])) { $location .= $rr['locale']; } if (strlen($rr['region'])) { if (strlen($rr['locale'])) { $location .= ', '; } $location .= $rr['region']; } if (strlen($rr['country'])) { if (strlen($location)) { $location .= ', '; } $location .= $rr['country']; } $age = ''; if (strlen($rr['birthday'])) { if (($years = age($rr['birthday'], 'UTC', '')) != 0) { $age = $years; } } $page_type = ''; if ($rr['total_ratings']) { $total_ratings = sprintf(tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']); } else { $total_ratings = ''; } $profile = $rr; if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) { $gender = x($profile, 'gender') == 1 ? t('Gender: ') . $profile['gender'] : False; } $marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False; $homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') : False; $homepageurl = x($profile, 'homepage') == 1 ? $profile['homepage'] : ''; $hometown = x($profile, 'hometown') == 1 ? $profile['hometown'] : False; $about = x($profile, 'about') == 1 ? bbcode($profile['about']) : False; $keywords = x($profile, 'keywords') ? $profile['keywords'] : ''; $out = ''; if ($keywords) { $keywords = str_replace(',', ' ', $keywords); $keywords = str_replace(' ', ' ', $keywords); $karr = explode(' ', $keywords); if ($karr) { if (local_channel()) { $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_channel())); if ($r) { $keywords = str_replace(',', ' ', $r[0]['keywords']); $keywords = str_replace(' ', ' ', $keywords); $marr = explode(' ', $keywords); } } foreach ($karr as $k) { if (strlen($out)) { $out .= ', '; } if ($marr && in_arrayi($k, $marr)) { $out .= '<strong>' . $k . '</strong>'; } else { $out .= $k; } } } } $entry = array('id' => ++$t, 'profile_link' => $profile_link, 'public_forum' => $rr['public_forum'], 'photo' => $rr['photo'], 'hash' => $rr['hash'], 'alttext' => $rr['name'] . (local_channel() || remote_channel() ? ' ' . $rr['address'] : ''), 'name' => $rr['name'], 'age' => $age, 'age_label' => t('Age:'), 'profile' => $profile, 'address' => $rr['address'], 'nickname' => substr($rr['address'], 0, strpos($rr['address'], '@')), 'location' => $location, 'location_label' => t('Location:'), 'gender' => $gender, 'total_ratings' => $total_ratings, 'viewrate' => true, 'canrate' => local_channel() ? true : false, 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), 'marital' => $marital, 'homepage' => $homepage, 'homepageurl' => linkify($homepageurl), 'hometown' => $hometown, 'hometown_label' => t('Hometown:'), 'about' => $about, 'about_label' => t('About:'), 'conn_label' => t('Connect'), 'forum_label' => t('Public Forum:'), 'connect' => $connect_link, 'online' => $online, 'kw' => $out ? t('Keywords: ') : '', 'keywords' => $out, 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '', 'ignore_label' => t('Don\'t suggest'), 'common_friends' => $common[$rr['address']] ? intval($common[$rr['address']]) : '', 'common_label' => t('Common connections:'), 'common_count' => intval($common[$rr['address']]), 'safe' => $safe_mode); $arr = array('contact' => $rr, 'entry' => $entry); call_hooks('directory_item', $arr); unset($profile); unset($location); if (!$arr['entry']) { continue; } if ($sort_order == '' && $suggest) { $entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first } else { $entries[] = $arr['entry']; } } ksort($entries); // Sort array by key so that foreach-constructs work as expected if ($j['keywords']) { \App::$data['directory_keywords'] = $j['keywords']; } logger('mod_directory: entries: ' . print_r($entries, true), LOGGER_DATA); if ($_REQUEST['aj']) { if ($entries) { $o = replace_macros(get_markup_template('directajax.tpl'), array('$entries' => $entries)); } else { $o = '<div id="content-complete"></div>'; } echo $o; killme(); } else { $maxheight = 94; $dirtitle = $globaldir ? t('Global Directory') : t('Local Directory'); $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>"; $o .= replace_macros($tpl, array('$search' => $search, '$desc' => t('Find'), '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search, ENT_QUOTES, 'UTF-8'), '$entries' => $entries, '$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle, '$submit' => t('Find'), '$next' => alt_pager($a, $j['records'], t('next page'), t('previous page')), '$sort' => t('Sort options'), '$normal' => t('Alphabetic'), '$reverse' => t('Reverse Alphabetic'), '$date' => t('Newest to Oldest'), '$reversedate' => t('Oldest to Newest'), '$suggest' => $suggest ? '&suggest=1' : '')); } } else { if ($_REQUEST['aj']) { $o = '<div id="content-complete"></div>'; echo $o; killme(); } if (\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search, '@')) { goaway(z_root() . '/chanview/?f=&address=' . $search); } info(t("No entries (some entries may be hidden).") . EOL); } } } } return $o; }
// Use the text file tweet_template.txt to construct each tweet in the list $tweet_template = file_get_contents('tweet_template.txt', FILE_USE_INCLUDE_PATH); $tweet_list = ''; $tweets_found = 0; while (($row = mysqli_fetch_assoc($result)) && $tweets_found < TWEET_DISPLAY_COUNT) { ++$tweets_found; // create a fresh copy of the empty template $current_tweet = $tweet_template; // Fill in the template with the current tweet $current_tweet = str_replace('[profile_image_url]', $row['profile_image_url'], $current_tweet); $current_tweet = str_replace('[created_at]', twitter_time($row['created_at']), $current_tweet); $current_tweet = str_replace('[screen_name]', $row['screen_name'], $current_tweet); $current_tweet = str_replace('[name]', $row['name'], $current_tweet); $current_tweet = str_replace('[user_mention_title]', USER_MENTION_TITLE . ' ' . $row['screen_name'] . ' (' . $row['name'] . ')', $current_tweet); $current_tweet = str_replace('[tweet_display_title]', TWEET_DISPLAY_TITLE, $current_tweet); $current_tweet = str_replace('[tweet_text]', linkify($row['tweet_text']), $current_tweet); // Include each tweet's id so site.js can request older or newer tweets $current_tweet = str_replace('[tweet_id]', $row['tweet_id'], $current_tweet); // Add this tweet to the list $tweet_list .= $current_tweet; } if (!$tweets_found) { if (isset($_GET['last'])) { $tweet_list = '<strong>No more tweets found</strong><br />'; } else { $tweet_list = '<strong>No tweets found</strong><br />'; } } if (isset($_GET['last'])) { // Called by site.js with Ajax, so print HTML to the browser print $tweet_list;
<span class="action <?php echo $comment->action; ?> ">(<?php echo $comment->action; ?> request)</span> <?php } ?> <?php if (isset($edit_ui) && $edit_ui) { ?> <a class="delete_button" class="button" href="#" onclick="deleteComment(<?php echo $comment->id; ?> )">delete</a> <?php } ?> </div> <div class="body"><?php echo linkify(htmlify($comment->body)); ?> </div> </li> <?php } ?> </ul>
public function toArray() { $array = parent::toArray(); // small modifications $array['unixtime'] = strtotime($array['created_at']); $array['edited'] = strtotime($array['updated_at']); $array['timeago'] = time_ago($array['created_at']); $array['time'] = modding_link(rtrim($array['time'])); $array['text'] = linkify(modding_link($array['text'])); $array['icon'] = $array['is_resolved'] ? $this->icons['resolved'] : (@$this->icons[$array['type']] ?: ''); // renames $array['id'] = $array['item_id']; $array['beatmap'] = $array['beatmap_id']; $array['resolved'] = $array['is_resolved']; // unsets unset($array['item_id']); unset($array['beatmapset_id']); unset($array['beatmap_id']); unset($array['is_resolved']); unset($array['created_at']); unset($array['updated_at']); if (!$array['deleted_at']) { unset($array['deleted_at']); } return $array; }
function preparse_bbcode($text, &$errors, $is_signature = false) { global $lang_common, $feather_config, $pd; $pd['new_errors'] = array(); // Reset the parser error message stack. $pd['in_signature'] = $is_signature ? true : false; $pd['ipass'] = 1; $newtext = preg_replace_callback($pd['re_bbcode'], '_preparse_bbcode_callback', $text); if ($newtext === null) { // On error, preg_replace_callback returns NULL. // Error #1: '(%s) Message is too long or too complex. Please shorten.' $errors[] = sprintf($lang_common['BBerr pcre'], preg_error()); return $text; } $newtext = str_replace("", '[', $newtext); // Fixup CODE sections. $parts = explode("", $newtext); // Hidden chunks pre-marked like so: "\1\2<code.../code>\1" for ($i = 0, $len = count($parts); $i < $len; ++$i) { // Loop through hidden and non-hidden text chunks. $part =& $parts[$i]; // Use shortcut alias if (empty($part)) { continue; } // Skip empty string chunks. if ($part[0] !== "") { // If not hidden, process this normal text content. // Mark erroneous orphan tags. $part = preg_replace_callback($pd['re_bbtag'], '_orphan_callback', $part); // Process do-clickeys if enabled. if ($feather_config['o_make_links']) { $part = linkify($part); } // Process textile syntax tag shortcuts. if ($pd['config']['textile']) { // Do phrase replacements. $part = preg_replace_callback($pd['re_textile'], '_textile_phrase_callback', $part); // Do lists. $part = preg_replace_callback('/^([*#]) .*+(?:\\n\\1 .*+)++$/Sm', '_textile_list_callback', $part); } $part = preg_replace('/^[ \\t]++$/m', '', $part); // Clear "white" lines of spaces and tabs. } else { $part = substr($part, 1); } // For hidden chunks, strip \2 marker byte. } $text = implode("", $parts); // Put hidden and non-hidden chunks back together. $pd['ipass'] = 2; // Run a second pass through parser to clean changed content. $text = preg_replace_callback($pd['re_bbcode'], '_preparse_bbcode_callback', $text); $text = str_replace("", '[', $text); // Fixup CODE sections. if (!empty($pd['new_errors'])) { foreach ($pd['new_errors'] as $errmsg) { $errors[] = $errmsg; } // Push all new errors on global array. } return $text; }
function makelink($query_vars, $params = array()) { $link = get_permalink(); $p = array_merge($query_vars, $params); // Page 1 is the default, don't clutter urls with it... if ($p['fdpage'] == 1) { unset($p['fdpage']); } // Likewise for list style... if ($p['fdstyle'] == 'list') { unset($p['fdstyle']); } $vars = linkify($p); if (strlen($vars) == 0) { return $link; } if (strpos($link, '?') === false) { $link .= '?'; } else { $link .= '&'; } return $link . $vars; }
// it's an all day event $eventDateStart = $event->start->date; } if (empty($eventDateEnd)) { // If there isn't any end time.. // MAYBE it's an all day event $eventDateEnd = $event->end->date; } $gcal .= '<div class="list-group-item"> <h4 class="list-group-item-heading">' . $event->summary . '</h4> <p class="list-group-item-text date">' . dateToDate($eventDateStart, $eventDateEnd) . '</p> <p class="list-group-item-text lieu">' . $event->location . '</p> '; // It's not required to enter a description, but if there's one... if (!empty($event->description)) { $gcal .= '<p class="list-group-item-text desc">' . linkify(nl2br($event->description)) . '</p>'; } $gcal .= ' </div> '; $count++; } // If there wasen't any events, then say there's nothing. if ($count == 0) { $gcal = ' <span class="list-group-item"> <h4 class="list-group-item-heading">Aucun évènement futur prévu (pour l\'instant)</h4> </span> '; } // Save to the "events.html" file
function advanced_profile(&$a) { $o .= ''; $o .= '<h2>' . t('Profile') . '</h2>'; if ($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); $profile = array(); $profile['fullname'] = array(t('Full Name:'), $a->profile['name']); if ($a->profile['gender']) { $profile['gender'] = array(t('Gender:'), $a->profile['gender']); } if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') { $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 6) . ' 00:00 +00:00', $short_bd_format)); $profile['birthday'] = array(t('Birthday:'), $val); } if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) { $profile['age'] = array(t('Age:'), $age); } if ($a->profile['marital']) { $profile['marital'] = array(t('Status:'), $a->profile['marital']); } if ($a->profile['with']) { $profile['marital']['with'] = $a->profile['with']; } if ($a->profile['sexual']) { $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']); } if ($a->profile['homepage']) { $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage'])); } if ($a->profile['pub_keywords']) { $profile['pub_keywords'] = array(t('Tags:'), $a->profile['pub_keywords']); } if ($a->profile['politic']) { $profile['politic'] = array(t('Political Views:'), $a->profile['politic']); } if ($a->profile['religion']) { $profile['religion'] = array(t('Religion:'), $a->profile['religion']); } if ($txt = prepare_text($a->profile['about'])) { $profile['about'] = array(t('About:'), $txt); } if ($txt = prepare_text($a->profile['interest'])) { $profile['interest'] = array(t('Hobbies/Interests:'), $txt); } if ($txt = prepare_text($a->profile['contact'])) { $profile['contact'] = array(t('Contact information and Social Networks:'), $txt); } if ($txt = prepare_text($a->profile['music'])) { $profile['music'] = array(t('Musical interests:'), $txt); } if ($txt = prepare_text($a->profile['book'])) { $profile['book'] = array(t('Books, literature:'), $txt); } if ($txt = prepare_text($a->profile['tv'])) { $profile['tv'] = array(t('Television:'), $txt); } if ($txt = prepare_text($a->profile['film'])) { $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt); } if ($txt = prepare_text($a->profile['romance'])) { $profile['romance'] = array(t('Love/Romance:'), $txt); } if ($txt = prepare_text($a->profile['work'])) { $profile['work'] = array(t('Work/employment:'), $txt); } if ($txt = prepare_text($a->profile['education'])) { $profile['education'] = array(t('School/education:'), $txt); } } return replace_macros($tpl, array('$title' => t('Profile'), '$profile' => $profile)); }
function add_links_to_text($text) { // Explicit URLs if (preg_match("/\\((http:\\/\\/.+?)\\)/si", $text, $match)) { $text = linkify($text, $match[1], $match[1]); } // SORBS: Spam and Open Relay Blocking System $text = linkify($text, "SORBS", "http://www.sorbs.net/"); // Razor2: Vipul's Razor $text = linkify($text, "Razor2", "http://razor.sourceforge.net/"); // Pyzor $text = linkify($text, "Pyzor", "http://pyzor.sourceforge.net/"); // DCC: Distributed Checksum Clearinghouse $text = linkify($text, "DCC", "http://rhyolite.com/anti-spam/dcc/"); // NJABL: Not Just Another Bogus List $text = linkify($text, "NJABL", "http://www.njabl.org/"); $text = linkify($text, "dnsbl.njabl.org", "http://www.njabl.org/"); // SpamCop Blocking List $text = linkify($text, "bl.spamcop.net", "http://www.spamcop.net/bl.shtml"); // OPM: Blitzed Open Proxy Monitor $text = linkify($text, "opm.blitzed.org", "http://www.blitzed.org/bopm/"); $text = linkify($text, "OPM", "http://www.blitzed.org/bopm/"); // DSBL: Distributed Server Boycott List $text = linkify($text, "list.dsbl.org", "http://www.dsbl.org/"); // RFCI: RFC-Ignorant $text = linkify($text, "ipwhois.rfc-ignorant.org", "http://www.rfc-ignorant.org/policy-ipwhois.php"); $text = linkify($text, "dsn.rfc-ignorant.org", "http://www.rfc-ignorant.org/policy-dsn.php"); // SBL: Spamhaus Block List $text = linkify($text, "Spamhaus Block List", "http://www.spamhaus.org/sbl/"); // MAPS: Mail Abuse Prevention System $text = linkify($text, "RBL", "http://www.mail-abuse.org/rbl/"); $text = linkify($text, "DUL", "http://www.mail-abuse.org/dul/"); $text = linkify($text, "RSS", "http://www.mail-abuse.org/rss/"); $text = linkify($text, "NML", "http://www.mail-abuse.org/nml/"); // BSP: Bonded Sender Program $text = linkify($text, "Bonded Sender Program", "http://www.bondedsender.com/"); // Habeas Sender Warranted E-mail $text = linkify($text, "Habeas", "http://www.habeas.com/"); // CBL: Composite Blocking List $text = linkify($text, "cbl.abuseat.org", "http://cbl.abuseat.org/"); // Easynet DNSBL $text = linkify($text, "proxies.blackholes.easynet.nl", "http://abuse.easynet.nl/proxies.html"); // AHBL: Abusive Hosts Blocking List $text = linkify($text, "AHBL", "http://www.ahbl.org"); $text = linkify($text, "dnsbl.ahbl.org", "http://www.ahbl.org"); return $text; }
*/ if (!(ctype_alnum($_GET['code']) && strlen($_GET['code']) == 32)) { echo template('master', ['content' => template('error', ['error' => "The code parameter provided doesn't look right.", 'details' => ''])]); exit; } $response = \Httpful\Request::post('https://api.instagram.com/oauth/access_token', 'client_id=' . $config['client_id'] . '&client_secret=' . $config['client_secret'] . '&grant_type=authorization_code' . '&redirect_uri=' . $config['redirect_uri'] . '&code=' . $_GET['code'])->send(); if ($response->code == 200) { $_SESSION['token'] = $response->body->access_token; } else { echo template('master', ['content' => template('error', ['error' => 'An error occured while trying to get an access token.', 'details' => debugging($response)])]); exit; } } } $token = $_SESSION['token']; $numberOfPosts = get('tags/capitalone')->data->media_count; $posts = get('tags/capitalone/media/recent?count=20')->data; $positive = $negative = $neutral = 0; foreach ($posts as $post) { $user = get('users/' . $post->user->id)->data->counts; $positivity = positivity($post->caption->text); if ($positivity === 0) { $neutral++; } elseif ($positivity > 0) { $positive++; } elseif ($positivity < 0) { $negative++; } $postTable .= template('post', ['url' => $post->link, 'likes' => $post->likes->count, 'user_name' => prettyprint($post->user->full_name, $post->user->username), 'user_url' => 'https://instagram.com/' . $post->user->username, 'user_posts' => $user->media, 'user_followed_by' => $user->followed_by, 'user_follows' => $user->follows, 'caption' => linkify(truncate($post->caption->text)), 'positivity' => $positivity, 'major' => $user->followed_by / $user->follows > 2 ? 'major' : '']); } echo template('master', ['content' => template('main', ['num' => number_format($numberOfPosts), 'positive' => $positive, 'negative' => $negative, 'neutral' => $neutral, 'posts' => $postTable])]);
if (isset($_GET['url'])) { $url = base64_decode($_GET['url']); } else { $url = ""; } if ($url != "") { $sql = "(SELECT * FROM streams_comments where url='{$url}' and comment!='' ORDER BY id DESC) ORDER BY id ASC LIMIT 100"; } //Display comments echo "<div id='commentthreadbox'><table cellpadding='0'>"; $dbreturn = databasequery($sql); foreach ($dbreturn as $row) { $User = htmlspecialchars($row["user"], ENT_QUOTES); $Comment = htmlspecialchars($row["comment"], ENT_QUOTES); $Comment = nl2br(strip_tags(html_entity_decode($Comment))); $Comment = linkify($Comment); $articletitle = html_entity_decode($row["title"]); $CommentID = htmlspecialchars($row["id"], ENT_QUOTES); $CommentCreationTime = htmlspecialchars($row["creationtime"], ENT_QUOTES); //Display comment creation in correct format if (strtotime($CommentCreationTime) < strtotime('-7 days')) { $CommentCreationTime = date("F j", strtotime($CommentCreationTime)) . " at " . date("g:i A", strtotime($CommentCreationTime)); } else { $CommentCreationTime = date("l", strtotime($CommentCreationTime)) . " at " . date("g:i A", strtotime($CommentCreationTime)); } //Look up name given email from directory $User2 = encrypt($User, ""); $picture = ""; $sql = "SELECT firstname, lastname, picture FROM directory where email='{$User2}'"; $dbreturn = databasequery($sql); foreach ($dbreturn as $row) {
/** * * Shows the header * */ function head($page_name, $file) { $head = <<<HEAD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>{$page_name}</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> HEAD; $head .= "<h1>" . linkify($file, $page_name) . "</h1>"; return $head; }
/** @file */ function profile_activity($changed, $value) { $a = get_app(); if (!local_user() || !is_array($changed) || !count($changed)) { return; } if (!get_pconfig(local_user(), 'system', 'post_profilechange')) { return; } require_once 'include/items.php'; $self = $a->get_channel(); if (!count($self)) { return; } $arr = array(); $arr['mid'] = $arr['parent_mid'] = item_message_id(); $arr['uid'] = local_user(); $arr['aid'] = $self['channel_account_id']; $arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash']; $arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN | ITEM_THREAD_TOP; $arr['verb'] = ACTIVITY_UPDATE; $arr['obj_type'] = ACTIVITY_OBJ_PROFILE; $arr['plink'] = z_root() . '/channel/' . $self['channel_address'] . '/?f=&mid=' . $arr['mid']; $A = '[url=' . z_root() . '/channel/' . $self['channel_address'] . ']' . $self['channel_name'] . '[/url]'; $changes = ''; $t = count($changed); $z = 0; foreach ($changed as $ch) { if (strlen($changes)) { if ($z == $t - 1) { $changes .= t(' and '); } else { $changes .= ', '; } } $z++; $changes .= $ch; } $prof = '[url=' . z_root() . '/profile/' . $self['channel_address'] . ']' . t('public profile') . '[/url]'; if ($t == 1 && strlen($value)) { // if it's a url, the HTML quotes will mess it up, so link it and don't try and zidify it because we don't know what it points to. $value = linkify($value); $message = sprintf(t('%1$s changed %2$s to “%3$s”'), $A, $changes, $value); $message .= "\n\n" . sprintf(t('Visit %1$s\'s %2$s'), $A, $prof); } else { $message = sprintf(t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes); } $arr['body'] = $message; $links = array(); $links[] = array('rel' => 'alternate', 'type' => 'text/html', 'href' => z_root() . '/profile/' . $self['channel_address']); $links[] = array('rel' => 'photo', 'type' => $self['xchan_photo_mimetype'], 'href' => $self['xchan_photo_l']); $arr['object'] = json_encode(array('type' => ACTIVITY_OBJ_PROFILE, 'title' => $self['channel_name'], 'id' => $self['xchan_url'] . '/' . $self['xchan_hash'], 'link' => $links)); $arr['allow_cid'] = $self['channel_allow_cid']; $arr['allow_gid'] = $self['channel_allow_gid']; $arr['deny_cid'] = $self['channel_deny_cid']; $arr['deny_gid'] = $self['channel_deny_gid']; $res = item_store($arr); $i = $res['item_id']; if ($i) { // FIXME - limit delivery in notifier.php to those specificed in the perms argument proc_run('php', "include/notifier.php", "activity", "{$i}", 'PERMS_R_PROFILE'); } }
?> <p> <?php echo htmlspecialchars($submission['users_name']); ?> submitted a task. </p> <p><strong>Task description: </strong><?php echo linkify(nl2br(htmlspecialchars($submission['task_description']))); ?> </p> <?php if (isset($submission['answer'])) { ?> <p><strong>Their answer: </strong><?php echo linkify(nl2br(htmlspecialchars($submission['answer']))); ?> </p> <?php } ?> <p> <hr> <?php } ?> </div> <?php $this->load_fragment('google_analytics'); ?> </body>
require 'display_lib.php'; // Create a stream of formatted tweets as HTML $tweet_stream = ''; foreach ($tweet_data as $tweet) { // Ignore any retweets if (isset($tweet['retweeted_status'])) { continue; } // Get a fresh copy of the tweet template $tweet_html = $tweet_template; // Insert this tweet into the html $tweet_html = str_replace('[screen_name]', $tweet['user']['screen_name'], $tweet_html); $tweet_html = str_replace('[name]', $tweet['user']['name'], $tweet_html); $tweet_html = str_replace('[profile_image_url]', $tweet['user']['profile_image_url'], $tweet_html); $tweet_html = str_replace('[tweet_id]', $tweet['id'], $tweet_html); $tweet_html = str_replace('[tweet_text]', linkify($tweet['text']), $tweet_html); $tweet_html = str_replace('[created_at]', twitter_time($tweet['created_at']), $tweet_html); $tweet_html = str_replace('[retweet_count]', $tweet['retweet_count'], $tweet_html); // Add the HTML for this tweet to the stream $tweet_stream .= $tweet_html; } // Pass the tweets HTML back to the Ajax request print $tweet_stream; // Handle errors from API request } else { if ($http_code == 429) { print 'Error: Twitter API rate limit reached'; } else { print 'Error: Twitter was not able to process that search'; } }
function advanced_profile(&$a) { require_once 'include/text.php'; if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) { return ''; } $o = ''; $o .= '<h2>' . t('Profile') . '</h2>'; if ($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); $profile = array(); $profile['fullname'] = array(t('Full Name:'), $a->profile['name']); if ($a->profile['gender']) { $profile['gender'] = array(t('Gender:'), $a->profile['gender']); } $ob_hash = get_observer_hash(); if ($ob_hash && perm_is_allowed($a->profile['profile_uid'], $ob_hash, 'post_like')) { $profile['canlike'] = true; $profile['likethis'] = t('Like this channel'); $profile['profile_guid'] = $a->profile['profile_guid']; } $likers = q("select liker, xchan.* from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", intval($a->profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE)); $profile['likers'] = array(); $profile['like_count'] = count($likers); $profile['like_button_label'] = tt('Like', 'Likes', $profile['like_count'], 'noun'); if ($likers) { foreach ($likers as $l) { $profile['likers'][] = array('name' => $l['xchan_name'], 'url' => zid($l['xchan_url'])); } } if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') { $val = ''; if (substr($a->profile['dob'], 5, 2) === '00' || substr($a->profile['dob'], 8, 2) === '00') { $val = substr($a->profile['dob'], 0, 4); } $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); if (!$val) { $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)); } $profile['birthday'] = array(t('Birthday:'), $val); } if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) { $profile['age'] = array(t('Age:'), $age); } if ($a->profile['marital']) { $profile['marital'] = array(t('Status:'), $a->profile['marital']); } if ($a->profile['with']) { $profile['marital']['with'] = bbcode($a->profile['with']); } if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) { $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); } if ($a->profile['sexual']) { $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']); } if ($a->profile['homepage']) { $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage'])); } if ($a->profile['hometown']) { $profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown'])); } if ($a->profile['keywords']) { $profile['keywords'] = array(t('Tags:'), $a->profile['keywords']); } if ($a->profile['politic']) { $profile['politic'] = array(t('Political Views:'), $a->profile['politic']); } if ($a->profile['religion']) { $profile['religion'] = array(t('Religion:'), $a->profile['religion']); } if ($txt = prepare_text($a->profile['about'])) { $profile['about'] = array(t('About:'), $txt); } if ($txt = prepare_text($a->profile['interest'])) { $profile['interest'] = array(t('Hobbies/Interests:'), $txt); } if ($txt = prepare_text($a->profile['likes'])) { $profile['likes'] = array(t('Likes:'), $txt); } if ($txt = prepare_text($a->profile['dislikes'])) { $profile['dislikes'] = array(t('Dislikes:'), $txt); } if ($txt = prepare_text($a->profile['contact'])) { $profile['contact'] = array(t('Contact information and Social Networks:'), $txt); } if ($txt = prepare_text($a->profile['channels'])) { $profile['channels'] = array(t('My other channels:'), $txt); } if ($txt = prepare_text($a->profile['music'])) { $profile['music'] = array(t('Musical interests:'), $txt); } if ($txt = prepare_text($a->profile['book'])) { $profile['book'] = array(t('Books, literature:'), $txt); } if ($txt = prepare_text($a->profile['tv'])) { $profile['tv'] = array(t('Television:'), $txt); } if ($txt = prepare_text($a->profile['film'])) { $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt); } if ($txt = prepare_text($a->profile['romance'])) { $profile['romance'] = array(t('Love/Romance:'), $txt); } if ($txt = prepare_text($a->profile['work'])) { $profile['work'] = array(t('Work/employment:'), $txt); } if ($txt = prepare_text($a->profile['education'])) { $profile['education'] = array(t('School/education:'), $txt); } if ($a->profile['extra_fields']) { foreach ($a->profile['extra_fields'] as $f) { $x = q("select * from profdef where field_name = '%s' limit 1", dbesc($f)); if ($x && ($txt = prepare_text($a->profile[$f]))) { $profile[$f] = array($x[0]['field_desc'] . ':', $txt); } } $profile['extra_fields'] = $a->profile['extra_fields']; } $things = get_things($a->profile['profile_guid'], $a->profile['profile_uid']); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); return replace_macros($tpl, array('$title' => t('Profile'), '$canlike' => $profile['canlike'] ? true : false, '$likethis' => t('Like this thing'), '$profile' => $profile, '$things' => $things)); } return ''; }
function advanced_profile(&$a) { $o = ''; $uid = $a->profile['uid']; $o .= replace_macros(get_markup_template('section_title.tpl'), array('$title' => t('Profile'))); if ($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); $profile = array(); $profile['fullname'] = array(t('Full Name:'), $a->profile['name']); if ($a->profile['gender']) { $profile['gender'] = array(t('Gender:'), $a->profile['gender']); } if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') { $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)); $profile['birthday'] = array(t('Birthday:'), $val); } if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) { $profile['age'] = array(t('Age:'), $age); } if ($a->profile['marital']) { $profile['marital'] = array(t('Status:'), $a->profile['marital']); } if ($a->profile['with']) { $profile['marital']['with'] = $a->profile['with']; } if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') { $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); } if ($a->profile['sexual']) { $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']); } if ($a->profile['homepage']) { $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage'])); } if ($a->profile['hometown']) { $profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown'])); } if ($a->profile['pub_keywords']) { $profile['pub_keywords'] = array(t('Tags:'), $a->profile['pub_keywords']); } if ($a->profile['politic']) { $profile['politic'] = array(t('Political Views:'), $a->profile['politic']); } if ($a->profile['religion']) { $profile['religion'] = array(t('Religion:'), $a->profile['religion']); } if ($txt = prepare_text($a->profile['about'])) { $profile['about'] = array(t('About:'), $txt); } if ($txt = prepare_text($a->profile['interest'])) { $profile['interest'] = array(t('Hobbies/Interests:'), $txt); } if ($txt = prepare_text($a->profile['likes'])) { $profile['likes'] = array(t('Likes:'), $txt); } if ($txt = prepare_text($a->profile['dislikes'])) { $profile['dislikes'] = array(t('Dislikes:'), $txt); } if ($txt = prepare_text($a->profile['contact'])) { $profile['contact'] = array(t('Contact information and Social Networks:'), $txt); } if ($txt = prepare_text($a->profile['music'])) { $profile['music'] = array(t('Musical interests:'), $txt); } if ($txt = prepare_text($a->profile['book'])) { $profile['book'] = array(t('Books, literature:'), $txt); } if ($txt = prepare_text($a->profile['tv'])) { $profile['tv'] = array(t('Television:'), $txt); } if ($txt = prepare_text($a->profile['film'])) { $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt); } if ($txt = prepare_text($a->profile['romance'])) { $profile['romance'] = array(t('Love/Romance:'), $txt); } if ($txt = prepare_text($a->profile['work'])) { $profile['work'] = array(t('Work/employment:'), $txt); } if ($txt = prepare_text($a->profile['education'])) { $profile['education'] = array(t('School/education:'), $txt); } //show subcribed forum if it is enabled in the usersettings if (feature_enabled($uid, 'forumlist_profile')) { $profile['forumlist'] = array(t('Forums:'), forumlist_profile_advanced($uid)); } if ($a->profile['uid'] == local_user()) { $profile['edit'] = array($a->get_baseurl() . '/profiles/' . $a->profile['id'], t('Edit profile'), "", t('Edit profile')); } return replace_macros($tpl, array('$title' => t('Profile'), '$profile' => $profile)); } return ''; }