liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file help_format_tikiwiki_inc.php

Documentation is available at help_format_tikiwiki_inc.php

  1. <?php
  2. /**
  3.  * help_format_tikiwiki_inc
  4.  *
  5.  * @author   Christian Fowler>
  6.  * @version  $Revision$
  7.  * @package  liberty
  8.  * @subpackage functions
  9.  */
  10.  
  11. /**
  12.  * required setup
  13.  */
  14. global $gBitSystem$gBitSmarty;
  15. require_onceKERNEL_PKG_PATH.'BitCache.php' );
  16. $cache new BitCache'liberty/help' );
  17.  
  18. // only regenerate this thing if it's not cached yet
  19. $cacheFile 'tikiwiki';
  20. if$cache->isCached$cacheFilefilemtime__FILE__ ))) {
  21.     $examples unserialize$cache->readCacheFile$cacheFile ));
  22. else {
  23.     // help for generic options
  24.     $tikiwiki array(
  25.         'Emphasis' => array(
  26.             'Headings' => array(
  27.                 'data' => "! heading 1\n!! heading 2\n!!! heading 3",
  28.                 'note' => "Number of ! correponds to heading level.",
  29.             ),
  30.             'Italics' => array(
  31.                 'data' => "''text''",
  32.                 'note' => "Two single quotes not one double quote",
  33.             ),
  34.             'Underline' => array(
  35.                 'data' => "===text===",
  36.             ),
  37.             'Coloured Background' => array(
  38.                 'data' => "++yellow:text++",
  39.             ),
  40.             'Coloured Text' => array(
  41.                 'data' => "~~red:text~~",
  42.             ),
  43.             'Bold' => array(
  44.                 'data' => "__text__",
  45.             ),
  46.             'Centered Text' => array(
  47.                 'data' => "::text::",
  48.             ),
  49.             'Combined' => array(
  50.                 'data' => "::__~~red:++yellow:text++~~__::",
  51.                 'note' => "When you combine options make sure you open and close in the opposite order analogous to: {[(text)]}",
  52.             ),
  53.         ),
  54.         'Lists' => array(
  55.             'Unordered Lists' => array(
  56.                 'data' => "* First item\n** First subitem\n** Second subitem\n* Second item",
  57.             ),
  58.             'Ordered Lists' => array(
  59.                 'data' => "# First item\n## First subitem\n## Second subitem\n# Second item",
  60.             ),
  61.             'Definition Lists' => array(
  62.                 'data' => ";Term: Definition",
  63.             ),
  64.         ),
  65.         'Links' => array(
  66.             'Wiki Links' => array(
  67.                 'data' => "((Wiki Page))",
  68.                 'result' => '<a href="#">Wiki Page</a>',
  69.             ),
  70.             'Wiki Links + Description' => array(
  71.                 'data' => "((Wiki Page|Page Description))",
  72.                 'result' => '<a href="#">Page Description</a>',
  73.             ),
  74.             'Wiki Links + Anchor + Description' => array(
  75.                 'data' => "((Wiki Page#Anchor|Page Description))",
  76.                 'result' => '<a href="#">Page Description</a>',
  77.             ),
  78.             'External Link' => array(
  79.                 'data' => "[http://www.example.com]",
  80.             ),
  81.             'External Link + Description' => array(
  82.                 'data' => "[http://www.example.com|Description]",
  83.             ),
  84.             'External Link + Anchor + Description' => array(
  85.                 'data' => "[http://www.example.com/Page#Anchor|Description]",
  86.             ),
  87.         ),
  88.         'Miscellaneous' => array(
  89.             'Horizontal Rule' => array(
  90.                 'data' => '---',
  91.             ),
  92.             'Highlighted Bar' => array(
  93.                 'data' => '-=text=-',
  94.             ),
  95.             'Highlighted Box' => array(
  96.                 'data' => "^text\nmore text^",
  97.             ),
  98.             'As is Text' => array(
  99.                 'data' => "~np~~~yellow:yellow~~\nand\n__bold__ text~/np~",
  100.                 'note' => "This text will not be parsed",
  101.             ),
  102.             'Pre Parsed' => array(
  103.                 'data' => "~pp~~~yellow:yellow~~\nand\n__bold__ text~/pp~",
  104.                 'note' => "This text will be treated like code and will not be altered and will be displayed using a monospace font. The same can be achieved by using &lt;pre&gt;text&lt;/pre&gt;.",
  105.             ),
  106.             'Monospaced Text' => array(
  107.                 'data' => "-+text+-",
  108.             ),
  109.             'Right to Left' => array(
  110.                 'data' => "{r2l}this text is from\nright to left\n{l2r}and back to\nleft to right.",
  111.             ),
  112.         ),
  113.         'Simple Tables' => array(
  114.             'Simple Table' => array(
  115.                 'data' => "|| Row1-Col1 | Row1-Col2\nRow2-Col1 | Row2-Col2 ||",
  116.             ),
  117.             'With Headers' => array(
  118.                 'data' => "||~ Header1 | Header2\nRow1-Col1 | Row1-Col2\nRow2-Col1 | Row2-Col2 ||",
  119.             ),
  120.         ),
  121.     );
  122.  
  123.     if$gBitSystem->getConfig'wiki_tables' == 'old' {
  124.         $tikiwiki['Simple Tables'array(
  125.             'Tables' => array(
  126.                 'data' => "|| Row1-Col1 | Row1-Col2 || Row2-Col1 | Row2-Col2 ||",
  127.             ),
  128.         );
  129.     }
  130.  
  131.     foreacharray_keys$tikiwiki as $section {
  132.         foreach$tikiwiki[$sectionas $title => $example {
  133.             ifempty$example['result')) {
  134.                 $example['format_guid''tikiwiki';
  135.                 $tikiwiki[$section][$title]['result'LibertyContent::parseData$example );
  136.             }
  137.         }
  138.     }
  139.  
  140.     // mediawiki type tables
  141.     $mediawiki array(
  142.         'Example 1' => array(
  143.             'data' =>
  144. '{| class="table"
  145. |+A Simple Table
  146. |-
  147. ! Col 1 !! Col 2 !! Col 3
  148. |-
  149. | Row1-Col1 || Row1-Col2 || Row1-Col3
  150. |-
  151. | Row2-Col1
  152. | Row2-Col2
  153. | Row2-Col3
  154. |-
  155. | Row3-Col1 || Row3-Col2 || Row3-Col3
  156. |}'
  157.         ),
  158.         'Example 2' => array(
  159.             'data' =>
  160. '{| class="table table-boardered"
  161. |+Multiplication table
  162. |-
  163. ! X !! 1 !! 2 !! 3
  164. |-
  165. ! 1
  166. | 1 || 2 || 3
  167. |-
  168. ! 2
  169. | 2 || 4 || 6
  170. |-
  171. ! 3
  172. | 3 || 6 || 9
  173. |-
  174. ! 4
  175. | 4 || 8 || 12
  176. |-
  177. ! 5
  178. | 5 || 10 || 15
  179. |}'
  180.         ),
  181.         'Example 3' => array(
  182.             'data' =>
  183. '{| class="table table-striped"
  184. |+ Table with alternating rows
  185. |-
  186. | one
  187. | two
  188. |-
  189. | three
  190. | four
  191. |- 
  192. | five
  193. | six
  194. |- 
  195. | seven
  196. | eight
  197. |- class="success"
  198. | colspan="2" | success
  199. |- class="error"
  200. | colspan="2" | error
  201. |- class="warning"
  202. | colspan="2" | warning
  203. |- class="info"
  204. | colspan="2" | info
  205. |}'
  206.         ),
  207.         'Example 4' => array(
  208.             'data' =>
  209. '{| class="table" style="background:yellow;color:green"
  210. |+ Table with many colours
  211. |-
  212. | abc
  213. | colspan="2" style="text-align:center;background:lightblue;" | defghi
  214. |- style="background:red;color:white"
  215. | jkl
  216. | mno
  217. | pqr
  218. |-
  219. | style="font-weight:bold" | stu
  220. | style="background:silver" | vwx
  221. | yz
  222. |}'
  223.         ),
  224.     );
  225.  
  226.     // parse tables
  227.     foreach$mediawiki as $title => $example {
  228.         ifempty$example['result')) {
  229.             $example['format_guid''tikiwiki';
  230.             $mediawiki[$title]['result'LibertyContent::parseData$example );
  231.         }
  232.     }
  233.  
  234.     $examples['tikiwiki'$tikiwiki;
  235.     $examples['mediawiki'$mediawiki;
  236.     $cache->writeCacheFile$cacheFileserialize$examples ));
  237. }
  238. $gBitSmarty->assign'examples'$examples );
  239. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:41 +0000 by phpDocumentor 1.5.0-lsces