Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Fixes in Backed PNG requests, Small tweak to rendered widget.
Browse files Browse the repository at this point in the history
Modified widget to show twitter username rather than description.
Proper wolf variables for PNG request, using PLUGINS_URI.
  • Loading branch information
mallardduck committed Aug 4, 2012
1 parent 92fdf6c commit 09fdc47
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 184 deletions.
32 changes: 16 additions & 16 deletions functions/twitter.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

function twitter($twitter_username,$tweet_count) {
echo "
<script type=\"text/javascript\" charset=\"utf-8\">
getTwitters('tweets', {
id: '".$twitter_username."',
clearContents: false,
count: ".$tweet_count.",
ignoreReplies: false,
template: '\"%text%\" <br /><a href=\"http://twitter.com/%user_screen_name%/statuses/%id%/\">%user_description%</a>'
});
</script>
<div class=\"twitters\" id=\"tweets\">
<h2>Latest Tweets:</h2>
</div>";
<?php

function twitter($twitter_username,$tweet_count) {
echo "
<script type=\"text/javascript\" charset=\"utf-8\">
getTwitters('tweets', {
id: '".$twitter_username."',
clearContents: false,
count: ".$tweet_count.",
ignoreReplies: false,
template: '\"%text%\" <br /><a href=\"http://twitter.com/%user_screen_name%/statuses/%id%/\">%user_name%</a>'
});
</script>
<div class=\"twitters\" id=\"tweets\">
<h2>Latest Tweets:</h2>
</div>";
}
262 changes: 131 additions & 131 deletions views/extending.php
Original file line number Diff line number Diff line change
@@ -1,132 +1,132 @@
<?php
if (Dispatcher::getAction() != 'view'):
?>



<h1><img src="../wolf/plugins/twitter/images/twitter_large.png" style="padding-bottom: 15px;" /></h1>

<h1>Extending the Twitter Plugin</h1>

<p>Whilst this plugin will work out of the box, there is room to extend it in the future and simple 'hacks' you can do for now, so if you can't resist getting your hands dirty, read on.</p>

<p>OK, so we make a request to Twitter's server with a username and number of tweets to collect and Twitter then returns information to us to do with what we like.</p>

<p>&nbsp;</p>

<p>Twitter will return the following information:</p>

<table class="index" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th width="25%" style="font-weight: bold; font-size: 16px;">Name</th>
<th width="35%" style="font-weight: bold; font-size: 16px;">Interpretation</th>
<th width="40%" style="font-weight: bold; font-size: 16px;">Example</th>
</tr>
</thead>
<tbody>
<tr class="<?php echo odd_even(); ?>">
<td>text</td>
<td>The message itself</td>
<td>is busy writing a plugin for Frog</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>id</td>
<td>The message ID number</td>
<td>http://twitter.com/user_name/statuses/<strong>123456789</strong></td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>source</td>
<td>Where the update came from</td>
<td>Twitterific, Web, Mobile</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>created_at</td>
<td>Timestamp of "Tweet"</td>
<td>Fri Jul 18 00:00:01 +0000 2008</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>time</td>
<td>A user friendly time of "Tweet"</td>
<td>"less than a minute ago", "4 days ago"</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_name</td>
<td>Your real name</td>
<td>Andrew Waters</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_screen_name</td>
<td>The Screen Name of the user</td>
<td>andrew_waters</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_id</td>
<td>The user ID value</td>
<td>987654321</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_profile_image_url</td>
<td>The users image</td>
<td>Returns the users image they have set</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_url</td>
<td>The users homepage</td>
<td>http://www.madebyfrog.com</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_location</td>
<td>Coordinates of where update sent from</td>
<td>12.123456,-1.234567</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_description</td>
<td>The Bio line on Twitter</td>
<td>I'm a web developer</td>
</tr>
</tbody>
</table>

<p>&nbsp;</p>

<p>We can then add that information to our output via the javascript function.<br />
<strong>Please Note that we have to wrap each string in "%" (see below)</strong></p>

<p>If you take a look at the <strong>wolf/plugins/twitter/functions</strong> folder there is a file called <strong><em>twitter.php</em></strong></p>

<p>Fire it up and take a look inside - it should look a little bit like this:</p>

<p>
<pre>
&lt;script type=\"text/javascript\" charset=\"utf-8\">
getTwitters('tweets', {
id: '".$twitter_username."',
clearContents: false,
count: ".$tweet_count.",
ignoreReplies: false,
template: '\"%text%\"
});
&lt;/script>
</pre>
</p>

<p>You can now customise this javascript to your own needs by inserting the code in the table above. Make sure that you wrap the variables in <code>%</code> though - for example <code>created_at</code> becomes <code>%created_at%</code></p>

<p><strong>Enjoy!</strong></p>















<?php
if (Dispatcher::getAction() != 'view'):
?>



<h1><img src="<?php echo PLUGINS_URI; ?>twitter/images/twitter_large.png" style="padding-bottom: 15px;" /></h1>

<h1>Extending the Twitter Plugin</h1>

<p>Whilst this plugin will work out of the box, there is room to extend it in the future and simple 'hacks' you can do for now, so if you can't resist getting your hands dirty, read on.</p>

<p>OK, so we make a request to Twitter's server with a username and number of tweets to collect and Twitter then returns information to us to do with what we like.</p>

<p>&nbsp;</p>

<p>Twitter will return the following information:</p>

<table class="index" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th width="25%" style="font-weight: bold; font-size: 16px;">Name</th>
<th width="35%" style="font-weight: bold; font-size: 16px;">Interpretation</th>
<th width="40%" style="font-weight: bold; font-size: 16px;">Example</th>
</tr>
</thead>
<tbody>
<tr class="<?php echo odd_even(); ?>">
<td>text</td>
<td>The message itself</td>
<td>is busy writing a plugin for Frog</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>id</td>
<td>The message ID number</td>
<td>http://twitter.com/user_name/statuses/<strong>123456789</strong></td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>source</td>
<td>Where the update came from</td>
<td>Twitterific, Web, Mobile</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>created_at</td>
<td>Timestamp of "Tweet"</td>
<td>Fri Jul 18 00:00:01 +0000 2008</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>time</td>
<td>A user friendly time of "Tweet"</td>
<td>"less than a minute ago", "4 days ago"</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_name</td>
<td>Your real name</td>
<td>Andrew Waters</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_screen_name</td>
<td>The Screen Name of the user</td>
<td>andrew_waters</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_id</td>
<td>The user ID value</td>
<td>987654321</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_profile_image_url</td>
<td>The users image</td>
<td>Returns the users image they have set</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_url</td>
<td>The users homepage</td>
<td>http://www.madebyfrog.com</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_location</td>
<td>Coordinates of where update sent from</td>
<td>12.123456,-1.234567</td>
</tr>
<tr class="<?php echo odd_even(); ?>">
<td>user_description</td>
<td>The Bio line on Twitter</td>
<td>I'm a web developer</td>
</tr>
</tbody>
</table>

<p>&nbsp;</p>

<p>We can then add that information to our output via the javascript function.<br />
<strong>Please Note that we have to wrap each string in "%" (see below)</strong></p>

<p>If you take a look at the <strong>wolf/plugins/twitter/functions</strong> folder there is a file called <strong><em>twitter.php</em></strong></p>

<p>Fire it up and take a look inside - it should look a little bit like this:</p>

<p>
<pre>
&lt;script type=\"text/javascript\" charset=\"utf-8\">
getTwitters('tweets', {
id: '".$twitter_username."',
clearContents: false,
count: ".$tweet_count.",
ignoreReplies: false,
template: '\"%text%\"
});
&lt;/script>
</pre>
</p>

<p>You can now customise this javascript to your own needs by inserting the code in the table above. Make sure that you wrap the variables in <code>%</code> though - for example <code>created_at</code> becomes <code>%created_at%</code></p>

<p><strong>Enjoy!</strong></p>















<?php endif; ?>
64 changes: 32 additions & 32 deletions views/index.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?php if (Dispatcher::getAction() != 'view'): ?>


<h1><img src="../wolf/plugins/twitter/images/twitter_large.png" style="padding-bottom: 15px;" /></h1>

<h1>Status Display</h1>

<p>This plugin enables you to display your <a href="http://www.twitter.com" target="_blank">Twitter Status</a> on your site in three simple steps.</p>
<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step One</h2>

<p>Add the following code to your layout head section:</p>
<p><code>&lt;?php twitter_js(); ?></code></p>
<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step Two</h2>

<p>Now that the javascript is set up, we can place the status updates on our page by inserting the following code where you would like your updates to appear. This can be placed in a page part, layout or snippet.</p>
<p><code>&lt;?php twitter(<strong>$twitter_username</strong>,<strong>$tweet_count</strong>); ?></code></p>

<p>When you write this in your page, you should replace the two variables:</p>
<p><strong><code>$twitter_username</code></strong><br />is your username...</p>
<p><strong><code>$tweet_count</code></strong><br />is the number of updates you would like to show on the page.</p>

<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step Three</h2>

<p><strong>Enjoy!</strong></p>


<?php if (Dispatcher::getAction() != 'view'): ?>


<h1><img src="<?php echo PLUGINS_URI; ?>/twitter/images/twitter_large.png" style="padding-bottom: 15px;" /></h1>

<h1>Status Display</h1>

<p>This plugin enables you to display your <a href="http://www.twitter.com" target="_blank">Twitter Status</a> on your site in three simple steps.</p>
<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step One</h2>

<p>Add the following code to your layout head section:</p>
<p><code>&lt;?php twitter_js(); ?></code></p>
<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step Two</h2>

<p>Now that the javascript is set up, we can place the status updates on our page by inserting the following code where you would like your updates to appear. This can be placed in a page part, layout or snippet.</p>
<p><code>&lt;?php twitter(<strong>$twitter_username</strong>,<strong>$tweet_count</strong>); ?></code></p>

<p>When you write this in your page, you should replace the two variables:</p>
<p><strong><code>$twitter_username</code></strong><br />is your username...</p>
<p><strong><code>$tweet_count</code></strong><br />is the number of updates you would like to show on the page.</p>

<p>&nbsp;</p>

<h2 style="text-decoration: underline;">Step Three</h2>

<p><strong>Enjoy!</strong></p>


<?php endif; ?>
10 changes: 5 additions & 5 deletions views/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php if (Dispatcher::getAction() != 'view'): ?>

<p class="button"><a href="<?php echo get_url('plugin/twitter/'); ?>"><img src="../wolf/plugins/twitter/images/twitter.png" align="middle" alt="page icon" />Home</a></p>
<p class="button"><a href="<?php echo get_url('plugin/twitter/extending'); ?>"><img src="../wolf/plugins/twitter/images/extending.png" align="middle" alt="page icon" />Extending</a></p>

<?php if (Dispatcher::getAction() != 'view'): ?>

<p class="button"><a href="<?php echo get_url('plugin/twitter/'); ?>"><img src="<?php echo PLUGINS_URI; ?>twitter/images/twitter.png" align="middle" alt="page icon" />Home</a></p>
<p class="button"><a href="<?php echo get_url('plugin/twitter/extending'); ?>"><img src="<?php echo PLUGINS_URI; ?>twitter/images/extending.png" align="middle" alt="page icon" />Extending</a></p>

<?php endif; ?>

0 comments on commit 09fdc47

Please sign in to comment.