PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/yet-another-photoblog/lib/Savant2-2.4.3/Savant2/tests/templates/plugins.tpl.php

https://github.com/Mercedes/ratonesytortillas
PHP | 192 lines | 123 code | 61 blank | 8 comment | 2 complexity | 9949b43a99f51ffa9931917c29cbf87b MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * Tests the default and example plugins for Savant.
  5. *
  6. * @version $Id: plugins.tpl.php,v 1.2 2004/12/08 15:52:17 pmjones Exp $
  7. *
  8. */
  9. ?>
  10. <h1>ahref</h1>
  11. <h2>from strings</h2>
  12. <pre>
  13. <?php
  14. $result = $this->splugin('ahref', 'http://example.com/index.html?this=this&that=that#something', 'Example Link', 'target="_blank"');
  15. echo '<p>' . $this->splugin('modify', $result, 'htmlentities nl2br') . '</p>';
  16. echo "<p>$result</p>";
  17. ?>
  18. </pre>
  19. <h2>from arrays</h2>
  20. <pre>
  21. <?php
  22. $result = $this->splugin(
  23. 'ahref',
  24. parse_url('http://example.com/index.html?this=this&that=that#something'),
  25. 'Example Link',
  26. array('target' => "_blank")
  27. );
  28. echo '<p>' . $this->splugin('modify', $result, 'htmlentities nl2br') . '</p>';
  29. echo "<p>$result</p>";
  30. ?>
  31. </pre>
  32. <h1>checkbox</h1>
  33. <pre>
  34. <?php
  35. $result = '';
  36. foreach ($this->set as $key => $val) {
  37. $result .= $this->splugin(
  38. 'checkbox', // plugin
  39. "xboxen[$key]", // checkbox name
  40. $key, // checkbox value
  41. 'key1', // pre-checked
  42. '', // default value when not checked
  43. 'dumb="dumber"' // attributes
  44. );
  45. $result .= $val . "<br /><br />\n";
  46. }
  47. $this->plugin('modify', $result, 'htmlentities nl2br');
  48. ?>
  49. </pre>
  50. <form><?php echo $result ?></form>
  51. <h1>cycle</h1>
  52. <h2>repeat 1 on array</h2>
  53. <pre>
  54. <?php for ($i = 0; $i < 9; $i++): ?>
  55. <?php $this->plugin('cycle', array('a', 'b', 'c'), $i) ?><br />
  56. <?php endfor; ?>
  57. </pre>
  58. <h2>repeat 3 on preset</h2>
  59. <pre>
  60. <?php for ($i = 0; $i < 12; $i++): ?>
  61. <?php $this->plugin('cycle', 'lightdark', $i, 3) ?><br />
  62. <?php endfor; ?>
  63. </pre>
  64. <h1>dateformat</h1>
  65. <p><?php $this->plugin('dateformat', "Aug 8, 1970") ?></p>
  66. <p><?php $this->plugin('dateformat', "Aug 8, 1970", 'mydate') ?></p>
  67. <h1>javascript</h1>
  68. <pre><?php echo htmlentities($this->splugin('javascript', 'path/to/file.js')) ?></pre>
  69. <h1>image</h1>
  70. <h2>local</h2>
  71. <pre><?php echo htmlentities($this->splugin('image', 'savant.gif')) ?></pre>
  72. <?php $this->plugin('image', 'savant.gif') ?>
  73. <h2>nonexistent</h2>
  74. <pre><?php echo htmlentities($this->splugin('image', 'savantx.gif', 'image does not exist')) ?></pre>
  75. <?php $this->plugin('image', 'savantx.gif', 'image does not exist') ?>
  76. <h2>stream</h2>
  77. <pre><?php echo htmlentities($this->splugin('image', 'http://phpsavant.com/etc/fester.jpg')) ?></pre>
  78. <?php $this->plugin('image', 'http://phpsavant.com/etc/fester.jpg') ?>
  79. <h1>options</h1>
  80. <h2>assoc</h2>
  81. <pre>
  82. <?php
  83. $result = $this->splugin('options', $this->set, 'key1', 'dumb="dumber"');
  84. $this->plugin('modify', $result, 'htmlentities nl2br');
  85. ?>
  86. </pre>
  87. <form><select name="test"><?php echo $result ?></select></form>
  88. <h2>seq</h2>
  89. <pre>
  90. <?php
  91. $result = $this->splugin('options', $this->set, 'val2', array('attrib' => 'this & that'), true);
  92. $this->plugin('modify', $result, 'htmlentities nl2br');
  93. ?>
  94. </pre>
  95. <form><select name="test"><?php echo $result ?></select></form>
  96. <h1>radios</h1>
  97. <h2>assoc</h2>
  98. <pre>
  99. <?php
  100. $result = $this->splugin('radios', 'das_radio', $this->set, 'key1', 'nil', "<br /><br />\n", 'dumb="dumber"');
  101. $this->plugin('modify', $result, 'htmlentities nl2br');
  102. ?>
  103. </pre>
  104. <form><?php echo $result ?></form>
  105. <h2>seq</h2>
  106. <pre>
  107. <?php
  108. $result = $this->splugin('radios', 'das_radio', $this->set, 'val2', 'nil', "<br /><br />\n", 'dumb="dumber"', true);
  109. $this->plugin('modify', $result, 'htmlentities nl2br');
  110. ?>
  111. </pre>
  112. <form><?php echo $result ?></form>
  113. <h1>stylesheet</h1>
  114. <pre><?php echo htmlentities($this->splugin('stylesheet', 'path/to/styles.css')) ?></pre>
  115. <h1>textarea</h1>
  116. <pre>
  117. <?php
  118. $result = $this->splugin('textarea', 'longtext', "some really long text");
  119. $this->plugin('modify', $result, 'htmlentities nl2br');
  120. ?>
  121. </pre>
  122. <?php
  123. // tests the plugin path and a call-by-instance plugin
  124. ?>
  125. <h1>fester</h1>
  126. <?php $this->plugin('fester', 'Gomez') ?><br />
  127. <?php $this->plugin('fester', 'Morticia') ?><br />
  128. <?php $this->plugin('fester', 'Cara Mia!') ?><br />
  129. <h1>Plugin Objects</h1>
  130. _resource[plugin]: <pre><?php print_r($this->_resource['plugin']) ?></pre>
  131. <!-- end -->