You are here

README.txt in Tweet 5.2

=============
== Summary ==
=============
This module provides links to post pages to twitter. Clicking the links will
open a new window or tab with twitter in it. The tweet will be in focus and will
contain a customizable string (making hashtags possible) which can
programmatically include the relevantURL and title. The URL will be abbreviated
using one of these services: hex.io, idek.net, is.gd, lin.cr, ri.ms, th8.us,
TinyURL, or tr.im.

URLs and titles will be for either the node which is being displayed as a
teaser or for the current page. Multiple links can appear on the same page, as
on a View of teasers. By default, links appear in the Links section when viewing
full nodes or teasers.

Administrators can choose whether to show the link as an icon, an icon and
text, or just text.  Options can be chosen separately for nodes and teasers.
Administrators can also choose which node types the links should appear on, or
could choose not to have links show up on nodes at all.  If the module is
configured not to display links automatically, administrators can display their
own links wherever they like by calling tweet_to_twitter().  A more complete
explanation is below.

==================
== Requirements ==
==================
There are no requirements for using this module, but it is recommended that your
PHP installation is compiled with either the file_get_contents() function, cURL,
or both.  If you're not sure, your PHP probably supports at least
file_get_contents(), and most installations support cURL as well.  Without one
of these, you will not be able to use the URL abbreviation feature.  For more
information visit http://php.net/file_get_contents and http://php.net/curl.

=====================
== Development/API ==
=====================
If you are using this module to display links to twitter arbitrarily, you will
probably be using the tweet_to_twitter() function.  This constructs the link
you need according to the following arguments.  All arguments are optional
unless otherwise noted.  If no arguments are passed the link constructed will
be for the current page according to your settings.

