This /text/ gets **parsed**.
This /text/ does not get **parsed**.
This /text/ gets **parsed**.
+++ Level 3 Heading
++++ Level 4 Heading
+++++ Level 5 Heading
++++++ Level 6 Heading
+++ Level 3 Heading
++++ Level 4 Heading
+++++ Level 5 Heading
++++++ Level 6 Heading
++ Text Alignment
You can center align paragraphs by using double colons:
::Center aligned text::
::Center aligned text::
++ Table of Contents
To create a list of every heading, with a link to that heading, put a table of contents tag on its own line.
++ Horizontal Rules
Use four dashes (=
* Bullet one
* Sub-bullet
* Bullet one
* Sub-bullet
+++ Numbered Lists
Similarly, you can create numbered lists by starting a paragraph \
with one or more hashes.
# Numero uno
# Number two
# Sub-item
# Numero uno
# Number two
# Sub-item
+++ Mixing Bullet and Number List Items
You can mix and match bullet and number lists:
# Number one
* Bullet
* Bullet
# Number two
* Bullet
* Bullet
* Sub-bullet
# Sub-sub-number
# Sub-sub-number
# Number three
* Bullet
* Bullet
# Number one
* Bullet
* Bullet
# Number two
* Bullet
* Bullet
* Sub-bullet
# Sub-sub-number
# Sub-sub-number
# Number three
* Bullet
* Bullet
+++ Definition Lists
You can create a definition (description) list with the following syntax:
; Item 1 ; Something
; Item 2 ; Something else
; Item 1 ; Something
; Item 2 ; Something else
++ Block Quotes
You can mark a blockquote by starting a line with one or more '>' \
characters, followed by a space and the text to be quoted.
This is normal text here.
> Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
>
> Another block, leading to...
>> Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
This is normal text here.
> Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
>
> Another block, leading to...
>> Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
++ Links and Images
+++ Wiki Links
SmashWordsTogether to create a page link.
You can force a SmashWordsTogether name *not* to be clickable by putting \
an exclamation mark in front of it.
SmashWordsTogether !SmashWordsTogether
SmashWordsTogether !SmashWordsTogether
You can create a "described" or "labeled" link to a wiki page by putting the page name in brackets, followed by some text.
((Wiki/Page)(Descriptive text for the link.))
((Wiki/Page)(Descriptive text for the link.))
+++ Interwiki Links
Interwiki links are links to pages on other Wiki sites. \
Type the =
[[php strtolower]]
[[php strtolower]]
+++ URLs
Create a remote link simply by typing its URL: http://ciaweb.net.
If you like, enclose it in brackets to create a numbered reference \
and avoid cluttering the page; =
((http://www.horde.org)(Horde))
((http://www.horde.org)(Horde))
+++ On-Page Links
Create and anchor on the page by =
[[block horde/Moon phase=next hemisphere=northern]]
[[block horde/Moon phase=next hemisphere=northern]]
+++ Application Links
Links to other Horde applications is supported if those applications support API links. The Wiki itself supports such an API to link to individual wiki pages:
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
++ Code Blocks
Create code blocks by using =...
= tags (each on its own line).
This is an example code block!
To create PHP blocks that get automatically colorized when you use PHP tags, simply surround the code with =...
= tags (the tags themselves should each be on their own lines, and no need for the == tags).
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
API references can be generated using =
name:listUsers
access:public
param:string,Filter users by this string.,'USER'
returns:array
throws:Exception,if user backend not available.
Heading one | Heading two
cell one | cell two
| big ol' line
cell four | cell five
cell six | here's a very long cell
cells are separated by | vertical bars | nothing
| you can span multiple columns by | starting each cell
with extra cell || separators
|| but perhaps an example is the easiest way to see
This //text// gets **parsed**.
``This //text// does not get **parsed**.``
This //text// gets **parsed**.
``This //text// does not get **parsed**.``
++ Headings
You can make various levels of heading by putting \
plus-signs before the text (all on its own line):
+++ Level 3 Heading
++++ Level 4 Heading
+++++ Level 5 Heading
++++++ Level 6 Heading
+++ Level 3 Heading
++++ Level 4 Heading
+++++ Level 5 Heading
++++++ Level 6 Heading
++ Text Alignment
You can center align paragraphs by starting it with an equal sign.
= Center aligned text
= Center aligned text
++ Table of Contents
To create a list of every heading, with a link to that heading, put a table of contents tag on its own line.
[[toc]]
++ Horizontal Rules
Use four dashes ({{``----``}}) to create a horizontal rule.
----
++ Lists
+++ Bullet Lists
You can create bullet lists by starting a paragraph with one or \
more asterisks.
* Bullet one
* Sub-bullet
* Bullet one
* Sub-bullet
+++ Numbered Lists
Similarly, you can create numbered lists by starting a paragraph \
with one or more hashes.
# Numero uno
# Number two
# Sub-item
# Numero uno
# Number two
# Sub-item
+++ Mixing Bullet and Number List Items
You can mix and match bullet and number lists:
# Number one
* Bullet
* Bullet
# Number two
* Bullet
* Bullet
* Sub-bullet
# Sub-sub-number
# Sub-sub-number
# Number three
* Bullet
* Bullet
# Number one
* Bullet
* Bullet
# Number two
* Bullet
* Bullet
* Sub-bullet
# Sub-sub-number
# Sub-sub-number
# Number three
* Bullet
* Bullet
+++ Definition Lists
You can create a definition (description) list with the following syntax:
: Item 1 : Something
: Item 2 : Something else
: Item 1 : Something
: Item 2 : Something else
++ Block Quotes
You can mark a blockquote by starting a line with one or more '>' \
characters, followed by a space and the text to be quoted.
This is normal text here.
> Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
>
> Another block, leading to...
>> Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
This is normal text here.
> Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
>
> Another block, leading to...
>> Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
++ Links and Images
+++ Wiki Links
SmashWordsTogether to create a page link.
You can force a Wiki page name '''not''' to be clickable by putting \
an exclamation mark in front of it.
SmashWordsTogether !SmashWordsTogether
SmashWordsTogether !SmashWordsTogether
You can force a Wiki page to be clickable even if it does '''not''' match the page name format by putting the name in parentheses.
((Wiki/Page))
((Wiki/Page))
You can also use this format to create a "described" or "labeled" link or to add an anchor target.
((Wiki/Page|Descriptive text for the link.#anchor))
((Wiki/Page|Descriptive text for the link.#anchor))
+++ Interwiki Links
Interwiki links are links to pages on other Wiki sites. \
Type the {{``SiteName:PageName``}} like this:
* MeatBall:RecentChanges
* Advogato:proj/WikkiTikkiTavi
* Wiki:WorseIsBetter
+++ PHP Manual Links
PHP manual links are links to the PHP manual on the php.net web site.
[[php strtolower]]
[[php strtolower]]
+++ URLs
Create a remote link simply by typing its URL: http://www.horde.org.
If you like, enclose it in brackets to create a numbered reference \
and avoid cluttering the page; {{``[http://www.horde.org/]``}} becomes [http://www.horde.org/].
Or you can have a described-reference instead of a numbered reference:
[http://www.horde.org Horde]
[http://www.horde.org Horde]
+++ On-Page Links
Create an anchor on the page by {{``[[# anchorName nice anchor text]]``}} [[# anchorName nice anchor text]] and refer to it by {{``#anchorName``}} #anchorName, or {{``[#anchorName use normal link renaming]``}} [#anchorName use normal link renaming].
+++ Images
You can put a picture in a page with {{``[[image foo.jpg]]``}}. You can use any file type, but most browsers only support GIF, JPEG, and PNG formats. The filename can either be a relative reference (in which case the wiki looks for a file attached to the current page - or a different wiki page if the file name is prefixed with a page name, e.g. {{``[[image SomePage:foo.jpg]]``}}), an absolute reference which begins with a slash (in which case the wiki uses it to retrieve a file relative to the web server's root), or a full, external URL.
Additional attributes, such as "alt" can follow the image filename or URL like so: {{``[[image foo.jpg alt="A Foo JPEG"]]``}}. "link" is a special attribute which makes the image a link to the specified URL.
++ Application Content
+++ Application Blocks
Content from other Horde applications provided by portal blocks can be embedded into a page using {{[[block]]}} tags.
To include Horde's moon phases block for example:
[[block horde/Moon phase=next hemisphere=northern]]
[[block horde/Moon phase=next hemisphere=northern]]
+++ Application Links
Links to other Horde applications is supported if those applications support API links. The Wiki itself supports such an API to link to individual wiki pages:
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
++ Code Blocks
Create code blocks by using {{...
}} tags (each on its own line).
This is an example code block!
To create PHP blocks that get automatically colorized when you use PHP tags, simply surround the code with {{...
}} tags (the tags themselves should each be on their own lines, and no need for the {{}} tags).
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
API references can be generated using {{
name:listUsers
access:public
param:string,Filter users by this string.,'USER'
returns:array
throws:Exception,if user backend not available.
//Rendering of this rule is broken as of Text_Wiki 1.2.1, usage is discouraged.//
++ HTML Markup
You can add native HTML markup using {{...}} tags.
HTML
//This rule is disabled by default.//
||~ Heading one ||~ Heading two ||
|| cell one || cell two ||
|||| big ol' line ||
|| cell four || cell five ||
|| cell six || here's a very long cell ||
||~ Heading one ||~ Heading two ||
|| cell one || cell two ||
|||| big ol' line ||
|| cell four || cell five ||
|| cell six || here's a very long cell ||
|| lines must start and end || with double vertical bars || nothing ||
|| cells are separated by || double vertical bars || nothing ||
|||| you can span multiple columns by || starting each cell ||
|| with extra cell |||| separators ||
|||||| but perhaps an example is the easiest way to see ||
|| lines must start and end || with double vertical bars || nothing ||
|| cells are separated by || double vertical bars || nothing ||
|||| you can span multiple columns by || starting each cell ||
|| with extra cell |||| separators ||
|||||| but perhaps an example is the easiest way to see ||
wicked-2.0.8/data/Default/Wiki/Usage 0000664 0001750 0001750 00000000427 13160726737 015301 0 ustar jan jan Browsing the wiki is just like browsing the web. You can edit any page by clicking on the edit button on any page.
((Wiki/AddingPages)) - How to create new pages in the wiki.
((Wiki/TextFormat)) - How to format wiki pages.
((Wiki/SandBox)) - A page you can experiment on.
wicked-2.0.8/data/Default/SmashWordsTogether 0000664 0001750 0001750 00000000112 13160726737 017115 0 ustar jan jan Generic target page. You SmashWordsTogether to indicate a wiki page name. wicked-2.0.8/data/Mediawiki/Wiki/AddingPages 0000664 0001750 0001750 00000000756 13160726737 016727 0 ustar jan jan = Creating New Pages =
You don't have to specifically create nodes. You can just type away and make up a new node name (a string with an initial capital letter, some lower case letters and at least one other capital letter, enclosed in double square brackets). When you view the page again it will be a link. The first time you click on that link, the wiki will automatically create the page and you can edit it.
See [[Wiki/TextFormat]] for information on how to format pages in this wiki.
wicked-2.0.8/data/Mediawiki/Wiki/Home 0000664 0001750 0001750 00000000511 13160726737 015436 0 ustar jan jan = Welcome to the Wiki =
A Wiki is a site where everyone can collaborate on the content. The most well-known and widely used Wiki is the Wikipedia at http://www.wikipedia.org.
You can read about [[Wiki/Usage]] and [[Wiki/AddingPages]]. Currently this Wiki has no theme for discussion, so go ahead and play with it and have fun!
wicked-2.0.8/data/Mediawiki/Wiki/Page 0000664 0001750 0001750 00000000050 13160726737 015420 0 ustar jan jan Generic target page (for example usage). wicked-2.0.8/data/Mediawiki/Wiki/SandBox 0000664 0001750 0001750 00000000426 13160726737 016111 0 ustar jan jan This is the sandbox. You can try out Wiki in here, and no one will care - but don't be rude and delete this explanatory text. '''Stay below the first horizontal rule.'''
For reference, you might want to visit [[Wiki/Usage]], [[Wiki/TextFormat]] or [[Wiki/AddingPages]].
----
wicked-2.0.8/data/Mediawiki/Wiki/TextFormat 0000664 0001750 0001750 00000022640 13160726737 016652 0 ustar jan jan = Sample Page for Wiki Markup =
== General Notes ==
The markup uses the [http://www.mediawiki.org/ Mediawiki] style.
All text is entered as plain text, and will be converted to HTML entities as \
necessary. This means that <, >, &, and so on are converted for \
you (except in special situations where the characters are Wiki markup; \
the Wiki is generally smart enough to know when to convert and when not to).
Just hit "return" twice to make a paragraph break. If you want \
to keep the same logical line but have to split it across \
two physical lines (such as when your editor only shows a certain number \
of characters per line), end the line with a backslash \ and hit \
return once. This will cause the two lines to be joined on display, and the \
backslash will not show. (If you end a line with a backslash and a tab \
or space, it will ''not'' be joined with the next line, and the backslash \
will be printed.)
== Inline Formatting ==
{|
|
This ''text'' gets '''parsed'''.
This ''text'' does not get '''parsed'''.
This ''text'' gets '''parsed'''.
== Headings ==
You can make various levels of heading by putting \
plus-signs before the text (all on its own line):
=== Level 3 Heading ===
==== Level 4 Heading ====
===== Level 5 Heading =====
====== Level 6 Heading ======
=== Level 3 Heading ===
==== Level 4 Heading ====
===== Level 5 Heading =====
====== Level 6 Heading ======
== Table of Contents ==
To create a list of every heading, with a link to that heading, put a table of contents tag on its own line.
[[toc]]
== Horizontal Rules ==
Use four dashes (
* Bullet one
** Sub-bullet
* Bullet one
** Sub-bullet
=== Numbered Lists ===
Similarly, you can create numbered lists by starting a paragraph \
with one or more hashes.
# Numero uno
# Number two
## Sub-item
# Numero uno
# Number two
## Sub-item
=== Mixing Bullet and Number List Items ===
You can mix and match bullet and number lists:
# Number one
** Bullet
** Bullet
# Number two
** Bullet
** Bullet
*** Sub-bullet
#### Sub-sub-number
#### Sub-sub-number
# Number three
** Bullet
** Bullet
# Number one
** Bullet
** Bullet
# Number two
** Bullet
** Bullet
*** Sub-bullet
#### Sub-sub-number
#### Sub-sub-number
# Number three
** Bullet
** Bullet
=== Definition Lists ===
You can create a definition (description) list with the following syntax:
;Item 1
:Something
;Item 2
:Something else
;Item 1
:Something
;Item 2
:Something else
== Block Quotes ==
You can mark a blockquote by starting a line with one or more '>' \
characters, followed by a space and the text to be quoted.
This is normal text here.
: Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
: Another block, leading to...
:: Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
This is normal text here.
: Indent me! The quick brown fox jumps over the lazy dog. \
Now this the time for all good men to come to the aid of \
their country. Notice how we can continue the block-quote \
in the same "paragraph" by using a backslash at the end of \
the line.
: Another block, leading to...
:: Second level of indenting. This second is indented even \
more than the previous one.
Back to normal text.
== Links and Images ==
=== Wiki Links ===
You can create page links by putting the name in brackets.
[[Wiki/Page]]
[[Wiki/Page]]
You can also use this format to create a "described" or "labeled" link or to add an anchor target.
[[Wiki/Page#anchor|Descriptive text for the link.]]
[[Wiki/Page#anchor|Descriptive text for the link.]]
=== URLs ===
Create a remote link simply by typing its URL: http://www.horde.org.
If you like, enclose it in brackets to create a numbered reference \
and avoid cluttering the page;
[http://www.horde.org Horde]
[http://www.horde.org Horde]
=== Images ===
You can put a picture in a page with
[[block horde/Moon phase=next hemisphere=northern]]
[[block horde/Moon phase=next hemisphere=northern]]
=== Application Links ===
Links to other Horde applications is supported if those applications support API links. The Wiki itself supports such an API to link to individual wiki pages:
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
[[link Link to some other wiki page|wiki/show page=Wiki/Page]]
== Code Blocks ==
Create code blocks by using code tags (each on its own line).
This is an example code block!
To create PHP blocks that get automatically colorized when you use PHP tags, simply surround the code with code type="php" tags (the tags themselves should each be on their own lines, and no need for the tags).
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
// Set up the wiki options
$options = array();
$options['view_url'] = "index.php?page=";
// load the text for the requested page
$text = implode('', file($page . '.wiki.txt'));
// create a Wiki objext with the loaded options
$wiki = new Text_Wiki($options);
// transform the wiki text.
echo $wiki->transform($text);
API references can be generated using
name:listUsers
access:public
param:string,Filter users by this string.,'USER'
returns:array
throws:Exception,if user backend not available.
''Rendering of this rule is broken as of Text_Wiki 1.2.1, usage is discouraged.''
== Tables ==
You can create tables using pairs of vertical bars:
{|
! Heading one !! Heading two
|-
| cell one || cell two
|-
| colspan="2" | big ol' line
|-
| cell four || cell five
|-
| cell six || here's a very long cell
|}
{|
! Heading one !! Heading two
|-
| cell one || cell two
|-
| colspan="2" | big ol' line
|-
| cell four || cell five
|-
| cell six || here's a very long cell
|}
{|
| lines must start || with a vertical bar || and a dash
|-
| cells are separated by || double vertical bars || nothing
|-
| or by starting the new
| cell on a new line
| with a vertical bar
|-
| colspan="2" | you can span multiple columns by || starting the cell
|-
| with a colspan || colspan="2" | attribute
|-
| colspan="3" | but perhaps an example is the easiest way to see
|}
{|
| lines must start || with a vertical bar || and a dash
|-
| cells are separated by || double vertical bars || nothing
|-
| or by starting the new
| cell on a new line
| with a vertical bar
|-
| colspan="2" | you can span multiple columns by || starting the cell
|-
| with a colspan || colspan="2" | attribute
|-
| colspan="3" | but perhaps an example is the easiest way to see
|}
wicked-2.0.8/data/Mediawiki/Wiki/Usage 0000664 0001750 0001750 00000000427 13160726737 015620 0 ustar jan jan Browsing the wiki is just like browsing the web. You can edit any page by clicking on the edit button on any page.
[[Wiki/AddingPages]] - How to create new pages in the wiki.
[[Wiki/TextFormat]] - How to format wiki pages.
[[Wiki/SandBox]] - A page you can experiment on.
wicked-2.0.8/data/Tiki/Wiki/AddingPages 0000664 0001750 0001750 00000000750 13160726737 015716 0 ustar jan jan ! Creating New Pages
You don't have to specifically create nodes. You can just type away and make up a new node name (a string with an initial capital letter, some lower case letters and at least one other capital letter, enclosed in double square brackets). When you view the page again it will be a link. The first time you click on that link, the wiki will automatically create the page and you can edit it.
See Wiki/TextFormat for information on how to format pages in this wiki.
wicked-2.0.8/data/Tiki/Wiki/Home 0000664 0001750 0001750 00000000477 13160726737 014446 0 ustar jan jan ! Welcome to the Wiki
A Wiki is a site where everyone can collaborate on the content. The most well-known and widely used Wiki is the Wikipedia at http://www.wikipedia.org.
You can read about Wiki/Usage and Wiki/AddingPages. Currently this Wiki has no theme for discussion, so go ahead and play with it and have fun!
wicked-2.0.8/data/Tiki/Wiki/Page 0000664 0001750 0001750 00000000050 13160726737 014415 0 ustar jan jan Generic target page (for example usage). wicked-2.0.8/data/Tiki/Wiki/SandBox 0000664 0001750 0001750 00000000410 13160726737 015077 0 ustar jan jan This is the sandbox. You can try out Wiki in here, and no one will care - but don't be rude and delete this explanatory text. __Stay below the first horizontal rule.__
For reference, you might want to visit Wiki/Usage, Wiki/TextFormat or Wiki/AddingPages.
----
wicked-2.0.8/data/Tiki/Wiki/TextFormat 0000664 0001750 0001750 00000023036 13160726737 015647 0 ustar jan jan ! Sample Page for Wiki Markup
!! General Notes
The markup uses the [http://tiki.org/|Tiki Wiki] style.
All text is entered as plain text, and will be converted to HTML entities as \
necessary. This means that -+<+-, -+>+-, -+&+-, and so on are converted for \
you (except in special situations where the characters are Wiki markup; \
the Wiki is generally smart enough to know when to convert and when not to).
Just hit "return" twice to make a paragraph break. If you want \
to keep the same logical line but have to split it across \
two physical lines (such as when your editor only shows a certain number \
of characters per line), end the line with a backslash -+\+- and hit \
return once. This will cause the two lines to be joined on display, and the \
backslash will not show. (If you end a line with a backslash and a tab \
or space, it will ''not'' be joined with the next line, and the backslash \
will be printed.)
!! Inline Formatting
|| ~np~''emphasis text''~/np~ | ''emphasis text''
~np~__strong text__~/np~ | __strong text__
~np~''__emphasis and strong__''~/np~ | ''__emphasis and strong__''
~np~===underline text===~/np~ | ===underline text===
~np~-+teletype text+-~/np~ | -+teletype text+-
~np~,,subscript,, text~/np~ | ,,subscript,, text
~np~^^superscript^^ text~/np~ | ^^superscript^^ text
~np~@@--- delete text +++ insert text @@~/np~ | @@--- delete text +++ insert text @@
~np~@@--- delete only @@~/np~ | @@--- delete only @@
~np~@@+++ insert only @@~/np~ | @@+++ insert only @@
~np~~~red:red text~~~/np~ | ~~red:red text~~
~np~~~#FFFF00:yellow text~~~/np~ | ~~#FFFF00:yellow text~~ ||
!! Literal Text
If you don't want the wiki to parse some text, enclose it in ~np~~np~...~/np~~/np~ tags.
{CODE()}
This ''text'' gets __parsed__.
~np~This ''text'' does not get __parsed__.~/np~
{CODE}
This ''text'' gets __parsed__.
~np~This ''text'' does not get __parsed__.~/np~
//Rendering of escaped content is incorrectly wrapped inside tags as of Text_Wiki 1.2.1.// !! Headings You can make various levels of heading by putting \ plus-signs before the text (all on its own line): {CODE()} !!! Level 3 Heading !!!! Level 4 Heading !!!!! Level 5 Heading !!!!!! Level 6 Heading {CODE} !!! Level 3 Heading !!!! Level 4 Heading !!!!! Level 5 Heading !!!!!! Level 6 Heading !! Text Alignment You can center align paragraphs by starting it with an equal sign. {CODE()} ::Center aligned text:: {CODE} ::Center aligned text:: !! Horizontal Rules Use four dashes (-+~np~----~/np~+-) to create a horizontal rule. ---- !! Lists !!! Bullet Lists You can create bullet lists by starting a paragraph with one or \ more asterisks. {CODE()} * Bullet one ** Sub-bullet {CODE} * Bullet one ** Sub-bullet !!! Numbered Lists Similarly, you can create numbered lists by starting a paragraph \ with one or more hashes. {CODE()} # Numero uno # Number two ## Sub-item {CODE} # Numero uno # Number two ## Sub-item !!! Mixing Bullet and Number List Items You can mix and match bullet and number lists: {CODE()} # Number one ** Bullet ** Bullet # Number two ** Bullet ** Bullet *** Sub-bullet #### Sub-sub-number #### Sub-sub-number # Number three ** Bullet ** Bullet {CODE} # Number one ** Bullet ** Bullet # Number two ** Bullet ** Bullet *** Sub-bullet #### Sub-sub-number #### Sub-sub-number # Number three ** Bullet ** Bullet !!! Definition Lists You can create a definition (description) list with the following syntax: {CODE()} ;Item 1:Something ;Item 2:Something else {CODE} ;Item 1:Something ;Item 2:Something else !! Block Quotes You can mark a blockquote by starting a line with one or more '>' \ characters, followed by a space and the text to be quoted. {CODE()} This is normal text here. > Indent me! The quick brown fox jumps over the lazy dog. \ Now this the time for all good men to come to the aid of \ their country. Notice how we can continue the block-quote \ in the same "paragraph" by using a backslash at the end of \ the line. > > Another block, leading to... >> Second level of indenting. This second is indented even \ more than the previous one. Back to normal text. {CODE} This is normal text here. > Indent me! The quick brown fox jumps over the lazy dog. \ Now this the time for all good men to come to the aid of \ their country. Notice how we can continue the block-quote \ in the same "paragraph" by using a backslash at the end of \ the line. > > Another block, leading to... >> Second level of indenting. This second is indented even \ more than the previous one. Back to normal text. !! Links and Images !!! Wiki Links SmashWordsTogether to create a page link. You can force a Wiki page to be clickable even if it does __not__ match the page name format by putting the name in parentheses. {CODE()} ((Wiki/Page)) {CODE} ((Wiki/Page)) You can also use this format to create a "described" or "labeled" link or to add an anchor target. {CODE()} ((Wiki/Page#anchor|Descriptive text for the link.)) {CODE} ((Wiki/Page#anchor|Descriptive text for the link.)) You can alternatively create a "described" or "labeled" link to a wiki page by putting the page name in brackets, followed by some text. {CODE()} [Wiki/Page|Descriptive text for the link.] {CODE} [Wiki/Page|Descriptive text for the link.] !!! URLs Create a remote link simply by typing its URL: http://www.horde.org/. Alternatively enclose it in brackets; -+~np~[http://www.horde.org/]~/np~+- becomes [http://www.horde.org/]. Or you can have a described-reference instead of a numbered reference: {CODE()} [http://www.horde.org|Horde] {CODE} [http://www.horde.org|Horde] !!! On-Page Links Create an anchor on the page by -+~np~[[# anchorName nice anchor text]]~/np~+- [[# anchorName nice anchor text]] and refer to it by -+~np~[#anchorName|use normal link renaming]~/np~+- [#anchorName|use normal link renaming]. !!! Images You can put a picture in a page with -+~np~{img foo.jpg}~/np~+-. You can use any file type, but most browsers only support GIF, JPEG, and PNG formats. The filename can either be a relative reference (in which case the wiki looks for a file attached to the current page - or a different wiki page if the file name is prefixed with a page name, e.g. -+~np~{img SomePage:foo.jpg}~/np~+-), an absolute reference which begins with a slash (in which case the wiki uses it to retrieve a file relative to the web server's root), or a full, external URL. Additional attributes, such as "alt" can follow the image filename or URL like so: -+~np~{img foo.jpg alt="A Foo JPEG"}~/np~+-. "link" is a special attribute which makes the image a link to the specified URL. !! Application Content !!! Application Blocks Content from other Horde applications provided by portal blocks can be embedded into a page using -+[[block]]+- tags. To include Horde's moon phases block for example: {CODE()} [[block horde/Moon phase=next hemisphere=northern]] {CODE} [[block horde/Moon phase=next hemisphere=northern]] !!! Application Links Links to other Horde applications is supported if those applications support API links. The Wiki itself supports such an API to link to individual wiki pages: {CODE()} [[link Link to some other wiki page|wiki/show page=Wiki/Page]] {CODE} [[link Link to some other wiki page|wiki/show page=Wiki/Page]] !! Code Blocks Create code blocks by using -+CODE()+- tags (each on its own line). {CODE()} This is an example code block! {CODE} To create PHP blocks that get automatically colorized when you use PHP tags, simply surround the code with -+CODE(type=php)+- tags (the tags themselves should each be on their own lines, and no need for the -++- tags). {CODE()} {CODE(type=php)} // Set up the wiki options $options = array(); $options['view_url'] = "index.php?page="; // load the text for the requested page $text = implode('', file($page . '.wiki.txt')); // create a Wiki objext with the loaded options $wiki = new Text_Wiki($options); // transform the wiki text. echo $wiki->transform($text); {CODE} {CODE} {CODE(type=php)} // Set up the wiki options $options = array(); $options['view_url'] = "index.php?page="; // load the text for the requested page $text = implode('', file($page . '.wiki.txt')); // create a Wiki objext with the loaded options $wiki = new Text_Wiki($options); // transform the wiki text. echo $wiki->transform($text); {CODE} !! HTML Markup You can add native HTML markup using -+...+- tags. {CODE()}HTML{CODE} ''This rule is disabled by default.''HTML!! Tables You can create tables using pairs of vertical bars: {CODE()} ||~ Heading one |~ Heading two cell one | cell two | big ol' line cell four | cell five cell six | here's a very long cell || {CODE} ||~ Heading one |~ Heading two cell one | cell two | big ol' line cell four | cell five cell six | here's a very long cell || {CODE()} || lines must start and end | with double vertical bars | nothing cells are separated by | single vertical bars | nothing | you can span multiple columns by | starting each cell with extra cell || separators || but perhaps an example is the easiest way to see || {CODE} || lines must start and end | with double vertical bars | nothing cells are separated by | single vertical bars | nothing | you can span multiple columns by | starting each cell with extra cell || separators || but perhaps an example is the easiest way to see || wicked-2.0.8/data/Tiki/Wiki/Usage 0000664 0001750 0001750 00000000413 13160726737 014610 0 ustar jan jan Browsing the wiki is just like browsing the web. You can edit any page by clicking on the edit button on any page. Wiki/AddingPages - How to create new pages in the wiki. Wiki/TextFormat - How to format wiki pages. Wiki/SandBox - A page you can experiment on. wicked-2.0.8/data/Tiki/SmashWordsTogether 0000664 0001750 0001750 00000000112 13160726737 016431 0 ustar jan jan Generic target page. You SmashWordsTogether to indicate a wiki page name. wicked-2.0.8/data/.htaccess 0000664 0001750 0001750 00000000174 13160726737 013620 0 ustar jan janRequire all denied Deny from all wicked-2.0.8/docs/CHANGES 0000600 0001750 0001750 00000023154 13160726737 013025 0 ustar jan jan ------ v2.0.8 ------ [jan] SECURITY: Fix unauthorized access to page attachments. --------- v2.0.8RC1 --------- [jan] Officially support PHP 7. [jan] Bundle Text_Wiki and fix it to run on PHP 7. [mjr] Minor PHP 7 compatibility improvements. ------ v2.0.7 ------ [jan] Update German translation. ------ v2.0.6 ------ [jan] Update Portuguese translation. ------ v2.0.5 ------ [jan] Use access rules compatible with both Apache 2.2 and 2.4. ------ v2.0.4 ------ [jan] Update Italian translation. [jan] Update Brazilian Portuguese translation (Luis Felipe Marzagao). [mjr] Fix fatal error in API due to incorrect access of protected member. [mjr] Fix fatal error in Whups_Api::getMultiplePageInfo due to erroneous include. ------ v2.0.3 ------ [jan] Fix updating annotated links when renaming pages. [jan] Add ReST rendering rule for horizontal rulers. ------ v2.0.2 ------ [jan] Add Swedish translation (Arne Nordmark ). [jan] Add Danish translation (Erling Preben Hansen ). ------ v2.0.1 ------ [jan] Fix rendering of full text search results. [jan] Fix rendering pages in portal blocks. [jan] Improve finding like pages if name contains digits. ------ v2.0.0 ------ [jan] Fix generating the most recent changes. [jan] Request CAPTCHA when creating pages too. --------- v2.0.0RC1 --------- [jan] Add table layout (Bug #12402). [jan] Fix DB column width for page contents (Bug #12407). [mjr] Fix creating a new page from search results (Bug #12381). [jan] Fix syntax error in wicked CLI script (Bug #12378). ----------- v2.0.0beta1 ----------- [jan] Fix parsing of headings in other than the default rule (Bug #12211). [jan] Remove synchronization code. [jan] Convert all templates to Horde_View. [jan] Add Most Popular and Least Popular pages to sidebar selection. [jan] Show at least 10 revisions on the RecentChanges page. [jan] Fix sorting page lists by date. ------ v1.0.2 ------ [jan] Fix accidental deletion of all attachments (Bug #10875). [jan] Fix permission check when merging and renaming pages (Bug #11332). ------ v1.0.1 ------ [gwr] Corrected teletype format for the reST renderer. [gwr] Support rendering lists in the reST renderer. [jan] Add Slovak translation (Martin Matuška ). ---- v1.0 ---- [jan] Fix links to existing pages with non-ascii or special characters (Bug #10672). -------- v1.0-RC1 -------- [jan] Fix rendering attached images with Mediawiki syntax (Bug #10570). [jan] Fix links to add new pages on pages with non-ascii names (Bug #10612). [gwr] Support rendering bold text and code section in the rst renderer. ----------- v1.0-ALPHA1 ----------- [jan] Move all default pages into the Wiki/ namespace (Request #7021). [jan] Support Unicode wiki page names. [gwr] Added support for reStructuredText export. [jan] Add embedding of Horde blocks. [jan] Log attachment downloads. [jan] Replace major and minor versions with single versions (Request #7210). [jan] Add Latvian translation (Jānis Eisaks ). [jan] Provide default configuration files instead of .dist versions. [jan] Require delete permissions for merging/renaming pages. [jan] Don't use WikiWords in menus (Request #7021). [jan] Drop support for coWiki markup. [jan] Fix Oracle SQL scripts. [jan] Implement pessimistic locking based on Horde_Lock. [mjr] Add default lighttpd-style rewrite rules. [jan] Add Brazilian Portuguese translation (Luis Felipe Marzagao ). [cjh] Support arbitrary charsets for page names (Bug #7805). [cjh] Fix saveTemplate API call (Duck , Bug #7620). [jan] Add Italian translation (Fabio Pedretti ). [jan] Add Precedence and Auto-Submitted headers to notification messages. [cjh] Add an API method for fetching recent changes, and allow specifying the number of days to look back in the RecentChanges page (Duck , Request #7230). [jan] Add script to convert data to UTF-8 in the backend. [cjh] Allow downloading from/uploading to a remote wiki server (Duck , Request #7191). [cjh] Add getMultiplePageInfo() and getPageHistory() API calls, along with page checksums (Duck , Request #7189). [cjh] Add Download this page as... link (Duck , Request #7168). [cjh] Add renderPage() API call (duck@obala.net). [cjh] Add list(), getPageInfo(), show(), and pageExists() API calls (Duck , Request #7149). [jan] Add display and edit API methods (Duck , Request #6130). [jan] Add Japanese translation (Takeshi Taguchi ). [cjh] Fix permission checks for non-admins when deleting and reverting (Bug #5806). [cjh] Fix removing the most recent revision with some databases (Bug #5807). [jan] Work around problems with Text_Wiki and PHP 5.2.5+ (Bug #5951). [mms] Compress download data. [jan] Add OpenSearch interface for page search through browser bars. [jan] Add Ukrainian translation (Andriy Kopystyansky ). [cjh] Support mod_rewrite style URLs with Text_Wiki 1.2 (Bug #4740). [jan] Allow to add images from other pages (Request #5448). [cjh] Enforce READ permissions for all page modes (Bug #5328). [jan] Add Slovenian translation (Duck ). [jan] Fix searching for non-ascii strings (Bug #4644). [mms] Add initial CAPTCHA support. [cjh] Fix deletion of the most recent revision. [cjh] Table of Contents is now floated to the right and collapses/expands on click. [jan] Show similar pages before creating a new one. [cjh] Ensure external links attached to images go through Horde::externalUrl() (tasin@fhm.edu, Bug #3151). [cjh] Include matching context in PageSearch results (Request #2485). [cjh] Encode notification emails correctly (tasin@fhm.edu, Bug #3153). [cjh] Don't create pages until they have content (Bug #2534). [cjh] Run all revert actions through a non-JavaScript, POST confirmation page. [cjh] Run all page/version deletion through a non-JavaScript, POST confirmation page. [ben] Better support for MS-SQL. [cjh] Add [[link ...]] syntax for calling $registry->link() in pages (Bug #1474). [cjh] Fix Wiki Page Block when the page being displayed has attachments (Bug #2258). [cjh] Only list standard pages in Wicked's "Back to" history (Bug #2252). [cjh] Delete all attachments to a page when that page is deleted. [cjh] Attachments can now be deleted (Bug #2246). [cjh] Send notification emails when files are attached (Bug #2248). [mas] Include changelogs in emails, if available. (Bug #2068) [cjh] If there is only one search result, go directly to it. [jan] Support type="htmlphp" attribute for code blocks. [cjh] Show a summary of any attachments on a page (Bug #1473). [cjh] Fix updating of attachments (Bug #1579). [cjh] Add a config option to toggle use of pretty URLS with mod_rewrite (Bug #1878). [jan] Support arbitrary charsets for page contents (with Text_Wiki > 1.0.0). [cjh] Require PERMS_EDIT to attach files to a page (tasin@fhm.edu, Bug #1880). [cjh] Send email on MergeOrRename (Bug #916). [cjh] Go to the newly merged or renamed page after MergeOrRename (Bug #916). [cjh] Display the page that was edited after editing instead of going to WikiHome (Bug #1478). [cjh] Require PERMS_EDIT to MergeOrRename a page (Bug #915). [cjh] Use bind variables in SQL driver (selsky@columbia.edu, #1746). [cjh] Multiple-definition guard for separator() (Bug #1710). [jmf] References to special pages in wiki text no longer look deleted. [jmf] Ability to set permissions on special pages. [jmf] Prevent loosing attachments when renaming pages. [jan] Add test page. [jan] Add Finnish translation (Leena Heino ). [jmf] Add command-line script to manipulate wiki pages (Vijay Mahrra ). [jmf] Add "Create" buttons on TitleSearch and PageSearch pages (Vijay Mahrra ). [jmf] Add quick diff link (show changes from last version) when viewing page. [jmf] Add configuration option to require change descriptions. [jan] Notify about page deletions. [jmf] Add support for displaying attached images. [jmf] Add the ability to attach files to pages. [jmf] Add the ability to merge and rename pages. [jan] Add Spanish translation (Manuel Perez Ayala ). [jmf] Implement templates (templates are pages which begin or end with "Template"). [jan] Add Traditional Chinese translation (David Chang ). [jan] Add history drop down list to jump to the last visited pages. [cjh] Add MostPopular and LeastPopular wiki pages. [cjh] Log page views. [cjh] A parameter of autocreate=1 must now be passed to display.php for pages that don't exist to be created automatically. This is done by default for "?" links, but for external incoming links and results of the top left jump box, users will get a form that allows them to confirm creation of the new page. [cjh] Add AllPages Page and Block implementations. [cjh] Wicked now provides Horde_Blocks for doing TitleSearches and viewing RecentChanges. [cjh] TitleSearch now works and is available as a global menu option. [cjh] Add a Preview button in the EditPage screen. [cjh] Move BackLinks and LikePages to the toolbar. [cjh] Store and display changelogs for page revisions. [cjh] In the history view, diffs between page versions work now. [jmf] Add jump box. [jan] Update to work with Text_Wiki 0.8. [cjh] Use Text_Diff for diff generation. [jan] Add Page::allows(). [jan] Add Wicked::mail(). [jan] Add diff and notification support. [jan] Add German translation. [jan] Allow keeping guests from editing and creating pages. [tjc] Initial version. wicked-2.0.8/docs/CREDITS 0000664 0001750 0001750 00000002415 13160726737 013061 0 ustar jan jan ========================= Wicked Development Team ========================= Core Developers =============== - Tyler Colbert - Initial codebase - Chuck Hagenbuch - Jan Schneider Localization ============ ====================== =============================================== Brazilian Portuguese Luis Felipe Marzagao Chinese (Traditional) David Chang Danish Erling Preben Hansen Finnish Leena Heino German Jan Schneider Italian Fabio Pedretti Japanese Takeshi Taguchi Latvian Jānis Eisaks Slovak Martin Matuška Jozef Sudolský Slovenian Duck Spanish Manuel Perez Ayala Juan C. Blanco Swedish Arne Nordmark Ukrainian Andriy Kopystyansky ====================== =============================================== wicked-2.0.8/docs/INSTALL 0000664 0001750 0001750 00000015140 13160726737 013071 0 ustar jan jan ====================== Installing Wicked H5 ====================== :Contact: horde@lists.horde.org .. contents:: Contents .. section-numbering:: This document contains instructions for installing the Wicked Wiki application on your system. For information on the capabilities and features of Wicked, see the file README_ in the top-level directory of the Wicked distribution. Prerequisites ============= To function properly, Wicked **requires** the following: 1. A working Horde installation. Wicked runs within the `Horde Application Framework`_, a set of common tools for web applications written in PHP. You must install Horde before installing Wicked. .. Important:: Wicked H5 requires version 5.0+ of the Horde Framework - earlier versions of Horde will **not** work. .. Important:: Be sure to have completed all of the steps in the `horde/docs/INSTALL`_ file for the Horde Framework before installing Wicked. Many of Wicked's prerequisites are also Horde prerequisites. Additionally, many of Wicked's optional features are configured via the Horde install. .. _`Horde Application Framework`: http://www.horde.org/apps/horde 2. SQL support in PHP. Wicked stores its data in an SQL database. Build PHP with whichever SQL driver you require; see the Horde INSTALL file for details. The following items are not required, but if present will enable advanced features in Wicked: 1. The following PEAR packages: (See `horde/docs/INSTALL`_ for instructions on installing PEAR packages) .. Important:: If you are going to install Wicked the recommended way, i.e. using the PEAR installer, you can skip the remainder of this section. Installing Wicked through PEAR will automatically download and install all required PEAR modules. a. Text_Figlet Text_Figlet can be used to require unauthenticated users to enter a CAPTCHA when updating pages. Installing Wicked ================= The **RECOMMENDED** way to install Wicked is using the PEAR installer. Alternatively, if you want to run the latest development code or get the latest not yet released fixes, you can install Wicked from Git. Installing with PEAR ~~~~~~~~~~~~~~~~~~~~ First follow the instructions in `horde/docs/INSTALL`_ to prepare a PEAR environment for Horde and install the Horde Framework. When installing Wicked through PEAR now, the installer will automatically install any dependencies of Wicked too. If you want to install Wicked with all optional dependencies, but without the binary PECL packages that need to be compiled, specify both the ``-a`` and the ``-B`` flag:: pear install -a -B horde/wicked By default, only the required dependencies will be installed:: pear install horde/wicked If you want to install Wicked even with all binary dependencies, you need to remove the ``-B`` flag. Please note that this might also try to install PHP extensions through PECL that might need further configuration or activation in your PHP configuration:: pear install -a horde/wicked Installing from Git ~~~~~~~~~~~~~~~~~~~ See http://www.horde.org/source/git.php Configuring Wicked ================== 1. Configuring Wicked You must login to Horde as a Horde Administrator to finish the configuration of Wicked. Use the Horde ``Administration`` menu item to get to the administration page, and then click on the ``Configuration`` icon to get the configuration page. Select ``Wiki`` from the selection list of applications. Fill in or change any configuration values as needed. When done click on ``Generate Wiki Configuration`` to generate the ``conf.php`` file. If your web server doesn't have write permissions to the Wicked configuration directory or file, it will not be able to write the file. In this case, go back to ``Configuration`` and choose one of the other methods to create the configuration file ``wicked/config/conf.php``. Documentation on the format and purpose of the other configuration files in the ``config/`` directory can be found in each file. You may create ``*.local.php`` versions of these files if you wish to customize Wicked's appearance and behavior. See the header of the configuration files for details and examples. The defaults will be correct for most sites. 2. Creating the database tables Once you finished the configuration in the previous step, you can create all database tables by clicking the ``DB schema is out of date.`` link in the Wicked row of the configuration screen. Alternatively creating the Wicked database tables can be accomplished with horde's ``horde-db-migrate`` utility. If your database is properly setup in the Horde configuration, just run the following:: horde-db-migrate wicked 3. Testing Wicked Test at least the following: - Modify a page - Create a new page via a WikiLink - Delete a page URL Styles ========== Wicked can use two forms of URLs: mod_rewrite style, or GET style. Your web server must have URL rewriting enabled to use the mod_rewrite style. Apache Servers or Apache Proxy Servers may also need to have AllowEncodedSlashes and/or AcceptPathInfo enabled to use the mod_rewrite style. The GET style URLs should work without any special configuration. Note for users of Lighttpd web server: The rewrite url generation relies on rewrite rules being configured on your web server. Since lighttpd does not support .htaccess files like Apache, there is also a configuration file for lighttpd included that contains the necessary rewrite rules. This file is:: docs/lighttpd-ansel.conf Instructions for using it are included in the file. Obtaining Support ================= If you encounter problems with Wicked, help is available! The Horde Frequently Asked Questions List (FAQ), available on the Web at http://wiki.horde.org/FAQ The Horde Project runs a number of mailing lists, for individual applications and for issues relating to the project as a whole. Information, archives, and subscription information can be found at http://www.horde.org/community/mail Lastly, Horde developers, contributors and users may also be found on IRC, on the channel #horde on the Freenode Network (irc.freenode.net). Please keep in mind that Wicked is free software written by volunteers. For information on reasonable support expectations, please read http://www.horde.org/community/support Thanks for using Wicked! The Wicked team .. _README: README .. _`horde/docs/INSTALL`: ../../horde/docs/INSTALL .. _`horde/docs/TRANSLATIONS`: ../../horde/docs/TRANSLATIONS wicked-2.0.8/docs/lighttpd-wicked.conf 0000664 0001750 0001750 00000002127 13160726737 015773 0 ustar jan jan ## This file should be reviewed prior to inclusion in your lighttpd ## configuration. Specifically, if you have ansel somewhere other than ## /horde/wicked you will need to edit the following rules to match your server ## configuration. ## This file should be included in your lighttpd.conf file with the "include" ## directive. Example: ## include "path/to/lighttpd-wicked.conf" ## The exact path you use will of course depend on your specific configuration. url.rewrite-once += ( "^/horde/wicked/diff\.php.*$" => "$0", "^/horde/wicked/display\.php.*$" => "$0", "^/horde/wicked/history\.php.*$" => "$0", "^/horde/wicked/index.php\.*$" => "$0", "^/horde/wicked/opensearch\.php.*$" => "$0", "^/horde/wicked/preview\.php.*$" => "$0", "^/horde/wicked/test\.php.*$" => "$0", "^/horde/wicked/view\.php.*$" => "$0", "^/horde/wicked/(themes|js)/.*$" => "$0", "^/horde/wicked/([A-Za-z0-9/]+)/?(?:\?(.*))?$" => "/horde/wicked/display.php?page=$1&$2", "^/horde/wicked/([A-Za-z0-9/].*)$" => "/horde/wicked/display.php?page=$1" ) wicked-2.0.8/docs/RELEASE_NOTES 0000664 0001750 0001750 00000001772 13160726737 014021 0 ustar jan jan */ /** * A block to display a Wiki page. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jason Felice */ class Wicked_Block_Page extends Horde_Core_Block { /** */ public function __construct($app, $params = array()) { parent::__construct($app, $params); $this->_name = _("Wiki page"); } /** */ protected function _title() { $page = Wicked_Page::getPage($this->_params['page']); return htmlspecialchars($page->pageName()); } /** */ protected function _content() { $page = Wicked_Page::getPage($this->_params['page']); return $page->render(Wicked::MODE_BLOCK); } /** */ protected function _params() { return array( 'page' => array( 'type' => 'text', 'name' => _("Name of wiki page to display"), 'default' => 'Wiki/Home' ) ); } } wicked-2.0.8/lib/Driver/Sql.php 0000664 0001750 0001750 00000076724 13160726737 014400 0 ustar jan jan * @author Chuck Hagenbuch * @author Jan Schneider * @package Wicked */ /** * Wicked storage implementation for the Horde_Db database abstraction layer. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Tyler Colbert * @author Chuck Hagenbuch * @author Jan Schneider * @package Wicked */ class Wicked_Driver_Sql extends Wicked_Driver { /** * Handle for the current database connection. * * @var Horde_Db_Adapter */ protected $_db; /** * A cached list of all available page names. * * @var array */ protected $_pageNames; /** * Constructor. * * @param array $params A hash containing connection parameters. */ public function __construct($params = array()) { if (!isset($params['db'])) { throw new InvalidArgumentException('Missing db parameter.'); } $this->_db = $params['db']; unset($params['db']); $params = array_merge(array( 'table' => 'wicked_pages', 'historytable' => 'wicked_history', 'attachmenttable' => 'wicked_attachments', 'attachmenthistorytable' => 'wicked_attachment_history' ), $params); parent::__construct($params); } /** * Retrieves the page of a particular name from the database. * * @param string $pagename The name of the page to retrieve. * * @return array * @throws Wicked_Exception */ public function retrieveByName($pagename) { $pages = $this->_retrieve( $this->_params['table'], array('page_name = ?', array($this->_convertToDriver($pagename)))); if (!empty($pages[0])) { return $pages[0]; } throw new Wicked_Exception($pagename . ' not found'); } /** * Retrieves a historic version of a page. * * @param string $pagename The name of the page to retrieve. * @param string $version The version to retrieve. * * @return array The page hash. * @throws Wicked_Exception */ public function retrieveHistory($pagename, $version) { if (!preg_match('/^\d+$/', $version)) { throw new Wicked_Exception('invalid version number'); } return $this->_retrieve( $this->_params['historytable'], array('page_name = ? AND page_version = ?', array($this->_convertToDriver($pagename), (int)$version))); } public function getPageById($id) { return $this->_retrieve($this->_params['table'], array('page_id = ?', array((int)$id))); } public function getAllPages() { return $this->_retrieve($this->_params['table'], '', 'page_name'); } public function getHistory($pagename) { return $this->_retrieve( $this->_params['historytable'], array('page_name = ?', array($this->_convertToDriver($pagename))), 'page_version DESC'); } /** * Returns the most recently changed pages. * * @param integer $days The number of days to look back. * * @return array Pages. * @throws Wicked_Exception */ public function getRecentChanges($days = 3) { $where = array('version_created > ?', array(time() - (86400 * $days))); $result = $this->_retrieve($this->_params['table'], $where, 'version_created DESC'); $result2 = $this->_retrieve($this->_params['historytable'], $where, 'version_created DESC'); return array_merge($result, $result2); } /** * Returns the most recently changed pages. * * @param integer $limit The number of most recent pages to return. * * @return array Pages. * @throws Wicked_Exception */ public function mostRecent($limit = 10) { $result = $this->_retrieve($this->_params['table'], '', 'version_created DESC', $limit); $result2 = $this->_retrieve($this->_params['historytable'], '', 'version_created DESC', $limit); $result = array_merge($result, $result2); usort( $result, function($a, $b) { return $b['version_created'] - $a['version_created']; } ); return array_slice($result, 0, $limit); } /** * Returns the most popular pages. * * @param integer $limit The number of most popular pages to return. * * @return array Pages. * @throws Wicked_Exception */ public function mostPopular($limit = 10) { return $this->_retrieve($this->_params['table'], '', 'page_hits DESC', $limit); } /** * Returns the least popular pages. * * @param integer $limit The number of least popular pages to return. * * @return array Pages. * @throws Wicked_Exception */ public function leastPopular($limit = 10) { return $this->_retrieve($this->_params['table'], '', 'page_hits ASC', $limit); } public function searchTitles($searchtext) { $searchtext = $this->_convertToDriver($searchtext); try { $where = $this->_db->buildClause('page_name', 'LIKE', $searchtext); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } return $this->_retrieve($this->_params['table'], $where); } /** * Finds pages with matches in text or title. * * @param string $searchtext The search expression (Google-like). * @param boolean $title Search both page title and text? * * @return array A list of pages. * @throws Wicked_Exception */ public function searchText($searchtext, $title = true) { $searchtext = $this->_convertToDriver($searchtext); try { $textClause = Horde_Db_SearchParser::parse('page_text', $searchtext); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } if ($title) { try { $nameClause = Horde_Db_SearchParser::parse('page_name', $searchtext); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } $where = '(' . $nameClause . ') OR (' . $textClause . ')'; } else { $where = $textClause; } return $this->_retrieve($this->_params['table'], $where); } public function getBackLinks($pagename) { try { $where = $this->_db->buildClause( 'page_text', 'LIKE', $this->_convertToDriver($pagename)); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } $pages = $this->_retrieve($this->_params['table'], $where); /* We've cast a wide net, so now we filter out pages which don't * actually refer to $pagename. */ /* @todo this should match the current wiki engine's syntax. */ $patterns = array('/\(\(' . preg_quote($pagename, '/') . '(?:\|[^)]+)?\)\)/'); if (preg_match('/^' . Wicked::REGEXP_WIKIWORD . '$/', $pagename)) { $patterns[] = '/\b' . preg_quote($pagename, '/') . '\b/'; } foreach ($pages as $key => $page) { $match = false; foreach ($patterns as $pattern) { if (preg_match($pattern, $page['page_text'])) { $match = true; break; } } if (!$match) { unset($pages[$key]); } } return $pages; } public function getMatchingPages($searchtext, $matchType = Wicked_Page::MATCH_ANY) { $searchtext = strtolower($searchtext); try { /* Short circuit the simple case. */ if ($matchType == Wicked_Page::MATCH_ANY) { return $this->_retrieve( $this->_params['table'], 'LOWER(page_name) LIKE ' . $this->_db->quote('%' . $searchtext . '%')); } $clauses = array(); if ($matchType & Wicked_Page::MATCH_LEFT) { $clauses[] = 'LOWER(page_name) LIKE ' . $this->_db->quote($searchtext . '%'); } if ($matchType & Wicked_Page::MATCH_RIGHT) { $clauses[] = 'LOWER(page_name) LIKE ' . $this->_db->quote('%' . $searchtext); } } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } if (!$clauses) { return array(); } return $this->_retrieve($this->_params['table'], implode(' OR ', $clauses)); } public function getLikePages($pagename) { if (Horde_String::isUpper($pagename, 'UTF-8')) { $firstword = $pagename; $lastword = null; } else { /* Get the first and last word of the page name. */ $count = preg_match_all('/[A-Z][a-z0-9]*/', $pagename, $matches); if (!$count) { return array(); } $matches = $matches[0]; $firstword = $matches[0]; $lastword = $matches[$count - 1]; if (strlen($firstword) == 1 && strlen($matches[1]) == 1) { for ($i = 1; $i < $count; $i++) { $firstword .= $matches[$i]; if (isset($matches[$i + 1]) && strlen($matches[$i + 1]) > 1) { break; } } } if (strlen($lastword) == 1 && strlen($matches[$count - 2]) == 1) { for ($i = $count - 2; $i > 0; $i--) { $lastword = $matches[$i] . $lastword; if (isset($matches[$i - 1]) && strlen($matches[$i - 1]) > 1) { break; } } } } try { $where = $this->_db->buildClause('page_name', 'LIKE', $firstword); if (!empty($lastword) && $lastword != $firstword) { $where .= ' OR ' . $this->_db->buildClause('page_name', 'LIKE', $lastword); } } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } return $this->_retrieve($this->_params['table'], $where); } /** * Retrieves data on files attached to a page. * * @param string $pageId This is the Id of the page for which we'd * like to find attached files. * @param boolean $allversions Whether to include all versions. If false * or omitted, only the most recent version * of each attachment is returned. * @return array An array of key/value arrays describing the attached * files. * @throws Wicked_Exception */ public function getAttachedFiles($pageId, $allversions = false) { $where = array('page_id = ?', array((int)$pageId)); $data = $this->_retrieve($this->_params['attachmenttable'], $where); if ($allversions) { $more_data = $this->_retrieve( $this->_params['attachmenthistorytable'], $where); $data = array_merge($data, $more_data); } foreach (array_keys($data) as $key) { $data[$key]['attachment_name'] = $this->_convertFromDriver($data[$key]['attachment_name']); } usort( $data, function($a, $b) { if ($res = strcmp($a['attachment_name'], $b['attachment_name'])) { return $res; } return ($a['attachment_version'] - $b['attachment_version']); } ); return $data; } /** * Removes a single version or all versions of an attachment from * $pageId. * * @param integer $pageId The Id of the page the file is attached to. * @param string $attachment The name of the file. * @param string $version If specified, the version to delete. If null, * then all versions of $attachment will be * removed. * * @throws Wicked_Exception */ public function removeAttachment($pageId, $attachment, $version = null) { /* Try to delete from the VFS first. */ parent::removeAttachment($pageId, $attachment, $version); /* First try against the current attachments table. */ $sql = 'DELETE FROM ' . $this->_params['attachmenttable'] . ' WHERE page_id = ? AND attachment_name = ?'; $params = array((int)$pageId, $attachment); if (!is_null($version)) { $sql .= ' AND attachment_version = ?'; $params[] = (int)$version; } try { $this->_db->beginDbTransaction(); $result = $this->_db->delete($sql, $params); /* Now try against the attachment history table. $params is * unchanged. */ $sql = 'DELETE FROM ' . $this->_params['attachmenthistorytable'] . ' WHERE page_id = ? AND attachment_name = ?'; if (!is_null($version)) { $sql .= ' AND attachment_version = ?'; } $this->_db->delete($sql, $params); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } /** * Removes all attachments from a page. * * @param integer $pageId A page ID. * * @throws Wicked_Exception */ public function removeAllAttachments($pageId) { /* Try to delete from the VFS first. */ $result = parent::removeAllAttachments($pageId); $params = array((int)$pageId); try { $this->_db->beginDbTransaction(); /* First try against the current attachments table. */ $result = $this->_db->delete( 'DELETE FROM ' . $this->_params['attachmenttable'] . ' WHERE page_id = ?', $params); /* Now try against the attachment history table. $params is * unchanged. */ $this->_db->delete( 'DELETE FROM ' . $this->_params['attachmenthistorytable'] . ' WHERE page_id = ?', $params); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } /** * Handles the driver-specific portion of attaching a file. * * Wicked_Driver::attachFile() calls down to this method for the driver- * specific portion, and then uses VFS to store the attachment. * * @param array $file See Wicked_Driver::attachFile(). * * @return integer The new version of the file attached. * @throws Wicked_Exception */ protected function _attachFile($file) { if ($file['change_author'] === false) { $file['change_author'] = null; } $attachments = $this->_retrieve( $this->_params['attachmenttable'], array('page_id = ? AND attachment_name = ?', array((int)$file['page_id'], $file['attachment_name']))); if ($attachments) { $version = $attachments[0]['attachment_version'] + 1; try { $this->_db->beginDbTransaction(); $this->_db->insert( sprintf('INSERT INTO %s (page_id, attachment_name, attachment_version, attachment_created, change_author, change_log) SELECT page_id, attachment_name, attachment_version, attachment_created, change_author, change_log FROM %s WHERE page_id = ? AND attachment_name = ?', $this->_params['attachmenthistorytable'], $this->_params['attachmenttable']), array((int)$file['page_id'], $file['attachment_name'])); $this->_db->update( sprintf('UPDATE %s SET attachment_version = ?, change_log = ?, change_author = ?, attachment_created = ? WHERE page_id = ? AND attachment_name = ?', $this->_params['attachmenttable']), array((int)$version, $this->_convertToDriver($file['change_log']), $this->_convertToDriver($file['change_author']), time(), (int)$file['page_id'], $this->_convertToDriver($file['attachment_name']))); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } else { $version = 1; try { $this->_db->insert( sprintf('INSERT INTO %s (page_id, attachment_version, change_log, change_author, attachment_created, attachment_name) VALUES (?, 1, ?, ?, ?, ?)', $this->_params['attachmenttable']), array((int)$file['page_id'], $this->_convertToDriver($file['change_log']), $this->_convertToDriver($file['change_author']), time(), $this->_convertToDriver($file['attachment_name']))); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } } return $version; } /** * Logs a page view. * * @param string $pagename The page that was viewed. * * @throws Wicked_Exception */ public function logPageView($pagename) { try { return $this->_db->update( 'UPDATE ' . $this->_params['table'] . ' SET page_hits = page_hits + 1 WHERE page_name = ?', array($this->_convertToDriver($pagename))); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } } /** * Logs an attachment download. * * @param integer $pageid The page with the attachment. * @param string $attachment The attachment name. * * @throws Wicked_Exception */ public function logAttachmentDownload($pageid, $attachment) { try { return $this->_db->update( 'UPDATE ' . $this->_params['attachmenttable'] . ' SET attachment_hits = attachment_hits + 1' . ' WHERE page_id = ? AND attachment_name = ?', array((int)$pageid, $this->_convertToDriver($attachment))); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } } /** * Creates a new page. * * @param string $pagename The new page's name. * @param string $text The new page's text. * * @throws Wicked_Exception */ public function newPage($pagename, $text) { if (!strlen($pagename)) { throw new Wicked_Exception(_("Page name must not be empty")); } if ($GLOBALS['browser']->isRobot()) { throw new Wicked_Exception(_("Robots are not allowed to create pages")); } $author = $GLOBALS['registry']->getAuth(); if ($author === false) { $author = null; } /* Attempt the insertion/update query. */ try { $page_id = $this->_db->insert( 'INSERT INTO ' . $this->_params['table'] . ' (page_name, page_text, version_created, page_version,' . ' page_hits, change_author) VALUES (?, ?, ?, 1, 0, ?)', array($this->_convertToDriver($pagename), $this->_convertToDriver($text), time(), $author)); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } /* Send notification. */ $url = Wicked::url($pagename, true, -1); Wicked::mail("Created page: $url\n\n$text\n", array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] created: ' . $pagename)); /* Call getPages with no caching so that the new list of pages is * read in. */ $this->getPages(true, true); return $page_id; } /** * Renames a page, keeping the page's history. * * @param string $pagename The name of the page to rename. * @param string $newname The page's new name. * * @throws Wicked_Exception */ public function renamePage($pagename, $newname) { try { $this->_db->beginDbTransaction(); $this->_db->update( 'UPDATE ' . $this->_params['table'] . ' SET page_name = ? WHERE page_name = ?', array($this->_convertToDriver($newname), $this->_convertToDriver($pagename))); $this->_db->update( 'UPDATE ' . $this->_params['historytable'] . ' SET page_name = ? WHERE page_name = ?', array($this->_convertToDriver($newname), $this->_convertToDriver($pagename))); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } $changelog = sprintf(_("Renamed page from %s"), $pagename); $newPage = $this->retrieveByName($newname); /* Call getPages with no caching so that the new list of pages is * read in. */ $this->getPages(true, true); return $this->updateText($newname, $newPage['page_text'], $changelog); } public function updateText($pagename, $text, $changelog) { if (!$this->pageExists($pagename)) { return $this->newPage($pagename, $text); } /* Copy the old version into the page history. */ Horde::log('Page ' . $pagename . ' saved with user agent ' . $GLOBALS['browser']->getAgentString(), 'DEBUG'); $author = $GLOBALS['registry']->getAuth(); if ($author === false) { $author = null; } try { $this->_db->beginDbTransaction(); $this->_db->insert( sprintf('INSERT INTO %s (page_id, page_name, page_text, page_version, version_created, change_author, change_log) SELECT page_id, page_name, page_text, page_version, version_created, change_author, change_log FROM %s WHERE page_name = ?', $this->_params['historytable'], $this->_params['table']), array($this->_convertToDriver($pagename))); /* Now move on to updating the record. */ $this->_db->update( 'UPDATE ' . $this->_params['table'] . ' SET change_author = ?, page_text = ?, change_log = ?,' . ' version_created = ?, page_version = page_version + 1' . ' WHERE page_name = ?', array($author, $this->_convertToDriver($text), $this->_convertToDriver($changelog), time(), $this->_convertToDriver($pagename))); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } public function getPages($special = true, $no_cache = false) { if (!isset($this->_pageNames) || $no_cache) { try { $result = $this->_db->selectAssoc( 'SELECT page_id, page_name FROM ' . $this->_params['table']); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } $this->_pageNames = $this->_convertFromDriver($result); } if ($special) { return $this->_pageNames + $this->getSpecialPages(); } return $this->_pageNames; } /** */ public function removeVersion($pagename, $version) { $values = array($this->_convertToDriver($pagename), (int)$version); /* We need to know if we're deleting the current version. */ try { $result = $this->_db->selectValue( 'SELECT 1 FROM ' . $this->_params['table'] . ' WHERE page_name = ? AND page_version = ?', $values); } catch (Horde_Db_Exception $e) { $result = false; } if (!$result) { /* Removing a historical revision - we can just slice it out of the * history table. $values is unchanged. */ try { $this->_db->delete( 'DELETE FROM ' . $this->_params['historytable'] . ' WHERE page_name = ? and page_version = ?', $values); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } return; } /* We're deleting the current version. Have to promote the next-most * revision from the history table. */ try { $query = 'SELECT * FROM ' . $this->_params['historytable'] . ' WHERE page_name = ? ORDER BY page_version DESC'; $query = $this->_db->addLimitOffset($query, array('limit' => 1)); $revision = $this->_db->selectOne( $query, array($this->_convertToDriver($pagename))); /* Replace the current version of the page with the version being * promoted. */ $this->_db->beginDbTransaction(); $this->_db->update( 'UPDATE ' . $this->_params['table'] . ' SET' . ' page_text = ?, page_version = ?,' . ' version_created = ?, change_author = ?, change_log = ?' . ' WHERE page_name = ?', array($revision['page_text'], (int)$revision['page_version'], (int)$revision['version_created'], $revision['change_author'], $revision['change_log'], $this->_convertToDriver($pagename))); /* Finally, remove the version that we promoted from the history * table. */ $this->_db->delete( 'DELETE FROM ' . $this->_params['historytable'] . ' WHERE page_name = ? and page_version = ?', array($this->_convertToDriver($pagename), (int)$revision['page_version'])); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } /** */ public function removeAllVersions($pagename) { /* Remove attachments and do other cleanup. */ parent::removeAllVersions($pagename); $this->_pageNames = null; try { $this->_db->beginDbTransaction(); $this->_db->delete( 'DELETE FROM ' . $this->_params['table'] . ' WHERE page_name = ?', array($this->_convertToDriver($pagename))); $this->_db->delete( 'DELETE FROM ' . $this->_params['historytable'] . ' WHERE page_name = ?', array($this->_convertToDriver($pagename))); $this->_db->commitDbTransaction(); } catch (Horde_Db_Exception $e) { $this->_db->rollbackDbTransaction(); throw new Wicked_Exception($e); } } /** * Retrieves a set of pages matching an SQL WHERE clause. * * @param string $table Table to retrieve pages from. * @param array|string $where Where clause for sql statement (without the * 'WHERE'). If an array the 1st element is the * clause with placeholder, the 2nd element the * values. * @param string $orderBy Order results by this column. * @param integer $limit Maximum number of pages to fetch. * * @return array A list of page hashes. * @throws Wicked_Exception */ protected function _retrieve($table, $where, $orderBy = null, $limit = null) { $query = 'SELECT * FROM ' . $table; $values = array(); if (!empty($where)) { $query .= ' WHERE '; if (is_array($where)) { $query .= $where[0]; $values = $where[1]; } else { $query .= $where; } } if (!empty($orderBy)) { $query .= ' ORDER BY ' . $orderBy; } if (!empty($limit)) { try { $query = $this->_db->addLimitOffset($query, array('limit' => $limit)); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } } try { $result = $this->_db->select($query, $values); } catch (Horde_Db_Exception $e) { throw new Wicked_Exception($e); } $pages = array(); foreach ($result as $row) { if (isset($row['page_name'])) { $row['page_name'] = $this->_convertFromDriver($row['page_name']); } if (isset($row['page_text'])) { $row['page_text'] = $this->_convertFromDriver($row['page_text']); } if (isset($row['change_log'])) { $row['change_log'] = $this->_convertFromDriver($row['change_log']); } $pages[] = $row; } return $pages; } /** * Returns the charset used by the backend. * * @return string The backend's charset */ public function getCharset() { return $this->_db->getOption('charset'); } /** * Converts a value from the driver's charset to the default charset. * * @param mixed $value A value to convert. * * @return mixed The converted value. */ protected function _convertFromDriver($value) { return Horde_String::convertCharset($value, $this->getCharset(), 'UTF-8'); } /** * Converts a value from the default charset to the driver's charset. * * @param mixed $value A value to convert. * * @return mixed The converted value. */ protected function _convertToDriver($value) { return Horde_String::convertCharset($value, 'UTF-8', $this->getCharset()); } } wicked-2.0.8/lib/Factory/Driver.php 0000664 0001750 0001750 00000004461 13160726737 015235 0 ustar jan jan * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @package Wicked */ /** * Wicked_Driver factory. * * @author Jan Schneider * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @package Wicked */ class Wicked_Factory_Driver extends Horde_Core_Factory_Injector { /** * @var array */ private $_instances = array(); /** * Return an Wicked_Driver instance. * * @param Horde_Injector $injector An injector object. * * @return Wicked_Driver A driver instance. * @throws Wicked_Exception */ public function create(Horde_Injector $injector) { $driver = Horde_String::ucfirst($GLOBALS['conf']['storage']['driver']); if (empty($driver)) { throw new Wicked_Exception('Wicked is not configured'); } $signature = serialize(array($driver, $GLOBALS['conf']['storage']['params']['driverconfig'])); if (empty($this->_instances[$signature])) { switch ($driver) { case 'Sql': $params = array('db' => $this->getDb($injector)); break; } $class = 'Wicked_Driver_' . $driver; $this->_instances[$signature] = new $class($params); } return $this->_instances[$signature]; } /** * Returns a Horde_Db instance for the SQL backend. * * @param Horde_Injector $injector An injector object. * * @return Horde_Db_Adapter A correctly configured Horde_Db_Adapter * instance. * @throws Wicked_Exception */ public function getDb(Horde_Injector $injector) { try { if ($GLOBALS['conf']['storage']['params']['driverconfig'] == 'horde') { return $injector->getInstance('Horde_Db_Adapter'); } return $injector->getInstance('Horde_Core_Factory_Db') ->create('wicked', 'storage'); } catch (Horde_Exception $e) { throw new Wicked_Exception($e); } } } wicked-2.0.8/lib/Page/AddPage.php 0000664 0001750 0001750 00000005706 13160726737 014537 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Displays a form to add new pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_AddPage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true ); /** * The page to confirm creation of. * * @var string */ protected $_newpage; /** * Cached search results. * * @var array */ protected $_results; public function __construct($newpage) { $this->_newpage = $newpage; $this->_results = $GLOBALS['wicked']->searchTitles($newpage); } /** * Bail out if there's no page name. */ public function preDisplay() { if (!strlen($this->referrer())) { $GLOBALS['notification']->push(_("Page name must not be empty")); Wicked::url('', true)->redirect(); } } /** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { global $injector, $page_output, $wicked; $view = $injector->createInstance('Horde_View'); $view->action = Wicked::url('NewPage'); $view->formInput = Horde_Util::formInput(); $view->referrer = $this->referrer(); $view->name = $this->pageName(); if ($this->_results) { $page_output->addScriptFile('tables.js', 'horde'); $view->pages = array(); foreach ($this->_results as $page) { if (!empty($page['page_history'])) { $page = new Wicked_Page_StandardHistoryPage($page); } else { $page = new Wicked_Page_StandardPage($page); } $view->pages[] = $page->toView(); } } $view->templates = $wicked->getMatchingPages('Template', Wicked_Page::MATCH_ENDS); $view->help = Horde_Help::link('wicked', 'Templates'); return $view->render('edit/create'); } public function pageName() { return 'AddPage'; } public function pageTitle() { return sprintf(_("Add Page: %s"), $this->referrer()); } public function referrer() { return $this->_newpage; } /** * * * @return string */ public function getText() { // New page, no text to return return ''; } } wicked-2.0.8/lib/Page/AllPages.php 0000664 0001750 0001750 00000003654 13160726737 014742 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Displays a list of all pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_AllPages extends Wicked_Page { /** * Display modes supported by this page. */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_DISPLAY => true); /** * Renders this page in content mode. * * @return string The page content. */ public function content() { return $GLOBALS['wicked']->getAllPages(); } /** * Renders this page in display or block mode. * * @return string The page contents. * @throws Wicked_Exception */ public function displayContents($isBlock) { global $injector, $page_output; $pages = array(); foreach ($this->content() as $page) { $page = new Wicked_Page_StandardPage($page); $pages[] = $page->toView(); } $page_output->addScriptFile('tables.js', 'horde'); $view = $injector->createInstance('Horde_View'); // Show search form and page header. return $view->render('pagelist/header') . $view->renderPartial('pagelist/page', array('collection' => $pages)) . $view->render('pagelist/footer'); } public function pageName() { return 'AllPages'; } public function pageTitle() { return _("All Pages"); } } wicked-2.0.8/lib/Page/AttachedFiles.php 0000664 0001750 0001750 00000023413 13160726737 015745 0 ustar jan jan * @author Jason M. Felice * @package Wicked */ /** * Displays and handles attached files. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Jason M. Felice * @package Wicked */ class Wicked_Page_AttachedFiles extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_EDIT => true, Wicked::MODE_REMOVE => true, Wicked::MODE_DISPLAY => true); /** * The page for which we'd like to manipulate attachments. * * @var string */ protected $_referrer = null; /** * Constructor. */ public function __construct($referrer) { $this->_referrer = $referrer; } /** * Returns the current user's permissions for the referring page. * * @return integer The permissions bitmask. */ public function getPermissions() { return parent::getPermissions($this->referrer()); } /** * Returns this page rendered in content mode. * * @throws Wicked_Exception */ public function content() { global $wicked, $notification, $registry; if (!$wicked->pageExists($this->referrer())) { throw new Wicked_Exception(sprintf(_("Referrer \"%s\" does not exist."), $this->referrer())); } $referrer_id = $wicked->getPageId($this->referrer()); $attachments = $wicked->getAttachedFiles($referrer_id, true); foreach ($attachments as $idx => $attach) { $attachments[$idx]['timestamp'] = $attach['attachment_created']; $attachments[$idx]['date'] = strftime( $GLOBALS['prefs']->getValue('date_format'), $attach['attachment_created'] ); $attachments[$idx]['url'] = $registry->downloadUrl( $attach['attachment_name'], array('page' => $referrer_id, 'file' => $attach['attachment_name'], 'version' => $attach['attachment_version'])); $attachments[$idx]['delete_form'] = $this->allows(Wicked::MODE_REMOVE); $this->_page['change_author'] = $attachments[$idx]['change_author']; $attachments[$idx]['change_author'] = $this->author(); } return $attachments; } /** * Returns this page rendered in Display mode. * * @throws Wicked_Exception */ public function display() { global $registry, $wicked, $notification, $conf; try { $attachments = $this->content(); } catch (Wicked_Exception $e) { $notification->push(sprintf(_("Error retrieving attachments: %s"), $e->getMessage()), 'horde.error'); throw $e; } $GLOBALS['page_output']->addScriptFile('tables.js', 'horde'); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->pageName = $this->pageName(); $view->formAction = Wicked::url('AttachedFiles'); $view->deleteButton = Horde_Themes::img('delete.png'); $view->referrerLink = Wicked::url($this->referrer()); $refreshIcon = Horde::link($this->pageUrl()) . Horde::img('reload.png', sprintf(_("Reload \"%s\""), $this->pageTitle())) . ''; $view->refreshIcon = $refreshIcon; $view->attachments = $attachments; /* Get an array of unique filenames for the update form. */ $files = array(); foreach ($attachments as $attachment) { $files[$attachment['attachment_name']] = true; } $files = array_keys($files); sort($files); $view->files = $files; $view->canUpdate = $this->allows(Wicked::MODE_EDIT) && count($files); $view->canAttach = $this->allows(Wicked::MODE_EDIT); $view->requireChangelog = $conf['wicked']['require_change_log']; $view->requiredMarker = Horde::img('required.png', '*'); $view->referrer = $this->referrer(); $view->formInput = Horde_Util::formInput(); echo $view->render('display/AttachedFiles'); } public function pageName() { return 'AttachedFiles'; } public function pageTitle() { return sprintf(_("Attached Files: %s"), $this->referrer()); } public function referrer() { return $this->_referrer; } /** * Retrieves the form fields and processes the attachment. */ public function handleAction() { global $notification, $wicked, $registry, $conf; // Only allow POST commands. $cmd = Horde_Util::getPost('cmd'); $version = Horde_Util::getFormData('version'); $is_update = (bool)Horde_Util::getFormData('is_update'); $filename = Horde_Util::getFormData('filename'); $change_log = Horde_Util::getFormData('change_log'); // See if we're supposed to delete an attachment. if ($cmd == 'delete' && $filename && $version) { if (!$this->allows(Wicked::MODE_REMOVE)) { $notification->push(_("You do not have permission to delete attachments from this page."), 'horde.error'); return; } try { $wicked->removeAttachment($wicked->getPageId($this->referrer()), $filename, $version); $notification->push( sprintf(_("Successfully deleted version %s of \"%s\" from \"%s\""), $version, $filename, $this->referrer()), 'horde.success'); } catch (Wicked_Exception $e) { $notification->push($result->getMessage(), 'horde.error'); } return; } if (empty($filename)) { $filename = Horde_Util::dispelMagicQuotes($_FILES['attachment_file']['name']); } try { $GLOBALS['browser']->wasFileUploaded('attachment_file', _("attachment")); } catch (Horde_Browser_Exception $e) { $notification->push($e, 'horde.error'); return; } if (strpos($filename, ' ') !== false) { $notification->push( _("Attachments with spaces can't be embedded into a page."), 'horde.warning'); } $data = file_get_contents($_FILES['attachment_file']['tmp_name']); if ($data === false) { $notification->push(_("Can't read uploaded file."), 'horde.error'); return; } if (!$this->allows(Wicked::MODE_EDIT)) { $notification->push( sprintf(_("You do not have permission to edit \"%s\""), $this->referrer()), 'horde.error'); return; } if ($conf['wicked']['require_change_log'] && empty($change_log)) { $notification->push( _("You must enter a change description to attach this file."), 'horde.error'); return; } $referrer_id = $wicked->getPageId($this->referrer()); try { $attachments = $wicked->getAttachedFiles($referrer_id); } catch (Wicked_Exception $e) { $notification->push(sprintf(_("Error retrieving attachments: %s"), $e->getMessage()), 'horde.error'); return; } $found = false; foreach ($attachments as $attach) { if ($filename == $attach['attachment_name']) { $found = true; break; } } if ($is_update) { if (!$found) { $notification->push( sprintf(_("Can't update \"%s\": no such attachment."), $filename), 'horde.error'); return; } } else { if ($found) { $notification->push( sprintf(_("There is already an attachment named \"%s\"."), $filename), 'horde.error'); return; } } $file = array('page_id' => $referrer_id, 'attachment_name' => $filename, 'change_log' => $change_log); try { $wicked->attachFile($file, $data); } catch (Wicked_Exception $e) { $notification->push($e); Horde::log($e); throw $e; } if ($is_update) { $message = sprintf(_("Updated attachment \"%s\" on page \"%s\"."), $filename, $this->referrer()); } else { $message = sprintf(_("New attachment \"%s\" to page \"%s\"."), $filename, $this->referrer()); } $notification->push($message, 'horde.success'); $url = Wicked::url($this->referrer(), true, -1); Wicked::mail($message . ' ' . _("View page: ") . $url . "\n", array('Subject' => '[' . $registry->get('name') . '] attachment: ' . $this->referrer() . ', ' . $filename)); } } wicked-2.0.8/lib/Page/BackLinks.php 0000664 0001750 0001750 00000004326 13160726737 015110 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Display page backlinks * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_BackLinks extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true); /** * The page that we're displaying backlinks to. * * @var string */ protected $_referrer = null; public function __construct($referrer) { $this->_referrer = $referrer; } /** * Renders this page in display or block mode. * * @return string The contents. * @throws Wicked_Exception */ public function displayContents($isBlock) { global $injector, $page_output, $wicked; $page_output->addScriptFile('tables.js', 'horde'); $view = $injector->createInstance('Horde_View'); $content = $view->render('pagelist/header'); $summaries = $wicked->getBackLinks($this->_referrer); foreach ($summaries as $page) { if (!empty($page['page_history'])) { $page = new Wicked_Page_StandardHistoryPage($page); } else { $page = new Wicked_Page_StandardPage($page); } $content .= $view->renderPartial( 'pagelist/page', array('object' => $page->toView()) ); } return $content . $view->render('pagelist/footer'); } public function pageName() { return 'BackLinks'; } public function pageTitle() { return sprintf(_("Backlinks: %s"), $this->referrer()); } public function referrer() { return $this->_referrer; } } wicked-2.0.8/lib/Page/DeletePage.php 0000664 0001750 0001750 00000011345 13160726737 015245 0 ustar jan jan * @author Chuck Hagenbuch * @package Wicked */ /** * Displays a confirmation form for deleting pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Chuck Hagenbuch * @package Wicked */ class Wicked_Page_DeletePage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array(Wicked::MODE_DISPLAY => true); /** * The page that we're confirming deletion for. * * @var string */ protected $_referrer = null; public function __construct($referrer) { $this->_referrer = $referrer; } /** * Retrieve this user's permissions for the referring page. * * @return integer The permissions bitmask. */ public function getPermissions() { return parent::getPermissions($this->referrer()); } /** * Send them back whence they came if they aren't allowed to * delete this page. */ public function preDisplay() { $page = Wicked_Page::getPage($this->referrer()); if (!$page->allows(Wicked::MODE_REMOVE)) { Wicked::url($this->referrer(), true)->redirect(); } } /** * Render this page in Display mode. * * @throws Wicked_Exception */ public function display() { $version = Horde_Util::getFormData('version'); $page = Wicked_Page::getPage($this->referrer(), $version); if (!$page->isValid()) { Wicked::url('Wiki/Home', true)->redirect(); } if (empty($version)) { $msg = _("Are you sure you want to delete this page? All versions will be permanently removed."); } else { $msg = sprintf(_("Are you sure you want to delete version %s of this page?"), $page->version()); } ?> _referrer; } public function handleAction() { $pagename = $this->referrer(); $page = Wicked_Page::getPage($pagename); if ($page->allows(Wicked::MODE_REMOVE)) { $version = Horde_Util::getFormData('version'); if (empty($version)) { $GLOBALS['wicked']->removeAllVersions($pagename); $GLOBALS['notification']->push(sprintf(_("Successfully deleted \"%s\"."), $pagename), 'horde.success'); Wicked::mail("Deleted page: $pagename\n", array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] deleted: ' . $pagename)); Wicked::url('Wiki/Home', true)->redirect(); } $GLOBALS['wicked']->removeVersion($pagename, $version); $GLOBALS['notification']->push(sprintf(_("Deleted version %s of \"%s\"."), $version, $pagename), 'horde.success'); Wicked::mail("Deleted version: $version of $pagename\n", array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] deleted: ' . $pagename . ' [' . $version . ']')); Wicked::url($pagename, true)->redirect(); } $GLOBALS['notification']->push(sprintf(_("You don't have permission to delete \"%s\"."), $pagename), 'horde.warning'); Wicked::url($this->referrer(), true)->redirect(); } } wicked-2.0.8/lib/Page/EditPage.php 0000664 0001750 0001750 00000016006 13160726737 014727 0 ustar jan jan * @author Jason M. Felice * @package Wicked */ /** * Displays and handles the form to edit pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Jason M. Felice * @package Wicked */ class Wicked_Page_EditPage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true, Wicked::MODE_EDIT => true); /** * The page that we're editing. * * @var string */ protected $_referrer = null; public function __construct($referrer) { $this->_referrer = $referrer; if ($GLOBALS['conf']['lock']['driver'] != 'none') { $this->supportedModes[Wicked::MODE_LOCKING] = $this->supportedModes[Wicked::MODE_UNLOCKING] = true; } } /** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { if ($mode == Wicked::MODE_EDIT) { $page = Wicked_Page::getPage($this->referrer()); if ($page->isLocked(Wicked::lockUser())) { return false; } } return parent::allows($mode); } /** * Retrieve this user's permissions for the referring page. * * @param string $pageName The page name (unused in this method). * * @return integer The permissions bitmask. */ public function getPermissions($pageName = null) { return parent::getPermissions($this->referrer()); } /** * Send them back whence they came if they aren't allowed to edit * this page. */ public function preDisplay() { if (!$this->allows(Wicked::MODE_EDIT)) { Wicked::url($this->referrer(), true)->redirect(); } if ($this->allows(Wicked::MODE_LOCKING)) { $page = Wicked_Page::getPage($this->referrer()); if ($page->isLocked()) { $page->unlock(); } try { $page->lock(); } catch (Wicked_Exception $e) { $GLOBALS['notification']->push(sprintf(_("Page failed to lock: %s"), $e->getMessage()), 'horde.error'); } } } /** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $GLOBALS['page_output']->addScriptFile('edit.js'); $GLOBALS['injector']->getInstance('Horde_View_Topbar')->subinfo = sprintf( _("Last Modified %s by %s"), $this->formatVersionCreated(), $this->author() ); $page = Wicked_Page::getPage($this->referrer()); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->action = Wicked::url('EditPage'); $view->formInput = Horde_Util::formInput(); $view->name = $page->pageName(); $view->header = $page->pageUrl()->link() . htmlspecialchars($page->pageName()) . ' '; if ($page->isLocked()) { $view->header .= ' ' . Horde::img('locked.png', _("Locked")); } $view->cancel = $page->pageUrl() ->add('actionID', 'unlock') ->link(array('class' => 'horde-cancel')) . _("Cancel") . ''; if (!empty($GLOBALS['conf']['wicked']['require_change_log'])) { $view->changelogRequired = Horde::img( 'required.png', _("Changelog is required") ); } if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) { $figlet = new Text_Figlet(); Horde_Exception_Pear::catchError($figlet->loadFont( $GLOBALS['conf']['wicked']['figlet_font'] )); $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true)); } $view->text = Horde_Util::getFormData('page_text'); if (is_null($view->text)) { $view->text = $page->getText(); } return $view->render('edit/standard'); } public function pageName() { return 'EditPage'; } public function pageTitle() { return _("Edit Page"); } public function referrer() { return $this->_referrer; } public function isLocked() { $page = Wicked_Page::getPage($this->referrer()); return $page->isLocked(); } public function getLockRequestor() { $page = Wicked_Page::getPage($this->referrer()); return $page->getLockRequestor(); } public function getLockTime() { $page = Wicked_Page::getPage($this->referrer()); return $page->getLockTime(); } public function handleAction() { global $notification, $conf; $page = Wicked_Page::getPage($this->referrer()); if (!$this->allows(Wicked::MODE_EDIT)) { $notification->push(sprintf(_("You don't have permission to edit \"%s\"."), $page->pageName())); } else { if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth() && (Horde_String::lower(Horde_Util::getFormData('wicked_captcha')) != Horde_String::lower(Wicked::getCAPTCHA()))) { $notification->push(_("Random string did not match."), 'horde.error'); return; } $text = Horde_Util::getFormData('page_text'); $changelog = Horde_Util::getFormData('changelog'); if ($conf['wicked']['require_change_log'] && empty($changelog)) { $notification->push(_("You must provide a change log."), 'horde.error'); $GLOBALS['page_output']->addInlineScript(array( 'if (document.editform && document.editform.changelog) document.editform.changelog.focus()' ), true); return; } if (trim($text) == trim($page->getText())) { $notification->push(_("No changes made"), 'horde.warning'); } else { $page->updateText($text, $changelog); $notification->push(_("Page Saved"), 'horde.success'); } if ($page->allows(Wicked::MODE_UNLOCKING)) { $page->unlock(); } } // Show the newly saved page. Wicked::url($this->referrer(), true)->redirect(); } } wicked-2.0.8/lib/Page/LeastPopular.php 0000664 0001750 0001750 00000004163 13160726737 015661 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Lists the least popular pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_LeastPopular extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_DISPLAY => true); /** * Renders this page in content mode. * * @param integer $numPages How many (at most) pages should we return? * * @return string The page contents. */ public function content($numPages = 10) { return $GLOBALS['wicked']->leastPopular($numPages); } /** * Renders this page in display or block mode. * * @return string The content. * @throws Wicked_Exception */ public function displayContents($isBlock) { global $injector, $page_output; $pages = array(); foreach ($this->content(10) as $page) { $page = new Wicked_Page_StandardPage($page); $object = $page->toView(); $object->hits = $page->hits(); $pages[] = $object; } $page_output->addScriptFile('tables.js', 'horde'); $view = $injector->createInstance('Horde_View'); $view->hits = true; return $view->render('pagelist/header') . $view->renderPartial('pagelist/page', array('collection' => $pages)) . $view->render('pagelist/footer'); } public function pageName() { return 'LeastPopular'; } public function pageTitle() { return _("Least Popular"); } } wicked-2.0.8/lib/Page/LikePages.php 0000664 0001750 0001750 00000004334 13160726737 015112 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * List similar pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_LikePages extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true); /** * The page that we're displaying similar pages to. * * @var string */ protected $_referrer = null; public function __construct($referrer) { $this->_referrer = $referrer; } /** * Renders this page in display or block mode. * * @return string The contents. * @throws Wicked_Exception */ public function displayContents($isBlock) { global $injector, $page_output, $wicked; $page_output->addScriptFile('tables.js', 'horde'); $view = $injector->createInstance('Horde_View'); $content = $view->render('pagelist/header'); $summaries = $wicked->getLikePages($this->referrer()); foreach ($summaries as $page) { if (!empty($page['page_history'])) { $page = new Wicked_Page_StandardHistoryPage($page); } else { $page = new Wicked_Page_StandardPage($page); } $content .= $view->renderPartial( 'pagelist/page', array('object' => $page->toView()) ); } return $content . $view->render('pagelist/footer'); } public function pageName() { return 'LikePages'; } public function pageTitle() { return sprintf(_("Similar Pages: %s"), $this->referrer()); } public function referrer() { return $this->_referrer; } } wicked-2.0.8/lib/Page/MergeOrRename.php 0000664 0001750 0001750 00000022712 13160726737 015736 0 ustar jan jan * @author Jason M. Felice * @package Wicked */ /** * Special page for merging or renaming pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Jason M. Felice * @package Wicked */ class Wicked_Page_MergeOrRename extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_EDIT => true, Wicked::MODE_REMOVE => true, Wicked::MODE_DISPLAY => true); /** * The page that we're displaying similar pages to. * * @var string */ protected $_referrer = null; /** * Validation errors. * * @var string */ protected $_errors = array(); public function __construct($referrer) { $this->_referrer = $referrer; } /** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { if ($mode == Wicked::MODE_EDIT) { if (!parent::allows(Wicked::MODE_REMOVE)) { return false; } $page = Wicked_Page::getPage($this->referrer()); if ($page->isLocked(Wicked::lockUser())) { return false; } } return parent::allows($mode); } /** * Retrieve this user's permissions for the referring page. * * @return integer The permissions bitmask. */ public function getPermissions() { return parent::getPermissions($this->referrer()); } /** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { global $wicked, $registry, $notification; $referrer = $this->referrer(); $callback = function($string) { return '=' . str_pad(dechex(ord($string[1])), 2, '0', STR_PAD_LEFT); }; $references = $wicked->getBackLinks($referrer); foreach ($references as $key => $page) { $references[$key]['page_url'] = Wicked::url($page['page_name']); $references[$key]['page_name'] = $page['page_name']; // Since the page name can have [ and ] and other special // characters in it, and we don't want the browser or PHP decoding // it, we encode it in quoted printable for the checkbox names. $references[$key]['checkbox'] = preg_replace_callback( '/([^a-zA-Z_0-9 ])/', $callback, $page['page_name'] ); } // Propogate any validation errors. foreach (array('new_name', 'collision') as $elt) { if (!isset($this->_errors[$elt])) { $this->_errors[$elt] = ''; } } $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->pageName = 'MergeOrRename'; $view->formAction = Wicked::url('MergeOrRename'); $view->referrer = $referrer; $view->referrerLink = Wicked::url($referrer); $view->requiredMarker = Horde::img('required.png', '*'); $view->references = $references; $view->referenceCount = sprintf(_("This page is referenced from %d other page(s)."), count($references)); $view->formInput = Horde_Util::formInput(); $view->errors = $this->_errors; $view->new_name = Horde_Util::getFormData('new_name', $referrer); echo $view->render('display/MergeOrRename'); } public function pageName() { return 'MergeOrRename'; } public function pageTitle() { return sprintf(_("Merge/Rename: %s"), $this->referrer()); } public function referrer() { return $this->_referrer; } /** * Retrieve the form fields and process the merge or rename. */ public function handleAction() { global $wicked, $notification, $registry; if (Horde_Util::getFormData('submit') == _("Cancel")) { Wicked::url($this->referrer(), true)->redirect(); } $referrer = $this->referrer(); $new_name = Horde_Util::getFormData('new_name'); if (empty($new_name)) { $this->_errors['new_name'] = _("This is a required field."); } elseif ($new_name == $referrer) { $this->_errors['new_name'] = _("New name is the same as old name."); } $collision = Horde_Util::getFormData('collision'); if (empty($collision)) { $this->_errors['collision'] = _("This is a required field."); } if (count($this->_errors)) { return; } $sourcePage = Wicked_Page::getPage($referrer); if (!$this->allows(Wicked::MODE_EDIT)) { throw new Wicked_Exception(sprintf(_("You do not have permission to edit \"%s\""), $referrer)); } $destPage = Wicked_Page::getPage($new_name); if (!($destPage instanceof Wicked_Page_AddPage)) { // Destination page exists. if ($collision != 'merge') { // We don't want to overwrite. throw new Wicked_Exception(sprintf(_("Page \"%s\" already exists."), $new_name)); } if (!$destPage->allows(Wicked::MODE_EDIT)) { throw new Wicked_Exception(sprintf(_("You do not have permission to edit \"%s\""), $new_name)); } // Merge the two pages. $newText = $destPage->getText() . "\n----\n" . $sourcePage->getText(); $changelog = sprintf(_("Merged from %s"), $referrer); $wicked->updateText($new_name, $newText, $changelog); $wicked->removeAllVersions($referrer); $notification->push(sprintf(_("Merged \"%s\" into \"%s\"."), $referrer, $new_name), 'horde.success'); $url = Wicked::url($new_name, true, -1); $message = sprintf(_("Merged \"%s\" into \"%s\". New page: %s\n"), $referrer, $new_name, $url); Wicked::mail($message, array( 'Subject' => '[' . $registry->get('name') . '] merged: ' . $referrer . ', ' . $new_name)); } else { // Rename the page. $wicked->renamePage($referrer, $new_name); $notification->push(sprintf(_("Renamed \"%s\" to \"%s\"."), $referrer, $new_name), 'horde.success'); $url = Wicked::url($new_name, true, -1); $message = sprintf(_("Renamed \"%s\" to \"%s\". New page: %s\n"), $referrer, $new_name, $url); Wicked::mail($message, array( 'Subject' => '[' . $registry->get('name') . '] renamed: ' . $referrer . ', ' . $new_name)); } // We don't check permissions on these pages since we want references // to be fixed even if the user doing the editing couldn't fix that // page, and fixing references is likely to never be a destructive // action, and the user can't supply their own data for it. $references = Horde_Util::getFormData('ref', array()); if ($references) { $wikiWord = '/^' . Wicked::REGEXP_WIKIWORD . '$/'; $changelog = sprintf(_("Changed references from %s to %s"), $referrer, $new_name); // Links like ((Foobar|Description Text)) $from = array('/\(\(' . preg_quote($referrer, '/') . '(\|[^)]*?)\)\)/'); $to = array('((' . $new_name . '$1))'); // Links like ((Foobar)) if (preg_match($wikiWord, $new_name)) { $replaceWith = $new_name; } else { $replaceWith = '((' . $new_name . '))'; } $from[] = '/\(\(' . preg_quote($referrer, '/') . '\)\)/'; $to[] = $replaceWith; // Links like FooBar if (preg_match($wikiWord, $referrer)) { $from[] = '/\b' . preg_quote($referrer, '/') . '\b/'; $to[] = $replaceWith; } foreach (array_keys($references) as $name) { $page_name = quoted_printable_decode($name); // Fix up for self-references. if ($page_name == $referrer) { $page_name = $new_name; } try { $refPage = $wicked->retrieveByName($page_name); } catch (Wicked_Exception $e) { $notification->push(sprintf(_("Error retrieving %s: %s"), $page_name, $e->getMessage()), 'horde.error'); continue; } $newText = preg_replace($from, $to, $refPage['page_text']); $wicked->updateText($page_name, $newText, $changelog); } } Wicked::url($new_name, true)->redirect(); } } wicked-2.0.8/lib/Page/MostPopular.php 0000664 0001750 0001750 00000004155 13160726737 015534 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Lists the most popular pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_MostPopular extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_DISPLAY => true); /** * Renders this page in content mode. * * @param integer $numPages How many (at most) pages should we return? * * @return string The page content. */ public function content($numPages = 10) { return $GLOBALS['wicked']->mostPopular($numPages); } /** * Renders this page in display or block mode. * * @return string The content. * @throws Wicked_Exception */ public function displayContents($isBlock) { global $injector, $page_output; $pages = array(); foreach ($this->content(10) as $page) { $page = new Wicked_Page_StandardPage($page); $object = $page->toView(); $object->hits = $page->hits(); $pages[] = $object; } $page_output->addScriptFile('tables.js', 'horde'); $view = $injector->createInstance('Horde_View'); $view->hits = true; return $view->render('pagelist/header') . $view->renderPartial('pagelist/page', array('collection' => $pages)) . $view->render('pagelist/footer'); } public function pageName() { return 'MostPopular'; } public function pageTitle() { return _("Most Popular"); } } wicked-2.0.8/lib/Page/NewPage.php 0000664 0001750 0001750 00000010513 13160726737 014570 0 ustar jan jan * @author Chuck Hagenbuch * @package Wicked */ /** * Adds a new page to the backend. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Chuck Hagenbuch * @package Wicked */ class Wicked_Page_NewPage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true, Wicked::MODE_EDIT => true); /** * The page that we're creating. * * @var string */ protected $_referrer = null; /** * Page template to use. * * @var string */ protected $_template = null; public function __construct($referrer) { $this->_referrer = $referrer; $this->_template = Horde_Util::getFormData('template'); } /** * Retrieve this user's permissions for the referring page. * * @return integer The permissions bitmask. */ public function getPermissions() { return parent::getPermissions($this->referrer()); } /** * Send them back whence they came if they aren't allowed to edit * this page. */ public function preDisplay() { if (!strlen($this->referrer())) { $GLOBALS['notification']->push(_("Page name must not be empty")); Wicked::url('', true)->redirect(); } if (!$this->allows(Wicked::MODE_EDIT)) { Wicked::url($this->referrer(), true)->redirect(); } } /** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $GLOBALS['page_output']->addScriptFile('edit.js'); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->action = Wicked::url('NewPage'); $view->formInput = Horde_Util::formInput(); $view->referrer = $this->referrer(); if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) { $figlet = new Text_Figlet(); Horde_Exception_Pear::catchError($figlet->loadFont( $GLOBALS['conf']['wicked']['figlet_font'] )); $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true)); } if ($this->_template) { $view->text = Wicked_Page::getPage($this->_template)->getText(); } return $view->render('edit/new'); } public function pageName() { return 'NewPage'; } public function pageTitle() { return _("New Page"); } public function referrer() { return $this->_referrer; } public function handleAction() { global $notification, $wicked; if (!$this->allows(Wicked::MODE_EDIT)) { $notification->push(sprintf(_("You don't have permission to create \"%s\"."), $this->referrer())); } else { if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth() && (Horde_String::lower(Horde_Util::getFormData('wicked_captcha')) != Horde_String::lower(Wicked::getCAPTCHA()))) { $notification->push(_("Random string did not match."), 'horde.error'); return; } $text = Horde_Util::getPost('page_text'); if (empty($text)) { $notification->push(_("Pages cannot be empty."), 'horde.error'); return; } try { $result = $wicked->newPage($this->referrer(), $text); $notification->push(_("Page Created"), 'horde.success'); } catch (Wicked_Exception $e) { $notification->push(sprintf(_("Create Failed: %s"), $e->getMessage()), 'horde.error'); } } // Show the newly created page. Wicked::url($this->referrer(), true)->redirect(); } } wicked-2.0.8/lib/Page/RecentChanges.php 0000664 0001750 0001750 00000007514 13160726737 015762 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Lists the most recently changed pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_RecentChanges extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_DISPLAY => true ); /** * Renders this page in content mode. * * @return string The page content. * @throws Wicked_Exception */ public function content() { global $wicked; $days = (int)Horde_Util::getGet('days', 3); $summaries = $wicked->getRecentChanges($days); if (count($summaries) < 10) { $summaries = $wicked->mostRecent(10); } $bydate = array(); $changes = array(); foreach ($summaries as $page) { $page = new Wicked_Page_StandardPage($page); $createDate = $page->versionCreated(); $tm = localtime($createDate, true); $createDate = mktime(0, 0, 0, $tm['tm_mon'], $tm['tm_mday'], $tm['tm_year'], $tm['tm_isdst']); $version_url = $page->pageUrl()->add('version', $page->version()); $diff_url = Horde::url('diff.php')->add(array( 'page' => $page->pageName(), 'v1' => '?', 'v2' => $page->version() )); $diff_alt = sprintf(_("Show changes for %s"), $page->version()); $diff_img = Horde::img('diff.png', $diff_alt); $pageInfo = array('author' => $page->author(), 'name' => $page->pageName(), 'url' => $page->pageUrl(), 'version' => $page->version(), 'version_url' => $version_url, 'version_alt' => sprintf(_("Show version %s"), $page->version()), 'diff_url' => $diff_url, 'diff_alt' => $diff_alt, 'diff_img' => $diff_img, 'created' => $page->formatVersionCreated(), 'change_log' => $page->changeLog()); $bydate[$createDate][$page->versionCreated()][$page->version()] = $pageInfo; } krsort($bydate); foreach ($bydate as $bysecond) { $day = array(); krsort($bysecond); foreach ($bysecond as $pageList) { krsort($pageList); $day = array_merge($day, array_values($pageList)); } $changes[] = array('date' => $day[0]['created'], 'pages' => $day); } return $changes; } /** * Renders this page in display or block mode. * * @return string The contents. * @throws Wicked_Exception */ public function displayContents($isBlock) { $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->changes = $this->content(); return $view->render('display/RecentChanges'); } public function pageName() { return 'RecentChanges'; } public function pageTitle() { return _("Recent Changes"); } } wicked-2.0.8/lib/Page/RevertPage.php 0000664 0001750 0001750 00000010054 13160726737 015306 0 ustar jan jan * @author Chuck Hagenbuch * @package Wicked */ /** * Displays and handles forms for confirming reversions of page history. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Chuck Hagenbuch * @package Wicked */ class Wicked_Page_RevertPage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array(Wicked::MODE_DISPLAY => true); /** * The page that we're confirming reversion for. * * @var string */ protected $_referrer = null; public function __construct($referrer) { $this->_referrer = $referrer; } /** * Retrieve this user's permissions for the referring page. * * @return integer The permissions bitmask. */ public function getPermissions() { return parent::getPermissions($this->referrer()); } /** * Send them back whence they came if they aren't allowed to * edit this page. */ public function preDisplay() { $page = Wicked_Page::getPage($this->referrer()); if (!$page->allows(Wicked::MODE_EDIT)) { Wicked::url($this->referrer(), true)->redirect(); } } /** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $version = Horde_Util::getFormData('version'); $page = Wicked_Page::getPage($this->referrer(), $version); $msg = sprintf(_("Are you sure you want to revert to version %s of this page?"), $version); ?> _referrer; } public function handleAction() { global $notification; $page = Wicked_Page::getPage($this->referrer()); if ($page->allows(Wicked::MODE_EDIT)) { $version = Horde_Util::getPost('version'); if (empty($version)) { $notification->push(sprintf(_("Can't revert to an unknown version.")), 'horde.error'); Wicked::url($this->referrer(), true)->redirect(); } $oldpage = Wicked_Page::getPage($this->referrer(), $version); $page->updateText($oldpage->getText(), 'Revert'); $notification->push(sprintf(_("Reverted to version %s of \"%s\"."), $version, $page->pageName())); Wicked::url($page->pageName(), true)->redirect(); } $notification->push(sprintf(_("You don't have permission to edit \"%s\"."), $page->pageName()), 'horde.warning'); Wicked::url($this->referrer(), true)->redirect(); } } wicked-2.0.8/lib/Page/Search.php 0000664 0001750 0001750 00000014527 13160726737 014460 0 ustar jan jan * @author Ben Chavet * @package Wicked */ /** * Displays and handles search forms and results. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Ben Chavet * @package Wicked */ class Wicked_Page_Search extends Wicked_Page { /** * Display modes supported by this page. * @var array */ public $supportedModes = array( Wicked::MODE_CONTENT => true, Wicked::MODE_DISPLAY => true ); /** * Cached search results. * * @var array */ protected $_results = array(); /** * Renders this page in content mode. * * @param string $searchtext The title to search for. * * @return string The page content. */ public function content($searchtext = '') { if (empty($searchtext)) { return array(); } return array( 'titles' => $GLOBALS['wicked']->searchTitles($searchtext), 'pages' => $GLOBALS['wicked']->searchText($searchtext, false) ); } /** * Perform any pre-display checks for permissions, searches, * etc. Called before any output is sent so the page can do * redirects. If the page wants to take control of flow from here, * it can, and is entirely responsible for handling the user * (should call exit after redirecting, for example). * * $param integer $mode The page render mode. * $param array $params Any page parameters. */ public function preDisplay($mode, $params) { $this->_results = $this->content($params); } /** * Renders this page in display mode. * * @param string $searchtext The title to search for. * * @return string The content. * @throws Wicked_Exception */ public function display($searchtext) { global $injector, $notification, $page_output, $wicked; $view = $injector->createInstance('Horde_View'); if (!$searchtext) { return $view->render('pagelist/search') . $view->render('pagelist/footer'); } /* Prepare exact match section */ $exact = array(); $page = new Wicked_Page_StandardPage($searchtext); if ($wicked->pageExists($searchtext)) { $exact[] = $page->toView(); } else { $exact[] = (object)array( 'author' => '', 'context' => Wicked::url($searchtext, false) ->link(array( 'title' => sprintf(_("Create %s"), $searchtext) )) . sprintf(_("%s does not exist. You can create it now."), '' . htmlspecialchars($searchtext) . '') . '', 'date' => '', 'name' => htmlspecialchars($searchtext), 'timestamp' => 0, 'version' => '', 'url' => Wicked::url($searchtext, false) ); } /* Prepare page title matches */ $titles = array(); foreach ($this->_results['titles'] as $page) { if (!empty($page['page_history'])) { $page = new Wicked_Page_StandardHistoryPage($page); } else { $page = new Wicked_Page_StandardPage($page); } $titles[] = $page->toView(); } /* Prepare page text matches */ $pages = array(); foreach ($this->_results['pages'] as $page) { if (!empty($page['page_history'])) { $page = new Wicked_Page_StandardHistoryPage($page); } else { $page = new Wicked_Page_StandardPage($page); } $object = $page->toView(); $object->context = $this->getContext($page, $searchtext); $pages[] = $object; } $page_output->addScriptFile('tables.js', 'horde'); $header = $injector->createInstance('Horde_View'); $header->th_page = _("Page"); $header->th_version = _("Current Version"); $header->th_author = _("Last Author"); $header->th_updated = _("Last Update"); $view = $injector->createInstance('Horde_View'); // Show search form and page header. $content = $view->render('pagelist/search'); // Show exact match. $header->title = _("Exact Match"); $content .= $header->render('pagelist/results_header') . $view->renderPartial( 'pagelist/page', array('collection' => $exact) ) . $view->render('pagelist/results_footer'); // Show page title matches. $header->title = _("Page Title Matches"); $content .= $header->render('pagelist/results_header') . $view->renderPartial( 'pagelist/page', array('collection' => $titles) ) . $view->render('pagelist/results_footer'); // Show page text matches. $header->title = _("Page Text Matches"); $content .= $header->render('pagelist/results_header') . $view->renderPartial( 'pagelist/page', array('collection' => $pages) ) . $view->render('pagelist/results_footer'); return $content; } public function getContext($page, $searchtext) { try { $text = html_entity_decode(strip_tags($page->displayContents(true)), ENT_QUOTES | ENT_XHTML, 'UTF-8'); } catch (Wicked_Exception $e) { $text = $page->getText(); } if (preg_match('/.{0,100}' . preg_quote($searchtext, '/') . '.{0,100}/i', $text, $context)) { return trim(preg_replace('/' . preg_quote($searchtext, '/') . '/i', '\0', htmlspecialchars($context[0]))); } return ''; } public function pageName() { return 'Search'; } public function pageTitle() { return _("Search"); } } wicked-2.0.8/lib/Page/StandardHistoryPage.php 0000664 0001750 0001750 00000004061 13160726737 017162 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Page class for old versions of pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_StandardHistoryPage extends Wicked_Page_StandardPage { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true, Wicked::MODE_EDIT => false, Wicked::MODE_REMOVE => true, Wicked::MODE_HISTORY => true, Wicked::MODE_DIFF => true, Wicked::MODE_LOCKING => false, Wicked::MODE_UNLOCKING => false); /** * Construct a standard history page class to represent an old * version of a wiki page. * * @param string $pagename The name of the page to load. * @param integer $version The version of the page to load. * * @throws Wicked_Exception */ public function __construct($pagename, $version = null) { if (empty($version)) { parent::__construct($pagename); return; } // Retrieve the version. $pages = $GLOBALS['wicked']->retrieveHistory($pagename, $version); // If it didnt find one, return an error. if (empty($pages[0])) { throw new Wicked_Exception(_("History page not found")); } $this->_page = $pages[0]; } public function isOld() { return true; } public function pageUrl($linkpage = null, $actionId = null) { return parent::pageUrl($linkpage, $actionId)->add('version', $this->version()); } } wicked-2.0.8/lib/Page/StandardPage.php 0000664 0001750 0001750 00000050513 13160726737 015603 0 ustar jan jan * @author Tyler Colbert * @package Wicked */ /** * Page class for regular pages. * * @category Horde * @license http://www.horde.org/licenses/gpl GPL * @author Jan Schneider * @author Tyler Colbert * @package Wicked */ class Wicked_Page_StandardPage extends Wicked_Page { /** * Display modes supported by this page. * * @var array */ public $supportedModes = array( Wicked::MODE_DISPLAY => true, Wicked::MODE_EDIT => true, Wicked::MODE_REMOVE => true, Wicked::MODE_HISTORY => true, Wicked::MODE_DIFF => true); /** * A Horde_Locks instance for un-/locking this page. * * @var Horde_Lock */ protected $_locks = null; /** * Lock information if this page is currently locked. * * @var array */ protected $_lock = null; /** * Constructs a standard page class to represent a wiki page. * * @param string $pagename The name of the page to represent. */ public function __construct($pagename) { if (is_array($pagename)) { $this->_page = $pagename; return; } $page = null; try { $page = $GLOBALS['wicked']->retrieveByName($pagename); } catch (Wicked_Exception $e) { // If we can't load $pagename, see if there's default data for it. // Protect against directory traversion. $pagepath = realpath(WICKED_BASE . '/data/' . $GLOBALS['conf']['wicked']['format']); $pagefile = realpath($pagepath . '/' . $pagename); if ($pagefile && Horde_String::common($pagefile, $pagepath) == $pagepath && substr($pagename, 0, 1) != '.' && file_exists($pagefile) && ($text = file_get_contents($pagefile))) { try { $GLOBALS['wicked']->newPage($pagename, $text); try { $page = $GLOBALS['wicked']->retrieveByName($pagename); } catch (Wicked_Exception $e) { $GLOBALS['notification']->push(sprintf(_("Unable to create %s"), $pagename), 'horde.error'); } } catch (Wicked_Exception $e) {} } } if ($page) { $this->_page = $page; } else { if ($pagename == 'Wiki/Home') { $GLOBALS['notification']->push(_("Unable to create Wiki/Home. The wiki is not configured."), 'horde.error'); } $this->_page = array(); } // Make sure 'wicked' permission exists. Set reasonable defaults if // necessary. $perms = $GLOBALS['injector']->getInstance('Horde_Perms'); $corePerms = $GLOBALS['injector']->getInstance('Horde_Core_Perms'); if (!$perms->exists('wicked')) { $perm = $corePerms->newPermission('wicked'); $perm->addGuestPermission(Horde_Perms::SHOW | Horde_Perms::READ, false); $perm->addDefaultPermission(Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT | Horde_Perms::DELETE, false); $perms->addPermission($perm); } // Make sure 'wicked:pages' exists. Copy from 'wicked' if it does not // exist. if (!$perms->exists('wicked:pages')) { $perm = $corePerms->newPermission('wicked:pages'); $copyFrom = $perms->getPermission('wicked'); $perm->addGuestPermission($copyFrom->getGuestPermissions(), false); $perm->addDefaultPermission($copyFrom->getDefaultPermissions(), false); $perm->addCreatorPermission($copyFrom->getCreatorPermissions(), false); foreach ($copyFrom->getUserPermissions() as $user => $uperm) { $perm->addUserPermission($user, $uperm, false); } foreach ($copyFrom->getGroupPermissions() as $group => $gperm) { $perm->addGroupPermission($group, $gperm, false); } $perms->addPermission($perm); } if ($GLOBALS['conf']['lock']['driver'] != 'none') { $this->supportedModes[Wicked::MODE_LOCKING] = $this->supportedModes[Wicked::MODE_UNLOCKING] = true; $this->_locks = $GLOBALS['injector']->getInstance('Horde_Lock'); $locks = $this->_locks->getLocks('wicked', $pagename, Horde_Lock::TYPE_EXCLUSIVE); if ($locks) { $this->_lock = reset($locks); } } } /** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { switch ($mode) { case Wicked::MODE_EDIT: if ($this->isLocked()) { return Wicked::lockUser() == $this->_lock['lock_owner']; } break; case Wicked::MODE_LOCKING: if ($GLOBALS['browser']->isRobot()) { return false; } if ($GLOBALS['registry']->isAdmin()) { return true; } if (($this->getPermissions() & Horde_Perms::EDIT) == 0) { return false; } break; case Wicked::MODE_UNLOCKING: if ($GLOBALS['registry']->isAdmin()) { return true; } if ($this->_lock) { return Wicked::lockUser() == $this->_lock['lock_owner']; } return false; } return parent::allows($mode); } /** * @throws Wicked_Exception */ public function displayContents($isBlock) { $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->text = $this->getProcessor()->transform($this->getText()); if ($isBlock) { return $view->render('display/standard'); } $view->showTools = true; if ($this->allows(Wicked::MODE_EDIT) && !$this->isLocked(Wicked::lockUser())) { $view->edit = Horde::widget(array( 'url' => Wicked::url('EditPage') ->add('referrer', $this->pageName()), 'title' => _("_Edit"), 'class' => 'wicked-edit', )); } if ($this->isLocked()) { if ($this->allows(Wicked::MODE_UNLOCKING)) { $view->unlock = Horde::widget(array( 'url' => $this->pageUrl(null, 'unlock')->remove('version'), 'title' => _("Un_lock"), 'class' => 'wicked-unlock', )); } } else { if ($this->allows(Wicked::MODE_LOCKING)) { $view->lock = Horde::widget(array( 'url' => $this->pageUrl(null, 'lock')->remove('version'), 'title' => _("_Lock"), 'class' => 'wicked-lock', )); } } if ($this->allows(Wicked::MODE_REMOVE)) { $params = array('referrer' => $this->pageName()); if ($this->isOld()) { $params['version'] = $this->version(); } $view->remove = Horde::widget(array( 'url' => Wicked::url('DeletePage')->add($params), 'title' => _("_Delete"), 'class' => 'wicked-delete', )); } if ($this->allows(Wicked::MODE_REMOVE) && !$this->isLocked(Wicked::lockUser())) { $view->rename = Horde::widget(array( 'url' => Wicked::url('MergeOrRename') ->add('referrer', $this->pageName()), 'title' => _("_Merge/Rename") )); } $view->backLinks = Horde::widget(array( 'url' => Wicked::url('BackLinks') ->add('referrer', $this->pageName()), 'title' => _("_Backlinks") )); $view->likePages = Horde::widget(array( 'url' => Wicked::url('LikePages') ->add('referrer', $this->pageName()), 'title' => _("S_imilar Pages") )); $view->attachedFiles = Horde::widget(array( 'url' => Wicked::url('AttachedFiles') ->add('referrer', $this->pageName()), 'title' => _("Attachments") )); if ($this->allows(Wicked::MODE_HISTORY)) { $view->changes = Horde::widget(array( 'url' => $this->pageUrl('history.php')->remove('version'), 'title' => _("Hi_story") )); } if ($GLOBALS['registry']->isAdmin()) { $permsurl = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/admin/perms/edit.php') ->add(array( 'category' => 'wicked:pages:' . $this->pageId(), 'autocreate' => 1, 'autocreate_copy' => 'wicked', 'autocreate_guest' => Horde_Perms::SHOW | Horde_Perms::READ, 'autocreate_default' => Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT | Horde_Perms::DELETE )); $view->perms = Horde::widget(array( 'url' => $permsurl, 'target' => '_blank', 'title' => _("Permissio_ns") )); } if ($histories = $GLOBALS['session']->get('wicked', 'history')) { $view->history = Horde::widget(array( 'url' => '#', 'onclick' => 'document.location = document.display.history[document.display.history.selectedIndex].value;', 'title' => _("Ba_ck to") )); $view->histories = array(); foreach ($histories as $history) { if (!strlen($history)) { continue; } $view->histories[(string)Wicked::url($history)] = $history; } } $pageId = $GLOBALS['wicked']->getPageId($this->pageName()); $attachments = $GLOBALS['wicked']->getAttachedFiles($pageId); if (count($attachments)) { $view->attachments = array(); foreach ($attachments as $attachment) { $url = $GLOBALS['registry'] ->downloadUrl( $attachment['attachment_name'], array( 'page' => $this->pageName(), 'file' => $attachment['attachment_name'], 'version' => $attachment['attachment_version'] ) ); $icon = $GLOBALS['injector'] ->getInstance('Horde_Core_Factory_MimeViewer') ->getIcon( Horde_Mime_Magic::filenameToMime( $attachment['attachment_name'] ) ); $view->attachments[] = Horde::link($url) . ' ' . htmlspecialchars($attachment['attachment_name']) . ''; } } $view->downloadPlain = Wicked::url($this->pageName()) ->add(array('actionID' => 'export', 'format' => 'plain')) ->link() . _("Plain Text") . ''; $view->downloadHtml = Wicked::url($this->pageName()) ->add(array('actionID' => 'export', 'format' => 'html')) ->link() . _("HTML") . ''; $view->downloadLatex = Wicked::url($this->pageName()) ->add(array('actionID' => 'export', 'format' => 'tex')) ->link() . _("Latex") . ''; $view->downloadRest = Wicked::url($this->pageName()) ->add(array('actionID' => 'export', 'format' => 'rst')) ->link() . _("reStructuredText") . ''; return $view->render('display/standard'); } /** * Renders this page in History mode. * * @return string The content. * @throws Wicked_Exception */ public function history() { global $injector, $page_output; $page_output->addScriptFile('history.js'); $view = $injector->createInstance('Horde_View'); // Header. $view->formInput = Horde_Util::formInput(); $view->name = $this->pageName(); $view->pageLink = $this->pageUrl()->link() . htmlspecialchars($this->pageName()) . ''; $view->refreshLink = $this->pageUrl('history.php')->link() . Horde::img('reload.png', _("Reload History")) . ''; if ($this->allows(Wicked::MODE_REMOVE)) { $view->remove = Horde::img('delete.png', _("Delete Version")); } if ($this->allows(Wicked::MODE_EDIT) && !$this->isLocked(Wicked::lockUser())) { $view->edit = Horde::img('edit.png', _("Edit Version")); $view->restore = Horde::img('restore.png', _("Restore Version")); } $content = $view->render('history/header'); // First item is this page. $view->showRestore = false; $this->_setViewProperties($view, $this); $content .= $view->render('history/summary'); // Now the rest of the histories. $view->showRestore = true; foreach ($GLOBALS['wicked']->getHistory($this->pageName()) as $page) { $page = new Wicked_Page_StandardHistoryPage($page); $this->_setViewProperties($view, $page); $view->pversion = $page->version(); $content .= $view->render('history/summary'); } // Footer. return $content . $view->render('history/footer'); } protected function _setViewProperties($view, $page) { $view->displayLink = $page->pageUrl() ->link(array( 'title' => sprintf(_("Display Version %s"), $page->version()) )) . htmlspecialchars($page->version()) . ''; $text = sprintf(_("Delete Version %s"), $page->version()); $view->deleteLink = Wicked::url('DeletePage') ->add(array( 'referrer' => $page->pageName(), 'version' => $page->version() )) ->link(array('title' => $text)) . Horde::img('delete.png', $text) . ''; $text = sprintf(_("Edit Version %s"), $page->version()); $view->editLink = Wicked::url('EditPage') ->add(array('referrer' => $page->pageName())) ->link(array('title' => $text)) . Horde::img('edit.png', $text) . ''; $text = sprintf(_("Revert to version %s"), $page->version()); $view->restoreLink = Wicked::url('RevertPage') ->add(array( 'referrer' => $page->pageName(), 'version' => $page->version() )) ->link(array('title' => $text)) . Horde::img('restore.png', $text) . ''; $view->author = $page->author(); $view->date = $page->formatVersionCreated(); $view->version = $page->version(); $view->changelog = $page->changeLog(); } public function isLocked($owner = null) { if (empty($this->_lock)) { return false; } if (is_null($owner)) { return true; } return $owner != $this->_lock['lock_owner']; } /** * @throws Wicked_Exception */ public function lock() { if ($this->_locks) { $id = $this->_locks->setLock(Wicked::lockUser(), 'wicked', $this->pageName(), $GLOBALS['conf']['wicked']['lock']['time'] * 60, Horde_Lock::TYPE_EXCLUSIVE); if ($id) { $this->_lock = $this->_locks->getLockInfo($id); } else { throw new Wicked_Exception(_("The page is already locked.")); } } } public function unlock() { if ($this->_locks && $this->_lock) { $this->_locks->clearLock($this->_lock['lock_id']); unset($this->_lock); } } public function getLockRequestor() { $requestor = $this->_lock['lock_owner']; if ($requestor) { $name = $GLOBALS['injector'] ->getInstance('Horde_Core_Factory_Identity') ->create($requestor) ->getValue('fullname'); if (!strlen($name)) { $name = $requestor; } return $name; } return _("a guest"); } public function getLockTime() { $time = ceil(($this->_lock['lock_expiry_timestamp'] - time()) / 60); return sprintf(ngettext("%d minute", "%d minutes", $time), $time); } /** * @throws Wicked_Exception */ public function updateText($newtext, $changelog) { $version = $this->version(); $result = $GLOBALS['wicked']->updateText($this->pageName(), $newtext, $changelog); $url = Wicked::url($this->pageName(), true, -1); $new_page = $this->getPage($this->pageName()); $message = "Modified page: $url\n" . 'New Revision: ' . $new_page->version() . "\n" . ($changelog ? 'Change log: ' . $changelog . "\n" : '') . "\n" . $new_page->getDiff($version); Wicked::mail($message, array('Subject' => '[' . $GLOBALS['registry']->get('name') . '] changed: ' . $this->pageName())); $this->_page['page_text'] = $newtext; } public function pageID() { return isset($this->_page['page_id']) ? $this->_page['page_id'] : ''; } public function pageName() { return isset($this->_page['page_name']) ? $this->_page['page_name'] : ''; } public function getText() { return isset($this->_page['page_text']) ? $this->_page['page_text'] : ''; } public function versionCreated() { return isset($this->_page['version_created']) ? $this->_page['version_created'] : ''; } public function hits() { return !empty($this->_page['page_hits']) ? $this->_page['page_hits'] : 0; } public function changeLog() { return $this->_page['change_log']; } public function version() { if (isset($this->_page['page_version'])) { return $this->_page['page_version']; } else { return ''; } } /** * Renders this page in diff mode. * * @param string $version The version to diff this page against. */ public function diff($version) { $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->link = $this->pageUrl()->link() . htmlspecialchars($this->pageName()) . ''; $view->version1 = $version; $view->version2 = $this->version(); $view->diff = $this->getDiff($version, 'inline'); echo $view->render('diff/diff'); } /** * Produces a diff for this page. * * @param string $version Previous version, or null if diffing with * `before the beginning' (empty). * @param string $renderer The diff renderer. */ public function getDiff($version, $renderer = 'unified') { if (is_null($version)) { $old_page_text = ''; } else { $old_page = $this->getPage($this->pageName(), $version); $old_page_text = $old_page->getText(); } $diff = new Horde_Text_Diff('auto', array(explode("\n", $old_page_text), explode("\n", $this->getText()))); $class = 'Horde_Text_Diff_Renderer_' . Horde_String::ucfirst($renderer); $renderer = new $class(); return $renderer->render($diff); } } wicked-2.0.8/lib/Text_Wiki/doc/BBCodeParser.php 0000664 0001750 0001750 00000033061 13160726737 017300 0 ustar jan jan * @author Bertrand Gugger
* @copyright 1997-2005 The PHP Group * @copyright 2005 bertrand Gugger * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_BBCodeParser * @see Text_Wiki */ /** * Text transformation engine */ require_once 'Text/Wiki/BBCode.php'; /** * PEAR base class to get the static properties */ if (!defined('HTML_BBCODEPARSER_V2')) { require_once 'PEAR.php'; } /** * Base HTML_BBCodeParser class to transform BBCode in XHTML * * This is a parser to replace UBB style tags with their xhtml equivalents. * It's the refundation of the class using the Text_Wiki transform engine * * Usage: * $parser = new HTML_BBCodeParser(); * $parser->setText('normal [b]bold[/b] and normal again'); * $parser->parse(); * echo $parser->getParsed(); * or: * $parser = new HTML_BBCodeParser(); * echo $parser->qparse('normal [b]bold[/b] and normal again'); * or: * echo HTML_BBCodeParser::staticQparse('normal [b]bold[/b] and normal again'); * * Setting the options from the ini file: * $config = parse_ini_file('BBCodeParser.ini', true); * $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); * $options = $config['HTML_BBCodeParser']; * unset($options); * * @category HTML * @package HTML_BBCodeParser * @author Stijn de Reede * @author Bertrand Gugger * @copyright 1997-2005 The PHP Group * @copyright 2005 bertrand Gugger * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/HTML_BBCodeParser * @see Text_Wiki::BBCode() */ class HTML_BBCodeParser extends Text_Wiki_BBCode { /** * A string containing the input * * @access private * @var string */ var $_text = ''; /** * A string containing the parsed version of the text * * @access private * @var string */ var $_parsed = ''; /** * An array of options, filled by an ini file or through the contructor * * @access private * @var array */ var $_options = array( 'quotestyle' => 'double', // fixed, ignored 'quotewhat' => 'all', // fixed, ignored 'open' => '[', // fixed, rejected 'close' => ']', // fixed, rejected 'xmlclose' => true, // fixed, ignored 'filters' => 'Basic', 'rules' => array(), 'parse' => array(), 'render' => array() ); /** * Constructor, initialises the options and filters * * Sets the private variable _options with base options defined with * &PEAR::getStaticProperty(), overwriting them with (if present) * the argument to this method. * Then it sets the extra options to properly escape the tag * characters in preg_replace() etc. The set options are * then stored back with &PEAR::getStaticProperty(), so that the filter * classes can use them. * All the filters in the options are initialised and their defined tags * are copied into the private variable _definedTags. * * @param mixed array or string options or ini file to use, can be left out * @return none * @access public * @author Stijn de Reede */ function HTML_BBCodeParser($options = array()) { // instantiate the Text_Wiki transformer parent::Text_Wiki_BBCode(); // config file (.ini) ? if (is_string($options)) { $options = HTML_BBCodeParser::parseIniFile($options); } // set the already set options if (!defined('HTML_BBCODEPARSER_V2')) { $baseoptions = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); if (is_array($baseoptions)) { foreach ($baseoptions as $k => $v) { $this->_options[$k] = $v; } } } // set the options passed as an argument foreach ($options as $k => $v ) { $this->_options[$k] = $v; } // open and close tags are fixed by Text_Wiki_BBCode if ((isset($this->_options['open']) && ($this->_options['open'] != '[')) || (isset($this->_options['close']) && ($this->_options['close'] != ']'))) { return " Sorry, open/close tags are fixed to '[' and ']', put a RFE if neede
\n"; } // set the rules $rules = array_merge( // mandatory rules array('Prefilter', 'Delimiter'), // old style ? isset($this->_options['filters']) ? HTML_BBCodeParser::filtersToRules($this->_options['filters']) : array(), // new style ? isset($this->_options['rules']) ? is_array($this->_options['rules']) ? $this->_options['rules'] : explode(',', $this->_options['rules']) : array() ); // filter rules so their order is kept foreach ($this->rules as $rule) { if (!in_array( $rule, $rules)) { $this->deleteRule($rule); } } if (isset($options['parse'][$options['set_parse']])) { $this->parseConf = $options['parse'][$options['set_parse']]; } if (isset($options['format'])) { foreach (array_keys($options['format']) as $render) { if (!isset($options['set_render']) || in_array($render, $options['set_render'])) { $this->setFormatConf($render, $options['format'][$render]); } } } if (isset($options['render'])) { foreach (array_keys($options['render']) as $render) { if (in_array($render, $options['set_render'])) { $this->renderConf[$render] = $options['render'][$render]; } } } // var_dump( $options);var_dump($this->parseConf);var_dump($this->formatConf);var_dump($this->renderConf); die(); } /** * Prune (unset) empty arrays in options * * @param string $iniFile the configuration file name (default 'BBCodeParser.ini') * @return array the corresponding options as a tree array general|Parse|Render*Format*Rule * @access public * @static */ function pruneOptions(&$options) { foreach (array_keys($options) as $k0) { if (is_array($options[$k0])) { if ($options[$k0]) { HTML_BBCodeParser::pruneOptions($options[$k0]); } if (!$options[$k0]) { unset($options[$k0]); } } } } /** * Parse configuration file to set an option array * * @param string $iniFile the configuration file name (default 'BBCodeParser.ini') * @return array the corresponding options * as a tree general|parse|render|format*Format*Rule * @access public * @static */ function parseIniFile($iniFile = 'BBCodeParser.ini') { static $isArray = array( 'set_render', 'filters', 'rules', 'schemes', 'extensions', 'refused', 'prefixes', 'img_ext'); $options = array(); // Parse the ini file $config = parse_ini_file($iniFile, true); // Normalize if old config if (isset($config['HTML_BBCodeParser'])) { $config = array_merge($config['HTML_BBCodeParser'], $config); unset($config['HTML_BBCodeParser']); } // proceed each section or general items foreach ($config as $name => $section) { if (is_string($section)) { $options[$name] = in_array($name, $isArray) ? explode(',', $section) : $section; continue; } $keys = explode('_', $name); $here = & $options; foreach ($keys as $key) { if (!isset($here[$key])) { $here[$key] = array(); } $here = & $here[$key]; } $smiley = (count($keys) == 3) && ($keys[0] == 'parse') && ($keys[2] == 'Smiley'); foreach ($section as $itk => $item) { if ($item === '') { continue; } if ($smiley && (substr($itk, 0, 7) == 'smiley_')) { $words = explode(' ', $item); $equal = false; $variante = array(); for ($i = 1; $i < count($words); $i++) { if ($equal) { $variante[] = $words[$i]; $equal = false; continue; } if (!$equal = ($words[$i] == '=')) { break; } } $here[$words[0]] = array_merge( array( substr($itk, 7), $equal || (count($words) == $i + 1) ? $itk : implode(' ', array_slice($words, $i)) ), $variante); } else { $here[$itk] = in_array($itk, $isArray) ? explode(',', $item) : $item; } } } HTML_BBCodeParser::pruneOptions($options); return $options; } /** * Sets rules list from Filters (groups of rules) * * @param mixed filters to set as a comma separated string or array * @return array the corresponding rules * @access public * @static */ function filtersToRules($filters = array()) { $conv = array( // todo: , 'Strike', ' Subscript', 'Superscript' 'Basic' => array('Bold', 'Italic', 'Underline'), 'Extended' => array('Colortext', 'Font', 'Blockquote', 'Code'), //todo: , 'align' 'Links' => array('Url'), 'Images' => array('Image'), 'Lists' => array('List'), 'Email' => array('Url') ); if (!is_array($filters)) { $filters = explode(',', $filters); } foreach ($conv as $filter => $rules) { if (!in_array( $filter, $filters)) { unset($conv[$filter]); } } return $conv; } /** * Sets text in the object to be parsed * * @param string the text to set in the object * @return none * @access public * @see getText() * @see $_text * @author Stijn de Reede*/ function setText($str) { $this->_text = $str; } /** * Gets the unparsed text from the object * * @return string the text set in the object * @access public * @see setText() * @see $_text * @author Stijn de Reede */ function getText() { return $this->_text; } /** * Gets the preparsed text from the object * * @return string the text set in the object * @access public * @see _preparse() * @see $_preparsed * @author Stijn de Reede */ function getPreparsed() { return $this->_preparsed; } /** * Gets the parsed text from the object * * @return string the parsed text set in the object * @access public * @see parse() * @see $_parsed * @author Stijn de Reede */ function getParsed() { return $this->_parsed; } /** * Parses the text set in the object * * @param string $text : if set, that's a call to the parent Text_Wiki::parse() * @return none * @access public * @see Text_Wiki::parse() * @see Text_Wiki::render() */ function parse($text = null) { if (isset($text)) { parent::parse($text); return; } parent::parse($this->_text); $this->_preparsed = $this->source; $this->_parsed = parent::render('Xhtml'); } /** * Quick method to do setText(), parse() and getParsed at once * * @return none * @access public * @see parse() * @see $_text * @author Stijn de Reede */ function qparse($str) { $this->_text = $str; $this->parse(); return $this->_parsed; } /** * Quick static method to do setText(), parse() and getParsed at once * * @return none * @access public * @see parse() * @see $_text * @author Stijn de Reede */ function staticQparse($str) { $p = new HTML_BBCodeParser(); $str = $p->qparse($str); unset($p); return $str; } } ?> wicked-2.0.8/lib/Text_Wiki/doc/BBCodeParser_V2.ini 0000664 0001750 0001750 00000006673 13160726737 017650 0 ustar jan jan [HTML_BBCodeParser] ; THESE OPTIONS ARE FIXED ! JUST HERE FOR VISIBILITY, DON'T CHANGE ! ; possible values: single|double ; use single or double quotes for attributes quotestyle = double ; possible values: all|nothing|strings ; quote all attribute values, none, or only the strings quotewhat = all ; the opening tag character open = [ ; the closing tag character close = ] ; possible values: true|false ; use xml style closing tags for single html tags ( or
) xmlclose = true ; END FIXED OPTIONS ; WILL BE SUPERSEDED BY 'rules' IF PRESENT ; possible values with the corresponding rules [not yet implemented] ; Basic => Bold,Italic,Underline [,Strike, Subscript,Superscript] ; Extended => Colortext,Font,Blockquote,Code, [,align] ; Links => Url ; Images => Image ; Lists => List ; Email => Url ; comma seperated list of filters to use filters = Basic,Extended,Links,Images,Lists,Email ;********************* ;* Text_Wiki options * ;********************* set_parse=BBCode set_render=Xhtml ; comma seperated list of rules to use, possible values: ; Prefilter,Delimiter,Code,Blockquote,List,Image,Smiley, ; Newline,Paragraph,Url,Colortext,Font,Bold,Italic,Underline,Tighten rules = Code,Blockquote,List,Image,Smiley,Newline,Paragraph,Url,Colortext,Font,Bold,Italic,Underline,Tighten ;************** Parse options ************ [parse_BBCode_Image] schemes= url_regexp= local_regexp= extensions= [parse_BBCode_Smiley] smiley_biggrin = ":D = :grin: Very Happy" smiley_smile = ":) = (: Smile" smiley_sad = ":( = ): Sad" smiley_surprised = ":o = :eek: = o: Surprised" smiley_eek = ":shock: Shocked" smiley_confused = ":? = :???: Confused" smiley_cool = "8) = (8 Cool" smiley_lol = ":lol: Laughing" smiley_mad = ":x = x: Mad" smiley_razz = ":P Razz" smiley_redface = ":oops Embarassed" smiley_cry = ":cry: Crying or Very sad" smiley_evil = ":evil: Evil or Very Mad" smiley_twisted = ":twisted: Twisted Evil" smiley_rolleyes = ":roll: Rolling Eyes" smiley_wink = ";) = (; Wink" smiley_exclaim = ":!: Exclamation" smiley_question = ":?: Question" smiley_idea = ":idea: Idea" smiley_arrow = ":arrow: Arrow" smiley_neutral = ":| = |: Neutral" smiley_mrgreen = ":mrgreen: Mr. Green" auto_nose=1 [parse_BBCode_Paragraph] skip= [parse_BBCode_Url] schemes= refused= prefixes= host_regexp= path_regexp= user_regexp= ;[parse_BBCode_Prefilter] ;[parse_BBCode_Delimiter] ;[parse_BBCode_Code] ;[parse_BBCode_Blockquote] ;[parse_BBCode_List] ;[parse_BBCode_Newline] ;[parse_BBCode_Colortext] ;[parse_BBCode_Font] ;[parse_BBCode_Bold] ;[parse_BBCode_Italic] ;[parse_BBCode_Underline] ;[parse_BBCode_Tighten] ;************** Renderer options ************ [format_Xhtml] translate=HTML_ENTITIES quotes= ENT_COMPAT charset=ISO-8859-1 [render_Xhtml_Image] base=/ ;url_base= css= css_link= [render_Xhtml_Smiley] prefix=images/smiles/icon_ extension=.gif css= [render_Xhtml_Url] images=true img_ext=jpg,jpeg,gif,png target=_blank css_inline= css_descr= ;css_footnote= css_img= [render_Xhtml_Code] css= css_code= css_php= css_html= css_filename= [render_Xhtml_Blockquote] css= [render_Xhtml_List] css_ol= css_ol_li= css_ul= css_ul_li= [render_Xhtml_Paragraph] css= [render_Xhtml_Bold] css= [render_Xhtml_Italic] css= [render_Xhtml_Underline] css= ;[render_Xhtml_Prefilter] ;[render_Xhtml_Delimiter] ;[render_Xhtml_Newline] ;[render_Xhtml_Colortext] ;[render_Xhtml_Font] ;[render_Xhtml_Tighten] wicked-2.0.8/lib/Text_Wiki/doc/BBtest.txt 0000664 0001750 0001750 00000004257 13160726737 016265 0 ustar jan jan Essai Code block, with other BBCode inside. [b]bolded[/b] [i]italic[/i] [i][b] bold italic[/b] simple italic[/i] [u] underline[/u] [u] underline[i]underline italic[b]underline bold italic[/b] underline italic[/i]underline[/u] Font size and color: [color=red]Hello![/color] or [color=#FF0000]Hello![/color] [color=#FF0000]Hello [color=green]You[/color] , how are you[/color] [size=9]SMALL[/size] [size=24]HUGE![/size] [size=18][color=red][b]LOOK AT ME![/b][/color][/size] url: [url=http://pear.php.net][img]http://pear.php.net/gifs/pearsmall.gif[/img][/url] [url=http://www.totalgeek.org]totalgeek.org[/url] [url=/some/relative/url.php]relative url[/url] [url]www.totalgeek.org[/url] www.totalgeek.org [email=user@example.com]example Mail[/email] [email]user@example.com[/email] user@example.com An [url=http://www.totalgeek.org]totalgeek.org[/url] is an url as [url=/some/relative/url.php]relative url[/url], [url]www.totalgeek.org[/url], www.totalgeek.org also emails as [email=user@example.com]example Mail[/email], [email]user@example.com[/email] or user@example.com [img]rond.gif[/img] [img]http://pear.php.net/gifs/pearsmall.gif[/img] [u][b][i]Test for BBCode lists[/i][/b][/u] Unordered list: [list] [*] This is the first bulleted item. [*] This is the second bulleted item. [/list] Ordered list: [list=A] [*] This is the first bulleted item. [*] This is the second bulleted item. [/list] [list] [*]unordered item 1 [*]unordered item 2 [/list] [list=1] [*]ordered item 1 [*]ordered item 2 [/list] [list=i][*]ordered item 1 type i[*]ordered item 2 type i[/list] an empty one: [list][/list] some more: [list=I] [*]ordered item 1 type I [/list] [list=a] [*]ordered item 1 type a [*]ordered item 2 type a [/list] [list=A] [*]ordered item 1 type A [*]ordered item 2 type A [/list] [list=X] [*]ordered item 1, nested list: [list=99] [*]nested item 1 [*]nested item 2 [/list] [*]ordered item 2 [/list] [quote="bibi"]And a quote! [quote]And a second inside [/quote] [/quote] [code] Hello [code] You [/code] , how are you [/code] [size=18][color=red][b]CRAP ![/b][/color][/size] [color=expression(alert('fooba'));]test[/color] [size=18pt;width:expression(alert("foobar"));]test[/size] wicked-2.0.8/lib/Text_Wiki/doc/parser.php 0000664 0001750 0001750 00000005433 13160726737 016343 0 ustar jan jan /* adjust include_path to include PEAR */ // ini_set('include_path', ini_get('include_path').':/usr/share/pear'); /* all your errors are belong to us */ error_reporting(E_ALL); /* require PEAR and the parser */ require_once('PEAR.php'); // require_once('HTML/BBCodeParser.php'); require_once 'BBCodeParser.php'; /* get options from the ini file */ // $config = parse_ini_file('BBCodeParser.ini', true); $config = parse_ini_file('BBCodeParser_V2.ini', true); $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $options = $config['HTML_BBCodeParser']; unset($options); /* do yer stuff! */ // $parser = new HTML_BBCodeParser(); $parser = new HTML_BBCodeParser('BBCodeParser_V2.ini'); $parser->setText(@$_GET['string']); $parser->parse(); $parsed = $parser->getParsed(); ?>
HTML_BBCodeParser (by Stijn de Reede) wicked-2.0.8/lib/Text_Wiki/doc/README_BBCodeParser 0000664 0001750 0001750 00000003202 13160726737 017521 0 ustar jan jan README_BBCodeParser ------------------- These notes introduce the changes in HTML_BBCodeParser refunded on Text_Wiki 1) PEAR static properties Options can still be initialized thru PEAR static properties, however this feature is deprecated. You may define the constant HTML_BBCODEPARSER_V2 to avoid requiring PEAR and shut off totally this feature 2) Droped out options * Open/close tags 'open' => '[' 'close' => ']' The tags are fixed to square brackets, if different rejected * XHTML compatibility The rendering is exlusively XHTML, so old rendering options are fixed : 'quotestyle' => 'double', 'quotewhat' => 'all', 'xmlclose' => true, Differents will be ignored. 3) Choice of filters/rules The option 'filters' is still in use 'filters' => 'Basic,Extended,Links,Images,Lists,Email' (default 'Basic') and will determine the list of active rules (tags) as usual It's a way of grouping rules and you may prefer the option 'rules' which enables a detailed list of activated tags. You can use both 'filters' and 'rules', they are additive. NOTE: as for the initial release, only standard BBCode tags are implemented in the parser. Therefore, [s], [sub], [sup], [font], [align] and [ulist] even if they exist in the renderer are not yet implemented in the parser 4) New options * General The 'filters' and 'rules' options detail the enabled tags * Parser The 'parser_BBCode_xxx' options cares for Text_Wiki_Parse_BBCode options for rule/tag xxx * Renderer Then 'render_Xhtml_xxx' options cares for Text_Wiki_Render_Xhtml options for rule/tag xxx See full example BBCodeParser_V2.ini wicked-2.0.8/lib/Text_Wiki/doc/test_Text_Wiki.php 0000664 0001750 0001750 00000012674 13160726737 020022 0 ustar jan jan $plist[0], 'render'=>$rlist[0], 'exchoice'=>($elist ? $elist[0] : ''), 'source'=>'') as $fld=>$def) { if(!isset($_REQUEST[$fld])) { $_REQUEST[$fld] = $def; } $$fld = $_REQUEST[$fld]; } if (!isset($_REQUEST['translate'])) { echo bldHtml('', $plist, $rlist, $elist); die(); } } // instantiate a Text_Wiki object from the given class $wiki = & Text_Wiki::singleton($parser); // If you want to include rules, use //$wiki = & Text_Wiki::singleton($parser, $rules); // If you want to get a new copy of the class use factory //$wiki =& Text_Wiki::factory($parser); //print "\n"; //print_r($wiki); //print "\n"; // when rendering XHTML, make sure wiki links point to a // specific base URL //$wiki->setRenderConf('xhtml', 'wikilink', 'view_url', // 'http://example.com/view.php?page='); // set an array of pages that exist in the wiki // and tell the XHTML renderer about them //$pages = array('HomePage', 'AnotherPage', 'SomeOtherPage'); $wiki->setRenderConf('xhtml', 'code', 'css_filename', 'codefilename'); // transform the wiki text into given rendering $result = $wiki->transform($source, $render); // display the transformed text if ($html) { echo bldHtml($result, $plist, $rlist, $elist); } else { if (PEAR::isError($result)) { var_dump($result); } else { echo $result; } } function bldOpt($name, $list) { $ret = ''; foreach($list as $opt) { $ret .= "\n"; } return $ret; } function bldHtml($result, $plist, $rlist, $elist) { $optparser = bldOpt('parser', $plist); $optrender = bldOpt('render', $rlist); $optexample = bldOpt('exchoice', $elist); if (PEAR::isError($result)) { $hresult = '' . nl2br(htmlentities($result->toString ())) . ''; $result = ''; } else { $hresult = nl2br(htmlentities($result)); } if ($_REQUEST['render'] != 'Xhtml') { $result = ''; } $_REQUEST['source'] = htmlspecialchars($_REQUEST['source']); return <<PEAR::Text_Wiki Demo PEAR::Text_Wiki Demo
{$hresult}{$result}EOT; } function findExamples($dir=null) { $ret = array(); $dh=opendir($dir? $dir : '.'); while ($subfil = readdir($dh)) { if (!is_dir($subfil) && is_readable($subfil) && (substr($subfil, -4) == '.txt')) { $ret[] = $subfil; } } closedir($dh); return $ret; } ?> wicked-2.0.8/lib/Text_Wiki/tests/BBCode/7908.phpt 0000664 0001750 0001750 00000011071 13160726737 017310 0 ustar jan jan --TEST-- Text_Wiki_BBCode_Parse_List --FILE-- parse( '[b]Services Provided:[/b] [list] [*]Matters pertinent to co-habitation and non-marital relationships, including tax, property and probate matters. [*]Guidance on how to deal with the breakdown or dissolution of a marriage and other relationships. [*]Advice on commencing and enabling judicial separation proceedings. [*]Guidance through the process involved in initiating divorce proceedings following the breakdown of a marriage. [*]Practical guidance on financial settlements, property disputes, maintenance rights and other financial orders arising from divorce and separation. [*]Advice on matters relating to children, including custody, contact and residence rights and disputes. [/list]', 'BBCode'); echo "---Text---\n"; var_dump(str_replace($t->delim, '<@>', $t->source)); echo "---Tokens---\n"; var_dump($t->tokens); ?> --EXPECT-- ---Text--- string(757) "[b]Services Provided:[/b] <@>12<@><@>0<@>Matters pertinent to co-habitation and non-marital relationships,<@>1<@>including tax, property and probate matters. <@>2<@>Guidance on how to deal with the breakdown or dissolution of a<@>3<@>marriage and other relationships. <@>4<@>Advice on commencing and enabling judicial separation proceedings.<@>5<@><@>6<@>Guidance through the process involved in initiating divorce<@>7<@>proceedings following the breakdown of a marriage. <@>8<@>Practical guidance on financial settlements, property disputes,<@>9<@>maintenance rights and other financial orders arising from divorce and separation. <@>10<@>Advice on matters relating to children, including custody, contact<@>11<@>and residence rights and disputes. <@>13<@>" ---Tokens--- array(14) { [0]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(0) } } [1]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(0) } } [2]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(1) } } [3]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(1) } } [4]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(2) } } [5]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(2) } } [6]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(3) } } [7]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(3) } } [8]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(4) } } [9]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(4) } } [10]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(17) "bullet_item_start" ["level"]=> int(0) ["count"]=> int(5) } } [11]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["type"]=> string(15) "bullet_item_end" ["level"]=> int(0) ["count"]=> int(5) } } [12]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["level"]=> int(0) ["count"]=> int(5) ["type"]=> string(17) "bullet_list_start" } } [13]=> array(2) { [0]=> string(4) "List" [1]=> array(3) { ["level"]=> int(0) ["count"]=> int(5) ["type"]=> string(15) "bullet_list_end" } } } wicked-2.0.8/lib/Text_Wiki/tests/fixtures/bug11649.txt 0000664 0001750 0001750 00000037707 13160726737 020540 0 ustar jan jan [[toc]] + Configuring Turba to use the same fields as Outlook 2003 This document is intended to help Horde administrators create a more Outlook-like experience for their users by giving them the address book fields they are accustomed to. An export of an Outlook 2003 address book contains a number of fields not included in the Outlook UI. This document only covers the fields available in the Outlook UI. ++ Modifying attributes.php //turba/config/attributes.php// is the file that defines which fields are available to turba, and what type of data they can hold. Make the following changes and additions to the default //attributes.php//. (**Note:** the //addresslink// type is only available in the CVS version of Horde/Turba. If you want to use this howto for the current stable Horde/Turba, use //address// instead. It's not as pretty, but it will do the job) Modify the //name// field to look like:$attributes['name'] = array( 'label' => '', 'type' => 'html', 'required' => true );
Modify the //lastname// field to look like:$attributes['lastname'] = array( 'label' => _("Last Name"), 'type' => 'text', 'required' => false );
Modify the //homeAddress// field to look like:$attributes['homeAddress'] = array( 'label' => '', 'type' => 'addresslink', 'required' => false, );
Modify the //workAddress// field to look like:$attributes['workAddress'] = array( 'label' => '', 'type' => 'addresslink', 'required' => false, );
Modify the //cellPhone// field to look like:$attributes['cellPhone'] = array( 'label' => _("Mobile Phone"), 'type' => 'text', 'required' => false );
And, add the following to the end of the file:$attributes['homeStreet2'] = array( 'label' => _("Home Street 2"), 'type' => 'text', 'required' => false, ); $attributes['homeStreet3'] = array( 'label' => _("Home Street 3"), 'type' => 'text', 'required' => false, ); $attributes['workStreet2'] = array( 'label' => _("Work Street 2"), 'type' => 'text', 'required' => false, ); $attributes['workStreet3'] = array( 'label' => _("Work Street 3"), 'type' => 'text', 'required' => false, ); $attributes['employeeType'] = array( 'label' => _("Employee Type"), 'type' => 'text', 'required' => false ); require_once 'Horde/Prefs/CategoryManager.php'; $cManager = &new Prefs_CategoryManager(); $categories = array_merge(array(_("Unfiled")), $cManager->get()); $attributes['category'] = array( 'label' => _("Category"), 'type' => 'enum', 'params' => array($categories), 'required' => false ); $attributes['jobtitle'] = array( 'label' => _("Job Title"), 'type' => 'text', 'required' => false, ); $attributes['profession'] = array( 'label' => _("Profession"), 'type' => 'text', 'required' => false, ); $attributes['manager'] = array( 'label' => _("Manager's Name"), 'type' => 'text', 'required' => false, ); $attributes['assistant'] = array( 'label' => _("Assistant's Name"), 'type' => 'text', 'required' => false, ); $attributes['suffix'] = array( 'label' => _("Suffix"), 'type' => 'text', 'required' => false, ); $attributes['spouse'] = array( 'label' => _("Spouse's Name"), 'type' => 'text', 'required' => false, ); $attributes['anniversary'] = array( 'label' => _("Anniversary"), 'type' => 'monthdayyear', 'params' => array(1900, null, true, 1), 'required' => false, ); $attributes['pager'] = array( 'label' => _("Pager"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['callbackPhone'] = array( 'label' => _("Callback Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['email2'] = array( 'label' => _("Email") . ' 2', 'type' => 'email', 'required' => false, 'params' => array('', 40, 255) ); $attributes['email3'] = array( 'label' => _("Email") . ' 3', 'type' => 'email', 'required' => false, 'params' => array('', 40, 255) ); $attributes['assistantPhone'] = array( 'label' => _("Assistant's Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['workPhone2'] = array( 'label' => _("Work Phone") . ' 2', 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['Phone'] = array( 'label' => _("Home Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['workFax'] = array( 'label' => _("Work Fax"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['callback'] = array( 'label' => _("Callback"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['carPhone'] = array( 'label' => _("Car Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['companyPhone'] = array( 'label' => _("Company Main Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['homePhone2'] = array( 'label' => _("Home Phone") . ' 2', 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['homeFax'] = array( 'label' => _("Home Fax") . ' 2', 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['isdn'] = array( 'label' => _("ISDN"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['otherPhone'] = array( 'label' => _("Other Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['otherFax'] = array( 'label' => _("Other Fax"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['primaryPhone'] = array( 'label' => _("Primary Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['radio'] = array( 'label' => _("Radio Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['telex'] = array( 'label' => _("Telex"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['tty/tdd'] = array( 'label' => _("TTY/TDD Phone"), 'type' => 'text', 'required' => false, 'params' => array('', 40, 25) ); $attributes['otherAddress'] = array( 'label' => '', 'type' => 'addresslink', 'required' => false, ); $attributes['otherStreet'] = array( 'label' => _("Other Street Address"), 'type' => 'text', 'required' => false, ); $attributes['otherStreet2'] = array( 'label' => _("Other Street 2"), 'type' => 'text', 'required' => false, ); $attributes['otherStreet3'] = array( 'label' => _("Other Street 3"), 'type' => 'text', 'required' => false, ); $attributes['otherCity'] = array( 'label' => _("Other City"), 'type' => 'text', 'required' => false ); $attributes['otherProvince'] = array( 'label' => _("Other State/Province"), 'type' => 'text', 'required' => false ); $attributes['otherPostalCode'] = array( 'label' => _("Other Postal Code"), 'type' => 'text', 'required' => false ); $attributes['otherCountry'] = array( 'label' => _("Other Country"), 'type' => 'text', 'required' => false ); $attributes['middlename'] = array( 'label' => _("Middle Name"), 'type' => 'text', 'required' => false );
++ Modifying sources.php //turba/config/sources.php// is the file that tells Turba which sources to use, and gives it all of the parameters for that source, such as what fields from //attributes.php// are used. Use the following for your sql source's //'map'// parameter:'map' => array( '__key' => 'object_id', '__owner' => 'owner_id', '__type' => 'object_type', '__members' => 'object_members', '__uid' => 'object_uid', 'name' => array('fields' => array('firstname', 'lastname'), 'format' => '%s %s'), 'title' => 'object_title', 'firstname' => 'object_firstname', 'middlename' => 'object_middlename', 'lastname' => 'object_lastname', 'suffix' => 'object_suffix', 'company' => 'object_company', 'department' => 'object_department', 'jobtitle' => 'object_jobtitle', 'workStreet' => 'object_workstreet', 'workStreet2' => 'object_workstreet2', 'workStreet3' => 'object_workstreet3', 'workCity' => 'object_workcity', 'workProvince' => 'object_workprovince', 'workPostalCode' => 'object_workpostalcode', 'workCountry' => 'object_workcountry', 'workAddress' => array('fields' => array('workStreet', 'workStreet2', 'workStreet3', 'workCity', 'workProvince', 'workPostalCode'), 'format' => "%s\n%s\n%s\n%s, %s %s"), 'homeStreet' => 'object_homestreet', 'homeStreet2' => 'object_homestreet2', 'homeStreet3' => 'object_homestreet3', 'homeCity' => 'object_homecity', 'homeProvince' => 'object_homeprovince', 'homePostalCode' => 'object_homepostalcode', 'homeCountry' => 'object_homecountry', 'homeAddress' => array('fields' => array('homeStreet', 'homeStreet2', 'homeStreet3', 'homeCity', 'homeProvince', 'homePostalCode'), 'format' => "%s\n%s\n%s\n%s, %s %s"), 'otherStreet' => 'object_otherstreet', 'otherStreet2' => 'object_otherstreet2', 'otherStreet3' => 'object_otherstreet3', 'otherCity' => 'object_othercity', 'otherProvince' => 'object_otherprovince', 'otherPostalCode' => 'object_otherpostalcode', 'otherCountry' => 'object_othercountry', 'otherAddress' => array('fields' => array('otherStreet', 'otherStreet2', 'otherStreet3', 'otherCity', 'otherProvince', 'otherPostalCode'), 'format' => "%s\n%s\n%s\n%s, %s %s"), 'assistantPhone' => 'object_assistantphone', 'workFax' => 'object_workfax', 'workPhone' => 'object_workphone', 'workPhone2' => 'object_workphone2', 'callback' => 'object_callback', 'carPhone' => 'object_carphone', 'companyPhone' => 'object_companyphone', 'homeFax' => 'object_homefax', 'homePhone' => 'object_homephone', 'homePhone2' => 'object_homephone2', 'isdn' => 'object_isdn', 'cellPhone' => 'object_cellphone', 'otherFax' => 'object_otherfax', 'otherPhone' => 'object_otherphone', 'pager' => 'object_pager', 'primaryPhone' => 'object_primaryphone', 'radio' => 'object_radio', 'tty/tdd' => 'object_ttytdd', 'telex' => 'object_telex', 'anniversary' => 'object_anniversary', 'assistant' => 'object_assistant', 'birthday' => 'object_birthday', 'category' => 'object_category', 'email' => 'object_email', 'email2' => 'object_email2', 'email3' => 'object_email3', 'freebusyUrl' => 'object_freebusyurl', 'manager' => 'object_manager', 'notes' => 'object_notes', 'office' => 'object_office', 'profession' => 'object_profession', 'spouse' => 'object_spouse', 'website' => 'object_website', 'alias' => 'object_alias', 'nickname' => 'object_nickname', 'pgpPublicKey' => 'object_pgppublickey', 'smimePublicKey' => 'object_smimepublickey', ),
And, use the following for your sql source's //'tabs'// parameter. This is not included in the default //sources.php//, so you will have to add it.'tabs' => array( 'General' => array('name', 'firstname', 'middlename', 'lastname', 'jobtitle', 'company', 'email', 'email2', 'email3', 'alias', 'website', 'category'), 'Phone Numbers' => array('primaryPhone', 'homePhone', 'homePhone2', 'homeFax', 'workPhone', 'workPhone2', 'workFax', 'cellPhone', 'pager', 'assistantPhone', 'callback', 'carPhone', 'companyPhone', 'isdn', 'otherPhone', 'otherFax', 'radio', 'telex', 'tty/tdd'), 'Home Address' => array('homeStreet', 'homeStreet2', 'homeStreet3', 'homeCity', 'homeProvince', 'homePostalCode', 'homeCountry', 'homeAddress'), 'Work Address' => array('workStreet', 'workStreet2', 'workStreet3', 'workCity', 'workProvince', 'workPostalCode', 'workCountry', 'workAddress'), 'Other Address' => array('otherStreet', 'otherStreet2', 'otherStreet3', 'otherCity', 'otherProvince', 'otherPostalCode', 'otherCountry', 'otherAddress'), 'Details' => array('department', 'office', 'profession', 'manager', 'assistant', 'nickname', 'title', 'suffix', 'spouse', 'birthday', 'anniversary', 'freebusyUrl', 'notes'), 'Certificates' => array('pgpPublicKey', 'smimePublicKey'), ),
++ Preparing the database The following SQL script will create a turba database table to hold all of the new fields.CREATE TABLE turba_objects ( object_id VARCHAR(32) NOT NULL, owner_id VARCHAR(255) NOT NULL, object_type VARCHAR(255) DEFAULT 'Object' NOT NULL, object_uid VARCHAR(255), object_members BLOB, object_lastname VARCHAR(255), object_alias VARCHAR(32), object_email VARCHAR(255), object_homestreet VARCHAR(255), object_homestreet3 VARCHAR(255), object_workstreet VARCHAR(255), object_workstreet3 VARCHAR(255), object_homephone VARCHAR(25), object_workphone VARCHAR(25), object_cellphone VARCHAR(25), object_workfax VARCHAR(25), object_title VARCHAR(255), object_company VARCHAR(255), object_notes TEXT, object_pgppublickey TEXT, object_smimepublickey TEXT, object_freebusyurl VARCHAR(255), object_firstname VARCHAR(255), object_homecity VARCHAR(255), object_homeprovince VARCHAR(255), object_homepostalcode VARCHAR(255), object_homecountry VARCHAR(255), object_homestreet2 VARCHAR(255), object_workstreet2 VARCHAR(255), object_workcity VARCHAR(255), object_workprovince VARCHAR(255), object_workpostalcode VARCHAR(255), object_workcountry VARCHAR(255), object_website VARCHAR(255), object_birthday VARCHAR(255), object_nickname VARCHAR(255), object_office VARCHAR(255), object_jobtitle VARCHAR(255), object_profession VARCHAR(255), object_manager VARCHAR(255), object_assistant VARCHAR(255), object_suffix VARCHAR(255), object_spouse VARCHAR(255), object_anniversary VARCHAR(255), object_email2 VARCHAR(255), object_email3 VARCHAR(255), object_category VARCHAR(255), object_assistantphone VARCHAR(25), object_workphone2 VARCHAR(25), object_callback VARCHAR(255), object_carphone VARCHAR(25), object_companyphone VARCHAR(25), object_homephone2 VARCHAR(25), object_homefax VARCHAR(25), object_isdn VARCHAR(255), object_otherphone VARCHAR(25), object_otherfax VARCHAR(25), object_pager VARCHAR(25), object_primaryphone VARCHAR(25), object_radio VARCHAR(255), object_telex VARCHAR(255), object_ttytdd VARCHAR(255), object_otherstreet VARCHAR(255), object_otherstreet2 VARCHAR(255), object_otherstreet3 VARCHAR(255), object_othercity VARCHAR(255), object_otherprovince VARCHAR(255), object_otherpostalcode VARCHAR(255), object_othercountry VARCHAR(255), object_middlename VARCHAR(255), object_department VARCHAR(255), -- PRIMARY KEY(object_id) ); CREATE INDEX turba_owner_idx ON turba_objects (owner_id); GRANT SELECT, INSERT, UPDATE, DELETE ON turba_objects TO horde;
wicked-2.0.8/lib/Text_Wiki/tests/fixtures/mediawiki_syntax.txt 0000664 0001750 0001750 00000014505 13160726737 022716 0 ustar jan jan #REDIRECT [[Some page name]] #redirect [[Other page name]] [http://www.example.com See the example site] [http://www.somelink.com/index.php] http://example.com/index.php '''Bold text''' and ''italic text'' and even '''''bold italic text''''' '''Bold text''' and ''italic text'' and even '''''bold italic text''''' some text '''bold then ''italic'' then bold''' more text ''italic then '''bold''' then italic again'' some text '''''bold and italic''''' '''''bold and italic'' and bold''' '''''bold and italic''' and italic'' '''bold and ''bold and italic''''' ''italic and '''bold and italic''''' =Level 1 heading= Lorem ipsum dolor sit amet, [http://exemple.com/index.php consectetur adipiscing] elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. [http://exemple.com/index.php#anchor Pellentesque] sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ==Level 2 heading== '''Lorem ipsum dolor sit amet''', consectetur ''adipiscing elit''. '''''Etiam commodo felis''''' vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ==Level 2 heading== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ====Level 4 heading==== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem [[convallis elementum]] vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. [[Etiam]] commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. =====Level 5 heading===== Lorem ipsum dolor sit amet, [[consectetur adipiscing]] elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ======Level 6 heading====== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, [[cursus]] nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. {| | A || B |- | C || D |}
Horizontal line: ---- Can be 4 hyphens or more: ------ * List * List ** List ** List *** List * List * List Invalid horizontal rule --- # List # List ## List ## List ### List # List # List ;Definition lists ;item : definition ;semicolon plus term :colon plus definition Mixed list: * List example ** List example **# List example **# List example *** List example **** List example *# List example *# List example ** List example * List example ** List example ** List example **# List example wicked-2.0.8/lib/Text_Wiki/tests/fixtures/mediawiki_syntax_to_test_preformatted.txt 0000664 0001750 0001750 00000000375 13160726737 027233 0 ustar jan janThe pre tag ignores [[Wiki]] ''markup''. It also doesn't reformat text. It still interprets special characters: →pre tag without line breakSome textsome ''text'' without '''wiki''' parsingmore text wicked-2.0.8/lib/Text_Wiki/tests/fixtures/mediawiki_syntax_to_test_raw.txt 0000664 0001750 0001750 00000000344 13160726737 025324 0 ustar jan janThe nowiki tag ignores [[Wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets special characters: → Some text''ignores markup'' more text wicked-2.0.8/lib/Text_Wiki/tests/fixtures/mediawiki_syntax_to_test_wikilink.txt 0000664 0001750 0001750 00000013662 13160726737 026363 0 ustar jan jan [http://www.example.com] [http://www.example.com See the example site] '''Bold text''' and ''italic text'' and even '''''bold italic text''''' '''Bold then into ''italics'' and bold again''' ''going to italics '''then bold''''' =Level 1 heading= Lorem ipsum dolor sit amet, [http://exemple.com/index.php consectetur adipiscing] elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. [http://exemple.com/index.php#anchor Pellentesque] sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ==Level 2 heading== '''Lorem ipsum dolor sit amet''', consectetur ''adipiscing elit''. '''''Etiam commodo felis''''' vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ==Level 2 heading== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ====Level 4 heading==== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem [[convallis elementum]] vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ===Level 3 heading=== Lorem ipsum dolor sit amet, consectetur adipiscing elit. [[Etiam]] commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. =====Level 5 heading===== Lorem ipsum dolor sit amet, [[consectetur adipiscing]] elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. ======Level 6 heading====== Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, [[cursus]] nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Horizontal line: ---- Can be 4 hyphens or more: ------ [[pt:Language link]] [[Image:someImagePath]] * List * List ** List ** List *** List * List * List Invalid horizontal rule --- # List # List ## List ## List ### List # List # List Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. [[Donec sagittis|description text]] turpis nec erat dictum a ultrices enim mollis. wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_lists_output.txt 0000664 0001750 0001750 00000001554 13160726737 026727 0 ustar jan jan !!Other Glossaries {img src="img/wiki_up/Swiss-army-knife1.jpg" alt="Swiss-army-knife1.jpg"} * We were inspired by the [http://www.wikipedia.org/|Wikipedia] share-alike dictionary * The [http://glossarist.com/|Glossarist] gives access to a huge range of Glossaries * Looking for a particular word? [http://thesaurus.reference.com/|Roget's Thesaurus] helps you find it * Check out new words in the [http://www.wordspy.com/|WordSpy] dictionary * Here is an [http://www.pbs.org/art21/education/glossary_pop.html|Art-related Glossary] * You may be interested in [http://www.cooper.edu/art/techno/essays/gloss.html|Roy Ascott's glossary] of neologisms for art and technology (1996) * See the Attainable Utopias [http://attainable-utopias.org/tiki/tiki-index.php?page=NewDefinitions|AU Glossary] page return to [http://writing-pad.org/glossary/index.php/Main_Page|Main Page] wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_lists_source.txt 0000664 0001750 0001750 00000001505 13160726737 026663 0 ustar jan jan ==Other Glossaries== [[Image:Swiss-army-knife1.jpg]] * We were inspired by the [http://www.wikipedia.org/ Wikipedia] share-alike dictionary * The [http://glossarist.com/ Glossarist] gives access to a huge range of Glossaries * Looking for a particular word? [http://thesaurus.reference.com/ Roget's Thesaurus] helps you find it * Check out new words in the [http://www.wordspy.com/ WordSpy] dictionary * Here is an [http://www.pbs.org/art21/education/glossary_pop.html Art-related Glossary] * You may be interested in [http://www.cooper.edu/art/techno/essays/gloss.html Roy Ascott's glossary] of neologisms for art and technology (1996) * See the Attainable Utopias [http://attainable-utopias.org/tiki/tiki-index.php?page=NewDefinitions AU Glossary] page return to [http://writing-pad.org/glossary/index.php/Main_Page Main Page] wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_output.txt 0000664 0001750 0001750 00000013603 13160726737 025507 0 ustar jan jan __Alexander Sutherland Neill__ (((Forfar)), ((Escócia)), ((17 de outubro)) de ((1883)) - ((23 de setembro)) de ((1973))), ((educador)), ((Literatura|escritor)) e fundador da escola ((Summerhill)). Ficou famoso por defender a liberdade das crianças na educação escolar. !!Vida Filho de uma numerosa família, seu pai, um mestre-escola, usava um bastão de ferro para disciplinar a classe. Trabalhou um tempo como auxiliar do seu pai e aos 25 anos de idade foi para a ((Universidade de Edimburgo)) onde se graduou em Inglês. Em ((1914)), se tornou diretor de uma pequena escola em ((Gretna Greem)) e lá escreveu ''A Dominie Log'' (O mestre inconsciente), o seu primeiro livro. Já nessa publicação, manisfesta seu descontentamento com a escola tradicional. Em ((1917)) visitou ((Little Commonwealth)), uma instituição para jovens delinqüentes que funcionava com base no princípio do auto-governo. ((Homer Lane)), que coordenava o reformatório, introduziu Neill a dois elementos que foram essenciais em sua prática pedagógica: o auto-governo e a importância do bem-estar emocional das crianças. Em ((1921)) fundou a ((International Schoool)), que mudou de sede por algumas vezes até se estabelecer em ((Leiston)), condado de ((Suffolk)), a 160 quilômetros de ((Londres)), passando então a se chamar ((Summerhill)). Casou duas vezes. Sua segunda mulher, Ena Wood Neill, administrou Summerhill junto com ele por algumas décadas até que a filha do casal, Zoe Readhead, assumiu o cargo. !!Summerhill Na área da educação, o educador britânico ((Homer Lane)) foi a principal influência de Neill. Ele também era um grande admirador e amigo do ((psicanalista)) ((Wilhelm Reich)) e se dedicava aos estudos da teoria ((freud))iana. O autor acreditava que a felicidade é fundamental para o desenvolvimento das crianças e que essa felicidade tem origem num senso de liberdade das mesmas. Para ele, as escolas tradicionais privam de liberdade seus alunos e as consequências da infelicidade vivida pelas crianças reprimidas estão na origem da maioria dos problemas psicológicos da vida adulta. A fundação de Summerhill deu formato as propostas pedagógicas de Neill, distintas da linha hegemônica da época. Sustentava que os jovens devem ser estimulados a aprender em um ambiente de liberdade e de responsabilidade. Influenciado pelo pós-((I Guerra Mundial)), o autor parte do princípio de que a humanidade está doente e essa doença decorre do tratamento repressivo que as crianças recebem numa sociedade patriarcal. Inclusive nas questões ligadas à repressão sexual, em especial quando associadas a normas religiosas mal compreendidas. Responde a isso afirmando que toda criança tem direito à liberdade e que um grupo de crianças se auto-regula, estabelecendo em conjunto as próprias normas. "Para resumir, meu ponto de vista é que a educação sem liberdade resulta numa vida que não pode ser integralmente vivida. Tal educação ignora quase inteiramente as emoções da vida, e porque essas emoções são dinâmicas, a falta de oportunidade de expressão deve resultar, e resulta, em insignificância, em fealdade, em hostilidade. Apenas a cabeça é instruída. Se as emoções tivessem livre expansão, o intelecto saberia cuidar de si próprio." (NEILL, 1963, p.93) Em Summerhill, as crianças não são obrigadas a assistir as aulas e, além disso, as decisões da escola são tomadas em assembléias onde todos votam, incluindo professores, alunos e funcionários. Para o autor, a experiência nessa escola mostrou que, sem a coerção das escolas tradicionais, os estudantes orientam sua aprendizagem através do seu próprio interesse, ao invés de orientar pelo que lhe é imposto. !!Heading Na escola, nenhum adulto tem mais direitos que uma criança, todos tem direitos iguais. Nesse sentido o autor destaca a diferença entre os conceitos de liberdade e licença. Para Neill todos devem ser livres, porém isso não implica numa liberdade sem limites. Ninguém tem licença para interferir no espaço de outra pessoa e, ao mesmo tempo, todos têm total liberdade para fazerem o que quiserem no que disser respeito a si próprio. Por isso que ninguém deve determinar quais aulas uma criança deve freqüentar. Mas, ao mesmo tempo, ninguém tem direito de atrapalhar uma atividade coletiva. Liberdade não pode significar direito de fazer o que bem quiser a hora que quiser. Excesso de liberdade se transforma em licenciosidade. Neill criticava a escola tradicional também por enfatizar demais o lado racional das pessoas, em detrimento do lado emocional. Nesse sentido, em sua escola o teatro, a dança, os trabalhos manuais, ganham um destaque grande frente às disciplinas tradicionais. As aulas das matérias convencionais existem, mas não são o centro da escola. Como diretor, ele dava aulas de álgebra, geometria e trabalhos manuais. Geralmente dizia que admirava mais aqueles que possuíam habilidades para o trabalho manual do que aqueles que se restringiam ao trabalho intelectual. Durante um período trabalhava individualmente com alguns alunos numa espécie de sessão de terapia. Após algum tempo abandonou esse trabalho individual, pois concluiu que com as sessões ou sem os alunos resolviam seus problemas de qualquer forma. A liberdade era a responsável por isso. !!Obras *((1960)): ''Liberdade sem medo'' (''Sumerhill'') *((1966)): ''Liberdade sem excesso'' (''Freedom - Not License!'') *((1967)): ''Liberdade no lar'' (''The problem family'') *((1967)): ''Liberdade na escola'' (''Talking of Summerhill'') !!Referências * NEILL, A. S. “Liberdade sem medo”. São Paulo: Ibrasa, 1963. !!Ver também *((Escola da Ponte)) *((Escolas democráticas)) *((Pedagogia libertária)) !!Ligações externas *[http://www.summerhillschool.co.uk|Summerhill Schooll] ~pp~The pre tag ignores [[Wiki]] ''markup''. It also doesn't reformat text. It still interprets special characters: →~/pp~ ~pp~pre tag without line break~/pp~ wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_redirect_output.txt 0000664 0001750 0001750 00000000104 13160726737 027360 0 ustar jan jan {redirect page="Some page name"} {redirect page="Other page name"} wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_redirect_source.txt 0000664 0001750 0001750 00000000073 13160726737 027325 0 ustar jan jan #REDIRECT [[Some page name]] #redirect [[Other page name]] wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_to_tiki_source.txt 0000664 0001750 0001750 00000013637 13160726737 025456 0 ustar jan jan '''Alexander Sutherland Neill''' ([[Forfar]], [[Escócia]], [[17 de outubro]] de [[1883]] - [[23 de setembro]] de [[1973]]), [[educador]], [[Literatura|escritor]] e fundador da escola [[Summerhill]]. Ficou famoso por defender a liberdade das crianças na educação escolar. ==Vida== Filho de uma numerosa família, seu pai, um mestre-escola, usava um bastão de ferro para disciplinar a classe. Trabalhou um tempo como auxiliar do seu pai e aos 25 anos de idade foi para a [[Universidade de Edimburgo]] onde se graduou em Inglês. Em [[1914]], se tornou diretor de uma pequena escola em [[Gretna Greem]] e lá escreveu ''A Dominie Log'' (O mestre inconsciente), o seu primeiro livro. Já nessa publicação, manisfesta seu descontentamento com a escola tradicional. Em [[1917]] visitou [[Little Commonwealth]], uma instituição para jovens delinqüentes que funcionava com base no princípio do auto-governo. [[Homer Lane]], que coordenava o reformatório, introduziu Neill a dois elementos que foram essenciais em sua prática pedagógica: o auto-governo e a importância do bem-estar emocional das crianças. Em [[1921]] fundou a [[International Schoool]], que mudou de sede por algumas vezes até se estabelecer em [[Leiston]], condado de [[Suffolk]], a 160 quilômetros de [[Londres]], passando então a se chamar [[Summerhill]]. Casou duas vezes. Sua segunda mulher, Ena Wood Neill, administrou Summerhill junto com ele por algumas décadas até que a filha do casal, Zoe Readhead, assumiu o cargo. ==Summerhill== Na área da educação, o educador britânico [[Homer Lane]] foi a principal influência de Neill. Ele também era um grande admirador e amigo do [[psicanalista]] [[Wilhelm Reich]] e se dedicava aos estudos da teoria [[freud]]iana. O autor acreditava que a felicidade é fundamental para o desenvolvimento das crianças e que essa felicidade tem origem num senso de liberdade das mesmas. Para ele, as escolas tradicionais privam de liberdade seus alunos e as consequências da infelicidade vivida pelas crianças reprimidas estão na origem da maioria dos problemas psicológicos da vida adulta. A fundação de Summerhill deu formato as propostas pedagógicas de Neill, distintas da linha hegemônica da época. Sustentava que os jovens devem ser estimulados a aprender em um ambiente de liberdade e de responsabilidade. Influenciado pelo pós-[[I Guerra Mundial]], o autor parte do princípio de que a humanidade está doente e essa doença decorre do tratamento repressivo que as crianças recebem numa sociedade patriarcal. Inclusive nas questões ligadas à repressão sexual, em especial quando associadas a normas religiosas mal compreendidas. Responde a isso afirmando que toda criança tem direito à liberdade e que um grupo de crianças se auto-regula, estabelecendo em conjunto as próprias normas. "Para resumir, meu ponto de vista é que a educação sem liberdade resulta numa vida que não pode ser integralmente vivida. Tal educação ignora quase inteiramente as emoções da vida, e porque essas emoções são dinâmicas, a falta de oportunidade de expressão deve resultar, e resulta, em insignificância, em fealdade, em hostilidade. Apenas a cabeça é instruída. Se as emoções tivessem livre expansão, o intelecto saberia cuidar de si próprio." (NEILL, 1963, p.93) Em Summerhill, as crianças não são obrigadas a assistir as aulas e, além disso, as decisões da escola são tomadas em assembléias onde todos votam, incluindo professores, alunos e funcionários. Para o autor, a experiência nessa escola mostrou que, sem a coerção das escolas tradicionais, os estudantes orientam sua aprendizagem através do seu próprio interesse, ao invés de orientar pelo que lhe é imposto. == Heading == Na escola, nenhum adulto tem mais direitos que uma criança, todos tem direitos iguais. Nesse sentido o autor destaca a diferença entre os conceitos de liberdade e licença. Para Neill todos devem ser livres, porém isso não implica numa liberdade sem limites. Ninguém tem licença para interferir no espaço de outra pessoa e, ao mesmo tempo, todos têm total liberdade para fazerem o que quiserem no que disser respeito a si próprio. Por isso que ninguém deve determinar quais aulas uma criança deve freqüentar. Mas, ao mesmo tempo, ninguém tem direito de atrapalhar uma atividade coletiva. Liberdade não pode significar direito de fazer o que bem quiser a hora que quiser. Excesso de liberdade se transforma em licenciosidade. Neill criticava a escola tradicional também por enfatizar demais o lado racional das pessoas, em detrimento do lado emocional. Nesse sentido, em sua escola o teatro, a dança, os trabalhos manuais, ganham um destaque grande frente às disciplinas tradicionais. As aulas das matérias convencionais existem, mas não são o centro da escola. Como diretor, ele dava aulas de álgebra, geometria e trabalhos manuais. Geralmente dizia que admirava mais aqueles que possuíam habilidades para o trabalho manual do que aqueles que se restringiam ao trabalho intelectual. Durante um período trabalhava individualmente com alguns alunos numa espécie de sessão de terapia. Após algum tempo abandonou esse trabalho individual, pois concluiu que com as sessões ou sem os alunos resolviam seus problemas de qualquer forma. A liberdade era a responsável por isso. ==Obras== *[[1960]]: ''Liberdade sem medo'' (''Sumerhill'') *[[1966]]: ''Liberdade sem excesso'' (''Freedom - Not License!'') *[[1967]]: ''Liberdade no lar'' (''The problem family'') *[[1967]]: ''Liberdade na escola'' (''Talking of Summerhill'') ==Referências== * NEILL, A. S. “Liberdade sem medo”. São Paulo: Ibrasa, 1963. ==Ver também== *[[Escola da Ponte]] *[[Escolas democráticas]] *[[Pedagogia libertária]] ==Ligações externas== *[http://www.summerhillschool.co.uk Summerhill Schooll]The pre tag ignores [[Wiki]] ''markup''. It also doesn't reformat text. It still interprets special characters: →pre tag without line breakwicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_mediawiki_wikilink_expected_matches.php 0000664 0001750 0001750 00000002474 13160726737 027607 0 ustar jan jan array( 0 => '[[convallis elementum]]', 1 => '[[Etiam]]', 2 => '[[consectetur adipiscing]]', 3 => '[[cursus]]', 4 => '[[pt:Language link]]', 5 => '[[Image:someImagePath]]', 6 => '[[Donec sagittis|description text]]', ), 1 => array ( 0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '', ), 2 => array( 0 => '', 1 => '', 2 => '', 3 => '', 4 => 'pt:', 5 => 'Image:', 6 => '', ), 3 => array( 0 => 'convallis elementum', 1 => 'Etiam', 2 => 'consectetur adipiscing', 3 => 'cursus', 4 => 'Language link', 5 => 'someImagePath', 6 => 'Donec sagittis', ), 4 => array( 0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '', ), 5 => array( 0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => 'description text', ), 6 => array( 0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '', ), ); ?> wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_tiki_heading_expected_matches.php 0000664 0001750 0001750 00000013515 13160726737 026360 0 ustar jan jan array( 0 => " ! Heading 1 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 1 => " !! Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 2 => " !!!Heading 3 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 3 => " !!- Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 4 => " !!+ Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. " ), 1 => array(0 => "\n", 1 => "\n", 2 => "\n", 3 => "\n", 4 => "\n"), 2 => array(0 => "!", 1 => "!!", 2 => "!!!", 3 => "!!", 4 => "!!"), 3 => array(0 => "", 1 => "", 2 => "", 3 => "-", 4 => "+"), 4 => array(0 => " Heading 1", 1 => " Heading 2", 2 => "Heading 3", 3 => " Heading 2", 4 => " Heading 2"), 5 => array( 0 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 1 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 2 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 3 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 4 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", ), ); ?> wicked-2.0.8/lib/Text_Wiki/tests/fixtures/test_tiki_to_tiki_heading_source.txt 0000664 0001750 0001750 00000000420 13160726737 026114 0 ustar jan jan !! heading 1 with new line some text after the heading with a new line before !!heading 2 without new line some text right after the heading !!heading 3 two heading almost togheter !! heading 4 text after heading that has now new line to separate from the last heading wicked-2.0.8/lib/Text_Wiki/tests/fixtures/text_wiki_sample_mediawiki_syntax.txt 0000664 0001750 0001750 00000012327 13160726737 026346 0 ustar jan jan [http://www.example.com] [http://www.example.com See the example site] Lorem ipsum dolor sit amet, [http://exemple.com/index.php consectetur adipiscing] elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. [http://exemple.com/index.php#anchor Pellentesque] sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. '''Lorem ipsum dolor sit amet''', consectetur ''adipiscing elit''. '''''Etiam commodo felis''''' vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Horizontal line: ---- Can be 4 hyphens or more: ------ * List * List ** List ** List *** List * List * List # List # List ## List ## List ### List # List # List wicked-2.0.8/lib/Text_Wiki/tests/fixtures/text_wiki_sample_syntax_transformed_to_plain.txt 0000664 0001750 0001750 00000012231 13160726737 030606 0 ustar jan jan http://www.example.com See the example site Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Horizontal line: Can be 4 hyphens or more: List List List List List List List List List List List List List List wicked-2.0.8/lib/Text_Wiki/tests/fixtures/text_wiki_sample_syntax_transformed_to_plain2.txt 0000664 0001750 0001750 00000012231 13160726737 030670 0 ustar jan jan http://www.example.com See the example site Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris. Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis. Horizontal line: Can be 4 hyphens or more: List List List List List List List List List List List List List List wicked-2.0.8/lib/Text_Wiki/tests/fixtures/text_wiki_sample_syntax_transformed_to_xhtml.txt 0000664 0001750 0001750 00000013724 13160726737 030647 0 ustar jan janLorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis vitae sem convallis elementum vel a mauris. Sed rhoncus dapibus orci ullamcorper tempor. Mauris tortor ante, hendrerit ut scelerisque ut, aliquet blandit metus. Morbi fermentum vulputate mi ac sagittis. Suspendisse in vehicula mauris.
Pellentesque sed luctus metus. Morbi posuere euismod placerat. Aliquam erat volutpat. Phasellus elit quam, cursus nec fringilla nec, egestas a libero. Integer aliquet gravida sem. Donec sagittis turpis nec erat dictum a ultrices enim mollis.
Horizontal line:
Can be 4 hyphens or more:
- List
- List
- List
- List
- List
- List
- List
wicked-2.0.8/lib/Text_Wiki/tests/fixtures/tiki_syntax.txt 0000664 0001750 0001750 00000005436 13160726737 021716 0 ustar jan jan [http://www.example.com/page|An example page] some text that is not an URL [http://www.example.com/page.php#anchor|Other example page] ! Heading 1 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. !! Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. !!!Heading 3 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. !!- Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. !!+ Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. wicked-2.0.8/lib/Text_Wiki/tests/AllTests.php 0000664 0001750 0001750 00000002626 13160726737 017200 0 ustar jan jan addTestSuite($phptTests); */ $suite->addTestSuite('Text_Wiki_Tests'); $suite->addTestSuite('Text_Wiki_Render_Tests'); //TODO: integrate Text_Wiki_Parse_Tiki_AllTests //$suite->addTestSuite('Text_Wiki_Parse_Tiki_AllTests'); $suite->addTestSuite('Text_Wiki_Render_Tiki_AllTests'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_AllTests'); $suite->addTestSuite('Text_Wiki_Generic_Transform_Tests'); /** * @desc This suite currently 'fails' when run through here. * Standalone works. */ $suite->addTestSuite('Text_Wiki_BugTests'); return $suite; } } wicked-2.0.8/lib/Text_Wiki/tests/Cowiki_Render_Url.phpt 0000664 0001750 0001750 00000000635 13160726737 021175 0 ustar jan jan --TEST-- Text_Wiki_Cowiki_Render_Url --FILE-- transform(' [[http://www.example.com/page|An example page]] [[http://www.example.com/page]] http://www.example.com/page ', 'Cowiki')); ?> --EXPECT-- string(106) " ((http://www.example.com/page)(An example page)) http://www.example.com/page http://www.example.com/page " wicked-2.0.8/lib/Text_Wiki/tests/Creole_Parse_Url.phpt 0000664 0001750 0001750 00000002214 13160726737 021007 0 ustar jan jan --TEST-- Text_Wiki_Creole_Parse_Url --FILE-- parse(' [[http://www.example.com/page|An example page]] [[http://www.example.com/page]] http://www.example.com/page ', 'Creole'); var_dump($t->source); var_dump($t->tokens); ?> --EXPECT-- string(31) " 0An example page1 2 3 " array(4) { [0]=> array(2) { [0]=> string(3) "Url" [1]=> array(3) { ["type"]=> string(5) "start" ["href"]=> string(27) "http://www.example.com/page" ["text"]=> string(15) "An example page" } } [1]=> array(2) { [0]=> string(3) "Url" [1]=> array(3) { ["type"]=> string(3) "end" ["href"]=> string(27) "http://www.example.com/page" ["text"]=> string(15) "An example page" } } [2]=> array(2) { [0]=> string(3) "Url" [1]=> array(1) { ["href"]=> string(27) "http://www.example.com/page" } } [3]=> array(2) { [0]=> string(3) "Url" [1]=> array(1) { ["href"]=> string(27) "http://www.example.com/page" } } } wicked-2.0.8/lib/Text_Wiki/tests/Creole_Render_Url.phpt 0000664 0001750 0001750 00000000644 13160726737 021161 0 ustar jan jan --TEST-- Text_Wiki_Creole_Render_Url --FILE-- transform(' [[http://www.example.com/page|An example page]] [[http://www.example.com/page]] http://www.example.com/page ', 'Creole')); ?> --EXPECT-- string(113) " [[http://www.example.com/page|An example page]] [[http://www.example.com/page]] [[http://www.example.com/page]] " wicked-2.0.8/lib/Text_Wiki/tests/Default_Parse_BlockQuote.phpt 0000664 0001750 0001750 00000001741 13160726737 022474 0 ustar jan jan --TEST-- Text_Wiki_Default_Blockquote --FILE-- parse(' > test 1 > test 2 >> test 11 >> test 22 ', 'Xhtml'); var_dump($t->source); var_dump($t->tokens); ?> --EXPECT-- string(43) " 0test 1 test 2 1test 11 test 22 23" array(4) { [0]=> array(2) { [0]=> string(10) "Blockquote" [1]=> array(2) { ["type"]=> string(5) "start" ["level"]=> int(1) } } [1]=> array(2) { [0]=> string(10) "Blockquote" [1]=> array(2) { ["type"]=> string(5) "start" ["level"]=> int(2) } } [2]=> array(2) { [0]=> string(10) "Blockquote" [1]=> array(2) { ["type"]=> string(3) "end" ["level"]=> int(2) } } [3]=> array(2) { [0]=> string(10) "Blockquote" [1]=> array(2) { ["type"]=> string(3) "end" ["level"]=> int(1) } } } wicked-2.0.8/lib/Text_Wiki/tests/Docbook_Render_Url.phpt 0000664 0001750 0001750 00000000602 13160726737 021322 0 ustar jan jan --TEST-- Text_Wiki_Docbook_Render_Url --FILE-- transform(' [http://www.example.com/page An example page] http://www.example.com/page ', 'Docbook'); ?> --EXPECT-- An example page http://www.example.com/page wicked-2.0.8/lib/Text_Wiki/tests/Doku_Render_Url.phpt 0000664 0001750 0001750 00000000630 13160726737 020645 0 ustar jan jan --TEST-- Text_Wiki_Doku_Render_Url --FILE-- transform(' [[http://www.example.com/page|An example page]] [[http://www.example.com/page]] http://www.example.com/page ', 'Doku')); ?> --EXPECT-- string(105) " [[http://www.example.com/page|An example page]] http://www.example.com/page http://www.example.com/page " wicked-2.0.8/lib/Text_Wiki/tests/Latex_Render_Url.phpt 0000664 0001750 0001750 00000000726 13160726737 021026 0 ustar jan jan --TEST-- Text_Wiki_Latex_Render_Url --FILE-- transform(' [http://www.example.com/page An example page] http://www.example.com/page ', 'Latex'); ?> --EXPECT-- \documentclass{article} \usepackage{ulem} \pagestyle{headings} \begin{document} An example page\footnote{http://www.example.com/page} http://www.example.com/page\footnote{http://www.example.com/page} \end{document} wicked-2.0.8/lib/Text_Wiki/tests/Plain_Render_Url.phpt 0000664 0001750 0001750 00000000453 13160726737 021011 0 ustar jan jan --TEST-- Text_Wiki_Plain_Render_Url --FILE-- transform(' [http://www.example.com/page An example page] http://www.example.com/page ', 'Plain'); ?> --EXPECT-- An example page http://www.example.com/page wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_BugTests.php 0000664 0001750 0001750 00000002572 13160726737 021174 0 ustar jan jan wiki = Text_Wiki::factory('Default'); } protected function tearDown() { unset($this->wiki); } /** * @see http://pear.php.net/bugs/bug.php?id=18289 */ public function test18289() { $text = <<
- List
- List
- List
- List
- List
- List
- List
wiki->transform($text); // strip all whitespace to make assertEquals() easier $html = preg_replace('/\s+/','',$html); $assertion = ' '; $this->assertEquals($assertion, $html); } /** *
- level1
'; $assertion .= '
- level2
- level1
- level2
parsing fails ("blank page") for large data. Let's make sure it works. * * @uses fixtures/bug11649.txt * @see http://pear.php.net/bugs/bug11649 */ public function testbug11649() { $data = file_get_contents(dirname(__FILE__) . '/fixtures/bug11649.txt'); $html = $this->wiki->transform($data); $this->assertTrue(is_string($html)); } } wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Generic_Transform_Tests.php 0000664 0001750 0001750 00000003266 13160726737 024226 0 ustar jan jan parseConf['Wikilink']['spaceUnderscore'] = false; $source = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_source.txt'); $expectedResult = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_output.txt'); $this->assertEquals($expectedResult, $obj->transform($source, 'Tiki')); } public function testTransformFromMediawikiToTikiListSyntax() { $obj = Text_Wiki::factory('Mediawiki'); $obj->parseConf['Wikilink']['spaceUnderscore'] = false; $source = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_lists_source.txt'); $expectedResult = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_lists_output.txt'); $this->assertEquals($expectedResult, $obj->transform($source, 'Tiki')); } public function testTransformFromMediawikiToTikiRedirectSyntax() { $obj = Text_Wiki::factory('Mediawiki'); $obj->parseConf['Wikilink']['spaceUnderscore'] = false; $source = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_redirect_source.txt'); $expectedResult = file_get_contents(dirname(__FILE__) . '/fixtures/test_mediawiki_to_tiki_redirect_output.txt'); $this->assertEquals($expectedResult, $obj->transform($source, 'Tiki')); } } wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Parse_Mediawiki_Tests.php 0000664 0001750 0001750 00000076645 13160726737 023667 0 ustar jan jan addTestSuite('Text_Wiki_Parse_Mediawiki_Break_Test'); /*$suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Code_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Comment_Test');*/ $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Deflist_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Emphasis_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Heading_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Horiz_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_List_Test'); //$suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Newline_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Preformatted_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Raw_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Redirect_Test'); /*$suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Subscript_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Superscript_Test');*/ $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Table_Test'); //$suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Tt_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Url_Test'); $suite->addTestSuite('Text_Wiki_Parse_Mediawiki_Wikilink_Test'); return $suite; } } class Text_Wiki_Parse_Mediawiki_SetUp_Tests extends PHPUnit_Framework_TestCase { protected function setUp() { $obj = Text_Wiki::factory('Mediawiki'); $testClassName = get_class($this); $ruleName = preg_replace('/Text_Wiki_Parse_Mediawiki_(.+?)_Test/', '\\1', $testClassName); $this->className = 'Text_Wiki_Parse_' . $ruleName; $this->t = new $this->className($obj); if (file_exists(dirname(__FILE__) . '/fixtures/mediawiki_syntax_to_test_' . strtolower($ruleName) . '.txt')) { $this->fixture = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax_to_test_' . strtolower($ruleName) . '.txt'); } else { $this->fixture = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax.txt'); } preg_match_all($this->t->regex, $this->fixture, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Break_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseBreakProcess() { $matches1 = array(0 => '
'); $matches2 = array(0 => '
'); $this->assertRegExp('/\d+?/', $this->t->process($matches1)); $this->assertRegExp('/\d+?/', $this->t->process($matches2)); $tokens = array(0 => array(0 => 'Break', 1 => array()), 1 => array(0 => 'Break', 1 => array())); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseBreakRegex() { $expectedResult = array(0 => array(0 => '
', 1 => '
')); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Deflist_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseDeflistProcess() { $matches1 = array( 0 => "\n;Definition lists\n;item : definition\n;semicolon plus term\n:colon plus definition\n", 1 => ";Definition lists\n;item : definition\n;semicolon plus term\n:colon plus definition\n", ); $this->assertRegExp("/\d+?\d+?Definition lists\d+?\d+?item\d+?\d+?definition\d+?\d+?semicolon plus term\d+?\d+?colon plus definition\d+?\d+?/", $this->t->process($matches1)); $tokens = array( 2 => array(0 => 'Deflist', 1 => array('type' => 'list_start', 'level' => 0)), 3 => array(0 => 'Deflist', 1 => array('type' => 'term_start', 'level' => 1, 'count' => 0, 'first' => true)), 4 => array(0 => 'Deflist', 1 => array('type' => 'term_end', 'level' => 1, 'count' => 0)), 5 => array(0 => 'Deflist', 1 => array('type' => 'term_start', 'level' => 1, 'count' => 1, 'first' => false)), 6 => array(0 => 'Deflist', 1 => array('type' => 'term_end', 'level' => 1, 'count' => 1)), 7 => array(0 => 'Deflist', 1 => array('type' => 'narr_start', 'level' => 1, 'count' => 2, 'first' => false)), 8 => array(0 => 'Deflist', 1 => array('type' => 'narr_end', 'level' => 1, 'count' => 2)), 9 => array(0 => 'Deflist', 1 => array('type' => 'term_start', 'level' => 1, 'count' => 3, 'first' => false)), 10 => array(0 => 'Deflist', 1 => array('type' => 'term_end', 'level' => 1, 'count' => 3)), 11 => array(0 => 'Deflist', 1 => array('type' => 'narr_start', 'level' => 1, 'count' => 4, 'first' => false)), 12 => array(0 => 'Deflist', 1 => array('type' => 'narr_end', 'level' => 1, 'count' => 4)), 13 => array(0 => 'Deflist', 1 => array('type' => 'list_end', 'level' => 0)) ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseDeflistRegex() { $expectedResult = array( 0 => array( 0 => " ;Definition lists ;item : definition ;semicolon plus term :colon plus definition ", ), 1 => array( 0 => ";Definition lists ;item : definition ;semicolon plus term :colon plus definition ", ), ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Emphasis_Test extends PHPUnit_Framework_TestCase { public function testMediawikiParseEmphasisParse() { $obj = $this->getMock('Text_Wiki_Parse_Emphasis', array('process'), array(), 'Text_Wiki_Parse_Emphasis_Parse_Mock', false); $obj->wiki = $this->getMock('Text_Wiki'); $obj->wiki->source = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax.txt'); $lines = explode("\n", $obj->wiki->source); $i = count($lines); $obj->expects($this->exactly($i))->method('process'); $obj->parse(); } public function testMediawikiParseEmphasisProcess() { $textwiki = Text_Wiki::factory('Mediawiki'); $obj = new Text_Wiki_Parse_Emphasis($textwiki); $lines = array( "'''Bold text''' and ''italic text'' and even '''''bold italic text'''''", "'''Bold text''' and ''italic text'' and even '''''bold italic text''''' some text '''bold then ''italic'' then bold''' more text ''italic then '''bold''' then italic again'' some text '''''bold and italic'''''", "'''''bold and italic''' and italic''", "''italic and '''bold and italic'''''" ); foreach ($lines as $line) { $obj->process($line); } $expectedResult = array( 14 => array(0 => 'Strong', 1 => array('type' => 'start')), 15 => array(0 => 'Strong', 1 => array('type' => 'end')), 16 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 17 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 18 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 19 => array(0 => 'Strong', 1 => array('type' => 'start')), 20 => array(0 => 'Strong',1 => array('type' => 'end')), 21 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 22 => array(0 => 'Strong', 1 => array('type' => 'start')), 23 => array(0 => 'Strong', 1 => array('type' => 'end')), 24 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 25 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 26 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 27 => array(0 => 'Strong', 1 => array('type' => 'start')), 28 => array(0 => 'Strong', 1 => array('type' => 'end')), 29 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 30 => array(0 => 'Strong', 1 => array('type' => 'start')), 31 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 32 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 33 => array(0 => 'Strong', 1 => array('type' => 'end')), 34 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 35 => array(0 => 'Strong', 1 => array('type' => 'start')), 36 => array(0 => 'Strong', 1 => array('type' => 'end')), 37 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 38 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 39 => array(0 => 'Strong', 1 => array('type' => 'start')), 40 => array(0 => 'Strong', 1 => array('type' => 'end')), 41 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 42 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 43 => array(0 => 'Strong', 1 => array('type' => 'start')), 44 => array(0 => 'Strong', 1 => array('type' => 'end')), 45 => array(0 => 'Emphasis', 1 => array('type' => 'end')), 46 => array(0 => 'Emphasis', 1 => array('type' => 'start')), 47 => array(0 => 'Strong', 1 => array('type' => 'start')), 48 => array(0 => 'Strong', 1 => array('type' => 'end')), 49 => array(0 => 'Emphasis', 1 => array('type' => 'end')), ); $this->assertEquals(array_values($expectedResult), array_values($obj->wiki->tokens)); } } class Text_Wiki_Parse_Mediawiki_Heading_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseHeadingProcess() { $matches1 = array(0 => "======Level 6 heading======", 1 => '======', 2 => 'Level 6 heading'); $matches2 = array(0 => "=Level 1 heading=", 1 => '=', 2 => 'Level 1 heading'); $matches3 = array(0 => "==Level 2 heading==", 1 => '==', 2 => 'Level 2 heading'); $this->assertRegExp("/\d+?Level 6 heading\d+?\n/", $this->t->process($matches1)); $this->assertRegExp("/\d+?Level 1 heading\d+?\n/", $this->t->process($matches2)); $this->assertRegExp("/\d+?Level 2 heading\d+?\n/", $this->t->process($matches3)); $tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 6, 'text' => 'Level 6 heading', 'id' => 'toc0')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 6)), 2 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 1, 'text' => 'Level 1 heading', 'id' => 'toc1')), 3 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 1)), 4 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => 'Level 2 heading', 'id' => 'toc2')), 5 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 2)) ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseHeadingRegex() { $expectedResult = array( 0 => array(0 => "=Level 1 heading=", 1 => "==Level 2 heading==", 2 => "==Level 2 heading==", 3 => "===Level 3 heading===", 4 => "====Level 4 heading====", 5 => "===Level 3 heading===", 6 => "===Level 3 heading===", 7 => "=====Level 5 heading=====", 8 => "======Level 6 heading======"), 1 => array(0 => '=', 1 => '==', 2 => '==', 3 => '===', 4 => '====', 5 => '===', 6 => '===', 7 => '=====', 8 => '======'), 2 => array(0 => 'Level 1 heading', 1 => 'Level 2 heading', 2 => 'Level 2 heading', 3 => 'Level 3 heading', 4 => 'Level 4 heading', 5 => 'Level 3 heading', 6 => 'Level 3 heading', 7 => 'Level 5 heading', 8 => 'Level 6 heading') ); $this->assertEquals($expectedResult, $this->matches); } } // Mediawiki parse uses horiz rule from default parser class Text_Wiki_Parse_Mediawiki_Horiz_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseHorizProcess() { $matches1 = array(0 => '----', 1 => '----'); $matches2 = array(0 => '------', 1 => '------'); $this->assertRegExp("/\d+?/", $this->t->process($matches1)); $this->assertRegExp("/\d+?/", $this->t->process($matches2)); $tokens = array( 0 => array(0 => 'Horiz', array()), 1 => array(0 => 'Horiz', array()), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseHeadingRegex() { $expectedResult = array( 0 => array(0 => '----', 1 => '------'), 1 => array(0 => '----', 1 => '------'), ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_List_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseListProcess() { $matches1 = array( 1 => " * List example ** List example **# List example **# List example *** List example **** List example ** List example ", 2 => "* List example ** List example **# List example **# List example *** List example **** List example ** List example " ); $this->assertRegExp("/\d+?\d+? List example\d+?\d+?\d+? List example\d+?\d+?\d+? List example\d+?\d+? List example\d+?\d+? List example\d+?\d+?\d+? List example\d+?\d+?\d+?\d+? List example\d+?\d+?\d+?/", $this->t->process($matches1)); $tokens = array( 432 => array(0 => 'List', 1 => array('type' => 'bullet_list_start', 'level' => 1)), 433 => array(0 => 'List', 1 => array('type' => 'bullet_item_start', 'level' => 1, 'count' => 0, 'first' => true)), 434 => array(0 => 'List', 1 => array('type' => 'bullet_item_end', 'level' => 1, 'count' => 0)), 435 => array(0 => 'List', 1 => array('type' => 'bullet_list_start', 'level' => 2)), 436 => array(0 => 'List', 1 => array('type' => 'bullet_item_start', 'level' => 2, 'count' => 0, 'first' => false)), 437 => array(0 => 'List', 1 => array('type' => 'bullet_item_end', 'level' => 2, 'count' => 0)), 438 => array(0 => 'List', 1 => array('type' => 'number_list_start', 'level' => 3)), 439 => array(0 => 'List', 1 => array('type' => 'number_item_start', 'level' => 3, 'count' => 0, 'first' => false)), 440 => array(0 => 'List', 1 => array('type' => 'number_item_end', 'level' => 3, 'count' => 0)), 441 => array(0 => 'List', 1 => array('type' => 'number_item_start', 'level' => 3, 'count' => 1, 'first' => false)), 442 => array(0 => 'List', 1 => array('type' => 'number_item_end', 'level' => 3, 'count' => 1)), 443 => array(0 => 'List', 1 => array('type' => 'bullet_item_start', 'level' => 3, 'count' => 2, 'first' => false)), 444 => array(0 => 'List', 1 => array('type' => 'bullet_item_end', 'level' => 3, 'count' => 2)), 445 => array(0 => 'List', 1 => array('type' => 'bullet_list_start', 'level' => 4)), 446 => array(0 => 'List', 1 => array('type' => 'bullet_item_start', 'level' => 4, 'count' => 0, 'first' => false)), 447 => array(0 => 'List', 1 => array('type' => 'bullet_item_end', 'level' => 4, 'count' => 0)), 448 => array(0 => 'List', 1 => array('type' => 'bullet_list_end', 'level' => 3)), 449 => array(0 => 'List', 1 => array('type' => 'number_list_end', 'level' => 2)), 450 => array(0 => 'List', 1 => array('type' => 'bullet_item_start', 'level' => 2, 'count' => 1, 'first' => false)), 451 => array(0 => 'List', 1 => array('type' => 'bullet_item_end', 'level' => 2, 'count' => 1)), 452 => array(0 => 'List', 1 => array('type' => 'bullet_list_end', 'level' => 1)), 453 => array(0 => 'List', 1 => array('type' => 'bullet_list_end', 'level' => 0)), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseListRegex() { $expectedResult = array( 0 => array( 0 => " * List * List ** List ** List *** List * List * List ", 1 => " # List # List ## List ## List ### List # List # List ", 2 => " * List example ** List example **# List example **# List example *** List example **** List example *# List example *# List example ** List example * List example ** List example ** List example **# List example ", ), 1 => array( 0 => "* List * List ** List ** List *** List * List * List ", 1 => "# List # List ## List ## List ### List # List # List ", 2 => "* List example ** List example **# List example **# List example *** List example **** List example *# List example *# List example ** List example * List example ** List example ** List example **# List example " ) ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Preformatted_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParsePreformattedProcess() { $matches1 = array(0 => "pre tag without line break", 1 => 'pre tag without line break'); // not sure why Text_Wiki_Parse_Preformatted uses $matches[2] $matches2 = array(0 => "pre tag without line break", 1 => 'pre tag without line break', 2 => 'some text'); $this->assertRegExp("/\d+?/", $this->t->process($matches1)); $this->assertRegExp("/\d+?/", $this->t->process($matches2)); $tokens = array( 0 => array(0 => 'Preformatted', 1 => array('text' => 'pre tag without line break')), 1 => array(0 => 'Preformatted', 1 => array('text' => 'some text')) ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParsePreformattedRegex() { $expectedResult = array( 0 => array( 0 => "The pre tag ignores [[Wiki]] ''markup''. It also doesn't reformat text. It still interprets special characters: →", 1 => "pre tag without line break", 2 => "some ''text'' without '''wiki''' parsing" ), 1 => array( 0 => "The pre tag ignores [[Wiki]] ''markup''. It also doesn't reformat text. It still interprets special characters: →", 1 => "pre tag without line break", 2 => "some ''text'' without '''wiki''' parsing", ), 2 => array(0 => '', 1 => '', 2 => '') ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Raw_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseRawProcess() { $matches1 = array(0 => "nowiki tag without break line ", 1 => 'nowiki tag without line break'); $this->assertRegExp("/\d+?/", $this->t->process($matches1)); $tokens = array( 0 => array(0 => 'Raw', 1 => array('text' => 'nowiki tag without line break')), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseRawRegex() { $expectedResult = array( 0 => array( 0 => "The nowiki tag ignores [[Wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets special characters: → ", 1 => "''ignores markup'' ", ), 1 => array( 0 => "The nowiki tag ignores [[Wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets special characters: →", 1 => "''ignores markup''", ) ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Redirect_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseRedirectProcess() { $matches1 = array(0 => "#REDIRECT [[Some page name]]", 1 => 'Some page name'); $matches2 = array(0 => "#redirect [[Other page name]]", 1 => 'Other page name'); $this->assertRegExp("/\d+?Some page name\d+?/", $this->t->process($matches1)); $this->assertRegExp("/\d+?Other page name\d+?/", $this->t->process($matches2)); $tokens = array( 0 => array(0 => 'Redirect', 1 => array('type' => 'start', 'text' => 'Some page name')), 1 => array(0 => 'Redirect', 1 => array('type' => 'end')), 2 => array(0 => 'Redirect', 1 => array('type' => 'start', 'text' => 'Other page name')), 3 => array(0 => 'Redirect', 1 => array('type' => 'end')), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseRedirectRegex() { $expectedResult = array( 0 => array(0 => "#REDIRECT [[Some page name]]", 1 => "#redirect [[Other page name]]"), 1 => array(0 => 'Some page name', 1 => 'Other page name'), ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Table_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseTableProcess() { $matches = array( 0 => '{| | A || B |- | C || D |}', 1 => ' ', 2 => '', 3 => '| A || B |- | C || D ' ); $this->assertRegExp("/\d+?\d+?\d+? A \d+?\d+? B\d+?\d+?\d+?\d+? C \d+?\d+? D \d+?\d+?\d+?/", $this->t->process($matches)); $tokens = array( 487 => array(0 => 'Table', 1 => array('type' => 'cell_start', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 0)), 488 => array(0 => 'Table', 1 => array('type' => 'cell_end', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 0)), 489 => array(0 => 'Table', 1 => array('type' => 'cell_start', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 1)), 490 => array(0 => 'Table', 1 => array('type' => 'cell_end', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 1)), 491 => array(0 => 'Table', 1 => array('type' => 'row_start', 'order' => 0, 'cols' => 2)), 492 => array(0 => 'Table', 1 => array('type' => 'row_end', 'order' => 0, 'cols' => 2)), 493 => array(0 => 'Table', 1 => array('type' => 'cell_start', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 0)), 494 => array(0 => 'Table', 1 => array('type' => 'cell_end', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 0)), 495 => array(0 => 'Table', 1 => array('type' => 'cell_start', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 1)), 496 => array(0 => 'Table', 1 => array('type' => 'cell_end', 'attr' => '', 'span' => 1, 'rowspan' => 1, 'order' => 1)), 497 => array(0 => 'Table', 1 => array('type' => 'row_start', 'order' => 1, 'cols' => 2)), 498 => array(0 => 'Table', 1 => array('type' => 'row_end', 'order' => 1, 'cols' => 2)), 499 => array(0 => 'Table', 1 => array('type' => 'table_start', 'level' => 0, 'rows' => 2, 'cols' => 2)), 500 => array(0 => 'Table', 1 => array('type' => 'table_end', 'level' => 0, 'rows' => 2, 'cols' => 2)) ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseTableRegex() { $expectedResult = array( 0 => array( 0 => "{| | A || B |- | C || D |}", ), 1 => array(0 => " \n"), 2 => array(0 => ''), 3 => array( 0 => "| A || B |- | C || D " ), 4 => array( 0 => '' ) ); $this->assertEquals($expectedResult, $this->matches); } } class Text_Wiki_Parse_Mediawiki_Wikilink_Test extends Text_Wiki_Parse_Mediawiki_SetUp_Tests { public function testMediawikiParseWikilinkProcessWithSpaceUnderscoreFalse() { $this->t->conf['spaceUnderscore'] = false; $matches1 = array(0 => '[[convallis elementum]]', 1 => '', 2 => '', 3 => 'convallis elementum', 4 => '', 5 => '', 6 => ''); $matches2 = array(0 => '[[Etiam]]', 1 => '', 2 => '', 3 => 'Etiam', 4 => '', 5 => '', 6 => ''); $matches3 = array(0 => '[[pt:Language link]]', 1 => '', 2 => 'pt:', 3 => 'Language link', 4 => '', 5 => '', 6 => ''); $matches4 = array(0 => '[[Image:some image]]', 1 => '', 2 => 'Image:', 3 => 'some image', 4 => '', 5 => '', 6 => ''); $matches5 = array(0 => '[[Etiam|description text]]', 1 => '', 2 => '', 3 => 'Etiam', 4 => '', 5 => 'description text', 6 => ''); $this->assertRegExp("/\d+?/", $this->t->process($matches1)); $this->assertRegExp("/\d+?/", $this->t->process($matches2)); $this->assertRegExp("/\d+?/", $this->t->process($matches3)); $this->assertRegExp("/\d+?/", $this->t->process($matches4)); $this->assertRegExp("/\d+?/", $this->t->process($matches5)); $tokens = array( 0 => array(0 => 'Wikilink', 1 => array('page' => 'convallis elementum', 'anchor' => '', 'text' => 'convallis elementum')), 1 => array(0 => 'Wikilink', 1 => array('page' => 'Etiam', 'anchor' => '', 'text' => 'Etiam')), 2 => array(0 => 'Wikilink', 1 => array('page' => 'pt:Language link', 'anchor' => '', 'text' => 'pt:Language link')), 3 => array(0 => 'Image', 1 => array('src' => 'some image', 'attr' => array('alt' => 'some image'))), 4 => array(0 => 'Wikilink', 1 => array('page' => 'Etiam', 'anchor' => '', 'text' => 'description text')), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseWikilinkProcessWithSpaceUnderscoreTrue() { $this->t->conf['spaceUnderscore'] = true; $matches1 = array(0 => '[[convallis elementum]]', 1 => '', 2 => '', 3 => 'convallis elementum', 4 => '', 5 => '', 6 => ''); $this->assertRegExp("/\d+?/", $this->t->process($matches1)); $tokens = array( 0 => array(0 => 'Wikilink', 1 => array('page' => 'convallis_elementum', 'anchor' => '', 'text' => 'convallis elementum')), ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseWikilinkRegex() { require_once(dirname(__FILE__) . '/fixtures/test_mediawiki_wikilink_expected_matches.php'); global $expectedWikilinkMatches; $fixture = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax_to_test_wikilink.txt'); preg_match_all($this->t->regex, $fixture, $matches); $this->assertEquals($expectedWikilinkMatches, $matches); } } class Text_Wiki_Parse_Mediawiki_Url_Test extends PHPUnit_Framework_TestCase { protected function setUp() { $textWiki = new Text_Wiki('Mediawiki'); $this->obj = new Text_Wiki_Parse_Url($textWiki); } public function testMediawikiParseUrlParse() { // for some weird reason I was unable to mock this class calling the constructor that is why to // test the regular expression I'm testing the tokens created (instead of testing many times each process function was called) $this->obj->wiki->source = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax.txt'); $this->obj->parse(); $tokens = array( 1 => array(0 => 'Url', 1 => array('type' => 'descr', 'href' => 'http://www.example.com', 'text' => 'See the example site')), 2 => array(0 => 'Url', 1 => array('type' => 'descr', 'href' => 'http://exemple.com/index.php', 'text' => 'consectetur adipiscing')), 3 => array(0 => 'Url', 1 => array('type' => 'descr', 'href' => 'http://exemple.com/index.php#anchor', 'text' => 'Pellentesque')), 4 => array(0 => 'Url', 1 => array('type' => 'descr', 'href' => 'http://www.somelink.com/index.php', 'text' => 'http://www.somelink.com/index.php')), 5 => array(0 => 'Url', 1 => array('type' => 'inline', 'href' => 'http://example.com/index.php', 'text' => 'http://example.com/index.php')) ); $this->assertEquals(array_values($tokens), array_values($this->obj->wiki->tokens)); } /* public function testMediawikiParseUrlParseWithMocking() { // NOT WORKING: unable to mock the class Text_Wiki_Parse_Url using its constructor $textWiki = Text_Wiki::factory('Mediawiki'); $obj = $this->getMock('Text_Wiki_Parse_Url', array('process', 'processWithoutProtocol', 'processInlineEmail', 'processFootnote', 'processOrdinary', 'processDescr'), array($textWiki), ); $obj->expects($this->once())->method('process'); $obj->expects($this->never())->method('processWithoutProtocol'); $obj->expects($this->never())->method('processInlineEmail'); $obj->expects($this->never())->method('processFootnote'); $obj->expects($this->exactly(2))->method('processOrdinary'); $obj->expects($this->exactly(5))->method('processDescr'); $obj->wiki->source = file_get_contents(dirname(__FILE__) . '/fixtures/mediawiki_syntax.txt'); $obj->parse(); }*/ public function testProcess() { $this->markTestIncomplete('Test incomplete'); } public function testProcessWithoutProtocol() { $this->markTestIncomplete('Test incomplete'); } public function testProcessInlineEmail() { $this->markTestIncomplete('Test incomplete'); } public function testProcessFootnote() { $this->markTestIncomplete('Test incomplete'); } public function testProcessOrdinary() { $this->markTestIncomplete('Test incomplete'); } public function testProcessDescr() { $this->markTestIncomplete('Test incomplete'); } } ?> wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Parse_Tiki_Tests.php 0000664 0001750 0001750 00000013030 13160726737 022637 0 ustar jan jan addTestSuite('Text_Wiki_Parse_Tiki_Heading_Test'); return $suite; } } class Text_Wiki_Parse_Tiki_SetUp_Tests extends PHPUnit_Framework_TestCase { protected function setUp() { $obj = Text_Wiki::factory('Tiki'); $testClassName = get_class($this); $ruleName = preg_replace('/Text_Wiki_Parse_Tiki_(.+?)_Test/', '\\1', $testClassName); $this->className = 'Text_Wiki_Parse_' . $ruleName; $this->t = new $this->className($obj); if (file_exists(dirname(__FILE__) . '/fixtures/tiki_syntax_to_test_' . strtolower($ruleName) . '.txt')) { $this->fixture = file_get_contents(dirname(__FILE__) . '/fixtures/tiki_syntax_to_test_' . strtolower($ruleName) . '.txt'); } else { $this->fixture = file_get_contents(dirname(__FILE__) . '/fixtures/tiki_syntax.txt'); } preg_match_all($this->t->regex, $this->fixture, $this->matches); } } class Text_Wiki_Parse_Tiki_Heading_Test extends Text_Wiki_Parse_Tiki_SetUp_Tests { public function testTikiParseHeadingProcess() { $matches1 = array( 0 => " !! Heading 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. ", 1 => "\n", 2 => "!!", 3 => "", 4 => " Heading 2", 5 => " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae est sit amet metus consequat scelerisque at accumsan dolor. Quisque posuere, mauris a fermentum sagittis, sem quam blandit tortor, vitae ullamcorper nulla velit placerat lacus. Nullam rutrum quam id est convallis luctus. Vivamus et urna odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut at augue eget elit feugiat pretium. " ); $this->assertRegExp("/\n\d+? Heading 2\d+?\d+?$matches1[5]\d+?/", $this->t->process($matches1)); $tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => ' Heading 2', 'id' => 'toc0', 'collapse' => '')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'text' => ' Heading 2', 'level' => 2, 'collapse' => '', 'id' => 'toc0')), 2 => array(0 => 'Heading', 1 => array('type' => 'startContent', 'id' => 'toc0', 'level' => 2, 'collapse' => '', 'text' => ' Heading 2')), 3 => array(0 => 'Heading', 1 => array('type' => 'endContent', 'collapse' => '', 'level' => 2, 'id' => 'toc0', 'text' => ' Heading 2')) ); $this->assertEquals(array_values($tokens), array_values($this->t->wiki->tokens)); } public function testMediawikiParseHeadingRegex() { require_once dirname(__FILE__) . '/fixtures/test_tiki_heading_expected_matches.php'; global $expectedHeadingMatches; $this->assertEquals($expectedHeadingMatches, $this->matches); } } ?> wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Render_Tests.php 0000664 0001750 0001750 00000007363 13160726737 022040 0 ustar jan jan obj = new Text_Wiki_Render($obj); $this->conf = array('firstConf' => 'firstConfValue', 'secondConf' => 'secondConfValue', 'thirdConf' => 'thirdConfValue', 'img_ext' => array('jpg', 'jpeg', 'gif', 'png'), 'css_table' => 'className', ); } public function testTextWikiRenderConstructor() { /* It is hard to test directly the constructor of the class Text_Wiki_Render as it * internally has logic expecting a child class name (to define the $this->rule and * $this->format variables). That is why we are creating an instance of * Text_Wiki_Render_Xhtml and Text_Wiki_Render_Xhtml_Address instead. If you have a * better idea feel free to improve this test */ $wiki = Text_Wiki::singleton(); $obj = new Text_Wiki_Render_Xhtml($wiki); $this->assertEquals($wiki, $obj->wiki, 'Should set reference to Text_Wiki object'); $this->assertEquals('Xhtml', $obj->format); $this->assertNull($obj->rule); $this->assertEquals(array('translate' => 1, 'quotes' => 2, 'charset' => 'ISO-8859-1'), $obj->conf); $obj = new Text_Wiki_Render_Xhtml_Address($wiki); $this->assertEquals($wiki, $obj->wiki, 'Should set reference to Text_Wiki object'); $this->assertEquals('Xhtml', $obj->format); $this->assertEquals('Address', $obj->rule); $this->assertEquals(array('css' => null), $obj->conf); } public function testGetConfShouldReturnConfValue() { $this->obj->conf = $this->conf; foreach ($this->conf as $key => $value) { $this->assertEquals($value, $this->obj->getConf($key)); $this->assertEquals($value, $this->obj->getConf($key, 'DefaultValue')); } } public function testGetConfShouldReturnDefaultValue() { $this->obj->conf = $this->conf; $this->assertEquals('DefaultValue', $this->obj->getConf('InvalidKey', 'DefaultValue')); } public function testFormatConfShouldReturnSprinfFormatedValue() { $this->obj->conf = $this->conf; foreach ($this->conf as $key => $value) { $this->assertEquals(" class=\"$value\"", $this->obj->formatConf(' class="%s"', $key)); } } public function testFormatConfShouldReturnNull() { $this->obj->conf = $this->conf; $this->assertNull($this->obj->formatConf(' class="%s"', 'InvalidKey')); $this->assertNull($this->obj->formatConf(' class="%s"', null)); } public function testUrlEncode() { $texts = array('ftp://user:foo @+%/@ftp.example.com/x.txt' => 'ftp%3A%2F%2Fuser%3Afoo%20%40%2B%25%2F%40ftp.example.com%2Fx.txt', 'http://example.com/department_list_script/sales and marketing/Miami' => 'http%3A%2F%2Fexample.com%2Fdepartment_list_script%2Fsales%20and%20marketing%2FMiami' ); foreach ($texts as $inputString => $outputString) { $this->assertEquals($outputString, $this->obj->urlEncode($inputString)); } } public function testTextEncode() { // need more strings to test $text = "Test"; $this->assertEquals("<a href='test'>Test</a>", $this->obj->textEncode($text)); } } ?> wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Render_Tiki_Tests.php 0000664 0001750 0001750 00000061447 13160726737 023023 0 ustar jan jan addTestSuite('Text_Wiki_Render_Tiki_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Anchor_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Blockquote_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Bold_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Box_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Break_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Center_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Code_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Colortext_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Deflist_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Delimiter_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Embed_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Emphasis_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Freelink_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Function_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Heading_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Horiz_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Html_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Image_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Include_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Interwiki_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Italic_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_List_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Newline_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Paragraph_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Phplookup_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Prefilter_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Preformatted_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Raw_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Redirect_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Revise_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Strong_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Subscript_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Superscript_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Table_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Tighten_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Toc_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Tt_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Underline_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Url_Test'); $suite->addTestSuite('Text_Wiki_Render_Tiki_Wikilink_Test'); return $suite; } } class Text_Wiki_Render_Tiki_Test extends PHPUnit_Framework_TestCase { protected function setUp() { $obj = Text_Wiki::singleton('Tiki'); $this->t = new Text_Wiki_Render_Tiki($obj); } public function testTikiRenderPre() { $this->assertEquals('', $this->t->pre()); } public function testTikiRenderPost() { $this->assertEquals('', $this->t->post()); } } class Text_Wiki_Render_Tiki_SetUp_Tests extends PHPUnit_Framework_TestCase { protected function setUp() { $obj = Text_Wiki::singleton('Tiki'); $testClassName = get_class($this); $ruleName = preg_replace('/Text_Wiki_Render_Tiki_(.+?)_Test/', '\\1', $testClassName); $className = 'Text_Wiki_Render_Tiki_' . $ruleName; $this->t = new $className($obj); } } class Text_Wiki_Render_Tiki_Anchor_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderAnchor() { $options = array('type' => 'start', 'name' => 'Page name'); $this->assertEquals('((Page name', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('))', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Blockquote_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderBlockquote() { $this->markTestIncomplete('check if Text_Wiki_Render_Tiki_Blockquote output a valid Tiki syntax.'); } } class Text_Wiki_Render_Tiki_Bold_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderBold() { $options = array(); $this->assertEquals('__', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Box_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderBox() { $options = array('type' => 'start'); $this->assertEquals('^', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('^', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Break_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderBreak() { $options = array(); $this->assertEquals("\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Center_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderCenter() { $options = array('type' => 'start'); $this->assertEquals('::', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('::', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Code_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderCode() { $options = array('text' => 'Some code text as a sample'); $this->assertEquals("{CODE()}\nSome code text as a sample\n{CODE}", $this->t->token($options)); $options = array('text' => 'Some code text as a sample', 'attr' => array('type' => '')); $this->assertEquals("{CODE()}\nSome code text as a sample\n{CODE}", $this->t->token($options)); $options = array('text' => 'Some code text as a sample', 'attr' => array('type' => 'php')); $this->assertEquals("{CODE(colors=>php)}\nSome code text as a sample\n{CODE}", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Colortext_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderColortext() { $options = array('type' => 'start', 'color' => 'red'); $this->assertEquals('~~red:', $this->t->token($options)); $options = array('type' => 'start', 'color' => 'FFFFFF'); $this->assertEquals('~~#FFFFFF:', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('~~', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Deflist_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderDeflist() { $options = array('type' => 'list_start'); $this->assertEquals("{DL()}\n", $this->t->token($options)); $options = array('type' => 'list_end'); $this->assertEquals("{DL}\n\n", $this->t->token($options)); $options = array('type' => 'term_start'); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'term_end'); $this->assertEquals(': ', $this->t->token($options)); $options = array('type' => 'narr_start'); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'narr_end'); $this->assertEquals("\n", $this->t->token($options)); // test definition item without definition narrative $this->t->token(array('type' => 'term_end')); $this->assertEquals('term_end', $this->t->last); $options = array('type' => 'term_start'); $this->assertEquals("\n", $this->t->token($options)); $this->assertEquals('term_start', $this->t->last); // test default swicth behavior $options = array('type' => 'InvalidType'); $this->assertEquals('', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Delimiter_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderDelimiter() { $options = array('text' => 'Sample text'); $this->assertEquals('Sample text', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Embed_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderEmbed() { $options = array('text' => 'Sample text'); $this->assertEquals('Sample text', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Emphasis_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderEmphasis() { $options = array(); $this->assertEquals("''", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Freelink_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderFreelink() { $options = array('type' => 'start', 'page' => 'Sample page', 'text' => 'Sample text'); $this->assertEquals('((Sample page|', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('))', $this->t->token($options)); $options = array('page' => 'Sample page', 'text' => 'Sample text'); $this->assertEquals('((Sample page|Sample text))', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Function_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderFunction() { $this->markTestIncomplete('This test has not been implemented yet.'); } } class Text_Wiki_Render_Tiki_Heading_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderHeading() { $options = array('type' => 'start', 'level' => 1); $this->assertEquals("!", $this->t->token($options)); $options = array('type' => 'start', 'level' => 2); $this->assertEquals("!!", $this->t->token($options)); $options = array('type' => 'start', 'level' => 6); $this->assertEquals("!!!!!!", $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals("\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Horiz_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderHoriz() { $options = array(); $this->assertEquals("\n---\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Html_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderHtml() { $this->markTestIncomplete('This test has not been implemented yet.'); } } class Text_Wiki_Render_Tiki_Image_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderImage() { $options = array('src' => 'src/image.jpg'); $this->assertEquals('{img src="img/wiki_up/src/image.jpg"}', $this->t->token($options)); $options = array('src' => 'src/image.jpg', 'attr' => array()); $this->assertEquals('{img src="img/wiki_up/src/image.jpg"}', $this->t->token($options)); $options = array('src' => 'src/image.jpg', 'attr' => array('width' => 600, 'height' => 500)); $this->assertEquals('{img src="img/wiki_up/src/image.jpg" width="600" height="500"}', $this->t->token($options)); $this->t->conf = array('prefix' => 'different/path/'); $options = array('src' => 'image.jpg'); $this->assertEquals('{img src="different/path/image.jpg"}', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Include_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderInclude() { $this->markTestIncomplete('This test has not been implemented yet.'); } } class Text_Wiki_Render_Tiki_Interwiki_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderInterwiki() { $this->markTestIncomplete('Check if Text_Wiki_Render_Tiki_Interwiki output a valid Tiki syntax.'); $options = array('site' => 'doc.tikiwiki.org', 'page' => 'WikiSyntax'); $this->assertEquals('((doc.tikiwiki.org:WikiSyntax))', $this->t->token($options)); $options = array('site' => 'doc.tikiwiki.org', 'page' => 'WikiSyntax', 'text' => 'Page WikiSyntax from doc.tikiwiki.org'); $this->assertEquals('((doc.tikiwiki.org:WikiSyntax|Page WikiSyntax from doc.tikiwiki.org))', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Italic_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderItalic() { $options = array(); $this->assertEquals("''", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_List_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderNumberItemStart() { $options = array('type' => 'number_item_start', 'level' => 1); $this->assertEquals("#", $this->t->token($options)); $options = array('type' => 'number_item_start', 'level' => 3); $this->assertEquals("###", $this->t->token($options)); } public function testTikiRenderBulletItemStart() { $options = array('type' => 'bullet_item_start', 'level' => 1); $this->assertEquals("*", $this->t->token($options)); $options = array('type' => 'bullet_item_start', 'level' => 3); $this->assertEquals("***", $this->t->token($options)); } public function testTikiRenderBulletAndNumberedListEnd() { $options = array('type' => 'bullet_list_end', 'level' => 0); $this->assertEquals("\n", $this->t->token($options)); $options = array('type' => 'number_list_end', 'level' => 0); $this->assertEquals("\n", $this->t->token($options)); $options = array('type' => 'bullet_list_end', 'level' => 1); $this->assertEquals("", $this->t->token($options)); $options = array('type' => 'number_list_end', 'level' => 1); $this->assertEquals("", $this->t->token($options)); } public function testTikiRenderBulletAndNumberedListStart() { $options = array('type' => 'bullet_list_start'); $this->assertEquals("", $this->t->token($options)); $options = array('type' => 'number_list_start'); $this->assertEquals("", $this->t->token($options)); } public function testTikiRenderBullerAndNumberedItemEnd() { $options = array('type' => 'bullet_item_end'); $this->assertEquals("\n", $this->t->token($options)); $options = array('type' => 'number_item_end'); $this->assertEquals("\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Newline_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderNewline() { $options = array(); $this->assertEquals("\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Paragraph_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderParagraph() { $options = array('type' => 'start'); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals("\n\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Phplookup_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderPhplookup() { $this->markTestIncomplete('This test has not been implemented yet.'); } } class Text_Wiki_Render_Tiki_Prefilter_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderPrefilter() { $this->markTestIncomplete('This test has not been implemented yet.'); } } class Text_Wiki_Render_Tiki_Preformatted_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderPreformatted() { $options = array('text' => 'Some preformatted text'); $this->assertEquals('~pp~Some preformatted text~/pp~', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Raw_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderRaw() { $options = array('text' => 'Some raw text'); $this->assertEquals('~np~Some raw text~/np~', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Redirect_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderRedirect() { $options = array('type' => 'start', 'text' => 'Some wiki link'); $this->assertEquals('{redirect page="', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('"}', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Revise_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderRevise() { $this->markTestIncomplete('Check if Text_Wiki_Render_Tiki_Revise output a valid Tiki syntax.'); } } class Text_Wiki_Render_Tiki_Strong_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderStrong() { $options = array(); $this->assertEquals('__', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Subscript_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderSubscript() { $this->markTestIncomplete('Check if Text_Wiki_Render_Tiki_Subscript output a valid Tiki syntax.'); } } class Text_Wiki_Render_Tiki_Superscript_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderSuperscript() { $this->markTestIncomplete('Check if Text_Wiki_Render_Tiki_Superscript output a valid Tiki syntax.'); } } class Text_Wiki_Render_Tiki_Table_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderTable() { /* test cases that doesn't depend on the static variable $last */ $options = array('type' => 'table_start'); $this->assertEquals('||', $this->t->token($options)); $options = array('type' => 'table_end'); $this->assertEquals('||', $this->t->token($options)); $options = array('type' => 'row_end'); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'cell_end', 'span' => 1); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'cell_end', 'span' => 4); $this->assertEquals(' | | | ', $this->t->token($options)); $options = array('type' => 'cell_end'); $this->assertEquals('', $this->t->token($options)); } public function testTikiRenderTableDependLastVariable() { /* test cases that depend on the static variable $last. we run token() with a different type first to set the appropiate $last value and then we run it again we the desirable assert value */ $options = array('type' => 'table_start'); $this->t->token($options); $options = array('type' => 'row_start'); $this->assertEquals('', $this->t->token($options)); $options = array('type' => 'cell_end'); $this->t->token($options); $options = array('type' => 'cell_start'); $this->assertEquals(' | ', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Tighten_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderTighten() { $options = array(); $this->assertEquals('', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Toc_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderToc() { $options = array(); $this->assertEquals("\n{maketoc}\n", $this->t->token($options)); } } class Text_Wiki_Render_Tiki_tt_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRendertt() { $this->markTestIncomplete('Check if Text_Wiki_Render_Tiki_tt output a valid Tiki syntax.'); } } class Text_Wiki_Render_Tiki_Underline_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderUnderline() { $options = array(); $this->assertEquals('===', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Url_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderUrlMultiToken() { $options = array('type' => 'start', 'href' => 'http://example.com'); $this->assertEquals('[http://example.com', $this->t->token($options)); $options = array('type' => 'start', 'href' => 'http://example.com', 'text' => 'http://example.com'); $this->assertEquals('[http://example.com', $this->t->token($options)); $options = array('type' => 'start', 'href' => 'http://example.com', 'text' => 'Sample text'); $this->assertEquals('[http://example.com|', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals(']', $this->t->token($options)); } public function testTikiRenderUrlSingleToken() { $options = array('href' => 'http://example.com'); $this->assertEquals('[http://example.com]', $this->t->token($options)); $options = array( 'href' => 'http://example.com', 'text' => 'http://example.com'); $this->assertEquals('[http://example.com]', $this->t->token($options)); $options = array( 'href' => 'http://example.com', 'text' => 'Sample text'); $this->assertEquals('[http://example.com|Sample text]', $this->t->token($options)); } } class Text_Wiki_Render_Tiki_Wikilink_Test extends Text_Wiki_Render_Tiki_SetUp_Tests { public function testTikiRenderWikilinkMultiToken() { $options = array('type' => 'start', 'page' => 'Sample page', 'text' => 'Sample text'); $this->assertEquals('((Sample page|', $this->t->token($options)); $options = array('type' => 'start', 'page' => 'Sample page', 'text' => 'Sample page'); $this->assertEquals('((Sample page|', $this->t->token($options)); $options = array('type' => 'end'); $this->assertEquals('))', $this->t->token($options)); } public function testTikiRenderWikilinkSingleToken() { $options = array('page' => 'Sample page'); $this->assertEquals('((Sample page))', $this->t->token($options)); $options = array('page' => 'Sample page', 'text' => 'Sample text'); $this->assertEquals('((Sample page|Sample text))', $this->t->token($options)); $options = array('page' => 'Sample page', 'text' => 'Sample page'); $this->assertEquals('((Sample page))', $this->t->token($options)); } } ?> wicked-2.0.8/lib/Text_Wiki/tests/Text_Wiki_Tests.php 0000664 0001750 0001750 00000053324 13160726737 020537 0 ustar jan jan obj = Text_Wiki::factory(); $this->obj->renderConf = array(); $this->obj->parseConf = array(); $this->obj->formatConf = array(); $this->obj->rules = array('Prefilter', 'Delimiter', 'Code', 'Function', 'Html', 'Raw', 'Include'); $this->obj->disable = array('Html', 'Include', 'Embed'); $this->obj->path = array('parse' => array(), 'render' => array()); $this->sourceText = 'A very \'\'simple\'\' \'\'\'source\'\'\' text. Not sure [[how]] to [http://example.com improve] the transform() tests.' . "\n"; $this->tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 6, 'text' => 'Level 6 heading', 'id' => 'toc0')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 6)), 2 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 1, 'text' => 'Level 1 heading', 'id' => 'toc1')), 3 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 1)), 4 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => 'Level 2 heading', 'id' => 'toc2')), 5 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 2)), 6 => array(0 => 'Break', 1 => array()), 7 => array(0 => 'Break', 1 => array()) ); $this->_countRulesTokens = array('Heading' => 6, 'Break' => 2); } public function testSingletonOfSameParserShouldReturnSameObject() { $obj1 = Text_Wiki::singleton(); $obj2 = Text_Wiki::singleton(); $this->assertEquals(spl_object_hash($obj1), spl_object_hash($obj2)); } public function testSingletonOfDifferentParserShouldReturnDifferentObject() { $obj1 = Text_Wiki::singleton('Tiki'); $obj2 = Text_Wiki::singleton(); $this->assertNotEquals(spl_object_hash($obj1), spl_object_hash($obj2)); } public function testFactoryReturnDefaultParserInstance() { $obj = Text_Wiki::factory(); $this->assertTrue(is_a($obj, 'Text_Wiki_Default')); } public function testFactoryRestrictRulesUniverse() { $rules = array('Heading', 'Bold', 'Italic', 'Paragraph'); $obj = Text_Wiki::factory('Default', $rules); $this->assertEquals($rules, $obj->rules); } public function testTokenIdForMultipleParsingDontCollideWithDifferentObjects() { $sampleText = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_mediawiki_syntax.txt'); $sampleTextTransformed2Xhtml = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_xhtml.txt'); $sampleTextTransformed2Plain = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_plain.txt'); $sampleTextTransformed2Plain2 = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_plain2.txt'); $obj1 = Text_Wiki::factory('Mediawiki'); $this->assertEquals($sampleTextTransformed2Xhtml, $obj1->transform($sampleText, 'Xhtml')); $obj2 = Text_Wiki::factory('Mediawiki'); $this->assertEquals($sampleTextTransformed2Plain, $obj2->transform($sampleText, 'Plain')); $obj3 = Text_Wiki::factory('Tiki'); $this->assertEquals($sampleTextTransformed2Plain2, $obj3->transform($sampleText, 'Plain')); } public function testTokenIdForMultipleParsingDontCollideWithSameObjects() { $sampleText = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_mediawiki_syntax.txt'); $sampleTextTransformed2Xhtml = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_xhtml.txt'); $sampleTextTransformed2Plain = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_plain.txt'); $sampleTextTransformed2Plain2 = file_get_contents(dirname(__FILE__) . '/fixtures/text_wiki_sample_syntax_transformed_to_plain2.txt'); $obj1 = Text_Wiki::singleton('Mediawiki'); $this->assertEquals($sampleTextTransformed2Xhtml, $obj1->transform($sampleText, 'Xhtml')); $obj2 = Text_Wiki::singleton('Mediawiki'); $this->assertEquals($sampleTextTransformed2Plain, $obj2->transform($sampleText, 'Plain')); $obj3 = Text_Wiki::singleton('Tiki'); $this->assertEquals($sampleTextTransformed2Plain2, $obj3->transform($sampleText, 'Plain')); } public function testSetParseConf() { $expectedResult = array('Center' => array('css' => 'center')); $this->obj->setParseConf('center', 'css', 'center'); $this->assertEquals($expectedResult, $this->obj->parseConf); $this->obj->parseConf = array(); $expectedResult = array('Center' => array('css' => 'center')); $this->obj->setParseConf('center', array('css' => 'center')); $this->assertEquals($expectedResult, $this->obj->parseConf); } public function testGetParseConf() { $this->obj->parseConf = array('Include' => array('base' => '/path/to/scripts/', 'anotherKey' => 'anotherValue'), 'Secondrule' => array('base' => '/other/path/')); $this->assertEquals(array('base' => '/other/path/'), $this->obj->getParseConf('Secondrule')); $this->assertEquals('/path/to/scripts/', $this->obj->getParseConf('include', 'base')); $this->assertNull($this->obj->getParseConf('inexistentRule', 'inexistentKey')); } public function testSetRenderConf() { $this->obj->setRenderConf('xhtml', 'center', 'css', 'center'); $expectedResult = array('Center' => array('css' => 'center')); $this->assertEquals($expectedResult, $this->obj->renderConf['Xhtml']); $this->obj->setRenderConf('xhtml', 'center', 'secondConfig', 'secondConfigValue'); $expectedResult = array('Center' => array('css' => 'center', 'secondConfig' => 'secondConfigValue')); $this->assertEquals($expectedResult, $this->obj->renderConf['Xhtml']); $arg = array('firstConfig' => 'firstConfigValue', 'secondConfig' => 'diferentValue'); $this->obj->setRenderConf('xhtml', 'newrule', $arg); $expectedResult = array_merge($expectedResult, array('Newrule' => $arg)); $this->assertEquals($expectedResult, $this->obj->renderConf['Xhtml']); } public function testGetRenderConfReturnRule() { $this->obj->renderConf['Xhtml'] = array('Center' => array('css' => 'center', 'align' => 'left')); $this->assertEquals(array('css' => 'center', 'align' => 'left'), $this->obj->getRenderConf('Xhtml', 'Center')); } public function testGetRenderConfReturnEspecifKeyRule() { $this->obj->renderConf['Xhtml'] = array('Center' => array('css' => 'center', 'align' => 'left')); $this->assertEquals('center', $this->obj->getRenderConf('Xhtml', 'Center', 'css')); } public function testGetRenderConfReturnFalseForInvalidFormatOrConfOrKey() { $this->obj->renderConf['Xhtml'] = array('Center' => array('css' => 'center', 'align' => 'left')); $this->assertNull($this->obj->getRenderConf('InvalidFormat', 'InvalidRule', 'InvalidKey')); $this->assertNull($this->obj->getRenderConf('Xhtml', 'InvalidRule')); $this->assertNull($this->obj->getRenderConf('Xhtml', 'Center', 'InvalidKey')); } public function testSetFormatConfWithThreeArguments() { $expectedResult = array('Xhtml' => array('css' => 'center')); $this->obj->setFormatConf('Xhtml', 'css', 'center'); $this->assertEquals($expectedResult, $this->obj->formatConf); } public function testSetFormatConfWithTwoArguments() { $expectedResult = array('Xhtml' => array('css' => 'center')); $this->obj->setFormatConf('Xhtml', array('css' => 'center')); $this->assertEquals($expectedResult, $this->obj->formatConf); } public function testGetFormatConf() { $this->obj->formatConf = array('Xhtml' => array('base' => '/path/to/scripts/', 'anotherKey' => 'anotherValue'), 'Docbook' => array('base' => '/other/path/')); $this->assertEquals(array('base' => '/other/path/'), $this->obj->getFormatConf('Docbook')); $this->assertEquals('/path/to/scripts/', $this->obj->getFormatConf('Xhtml', 'base')); $this->assertNull($this->obj->getFormatConf('inexistentFormat')); } public function testInsertRuleShouldReturnNullIfRuleAlreadyExist() { $this->assertNull($this->obj->insertRule('Code', 'Prefilter')); } public function testInsertRuleShouldReturnNullIfInexistentRuleToInsertAfter() { $this->assertNull($this->obj->insertRule('Code', 'InexistentRule')); } public function testInsertRuleShouldInsertRuleAtTheEnd() { $return = $this->obj->insertRule('NewRule'); $this->assertTrue($return); $this->assertEquals('Newrule', end($this->obj->rules)); } public function testInsertRuleShouldInsertRuleAtTheBeginning() { $return = $this->obj->insertRule('NewRule', ''); $this->assertTrue($return); $this->assertEquals('Newrule', $this->obj->rules[0]); } public function testInsertRuleShouldInsertRuleInExactPlace() { $key = array_search('Function', $this->obj->rules); $return = $this->obj->insertRule('NewRule', 'Function'); $this->assertTrue($return); $this->assertEquals('Newrule', $this->obj->rules[$key+1]); } public function testDeleteRule() { $rules = array(0 => 'Prefilter', 1 => 'Delimiter', 2 => 'Code', 3 => 'Function', 5 => 'Raw', 6 => 'Include'); $this->obj->deleteRule('Html'); $this->assertEquals($rules, $this->obj->rules); $rules = array(0 => 'Prefilter', 2 => 'Code', 3 => 'Function', 5 => 'Raw', 6 => 'Include'); $this->obj->deleteRule('Delimiter'); $this->assertEquals($rules, $this->obj->rules); } public function testChangeRule() { $rules = array('Prefilter', 'Delimiter', 'Code', 'Function', 'Html', 'Newrulename', 'Include'); $this->obj->changeRule('Raw', 'NewRuleName'); $this->assertEquals($rules, $this->obj->rules); // should delete the 'Function' rule and rename 'Code' rule to 'Function' $rules = array(0 => 'Prefilter', 1 => 'Delimiter', 2 => 'Function', 4 => 'Html', 5 => 'Newrulename', 6 => 'Include'); $this->obj->changeRule('Code', 'Function'); $this->assertEquals($rules, $this->obj->rules); // no changes as inexistent old rule name $this->obj->changeRule('InexistentRule', 'NewRule'); $this->assertEquals($rules, $this->obj->rules); } public function testEnableRule() { $this->obj->enableRule('Include'); $disable = array(0 => 'Html', 2 => 'Embed'); $this->assertEquals($disable, $this->obj->disable); $this->obj->enableRule('InvalidRule'); $this->assertEquals($disable, $this->obj->disable); } public function testDisableRule() { $this->obj->disableRule('Newrule'); $disable = array(0 => 'Html', 1 => 'Include', 2 => 'Embed', 3 => 'Newrule'); $this->assertEquals($disable, $this->obj->disable); // nothing change as rule is already marked as disabled $this->obj->disableRule('Include'); $this->assertEquals($disable, $this->obj->disable); } public function testTransform() { $obj = Text_Wiki::factory('Mediawiki'); $expectedResult = 'A very \'\'simple\'\' __source__ text. Not sure ((how)) to [http://example.com|improve] the transform() tests.' . "\n\n"; $this->assertEquals($expectedResult, $obj->transform($this->sourceText, 'Tiki')); } public function testParse() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testParseShouldSetSourceProperty() { $this->obj->parse($this->sourceText); // TODO: check why there is a line break at the beginning and end of $this->obj->source $this->assertEquals("\n".$this->sourceText."\n", $this->obj->source); } public function testRender() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testRenderShouldReturnErrorIfInvalidFormat() { $result = $this->obj->render('InvalidFormat'); $this->assertTrue(is_a($result, 'PEAR_Error')); } public function test_renderToken() { // $matches = array(0 => '0', 1 => 0); // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testRegisterRenderCallback() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testPopRenderCallback() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testGetSource() { $this->obj->source = $this->sourceText; $this->assertEquals($this->sourceText, $this->obj->getSource()); } public function testGetTokens() { $breakTokens = array_slice($this->tokens, 6, 2, true); $this->obj->tokens = $this->tokens; $this->assertEquals($this->tokens, $this->obj->getTokens()); $this->assertEquals($breakTokens, $this->obj->getTokens('Break')); } public function testAddTokenReturnIdOnly() { $options = array('type' => 'someType', 'anotherOption' => 'value'); $id = $this->obj->addToken('Test', $options, true); $this->assertEquals(0, $id); } public function testAddTokenReturnTokenNumberWithDelimiters() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testSetTokenShouldChangeOptionsOfAlreadyExistingRuleAndKeepName() { $this->obj->tokens = $this->tokens; $this->obj->_countRulesTokens = $this->_countRulesTokens; $tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 6, 'text' => 'Level 6 heading', 'id' => 'toc0')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 6)), 2 => array(0 => 'Heading', 1 => array()), 3 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 1)), 4 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => 'Level 2 heading', 'id' => 'toc2')), 5 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 2)), 6 => array(0 => 'Break', 1 => array()), 7 => array(0 => 'Break', 1 => array()) ); $this->obj->setToken(2, 'Heading', array()); $this->assertEquals($tokens, $this->obj->tokens); $this->assertEquals($this->_countRulesTokens, $this->obj->_countRulesTokens); } public function testSetTokenShouldReplaceRuleWithNewRule() { $this->obj->tokens = $this->tokens; $this->obj->_countRulesTokens = $this->_countRulesTokens; $tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 6, 'text' => 'Level 6 heading', 'id' => 'toc0')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 6)), 2 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 1, 'text' => 'Level 1 heading', 'id' => 'toc1')), 3 => array(0 => 'Raw', 1 => array('type' => 'end')), 4 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => 'Level 2 heading', 'id' => 'toc2')), 5 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 2)), 6 => array(0 => 'Break', 1 => array()), 7 => array(0 => 'Break', 1 => array()) ); $this->_countRulesTokens = array('Heading' => 5, 'Break' => 2, 'Raw' => 1); $this->obj->setToken(3, 'Raw', array('type' => 'end')); $this->assertEquals($tokens, $this->obj->tokens); $this->assertEquals($this->_countRulesTokens, $this->obj->_countRulesTokens); } public function testSetTokenShouldAddNewRule() { $this->obj->tokens = $this->tokens; $this->obj->_countRulesTokens = $this->_countRulesTokens; $tokens = array( 0 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 6, 'text' => 'Level 6 heading', 'id' => 'toc0')), 1 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 6)), 2 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 1, 'text' => 'Level 1 heading', 'id' => 'toc1')), 3 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 1)), 4 => array(0 => 'Heading', 1 => array('type' => 'start', 'level' => 2, 'text' => 'Level 2 heading', 'id' => 'toc2')), 5 => array(0 => 'Heading', 1 => array('type' => 'end', 'level' => 2)), 6 => array(0 => 'Break', 1 => array()), 7 => array(0 => 'Break', 1 => array()), 8 => array(0 => 'Raw', 1 => array('type' => 'end')), ); $this->_countRulesTokens = array('Heading' => 6, 'Break' => 2, 'Raw' => 1); $this->obj->setToken(8, 'Raw', array('type' => 'end')); $this->assertEquals($tokens, $this->obj->tokens); $this->assertEquals($this->_countRulesTokens, $this->obj->_countRulesTokens); } public function testLoadParseObj() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testLoadRenderObj() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testLoadFormatObj() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testAddPathShouldAddDirToExistentType() { $path = array('parse' => array('Text/Wiki/Parse/Default/'), 'render' => array()); $this->obj->addPath('parse', 'Text/Wiki/Parse/Default/'); $this->assertEquals($path, $this->obj->path); // dir without trailing trailing slash $path = array('parse' => array('Text/Wiki/Parse/Other/', 'Text/Wiki/Parse/Default/'), 'render' => array()); $this->obj->addPath('parse', 'Text/Wiki/Parse/Other'); $this->assertEquals($path, $this->obj->path); } public function testAddPathCreateTypeAndThenAddDir() { $this->obj->path = array(); $path = array('parse' => array('Text/Wiki/Parse/Default/')); $this->obj->addPath('parse', 'Text/Wiki/Parse/Default/'); $this->assertEquals($path, $this->obj->path); } public function testGetPathShouldReturnPathArray() { $path = array('parse' => array('Text/Wiki/Parse/Default/', 'Text/Wiki/Parse/Other/'), 'render' => array('Text/Wiki/Parse/Xhtml/')); $this->obj->path = $path; $this->assertEquals($path, $this->obj->getPath()); } public function testGetPathShouldReturnTypePaths() { $path = array('parse' => array('Text/Wiki/Parse/Default/', 'Text/Wiki/Parse/Other/'), 'render' => array('Text/Wiki/Parse/Xhtml/')); $this->obj->path = $path; $this->assertEquals($path['parse'], $this->obj->getPath('parse')); $this->assertEquals($path['render'], $this->obj->getPath('render')); } public function testGetPathShouldReturnEmptyArray() { $path = array('parse' => array('Text/Wiki/Parse/Default/', 'Text/Wiki/Parse/Other/'), 'render' => array('Text/Wiki/Parse/Xhtml/')); $this->obj->path = $path; $this->assertEquals(array(), $this->obj->getPath('InexistentType')); } public function testFindFile() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } public function testFixPath() { $this->assertEquals('path/', $this->obj->fixPath('path')); $this->assertEquals('/longer/path/path/', $this->obj->fixPath('/longer/path/path')); $this->assertEquals('/longer/path/path/with/trailing/slash/', $this->obj->fixPath('/longer/path/path/with/trailing/slash/')); $this->assertEquals('', $this->obj->fixPath('')); } public function testError() { $errorObject = $this->obj->error('Some error message'); $this->assertTrue(is_a($errorObject, 'PEAR_Error')); $this->assertEquals('Some error message', $errorObject->message); } public function testIsError() { $this->assertTrue($this->obj->isError(PEAR::throwError('Some error message'))); $notPearErrorObject = new Text_Wiki; $this->assertFalse($this->obj->isError($notPearErrorObject)); } } ?> wicked-2.0.8/lib/Text_Wiki/tests/Xhtml_Render_Url.phpt 0000664 0001750 0001750 00000000657 13160726737 021050 0 ustar jan jan --TEST-- Text_Wiki_Xhtml_Render_Url --FILE-- setRenderConf('Xhtml', 'Url', 'target', ''); print $t->transform(' [http://www.example.com/page An example page] http://www.example.com/page ', 'Xhtml'); ?> --EXPECT-- An example page http://www.example.com/page wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Attribute.php 0000664 0001750 0001750 00000002746 13160726737 022230 0 ustar jan jan regex = '/((?:\[\[' . Wicked::REGEXP_WIKIWORD . ':\s+.*?\]\]\s*)+)/'; } /** * Generates a token entry for the matched text. Token options are: * * 'src' => The image source, typically a relative path name. * 'opts' => Any macro options following the source. * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. */ public function process(&$matches) { $options = array('attributes' => array()); $text = $matches[1]; while (preg_match('/^\[\[(' . Wicked::REGEXP_WIKIWORD . '):\s+(.*?)\]\]\s*(.*)$/s', $text, $sub)) { $options['attributes'][] = array('name' => $sub[1], 'value' => $sub[2]); $text = $sub[3]; } return $this->wiki->addToken($this->rule, $options); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Blockquote.php 0000664 0001750 0001750 00000005766 13160726737 022402 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Block-quoted text rule parser class (with nesting) for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger* @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * We match [quote=..] ... [/quote] with nesting * * @access public * @var string * @see Text_Wiki_Parse::parse() */ var $regex = '#\[quote(?:=\s*"(.*?)")?\s*]((?:((?R))|.)*?)\[/quote]#msi'; /** * The current quote nesting depth, starts by zero * * @access private * @var int */ var $_level = 0; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the block-quoted text. * The text itself is left in the source but may content bested blocks * - 'level' => the level of nesting (starting 0) * - 'name' => the author indicator (optional) * * @param array &$matches The array of matches from parse(). * @return string Delimited by start/end tokens to be used as * placeholder in the source text surrounding the text to be quoted. * @access public */ function process(&$matches) { // nested block ? if (array_key_exists(3, $matches)) { $this->_level++; $expsub = preg_replace_callback( $this->regex, array(&$this, 'process'), $matches[2] ); $this->_level--; } else { $expsub = $matches[2]; } // builds the option array $options = array('type' => 'start', 'level'=>$this->_level); if (isset($matches[1])) { $options['name'] = $matches[1]; } $statok = $this->wiki->addToken($this->rule, $options); $options['type'] = 'end'; return $statok . $expsub . $this->wiki->addToken($this->rule, $options); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Bold.php 0000664 0001750 0001750 00000004064 13160726737 021140 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Bold text rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Bold extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[b](.*?)\[/b]#i"; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @param array &$matches The array of matches from parse(). * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * @access public */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Code.php 0000664 0001750 0001750 00000003746 13160726737 021140 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Code block rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[code]((?:(?R)|.)*?)\[/code]#msi"; /** * Generates a replacement for the matched text. Token options are: * - 'text' => the contained text * - 'attr' => type empty * * @param array &$matches The array of matches from parse(). * @return A delimited token to be used as a placeholder in * the source text and containing the original block of text * @access public */ function process(&$matches) { return $this->wiki->addToken($this->rule, array( 'text' => $matches[1], 'attr' => array('type' => '') ) ); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Code2.php 0000664 0001750 0001750 00000000317 13160726737 021211 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Colored text rule parser class (with nesting) for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * We match either [color..] ... [/color] nested * * @access public * @var string * @see Text_Wiki_Parse::parse() */ var $regex = "'(?:\[color=(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|\#?[0-9a-f]{6})]((?:((?R))|.)*?)\[/color])'msi"; /** * The current color nesting depth, starts by zero * * @access private * @var int */ var $_level = 0; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the colored text. * The text itself is left in the source but may content bested blocks * - 'level' => the level of nesting (starting 0) * - 'color' => the color indicator * * @param array &$matches The array of matches from parse(). * @return string Delimited by start/end tokens to be used as * placeholder in the source text surrounding the text to be colored. * @access public */ function process(&$matches) { // nested block ? if (array_key_exists(2, $matches)) { $this->_level++; $expsub = preg_replace_callback( $this->regex, array(&$this, 'process'), $matches[2] ); $this->_level--; } else { $expsub = $matches[2]; } // needs to withdraw leading # as renderer put it in $color = $matches[1]{0} == '#' ? substr($matches[1], 1) : $matches[1]; // builds the option array $options = array('type' => 'start', 'level' => $this->_level, 'color' => $color); $statok = $this->wiki->addToken($this->rule, $options); $options['type'] = 'end'; return $statok . $expsub . $this->wiki->addToken($this->rule, $options); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Font.php 0000664 0001750 0001750 00000005472 13160726737 021172 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Font rule parser class (with nesting) for BBCode. ([size=...]...[/size]) * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Font extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[size=(\d+)]((?:((?R))|.)*?)\[/size]#msi"; /** * The current font nesting depth, starts by zero * * @access private * @var int */ var $_level = 0; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the sized text. * The text itself is left in the source but may content bested blocks * - 'level' => the level of nesting (starting 0) * - 'size' => the size indicator * * @param array &$matches The array of matches from parse(). * @return string Delimited by start/end tokens to be used as * placeholder in the source text surrounding the text to be sized. * @access public */ function process(&$matches) { // nested block ? if (array_key_exists(3, $matches)) { $this->_level++; $expsub = preg_replace_callback( $this->regex, array(&$this, 'process'), $matches[2] ); $this->_level--; } else { $expsub = $matches[2]; } // builds the option array $options = array('type' => 'start', 'level' => $this->_level, 'size' => $matches[1]); $statok = $this->wiki->addToken($this->rule, $options); $options['type'] = 'end'; return $statok . $expsub . $this->wiki->addToken($this->rule, $options); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Image.php 0000664 0001750 0001750 00000007653 13160726737 021311 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Image rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Image extends Text_Wiki_Parse { /** * Configuration keys for this rule * 'schemes' => URL scheme(s) (array) recognized by this rule, default is 'http|ftp|https|ftps' * That is some (array of) regex string(s), must be safe with a pattern delim '#' * 'extensions' => URL scheme(s) (array) recognized by this rule, default is 'jpg|jpeg|gif|png' * That is some (array of) regex string(s), must be safe with a pattern delim '#' * 'url_regexp' => the regexp used to match the url after 'scheme://' and before '.extension' * 'path_regexp' => the regexp used to match the local images path before '.extension' * * @access public * @var array 'config-key' => mixed config-value */ var $conf = array( 'schemes' => 'http|ftp|https|ftps', // can be also as array of regexps/strings 'extensions' => 'jpg|jpeg|gif|png', // can be also as array of regexps/strings 'url_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?(?:/[^\s"<>\\\#delim#\ca-\cz]*)?', 'local_regexp' => '(?:/?[^/\s"<\\\#delim#\ca-\cz]+)*' ); /** * Constructor. * We override the constructor to build up the regex from config * * @param object &$obj the base conversion handler * @return The parser object * @access public */ function __construct(&$obj) { $default = $this->conf; parent::__construct($obj); // convert the list of recognized schemes to a regex OR, $schemes = $this->getConf('schemes', $default['schemes']); $this->regex = '#\[img]((?:(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://' . $this->getConf('url_regexp', $default['url_regexp']); if ($local = $this->getConf('local_regexp', $default['local_regexp'])) { $this->regex .= '|' . ( is_array($local) ? implode('|', $local) : $local ); } $this->regex .= ')'; // add the extensions if any if ($extensions = $this->getConf('extensions', array())) { if (is_array($extensions)) { $extensions = implode('|', $extensions); } $this->regex .= '\.(?:' . $extensions . ')'; } // replace delim in the regexps $this->regex = str_replace( '#delim#', $this->wiki->delim, $this->regex); $this->regex .= ')\[/img]#i'; } /** * Generates a replacement token for the matched text. Token options are: * 'src' => the URL / path to the image * 'attr' => empty for basic BBCode * * @param array &$matches The array of matches from parse(). * @return string Delimited token representing the image * @access public */ function process(&$matches) { // tokenize return $this->wiki->addToken($this->rule, array('src' => $matches[1], 'attr' => array())); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Image2.php 0000664 0001750 0001750 00000000323 13160726737 021356 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Italic text rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Italic extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[i](.*?)\[/i]#i"; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @param array &$matches The array of matches from parse(). * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * @access public */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/List.php 0000664 0001750 0001750 00000014443 13160726737 021175 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * List rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_List extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[list(?:=(.+?))?]\n?((?:((?R))|.)*?)\[/list]\n?#msi"; /** * The regular expression used in second stage to find list's elements * used by process() to call back processElement() * * @access public * @var string * @see process() * @see processElement() */ var $regexElement = '#\[\*](.*?)(?=\[\*]|$)\n?#msi'; /** * The current list nesting depth, starts by zero * * @access private * @var int */ var $_level = 0; /** * The count of items for this level * * @access private * @var int */ var $_count = array(); /** * The type of list for this level ('bullet' or 'number') * * @access private * @var int */ var $_type = array(); /** * Generates a replacement for the matched text. Returned token options are: * 'type' => * 'bullet_list_start' : the start of a bullet list * 'bullet_list_end' : the end of a bullet list * 'number_list_start' : the start of a number list * 'number_list_end' : the end of a number list * 'item_start' : the start of item text (bullet or number) * 'item_end' : the end of item text (bullet or number) * 'unknown' : unknown type of list or item * * 'level' => the indent level (0 for the first level, 1 for the * second, etc) * * 'count' => the list item number at this level. not needed for * xhtml, but very useful for PDF and RTF. * * 'format' => the optional enumerating type : A, a, I, i, or 1 (default) * as HTML tag's type attribute (only for number_... type) * * 'key' => the optional starting number/letter (not for items) * * @param array &$matches The array of matches from parse(). * @return A delimited token to be used as a placeholder in * the source text and containing the original block of text * @access public */ function process(&$matches) { if (!empty($matches[3])) { $this->_level++; $expsub = preg_replace_callback( $this->regex, array(&$this, 'process'), $matches[2] ); $this->_level--; } else { $expsub = $matches[2]; } if ($matches[1]) { $this->_type[$this->_level] = 'number'; if (is_numeric($matches[1])) { $format = '1'; $key = $matches[1] + 0; } elseif (($matches[1] == 'i') || ($matches[1] == 'I')) { $format = $matches[1]; } else { $format = ($matches[1] >= 'a') && ($matches[1] <='z') ? 'a' : 'A'; $key = $matches[1]; } } else { $this->_type[$this->_level] = 'bullet'; } $this->_count[$this->_level] = -1; $sub = preg_replace_callback( $this->regexElement, array(&$this, 'processElement'), $expsub ); $param = array( 'level' => $this->_level, 'count' => $this->_count[$this->_level] ); $param['type'] = $this->_type[$this->_level].'_list_start'; if (isset($format)) { $param['format'] = $format; } if (isset($key)) { $param['key'] = $key; } $ret = $this->wiki->addToken($this->rule, $param ); $param['type'] = $this->_type[$this->_level].'_list_end'; return $ret . $sub . $this->wiki->addToken($this->rule, $param ); } /** * Generates a replacement for the matched list elements. Token options are: * 'type' => * '[listType]_item_start' : the start of item text (bullet or number) * '[listType]_item_end' : the end of item text (bullet or number) * where [listType] is bullet or number * * 'level' => the indent level (0 for the first level, 1 for the * second, etc) * * 'count' => the item ordeer at this level. * * @param array &$matches The array of matches from parse(). * @return A delimited token to be used as a placeholder in * the source text and containing the original block of text * @access public */ function processElement(&$matches) { return $this->wiki->addToken($this->rule, array( 'type' => $this->_type[$this->_level] . '_item_start', 'level' => $this->_level, 'count' => ++$this->_count[$this->_level]) ) . rtrim($matches[1]) . $this->wiki->addToken($this->rule, array( 'type' => $this->_type[$this->_level] . '_item_end', 'level' => $this->_level, 'count' => $this->_count[$this->_level]) ); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Registrylink.php 0000664 0001750 0001750 00000002553 13160726737 022747 0 ustar jan jan The application to link to. * 'args' => The parameters passed to the app/show method. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. */ public function process(&$matches) { @list($title, $call) = explode('|', $matches[1], 2); $opts = explode(' ', trim($call)); $method = trim(array_shift($opts)); parse_str(implode('&', $opts), $args); return $this->wiki->addToken($this->rule, array('title' => trim($title), 'method' => $method, 'args' => $args)); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Subscript.php 0000664 0001750 0001750 00000004367 13160726737 022244 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lgpl.html * GNU Lesser General Public License, version 2.1 * @version CVS: $Id$ */ // }}} // {{{ Class: Text_Wiki_Parse_Subscript /** * Subscript text rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Firman Wandayandi
* @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lgpl.html * GNU Lesser General Public License, version 2.1 * @version Release: @package_version@ */ class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse { // {{{ Properties /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[sub](.*?)\[/sub]#i"; // }}} // {{{ process() /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @param array &$matches The array of matches from parse(). * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * @access public */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Superscript.php 0000664 0001750 0001750 00000004366 13160726737 022610 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lgpl.html * GNU Lesser General Public License, version 2.1 * @version CVS: $Id$ */ // }}} // {{{ Class: Text_Wiki_Parse_Superscript /** * Superscript text rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Firman Wandayandi * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lgpl.html * GNU Lesser General Public License, version 2.1 * @version Release: @package_version@ */ class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse { // {{{ Properties /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[sup](.*?)\[/sup]#i"; // {{{ process() /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @param array &$matches The array of matches from parse(). * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * @access public */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } // }}} } // }}} /* * Local variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Underline.php 0000664 0001750 0001750 00000004112 13160726737 022177 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Underlined text rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Underline extends Text_Wiki_Parse { /** * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = "#\[u](.*?)\[/u]#i"; /** * Generates a replacement for the matched text. Token options are: * - 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @param array &$matches The array of matches from parse(). * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * @access public */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Url.php 0000664 0001750 0001750 00000016112 13160726737 021017 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Url rule parser class for BBCode. * * @category Text * @package Text_Wiki * @author Bertrand Gugger * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki_Parse::Text_Wiki_Parse() */ class Text_Wiki_Parse_Url extends Text_Wiki_Parse { /** * Configuration keys for this rule * 'schemes' => URL scheme(s) (array) recognized by this rule, default is the single rfc2396 pattern * That is some (array of) regex string(s), must be safe with a pattern delim '#' * 'refused' => which schemes are refused (usefull if 'schemes' is not an exhaustive list as by default * 'prefixes' => which prefixes are usable for "lazy" url as www.xxxx.yyyy... (defaulted to http://...) * 'host_regexp' => the regexp used to match the host part of url (after 'scheme://') * 'path_regexp' => the regexp used to match the rest of url (starting with '/' included) * 'user_regexp' => the regexp used to match user name in email * 'inline_enable' => are inline urls and emails enabled (default true) * * @var array 'config-key' => mixed config-value * @access public */ var $conf = array( 'schemes' => '[a-z][-+.a-z0-9]*', // can be also as array('htpp', 'htpps', 'ftp') 'refused' => array('script', 'about', 'applet', 'activex', 'chrome'), 'prefixes' => array('www', 'ftp'), 'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?', 'path_regexp' => '(?:/[^][\'\s"<\\\#delim#\ca-\cz]*)?', 'user_regexp' => '[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+(?:\.[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+)*', 'inline_enable' => true, 'relative_enable' => false ); /** * The regular expressions used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * @var string * @see parse() */ var $regex = array( '#\[url(?:(=)|])(#url#)(?(1)](.*?))\[/url]#mi', '#([\n\r\s#delim#])(#url#)#i', '#\[(email)(?:(=)|])(#email#)(?(2)](.*?))\[/email]#mi', '#([\n\r\s#delim#](mailto:)?)(#email#)#i', ); /** * Constructor. * We override the constructor to build up the regex from config * * @param object &$obj the base conversion handler * @return The parser object * @access public */ function __construct(&$obj) { $default = $this->conf; parent::__construct($obj); // store the list of refused schemes $this->refused = $this->getConf('refused', array()); if (is_string($this->refused)) { $this->refused = array($this->refused); } // convert the list of recognized schemes to a regex OR, $schemes = $this->getConf('schemes', $default['schemes']); $url = '(?:(' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://'; // add the "lazy" prefixes if any $prefixes = $this->getConf('prefixes', array()); foreach ($prefixes as $val) { $url .= '|' . preg_quote($val, '#') . '\.'; } $host = $this->getConf('host_regexp', $default['host_regexp']); $path = $this->getConf('path_regexp', $default['path_regexp']); // the full url regexp $url .= ')' . $host . $path; // the full email regexp $email = $this->getConf('user_regexp', $default['user_regexp']) . '@' . $host; // inline to disable ? if (!$this->getConf('inline_enable', true)) { unset($this->regex[1]); unset($this->regex[3]); } // relative url to enable ? if ($this->getConf('relative_enable', false)) { $this->regex[5] = str_replace( '#url#', $path, $this->regex[0]); } // replace in the regexps $this->regex = str_replace( '#url#', $url, $this->regex); $this->regex = str_replace( '#email#', $email, $this->regex); $this->regex = str_replace( '#delim#', $this->wiki->delim, $this->regex); } /** * Generates a replacement for the matched text. Token options are: * 'type' => ['inline'|'footnote'|'descr'] the type of URL * 'href' => the URL link href portion * 'text' => the displayed text of the URL link * * @param array &$matches The array of matches from parse(). * @return string Delimited token representing the url * @access public */ function process(&$matches) { if ($this->refused && isset($matches[3]) && in_array($matches[3], $this->refused)) { return $matches[0]; } $pre = ''; $type = 'inline'; if (isset($matches[1])) { if (strpos(strtolower($matches[1]), 'mail')) { if (isset($matches[2])) { if ($matches[2] === '=') { $type = 'descr'; } elseif ($matches[2]) { $pre = $matches[1]{0}; } } $matches[2] = 'mailto:' . $matches[3]; if (!isset($matches[4])) { $matches[4] = $matches[3]; } } elseif ($matches[1] === '=') { $type = 'descr'; } else { $pre = $matches[1]; if (!$matches[2]) { $matches[2] = 'mailto:' . $matches[3]; $matches[4] = $matches[3]; } } } // set options $href = (isset($matches[3]) ? '' : 'http://') . $matches[2]; $text = isset($matches[4]) ? $matches[4] : $matches[2]; // tokenize if ($type == 'inline') { return $pre . $this->wiki->addToken($this->rule, array( 'type' => $type, 'href' => $href, 'text' => $text)); } return $pre . $this->wiki->addToken($this->rule, array( 'type' => 'start', 'href' => $href, 'text' => '')) . $text . $this->wiki->addToken($this->rule, array( 'type' => 'end', 'href' => $href, 'text' => '')); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/BBCode/Wickedblock.php 0000664 0001750 0001750 00000002361 13160726737 022477 0 ustar jan jan The image source, typically a relative path name. * 'opts' => Any macro options following the source. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. */ public function process(&$matches) { $args = array(); foreach (explode(' ', $matches[3], 2) as $pair) { @list($arg, $value) = explode('=', $pair); $args[$arg] = $value; } return $this->wiki->addToken( $this->rule, array('app' => $matches[1], 'block' => $matches[2], 'args' => $args)); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Anchor.php 0000664 0001750 0001750 00000003322 13160726737 021635 0 ustar jan jan * * @author Paul M. Jones * * @license LGPL * * @version $Id$ * */ /** * * This class implements a Text_Wiki_Parse to add an anchor target name * in the wiki page. * * @author Manuel Holtgrewe * * @author Paul M. Jones * * @category Text * * @package Text_Wiki * */ //Not used in CoWiki class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse { /** * * The regular expression used to find source text matching this * rule. Looks like a macro: [[# anchor_name]] * * @access public * * @var string * */ var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i'; /** * * Generates a token entry for the matched text. Token options are: * * 'text' => The full matched text, not including the tags. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. * */ function process(&$matches) { $name = $matches[2]; $text = $matches[3]; $start = $this->wiki->addToken( $this->rule, array('type' => 'start', 'name' => $name) ); $end = $this->wiki->addToken( $this->rule, array('type' => 'end', 'name' => $name) ); // done, place the script output directly in the source return $start . trim($text) . $end; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Attribute.php 0000664 0001750 0001750 00000002746 13160726737 022377 0 ustar jan jan regex = '/((?:\[\[' . Wicked::REGEXP_WIKIWORD . ':\s+.*?\]\]\s*)+)/'; } /** * Generates a token entry for the matched text. Token options are: * * 'src' => The image source, typically a relative path name. * 'opts' => Any macro options following the source. * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. */ public function process(&$matches) { $options = array('attributes' => array()); $text = $matches[1]; while (preg_match('/^\[\[(' . Wicked::REGEXP_WIKIWORD . '):\s+(.*?)\]\]\s*(.*)$/s', $text, $sub)) { $options['attributes'][] = array('name' => $sub[1], 'value' => $sub[2]); $text = $sub[3]; } return $this->wiki->addToken($this->rule, $options); } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Blockquote.php 0000664 0001750 0001750 00000011353 13160726737 022536 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parse for block-quoted text. * * Find source text marked as a blockquote, identified by any number of * greater-than signs '>' at the start of the line, followed by a space, * and then the quote text; each '>' indicates an additional level of * quoting. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones
* */ //Not really used in CoWiki...sort of like class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { /** * * Regex for parsing the source text. * * @access public * * @var string * * @see parse() * */ var $regex = '/\n((\>).*\n)(?!(\>))/Us'; /** * * Generates a replacement for the matched text. * * Token options are: * * 'type' => * 'start' : the start of a blockquote * 'end' : the end of a blockquote * * 'level' => the indent level (0 for the first level, 1 for the * second, etc) * * @access public * * @param array &$matches The array of matches from parse(). * * @return A series of text and delimited tokens marking the different * list text and list elements. * */ function process(&$matches) { // the replacement text we will return to parse() $return = ''; // the list of post-processing matches $list = array(); // $matches[1] is the text matched as a list set by parse(); // create an array called $list that contains a new set of // matches for the various list-item elements. preg_match_all( '=^(\>+) (.*\n)=Ums', $matches[1], $list, PREG_SET_ORDER ); // a stack of starts and ends; we keep this so that we know what // indent level we're at. $stack = array(); // loop through each list-item element. foreach ($list as $key => $val) { // $val[0] is the full matched list-item line // $val[1] is the number of initial '>' chars (indent level) // $val[2] is the quote text // we number levels starting at 1, not zero $level = strlen($val[1]); // get the text of the line $text = $val[2]; // add a level to the list? while ($level > count($stack)) { // the current indent level is greater than the number // of stack elements, so we must be starting a new // level. push the new level onto the stack with a // dummy value (boolean true)... array_push($stack, true); $return .= "\n"; // ...and add a start token to the return. $return .= $this->wiki->addToken( $this->rule, array( 'type' => 'start', 'level' => $level - 1 ) ); $return .= "\n\n"; } // remove a level? while (count($stack) > $level) { // as long as the stack count is greater than the // current indent level, we need to end list types. // continue adding end-list tokens until the stack count // and the indent level are the same. array_pop($stack); $return .= "\n\n"; $return .= $this->wiki->addToken( $this->rule, array ( 'type' => 'end', 'level' => count($stack) ) ); $return .= "\n"; } // add the line text. $return .= $text; } // the last line may have been indented. go through the stack // and create end-tokens until the stack is empty. $return .= "\n"; while (count($stack) > 0) { array_pop($stack); $return .= $this->wiki->addToken( $this->rule, array ( 'type' => 'end', 'level' => count($stack) ) ); } // we're done! send back the replacement text. return "\n$return\n\n"; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Bold.php 0000664 0001750 0001750 00000003213 13160726737 021302 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for bold text. * * This class implements a Text_Wiki_Rule to find source text marked for * strong emphasis (bold) as defined by text surrounded by three * single-quotes. On parsing, the text itself is left in place, but the * starting and ending instances of three single-quotes are replaced with * tokens. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones * */ class Text_Wiki_Parse_Bold extends Text_Wiki_Parse { /** * * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * * @var string * * @see parse() * */ var $regex = '/\*(()|.*)\*/U'; /** * * Generates a replacement for the matched text. Token options are: * * 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A pair of delimited tokens to be used as a placeholder in * the source text surrounding the text to be emphasized. * */ function process(&$matches) { $start = $this->wiki->addToken($this->rule, array('type' => 'start')); $end = $this->wiki->addToken($this->rule, array('type' => 'end')); return $start . $matches[1] . $end; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Break.php 0000664 0001750 0001750 00000002232 13160726737 021446 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for explicit line breaks. * * This class implements a Text_Wiki_Parse to mark forced line breaks in the * source text. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones * */ //Not used in CoWiki class Text_Wiki_Parse_Break extends Text_Wiki_Parse { /** * * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * * @var string * * @see parse() * */ var $regex = '/ \\\n/'; /** * * Generates a replacement token for the matched text. * * @access public * * @param array &$matches The array of matches from parse(). * * @return string A delimited token to be used as a placeholder in * the source text. * */ function process(&$matches) { return $this->wiki->addToken($this->rule); } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Center.php 0000664 0001750 0001750 00000002566 13160726737 021654 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for centered lines of text. * * This class implements a Text_Wiki_Parse to find lines marked for centering. * The line must start with "= " (i.e., an equal-sign followed by a space). * * @category Text * * @package Text_Wiki * * @author Paul M. Jones * */ //None in CoWiki class Text_Wiki_Parse_Center extends Text_Wiki_Parse { /** * * The regular expression used to find source text matching this * rule. * * @access public * * @var string * */ var $regex = '/\n::(.*?)::\n/'; /** * * Generates a token entry for the matched text. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. * */ function process(&$matches) { $start = $this->wiki->addToken( $this->rule, array('type' => 'start') ); $end = $this->wiki->addToken( $this->rule, array('type' => 'end') ); return "\n" . $start . $matches[1] . $end . "\n"; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Code.php 0000664 0001750 0001750 00000004276 13160726737 021306 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for text marked as a code example block. * * This class implements a Text_Wiki_Parse to find sections marked as code * examples. Blocks are marked as the string on a line by itself, * followed by the inline code example, and terminated with the string *
on a line by itself. The code example is run through the * native PHP highlight_string() function to colorize it, then surrounded * with...tags when rendered as XHTML. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones* */ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { /** * * The regular expression used to find source text matching this * rule. * * @access public * * @var string * */ var $regex = '/^( ]*)?>)\n(.+)\n(<\/code>)(\s|$)/Umsi'; /** * * Generates a token entry for the matched text. Token options are: * * 'text' => The full matched text, not including the
tags. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. * */ function process(&$matches) { // are there additional attribute arguments? $args = trim($matches[2]); if ($args == '') { $options = array( 'text' => $matches[3], 'attr' => array('type' => '') ); } else { // get the attributes... $attr = $this->getAttrs($args); // ... and make sure we have a 'type' if (!isset($attr['type'])) { $attr['type'] = ''; } // retain the options $options = array( 'text' => $matches[3], 'attr' => $attr ); } return $this->wiki->addToken($this->rule, $options) . $matches[5]; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Code2.php 0000664 0001750 0001750 00000000317 13160726737 021360 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for colorized text. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones
* */ //Not used in CoWiki class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse { /** * * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * * @var string * * @see parse() * */ var $regex = "/~~(.+?):(.+?)~~/"; /** * * Generates a replacement for the matched text. Token options are: * * 'type' => ['start'|'end'] The starting or ending point of the * emphasized text. The text itself is left in the source. * * 'color' => the color indicator * * @access public * * @param array &$matches The array of matches from parse(). * * @return string A pair of delimited tokens to be used as a * placeholder in the source text surrounding the text to be * emphasized. * */ function process(&$matches) { $start = $this->wiki->addToken( $this->rule, array( 'type' => 'start', 'color' => $matches[1] ) ); $end = $this->wiki->addToken( $this->rule, array( 'type' => 'end', 'color' => $matches[1] ) ); return $start . $matches[2] . $end; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Deflist.php 0000664 0001750 0001750 00000006437 13160726737 022027 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for definition lists. * * This class implements a Text_Wiki_Parse to find source text marked as a * definition list. In short, if a line starts with ':' then it is a * definition list item; another ':' on the same line indicates the end * of the definition term and the beginning of the definition narrative. * The list items must be on sequential lines (no blank lines between * them) -- a blank line indicates the beginning of a new list. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones * */ //Not used in CoWiki class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse { /** * * The regular expression used to parse the source text and find * matches conforming to this rule. Used by the parse() method. * * @access public * * @var string * * @see parse() * */ var $regex = '/\n((; ).*\n)(?!(; |\n))/Us'; /** * * Generates a replacement for the matched text. Token options are: * * 'type' => * 'list_start' : the start of a definition list * 'list_end' : the end of a definition list * 'term_start' : the start of a definition term * 'term_end' : the end of a definition term * 'narr_start' : the start of definition narrative * 'narr_end' : the end of definition narrative * 'unknown' : unknown type of definition portion * * @access public * * @param array &$matches The array of matches from parse(). * * @return A series of text and delimited tokens marking the different * list text and list elements. * */ function process(&$matches) { // the replacement text we will return to parse() $return = ''; // the list of post-processing matches $list = array(); // start the deflist $options = array('type' => 'list_start'); $return .= $this->wiki->addToken($this->rule, $options); // $matches[1] is the text matched as a list set by parse(); // create an array called $list that contains a new set of // matches for the various definition-list elements. preg_match_all( '/^(; )(.*)?( ; )(.*)?$/Ums', $matches[1], $list, PREG_SET_ORDER ); // add each term and narrative foreach ($list as $key => $val) { $return .= ( $this->wiki->addToken($this->rule, array('type' => 'term_start')) . trim($val[2]) . $this->wiki->addToken($this->rule, array('type' => 'term_end')) . $this->wiki->addToken($this->rule, array('type' => 'narr_start')) . trim($val[4]) . $this->wiki->addToken($this->rule, array('type' => 'narr_end')) ); } // end the deflist $options = array('type' => 'list_end'); $return .= $this->wiki->addToken($this->rule, $options); // done! return "\n" . $return . "\n\n"; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Delimiter.php 0000664 0001750 0001750 00000003245 13160726737 022345 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Parses for Text_Wiki delimiter characters already in the source text. * * This class implements a Text_Wiki_Parse to find instances of the delimiter * character already embedded in the source text; it extracts them and replaces * them with a delimited token, then renders them as the delimiter itself * when the target format is XHTML. * * @category Text * * @package Text_Wiki * * @author Paul M. Jones * */ class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse { /** * * Constructor. Overrides the Text_Wiki_Parse constructor so that we * can set the $regex property dynamically (we need to include the * Text_Wiki $delim character. * * @param object &$obj The calling "parent" Text_Wiki object. * * @param string $name The token name to use for this rule. * */ function __construct(&$obj) { parent::__construct($obj); $this->regex = '/' . $this->wiki->delim . '/'; } /** * * Generates a token entry for the matched text. Token options are: * * 'text' => The full matched text. * * @access public * * @param array &$matches The array of matches from parse(). * * @return A delimited token number to be used as a placeholder in * the source text. * */ function process(&$matches) { return $this->wiki->addToken( $this->rule, array('text' => $this->wiki->delim) ); } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Parse/Cowiki/Embed.php 0000664 0001750 0001750 00000004451 13160726737 021443 0 ustar jan jan * * @license LGPL * * @version $Id$ * */ /** * * Embeds the results of a PHP script at render-time. * * This class implements a Text_Wiki_Parse to embed the contents of a URL * inside the page at render-time. Typically used to get script output. * This differs from the 'include' rule, which incorporates results at * parse-time; 'embed' output does not get parsed by Text_Wiki, while * 'include' ouput does. * * This rule is inherently not secure; it allows cross-site scripting to * occur if the embedded output has '; } } else { $js = ''; } return $js.' '; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Heading2.php 0000664 0001750 0001750 00000000162 13160726740 022051 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders an horizontal bar in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { $css = $this->formatConf(' class="%s"', 'css'); return "
\n"; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Html.php 0000664 0001750 0001750 00000002146 13160726740 021340 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders preformated html in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render { /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { return $options['text']; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Image.php 0000664 0001750 0001750 00000013567 13160726740 021467 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class inserts an image in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render { var $conf = array( 'base' => '/', 'url_base' => null, 'css' => null, 'css_link' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { // note the image source $src = $options['src']; // is the source a local file or URL? if (strpos($src, '://') === false) { // the source refers to a local file. // add the URL base to it. $src = $this->getConf('base', '/') . $src; } // stephane@metacites.net // is the image clickable? if (isset($options['attr']['link'])) { // yes, the image is clickable. // are we linked to a URL or a wiki page? if (strpos($options['attr']['link'], '://')) { // it's a URL, prefix the URL base $href = $this->getConf('url_base') . $options['attr']['link']; } else { // it's a WikiPage; assume it exists. /** @todo This needs to honor sprintf wikilinks (pmjones) */ /** @todo This needs to honor interwiki (pmjones) */ /** @todo This needs to honor freelinks (pmjones) */ $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') . $options['attr']['link']; } } else { // image is not clickable. $href = null; } // unset so it won't show up as an attribute unset($options['attr']['link']); // stephane@metacites.net -- 25/07/2004 // use CSS for all alignment if (isset($options['attr']['align'])) { // make sure we have a style attribute if (!isset($options['attr']['style'])) { // no style, set up a blank one $options['attr']['style'] = ''; } else { // style exists, add a space $options['attr']['style'] .= ' '; } if ($options['attr']['align'] == 'center') { // add a "center" style to the existing style. $options['attr']['style'] .= 'display: block; margin-left: auto; margin-right: auto;'; } else { // add a float style to the existing style $options['attr']['style'] .= 'float: '.$options['attr']['align']; } // unset so it won't show up as an attribute unset($options['attr']['align']); } // stephane@metacites.net -- 25/07/2004 // try to guess width and height if (! isset($options['attr']['width']) && ! isset($options['attr']['height'])) { // does the source refer to a local file or a URL? if (strpos($src,'://')) { // is a URL link $imageFile = $src; } elseif ($src[0] == '.') { // reg at dav-muz dot net -- 2005-03-07 // is a local file on relative path. $imageFile = $src; # ...don't do anything because it's perfect! } else { // is a local file on absolute path. $imageFile = $_SERVER['DOCUMENT_ROOT'] . $src; } // attempt to get the image size $imageSize = @getimagesize($imageFile); if (is_array($imageSize)) { $options['attr']['width'] = $imageSize[0]; $options['attr']['height'] = $imageSize[1]; } } // start the HTML output $output = ' formatConf(' class="%s"', 'css'); // add the attributes to the output, and be sure to // track whether or not we find an "alt" attribute $alt = false; foreach ($options['attr'] as $key => $val) { // track the 'alt' attribute if (strtolower($key) == 'alt') { $alt = true; } // the 'class' attribute overrides the CSS class conf if (strtolower($key) == 'class') { $css = null; } $key = $this->textEncode($key); $val = $this->textEncode($val); $output .= " $key=\"$val\""; } // always add an "alt" attribute per Stephane Solliec if (! $alt) { $alt = $this->textEncode(basename($options['src'])); $output .= " alt=\"$alt\""; } // end the image tag with the automatic CSS class (if any) $output .= "$css />"; // was the image clickable? if ($href) { // yes, add the href and return $href = $this->textEncode($href); $css = $this->formatConf(' class="%s"', 'css_link'); $output = "$output"; } return $output; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Image2.php 0000664 0001750 0001750 00000012336 13160726740 021542 0 ustar jan jan '', 'url_base' => null, 'css' => null, 'css_link' => null ); /** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { if (!isset($options['attr']['alt'])) { $options['attr']['alt'] = $options['src']; } if (strpos($options['src'], '://') === false) { if ($options['src'][0] != '/') { if (strpos($options['src'], ':')) { list($page, $options['src']) = explode(':', $options['src'], 2); } else { $page = Horde_Util::getFormData('page'); if ($page == 'EditPage') { $page = Horde_Util::getFormData('referrer'); } if (empty($page)) { $page = 'Wiki/Home'; } } $params = array('page' => $page, 'mime' => '1', 'file' => $options['src']); $options['src'] = $GLOBALS['registry'] ->downloadUrl($options['src'], $params) ->setRaw(true); } } else { $options['src'] = new Horde_Url(Horde::externalUrl($options['src'])); $options['src']->setRaw(true); } // Send external links through Horde::externalUrl(). if (isset($options['attr']['link']) && strpos($options['attr']['link'], '://')) { $href = htmlspecialchars($options['attr']['link']); unset($options['attr']['link']); return Horde::link(Horde::externalUrl($href), $href) . $this->_token($options) . ''; } else { return $this->_token($options); } } /** * Render code from Text_Wiki's Image with Horde tweaks (remove * getimagesize call, etc). * * @access private * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ protected function _token($options) { // note the image source $src = $options['src']; // is the source a local file or URL? if (strpos($src, '://') === false) { // the source refers to a local file. // add the URL base to it. $src = $this->getConf('base', '/') . $src; } // stephane@metacites.net // is the image clickable? if (isset($options['attr']['link'])) { // yes, the image is clickable. // are we linked to a URL or a wiki page? if (strpos($options['attr']['link'], '://')) { // it's a URL, prefix the URL base $href = $this->getConf('url_base') . $options['attr']['link']; } else { // it's a WikiPage; assume it exists. /** @todo This needs to honor sprintf wikilinks (pmjones) */ /** @todo This needs to honor interwiki (pmjones) */ /** @todo This needs to honor freelinks (pmjones) */ $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') . $options['attr']['link']; } } else { // image is not clickable. $href = null; } // unset so it won't show up as an attribute unset($options['attr']['link']); // start the HTML output $output = '
formatConf(' class="%s"', 'css'); // add the attributes to the output, and be sure to // track whether or not we find an "alt" attribute $alt = false; foreach ($options['attr'] as $key => $val) { // track the 'alt' attribute if (strtolower($key) == 'alt') { $alt = true; } // the 'class' attribute overrides the CSS class conf if (strtolower($key) == 'class') { $css = null; } $key = htmlspecialchars($key); $val = htmlspecialchars($val); $output .= " $key=\"$val\""; } // always add an "alt" attribute per Stephane Solliec if (!$alt) { $alt = htmlspecialchars(basename($options['src'])); $output .= " alt=\"$alt\""; } // end the image tag with the automatic CSS class (if any) $output .= "$css />"; // was the image clickable? if ($href) { // yes, add the href and return $href = htmlspecialchars($href); $css = $this->formatConf(' class="%s"', 'css_link'); $output = "$output"; } return $output; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Include.php 0000664 0001750 0001750 00000001503 13160726740 022013 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders included maekup in XHTML. (empty) * * @category Text * @package Text_Wiki * @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render { function token() { return ''; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php 0000664 0001750 0001750 00000003133 13160726740 022376 0 ustar jan jan array( 'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s', 'Advogato' => 'http://advogato.org/%s', 'Wiki' => 'http://c2.com/cgi/wiki?%s', 'Bookshelved' => 'http://bookshelved.org/cgi-bin/wiki.pl?%s' ), 'target' => '_blank' ); /** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { $site = $options['site']; $page = $options['page']; $text = $options['text']; if (isset($this->conf['sites'][$site])) { $href = $this->conf['sites'][$site]; } else { return $text; } // old form where page is at end, // or new form with %s placeholder for sprintf()? if (strpos($href, '%s') === false) { // use the old form $href = $href . $page; } else { // use the new form $href = sprintf($href, $page); } // allow for alternative targets $target = $this->getConf('target', ''); if ($target && trim($target) != '') { $target = " target=\"$target\""; } return '' . $text . ''; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Italic.php 0000664 0001750 0001750 00000002526 13160726740 021643 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders italic text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/List.php 0000664 0001750 0001750 00000011115 13160726740 021343 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders bullet and ordered lists in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render { var $conf = array( 'css_ol' => null, 'css_ol_li' => null, 'css_ul' => null, 'css_ul_li' => null ); /** * * Renders a token into text matching the requested format. * * This rendering method is syntactically and semantically compliant * with XHTML 1.1 in that sub-lists are part of the previous list item. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { // make nice variables (type, level, count) extract($options); // set up indenting so that the results look nice; we do this // in two steps to avoid str_pad mathematics. ;-) $pad = str_pad('', $level, "\t"); $pad = str_replace("\t", ' ', $pad); switch ($type) { case 'bullet_list_start': // build the base HTML $css = $this->formatConf(' class="%s"', 'css_ul'); $html = " "; /* // if this is the opening block for the list, // put an extra newline in front of it so the // output looks nice. if ($level == 0) { $html = "\n$html"; } */ // done! return $html; break; case 'bullet_list_end': // build the base HTML $html = "\n$pad
"; // if this is the closing block for the list, // put extra newlines after it so the output // looks nice. if ($level == 0) { $html .= "\n\n"; } // done! return $html; break; case 'number_list_start': if (isset($format)) { $format = ' type="' . $format . '"'; } else { $format = ''; } // build the base HTML $css = $this->formatConf(' class="%s"', 'css_ol'); $html = ""; /* // if this is the opening block for the list, // put an extra newline in front of it so the // output looks nice. if ($level == 0) { $html = "\n$html"; } */ // done! return $html; break; case 'number_list_end': // build the base HTML $html = "\n$pad
"; // if this is the closing block for the list, // put extra newlines after it so the output // looks nice. if ($level == 0) { $html .= "\n\n"; } // done! return $html; break; case 'bullet_item_start': case 'number_item_start': // pick the proper CSS class if ($type == 'bullet_item_start') { $css = $this->formatConf(' class="%s"', 'css_ul_li'); } else { $css = $this->formatConf(' class="%s"', 'css_ol_li'); } // build the base HTML $html = "\n$pad- "; // for the very first item in the list, do nothing. // but for additional items, be sure to close the // previous item. if ($count > 0) { $html = "
$html"; } // done! return $html; break; case 'bullet_item_end': case 'number_item_end': default: // ignore item endings and all other types. // item endings are taken care of by the other types // depending on their place in the list. return ''; break; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Newline.php 0000664 0001750 0001750 00000001510 13160726740 022027 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders new lines in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render { function token($options) { return "
\n"; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Page.php 0000664 0001750 0001750 00000002173 13160726740 021310 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders page markers in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render { /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE'; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Paragraph.php 0000664 0001750 0001750 00000002554 13160726740 022344 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders paragraphs in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { extract($options); //type if ($type == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return " "; } if ($type == 'end') { return "
\n\n"; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Phplookup.php 0000664 0001750 0001750 00000004342 13160726740 022415 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders a link to php functions description in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render { var $conf = array( 'target' => '_blank', 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { $text = trim($options['text']); $css = $this->formatConf(' class="%s"', 'css'); // start the html $output = "getConf('target', ''); if ($target && $target != '_self') { // use a "popup" window. this is XHTML compliant, suggested by // Aaron Kalin. uses the $target as the new window name. $target = $this->textEncode($target); $output .= " onclick=\"window.open(this.href, '$target');"; $output .= " return false;\""; } // take off the final parens for functions if (substr($text, -2) == '()') { $q = substr($text, 0, -2); } else { $q = $text; } // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) $q = $this->urlEncode($q); $text = $this->textEncode($text); // finish and return $output .= " href=\"http://php.net/$q\">$text"; return $output; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Plugin.php 0000664 0001750 0001750 00000002261 13160726740 021670 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders wiki plugins in XHTML. (empty) * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render { /** * * Renders a token into text matching the requested format. * Plugins produce wiki markup so are processed by parsing, no tokens produced * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { return ''; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Prefilter.php 0000664 0001750 0001750 00000001762 13160726740 022373 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so * that line endings are consistently \n, lines ending in a backslash \ * are concatenated with the next line, and tabs are converted to spaces. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render { function token() { return ''; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Preformatted.php 0000664 0001750 0001750 00000002260 13160726740 023065 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders preformated text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render { /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { $text = $this->textEncode($options['text']); return ' '.$text.''; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Raw.php 0000664 0001750 0001750 00000002172 13160726740 021164 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders not processed blocks in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render { /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { return $this->textEncode($options['text']); } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Registrylink.php 0000664 0001750 0001750 00000001340 13160726740 023115 0 ustar jan jan link($options['method'], $options['args'])); } catch (Horde_Exception $e) { return $e->getMessage(); } return $link->link() . $options['title'] . ''; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Revise.php 0000664 0001750 0001750 00000003170 13160726740 021667 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders revision marks in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render { var $conf = array( 'css_ins' => null, 'css_del' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'del_start') { $css = $this->formatConf(' class="%s"', 'css_del'); return " "; } if ($options['type'] == 'del_end') { return ""; } if ($options['type'] == 'ins_start') { $css = $this->formatConf(' class="%s"', 'css_ins'); return ""; } if ($options['type'] == 'ins_end') { return ""; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Smiley.php 0000664 0001750 0001750 00000005011 13160726740 021670 0 ustar jan jan * @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * Smiley rule Xhtml render class * * @category Text * @package Text_Wiki * @author Bertrand Gugger* @copyright 2005 bertrand Gugger * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki * @see Text_Wiki::Text_Wiki_Render() */ class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render { /** * Configuration keys for this rule * 'prefix' => the path to smileys images inclusive file name prefix, * starts with '/' ==> abolute reference * if no file names prefix but some folder, terminates with '/' * 'extension' => the file extension (inclusive '.'), e.g. : * if prefix 'smileys/icon_' and extension '.gif' * ':)' whose name is 'smile' will give relative file 'smileys/icon_smile.gif' * if prefix '/image/smileys/' and extension '.png': absolute '/image/smileys/smile.gif' * 'css' => optional style applied to smileys * * @access public * @var array 'config-key' => mixed config-value */ var $conf = array( 'prefix' => 'images/smiles/icon_', 'extension' => '.gif', 'css' => null ); /** * Renders a token into text matching the requested format. * process the Smileys * * @access public * @param array $options The "options" portion of the token (second element). * @return string The text rendered from the token options. */ function token($options) { $imageFile = $this->getConf('prefix') . $options['name'] . $this->getConf('extension'); // attempt to get the image size $imageSize = @getimagesize($imageFile); // return the HTML output return ' formatConf(' class="%s"', 'css') . ' />'; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Specialchar.php 0000664 0001750 0001750 00000003101 13160726740 022642 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders special characters in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render { var $types = array('~bs~' => '\', '~hs~' => ' ', '~amp~' => '&', '~ldq~' => '“', '~rdq~' => '”', '~lsq~' => '‘', '~rsq~' => '’', '~c~' => '©', '~--~' => '—', '" -- "' => '—', '" -- "' => '—', '~lt~' => '<', '~gt~' => '>'); function token($options) { if (isset($this->types[$options['char']])) { return $this->types[$options['char']]; } else { return ''.substr($options['char'], 1, -1).';'; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Strong.php 0000664 0001750 0001750 00000002553 13160726740 021712 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders text marked as strong in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Subscript.php 0000664 0001750 0001750 00000002543 13160726740 022413 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders subscript text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Superscript.php 0000664 0001750 0001750 00000002551 13160726740 022757 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders superscript text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Table.php 0000664 0001750 0001750 00000006562 13160726740 021471 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders tables in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render { var $conf = array( 'css_table' => null, 'css_caption' => null, 'css_tr' => null, 'css_th' => null, 'css_td' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { // make nice variable names (type, attr, span) $span = $rowspan = 1; extract($options); // free format $format = isset($format) ? ' '. $format : ''; $pad = ' '; switch ($type) { case 'table_start': $css = $this->formatConf(' class="%s"', 'css_table'); return "\n\n \n"; break; case 'table_end': return "
\n\n"; break; case 'caption_start': $css = $this->formatConf(' class="%s"', 'css_caption'); return "\n"; break; case 'caption_end': return " \n"; break; case 'row_start': $css = $this->formatConf(' class="%s"', 'css_tr'); return "$pad\n"; break; case 'row_end': return "$pad \n"; break; case 'cell_start': // base html $html = $pad . $pad; // is this a TH or TD cell? if ($attr == 'header') { // start a header cell $css = $this->formatConf(' class="%s"', 'css_th'); $html .= "formatConf(' class="%s"', 'css_td'); $html .= " 1) { $html .= " colspan=\"$span\""; } // add the row span if ($rowspan > 1) { $html .= " rowspan=\"$rowspan\""; } // add alignment if ($attr != 'header' && $attr != '') { $html .= " style=\"text-align: $attr;\""; } // done! $html .= "$format>"; return $html; break; case 'cell_end': if ($attr == 'header') { return "\n"; } else { return " \n"; } break; default: return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Tighten.php 0000664 0001750 0001750 00000001502 13160726740 022031 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class makes the tightening in XHTML. (empty) * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render { function token() { return ''; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Titlebar.php 0000664 0001750 0001750 00000002544 13160726740 022204 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders a title bar in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render { var $conf = array( 'css' => 'titlebar' ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return " "; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php 0000664 0001750 0001750 00000005547 13160726740 021171 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class inserts a table of content in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render { var $conf = array( 'css_list' => null, 'css_item' => null, 'title' => 'Table of Contents', 'div_id' => 'toc', 'base_url' => '', 'collapse' => true ); var $min = 2; /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { // type, id, level, count, attr extract($options); switch ($type) { case 'list_start': $css = $this->getConf('css_list'); $html = ''; // collapse div within a table? if ($this->getConf('collapse')) { $html .= ' '; $html .= "
\n\n"; } else { return "\n\n\n"; } break; case 'item_start': $html = "\n\t\n"; } // add the div, class, and id $html .= ' getConf('div_id'); if ($div_id) { $html .= " id=\"$div_id\""; } // add the title, and done $html .= '>'; $html .= $this->getConf('title'); return $html; break; case 'list_end': if ($this->getConf('collapse')) { return "\n\ngetConf('css_item'); if ($css) { $html .= " class=\"$css\""; } $pad = ($level - $this->min); $html .= " style=\"margin-left: {$pad}em;\">"; $html .= ''; return $html; break; case 'item_end': return ""; break; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Toc2.php 0000664 0001750 0001750 00000004770 13160726740 021250 0 ustar jan jan null, 'css_item' => null, 'title' => 'Table of Contents', 'div_id' => 'toc', ); protected $_last_level = null; /** * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { // type, id, level, count, attr. extract($options); switch ($type) { case 'list_start': $GLOBALS['page_output']->addScriptFile('toc.js', 'wicked'); // Add the div, class, and id. $html = 'getConf('css_list'); if ($css) { $html .= " class=\"$css\""; } $div_id = $this->getConf('div_id'); if ($div_id) { $html .= " id=\"$div_id\""; } // Add the title, and done. return $html . '>' . $this->getConf('title') . '\n\n"; case 'item_start': $html = ''; if ($this->_last_level !== null) { if ($level > $this->_last_level) { while ($level > $this->_last_level) { $html .= ''; case 'list_end': $html = ''; while ($this->_last_level > 1) { $html .= '
'; --$this->_last_level; } return $html . "\n'; ++$this->_last_level; } $html .= '
'; --$this->_last_level; } $html .= '- _last_level) { while ($level < $this->_last_level) { $html .= '
- _last_level = $level; $css = $this->getConf('css_item'); if ($css) { $html .= " class=\"$css\""; } return $html . ">"; case 'item_end': return ''; } } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Tt.php 0000664 0001750 0001750 00000002525 13160726740 021024 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders monospaced text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Underline.php 0000664 0001750 0001750 00000002540 13160726740 022357 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders underlined text in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render { var $conf = array( 'css' => null ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); return ""; } if ($options['type'] == 'end') { return ''; } } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Url.php 0000664 0001750 0001750 00000002466 13160726740 021203 0 ustar jan jan '_blank' ); /** * Renders a token into text matching the requested format. * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. */ public function token($options) { // Create local variables from the options array (text, href, // type). extract($options); // Find the rightmost dot and determine the filename // extension. $pos = strrpos($href, '.'); $ext = Horde_String::lower(substr($href, $pos + 1)); $href = htmlspecialchars($href); // Allow for alternative targets on non-anchor HREFs. if ($href[0] == '#') { $target = ''; } else { $target = $this->getConf('target', ''); } $output = Horde::link(Horde::externalUrl($href), $href, 'external', htmlspecialchars($target)) . htmlspecialchars($text) . ''; // Make numbered references look like footnotes. if ($type == 'footnote') { $output = '' . $output . ''; } return $output; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Wickedblock.php 0000664 0001750 0001750 00000001603 13160726740 022652 0 ustar jan jan getInstance('Horde_Core_Factory_BlockCollection') ->create() ->getBlock($options['app'], $options['app'] . '_Block_' . $options['block'], $options['args']) ->getContent(); } catch (Horde_Exception $e) { return $e->getMessage(); } } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php 0000664 0001750 0001750 00000013422 13160726740 022214 0 ustar jan jan * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Text_Wiki */ /** * This class renders wiki links in XHTML. * * @category Text * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render { var $conf = array( 'pages' => array(), // set to null or false to turn off page checks 'view_url' => 'http://example.com/index.php?page=%s', 'new_url' => 'http://example.com/new.php?page=%s', 'new_text' => '?', 'new_text_pos' => 'after', // 'before', 'after', or null/false 'css' => null, 'css_new' => null, 'exists_callback' => null // call_user_func() callback ); /** * * Renders a token into XHTML. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { // make nice variable names (page, anchor, text) extract($options); // is there a "page existence" callback? // we need to access it directly instead of through // getConf() because we'll need a reference (for // object instance method callbacks). if (isset($this->conf['exists_callback'])) { $callback =& $this->conf['exists_callback']; } else { $callback = false; } if ($callback) { // use the callback function $exists = call_user_func($callback, $page); } else { // no callback, go to the naive page array. $list = $this->getConf('pages'); if (is_array($list)) { // yes, check against the page list $exists = in_array($page, $list); } else { // no, assume it exists $exists = true; } } $anchor = '#'.$this->urlEncode(substr($anchor, 1)); // does the page exist? if ($exists) { // PAGE EXISTS. // link to the page view, but we have to build // the HREF. we support both the old form where // the page always comes at the end, and the new // form that uses %s for sprintf() $href = $this->getConf('view_url'); if (strpos($href, '%s') === false) { // use the old form (page-at-end) $href = $href . $this->urlEncode($page) . $anchor; } else { // use the new form (sprintf format string) $href = sprintf($href, $this->urlEncode($page)) . $anchor; } // get the CSS class and generate output $css = ' class="'.$this->textEncode($this->getConf('css')).'"'; $start = ''; $end = ''; } else { // PAGE DOES NOT EXIST. // link to a create-page url, but only if new_url is set $href = $this->getConf('new_url', null); // set the proper HREF if (! $href || trim($href) == '') { // no useful href, return the text as it is //TODO: This is no longer used, need to look closer into this branch $output = $text; } else { // yes, link to the new-page href, but we have to build // it. we support both the old form where // the page always comes at the end, and the new // form that uses sprintf() if (strpos($href, '%s') === false) { // use the old form $href = $href . $this->urlEncode($page); } else { // use the new form $href = sprintf($href, $this->urlEncode($page)); } } // get the appropriate CSS class and new-link text $css = ' class="'.$this->textEncode($this->getConf('css_new')).'"'; $new = $this->getConf('new_text'); // what kind of linking are we doing? $pos = $this->getConf('new_text_pos'); if (! $pos || ! $new) { // no position (or no new_text), use css only on the page name $start = ''; $end = ''; } elseif ($pos == 'before') { // use the new_text BEFORE the page name $start = ''.$this->textEncode($new).''; $end = ''; } else { // default, use the new_text link AFTER the page name $start = ''; $end = ''.$this->textEncode($new).''; } } if (!strlen($text)) { $start .= $this->textEncode($page); } if (isset($type)) { switch ($type) { case 'start': $output = $start; break; case 'end': $output = $end; break; } } else { $output = $start.$this->textEncode($text).$end; } return $output; } } ?> wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink2.php 0000664 0001750 0001750 00000007340 13160726740 022300 0 ustar jan jan conf['exists_callback'])) { $callback =& $this->conf['exists_callback']; } else { $callback = false; } if ($callback) { // use the callback function $exists = call_user_func($callback, $page); } else { // no callback, go to the naive page array. $list = $this->getConf('pages'); if (is_array($list)) { // yes, check against the page list $exists = in_array($page, $list); } else { // no, assume it exists $exists = true; } } $anchor = $this->urlEncode(substr($anchor, 1)); if (strlen($anchor)) { $anchor = '#' . $anchor; } // Does the page exist? if ($exists) { $href = sprintf(preg_replace('/%(?!s)/', '%%', $this->getConf('view_url')), $GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? htmlspecialchars($page) : $this->urlEncode($page)) . $anchor; // get the CSS class and generate output $css = ' class="'.$this->textEncode($this->getConf('css')).'"'; $start = ''; $end = ''; } else { $new_url = $this->getConf('new_url'); if (!$new_url) { return $this->textEncode($text); } $href = sprintf(preg_replace('/%(?!s)/', '%%', $new_url), $GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? htmlspecialchars($page) : $this->urlEncode($page)); // get the appropriate CSS class and new-link text $css = ' class="'.$this->textEncode($this->getConf('css_new')).'"'; $new = $this->getConf('new_text'); // what kind of linking are we doing? $pos = $this->getConf('new_text_pos'); if (! $pos || ! $new) { // no position (or no new_text), use css only on the page name $start = ''; $end = ''; } elseif ($pos == 'before') { // use the new_text BEFORE the page name $start = ''.$this->textEncode($new).''; $end = ''; } else { // default, use the new_text link AFTER the page name $start = ''; $end = ''.$this->textEncode($new).''; } } if (!strlen($text)) { $start .= $this->textEncode($page); } if (isset($type)) { switch ($type) { case 'start': $output = $start; break; case 'end': $output = $end; break; } } else { $output = $start.$this->textEncode($text).$end; } return $output; } } wicked-2.0.8/lib/Text_Wiki/Text/Wiki/Render/Cowiki.php 0000664 0001750 0001750 00000000262 13160726740 020562 0 ustar jan jan