Skip to content

Instantly share code, notes, and snippets.

@nitinthewiz
Created August 6, 2013 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitinthewiz/6167179 to your computer and use it in GitHub Desktop.
Save nitinthewiz/6167179 to your computer and use it in GitHub Desktop.
liveblog mobile view
<?php
function current_user_canada() {
$curr_user = wp_get_current_user();
return $curr_user;
}
$message = "";
$status = "";
foreach($_GET as $key => $value) {
if($key=="text"){
$message = $value;
}
if($key=="status"){
$status = $value;
}
}
if ( ! class_exists( 'WPCOM_Liveblog_Entry' ) ) :
require( 'classes/class-wpcom-liveblog-entry.php');
require( 'classes/class-wpcom-liveblog-entry-query.php' );
endif;
if(isset($_POST['submit'])) {
//echo 'You entered: ', htmlspecialchars($_POST['something']);
$text = htmlentities($_POST['something']);
$args['post_id'] = 483;
$args['content'] = $text;
$args['user'] = current_user_canada();
$new_entry = call_user_func( array( 'WPCOM_Liveblog_Entry', 'insert' ), $args);
$id = $new_entry->get_id();
}
?>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<form method="post" action="" class="form-horizontal">
<textarea rows="7" cols="50" id="something" name="something" value="<?= isset($_POST['something']) ? htmlspecialchars($_POST['something']) : '' ?>" ><?php echo htmlspecialchars($message); ?></textarea><br />
<input type="submit" class="btn" name="submit" />
<script type="text/javascript">
function btnOnClick() {
var str=document.getElementById('something').value;
var n=str.replace("\\'","'");
//alert(n);
var win=window.open('https://twitter.com/intent/tweet?text='+n, '_blank');
}
</script>
<input
type="button"
name="Tweet"
value="Tweet!"
onclick="javascript:btnOnClick()"/><br />
<textarea rows="2" cols="50"><?php echo htmlspecialchars($status); ?></textarea><br />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment