Created
August 6, 2013 18:27
-
-
Save nitinthewiz/6167179 to your computer and use it in GitHub Desktop.
liveblog mobile view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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