Esempio n. 1
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
    if (user_is_authenticated()) {
        if ($_SERVER['HTTPS'] == "on") {
            $icon = "https://si0.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
        } else {
            $icon = "http://a1.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
        }
        //	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><img src="' . $icon . '" width="16" height="16" /> What\'s Happening?</legend>
				<textarea id="status" name="status" rows="4" style="width:95%; max-width: 400px;">' . $text . '</textarea>
				<div>
					<input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" />
					<input type="submit" value="Tweet" />
					<span id="remaining">140</span> 
					<span id="geo" style="display: none;">
						<input onclick="goGeo()" type="checkbox" id="geoloc" name="location" />
						<label for="geoloc" id="lblGeo"></label>
					</span>
				</div>
			</fieldset>
			<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) {
					geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
					chkbox.value = position.coords.latitude + "," + position.coords.longitude;
				}
			</script>
		</form>';
        $output .= js_counter('status');
        return $output;
    }
}
Esempio n. 2
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
    if (user_is_authenticated()) {
        $output = '<form method="post" action="update">
  <textarea id="status" name="status" rows="3" style="width:95%; max-width: 400px;">' . $text . '</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> 
  <span id="geo" style="display: none; float: right;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span></div>
  <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);
}
function geoStatus(msg) {
	document.getElementById("geo").style.display = "inline";
	document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
	geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
	chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
  </script>
</form>';
        $output .= js_counter('status');
        return $output;
    }
}
Esempio n. 3
0
function theme_retweet($status)
{
    $text = "RT @{$status->user->screen_name}: {$status->text}";
    $screen_name = $status->user->screen_name;
    $id = $status->id_str;
    $length = function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text);
    $from = substr($_SERVER['HTTP_REFERER'], strlen(BASE_URL));
    if ($status->user->protected == 0) {
        $content .= "<p>Twitter retweet:</p>\n\t\t\t\t\t<form action='twitter-retweet/{$status->id_str}' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='submit' value='Twitter Retweet' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />";
        $content .= "<p>Comment on Tweet:</p>\n\t\t\t\t\t<form action='update' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='hidden' name='in_reply_to_id' value='{$status->id_str}' />\n\t\t\t\t\t\t<textarea name='status' style='width:90%; max-width: 400px;' rows='5' id='status'>&nbsp;\nhttps://twitter.com/{$screen_name}/status/{$id}</textarea>\n\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t<input type='submit' value='Comment' />\n\t\t\t\t\t\t<span id='remaining'>" . (140 - $length) . "</span>\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />";
    } else {
        $content .= "<p>@{$status->user->screen_name} doesn't allow you to retweet them. You will have to retweet them manually.</p>";
    }
    $content .= "<p>Edit before retweet:</p>\n\t\t\t\t\t<form action='update' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='hidden' name='in_reply_to_id' value='{$status->id_str}' />\n\t\t\t\t\t\t<textarea name='status' style='width:90%; max-width: 400px;' rows='5' id='status'>{$text}</textarea>\n\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t<input type='submit' value='Quote' />\n\t\t\t\t\t\t<span id='remaining'>" . (140 - $length) . "</span>\n\t\t\t\t\t</form>";
    $content .= js_counter("status");
    return $content;
}
Esempio n. 4
0
function touch_theme_menu_bottom()
{
    return js_counter('status');
}
Esempio n. 5
0
function theme_retweet($status)
{
    $text = "RT @{$status->user->screen_name}: {$status->text}";
    $length = function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text);
    $from = substr($_SERVER['HTTP_REFERER'], strlen(BASE_URL));
    if ($status->user->protected == 0) {
        $content .= "<p>Twitter's new style retweet:</p>\n\t\t\t\t\t<form action='twitter-retweet/{$status->id_str}' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='submit' value='Twitter Retweet' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />";
    } else {
        $content .= "<p>@{$status->user->screen_name} doesn't allow you to retweet them. You will have to use the  use the old style editable retweet</p>";
    }
    $content .= "<p>Old style editable retweet:</p>\n\t\t\t\t\t<form action='update' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<textarea name='status' style='width:90%; max-width: 400px;' rows='3' id='status'>{$text}</textarea>\n\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t<input type='submit' value='Retweet' />\n\t\t\t\t\t\t<span id='remaining'>" . (140 - $length) . "</span>\n\t\t\t\t\t</form>";
    $content .= js_counter("status");
    return $content;
}
Esempio n. 6
0
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;
    }
}
Esempio n. 7
0
function theme_retweet($status)
{
    $text = "RT @{$status->user->screen_name}: {$status->text}";
    $length = function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text);
    $from = substr($_SERVER['HTTP_REFERER'], strlen(BASE_URL));
    $content = "<p>";
    if ($status->user->protected == 0) {
        $content .= "<form action='" . BASE_URL . "twitter-retweet/{$status->id_str}' method='post'><input type='hidden' name='from' value='{$from}' /><input type='submit' value='Twitter " . __("Official Retweet") . "'> " . __("or Traditional Retweet") . ":</form>";
    } else {
        $content .= __("Note: ") . __("It is not well suited to retweet a protected user 's tweet.");
    }
    $content .= "</p><p><form action='" . BASE_URL . "update' method='post'><input type='hidden' name='from' value='{$from}' /><textarea name='status' style='width:100%;max-width:400px;' rows='3' id='status'>{$text}</textarea><br /><input type='submit' value='" . __(Retweet) . "'><span id='remaining'>" . (140 - $length) . "</span></form>" . js_counter("status") . "</p>";
    return $content;
}
Esempio n. 8
0
function desktop_theme_menu_bottom()
{
    return theme_menu_bottom() . js_counter('status');
}
Esempio n. 9
0
function theme_retweet($status)
{
    $rtsyntax = setting_fetch('rtsyntax', 'RT [User]: [Content]');
    $replace = array("[User]" => "@{$status->user->screen_name}", "[Content]" => "{$status->text}");
    $text = str_replace(array_keys($replace), array_values($replace), $rtsyntax);
    $length = function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen(utf8_decode($text));
    $from = substr($_SERVER['HTTP_REFERER'], strlen(BASE_URL));
    if ($status->user->protected == 0) {
        $content .= "<p>Twitter's new style retweet:</p>\n    <form action='twitter-retweet/{$status->id_str}' method='post'>\n    <div>\n      <input type='hidden' name='from' value='{$from}' />\n      <button type='submit'>Twitter Retweet</button>\n      </div>\n    </form>\n    <hr />";
    } else {
        $content .= "<p>@{$status->user->screen_name} doesn't allow you to retweet them. You will have to use the  use the old style editable retweet</p>";
    }
    $content .= "<p>Old style editable retweet:</p>\n    <form action='update' method='post'>\n    <div>\n      <input type='hidden' name='from' value='{$from}' />\n      <textarea name='status' rows='3' cols='60' id='status'>{$text}</textarea>\n      <br/>\n      <button id='submit' type='submit'>Retweet</button>\n      <span id='remaining'>" . (140 - $length) . "</span>\n      </div>\n    </form>";
    $content .= js_counter("status");
    if (setting_fetch('browser') == 'desktop') {
        $content .= "<script type='text/javascript'>\n    <!--\n    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()};\n    //-->\n    </script>";
    }
    return $content;
}
Esempio n. 10
0
function theme_retweet($status)
{
    $text = "RT @{$status->user->screen_name}: {$status->text}";
    $screen_name = $status->user->screen_name;
    $id = $status->id_str;
    $length = function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text);
    $from = substr($_SERVER['HTTP_REFERER'], strlen(BASE_URL));
    if ($status->user->protected == 0) {
        $content .= "<p>" . _(RETWEET_TWITTER) . ":</p>\n\t\t\t\t\t<form action='twitter-retweet/{$status->id_str}' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='submit' value='" . _(RETWEET_TWITTER) . "' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />";
        $content .= "<p>" . _(RETWEET_COMMENT) . ":</p>\n\t\t\t\t\t<form action='update' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='hidden' name='in_reply_to_id' value='{$status->id_str}' />\n\t\t\t\t\t\t<textarea name='status'\n\t\t\t\t\t\t\tstyle='width:90%;\n\t\t\t\t\t\t\tmax-width: 400px;'\n\t\t\t\t\t\t\trows='5'\n\t\t\t\t\t\t\tid='status'>&nbsp;\nhttps://twitter.com/{$screen_name}/status/{$id}</textarea>\n\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t<input type='submit' value='" . _(RETWEET_COMMENT) . "' />\n\t\t\t\t\t\t<span id='status-remaining'>" . (140 - $length) . "</span>\n\t\t\t\t\t</form>\n\t\t\t\t\t<hr />";
        $content .= js_counter("status");
    } else {
        $content .= "<p>" . sprintf(_(RETWEET_FORBIDDEN), $status->user->screen_name) . "</p>";
    }
    $content .= "<p>" . _(RETWEET_EDIT) . ":</p>\n\t\t\t\t\t<form action='update' method='post'>\n\t\t\t\t\t\t<input type='hidden' name='from' value='{$from}' />\n\t\t\t\t\t\t<input type='hidden' name='in_reply_to_id' value='{$status->id_str}' />\n\t\t\t\t\t\t<textarea name='status'\n\t\t\t\t\t\t\tstyle='width:90%;\n\t\t\t\t\t\t\tmax-width: 400px;'\n\t\t\t\t\t\t\trows='5'\n\t\t\t\t\t\t\tid='edit'>{$text}</textarea>\n\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t<input type='submit' value='" . _(RETWEET_EDIT_BUTTON) . "' />\n\t\t\t\t\t\t<span id='edit-remaining'>" . (140 - $length) . "</span>\n\t\t\t\t\t</form>";
    $content .= js_counter("edit");
    return $content;
}