Last active
October 30, 2015 18:20
-
-
Save i5ar/b7f97ed51ba6974a8982 to your computer and use it in GitHub Desktop.
Twitter Indent
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 | |
// Assigning Twitter form | |
$text = 'An awesome tweet'; // The tweet text | |
$url_page = 'http://localhost/mydomain/page-name'; // The tweet link | |
$account = 'i5ar'; // The tweet account | |
// Encoding | |
$url = urlencode($text); | |
$url.= "+".rawurlencode($url_page); | |
$url.= "+via+".urlencode('@').urlencode($account); | |
// Escaping any html that might do bad things | |
echo htmlspecialchars($url).'<br/>'; | |
// Printing link | |
echo '<a class="inv-tweet" href="https://twitter.com/indent/tweet?text='.htmlspecialchars($url).'" data-via="'.$account.'" target="_blank">'; | |
echo $text; | |
echo '<span class="genericon genericon-twitter"></span></a><br/>'; | |
// Printing html link | |
$html = '<a class="inv-tweet" href="https://twitter.com/indent/tweet?text='.htmlspecialchars($url).'" data-via="'.$account.'" target="_blank">'.$text.'<span class="genericon genericon-twitter"></span></a>'; | |
echo htmlspecialchars($html); | |
?> |
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
/* Twitter Indent */ | |
a.inv-tweet { | |
display: inline; | |
padding: 0px 5px; | |
background: #f5f5f5; | |
text-decoration: none; | |
} | |
.inv-tweet .genericon { | |
color: #808080; | |
vertical-align:baseline; | |
} | |
.inv-tweet:hover .genericon { | |
color: #00adff; | |
} | |
.inv-tweet:hover { | |
color: #2b2b2b; | |
background: #e1f2f5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment