function settings_page($args) { if ($args[1] == 'save') { $settings['browser'] = $_POST['browser']; $settings['gwt'] = $_POST['gwt']; $settings['colours'] = $_POST['colours']; $settings['reverse'] = $_POST['reverse']; setcookie_year('settings', base64_encode(serialize($settings))); twitter_refresh(''); } $modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch'); $gwt = array('off' => 'direct', 'on' => 'via GWT'); $colour_schemes = array(); foreach ($GLOBALS['colour_schemes'] as $id => $info) { list($name, $colours) = explode('|', $info); $colour_schemes[$id] = $name; } $content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">'; $content .= theme('options', $colour_schemes, setting_fetch('colours', 1)); $content .= '</select></p><p>Mode:<br /><select name="browser">'; $content .= theme('options', $modes, $GLOBALS['current_theme']); $content .= '</select></p><p>External links go:<br /><select name="gwt">'; $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off')); $content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>'; $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>'; $content .= '<p><input type="submit" value="Save" /></p></form>'; $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>'; return theme('page', 'Settings', $content); }
function theme_menu_both($menu) { $links = array(); foreach (menu_visible_items() as $url => $page) { $title = $url ? $url : 'home'; $title = ucwords(str_replace("-", " ", $title)); if ('yes' == setting_fetch('menu_icons')) { $display = $page['display']; $class = "menu"; } else { $display = $title . " |"; $class = "menu-text"; } if (!$url) { $url = BASE_URL; } // Shouldn't be required, due to <base> element but some browsers are stupid. // if ($menu == 'bottom' ) { //&& isset($page['accesskey'])) { // $links[] = "<a href='$url'>$title</a> {$page['accesskey']}"; // } else { // // $links[] = "<a href='$url'>$title</a>"; // } $links[] = "<a href=\"{$url}\" title=\"{$title}\">{$display}</a>"; } if (user_is_authenticated()) { // $user = user_current_username(); // array_unshift($links, "<b><a href='user/$user'>$user</a></b>"); } if ($menu == 'bottom') { // $links[] = "<a href='{$_GET['q']}' accesskey='5'>refresh</a> 5"; } return "<div class='{$class}' id='menu'>" . implode(' ', $links) . '</div>'; }
function css() { // Get the colours that the user has chosen $c = theme('colours'); $css = "@charset \"UTF-8\";\n\n@font-face {\n\tfont-family: 'icons';\n\tsrc: url('" . BASE_URL . "i/fonts/dabr-icons.eot');\n\tsrc: url('" . BASE_URL . "i/fonts/dabr-icons.eot#iefix') format('embedded-opentype'),\n\t url('" . BASE_URL . "i/fonts/dabr-icons.woff2') format('woff2'),\n\t url('" . BASE_URL . "i/fonts/dabr-icons.woff') format('woff'),\n\t url('" . BASE_URL . "i/fonts/dabr-icons.ttf') format('truetype'),\n\t url('" . BASE_URL . "i/fonts/dabr-icons.svg#dabr') format('svg');\n\tfont-weight: normal;\n\tfont-style: normal;\n}\n\nbody{\n\tmargin:0;\n\tfont-family: '" . urldecode(substr(setting_fetch("dabr_fonts", "Raleway"), 0, -4)) . "', sans;\n\tfont-size: " . setting_fetch("dabr_font_size", "1") . "em;\n\tbackground:#{$c->body_background};\n\tcolor:#{$c->body_text};\n}\n\nselect,button,input {\n\tfont-size:0.9em;\n}\n\n.embedded-tweet{\n\tborder : 0.1em solid #{$c->menu_background};\n\tmargin-left: 0.5em;\n\t/*\n\twidth: -moz-min-content;\n\twidth: -webkit-min-content;\n\twidth: min-content;\n\t*/\n}\n\nfieldset {\n\tborder-radius:1em;\n\tmax-width:30em;\n}\n\n#twitterbird {\n\tcolor: #00acee;\n}\ntextarea {\n\twidth: 100%;\n\tborder-radius: 0.5em;\n\tmax-width: 39.5em;\n}\n.fileinputs {\n\tfloat: right;\n\tdirection: rtl;\n\tmargin-right: 1em;\n}\n#geo {\n\tfloat:right;\n}\n\n.profile,.bottom {\n\tpadding: 0.5em;\n}\n\n.bottom {\n\ttext-align: center;\n}\n\n.actionicons {\n\tdisplay: block;\n\tmargin: 0.3em;\n\tclear: both;\n}\n.actionicons a{\n\tfont-family:icons,sans-serif;\n\tfont-size: 1.2em;\n\ttext-decoration: none;\n}\n.actionicons .action-text {\n\tfont-size:0.9em;\n}\n\n.icons {\n\tfont-family:icons,sans-serif;\n\tfont-size: 1em;\n}\n\n.button {\n\ttext-decoration: none;\n\tbackground-color: #EEE;\n\tcolor: #333;\n\tpadding: 0.1em 1em;\n\tborder: 0.15em solid black;\n}\n\n.button-div {\n\tmargin-top:0.25em;\n\tmargin-bottom:0.25em;\n}\n\n.action {\n\tfont-family:icons,sans-serif;\n\ttext-decoration: none;\n}\n\nform{margin:.3em;}\n\na{color:#{$c->links}}\n\nsmall,small a{\n\tcolor:#{$c->small}\n}\n.odd{\n\tbackground:#{$c->odd};\n}\n.even{\n\tbackground:#{$c->even};\n}\n.reply{\n\tbackground:#{$c->replyodd};\n}\n.reply.even{\n\tbackground:#{$c->replyeven};\n}\n\n.menu{\n\tcolor:#{$c->menu_text};\n\tbackground:#{$c->menu_background};\n\tpadding: 0.2em;\n\tfont-family:icons,sans-serif;\n\tfont-size: 1.75em;\n\twidth:95%;\n}\n\n.menu-text{\n\tbackground:#{$c->menu_background};\n\tfont-family:sans-serif;\n\twidth:95%;\n}\n\n.menu-float {\n\tposition:fixed;\n\tz-index:1;\n\twidth:100%;\n}\n\n.menu a{\n\tcolor:#{$c->menu_link};\n\ttext-decoration: none;\n}\n\n.menu-text a{\n\tcolor:#{$c->menu_link};\n\ttext-decoration: none;\n}\n\n.tweet{\n\tpadding: 0.5em;\n}\n\n.timeline a img{\n\t/*padding:2px;*/\n}\n\n.avatar{\n\theight: auto;\n\twidth: auto;\n\tfloat: left;\n\tmargin-right: 0.5em;\n}\n\n.shift{\n}\n\n.status {\n\tword-wrap:break-word;\n\tmin-height:50px;\n}\n\n.embed{\n\tleft: 0px;\n\tdisplay: block;\n\toverflow-x: auto;\n\tclear: both;\n\tmax-width: 600px;\n}\n.embedded {\n\t/*max-width:80%;*/\n\tmax-width:100%;\n\theight:auto;\n\tmargin-top: 0.25em;\n}\n.media{\n\tleft: 0px;\n\tdisplay: block;\n\toverflow-x: auto;\n\tclear: both;\n\tmax-width:100%;\n}\n.media img{\n\tmax-width:95%;\n\theight:auto;\n}\n\n.date{\n\tpadding:0.5em;\n\tfont-size:0.8em;\n\tfont-weight:bold;\n\tcolor:#{$c->small}\n}\n\n.about{\n\tcolor:#{$c->small}\n}\n\n.time{\n\tfont-size:1em;\n\tcolor:#{$c->small}\n}\n\n.from{\n\tfont-size:0.75em;\n\tcolor:#{$c->small};\n\tfont-family:serif;\n}\n.from a{\n\tcolor:#{$c->small};\n}\n.table {\n\tdisplay: table;\n\tmax-width:95%;\n}\n.table-row {\n\tdisplay: table-row;\n\ttext-align: right;\n\tword-wrap:break-word;\n}\n.table-cell {\n\tdisplay: table-cell;\n}\n.table-cell-middle,.table-cell-end {\n\tdisplay: table-cell;\n\tpadding-left: 1em;\n\tpadding-right:1em;\n}\n"; header('Content-Type: text/css; charset=utf-8'); echo $css; }
function bigtouch_theme_avatar($url, $name = '', $force_large = false) { if (setting_fetch('avataro', 'yes') !== 'yes') { return "<img src='{$url}' alt='{$name}' width='48' height='48' />"; } else { return ''; } }
function blackberry_theme_avatar($url, $force_large = false) { if (setting_fetch('avataro', 'yes') !== 'yes') { return "<img src='{$url}' width='48' height='48' />"; } else { return ''; } }
function desktop_theme_css() { $out = theme_css(); if (setting_fetch('avataro', 'yes') == 'yes') { $out .= '<link rel="stylesheet" href="' . BASE_URL . 'browsers/desktop.avatar.css" />'; } $out .= '<style type="text/css">' . setting_fetch('css') . '</style>'; return $out; }
function settings_page($args) { if ($args[1] == 'save') { $settings['browser'] = $_POST['browser']; $settings['gwt'] = $_POST['gwt']; $settings['colours'] = $_POST['colours']; $settings['reverse'] = $_POST['reverse']; $settings['timestamp'] = $_POST['timestamp']; $settings['hide_inline'] = $_POST['hide_inline']; $settings['utc_offset'] = (double) $_POST['utc_offset']; // Save a user's oauth details to a MySQL table if (MYSQL_USERS == 'ON' && ($newpass = $_POST['newpassword'])) { user_is_authenticated(); list($key, $secret) = explode('|', $GLOBALS['user']['password']); $sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES ('%s', '%s', '%s', MD5('%s'))", mysql_escape_string(user_current_username()), mysql_escape_string($key), mysql_escape_string($secret), mysql_escape_string($newpass)); mysql_query($sql); } setcookie_year('settings', base64_encode(serialize($settings))); twitter_refresh(''); } $modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch'); $gwt = array('off' => 'direct', 'on' => 'via GWT'); $colour_schemes = array(); foreach ($GLOBALS['colour_schemes'] as $id => $info) { list($name, $colours) = explode('|', $info); $colour_schemes[$id] = $name; } $utc_offset = setting_fetch('utc_offset', 0); /* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???) if (!$utc_offset) { $user = twitter_user_info(); $utc_offset = $user->utc_offset; } */ if ($utc_offset > 0) { $utc_offset = '+' . $utc_offset; } $content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">'; $content .= theme('options', $colour_schemes, setting_fetch('colours', 1)); $content .= '</select></p><p>Mode:<br /><select name="browser">'; $content .= theme('options', $modes, $GLOBALS['current_theme']); $content .= '</select></p><p>External links go:<br /><select name="gwt">'; $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off')); $content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>'; $content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>'; $content .= '<p><label><input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago</label></p>'; $content .= '<p><label><input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide inline media (eg TwitPic thumbnails)</label></p>'; $content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>'; // Allow users to choose a Dabr password if accounts are enabled if (MYSQL_USERS == 'ON' && user_is_authenticated()) { $content .= '<fieldset><legend>Dabr account</legend><small>If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</small></p><p>Change Dabr password<br /><input type="password" name="newpassword" /><br /><small>Leave blank if you don\'t want to change it</small></fieldset>'; } $content .= '<p><input type="submit" value="Save" /></p></form>'; $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>'; return theme('page', 'Settings', $content); }
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL, $is_desktop = true) { if (user_is_authenticated()) { $fixedtags = setting_fetch('fixedtago', 'no') == "yes" && $text == '' ? " #" . setting_fetch('fixedtagc') : null; $output = '<form method="post" action="' . BASE_URL . 'update"><textarea id="status" name="status" rows="3" style="width:100%; max-width: 400px;">' . $text . $fixedtags . '</textarea><div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="' . __('Update') . '" /> <span id="remaining">140</span> '; if (substr($_GET["q"], 0, 4) !== "user") { $output .= ' <a href="' . BASE_URL . 'upload">' . __('Upload Picture') . '</a>'; } $output .= '</div></form>'; return $output; } }
function twitter_lists_tweets($user, $list) { // Tweets belonging to a list $count = setting_fetch('tpp', 20); $url = API_ROOT . "lists/statuses.json?slug={$list}&owner_screen_name={$user}&include_entities=true&include_rts=true&count={$count}"; if ($_GET['max_id']) { $url .= "&max_id=" . $_GET['max_id']; } if ($_GET['since_id']) { $url .= "&since_id=" . $_GET['since_id']; } return twitter_process($url); }
function blackberry_theme_menu_bottom() { $links = array(); $links[] = "<a href='" . BASE_URL . "'>" . __("Home") . "</a>"; if (user_is_authenticated()) { if (setting_fetch('replies') == 'yes') { $links[] = "<a href='" . BASE_URL . "replies'>" . __("Replies") . "</a>"; } if (setting_fetch('retweets') == 'yes') { $links[] = "<a href='" . BASE_URL . "retweets'>" . __("Retweets") . "</a>"; } if (setting_fetch('directs') == 'yes') { $links[] = "<a href='" . BASE_URL . "directs'>" . __("Directs") . "</a>"; } if (setting_fetch('search') == 'yes') { $links[] = "<a href='" . BASE_URL . "search'>" . __("Search") . "</a>"; } if (setting_fetch('favourites') == 'yes') { $links[] = "<a href='" . BASE_URL . "favourites'>" . __("Favourites") . "</a>"; } if (setting_fetch('lists') == 'yes') { $links[] = "<a href='" . BASE_URL . "lists'>" . __("Lists") . "</a>"; } if (setting_fetch('followers') == 'yes') { $links[] = "<a href='" . BASE_URL . "followers'>" . __("Followers") . "</a>"; } if (setting_fetch('friends') == 'yes') { $links[] = "<a href='" . BASE_URL . "friends'>" . __("Friends") . "</a>"; } if (setting_fetch('blockings') == 'yes') { $links[] = "<a href='" . BASE_URL . "blockings'>" . __("Blockings") . "</a>"; } } if (user_is_authenticated()) { $user = user_current_username(); array_unshift($links, "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>"); if (setting_fetch('about') == 'yes') { $links[] = "<a href='" . BASE_URL . "about'>" . __("About") . "</a>"; } if (setting_fetch('ssettings', 'yes') == 'yes') { $links[] = "<a href='" . BASE_URL . "settings'>" . __("Settings") . "</a>"; } if (setting_fetch('slogout') == 'yes') { $links[] = "<a href='" . BASE_URL . "logout'>" . __("Logout") . "</a>"; } } if (setting_fetch('srefresh', 'yes') == 'yes') { $links[] = "<a href='" . BASE_URL . "{$_GET['q']}' accesskey='5'>" . __("Refresh") . "</a> 5"; } return "<div class='menu menu-{$menu}'>" . implode(' | ', $links) . "</div>" . theme('pagination'); }
function twitter_lists_tweets($user, $list) { // Tweets belonging to a list $count = setting_fetch('ltpp', 20); // https://dev.twitter.com/docs/api/1/get/lists/statuses // How many tweets to show $perPage = setting_fetch('perPage', 20); $url = API_URL . "lists/statuses.json?slug={$list}&owner_screen_name={$user}&per_page={$perPage}&include_entities=true&include_rts=true"; $page = intval($_GET['page']); if ($page > 0) { $url .= '&page=' . $page; } $url .= '&per_page=' . $count; return twitter_process($url); }
function twitter_lists_list_subscribers($user, $list) { // Subscribers of a list $api_options = array("owner_screen_name" => $user, "slug" => $list); $api_options["count"] = setting_fetch('dabr_perPage', 20); $cursor = $_GET['cursor']; if (!is_numeric($cursor)) { $cursor = -1; } if ($cursor > 0) { $api_options["cursor"] = $cursor; } $list = execute_codebird("lists_subscribers", $api_options); return $list; }
function browser_detect() { if ($browser = setting_fetch('browser')) { return browser_load($browser); } if ($_SERVER['HTTP_X_NOKIA_BEARER'] == 'GPRS') { return browser_load('text'); } if (array_key_exists('HTTP_X_DEVICE_USER_AGENT', $_SERVER)) { $user_agent = $_SERVER['HTTP_X_DEVICE_USER_AGENT']; } else { $user_agent = $_SERVER['HTTP_USER_AGENT']; } $handle = fopen('browsers/list.csv', 'r'); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if (preg_match("#{$data[0]}#", $user_agent, $matches)) { browser_load($data[1]); break; } } fclose($handle); }
function theme_menu_bottom() { $links = array(); $links[] = "<a href='" . BASE_URL . "'>" . __("Home") . "</a>"; if (user_is_authenticated()) { if (setting_fetch('replies') == 'yes') { $links[] = "<a href='" . BASE_URL . "replies'>" . __("Replies") . "</a>"; } if (setting_fetch('retweets') == 'yes') { $links[] = "<a href='" . BASE_URL . "retweets'>" . __("Retweets") . "</a>"; } if (setting_fetch('directs') == 'yes') { $links[] = "<a href='" . BASE_URL . "directs'>" . __("Directs") . "</a>"; } if (setting_fetch('search') == 'yes') { $links[] = "<a href='" . BASE_URL . "search'>" . __("Search") . "</a>"; } if (setting_fetch('favourites') == 'yes') { $links[] = "<a href='" . BASE_URL . "favourites'>" . __("Favourites") . "</a>"; } if (setting_fetch('lists') == 'yes') { $links[] = "<a href='" . BASE_URL . "lists'>" . __("Lists") . "</a>"; } if (setting_fetch('followers') == 'yes') { $links[] = "<a href='" . BASE_URL . "followers'>" . __("Followers") . "</a>"; } if (setting_fetch('friends') == 'yes') { $links[] = "<a href='" . BASE_URL . "friends'>" . __("Friends") . "</a>"; } if (setting_fetch('blockings') == 'yes') { $links[] = "<a href='" . BASE_URL . "blockings'>" . __("Blockings") . "</a>"; } } if (user_is_authenticated()) { $user = user_current_username(); array_unshift($links, "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>"); if (setting_fetch('about') == 'yes') { $links[] = "<a href='" . BASE_URL . "about'>" . __("About") . "</a>"; } if (setting_fetch('ssettings', 'yes') == 'yes') { $links[] = "<a href='" . BASE_URL . "settings'>" . __("Settings") . "</a>"; } if (setting_fetch('slogout', 'yes') == 'yes') { $links[] = "<a href='" . BASE_URL . "logout'>" . __("Logout") . "</a>"; } } return '<div class="menu menu-$menu">' . implode(' | ', $links) . '</div>'; }
function replacementURLs($matches) { $replacement = $matches[2]; $url = $matches[3]; if (!preg_match("#^https{0,1}://#i", $url)) { $url = "http://{$url}"; } if (setting_fetch('gwt') == 'on') { $encoded = urlencode($url); $replacement .= "<a href='http://google.com/gwt/n?u={$encoded}' target='_blank'>{$url}</a>"; } else { $replacement .= theme('external_link', $url); } return $replacement; }
function theme_css() { $c = theme('colours'); $out = "<style type='text/css'>a{color:#{$c->links};}form{margin:.3em;}img{border:0;}small,small a{color:#{$c->small};font-weight:normal;}body{background:#{$c->bodybg};color:#{$c->bodyt};margin:0;font:90% sans-serif;}.odd{background:#{$c->odd};}.even{background:#{$c->even};}.reply{background:#{$c->replyodd};}.reply.even{background:#{$c->replyeven};}.menu{color:#{$c->menut};background:#{$c->menubg};padding:2px;}.menu a{color:#{$c->menua};text-decoration:none;}.profile,.tweet{padding:5px;}.stext a{font-weight:bold;}.date{padding:5px;font-size:0.75em;color:#{$c->small}}.avatar{display:block;left:0.3em;margin:0;overflow:hidden;position:absolute;}.status{display:block;}.shift{margin-left:30px;min-height:24px;}.shift48{margin-left:60px;min-height:48px;}" . setting_fetch('css') . "</style>"; return $out; }
function theme_action_icons($status) { $from = $status->from->screen_name; $retweeted_by = $status->retweeted_by->user->screen_name; $retweeted_id = $status->retweeted_by->id; $geo = $status->geo; $actions = array(); if (!$status->is_direct) { if (setting_fetch('buttonrl', 'yes') == 'yes' && setting_fetch('rl_user', '') !== '' && setting_fetch('rl_pass', '') !== '') { $actions[] = theme('action_icon', "status/{$status->id}/rl", 'images/instapaper.png', 'RL'); } if (setting_fetch('buttonre', 'yes') == 'yes') { $actions[] = theme('action_icon', "user/{$from}/reply/{$status->id}", 'images/reply.png', 'AT'); } } //Reply All functionality. if (setting_fetch('buttonreall') == 'yes' && $status->entities->user_mentions) { $actions[] = theme('action_icon', "user/{$from}/replyall/{$status->id}", 'images/replyall.png', 'RE'); } if (setting_fetch('buttondm') == 'yes') { if (!user_is_current_user($from)) { $actions[] = theme('action_icon', "directs/create/{$from}", 'images/dm.png', 'DM'); } } if (!$status->is_direct) { if (setting_fetch('buttonfav', 'yes') == 'yes') { if ($status->favorited == '1') { $actions[] = theme('action_icon', "unfavourite/{$status->id}", 'images/star.png', 'UNFAV'); } else { $actions[] = theme('action_icon', "favourite/{$status->id}", 'images/star_grey.png', 'FAV'); } } if (setting_fetch('buttonrt', 'yes') == 'yes') { if ($retweeted_by) { $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweeted.png', 'RTED'); } else { $actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweet.png', 'RT'); } } if (setting_fetch('buttondel', 'yes') == 'yes') { if (user_is_current_user($from)) { $actions[] = theme('action_icon', "confirm/delete/{$status->id}", 'images/trash.gif', 'DEL'); } if ($retweeted_by) { if (user_is_current_user($retweeted_by)) { $actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", 'images/trash.gif', 'DEL'); } } } } else { if (setting_fetch('buttondel', 'yes') == 'yes') { $actions[] = theme('action_icon', "confirm/deleteDM/{$status->id}", 'images/trash.gif', 'DEL'); } } if (setting_fetch('buttonmap', 'yes') == 'yes') { if ($geo !== null) { $latlong = $geo->coordinates; $lat = $latlong[0]; $long = $latlong[1]; $actions[] = theme('action_icon', "https://maps.google.com/maps?q={$lat},{$long}", 'images/map.png', 'MAP'); } } if (setting_fetch('buttonot', 'yes') == 'yes') { $actions[] = theme('action_icon', "http://twitter.com/{$from}/status/{$status->id}", 'images/original.png', 'OT'); } if (setting_fetch('buttonsearch', 'yes') == 'yes') { //Search for @ to a user $actions[] = theme('action_icon', "search?query=%40{$from}", 'images/q.png', '?'); } return implode(' ', $actions); }
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL) { if (user_is_authenticated()) { $fixedtagspre = setting_fetch('fixedtagspre'); $fixedtagspost = setting_fetch('fixedtagspost'); $fixedtagspre = !empty($fixedtagspre) && setting_fetch('fixedtagspreo', 'no') == "yes" && $text == '' ? $fixedtagspre . " " : NULL; $fixedtagspost = !empty($fixedtagspost) && setting_fetch('fixedtagsposto', 'no') == "yes" && $text == '' ? " " . $fixedtagspost : NULL; $text = $fixedtagspre . $text . $fixedtagspost; // adding ?status=foo will automaticall add "foo" to the text area. if ($_GET['status']) { $text = $_GET['status']; } $output = '<form method="post" action="update"> <fieldset><legend>What\'s Happening?</legend> <div><textarea id="status" name="status" rows="4" cols="60">' . $text . '</textarea> '; if (setting_fetch('buttongeo') == 'yes') { $output .= '<br /><span id="geo" style="display: inline;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span> <script type="text/javascript"> <!-- started = false; chkbox = document.getElementById("geoloc"); if (navigator.geolocation) { geoStatus("Tweet my location"); if ("' . $_COOKIE['geo'] . '"=="Y") { chkbox.checked = true; goGeo(); } } function goGeo(node) { if (started) return; started = true; geoStatus("Locating..."); navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus, {enableHighAccuracy: true}); } function geoStatus(msg) { document.getElementById("geo").style.display = "inline"; document.getElementById("lblGeo").innerHTML = msg; } function geoSuccess(position) { if(typeof position.address !== "undefined") geoStatus("Tweet my <a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (" + position.address.country + position.address.region + "省" + position.address.city + "市,accuracy: " + position.coords.accuracy + "m)"); else geoStatus("Tweet my <a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (accuracy: " + position.coords.accuracy + "m)"); chkbox.value = position.coords.latitude + "," + position.coords.longitude; } //--> </script> '; } $output .= '<div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><button id="submit" type="submit">Tweet</button><span id="remaining">140</span>'; $output .= '</div></div></fieldset></form>'; $output .= js_counter('status'); if (setting_fetch('browser') == 'desktop') { $output .= '<script type="text/javascript"> <!-- document.getElementById("status").onkeydown=function(b){var a=null;a=window.event?window.event:b;a!=null&&a.ctrlKey&&a.keyCode==13&&document.getElementById("submit").click()}; //--> </script>'; } return $output; } }
function theme_colours() { $info = $GLOBALS['colour_schemes'][setting_fetch('colours', 5)]; list($name, $bits) = explode('|', $info); $colours = explode(',', $bits); return (object) array('links' => $colours[0], 'bodybg' => $colours[1], 'bodyt' => $colours[2], 'small' => $colours[3], 'odd' => $colours[4], 'even' => $colours[5], 'replyodd' => $colours[6], 'replyeven' => $colours[7], 'menubg' => $colours[8], 'menut' => $colours[9], 'menua' => $colours[10]); }
function theme_css() { $c = theme('colours'); $t = "<style type='text/css'>\r\na{color:#{$c->links};}table{border-collapse:collapse;}\r\nform{margin:.3em;}td{vertical-align:top;padding:0.3em;}\r\nimg{border:0;}\r\nbody{background:#{$c->bodybg};color:#{$c->bodyt};margin:0;font:90% sans-serif;}\r\n.odd{background:#{$c->odd}}\r\n.even{background:#{$c->even}}\r\n.reply{background:#{$c->replyodd}}\r\n.reply.even{background: #{$c->replyeven}}\r\n.menu{color:#{$c->menut};background:#{$c->menubg};padding: 2px;}\r\n.menu a{color:#{$c->menua};text-decoration: none;}\r\n.tweet,.features{padding:5px}\r\n.date{padding:5px;font-size:0.8em;font-weight:bold;color:#{$c->small}}\r\n.about,.time{font-size:0.75em;color:#{$c->small}}\r\n.avatar{display:block; height:26px; width:26px; left:0.3em; margin:0; overflow:hidden; position:absolute;}\r\n.status{display:block;word-wrap:break-word;}\r\n.list span{margin:0 4px 0 0;}"; if (setting_fetch('avataro', 'yes') !== 'yes') { $t .= ".shift{margin-left:30px;min-height:24px;}"; } else { $t .= ".shift{margin-left:10px;min-height:24px;}"; } $t .= ".from{font-size:0.75em;color:#{$c->small};font-family:serif;}\r\n.from a{color:#{$c->small};}\r\n.textb{font-weight:bold;}\r\n.texts,.texts a{color:#{$c->small};font-size:small;}\r\ntextarea{width:90%; max-width: 400px;overflow-x:hidden;}\r\n.translate{padding:5px;margin:15px;border:thin solid;}\r\ninput#query{width:100%;max-width:300px;}\r\n#about{margin:0.5em;padding:0.1em 1em;}\r\nfieldset{border:1px dashed #{$c->bodyt};}\r\nhr{border:1px dotted#{$c->bodyt};}\r\n.filter{text-decoration:none;}\r\n.sinput{width:40px;}\r\n.linput{width:120px;}\r\n.minput{width:20px;}\r\n.ninput{width:90px;}\r\n</style>"; return $t; }
function theme_timeline($feed, $paginate = true) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities); } unset($status); // Only embed images in suitable browsers if (!setting_fetch('hide_inline') && !in_array(setting_fetch('browser'), array('text', 'worksafe'))) { embedly_embed_thumbnails($feed); } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $time = strtotime($status->created_at); if ($time > 0) { $date = twitter_date('l jS F Y', strtotime($status->created_at)); if ($date_heading !== $date) { $date_heading = $date; $rows[] = array('data' => array($date), 'class' => 'date'); } } else { $date = $status->created_at; } $text = $status->text; if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { $media = twitter_get_media($status); } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $avatar = theme('avatar', theme_get_avatar($status->from)); $source = $status->source ? " from " . str_replace('rel="nofollow"', 'rel="nofollow" target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) : ''; //need to replace & in links with &s and force new window on links if ($status->place->name) { $source .= ", " . $status->place->name . ", " . $status->place->country; } if ($status->in_reply_to_status_id) { $source .= ", in reply to <a href='status/{$status->in_reply_to_status_id_str}'>{$status->in_reply_to_screen_name}</a>"; } if ($status->retweet_count) { $source .= ", <a href='retweeted_by/{$status->id}'>retweeted " . x_times($status->retweet_count) . "</a>"; } $retweeted = ''; if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $retweeted = "<br /><small>" . theme('action_icon', "retweeted_by/{$status->id}", 'images/retweet.png', 'RT') . "retweeted by <a href='user/{$retweeted_by}'>{$retweeted_by}</a></small>"; //$source .= "<br /><a href='retweeted_by/{$status->id}'>retweeted</a> by <a href='user/{$retweeted_by}'>{$retweeted_by}</a>"; } if ($status->favorite_count) { $source .= ', favourited ' . x_times($status->favorite_count); } //$html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> $actions $link<br />{$text}<br />$media<small>$source</small>"; $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}{$retweeted}<br />{$text}<br />{$media}<span class='from'>{$source}</span>"; unset($row); $class = 'status'; if ($avatar) { $row[] = array('data' => $avatar, 'class' => 'avatar'); $class .= ' shift'; } $row[] = array('data' => $html, 'class' => $class); $class = 'tweet'; if ($page != 'replies' && twitter_is_reply($status)) { $class .= ' reply'; } $row = array('data' => $row, 'class' => $class); $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); if (!$hide_pagination) { if ($paginate) { if ($page == 'some-unknown-method-which-doesnt-take-max_id') { $content .= theme('pagination'); } else { if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $content .= theme('pagination', $max_id); } } } return $content; }
function settings_page($args) { if ($args[1] == 'save') { $settings['dabr_perPage'] = $_POST['dabr_perPage']; $settings['dabr_gwt'] = $_POST['dabr_gwt']; $settings['dabr_colours'] = $_POST['dabr_colours']; $settings['dabr_timestamp'] = $_POST['dabr_timestamp']; $settings['dabr_show_inline'] = $_POST['dabr_show_inline']; $settings['dabr_show_oembed'] = $_POST['dabr_show_oembed']; $settings['dabr_show_avatars'] = $_POST['dabr_show_avatars']; $settings['dabr_show_icons'] = $_POST['dabr_show_icons']; $settings['dabr_float_menu'] = $_POST['dabr_float_menu']; $settings['dabr_image_size'] = $_POST['dabr_image_size']; $settings['dabr_utc_offset'] = (double) $_POST['dabr_utc_offset']; $settings['dabr_font_size'] = $_POST['dabr_font_size']; $settings['dabr_fonts'] = $_POST['dabr_fonts']; setcookie_year('settings', base64_encode(serialize($settings))); twitter_refresh(''); } $perPage = array('5' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 5), '10' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 10), '20' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 20), '30' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 30), '40' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 40), '50' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 50), '100' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 100) . " " . _(SETTINGS_SLOW_1), '150' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 150) . " " . _(SETTINGS_SLOW_2), '200' => sprintf(_(SETTINGS_TWEETS_PER_PAGE), 200) . " " . _(SETTINGS_SLOW_3)); $image_size = array('thumb' => _(SETTINGS_IMAGE_THUMB), 'small' => _(SETTINGS_IMAGE_SMALL), 'medium' => _(SETTINGS_IMAGE_MEDIUM), 'large' => _(SETTINGS_IMAGE_LARGE), 'orig' => _(SETTINGS_IMAGE_ORIGINAL)); $colour_schemes = array(); foreach ($GLOBALS['colour_schemes'] as $id => $info) { list($name) = explode('|', $info); $colour_schemes[$id] = $name; } $font_size = array('0.5' => _(FONT_SMALLEST), '0.75' => _(FONT_SMALL), '0.9' => _(FONT_MEDIUM), '1' => _(FONT_NORMAL), '1.25' => _(FONT_BIG), '1.5' => _(FONT_LARGE), '2' => _(FONT_HUGE)); // $fonts = array( //ID => Value // 'Schoolbell' => 'Schoolbell', // 'Raleway' => 'Raleway', // 'Ubuntu+Mono' => 'Ubuntu Mono', // 'Karma' => 'Karma', // 'Open+Sans'=> 'Open Sans', // 'aaaaa' => 'bbbb', // ); $utc_offset = setting_fetch('dabr_utc_offset', 0); // returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???) // if (!$utc_offset) { // $user = twitter_user_info(user_current_username()); // $utc_offset = $user->utc_offset; // echo "THE UTC IS $utc_offset"; // } if ($utc_offset > 0) { $utc_offset = '+' . $utc_offset; } $content = ''; $content .= '<form action="settings/save" method="post">'; $content .= theme('options', $colour_schemes, setting_fetch('dabr_colours', 0), _(SETTINGS_COLOUR), "dabr_colours"); $content .= theme('options', $perPage, setting_fetch('dabr_perPage', 20), _(SETTINGS_PER_PAGE), "dabr_perPage"); $content .= theme('options', $image_size, setting_fetch('dabr_image_size', "medium"), _(SETTINGS_IMAGE_SIZE), "dabr_image_size"); global $fonts; $content .= "<fieldset><legend>" . _(SETTINGS_FONT) . "</legend>"; $content .= theme('radio', array_combine($fonts, $fonts), "dabr_fonts", urldecode(substr(setting_fetch("dabr_fonts", "Raleway"), 0, -4))); $content .= "</fieldset>"; $content .= "<fieldset><legend>" . _(SETTINGS_FONT_SIZE) . "</legend>"; $content .= theme('radio', $font_size, "dabr_font_size", setting_fetch("dabr_font_size", "1")); $content .= "</fieldset>"; $content .= '<p> <label> <input type="checkbox" name="dabr_timestamp" value="yes" ' . (setting_fetch('dabr_timestamp', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . sprintf(_(SETTINGS_TIMESTAMP), twitter_date('H:i')) . '</label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_show_inline" value="yes" ' . (setting_fetch('dabr_show_inline', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_INLINE) . '</label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_show_oembed" value="yes" ' . (setting_fetch('dabr_show_oembed', 'yes') == yes ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_PREVIEW) . '</label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_show_avatars" value="yes" ' . (setting_fetch('dabr_show_avatars', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_SHOW_AVATARS) . '</label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_show_icons" value="yes" ' . (setting_fetch('dabr_show_icons', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_MENU_ICONS) . '</label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_float_menu" value="yes" ' . (setting_fetch('dabr_float_menu', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_FLOAT_MENU) . '</label> </p>'; $content .= '<p> <label>' . sprintf(_(SETTINGS_TIMESTAMP_IS), gmdate('H:i')) . '<br>' . sprintf(_(SETTINGS_TIMESTAMP_DISPLAY), "<input type=\"text\" name=\"dabr_utc_offset\" value=\"{$utc_offset}\" size=\"3\" />", twitter_date('H:i')) . '<br />' . _(SETTINGS_TIMESTAMP_ADJUST) . ' </label> </p>'; $content .= '<p> <label> <input type="checkbox" name="dabr_gwt" value="on" ' . (setting_fetch('dabr_gwt') == 'on' ? ' checked="checked" ' : '') . ' />' . _(SETTINGS_GWT_DETAIL) . '</label> </p>'; $content .= '<p><input type="submit" value="' . _(SETTINGS_SAVE_BUTTON) . '" /></p></form>'; $content .= '<hr /><p>' . _(SETTINGS_RESET) . '</p>'; return theme('page', _(SETTINGS_TITLE), $content); }
function theme_timeline($feed) { if (count($feed) == 0) { return theme('no_tweets'); } if (count($feed) < 2) { $hide_pagination = true; } $rows = array(); $page = menu_current_page(); $date_heading = false; $first = 0; // Add the hyperlinks *BEFORE* adding images foreach ($feed as &$status) { $status->text = twitter_parse_tags($status->text, $status->entities); } unset($status); // Only embed images in suitable browsers if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { if (EMBEDLY_KEY !== '') { embedly_embed_thumbnails($feed); } } foreach ($feed as $status) { if ($first == 0) { $since_id = $status->id; $first++; } else { $max_id = $status->id; if ($status->original_id) { $max_id = $status->original_id; } } $time = strtotime($status->created_at); if ($time > 0) { $date = twitter_date('l jS F Y', strtotime($status->created_at)); if ($date_heading !== $date) { $date_heading = $date; $rows[] = array('data' => array($date), 'class' => 'date'); } } else { $date = $status->created_at; } $text = $status->text; if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) { $media = twitter_get_media($status); } $link = theme('status_time_link', $status, !$status->is_direct); $actions = theme('action_icons', $status); $avatar = theme('avatar', theme_get_avatar($status->from)); $source = $status->source ? " from " . str_replace('rel="nofollow"', 'rel="nofollow" target="' . get_target() . '"', preg_replace('/&(?![a-z][a-z0-9]*;|#[0-9]+;|#x[0-9a-f]+;)/i', '&', $status->source)) : ''; //need to replace & in links with &s and force new window on links if ($status->place->name) { $source .= " " . $status->place->name . ", " . $status->place->country; } if ($status->in_reply_to_status_id) { $source .= " <a href='status/{$status->in_reply_to_status_id_str}'>in reply to {$status->in_reply_to_screen_name}</a>"; } if ($status->retweet_count) { $source .= " <a href='retweeted_by/{$status->id}'>retweeted "; switch ($status->retweet_count) { case 1: $source .= "once</a>"; break; case 2: $source .= "twice</a>"; break; default: $source .= $status->retweet_count . " times</a>"; } } if ($status->retweeted_by) { $retweeted_by = $status->retweeted_by->user->screen_name; $source .= "<br /><a href='retweeted_by/{$status->id}'>retweeted</a> by <a href='user/{$retweeted_by}'>{$retweeted_by}</a>"; } $html = "<b><a href='user/{$status->from->screen_name}'>{$status->from->screen_name}</a></b> {$actions} {$link}<br />{$text}<br />{$media}<small>{$source}</small>"; unset($row); $class = 'status'; if ($page != 'user' && $avatar) { $row[] = array('data' => $avatar, 'class' => 'avatar'); $class .= ' shift'; } $row[] = array('data' => $html, 'class' => $class); $class = 'tweet'; if ($page != 'replies' && twitter_is_reply($status)) { $class .= ' reply'; } $row = array('data' => $row, 'class' => $class); $rows[] = $row; } $content = theme('table', array(), $rows, array('class' => 'timeline')); if ($page != '' && !$hide_pagination) { $content .= theme('pagination'); } else { if (!$hide_pagination) { //Doesn't work. since_id returns the most recent tweets up to since_id, not since. Grrr //$links[] = "<a href='{$_GET['q']}?since_id=$since_id'>Newer</a>"; if (is_64bit()) { $max_id = intval($max_id) - 1; } //stops last tweet appearing as first tweet on next page $links[] = "<a href='{$_GET['q']}?max_id={$max_id}' accesskey='9'>Older</a> 9"; $content .= '<p>' . implode(' | ', $links) . '</p>'; } } return $content; }
function settings_page($args) { if ($args[1] == 'save') { $settings['perPage'] = $_POST['perPage']; $settings['gwt'] = $_POST['gwt']; $settings['colours'] = $_POST['colours']; $settings['reverse'] = $_POST['reverse']; $settings['timestamp'] = $_POST['timestamp']; $settings['hide_inline'] = $_POST['hide_inline']; $settings['show_oembed'] = $_POST['show_oembed']; $settings['hide_avatars'] = $_POST['hide_avatars']; $settings['menu_icons'] = $_POST['menu_icons']; $settings['image_size'] = $_POST['image_size']; $settings['utc_offset'] = (double) $_POST['utc_offset']; setcookie_year('settings', base64_encode(serialize($settings))); twitter_refresh(''); } $perPage = array('5' => '5 Tweets Per Page', '10' => '10 Tweets Per Page', '20' => '20 Tweets Per Page', '30' => '30 Tweets Per Page', '40' => '40 Tweets Per Page', '50' => '50 Tweets Per Page', '100' => '100 Tweets Per Page (Slow)', '150' => '150 Tweets Per Page (Very Slow)', '200' => '200 Tweets Per Page (Extremely Slow)'); $image_size = array('thumb' => 'Thumbnail (150*150)', 'small' => 'Small (340*340)', 'medium' => 'Medium (600*600)', 'large' => 'Large (1024*1024)', 'orig' => 'Original (8000*8000)'); $colour_schemes = array(); foreach ($GLOBALS['colour_schemes'] as $id => $info) { list($name) = explode('|', $info); $colour_schemes[$id] = $name; } $utc_offset = setting_fetch('utc_offset', 0); /* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???) if (!$utc_offset) { $user = twitter_user_info(); $utc_offset = $user->utc_offset; } */ if ($utc_offset > 0) { $utc_offset = '+' . $utc_offset; } $content = ''; $content .= '<form action="settings/save" method="post"> <p>Colour scheme: <br /> <select name="colours">'; $content .= theme('options', $colour_schemes, setting_fetch('colours', 0)); $content .= '</select> </p>'; $content .= '<p>Tweets Per Page: <br /> <select name="perPage">'; $content .= theme('options', $perPage, setting_fetch('perPage', 20)); $content .= '</select> <br/> </p>'; $content .= '<p>Image size: <br /> <select name="image_size">'; $content .= theme('options', $image_size, setting_fetch('image_size', "medium")); $content .= '</select> <br/> </p>'; $content .= '<p> <label> <input type="checkbox" name="gwt" value="on" ' . (setting_fetch('gwt') == 'on' ? ' checked="checked" ' : '') . ' /> Use Google Web Transcoder (GWT) for external links. Suitable for older phones and people with less bandwidth. </label> </p>'; $content .= '<p> <label> <input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago </label> </p>'; $content .= '<p> <label> <input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide Twitter photos. </label> </p>'; // Hide oembeds by default. Keep things fast & save API calls. $content .= '<p> <label> <input type="checkbox" name="show_oembed" value="yes" ' . (setting_fetch('show_oembed') == yes ? ' checked="checked" ' : '') . ' /> Show link previews (YouTube, Instagram, Blogs, etc). </label> </p>'; $content .= '<p> <label> <input type="checkbox" name="hide_avatars" value="yes" ' . (setting_fetch('hide_avatars') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide users\' profile images. </label> </p>'; $content .= '<p> <label> <input type="checkbox" name="menu_icons" value="yes" ' . (setting_fetch('menu_icons') == 'yes' ? ' checked="checked" ' : '') . ' /> Show Menu icons like <span class="icons">ðŸ� ⌖</span>. </label> </p>'; $content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>'; $content .= '<p><input type="submit" value="Save" /></p></form>'; $content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>'; return theme('page', 'Settings', $content); }
function twitter_date($format, $timestamp = null) { $offset = setting_fetch('dabr_utc_offset', 0) * 3600; if (!isset($timestamp)) { $timestamp = time(); } return gmdate($format, $timestamp + $offset); }
function touch_theme_css() { $out = theme_css() . '<link rel="stylesheet" href="' . BASE_URL . 'browsers/touch.css" /><script type="text/javascript">' . file_get_contents('browsers/touch.js') . '</script>'; $out .= '<style type="text/css">' . setting_fetch('css') . '</style>'; return $out; }
function theme_action_icon($url, $image_url, $text) { if (setting_fetch('buttonintext', 'yes') == 'yes') { return "<a href='{$url}'>{$text}</a>"; } else { return "<a href='{$url}'><img src='" . BASE_URL . $image_url . "' /></a>"; } }
function theme_menu_top() { $links = array(); foreach (menu_visible_items() as $url => $page) { $title = $url ? $url : 'home'; $title = ucwords(str_replace("-", " ", $title)); if ('yes' == setting_fetch('dabr_show_icons', "yes")) { $display = $page['display']; $class = "menu"; } else { $display = $title . " |"; $class = "menu-text"; } if (!$url) { $url = BASE_URL; } // Shouldn't be required, due to <base> element but some browsers are stupid. $links[] = "<a href=\"{$url}\" title=\"{$title}\">{$display}</a>"; } // if (user_is_authenticated()) { // // $user = user_current_username(); // // array_unshift($links, "<b><a href='user/$user'>$user</a></b>"); // } // if ($menu == 'bottom') { // // $links[] = "<a href='{$_GET['q']}' accesskey='5'>refresh</a> 5"; // } if (setting_fetch('dabr_colours') == null) { // If the cookies haven't been set, remind the user that they can set how Dabr looks $ugly = "<div class='tweet'>" . _(UGLY) . "</div>"; } if ('yes' == setting_fetch('dabr_float_menu', "yes")) { // Horrible hack to make the height of the element corrent $padding = "<div class='{$class}' id='menu'>" . implode(' ', $links) . "</div>" . $ugly; $class .= ' menu-float'; return "<div class='{$class}' id='menu-float'>" . implode(' ', $links) . "</div>" . $padding; } return "<div class='{$class}' id='menu'>" . implode(' ', $links) . "</div>" . $ugly; }
function theme_action_icon($url, $display, $text) { // If the user doesn't want icons, display as text if ('yes' !== setting_fetch('menu_icons')) { $display = $text; $class = "action-text"; } else { $class = "action"; } // Maps open in a new tab if ($text == 'Location') { return "<a href='{$url}' target='" . get_target() . "' class='{$class}'>{$display}</a>"; } // Verified ticks & RT notifications don't need to be linked if ("Verified" == $text || "retweeted" == $text) { return "<span class='{$class}' title='{$text}'>{$display}</span>"; } // if (0 === strpos($image_url, "images/")) // { // return "<a href='$url'><img src='$image_url' alt='$text' /></a>"; // } return "<a href='{$url}' class='{$class}' title='{$text}'>{$display}</a>"; }
function twitter_standard_timeline($feed, $source) { // echo "<pre>"; //var_dump($feed); // echo json_encode($feed); // Remove the status elements from the array unset($feed->httpstatus); if ($feed->rate) { twitter_rate_limit($feed->rate); unset($feed->rate); } $output = array(); // if (!is_array($feed) && $source != 'thread') return $output; //32bit int / snowflake patch // if (is_array($feed)) { // foreach($feed as $key => $status) { // if($status->id_str) { // $feed[$key]->id = $status->id_str; // } // if($status->in_reply_to_status_id_str) { // $feed[$key]->in_reply_to_status_id = $status->in_reply_to_status_id_str; // } // if($status->retweeted_status->id_str) { // $feed[$key]->retweeted_status->id = $status->retweeted_status->id_str; // } // } // } foreach ($feed as $status) { // echo "</pre><br.>STATUS = " . $status->text; } switch ($source) { case 'status': case 'favourites': case 'friends': case 'replies': case 'retweets': case 'user': case 'search': foreach ($feed as $status) { $new = $status; if ($new->retweeted_status) { $retweet = $new->retweeted_status; unset($new->retweeted_status); $retweet->retweeted_by = $new; $retweet->original_id = $new->id; $new = $retweet; } $new->from = $new->user; unset($new->user); $output[(string) $new->id] = $new; } return $output; case 'directs_sent': case 'directs_inbox': foreach ($feed as $status) { $new = $status; if ($source == 'directs_inbox') { $new->from = $new->sender; $new->to = $new->recipient; } else { $new->from = $new->recipient; $new->to = $new->sender; } unset($new->sender, $new->recipient); $new->is_direct = true; $output[$new->id_str] = $new; } return $output; case 'thread': // First pass: extract tweet info from the HTML $html_tweets = explode('</li>', $feed); foreach ($html_tweets as $tweet) { $id = preg_match_one('#msgtxt(\\d*)#', $tweet); if (!$id) { continue; } $output[$id] = (object) array('id' => $id, 'text' => strip_tags(preg_match_one('#</a>: (.*)</span>#', $tweet)), 'source' => preg_match_one('#>from (.*)</span>#', $tweet), 'from' => (object) array('id' => preg_match_one('#profile_images/(\\d*)#', $tweet), 'screen_name' => preg_match_one('#twitter.com/([^"]+)#', $tweet), 'profile_image_url' => preg_match_one('#src="([^"]*)"#', $tweet)), 'to' => (object) array('screen_name' => preg_match_one('#@([^<]+)#', $tweet)), 'created_at' => str_replace('about', '', preg_match_one('#info">\\s(.*)#', $tweet))); } // Second pass: OPTIONALLY attempt to reverse the order of tweets if (setting_fetch('reverse') == 'yes') { $first = false; foreach ($output as $id => $tweet) { $date_string = str_replace('later', '', $tweet->created_at); if ($first) { $attempt = strtotime("+{$date_string}"); if ($attempt == 0) { $attempt = time(); } $previous = $current = $attempt - time() + $previous; } else { $previous = $current = $first = strtotime($date_string); } $output[$id]->created_at = date('r', $current); } $output = array_reverse($output); } return $output; default: echo "<h1>{$source}</h1><pre>"; print_r($feed); die; } }