BlankAdPlugin.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * Plugin for testing ad layout
  6. *
  7. * PHP version 5
  8. *
  9. * LICENCE: This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * @category Ads
  23. * @package StatusNet
  24. * @author Evan Prodromou <evan@status.net>
  25. * @copyright 2010 StatusNet Inc.
  26. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  27. * @link http://status.net/
  28. */
  29. if (!defined('STATUSNET')) {
  30. exit(1);
  31. }
  32. /**
  33. * Plugin for testing ad layout
  34. *
  35. * This plugin uses the UAPPlugin framework to output ad content. However,
  36. * its ad content is just images with one red pixel stretched to the
  37. * right size. It's mostly useful for debugging theme layout.
  38. *
  39. * To use this plugin, set the parameter for the ad size you want to use
  40. * to true (or anything non-null). For example, to make a leaderboard:
  41. *
  42. * addPlugin('BlankAd', array('leaderboard' => true));
  43. *
  44. * @category Plugin
  45. * @package StatusNet
  46. * @author Evan Prodromou <evan@status.net>
  47. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  48. * @link http://status.net/
  49. *
  50. * @seeAlso Location
  51. */
  52. class BlankAdPlugin extends UAPPlugin
  53. {
  54. /**
  55. * Show a medium rectangle 'ad'
  56. *
  57. * @param Action $action Action being shown
  58. *
  59. * @return void
  60. */
  61. protected function showMediumRectangle($action)
  62. {
  63. $action->element('img',
  64. array('width' => 300,
  65. 'height' => 250,
  66. 'src' => $this->path('redpixel.png')),
  67. '');
  68. }
  69. /**
  70. * Show a rectangle 'ad'
  71. *
  72. * @param Action $action Action being shown
  73. *
  74. * @return void
  75. */
  76. protected function showRectangle($action)
  77. {
  78. $action->element('img',
  79. array('width' => 180,
  80. 'height' => 150,
  81. 'src' => $this->path('redpixel.png')),
  82. '');
  83. }
  84. /**
  85. * Show a wide skyscraper ad
  86. *
  87. * @param Action $action Action being shown
  88. *
  89. * @return void
  90. */
  91. protected function showWideSkyscraper($action)
  92. {
  93. $action->element('img',
  94. array('width' => 160,
  95. 'height' => 600,
  96. 'src' => $this->path('redpixel.png')),
  97. '');
  98. }
  99. /**
  100. * Show a leaderboard ad
  101. *
  102. * @param Action $action Action being shown
  103. *
  104. * @return void
  105. */
  106. protected function showLeaderboard($action)
  107. {
  108. $action->element('img',
  109. array('width' => 728,
  110. 'height' => 90,
  111. 'src' => $this->path('redpixel.png')),
  112. '');
  113. }
  114. function onPluginVersion(array &$versions)
  115. {
  116. $versions[] = array('name' => 'BlankAd',
  117. 'version' => GNUSOCIAL_VERSION,
  118. 'author' => 'Evan Prodromou',
  119. 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/BlankAdPlugin',
  120. 'rawdescription' =>
  121. // TRANS: Plugin description.
  122. _m('Plugin for testing ad layout.'));
  123. return true;
  124. }
  125. }