If you want more control, the _tweet_to_twitter() function takes the same
arguments and returns an array in the format required by hook_link()
(http://api.drupal.org/api/function/hook_link/5).

$type
  Specifies what will show up in the link: the twitter icon, the twitter icon
  and text, or just text. Pass 'icon' to show just the icon, 'icon_text' to
  show the icon and text, and 'text' to show just the text. Required if display
  options for nodes are set to 'none' on the settings page.
$format
  A string representing the tweet text, optionally with the case-insensitive
  tokens [url] and [title]. If not passed, the format from the settings page
  will be used.
$nid
  The NID of the node for which the twitter link should be constructed.
$q
  The absolute URL of the page for which the twitter link should be
  constructed. If this is not the current page, the _title_ MUST be set
  manually, or it will be incorrect.

----

You can add additional URL abbreviation services to Tweet using
hook_tweet_service($original). Using this hook will expose your service to the
Tweet Settings page. If you choose the service provided by your hook there,
Tweet will process URL abbreviation as described below. See
tweet_tweet_service() for an example.

The hook should return an array keyed by the name of the service. The value of
each array element can be the URL of the service's API page that returns only
the abbreviated URL, without the site's URL appended:
'http://tinyurl.com/api-create.php?url='. If this is the case, Tweet will
automatically retrieve the abbreviated URL from the service.

The value of each array element can also be an array structured like this:
array('custom' => TRUE, 'url' => 'http://tinyurl.com/api-create.php?url='). If
'custom' is FALSE, Tweet will treat 'url' as if it was passed like a string (as
explained above). If 'custom' is TRUE, Tweet will assume the 'url' has already
been processed and will not attempt to abbreviate anything. This behavior allows
you to do your own processing--for example, you could retrieve abbreviated URLs
using JSON or XML in this manner. The 'url' returned in this case should already
be abbreviated (the parameter $original is the URL that should be abbreviated).

==================
== Installation ==
==================
   1. Install this module as usual (FTP the files to sites/all/modules, enable 
        at admin/build/modules).  See http://drupal.org/node/70151 for help.
   2. If you want, go to admin/settings/tweet to change the module's settings.

===========
== Links ==
===========
Visit the module page for more information.

Module Page: http://drupal.org/project/tweet
Enable Module: http://example.com/?q=admin/build/modules
Settings Page: http://example.com/?q=admin/settings/tweet

File

README.txt
View source
  1. =============
  2. == Summary ==
  3. =============
  4. This module provides links to post pages to twitter. Clicking the links will
  5. open a new window or tab with twitter in it. The tweet will be in focus and will
  6. contain a customizable string (making hashtags possible) which can
  7. programmatically include the relevantURL and title. The URL will be abbreviated
  8. using one of these services: hex.io, idek.net, is.gd, lin.cr, ri.ms, th8.us,
  9. TinyURL, or tr.im.
  10. URLs and titles will be for either the node which is being displayed as a
  11. teaser or for the current page. Multiple links can appear on the same page, as
  12. on a View of teasers. By default, links appear in the Links section when viewing
  13. full nodes or teasers.
  14. Administrators can choose whether to show the link as an icon, an icon and
  15. text, or just text. Options can be chosen separately for nodes and teasers.
  16. Administrators can also choose which node types the links should appear on, or
  17. could choose not to have links show up on nodes at all. If the module is
  18. configured not to display links automatically, administrators can display their
  19. own links wherever they like by calling tweet_to_twitter(). A more complete
  20. explanation is below.
  21. ==================
  22. == Requirements ==
  23. ==================
  24. There are no requirements for using this module, but it is recommended that your
  25. PHP installation is compiled with either the file_get_contents() function, cURL,
  26. or both. If you're not sure, your PHP probably supports at least
  27. file_get_contents(), and most installations support cURL as well. Without one
  28. of these, you will not be able to use the URL abbreviation feature. For more
  29. information visit http://php.net/file_get_contents and http://php.net/curl.
  30. =====================
  31. == Development/API ==
  32. =====================
  33. If you are using this module to display links to twitter arbitrarily, you will
  34. probably be using the tweet_to_twitter() function. This constructs the link
  35. you need according to the following arguments. All arguments are optional
  36. unless otherwise noted. If no arguments are passed the link constructed will
  37. be for the current page according to your settings.
  38. If you want more control, the _tweet_to_twitter() function takes the same
  39. arguments and returns an array in the format required by hook_link()
  40. (http://api.drupal.org/api/function/hook_link/5).
  41. $type
  42. Specifies what will show up in the link: the twitter icon, the twitter icon
  43. and text, or just text. Pass 'icon' to show just the icon, 'icon_text' to
  44. show the icon and text, and 'text' to show just the text. Required if display
  45. options for nodes are set to 'none' on the settings page.
  46. $format
  47. A string representing the tweet text, optionally with the case-insensitive
  48. tokens [url] and [title]. If not passed, the format from the settings page
  49. will be used.
  50. $nid
  51. The NID of the node for which the twitter link should be constructed.
  52. $q
  53. The absolute URL of the page for which the twitter link should be
  54. constructed. If this is not the current page, the _title_ MUST be set
  55. manually, or it will be incorrect.
  56. ----
  57. You can add additional URL abbreviation services to Tweet using
  58. hook_tweet_service($original). Using this hook will expose your service to the
  59. Tweet Settings page. If you choose the service provided by your hook there,
  60. Tweet will process URL abbreviation as described below. See
  61. tweet_tweet_service() for an example.
  62. The hook should return an array keyed by the name of the service. The value of
  63. each array element can be the URL of the service's API page that returns only
  64. the abbreviated URL, without the site's URL appended:
  65. 'http://tinyurl.com/api-create.php?url='. If this is the case, Tweet will
  66. automatically retrieve the abbreviated URL from the service.
  67. The value of each array element can also be an array structured like this:
  68. array('custom' => TRUE, 'url' => 'http://tinyurl.com/api-create.php?url='). If
  69. 'custom' is FALSE, Tweet will treat 'url' as if it was passed like a string (as
  70. explained above). If 'custom' is TRUE, Tweet will assume the 'url' has already
  71. been processed and will not attempt to abbreviate anything. This behavior allows
  72. you to do your own processing--for example, you could retrieve abbreviated URLs
  73. using JSON or XML in this manner. The 'url' returned in this case should already
  74. be abbreviated (the parameter $original is the URL that should be abbreviated).
  75. ==================
  76. == Installation ==
  77. ==================
  78. 1. Install this module as usual (FTP the files to sites/all/modules, enable
  79. at admin/build/modules). See http://drupal.org/node/70151 for help.
  80. 2. If you want, go to admin/settings/tweet to change the module's settings.
  81. ===========
  82. == Links ==
  83. ===========
  84. Visit the module page for more information.
  85. Module Page: http://drupal.org/project/tweet
  86. Enable Module: http://example.com/?q=admin/build/modules
  87. Settings Page: http://example.com/?q=admin/settings/tweet