From 9b6195715431d0a26946f05fae96637bd2485551 Mon Sep 17 00:00:00 2001 From: jepso Date: Fri, 20 Jul 2007 08:03:04 +0000 Subject: [PATCH] - New feature in documentation: you can now link to other documentation sections with the following syntax: - [doc getting-started:installation], or - [doc getting-started:installation Custom link text] - Updated Text_Wiki to 1.2.0 - Documentation should now pass XHTML validator - Formatted DSN section so that it's easier on eyes - The single quotes in won't work anymore due to the Text_Wiki update. Use double quotes instead: . The single quotes have been converted to double quotes in documentation files. - Modified the links in h1-h6 headings to use the same style as the headings. - Some refactoring --- manual/new/DocTool.php | 251 ------------- manual/new/docs/en/caching.txt | 20 +- .../dsn-the-data-source-name.txt | 95 ++--- manual/new/docs/en/database-abstraction.txt | 28 +- .../order-by-clause.txt | 4 +- manual/new/docs/en/event-listeners.txt | 40 +- .../new/docs/en/exceptions-and-warnings.txt | 4 +- manual/new/docs/en/getting-started.txt | 14 +- .../docs/en/getting-started/installation.txt | 4 +- .../getting-started/starting-new-project.txt | 2 +- .../working-with-existing-databases.txt | 4 +- manual/new/docs/en/mapping-relations.txt | 12 +- manual/new/docs/en/native-sql.txt | 10 +- .../columns/data-types.txt | 2 +- .../constraints-and-validators.txt | 8 +- .../introduction.txt | 2 +- manual/new/docs/en/plugins.txt | 16 +- .../user-management-system.txt | 2 +- manual/new/docs/en/searching.txt | 4 +- manual/new/docs/en/working-with-objects.txt | 4 +- .../component-overview/record.txt | 2 +- manual/new/images/quotation-mark.png | Bin 502 -> 0 bytes manual/new/index.php | 9 +- manual/new/lang/en.php | 6 - manual/new/lang/fi.php | 9 - manual/new/{ => lib}/Cache.php | 2 +- manual/new/lib/DocTool.php | 231 ++++++++++++ manual/new/lib/Text/Wiki/Doc.php | 67 ++++ manual/new/lib/Text/Wiki/Parse/Doc/Code.php | 97 +++++ .../new/lib/Text/Wiki/Parse/Doc/Doclink.php | 37 ++ .../lib/Text/Wiki/Render/Xhtml/Blockquote.php | 82 +++++ .../new/lib/Text/Wiki/Render/Xhtml/Code.php | 110 ++++++ .../lib/Text/Wiki/Render/Xhtml/Doclink.php | 29 ++ manual/new/{ => lib}/highlight.php | 0 manual/new/styles/basic.css | 12 +- vendor/Text/Wiki.php | 147 +++++++- vendor/Text/Wiki/Mediawiki.php | 93 ----- vendor/Text/Wiki/Parse.php | 9 +- vendor/Text/Wiki/Parse/Default/Blockquote.php | 55 +-- vendor/Text/Wiki/Parse/Default/Code.php | 9 +- vendor/Text/Wiki/Parse/Default/Freelink.php | 17 +- vendor/Text/Wiki/Parse/Default/Prefilter.php | 8 +- vendor/Text/Wiki/Parse/Default/Wikilink.php | 25 +- vendor/Text/Wiki/Parse/Mediawiki/Deflist.php | 278 -------------- vendor/Text/Wiki/Parse/Mediawiki/Emphasis.php | 86 ----- vendor/Text/Wiki/Parse/Mediawiki/Heading.php | 109 ------ vendor/Text/Wiki/Parse/Mediawiki/List.php | 250 ------------- vendor/Text/Wiki/Parse/Mediawiki/Raw.php | 73 ---- vendor/Text/Wiki/Parse/Mediawiki/Table.php | 286 -------------- vendor/Text/Wiki/Parse/Mediawiki/Url.php | 348 ------------------ vendor/Text/Wiki/Parse/Mediawiki/Wikilink.php | 302 --------------- vendor/Text/Wiki/Render/Latex/Url.php | 26 +- vendor/Text/Wiki/Render/Plain/Url.php | 22 +- vendor/Text/Wiki/Render/Xhtml/Address.php | 54 +++ vendor/Text/Wiki/Render/Xhtml/Blockquote.php | 5 +- vendor/Text/Wiki/Render/Xhtml/Bold.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Box.php | 13 +- vendor/Text/Wiki/Render/Xhtml/Center.php | 14 +- vendor/Text/Wiki/Render/Xhtml/Code.php | 48 +-- vendor/Text/Wiki/Render/Xhtml/Image.php | 28 +- vendor/Text/Wiki/Render/Xhtml/Interwiki.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Italic.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Phplookup.php | 4 +- .../Text/Wiki/Render/Xhtml/Preformatted.php | 5 +- vendor/Text/Wiki/Render/Xhtml/Underline.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Url.php | 40 +- vendor/Text/Wiki/Render/Xhtml/Wikilink.php | 6 +- 67 files changed, 1190 insertions(+), 2405 deletions(-) delete mode 100644 manual/new/DocTool.php delete mode 100644 manual/new/images/quotation-mark.png delete mode 100644 manual/new/lang/en.php delete mode 100644 manual/new/lang/fi.php rename manual/new/{ => lib}/Cache.php (97%) create mode 100644 manual/new/lib/DocTool.php create mode 100644 manual/new/lib/Text/Wiki/Doc.php create mode 100644 manual/new/lib/Text/Wiki/Parse/Doc/Code.php create mode 100644 manual/new/lib/Text/Wiki/Parse/Doc/Doclink.php create mode 100644 manual/new/lib/Text/Wiki/Render/Xhtml/Blockquote.php create mode 100644 manual/new/lib/Text/Wiki/Render/Xhtml/Code.php create mode 100644 manual/new/lib/Text/Wiki/Render/Xhtml/Doclink.php rename manual/new/{ => lib}/highlight.php (100%) delete mode 100644 vendor/Text/Wiki/Mediawiki.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Deflist.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Emphasis.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Heading.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/List.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Raw.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Table.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Url.php delete mode 100644 vendor/Text/Wiki/Parse/Mediawiki/Wikilink.php create mode 100644 vendor/Text/Wiki/Render/Xhtml/Address.php diff --git a/manual/new/DocTool.php b/manual/new/DocTool.php deleted file mode 100644 index 4e996c5b6..000000000 --- a/manual/new/DocTool.php +++ /dev/null @@ -1,251 +0,0 @@ - 1, - 'lang' => 'en', - 'default-lang' => 'en', - 'one-page' => false, - 'section' => null, - 'clean-url' => false, - 'base-url' => ''); - private $_lang = array(); - - public function __construct($filename) - { - $this->_wiki = new Text_Wiki(); - $this->_wiki->disableRule('Wikilink'); - $this->_toc = new Sensei_Doc_Toc($filename); - } - - public function getOption($option) - { - return $this->_options[$option]; - } - - public function setOption($option, $value) - { - switch ($option) { - case 'max-level': - if (!is_int($value)) { - throw new Exception('Value must be an integer.'); - } - break; - - case 'one-page': - case 'clean-url': - if (!is_bool($value)) { - throw new Exception('Value must be a boolean.'); - } - break; - - case 'locale': - case 'base-url': - if (!is_string($value)) { - throw new Exception('Value must be a string.'); - } - break; - - case 'section': - if (! $value instanceof Sensei_Doc_Section) { - throw new Exception('Value must be an instance of Sensei_Doc_Section.'); - } - break; - - default: - throw new Exception('Unknown option.'); - } - - $this->_options[$option] = $value; - } - - public function addLanguage(array $translations, $lang) - { - $this->_lang[$lang] = $translations; - } - - public function translate($string) - { - $language = $this->getOption('lang'); - - if (array_key_exists($language, $this->_lang) - && array_key_exists($string, $this->_lang[language])) { - return $this->_lang[$language][$string]; - } else { - return $string; - } - } - - public function renderToc($toc = null) - { - if (!$toc) { - $toc = $this->_toc; - } - - $classes = array(); - - if ($toc instanceof Sensei_Doc_Toc) { - - $class = ''; - if ($this->getOption('one-page')) { - $class = ' class="one-page"'; - } - - $classes[] = 'tree'; - - } else { - - $isParent = false; - $section = $this->getOption('section'); - - if ($section !== null) { - $current = $section; - do { - if ($current === $toc) { - $isParent = true; - break; - } - } while (($current = $current->getParent()) !== null); - } - - if (! $isParent) { - $classes[] = 'closed'; - } - } - - $classes = implode(' ', $classes); - - if ($classes === '') { - echo "
    \n"; - } else { - echo "
      \n"; - } - - for ($i = 0; $i < $toc->count(); $i++) { - $child = $toc->getChild($i); - - if ($child === $this->getOption('section')) { - echo '
    • '; - } else { - echo '
    • '; - } - - echo ''; - echo $child->getIndex() . ' ' . $child->getName() . ''; - - if ($child->count() > 0) { - echo "\n"; - $this->renderToc($child); - } - - echo '
    • ' . "\n"; - } - - echo '
    ' . "\n"; - - } - - public function makeUrl($path) - { - $prefix = $this->getOption('base-url'); - - if (!$this->getOption('one-page')) { - if ($this->getOption('clean-url')) { - $prefix .= 'chapter/'; - } else { - $prefix .= '?chapter='; - } - } - - $parts = explode(':', $path); - $firstPath = array_slice($parts, 0, $this->getOption('max-level')); - - $href = $prefix . implode(':', $firstPath); - - $anchorName = $this->makeAnchor($path); - if (!empty($anchorName)) { - $href .= '#' . $anchorName; - } - - return $href; - } - - public function makeAnchor($path) - { - $pathParts = explode(':', $path); - $anchorParts = array_slice($pathParts, $this->getOption('max-level')); - $anchorName = implode(':', $anchorParts); - return $anchorName; - } - - public function render() - { - if ($this->getOption('one-page')) { - - for ($i = 0; $i < count($this->_toc); $i++) { - $this->renderSection($this->_toc->getChild($i)); - } - - } else { - $section = $this->getOption('section'); - - if (!$section) { - throw new Exception('Section has not been set.'); - } else { - $this->renderSection($section); - } - } - } - - protected function renderSection($section) - { - $level = $section->getLevel(); - $name = $section->getName(); - $index = $section->getIndex(); - - if ($section->getLevel() == 1) { - echo '
    ' . "\n"; - echo "Chapter $index "; - } else { - echo '
    ' . "\n"; - echo "$index "; - } - - if ($section->getLevel() > $this->getOption('max-level')) { - echo ''; - echo $name; - echo ''; - } else { - echo $name; - } - - echo "\n"; - - if ($level === 1 && !$this->getOption('one-page')) { - //$this->renderToc($this->_toc); - } - - echo $this->_wiki->transform($section->getText()); - - for ($i = 0; $i < count($section); $i++) { - $this->renderSection($section->getChild($i)); - } - - echo '
    ' . "\n"; - } - - public function findByPath($path) - { - return $this->_toc->findByPath($path); - } - - public function findByIndex($index) - { - return $this->_toc->findByIndex($index); - } -} \ No newline at end of file diff --git a/manual/new/docs/en/caching.txt b/manual/new/docs/en/caching.txt index 5c243430e..943d0c3ca 100644 --- a/manual/new/docs/en/caching.txt +++ b/manual/new/docs/en/caching.txt @@ -6,7 +6,7 @@ Initializing a new cache driver instance: - + $cache = new Doctrine_Cache_Memcache($options); @@ -14,7 +14,7 @@ $cache = new Doctrine_Cache_Memcache($options); +++ Memcache Memcache driver stores cache records into a memcached server. Memcached is a high-performance, distributed memory object caching system. In order to use this backend, you need a memcached daemon and the memcache PECL extension. - + // memcache allows multiple servers $servers = array('host' => 'localhost', 'port' => 11211, @@ -35,7 +35,7 @@ The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It was The APC cache driver of Doctrine stores cache records in shared memory. - + $cache = new Doctrine_Cache_Apc(); @@ -46,7 +46,7 @@ Db caching backend stores cache records into given database. Usually some fast f Initializing sqlite cache driver can be done as above: - + $conn = Doctrine_Manager::connection(new PDO('sqlite::memory:')); $cache = new Doctrine_Cache_Sqlite(array('connection' => $conn)); @@ -75,14 +75,14 @@ So not only does the DQL query cache skip the standard database query execution You can set a connection or manager level cache driver by using Doctrine::ATTR_CACHE. Setting a connection level cache driver means that all queries executed with this connection use the specified cache driver whereas setting a manager level cache driver means that all connections (unless overridden at connection level) will use the given cache driver. Setting a manager level cache driver: - + $manager = Doctrine_Manager::getInstance(); $manager->setAttribute(Doctrine::ATTR_CACHE, $cacheDriver); Setting a connection level cache driver: - + $manager = Doctrine_Manager::getInstance(); $conn = $manager->openConnection('pgsql://user:pass@localhost/test'); @@ -90,14 +90,14 @@ $conn->setAttribute(Doctrine::ATTR_CACHE, $cacheDriver); Usually the cache entries are valid for only some time. You can set global value for how long the cache entries should be considered valid by using Doctrine::ATTR_CACHE_LIFESPAN. - + $manager = Doctrine_Manager::getInstance(); // set the lifespan as one hour (60 seconds * 60 minutes = 1 hour = 3600 secs) $manager->setAttribute(Doctrine::ATTR_CACHE_LIFESPAN, 3600); Now as we have set a cache driver for use we can make a DQL query to use it: - + $query = new Doctrine_Query(); // fetch blog titles and the number of comments @@ -114,7 +114,7 @@ $entries = $query->execute(); In the previous chapter we used global caching attributes. These attributes can be overriden at the query level. You can override the cache driver by calling useCache with a valid cacheDriver: - + $query = new Doctrine_Query(); $query->useCache(new Doctrine_Cache_Apc()); @@ -122,7 +122,7 @@ $query->useCache(new Doctrine_Cache_Apc()); Also you can override the lifespan attribute by calling setCacheLifeSpan(): - + $query = new Doctrine_Query(); // set the lifespan as half an hour diff --git a/manual/new/docs/en/connection-management/dsn-the-data-source-name.txt b/manual/new/docs/en/connection-management/dsn-the-data-source-name.txt index 1b8d79ea7..61c624c65 100644 --- a/manual/new/docs/en/connection-management/dsn-the-data-source-name.txt +++ b/manual/new/docs/en/connection-management/dsn-the-data-source-name.txt @@ -1,18 +1,19 @@ In order to connect to a database through Doctrine, you have to create a valid DSN - data source name. -Doctrine supports both PEAR DB/MDB2 like data source names as well as PDO style data source names. The following section deals with PEAR like data source names. If you need more info about the PDO-style data source names see http://www.php.net/manual/en/function.PDO-construct.php. +Doctrine supports both PEAR DB/MDB2 like data source names as well as PDO style data source names. The following section deals with PEAR like data source names. If you need more info about the PDO-style data source names see [[php PDO->__construct()]]. The DSN consists in the following parts: -**phptype**: Database backend used in PHP (i.e. mysql , pgsql etc.) -**dbsyntax**: Database used with regards to SQL syntax etc. -**protocol**: Communication protocol to use ( i.e. tcp, unix etc.) -**hostspec**: Host specification (hostname[:port]) -**database**: Database to use on the DBMS server -**username**: User name for login -**password**: Password for login -**proto_opts**: Maybe used with protocol -**option**: Additional connection options in URI query string format. options get separated by &. The Following table shows a non complete list of options: +||~ DSN part ||~ Description || +|| phptype || Database backend used in PHP (i.e. mysql , pgsql etc.) || +|| dbsyntax || Database used with regards to SQL syntax etc. || +|| protocol || Communication protocol to use ( i.e. tcp, unix etc.) || +|| hostspec || Host specification (hostname[:port]) || +|| database || Database to use on the DBMS server || +|| username || User name for login || +|| password || Password for login || +|| proto_opts || Maybe used with protocol || +|| option || Additional connection options in URI query string format. Options are separated by ampersand (&). The Following table shows a non complete list of options: || **List of options** @@ -22,10 +23,12 @@ The DSN consists in the following parts: || new_link || Some RDBMS do not create new connections when connecting to the same host multiple times. This option will attempt to force a new connection. || The DSN can either be provided as an associative array or as a string. The string format of the supplied DSN is in its fullest form: -`` phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value `` + +phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value Most variations are allowed: + phptype://username:password@protocol+hostspec:110//usr/db_file.db phptype://username:password@hostspec/database phptype://username:password@hostspec @@ -36,63 +39,73 @@ phptype:///database phptype:///database?option=value&anotheroption=anothervalue phptype(dbsyntax) phptype - - + The currently supported database backends are: -||//fbsql//|| -> FrontBase || -||//ibase//|| -> InterBase / Firebird (requires PHP 5) || -||//mssql//|| -> Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql) || -||//mysql//|| -> MySQL || -||//mysqli//|| -> MySQL (supports new authentication protocol) (requires PHP 5) || -||//oci8 //|| -> Oracle 7/8/9/10 || -||//pgsql//|| -> PostgreSQL || -||//querysim//|| -> QuerySim || -||//sqlite//|| -> SQLite 2 || - -A second DSN format is supported phptype(syntax)://user:pass@protocol(proto_opts)/database - +||~ Driver name ||~ Supported databases || +|| fbsql || FrontBase || +|| ibase || InterBase / Firebird (requires PHP 5) || +|| mssql || Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql) || +|| mysql || MySQL || +|| mysqli || MySQL (supports new authentication protocol) (requires PHP 5) || +|| oci8 || Oracle 7/8/9/10 || +|| pgsql || PostgreSQL || +|| querysim || QuerySim || +|| sqlite || SQLite 2 || + +A second DSN format supported is + + +phptype(syntax)://user:pass@protocol(proto_opts)/database + + If your database, option values, username or password contain characters used to delineate DSN parts, you can escape them via URI hex encodings: -``: = %3a`` -``/ = %2f`` -``@ = %40`` -``+ = %2b`` -``( = %28`` -``) = %29`` -``? = %3f`` -``= = %3d`` -``& = %26`` +||~ Character ||~ Hex Code || +|| : || %3a || +|| / || %2f || +|| @ || %40 || +|| + || %2b || +|| ( || %28 || +|| ) || %29 || +|| ? || %3f || +|| = || %3d || +|| & || %26 || Warning Please note, that some features may be not supported by all database backends. -Example ++++ Examples + **Example 1.** Connect to database through a socket + mysql://user@unix(/path/to/socket)/pear - + **Example 2.** Connect to database on a non standard port + pgsql://user:pass@tcp(localhost:5555)/pear - + **Example 3.** Connect to SQLite on a Unix machine using options + sqlite:////full/unix/path/to/file.db?mode=0666 - + **Example 4.** Connect to SQLite on a Windows machine using options + sqlite:///c:/full/windows/path/to/file.db?mode=0666 - + **Example 5.** Connect to MySQLi using SSL + mysqli://user:pass@localhost/pear?key=client-key.pem&cert=client-cert.pem - - + diff --git a/manual/new/docs/en/database-abstraction.txt b/manual/new/docs/en/database-abstraction.txt index 76e738e62..f75c7c70d 100644 --- a/manual/new/docs/en/database-abstraction.txt +++ b/manual/new/docs/en/database-abstraction.txt @@ -11,14 +11,14 @@ people(id, name); event_participants(event_id, person_id); +++ Creating a database - + $conn->export->createDatabase('events_db'); +++ Creating tables Now that the database is created, we can proceed with adding some tables. The method createTable() takes three parameters: the table name, an array of field definition and some extra options (optional and RDBMS-specific). Now lets create the events table: - + $definition = array ( 'id' => array ( 'type' => 'integer', @@ -54,7 +54,7 @@ The keys of the definition array are the names of the fields in the table. The v Creating the people table: - + $options = array( 'comment' => 'Repository of people', 'character_set' => 'utf8', @@ -82,7 +82,7 @@ $conn->export->createTable('people', $definition, $options); Creating the event_participants table with a foreign key: - + $options = array( 'foreignKeys' => array('local' => 'event_id', 'foreign' => 'id' @@ -110,7 +110,7 @@ $conn->export->createTable('event_participants', $definition, $options); Now lets say we want to add foreign key on person_id too. This can be achieved as follows: - + $definition = array('local' => 'person_id', 'foreign' => 'id' 'foreignTable' => 'people' @@ -217,7 +217,7 @@ length, integer value Not all RDBMS will support index sorting or length, in these cases the drivers will ignore them. In the test events database, we can assume that our application will show events occuring in a specific timeframe, so the selects will use the datetime field in WHERE conditions. It will help if there is an index on this field. - + $definition = array( 'fields' => array( 'datetime' => array() @@ -228,7 +228,7 @@ $conn->export->createIndex('events', 'event_timestamp', $definition); +++ Deleting database elements For every create*() method as shown above, there is a corresponding drop*() method to delete a database, a table, field, index or constraint. The drop*() methods do not check if the item to be deleted exists, so it's developer's responsibility to check for exceptions. - + // drop a sequence try { $conn->export->dropSequence('nonexisting'); @@ -290,26 +290,26 @@ To see what's in the database, you can use the list*() family of functions in th +++ Listing databases - + $dbs = $conn->import->listDatabases(); print_r($dbs); +++ Listing sequences - + $seqs = $conn->export->listSequences('events_db'); print_r($seqs); +++ Listing constraints - + $cons = $conn->export->listTableConstraints('event_participants'); +++ Listing table fields - + $fields = $conn->export->listTableFields('events'); print_r($fields); /* @@ -324,7 +324,7 @@ Array +++ Listing table indices - + $idx = $conn->export->listTableIndexes('events'); print_r($idx); /* @@ -338,7 +338,7 @@ Array +++ Listing tables - + $tables = $conn->export->listTables(); print_r($tables); /* @@ -354,7 +354,7 @@ Array +++ Listing views - + // currently there is no method to create a view, // so let's do it "manually" $sql = "CREATE VIEW names_only AS SELECT name FROM people"; diff --git a/manual/new/docs/en/dql-doctrine-query-language/order-by-clause.txt b/manual/new/docs/en/dql-doctrine-query-language/order-by-clause.txt index 063494640..7425f717a 100644 --- a/manual/new/docs/en/dql-doctrine-query-language/order-by-clause.txt +++ b/manual/new/docs/en/dql-doctrine-query-language/order-by-clause.txt @@ -31,7 +31,7 @@ FROM User u LEFT JOIN u.Email e In the following example we fetch all users and sort those users by the number of phonenumbers they have. - + $q = new Doctrine_Query(); $users = $q->select('u.*, COUNT(p.id) count') @@ -44,7 +44,7 @@ $users = $q->select('u.*, COUNT(p.id) count') In the following example we use random in the ORDER BY clause in order to fetch random post. - + $q = new Doctrine_Query(); $posts = $q->select('p.*, RANDOM() rand') diff --git a/manual/new/docs/en/event-listeners.txt b/manual/new/docs/en/event-listeners.txt index 450e44bfa..ea85f6cd3 100644 --- a/manual/new/docs/en/event-listeners.txt +++ b/manual/new/docs/en/event-listeners.txt @@ -8,7 +8,7 @@ Doctrine provides flexible event listener architecture that not only allows list There are several different listeners and hooks for various Doctrine components. Listeners are separate classes where as hooks are empty template methods which are defined in the base class. An example of using Doctrine_Record hooks: - + class Blog extends Doctrine_Record { public function setTableDefinition() @@ -39,7 +39,7 @@ Connection listeners are used for listening the methods of Doctrine_Connection a +++ Creating a new listener There are three different ways of defining a listener. First you can create a listener by making a class that inherits Doctrine_EventListener: - + class MyListener extends Doctrine_EventListener { public function preExec(Doctrine_Event $event) @@ -53,7 +53,7 @@ Note that by declaring a class that extends Doctrine_EventListener you don't hav Sometimes it may not be possible to define a listener that extends Doctrine_EventListener (you might have a listener that inherits some other base class). In this case you can make it implement Doctrine_EventListener_Interface. - + class MyListener implements Doctrine_EventListener_Interface { // notice: all listener methods must be defined here @@ -70,7 +70,7 @@ class MyListener implements Doctrine_EventListener_Interface The third way of creating a listener is a very elegant one. You can make a class that implements Doctrine_Overloadable. This interface has only one method: __call(), which can be used for catching *all* the events. - + class MyDebugger implements Doctrine_Overloadable { public function __call($methodName, $args) @@ -84,13 +84,13 @@ class MyDebugger implements Doctrine_Overloadable You can attach the listeners to a connection with setListener(). - + $conn->setListener(new MyDebugger()); If you need to use multiple listeners you can use addListener(). - + $conn->addListener(new MyDebugger()); $conn->addListener(new MyLogger()); @@ -153,7 +153,7 @@ Here is a list of all availible listener methods: || postValidate() || Doctrine_Validator::validate() || Just like with connection listeners there are three ways of defining a record listener: by extending Doctrine_Record_Listener, by implement Doctrine_Record_Listener_Interface or by implementing Doctrine_Overloadable. In the following we'll create a global level listener by implementing Doctrine_Overloadable: - + class Logger extends Doctrine_Overloadable { public function __call($m, $a) @@ -167,13 +167,13 @@ class Logger extends Doctrine_Overloadable Attaching the listener to manager is easy: - + $manager->addRecordListener(new Logger()); Note that by adding a manager level listener it affects on all connections and all tables / records within these connections. In the following we create a connection level listener: - + class Debugger extends Doctrine_Record_Listener { public function preInsert(Doctrine_Event $event) @@ -189,13 +189,13 @@ class Debugger extends Doctrine_Record_Listener Attaching the listener to a connection is as easy as: - + $conn->addRecordListener(new Debugger()); Many times you want the listeners to be table specific so that they only apply on the actions on that given table. Here is an example: - + class Debugger extends Doctrine_Record_Listener { public function postDelete(Doctrine_Event $event) @@ -207,7 +207,7 @@ class Debugger extends Doctrine_Record_Listener Attaching this listener to given table can be done as follows: - + class MyRecord extends Doctrine_Record { public function setTableDefinition() @@ -238,7 +238,7 @@ class MyRecord extends Doctrine_Record || postValidate() || Doctrine_Validator::validate() || Example 1. Using insert and update hooks - + class Blog extends Doctrine_Record { public function setTableDefinition() @@ -264,7 +264,7 @@ class Blog extends Doctrine_Record All different event listeners in Doctrine allow chaining. This means that more than one listener can be attached for listening the same methods. The following example attaches two listeners for given connection: - + // here Debugger and Logger both inherit Doctrine_EventListener $conn->addListener(new Debugger()); @@ -274,7 +274,7 @@ $conn->addListener(new Logger()); ++ The Event object +++ Getting the invoker You can get the object that invoked the event by calling getInvoker(): - + class MyListener extends Doctrine_EventListener { public function preExec(Doctrine_Event $event) @@ -295,7 +295,7 @@ Doctrine_Event uses constants as event codes. Above is the list of all availible * Doctrine_Event::STMT_FETCH * Doctrine_Event::STMT_FETCHALL - + class MyListener extends Doctrine_EventListener { public function preExec(Doctrine_Event $event) @@ -318,7 +318,7 @@ class MyListener extends Doctrine_EventListener * Doctrine_Event::RECORD_SERIALIZE * Doctrine_Event::RECORD_UNSERIALIZE - + class MyRecord extends Doctrine_Record { public function preUpdate(Doctrine_Event $event) @@ -331,7 +331,7 @@ class MyRecord extends Doctrine_Record The method getInvoker() returns the object that invoked the given event. For example for event Doctrine_Event::CONN_QUERY the invoker is a Doctrine_Connection object. Example: - + class MyRecord extends Doctrine_Record { public function preUpdate(Doctrine_Event $event) @@ -346,7 +346,7 @@ Doctrine_Event provides many methods for altering the execution of the listened For some reason you may want to skip the execution of the listened method. It can be done as follows (note that preExec could be any listener method): - + class MyListener extends Doctrine_EventListener { public function preExec(Doctrine_Event $event) @@ -363,7 +363,7 @@ class MyListener extends Doctrine_EventListener When using a chain of listeners you might want to skip the execution of the next listener. It can be achieved as follows: - + class MyListener extends Doctrine_EventListener { public function preExec(Doctrine_Event $event) diff --git a/manual/new/docs/en/exceptions-and-warnings.txt b/manual/new/docs/en/exceptions-and-warnings.txt index 0872ac4f8..3aca6c358 100644 --- a/manual/new/docs/en/exceptions-and-warnings.txt +++ b/manual/new/docs/en/exceptions-and-warnings.txt @@ -2,7 +2,7 @@ Doctrine_Manager_Exception is thrown if something failed at the connection management - + try { $manager->getConnection('unknown'); } catch (Doctrine_Manager_Exception) { @@ -18,7 +18,7 @@ thrown if something failed during the relation parsing thrown if something failed at the database level - + try { $conn->execute('SELECT * FROM unknowntable'); } catch (Doctrine_Connection_Exception) { diff --git a/manual/new/docs/en/getting-started.txt b/manual/new/docs/en/getting-started.txt index 0f91c0bfb..63c0c9047 100644 --- a/manual/new/docs/en/getting-started.txt +++ b/manual/new/docs/en/getting-started.txt @@ -9,7 +9,7 @@ Doctrine offers method called {{compile()}} to solve this issue. The compile met Compiling is a method for making a single file of most used doctrine runtime components including the compiled file instead of multiple files (in worst cases dozens of files) can improve performance by an order of magnitude. In cases where this might fail, a {{Doctrine_Exception}} is throw detailing the error. - + Doctrine::compile(); // on some other script: require_once('path_to_doctrine/Doctrine.compiled.php'); @@ -23,7 +23,7 @@ Doctrine supports exporting record classes into database. This means that based Lets say we have a classes called User and Phonenumber with the following definitions: - + // file User.php class User extends Doctrine_Record { @@ -56,7 +56,7 @@ class Phonenumber extends Doctrine_Record Now lets say these classes are in directory 'models/'. We can make Doctrine to iterate through this directory and attach these classes into your database structure with the following script: - + require_once('path-to-doctrine/lib/Doctrine.php'); @@ -86,7 +86,7 @@ Pay attention to the following things: There might be situations where you don't want to execute the export queries immediately rather you want to get the query strings and maybe attach them to a build.sql file. This can be easily achieved as follows: - + require_once('path-to-doctrine/lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); @@ -100,7 +100,7 @@ print_r($queries); Notice that the methods Doctrine::export() and Doctrine::exportSql() are just short cuts for Doctrine_Export::export() and Doctrine_Export::exportSql(). So the following code is equivalent with the previous example: - + require_once('path-to-doctrine/lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); @@ -118,7 +118,7 @@ print_r($queries); +++ Convenience methods In the previous example we exported all record classes within a directory. Sometimes you may want to export specific classes. It can be achieved by giving exportClasses() an array of class names: - + require_once('path-to-doctrine/lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); @@ -135,7 +135,7 @@ Consider the same situation and you want to get the array of sql queries needed +++ Export options - + // export everything, table definitions and constraints $manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); diff --git a/manual/new/docs/en/getting-started/installation.txt b/manual/new/docs/en/getting-started/installation.txt index 0e3ca279f..32e56f47f 100644 --- a/manual/new/docs/en/getting-started/installation.txt +++ b/manual/new/docs/en/getting-started/installation.txt @@ -18,7 +18,7 @@ If you do not have a SVN client, chose one from the list below. Find the **Check In order to use Doctrine in your project it must first be included. - + require_once('path-to-doctrine/lib/Doctrine.php'); @@ -26,7 +26,7 @@ Doctrine support [http://www.php.net/autoload Autoloading] for including files s If you do use the **__autoload** function for your own logic you can use it. - + function __autoload($class) { Doctrine::autoload($class); } diff --git a/manual/new/docs/en/getting-started/starting-new-project.txt b/manual/new/docs/en/getting-started/starting-new-project.txt index 3360d6328..9922e9135 100644 --- a/manual/new/docs/en/getting-started/starting-new-project.txt +++ b/manual/new/docs/en/getting-started/starting-new-project.txt @@ -6,7 +6,7 @@ An short example: We want to create a database table called 'user' with columns id(primary key), name, username, password and created. Provided that you have already installed Doctrine these few lines of code are all you need: - + require_once('lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); diff --git a/manual/new/docs/en/getting-started/working-with-existing-databases.txt b/manual/new/docs/en/getting-started/working-with-existing-databases.txt index f4da21ada..01efdc740 100644 --- a/manual/new/docs/en/getting-started/working-with-existing-databases.txt +++ b/manual/new/docs/en/getting-started/working-with-existing-databases.txt @@ -24,7 +24,7 @@ CREATE TABLE file ( Now we would like to convert it into Doctrine record class. It can be achieved easily with the following code snippet: - + require_once('lib/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); @@ -38,7 +38,7 @@ $conn->import->import('myrecords'); That's it! Now there should be a file called File.php in your myrecords directory. The file should look like: - + /** * This class has been auto-generated by the Doctrine ORM Framework * Created: Saturday 10th of February 2007 01:03:15 PM diff --git a/manual/new/docs/en/mapping-relations.txt b/manual/new/docs/en/mapping-relations.txt index 98e83ad2e..d68626fcb 100644 --- a/manual/new/docs/en/mapping-relations.txt +++ b/manual/new/docs/en/mapping-relations.txt @@ -344,7 +344,7 @@ The entity table has a column called {{type}} which tells whether an entity is a The only thing we have to do is to create 3 records (the same as before) and add call the {{Doctrine_Table::setInheritanceMap()}} method inside the {{setUp()}} method. - + class Entity extends Doctrine_Record { public function setTableDefinition() @@ -379,7 +379,7 @@ class Group extends Entity If we want to be able to fetch a record from the {{Entity}} table and automatically get a {{User}} record if the {{Entity}} we fetched is a user we have to do set the subclasses option in the parent class. The adjusted example: - + class Entity extends Doctrine_Record { public function setTableDefinition() @@ -415,7 +415,7 @@ class Group extends Entity We can then do the following given the previous table mapping. - + $user = new User(); $user->name = 'Bjarte S. Karlsen'; $user->username = 'meus'; @@ -444,7 +444,7 @@ A foreign key constraint specifies that the values in a column (or a group of co Say you have the product table with the following definition: - + class Product extends Doctrine_Record { public function setTableDefinition() @@ -458,7 +458,7 @@ class Product extends Doctrine_Record Let's also assume you have a table storing orders of those products. We want to ensure that the order table only contains orders of products that actually exist. So we define a foreign key constraint in the orders table that references the products table: - + class Order extends Doctrine_Record { public function setTableDefinition() @@ -512,7 +512,7 @@ Rejects the delete or update operation for the parent table. NO ACTION and RESTR In the following example we define two classes, User and Phonenumber with their relation being one-to-many. We also add a foreign key constraint with onDelete cascade action. This means that everytime a users is being deleted its associated phonenumbers will also be deleted. - + class User extends Doctrine_Record { public function setTableDefinition() diff --git a/manual/new/docs/en/native-sql.txt b/manual/new/docs/en/native-sql.txt index 75b05cad7..13f2fdd70 100644 --- a/manual/new/docs/en/native-sql.txt +++ b/manual/new/docs/en/native-sql.txt @@ -6,13 +6,13 @@ Using raw sql for fetching might be useful when you want to utilize database spe Creating Doctrine_RawSql object is easy: - + $q = new Doctrine_RawSql(); Optionally a connection parameter can be given: - + $q = new Doctrine_RawSql($conn); // here $conn is an instance of Doctrine_Connection @@ -22,7 +22,7 @@ The first thing to notice when using Doctrine_RawSql is that you always have to The following example should clarify the usage of these: - + $q = new Doctrine_RawSql(); $q->select('{u.*}') @@ -45,7 +45,7 @@ When fetching from multiple components the addComponent calls become a bit more Consider the following model: - + // file User.php class User extends Doctrine_Record { @@ -78,7 +78,7 @@ class Phonenumber extends Doctrine_Record In the following example we fetch all users and their phonenumbers: - + $q = new Doctrine_RawSql(); $q->select('{u.*}, {p.*}') diff --git a/manual/new/docs/en/object-relational-mapping/columns/data-types.txt b/manual/new/docs/en/object-relational-mapping/columns/data-types.txt index c73edab2b..61ce57872 100644 --- a/manual/new/docs/en/object-relational-mapping/columns/data-types.txt +++ b/manual/new/docs/en/object-relational-mapping/columns/data-types.txt @@ -104,7 +104,7 @@ The fields of this type should be able to handle 8 bit characters. Drivers take By default Doctrine will use variable length character types. If fixed length types should be used can be controlled via the fixed modifier. - + class Test extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('stringtest', 'string', 200, array('fixed' => true)); diff --git a/manual/new/docs/en/object-relational-mapping/constraints-and-validators.txt b/manual/new/docs/en/object-relational-mapping/constraints-and-validators.txt index 9070cd1da..ceb190bc4 100644 --- a/manual/new/docs/en/object-relational-mapping/constraints-and-validators.txt +++ b/manual/new/docs/en/object-relational-mapping/constraints-and-validators.txt @@ -15,7 +15,7 @@ A not-null constraint simply specifies that a column must not assume the null va The following definition uses a notnull constraint for column {{name}}. This means that the specified column doesn't accept null values. - + class User extends Doctrine_Record { public function setTableDefinition() @@ -45,7 +45,7 @@ In general, a unique constraint is violated when there are two or more rows in t The following definition uses a unique constraint for column {{name}}. - + class User extends Doctrine_Record { public function setTableDefinition() @@ -59,7 +59,7 @@ class User extends Doctrine_Record The following definition adds a unique constraint for columns {{name}} and {{age}}. - + class User extends Doctrine_Record { public function setTableDefinition() @@ -87,7 +87,7 @@ Doctrine provides the following simple check operators: Consider the following example: - + class Product extends Doctrine_Record { public function setTableDefinition() diff --git a/manual/new/docs/en/object-relational-mapping/introduction.txt b/manual/new/docs/en/object-relational-mapping/introduction.txt index 863f719c1..b1989a2a6 100644 --- a/manual/new/docs/en/object-relational-mapping/introduction.txt +++ b/manual/new/docs/en/object-relational-mapping/introduction.txt @@ -5,7 +5,7 @@ Doctrine_Record::hasColumn() takes 4 arguments: # **column length** # **column constraints and validators** - + class Email extends Doctrine_Record { public function setTableDefinition() { // setting custom table name: diff --git a/manual/new/docs/en/plugins.txt b/manual/new/docs/en/plugins.txt index 1dc2b8982..9835bd595 100644 --- a/manual/new/docs/en/plugins.txt +++ b/manual/new/docs/en/plugins.txt @@ -7,7 +7,7 @@ {{Doctrine_Connection_Profiler}} can be enabled by adding it as an eventlistener for {{Doctrine_Connection}}. - + $conn = Doctrine_Manager::connection($dsn); $profiler = new Doctrine_Connection_Profiler(); @@ -18,7 +18,7 @@ $conn->setListener($profiler); Perhaps some of your pages is loading slowly. The following shows how to build a complete profiler report from the connection: - + $totalTime = $profiler->getTotalElapsedSecs(); $queryCount = $profiler->getTotalNumQueries(); $longestTime = 0; @@ -43,7 +43,7 @@ echo 'Longest query: ' . $longestQuery . "\n"; ++ AuditLog and versioning Doctrine_AuditLog provides a full versioning solution. Lets say we have a NewsItem class that we want to be versioned. This functionality can be applied by simply adding $this->actAs('Versionable') into your record setup. - + class NewsItem extends Doctrine_Record { public function setTableDefinition() @@ -70,7 +70,7 @@ Now when we have defined this record to be versionable, Doctrine does internally +++ Using versioning - + $newsItem = new NewsItem(); $newsItem->title = 'No news is good news'; $newsItem->content = 'All quiet on the western front'; @@ -87,7 +87,7 @@ $newsItem->version; // 2 Doctrine_Record provides a method called revert() which can be used for reverting to specified version. Internally Doctrine queries the version table and fetches the data for given version. If the given version is not found a Doctrine_Record_Exception is being thrown. - + $newsItem->revert(1); $newsItem->title; // No news is good news @@ -97,7 +97,7 @@ $newsItem->title; // No news is good news There are many options for the versioning plugin. Sometimes you may want to use other version column than 'version'. This can be achieved by giving the options parameter to actAs() method. - + class NewsItem extends Doctrine_Record { public function setTableDefinition() @@ -124,7 +124,7 @@ Soft-delete is a very simple plugin for achieving the following behaviour: when The following code snippet shows what you need in order to achieve this kind of behaviour. Notice how we define two event hooks: preDelete and postDelete. Also notice how the preDelete hook skips the actual delete-operation with skipOperation() call. For more info about the event hooks see the Event listener section. - + class SoftDeleteTest extends Doctrine_Record { public function setTableDefinition() @@ -146,7 +146,7 @@ class SoftDeleteTest extends Doctrine_Record Now lets put the plugin in action: - + // save a new record $record = new SoftDeleteTest(); diff --git a/manual/new/docs/en/real-world-examples/user-management-system.txt b/manual/new/docs/en/real-world-examples/user-management-system.txt index ccb7f59e7..eb039cd86 100644 --- a/manual/new/docs/en/real-world-examples/user-management-system.txt +++ b/manual/new/docs/en/real-world-examples/user-management-system.txt @@ -11,7 +11,7 @@ In the following example we make a user management system where # When an entity is updated a current timestamp will be assigned to 'updated' field # Entities will always be fetched in batches - + class Entity extends Doctrine_Record { public function setUp() diff --git a/manual/new/docs/en/searching.txt b/manual/new/docs/en/searching.txt index a75449b07..2211ea469 100644 --- a/manual/new/docs/en/searching.txt +++ b/manual/new/docs/en/searching.txt @@ -4,7 +4,7 @@ Searching is a huge topic, hence an entire chapter has been devoted to a plugin Consider we have a class called NewsItem with the following definition: - + class NewsItem extends Doctrine_Record { public function setTableDefinition() @@ -27,7 +27,7 @@ contains word 'framework') the database would have to traverse through each row Doctrine solves this with its search component and inverse indexes. First lets alter our definition a bit: - + class NewsItem extends Doctrine_Record { public function setTableDefinition() diff --git a/manual/new/docs/en/working-with-objects.txt b/manual/new/docs/en/working-with-objects.txt index 42a1f5203..5b2b88ec5 100644 --- a/manual/new/docs/en/working-with-objects.txt +++ b/manual/new/docs/en/working-with-objects.txt @@ -7,7 +7,7 @@ Whenever you fetch an object that has not all of its fields loaded from database Lets say we have a User class with the following definition: - + class User extends Doctrine_Record { public function setTableDefinition() @@ -21,7 +21,7 @@ class User extends Doctrine_Record In the following example we fetch all the Users with the fields name and password loaded directly. Then we lazy-load a huge field called description for one user. - + $users = Doctrine_Query::create()->select('u.name, u.password')->from('User u'); // the following lazy-loads the description fields and executes one additional database query diff --git a/manual/new/docs/en/working-with-objects/component-overview/record.txt b/manual/new/docs/en/working-with-objects/component-overview/record.txt index c975273d7..4f5bbc6fe 100644 --- a/manual/new/docs/en/working-with-objects/component-overview/record.txt +++ b/manual/new/docs/en/working-with-objects/component-overview/record.txt @@ -92,7 +92,7 @@ foreach($user as $key => $value) { Updating objects is very easy, you just call the {{Doctrine_Record::save()}} method. The other way (perhaps even easier) is to call {{Doctrine_Connection::flush()}} which saves all objects. It should be noted though that flushing is a much heavier operation than just calling save method. - + $table = $conn->getTable('User'); diff --git a/manual/new/images/quotation-mark.png b/manual/new/images/quotation-mark.png deleted file mode 100644 index 986d54ec0cb3ffa268d73b1c1aa8efcd08e5e27c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 502 zcmeAS@N?(olHy`uVBq!ia0vp^5Hl`|UG|bMv)+`VpxaNr8#^4Y69S=I$yTrOwR%9%c_|I}w zq^rw)@v%dPW;p4dY0OMosL{eQ=}d&i?7MG{G5aWmkLY`j}h zb$S2ifD>1=r_I`YQ)gRQQ$$oGD}%?RmUrv?E+6_?BiHVJe8%^m4jhdd94}tK)#Sgy z$F}i7yo=goMurF-u`_4SIZRS<{@8umyT{Mx(buoOy*W8466Ypals1IC^3=U|=}ybR zI{lR8m$&?W{#<ZnQ@W<45{1-J2P2_kL qqj%**QKbBFIT^MD1{Cz;iuJ;+ryk5=IeG&akqn-$elF{r5}E)pO5Di+ diff --git a/manual/new/index.php b/manual/new/index.php index 64e101877..6004dead0 100644 --- a/manual/new/index.php +++ b/manual/new/index.php @@ -1,7 +1,8 @@ begin()) { $tool = new DocTool('docs/en.txt'); // $tool->setOption('clean-url', true); - $supportedLangs = array('en', 'fi'); - foreach ($supportedLangs as $language) { - include "lang/$language.php"; - $tool->addLanguage($lang[$language], $language); - } - $baseUrl = ''; $title = 'Doctrine Manual'; $section = null; diff --git a/manual/new/lang/en.php b/manual/new/lang/en.php deleted file mode 100644 index b118bbbee..000000000 --- a/manual/new/lang/en.php +++ /dev/null @@ -1,6 +0,0 @@ - 'Chapter %s', - 'Contents' => 'Contents' -); diff --git a/manual/new/lang/fi.php b/manual/new/lang/fi.php deleted file mode 100644 index d27e164bf..000000000 --- a/manual/new/lang/fi.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Sisällysluettelo', - 'Contents' => 'Sisältö', - 'List of Chapters' => 'Luvut', - 'Previous' => 'Edellinen', - 'Next' => 'Seuraava' -); diff --git a/manual/new/Cache.php b/manual/new/lib/Cache.php similarity index 97% rename from manual/new/Cache.php rename to manual/new/lib/Cache.php index 86c3fe28a..8810fa714 100644 --- a/manual/new/Cache.php +++ b/manual/new/lib/Cache.php @@ -57,7 +57,7 @@ class Cache */ public function clear() { - if ($handle = opendir($this->_dir)) { + if ($handle = @opendir($this->_dir)) { while ($file = readdir($handle)) { if ($file !== '.' && $file !== '..') { @unlink($this->_dir . '/' . $file); diff --git a/manual/new/lib/DocTool.php b/manual/new/lib/DocTool.php new file mode 100644 index 000000000..6436782cc --- /dev/null +++ b/manual/new/lib/DocTool.php @@ -0,0 +1,231 @@ + 1, + 'one-page' => false, + 'section' => null, + 'clean-url' => false, + 'base-url' => ''); + private $_lang = array(); + + public function __construct($filename) + { + $this->_toc = new Sensei_Doc_Toc($filename); + + $this->_wiki = Text_Wiki::singleton('Doc'); + $this->_wiki->setParseConf('Doclink', 'toc', $this->_toc); + $this->_wiki->setRenderConf('xhtml', 'Doclink', 'url_callback', array(&$this, 'makeUrl')); + } + + public function getOption($option) + { + return $this->_options[$option]; + } + + public function setOption($option, $value) + { + switch ($option) { + case 'max-level': + $value = (int) $value; + break; + + case 'one-page': + case 'clean-url': + $value = (bool) $value; + break; + + case 'base-url': + $value = (string) $value; + break; + + case 'section': + if (! $value instanceof Sensei_Doc_Section) { + throw new Exception('Value must be an instance of Sensei_Doc_Section.'); + } + break; + + default: + throw new Exception('Unknown option.'); + } + + $this->_wiki->setRenderConf('xhtml', 'Doclink', 'view_url', $this->getUrlPrefix()); + + $this->_options[$option] = $value; + } + + public function renderToc($toc = null) + { + if (!$toc) { + $toc = $this->_toc; + } + + $classes = array(); + + if ($toc instanceof Sensei_Doc_Toc) { + + $class = ''; + if ($this->getOption('one-page')) { + $class = ' class="one-page"'; + } + + $classes[] = 'tree'; + + } else { + + $isParent = false; + $section = $this->getOption('section'); + + if ($section !== null) { + $current = $section; + do { + if ($current === $toc) { + $isParent = true; + break; + } + } while (($current = $current->getParent()) !== null); + } + + if (! $isParent) { + $classes[] = 'closed'; + } + } + + $classes = implode(' ', $classes); + + if ($classes === '') { + echo "
      \n"; + } else { + echo "
        \n"; + } + + for ($i = 0; $i < $toc->count(); $i++) { + $child = $toc->getChild($i); + + if ($child === $this->getOption('section')) { + echo '
      • '; + } else { + echo '
      • '; + } + + echo ''; + echo $child->getIndex() . ' ' . $child->getName() . ''; + + if ($child->count() > 0) { + echo "\n"; + $this->renderToc($child); + } + + echo '
      • ' . "\n"; + } + + echo '
      ' . "\n"; + + } + + public function getUrlPrefix() + { + $prefix = $this->getOption('base-url'); + + if (!$this->getOption('one-page')) { + if ($this->getOption('clean-url')) { + $prefix .= 'chapter/'; + } else { + $prefix .= '?chapter='; + } + } + + return $prefix; + } + + public function makeUrl($path) + { + $parts = explode(':', $path); + $firstPath = array_slice($parts, 0, $this->getOption('max-level')); + + $href = $this->getUrlPrefix() . implode(':', $firstPath); + + $anchorName = $this->makeAnchor($path); + if (!empty($anchorName)) { + $href .= '#' . $anchorName; + } + + return $href; + } + + public function makeAnchor($path) + { + $pathParts = explode(':', $path); + $anchorParts = array_slice($pathParts, $this->getOption('max-level')); + $anchorName = implode(':', $anchorParts); + return $anchorName; + } + + public function render() + { + if ($this->getOption('one-page')) { + + for ($i = 0; $i < count($this->_toc); $i++) { + $this->renderSection($this->_toc->getChild($i)); + } + + } else { + $section = $this->getOption('section'); + + if (!$section) { + throw new Exception('Section has not been set.'); + } else { + $this->renderSection($section); + } + } + } + + protected function renderSection($section) + { + $level = $section->getLevel(); + $name = $section->getName(); + $index = $section->getIndex(); + + if ($section->getLevel() == 1) { + echo '
      ' . "\n"; + echo "Chapter $index "; + } else { + echo '
      ' . "\n"; + echo "$index "; + } + + if ($section->getLevel() > $this->getOption('max-level')) { + echo ''; + echo $name; + echo ''; + } else { + echo $name; + } + + echo "\n"; + + echo $this->_wiki->transform($section->getText()); + + for ($i = 0; $i < count($section); $i++) { + $this->renderSection($section->getChild($i)); + } + + echo '
      ' . "\n"; + } + + public function findByPath($path) + { + return $this->_toc->findByPath($path); + } + + public function findByIndex($index) + { + return $this->_toc->findByIndex($index); + } +} \ No newline at end of file diff --git a/manual/new/lib/Text/Wiki/Doc.php b/manual/new/lib/Text/Wiki/Doc.php new file mode 100644 index 000000000..ad00687c7 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Doc.php @@ -0,0 +1,67 @@ + + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Default.php,v 1.1 2006/03/01 16:58:17 justinpatrin Exp $ + * @link http://pear.php.net/package/Text_Wiki + */ + +require_once('Text/Wiki.php'); + +/** + * This is the parser for the documentation + * + * @category Text + * @package Text_Wiki + * @author Janne Vanhala + * @author Justin Patrin + */ +class Text_Wiki_Doc extends Text_Wiki { + + var $rules = array( + 'Prefilter', + 'Delimiter', + 'Code', + 'Raw', + 'Horiz', + 'Break', + 'Blockquote', + 'List', + 'Deflist', + 'Table', + 'Image', + 'Phplookup', + 'Newline', + 'Paragraph', + 'Url', + 'Doclink', + 'Colortext', + 'Strong', + 'Bold', + 'Emphasis', + 'Italic', + 'Underline', + 'Tt', + 'Superscript', + 'Subscript', + 'Revise', + 'Tighten' + ); + + function Text_Wiki_Doc($rules = null) { + parent::Text_Wiki($rules); + + $this->addPath('parse', $this->fixPath(dirname(__FILE__)) . 'Parse/Doc'); + $this->addPath('render', $this->fixPath(dirname(__FILE__)) . 'Render/'); + + $this->setRenderConf('Xhtml', 'Url', 'target', ''); + $this->setRenderConf('Xhtml', 'charset', 'UTF-8'); + } + +} diff --git a/manual/new/lib/Text/Wiki/Parse/Doc/Code.php b/manual/new/lib/Text/Wiki/Parse/Doc/Code.php new file mode 100644 index 000000000..007ba2402 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Parse/Doc/Code.php @@ -0,0 +1,97 @@ + +* +* @license LGPL +* +* @version $Id: Code.php,v 1.11 2007/06/09 23:11:25 justinpatrin Exp $ +* +*/ + +/** +* +* 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 = ';^]*)?>(?:\s*)(.*?)(?:\s*)
      (\s|$);msi'; + + /** + * + * 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[1]); + + if ($args == '') { + $options = array( + 'text' => $matches[2], + '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[2], + 'attr' => $attr + ); + } + + return $this->wiki->addToken($this->rule, $options) . $matches[3]; + } +} +?> diff --git a/manual/new/lib/Text/Wiki/Parse/Doc/Doclink.php b/manual/new/lib/Text/Wiki/Parse/Doc/Doclink.php new file mode 100644 index 000000000..c99f3a419 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Parse/Doc/Doclink.php @@ -0,0 +1,37 @@ + null + ); + + var $regex = '/\[doc ([a-z0-9-]+(?::[a-z0-9-]+)*)(?: ([^\n\]]*))?]/'; + + function process(&$matches) + { + $toc = $this->getConf('toc'); + + if ($toc instanceof Sensei_Doc_Toc) { + $section = $toc->findByPath($matches[1]); + } + + if (isset($section)) { + $options = array(); + + $options['path'] = $matches[1]; + + if (isset($matches[2])) { + $options['text'] = $matches[2]; + } else { + $options['text'] = $section->getIndex() . ' ' . $section->getName(true); + } + + return $this->wiki->addToken($this->rule, $options); + + } else { + return $matches[0]; + } + + } +} diff --git a/manual/new/lib/Text/Wiki/Render/Xhtml/Blockquote.php b/manual/new/lib/Text/Wiki/Render/Xhtml/Blockquote.php new file mode 100644 index 000000000..60df55ce1 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Render/Xhtml/Blockquote.php @@ -0,0 +1,82 @@ + + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Blockquote.php,v 1.9 2007/05/26 18:25:23 mic Exp $ + * @link http://pear.php.net/package/Text_Wiki + */ + +/** + * This class renders a blockquote 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_Blockquote 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) + { + $type = $options['type']; + $level = $options['level']; + + // 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); + + // pick the css type + $css = $this->formatConf(' class="%s"', 'css'); + + if (isset($options['css'])) { + $css = ' class="' . $options['css']. '"'; + } + // starting + if ($type == 'start') { + $output = $pad; + if ($level > 1) { + $output .= '

      '; + } + $output .= "

      "; + + return $output; + } + + // ending + if ($type == 'end') { + $output = $pad . "

      \n"; + if ($level > 1) { + $output .= '

      '; + } + return $output; + } + } +} +?> diff --git a/manual/new/lib/Text/Wiki/Render/Xhtml/Code.php b/manual/new/lib/Text/Wiki/Render/Xhtml/Code.php new file mode 100644 index 000000000..310687e12 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Render/Xhtml/Code.php @@ -0,0 +1,110 @@ + + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @version CVS: $Id: Code.php,v 1.13 2006/02/10 23:07:03 toggg Exp $ + * @link http://pear.php.net/package/Text_Wiki + */ + +/** + * This class renders code 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_Code extends Text_Wiki_Render { + + var $conf = array( + 'css' => null, // class for

      +        'css_code' => null, // class for generic 
      +        'css_php'  => null, // class for PHP 
      +        'css_html' => null, // class for HTML 
      +        'css_filename' => null // class for optional filename 
      + ); + + /** + * + * 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 = $options['text']; + $attr = $options['attr']; + $type = strtolower($attr['type']); + + $css = $this->formatConf(' class="%s"', 'css'); + $css_code = $this->formatConf(' class="%s"', 'css_code'); + $css_php = $this->formatConf(' class="%s"', 'css_php'); + $css_html = $this->formatConf(' class="%s"', 'css_html'); + $css_filename = $this->formatConf(' class="%s"', 'css_filename'); + + if ($type == 'php') { + if (substr($options['text'], 0, 5) != '"; // ...
      tags) + $h = new PHP_Highlight(true); + $h->loadString($text); + $text = $h->toHtml(true); + + $text = str_replace(' ', ' ', $text); + + $text = str_replace('
      ', "
      ", $text);
      +            $text = str_replace('
      ', "
      ", $text); + + } elseif ($type == 'html' || $type == 'xhtml') { + + // HTML code example: + // add opening and closing tags, + // convert tabs to four spaces, + // convert entities. + $text = str_replace("\t", " ", $text); + $text = "\n$text\n"; + $text = $this->textEncode($text); + $text = "$text
      "; + + } else { + // generic code example: + // convert tabs to four spaces, + // convert entities. + $text = str_replace("\t", " ", $text); + $text = $this->textEncode($text); + $text = "$text
      "; + } + + if ($css_filename && isset($attr['filename'])) { + $text = "" . + $attr['filename'] . '
      ' . $text; + } + + return "\n$text\n\n"; + } +} +?> diff --git a/manual/new/lib/Text/Wiki/Render/Xhtml/Doclink.php b/manual/new/lib/Text/Wiki/Render/Xhtml/Doclink.php new file mode 100644 index 000000000..a08c53265 --- /dev/null +++ b/manual/new/lib/Text/Wiki/Render/Xhtml/Doclink.php @@ -0,0 +1,29 @@ + null, + 'css' => null + ); + + function token($options) + { + $callback = $this->getConf('url_callback'); + + if ($callback) { + $href = call_user_func($callback, $options['path']); + } else { + $href = $options['path']; + } + + if ($this->getConf('css')) { + $css = ' class="' . $this->getConf('css') . '"'; + } else { + $css = ''; + } + + $output = '' . $options['text'] . ''; + + return $output; + } +} diff --git a/manual/new/highlight.php b/manual/new/lib/highlight.php similarity index 100% rename from manual/new/highlight.php rename to manual/new/lib/highlight.php diff --git a/manual/new/styles/basic.css b/manual/new/styles/basic.css index 40bb15a77..37222bae1 100644 --- a/manual/new/styles/basic.css +++ b/manual/new/styles/basic.css @@ -92,9 +92,19 @@ a:visited:active { background-color: inherit; } +h1 a:link, h1 a:visited, +h2 a:link, h2 a:visited, +h3 a:link, h3 a:visited, +h4 a:link, h4 a:visited, +h5 a:link, h5 a:visited, +h6 a:link, h6 a:visited { + text-decoration: none !important; + color: black !important; +} + /*** Code blocks and highlighting**********************************************/ -pre, tt { +pre, code, tt { font-family: "Bitstream Vera Sans Mono", monospace; font-size: small; } diff --git a/vendor/Text/Wiki.php b/vendor/Text/Wiki.php index e0b8e1410..9facda823 100644 --- a/vendor/Text/Wiki.php +++ b/vendor/Text/Wiki.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wiki.php,v 1.48 2006/10/10 19:34:38 justinpatrin Exp $ + * @version CVS: $Id: Wiki.php,v 1.51 2007/06/09 23:17:46 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -33,7 +33,7 @@ require_once 'Text/Wiki/Render.php'; * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: 1.2.0RC1 + * @version Release: 1.2.0 * @link http://pear.php.net/package/Text_Wiki */ class Text_Wiki { @@ -256,6 +256,13 @@ class Text_Wiki { var $source = ''; + /** + * The output text + * + * @var string + */ + var $output = ''; + /** * @@ -337,9 +344,32 @@ class Text_Wiki { /** * Temporary configuration variable + * + * @var string */ var $renderingType = 'preg'; + /** + * Stack of rendering callbacks + * + * @var Array + */ + var $_renderCallbacks = array(); + + /** + * Current output block + * + * @var string + */ + var $_block; + + /** + * A stack of blocks + * + * @param Array + */ + var $_blocks; + /** * * Constructor. @@ -356,7 +386,10 @@ class Text_Wiki { function Text_Wiki($rules = null) { if (is_array($rules)) { - $this->rules = $rules; + $this->rules = array(); + foreach ($rules as $rule) { + $this->rules[] = ucfirst($rule); + } } $this->addPath( @@ -408,15 +441,15 @@ class Text_Wiki { * in further calls it will be effectively ignored. * @return &object a reference to the Text_Wiki unique instantiation. */ - function singleton($parser = 'Default', $rules = null) + function &singleton($parser = 'Default', $rules = null) { static $only = array(); if (!isset($only[$parser])) { - $ret = Text_Wiki::factory($parser, $rules); + $ret = & Text_Wiki::factory($parser, $rules); if (Text_Wiki::isError($ret)) { return $ret; } - $only[$parser] = $ret; + $only[$parser] =& $ret; } return $only[$parser]; } @@ -432,7 +465,7 @@ class Text_Wiki { * {@see Text_Wiki::singleton} for a list of rules * @return Text_Wiki a Parser object extended from Text_Wiki */ - function factory($parser = 'Default', $rules = null) + function &factory($parser = 'Default', $rules = null) { $class = 'Text_Wiki_' . $parser; $file = str_replace('_', '/', $class).'.php'; @@ -445,7 +478,7 @@ class Text_Wiki { } } - $obj = new $class($rules); + $obj =& new $class($rules); return $obj; } @@ -920,7 +953,7 @@ class Text_Wiki { // load may have failed; only parse if // an object is in the array now - if (isset($this->parseObj[$name]) && is_object($this->parseObj[$name])) { + if (is_object($this->parseObj[$name])) { $this->parseObj[$name]->parse(); } } @@ -948,7 +981,7 @@ class Text_Wiki { $format = ucwords(strtolower($format)); // the eventual output text - $output = ''; + $this->output = ''; // when passing through the parsed source text, keep track of when // we are in a delimited section @@ -965,7 +998,7 @@ class Text_Wiki { // pre-rendering activity if (is_object($this->formatObj[$format])) { - $output .= $this->formatObj[$format]->pre(); + $this->output .= $this->formatObj[$format]->pre(); } // load the render objects @@ -974,11 +1007,32 @@ class Text_Wiki { } if ($this->renderingType == 'preg') { - $output = preg_replace_callback('/'.$this->delim.'(\d+)'.$this->delim.'/', + $this->output = preg_replace_callback('/'.$this->delim.'(\d+)'.$this->delim.'/', array(&$this, '_renderToken'), $this->source); + /* +//Damn strtok()! Why does it "skip" empty parts of the string. It's useless now! + } elseif ($this->renderingType == 'strtok') { + echo '
      '.htmlentities($this->source).'
      '; + $t = strtok($this->source, $this->delim); + $inToken = true; + $i = 0; + while ($t !== false) { + echo 'Token: '.$i.'
      "'.htmlentities($t).'"


      '; + if ($inToken) { + //$this->output .= $this->renderObj[$this->tokens[$t][0]]->token($this->tokens[$t][1]); + } else { + $this->output .= $t; + } + $inToken = !$inToken; + $t = strtok($this->delim); + ++$i; + } + */ } else { // pass through the parsed source text character by character + $this->_block = ''; + $tokenStack = array(); $k = strlen($this->source); for ($i = 0; $i < $k; $i++) { @@ -991,17 +1045,34 @@ class Text_Wiki { // yes; are we ending the section? if ($char == $this->delim) { + if (count($this->_renderCallbacks) == 0) { + $this->output .= $this->_block; + $this->_block = ''; + } + + if (isset($opts['type'])) { + if ($opts['type'] == 'start') { + array_push($tokenStack, $rule); + } elseif ($opts['type'] == 'end') { + if ($tokenStack[count($tokenStack) - 1] != $rule) { + return Text_Wiki::error('Unbalanced tokens, check your syntax'); + } else { + array_pop($tokenStack); + } + } + } + // yes, get the replacement text for the delimited // token number and unset the flag. $key = (int)$key; $rule = $this->tokens[$key][0]; $opts = $this->tokens[$key][1]; - $output .= $this->renderObj[$rule]->token($opts); + $this->_block .= $this->renderObj[$rule]->token($opts); $in_delim = false; } else { - // no, add to the dlimited token key number + // no, add to the delimited token key number $key .= $char; } @@ -1015,21 +1086,35 @@ class Text_Wiki { // set the flag. $key = ''; $in_delim = true; + } else { // no, add to the output as-is - $output .= $char; + $this->_block .= $char; } } } } + if (count($this->_renderCallbacks)) { + return $this->error('Render callbacks left over after processing finished'); + } + /* + while (count($this->_renderCallbacks)) { + $this->popRenderCallback(); + } + */ + if (strlen($this->_block)) { + $this->output .= $this->_block; + $this->_block = ''; + } + // post-rendering activity if (is_object($this->formatObj[$format])) { - $output .= $this->formatObj[$format]->post(); + $this->output .= $this->formatObj[$format]->post(); } // return the rendered source text. - return $output; + return $this->output; } /** @@ -1043,6 +1128,28 @@ class Text_Wiki { return $this->renderObj[$this->tokens[$matches[1]][0]]->token($this->tokens[$matches[1]][1]); } + function registerRenderCallback($callback) { + $this->_blocks[] = $this->_block; + $this->_block = ''; + $this->_renderCallbacks[] = $callback; + } + + function popRenderCallback() { + if (count($this->_renderCallbacks) == 0) { + return Text_Wiki::error('Render callback popped when no render callbacks in stack'); + } else { + $callback = array_pop($this->_renderCallbacks); + $this->_block = call_user_func($callback, $this->_block); + if (count($this->_blocks)) { + $parentBlock = array_pop($this->_blocks); + $this->_block = $parentBlock.$this->_block; + } + if (count($this->_renderCallbacks) == 0) { + $this->output .= $this->_block; + $this->_block = ''; + } + } + } /** * @@ -1222,7 +1329,7 @@ class Text_Wiki { } } - $this->parseObj[$rule] = new $class($this); + $this->parseObj[$rule] =& new $class($this); } @@ -1258,7 +1365,7 @@ class Text_Wiki { } } - $this->renderObj[$rule] = new $class($this); + $this->renderObj[$rule] =& new $class($this); } @@ -1291,7 +1398,7 @@ class Text_Wiki { } } - $this->formatObj[$format] = new $class($this); + $this->formatObj[$format] =& new $class($this); } diff --git a/vendor/Text/Wiki/Mediawiki.php b/vendor/Text/Wiki/Mediawiki.php deleted file mode 100644 index 16bb256a0..000000000 --- a/vendor/Text/Wiki/Mediawiki.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Mediawiki.php,v 1.8 2006/02/25 09:59:34 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * "master" class for handling the management and convenience - */ -require_once('Text/Wiki.php'); - -/** - * Base Text_Wiki handler class extension for Mediawiki markup - * - * @category Text - * @package Text_Wiki - * @author 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() - */ -class Text_Wiki_Mediawiki extends Text_Wiki { - var $rules = array( - 'Prefilter', - 'Delimiter', -// 'Code', -// 'Plugin', -// 'Function', -// 'Html', - 'Raw', -// 'Preformatted', -// 'Include', -// 'Embed', -// 'Page', -// 'Anchor', - 'Heading', - 'Toc', -// 'Titlebar', - 'Horiz', - 'Break', -// 'Blockquote', - 'List', - 'Deflist', - 'Table', -// 'Box', -// 'Image', // done by Wikilink but still possible to disable/configure -// 'Phplookup', -// 'Center', - 'Newline', - 'Paragraph', - 'Url', -// 'Freelink', -// 'Colortext', - 'Wikilink', -// 'Strong', ** will be only fake inserted by Emphasis if needed for render -// 'Bold', - 'Emphasis', -// 'Italic', -// 'Underline', -// 'Tt', -// 'Superscript', -// 'Subscript', -// 'Specialchar', -// 'Revise', -// 'Interwiki', // done by Wikilink but still possible to disable/configure - 'Tighten' - ); - - /** - * Constructor: just adds the path to Mediawiki rules - * - * @access public - * @param array $rules The set of rules to load for this object. - */ - function Text_Wiki_Mediawiki($rules = null) { - parent::Text_Wiki($rules); - $this->addPath('parse', $this->fixPath(dirname(__FILE__)).'Parse/Mediawiki'); - } -} - -?> diff --git a/vendor/Text/Wiki/Parse.php b/vendor/Text/Wiki/Parse.php index a220d1926..404c6128c 100644 --- a/vendor/Text/Wiki/Parse.php +++ b/vendor/Text/Wiki/Parse.php @@ -233,12 +233,6 @@ class Text_Wiki_Parse { { // find the =" sections; $tmp = explode('="', trim($text)); - $mark = '"'; - - if (count($tmp) == 1) { - $tmp = explode("='", trim($text)); - $mark = "'"; - } // basic setup $k = count($tmp) - 1; @@ -257,11 +251,12 @@ class Text_Wiki_Parse { // find the last double-quote in the value. // the part to the left is the value for the last key, // the part to the right is the next key name - $pos = strrpos($val, $mark); + $pos = strrpos($val, '"'); $attrs[$key] = stripslashes(substr($val, 0, $pos)); $key = trim(substr($val, $pos+1)); } + return $attrs; } diff --git a/vendor/Text/Wiki/Parse/Default/Blockquote.php b/vendor/Text/Wiki/Parse/Default/Blockquote.php index d3c95fb61..7e209726a 100644 --- a/vendor/Text/Wiki/Parse/Default/Blockquote.php +++ b/vendor/Text/Wiki/Parse/Default/Blockquote.php @@ -12,7 +12,7 @@ * * @license LGPL * -* @version $Id: Blockquote.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ +* @version $Id: Blockquote.php,v 1.4 2006/10/21 05:56:28 justinpatrin Exp $ * */ @@ -76,7 +76,7 @@ class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { function process(&$matches) { // the replacement text we will return to parse() - $return = ''; + $return = "\n"; // the list of post-processing matches $list = array(); @@ -91,10 +91,8 @@ class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { PREG_SET_ORDER ); - // a stack of starts and ends; we keep this so that we know what - // indent level we're at. - $stack = array(); - + $curLevel = 0; + // loop through each list-item element. foreach ($list as $key => $val) { @@ -105,75 +103,78 @@ class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { // 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)) { - + while ($level > $curLevel) { // 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); + ++$curLevel; - $return .= "\n"; + //$return .= "\n"; // ...and add a start token to the return. $return .= $this->wiki->addToken( $this->rule, array( 'type' => 'start', - 'level' => $level - 1 + 'level' => $curLevel ) ); - $return .= "\n\n"; + //$return .= "\n\n"; } // remove a level? - while (count($stack) > $level) { + while ($curLevel > $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 .= "\n\n"; $return .= $this->wiki->addToken( $this->rule, array ( 'type' => 'end', - 'level' => count($stack) + 'level' => $curLevel ) ); - $return .= "\n"; + //$return .= "\n"; + --$curLevel; } // add the line text. - $return .= $text; + $return .= $val[2]; } + // the last char of the matched pattern must be \n but we don't + // want this to be inside the tokens + $return = substr($return, 0, -1); + // 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 .= "\n"; + + while ($curLevel > 0) { $return .= $this->wiki->addToken( $this->rule, array ( 'type' => 'end', - 'level' => count($stack) + 'level' => $curLevel ) ); + --$curLevel; } + // put back the trailing \n + $return .= "\n"; + // we're done! send back the replacement text. - return "\n$return\n\n"; + return $return; } } ?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Code.php b/vendor/Text/Wiki/Parse/Default/Code.php index 28f642840..cf60656a3 100644 --- a/vendor/Text/Wiki/Parse/Default/Code.php +++ b/vendor/Text/Wiki/Parse/Default/Code.php @@ -12,7 +12,7 @@ * * @license LGPL * -* @version $Id: Code.php,v 1.10 2006/02/21 14:33:53 toggg Exp $ +* @version $Id: Code.php,v 1.11 2007/06/09 23:11:25 justinpatrin Exp $ * */ @@ -50,8 +50,7 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { */ /* var $regex = '/^(\)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/ -/* var $regex = ';^]*)?>((?:(?R)|.)*?)\n
      (\s|$);msi';*/ - var $regex = ';^]*)?>\n(.+?)\n
      (\s|$);msi'; + var $regex = ';^]*)?>((?:(?R)|.*?)*)\n(\s|$);msi'; /** * @@ -72,7 +71,7 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { { // are there additional attribute arguments? $args = trim($matches[1]); - + if ($args == '') { $options = array( 'text' => $matches[2], @@ -81,7 +80,7 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { } else { // get the attributes... $attr = $this->getAttrs($args); - + // ... and make sure we have a 'type' if (! isset($attr['type'])) { $attr['type'] = ''; diff --git a/vendor/Text/Wiki/Parse/Default/Freelink.php b/vendor/Text/Wiki/Parse/Default/Freelink.php index 6cb64930a..f73aadf12 100644 --- a/vendor/Text/Wiki/Parse/Default/Freelink.php +++ b/vendor/Text/Wiki/Parse/Default/Freelink.php @@ -12,7 +12,7 @@ * * @license LGPL * -* @version $Id: Freelink.php,v 1.4 2005/10/19 23:43:53 toggg Exp $ +* @version $Id: Freelink.php,v 1.8 2006/12/08 08:23:51 justinpatrin Exp $ * */ @@ -41,6 +41,9 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse { + var $conf = array ( + 'utf-8' => false + ); /** * @@ -56,16 +59,20 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse { function Text_Wiki_Parse_Freelink(&$obj) { parent::Text_Wiki_Parse($obj); - + if ($this->getConf('utf-8')) { + $any = '\p{L}'; + } else { + $any = ''; + } $this->regex = '/' . // START regex "\\(\\(" . // double open-parens "(" . // START freelink page patter - "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character + "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&".$any."\xc0-\xff]+" . // 1 or more of just about any character ")" . // END freelink page pattern "(" . // START display-name "\|" . // a pipe to start the display name - "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character + "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&".$any."\xc0-\xff]+" . // 1 or more of just about any character ")?" . // END display-name pattern 0 or 1 "(" . // START pattern for named anchors "\#" . // a hash mark @@ -73,7 +80,7 @@ class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse { "[-A-Za-z0-9_:.]*" . // 0 or more alpha, digit, underscore ")?" . // END named anchors pattern 0 or 1 "()\\)\\)" . // double close-parens - '/'; // END regex + '/'.($this->getConf('utf-8') ? 'u' : ''); // END regex } diff --git a/vendor/Text/Wiki/Parse/Default/Prefilter.php b/vendor/Text/Wiki/Parse/Default/Prefilter.php index 4fb3886c0..3f41d96d9 100644 --- a/vendor/Text/Wiki/Parse/Default/Prefilter.php +++ b/vendor/Text/Wiki/Parse/Default/Prefilter.php @@ -12,7 +12,7 @@ * * @license LGPL * -* @version $Id: Prefilter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ +* @version $Id: Prefilter.php,v 1.4 2006/12/08 08:30:37 justinpatrin Exp $ * */ @@ -65,6 +65,12 @@ class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse { // add extra newlines at the top and end; this // seems to help many rules. $this->wiki->source = "\n" . $this->wiki->source . "\n\n"; + + $this->wiki->source = str_replace("\n----\n","\n\n----\n\n", + $this->wiki->source); + $this->wiki->source = preg_replace("/\n(\\+{1,6})(.*)\n/m", + "\n\n\\1 \\2\n\n", + $this->wiki->source); // finally, compress all instances of 3 or more newlines // down to two newlines. diff --git a/vendor/Text/Wiki/Parse/Default/Wikilink.php b/vendor/Text/Wiki/Parse/Default/Wikilink.php index ad072d5c5..3d6c1156e 100644 --- a/vendor/Text/Wiki/Parse/Default/Wikilink.php +++ b/vendor/Text/Wiki/Parse/Default/Wikilink.php @@ -12,7 +12,7 @@ * * @license LGPL * -* @version $Id: Wikilink.php,v 1.5 2005/09/14 14:29:38 toggg Exp $ +* @version $Id: Wikilink.php,v 1.9 2006/12/08 08:23:51 justinpatrin Exp $ * */ @@ -45,7 +45,8 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse { var $conf = array ( - 'ext_chars' => false + 'ext_chars' => false, + 'utf-8' => false ); /** @@ -65,13 +66,17 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse { { parent::Text_Wiki_Parse($obj); - if ($this->getConf('ext_chars')) { + if ($this->getConf('utf-8')) { + $upper = 'A-Z\p{Lu}'; + $lower = 'a-z0-9\p{Ll}'; + $either = 'A-Za-z0-9\p{L}'; + } else if ($this->getConf('ext_chars')) { // use an extended character set; this should // allow for umlauts and so on. taken from the // Tavi project defaults.php file. - $upper = "A-Z\xc0-\xde"; - $lower = "a-z0-9\xdf-\xfe"; - $either = "A-Za-z0-9\xc0-\xfe"; + $upper = 'A-Z\xc0-\xde'; + $lower = 'a-z0-9\xdf-\xfe'; + $either = 'A-Za-z0-9\xc0-\xfe'; } else { // the default character set, should be fine // for most purposes. @@ -111,7 +116,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse { function parse() { // described wiki links - $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/'; + $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/'.($this->getConf('utf-8') ? 'u' : ''); $this->wiki->source = preg_replace_callback( $tmp_regex, array(&$this, 'processDescr'), @@ -119,13 +124,15 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse { ); // standalone wiki links - if ($this->getConf('ext_chars')) { + if ($this->getConf('utf-8')) { + $either = 'A-Za-z0-9\p{L}'; + } else if ($this->getConf('ext_chars')) { $either = "A-Za-z0-9\xc0-\xfe"; } else { $either = "A-Za-z0-9"; } - $tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/"; + $tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/".($this->getConf('utf-8') ? 'u' : ''); $this->wiki->source = preg_replace_callback( $tmp_regex, array(&$this, 'process'), diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Deflist.php b/vendor/Text/Wiki/Parse/Mediawiki/Deflist.php deleted file mode 100644 index d0f2de9ed..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Deflist.php +++ /dev/null @@ -1,278 +0,0 @@ - -* @author Paul M. Jones -* @author Moritz Venn -* @license LGPL -* @version $Id: Deflist.php,v 1.1 2006/03/29 18:41:43 ritzmo Exp $ -* -*/ - -/** -* -* Parses for definition lists. -* -* This class implements a Text_Wiki_Parse to find source text marked as a -* definition list. -* If a line starts with ';' or ':' it is considered a part of a definition -* list. ';' indicates the term to be defined and ':' indicates its definition. -* As in Mediawiki we also allow definition lists to only consist of one -* item-type. -* -* @category Text -* @package Text_Wiki -* -* @author Justin Patrin -* @author Paul M. Jones -* @author Moritz Venn -* -*/ - -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(?!(?:\;|\:)+))/s'; - - /** - * - * 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 - * - * '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. - * - * @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 - $return = ''; - - // the list of post-processing matches - $list = array(); - - // a stack of list-start and list-end types; we keep this - // so that we know what kind of list we're working with - // (bullet or number) and what indent level we're at. - $stack = array(); - - // the item count is the number of list items for any - // given list-type on the stack - $itemcount = array(); - - // have we processed the very first list item? - $pastFirst = false; - - // populate $list with this set of matches. $matches[1] is the - // text matched as a list set by parse(). - preg_match_all( - '/^((;|:)+)(.*?)$/ms', - $matches[1], - $list, - PREG_SET_ORDER - ); - - // loop through each list-item element. - foreach ($list as $key => $val) { - // $val[0] is the full matched list-item line - // $val[1] is the type (* or #) - // $val[2] is the level (number) - // $val[3] is the list item text - - // how many levels are we indented? (1 means the "root" - // list level, no indenting.) - $level = strlen($val[1]); - - // get the list item type - if ($val[2] == ';') { - $type = 'term'; - } elseif ($val[2] == ':') { - $type = 'narr'; - } else { - $type = 'unknown'; - } - - // get the text of the list item - $text = $val[3]; - - // add a level to the list? - if ($level > count($stack)) { - - // the current indent level is greater than the - // number of stack elements, so we must be starting - // a new list. push the new list type onto the - // stack... - array_push($stack, $type); - - // The new list has to be opened in an item (use current type) - if ($level > 1) { - $return .= $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_start', - 'level' => $level - 1 - ) - ); - } - // ...and add a list-start token to the return. - $return .= $this->wiki->addToken( - $this->rule, - array( - 'type' => 'list_start', - 'level' => $level - 1 - ) - ); - } - - // remove a level from the list? - while (count($stack) > $level) { -echo "."; - // so we don't keep counting the stack, we set up a temp - // var for the count. -1 becuase we're going to pop the - // stack in the next command. $tmp will then equal the - // current level of indent. - $tmp = count($stack) - 1; - - // 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. - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'list_end', - 'level' => $tmp - ) - ); - - array_pop($stack); - - // reset to the current (previous) list type so that - // the new list item matches the proper list type. - $type = $stack[$tmp - 1]; - - // Close the previously opened List item - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => $type . '_end', - 'level' => $tmp - ) - ); - - // reset the item count for the popped indent level - unset($itemcount[$tmp + 1]); - } - - // add to the item count for this list (taking into account - // which level we are at). - if (! isset($itemcount[$level])) { - // first count - $itemcount[$level] = 0; - } else { - // increment count - $itemcount[$level]++; - } - - // is this the very first item in the list? - if (! $pastFirst) { - $first = true; - $pastFirst = true; - } else { - $first = false; - } - - // create a list-item starting token. - $start = $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_start', - 'level' => $level, - 'count' => $itemcount[$level], - 'first' => $first - ) - ); - - // create a list-item ending token. - $end = $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_end', - 'level' => $level, - 'count' => $itemcount[$level] - ) - ); - - // add the starting token, list-item text, and ending token - // to the return. - $return .= $start . $text . $end; - } - - // the last list-item may have been indented. go through the - // list-type stack and create end-list tokens until the stack - // is empty. - $level = count($stack); - while ($level > 0) { - array_pop($stack); - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'list_end', - 'level' => $level - 1 - ) - ); - - // if we are higher than level 1 we need to close fake items - if ($level > 1) { - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => $stack[$level - 2] . '_end', - 'level' => $level - 2 - ) - ); - } - $level = count($stack); - } - - // we're done! send back the replacement text. - return "\n" . $return . "\n\n"; - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Emphasis.php b/vendor/Text/Wiki/Parse/Mediawiki/Emphasis.php deleted file mode 100644 index bffceff6d..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Emphasis.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @author Paul M. Jones - * @copyright 2005 bertrand Gugger - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Emphasis.php,v 1.4 2006/02/15 12:27:40 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * Emphazised text rule parser class for Mediawiki. Makes Emphasis, Strong or both - * This class implements a Text_Wiki_Parse to find source text marked for - * emphasis, stronger and very as defined by text surrounded by 2,3 or 5 single-quotes. - * On parsing, the text itself is left in place, but the starting and ending - * instances of the single-quotes are replaced with tokens. - * - * @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_Emphasis 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 '' , ''' or ''''' embeded texts - * - * @access public - * @var string - * @see Text_Wiki_Parse::parse() - */ - var $regex = "/(? ['start'|'end'] The starting or ending point of the emphasized text. - * Generated tokens are Emphasis (this rule), Strong or Emphasis / Strong - * The text itself is left in the source but may content bested blocks - * - * @access public - * @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 emphasized. - */ - function process(&$matches) - { - $embeded = $matches[2]; - switch (strlen($matches[1])) { - case 1: - $start = $this->wiki->addToken($this->rule, array('type' => 'start')); - $end = $this->wiki->addToken($this->rule, array('type' => 'end')); - break; - case 3: - $embeded = "'" . $embeded . "'"; - case 2: - $start = $this->wiki->addToken('Strong', array('type' => 'start')); - $end = $this->wiki->addToken('Strong', array('type' => 'end')); - break; - case 4: - $start = $this->wiki->addToken($this->rule, array('type' => 'start')) - . $this->wiki->addToken('Strong', array('type' => 'start')); - $end = $this->wiki->addToken('Strong', array('type' => 'end')) - . $this->wiki->addToken($this->rule, array('type' => 'end')); - break; - } - return $start . $embeded . $end; - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Heading.php b/vendor/Text/Wiki/Parse/Mediawiki/Heading.php deleted file mode 100644 index 7e87980e6..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Heading.php +++ /dev/null @@ -1,109 +0,0 @@ - -* -* @author Moritz Venn -* -* @license LGPL -* -* @version $Id: Heading.php,v 1.3 2006/02/03 19:47:02 toggg Exp $ -* -*/ - -/** -* -* Parses for heading text. -* -* This class implements a Text_Wiki_Parse to find source text marked to -* be a heading element, as defined by text on a line by itself prefixed -* with a number of plus signs (+). The heading text itself is left in -* the source, but is prefixed and suffixed with delimited tokens marking -* the start and end of the heading. -* -* @category Text -* -* @package Text_Wiki -* -* @author Moritz Venn -* -*/ - -class Text_Wiki_Parse_Heading 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 = '/^(={2,6})(.*?)\1(?:\s|$)/m'; - - var $conf = array( - 'id_prefix' => 'toc' - ); - - /** - * - * Generates a replacement for the matched text. Token options are: - * - * 'type' => ['start'|'end'] The starting or ending point of the - * heading text. The text itself is left in the source. - * - * @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 heading text. - * - */ - - function process(&$matches) - { - // keep a running count for header IDs. we use this later - // when constructing TOC entries, etc. - static $id; - if (! isset($id)) { - $id = 0; - } - - $prefix = htmlspecialchars($this->getConf('id_prefix')); - - $start = $this->wiki->addToken( - $this->rule, - array( - 'type' => 'start', - 'level' => strlen($matches[1]), - 'text' => trim($matches[2]), - 'id' => $prefix . $id ++ - ) - ); - - $end = $this->wiki->addToken( - $this->rule, - array( - 'type' => 'end', - 'level' => strlen($matches[1]) - ) - ); - - return $start . trim($matches[2]) . $end . "\n"; - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Mediawiki/List.php b/vendor/Text/Wiki/Parse/Mediawiki/List.php deleted file mode 100644 index f93655321..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/List.php +++ /dev/null @@ -1,250 +0,0 @@ - -* @author Paul M. Jones -* -* @license LGPL -* -* @version $Id: List.php,v 1.1 2006/03/28 04:46:09 ritzmo Exp $ -* -*/ - -/** -* -* Parses for bulleted and numbered lists. -* -* This class implements a Text_Wiki_Parse to find source text marked as -* a bulleted or numbered list. In short, if a line starts with '* ' then -* it is a bullet list item; if a line starts with '# ' then it is a -* number list item. Spaces in front of the * or # indicate an indented -* sub-list. The list items must be on sequential lines, and may be -* separated by blank lines to improve readability. Using a non-* non-# -* non-whitespace character at the beginning of a line ends the list. -* -* @category Text -* -* @package Text_Wiki -* -* @author Justin Patrin -* @author Paul M. Jones -* -*/ - -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() - * - */ - - //TODO: add text continuations (any number of + signs) and expandable areas (- after *s ot #s) - - var $regex = '/\n((?:\*|#)+.*?\n(?!(?:\*|#)+))/s'; - - /** - * - * Generates a replacement for the matched text. Token options are: - * - * 'type' => - * 'bullet_start' : the start of a bullet list - * 'bullet_end' : the end of a bullet list - * 'number_start' : the start of a number list - * 'number_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. - * - * @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 - $return = ''; - - // the list of post-processing matches - $list = array(); - - // a stack of list-start and list-end types; we keep this - // so that we know what kind of list we're working with - // (bullet or number) and what indent level we're at. - $stack = array(); - - // the item count is the number of list items for any - // given list-type on the stack - $itemcount = array(); - - // have we processed the very first list item? - $pastFirst = false; - - // populate $list with this set of matches. $matches[1] is the - // text matched as a list set by parse(). - preg_match_all( - '/^((\*|#)+)(.*?)$/ms', - $matches[1], - $list, - PREG_SET_ORDER - ); - - // loop through each list-item element. - foreach ($list as $key => $val) { - // $val[0] is the full matched list-item line - // $val[1] is the type (* or #) - // $val[2] is the level (number) - // $val[3] is the list item text - - // how many levels are we indented? (1 means the "root" - // list level, no indenting.) - $level = strlen($val[1]); - - // get the list item type - if ($val[2] == '*') { - $type = 'bullet'; - } elseif ($val[2] == '#') { - $type = 'number'; - } else { - $type = 'unknown'; - } - - // get the text of the list item - $text = $val[3]; - - // add a level to the list? - if ($level > count($stack)) { - - // the current indent level is greater than the - // number of stack elements, so we must be starting - // a new list. push the new list type onto the - // stack... - array_push($stack, $type); - - // ...and add a list-start token to the return. - $return .= $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_list_start', - 'level' => $level - 1 - ) - ); - } - - // remove a level from the list? - while (count($stack) > $level) { - - // so we don't keep counting the stack, we set up a temp - // var for the count. -1 becuase we're going to pop the - // stack in the next command. $tmp will then equal the - // current level of indent. - $tmp = count($stack) - 1; - - // 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. - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => array_pop($stack) . '_list_end', - 'level' => $tmp - ) - ); - - // reset to the current (previous) list type so that - // the new list item matches the proper list type. - $type = $stack[$tmp - 1]; - - // reset the item count for the popped indent level - unset($itemcount[$tmp + 1]); - } - - // add to the item count for this list (taking into account - // which level we are at). - if (! isset($itemcount[$level])) { - // first count - $itemcount[$level] = 0; - } else { - // increment count - $itemcount[$level]++; - } - - // is this the very first item in the list? - if (! $pastFirst) { - $first = true; - $pastFirst = true; - } else { - $first = false; - } - - // create a list-item starting token. - $start = $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_item_start', - 'level' => $level, - 'count' => $itemcount[$level], - 'first' => $first - ) - ); - - // create a list-item ending token. - $end = $this->wiki->addToken( - $this->rule, - array( - 'type' => $type . '_item_end', - 'level' => $level, - 'count' => $itemcount[$level] - ) - ); - - // add the starting token, list-item text, and ending token - // to the return. - $return .= $start . $text . $end; - } - - // the last list-item may have been indented. go through the - // list-type stack and create end-list tokens until the stack - // is empty. - while (count($stack) > 0) { - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => array_pop($stack) . '_list_end', - 'level' => count($stack) - ) - ); - } - - // we're done! send back the replacement text. - return "\n" . $return . "\n\n"; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Raw.php b/vendor/Text/Wiki/Parse/Mediawiki/Raw.php deleted file mode 100644 index c92ab12be..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Raw.php +++ /dev/null @@ -1,73 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Raw.php,v 1.2 2006/02/15 10:20:08 toggg Exp $ -* -*/ - -/** -* -* Parses for text marked as "raw" (i.e., to be rendered as-is). -* -* This class implements a Text_Wiki rule to find sections of the source -* text that are not to be processed by Text_Wiki. These blocks of "raw" -* text will be rendered as they were found. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Raw extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to find source text matching this - * rule. - * - * @access public - * - * @var string - * - */ - - var $regex = "/(.*)<\/nowiki>/Ums"; - - - /** - * - * 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) - { - $options = array('text' => $matches[1]); - return $this->wiki->addToken($this->rule, $options); - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Table.php b/vendor/Text/Wiki/Parse/Mediawiki/Table.php deleted file mode 100644 index a35b451e2..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Table.php +++ /dev/null @@ -1,286 +0,0 @@ - - * @copyright 2005 bertrand Gugger - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Table.php,v 1.7 2005/12/06 15:54:56 ritzmo Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * Table rule parser class for Mediawiki. - * - * @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_Table 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 = '#^\{\|(.*?)(?:^\|\+(.*?))?(^(?:((?R))|.)*?)^\|}#msi'; - - /** - * The regular expression used in second stage to find table's rows - * used by process() to call back processRows() - * - * @access public - * @var string - * @see process() - * @see processRows() - */ - var $regexRows = '#(?:^(\||!)-|\G)(.*?)^(.*?)(?=^(?:\|-|!-|\z))#msi'; - - /** - * The regular expression used in third stage to find rows's cells - * used by processRows() to call back processCells() - * - * @access public - * @var string - * @see process() - * @see processCells() - */ - var $regexCells = - '#((?:^\||^!|\|\||!!|\G))(?:([^|\n]*?) \|(?!\|))?(.+?)(?=^\||^!|\|\||!!|\z)#msi'; - - /** - * The current table nesting depth, starts by zero - * - * @access private - * @var int - */ - var $_level = 0; - - /** - * The count of rows for this level - * - * @access private - * @var array of int - */ - var $_countRows = array(); - - /** - * The max count of cells for this level - * - * @access private - * @var array of int - */ - var $_maxCells = array(); - - /** - * The count of cells for each row - * - * @access private - * @var array of int - */ - var $_countCells = array(); - - /** - * The count of spanned cells from previous rowspans for each column - * - * @access private - * @var array of int - */ - var $_spanCells = array(); - - /** - * Generates a replacement for the matched text. Returned token options are: - * 'type' => - * 'table_start' : the start of a bullet list - * 'table_end' : the end of a bullet list - * 'row_start' : the start of a number list - * 'row_end' : the end of a number list - * 'cell_start' : the start of item text (bullet or number) - * 'cell_end' : the end of item text (bullet or number) - * 'caption_start' : the start of associated caption - * 'caption_end' : the end of associated caption - * - * 'level' => the table nesting level (starting zero) ('table_start') - * - * 'rows' => the number of rows in the table ('table_start') - * - * 'cols' => the number of columns in the table or rows - * ('table_start' and 'row_start') - * - * 'span' => column span ('cell_start') - * - * 'row_span' => row span ('cell_start') - * - * 'attr' => header optional attribute flag ('row_start' or 'cell_start') - * - * 'format' => table, row or cell optional styling ('xxx_start') - * - * @param array &$matches The array of matches from parse(). - * @return string the original text with tags replaced by delimited tokens - * which point to the the token array containing their type and definition - * @access public - */ - function process(&$matches) - { - if (array_key_exists(4, $matches)) { - $this->_level++; - $expsub = preg_replace_callback( - $this->regex, - array(&$this, 'process'), - $matches[3] - ); - $this->_level--; - } else { - $expsub = $matches[3]; - } - $this->_countRows[$this->_level] = $this->_maxCells[$this->_level] = 0; - $this->_countCells[$this->_level] = $this->_spanCells[$this->_level] = array(); - $sub = preg_replace_callback( - $this->regexRows, - array(&$this, 'processRows'), - $expsub - ); - $param = array( - 'type' => 'table_start', - 'level' => $this->_level, - 'rows' => $this->_countRows[$this->_level], - 'cols' => $this->_maxCells[$this->_level] - ); - if ($format = trim($matches[1])) { - $param['format'] = $format; - } - $ret = $this->wiki->addToken($this->rule, $param ); - if ($matches[2]) { - $ret .= $this->wiki->addToken($this->rule, array( - 'type' => 'caption_start', - 'level' => $this->_level ) ) . $matches[2] . - $this->wiki->addToken($this->rule, array( - 'type' => 'caption_end', - 'level' => $this->_level ) ); - } - $param['type'] = 'table_end'; - return $ret . $sub . $this->wiki->addToken($this->rule, $param ); - } - - /** - * Generates a replacement for the matched rows. Token options are: - * 'type' => - * 'row_start' : the start of a row - * 'row_end' : the end of a row - * - * 'order' => the row order in the table - * - * 'cols' => the count of cells in the row - * - * 'attr' => header optional attribute flag - * - * 'format' => row optional styling - * - * @param array &$matches The array of matches from process() callback. - * @return string 2 delimited tokens pointing the row params - * and containing the cells-parsed block of text between the tags - * @access public - */ - function processRows(&$matches) - { - $this->_countCells[$this->_level][$this->_countRows[$this->_level]] = 0; - $sub = preg_replace_callback( - $this->regexCells, - array(&$this, 'processCells'), - $matches[3] - ); - $param = array( - 'type' => 'row_start', - 'order' => $this->_countRows[$this->_level], - 'cols' => $this->_countCells[$this->_level][$this->_countRows[$this->_level]++] - ); - if ($matches[1] == '!') { - $param['attr'] = 'header'; - } - if ($format = trim($matches[2])) { - $param['format'] = $format; - } - if ($this->_maxCells[$this->_level] < $param['cols']) { - $this->_maxCells[$this->_level] = $param['cols']; - } - $ret = $this->wiki->addToken($this->rule, $param ); - $param['type'] = 'row_end'; - return $ret . $sub . $this->wiki->addToken($this->rule, $param ); - } - - /** - * Generates a replacement for the matched cells. Token options are: - * 'type' => - * 'cell_start' : the start of a row - * 'cell_end' : the end of a row - * - * 'order' => the cell order in the row - * - * 'cols' => the count of cells in the row - * - * 'span' => column span - * - * 'row_span' => row span - * - * 'attr' => header optional attribute flag - * - * 'format' => cell optional styling - * - * @param array &$matches The array of matches from processRows() callback. - * @return string 2 delimited tokens pointing the cell params - * and containing the block of text between the tags - * @access public - */ - function processCells(&$matches) - { - $order = & $this->_countCells[$this->_level][$this->_countRows[$this->_level]]; - while (isset($this->_spanCells[$this->_level][$order])) { - if (--$this->_spanCells[$this->_level][$order] < 2) { - unset($this->_spanCells[$this->_level][$order]); - } - $order++; - } - $param = array( - 'type' => 'cell_start', - 'attr' => $matches[1] && ($matches[1]{0} == '!') ? 'header': null, - 'span' => 1, - 'rowspan' => 1, - 'order' => $order - ); - if ($format = trim($matches[2])) { - if (preg_match('#(.*)colspan=("|\')?(\d+)(?(2)\2)(.*)#i', $format, $pieces)) { - $param['span'] = (int)$pieces[3]; - $format = $pieces[1] . $pieces[4]; - } - if (preg_match('#(.*)rowspan=("|\')?(\d+)(?(2)\2)(.*)#i', $format, $pieces)) { - $this->_spanCells[$this->_level][$order] = - $param['rowspan'] = (int)$pieces[3]; - $format = $pieces[1] . $pieces[4]; - } - $param['format'] = $format; - } - $this->_countCells[$this->_level][$this->_countRows[$this->_level]] += $param['span']; - $ret = $this->wiki->addToken($this->rule, $param); - $param['type'] = 'cell_end'; - return $ret . $matches[3] . $this->wiki->addToken($this->rule, $param ); - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Url.php b/vendor/Text/Wiki/Parse/Mediawiki/Url.php deleted file mode 100644 index 3453e1a74..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Url.php +++ /dev/null @@ -1,348 +0,0 @@ - -* -* @author Moritz Venn -* -* @license LGPL -* -* @version $Id: Url.php,v 1.1 2005/12/06 15:54:56 ritzmo Exp $ -* -*/ - -/** -* -* Parse for URLS in the source text. -* -* Various URL markings are supported: inline (the URL by itself), -* inline (where the URL is enclosed in square brackets), and named -* reference (where the URL is enclosed in square brackets and has a -* name included inside the brackets). E.g.: -* -* inline -- http://example.com -* undescribed -- [http://example.com] -* described -- [http://example.com Example Description] -* described -- [http://www.example.com|Example Description] -* -* When rendering a URL token, this will convert URLs pointing to a .gif, -* .jpg, or .png image into an inline tag (for the 'xhtml' -* format). -* -* 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 -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -* @author Moritz Venn -* -*/ - -class Text_Wiki_Parse_Url extends Text_Wiki_Parse { - - - /** - * - * Keeps a running count of numbered-reference URLs. - * - * @access public - * - * @var int - * - */ - - var $footnoteCount = 0; - - - /** - * - * URL schemes recognized by this rule. - * - * @access public - * - * @var array - * - */ - - var $conf = array( - 'schemes' => array( - 'http://', - 'https://', - 'ftp://', - 'gopher://', - 'news://', - 'mailto:' - ) - ); - - - /** - * - * Constructor. - * - * We override the constructor so we can comment the regex nicely. - * - * @access public - * - */ - - function Text_Wiki_Parse_Url(&$obj) - { - parent::Text_Wiki_Parse($obj); - - // convert the list of recognized schemes to a regex-safe string, - // where the pattern delim is a slash - $tmp = array(); - $list = $this->getConf('schemes', array()); - foreach ($list as $val) { - $tmp[] = preg_quote($val, '/'); - } - $schemes = implode('|', $tmp); - - // build the regex - $this->regex = - "($schemes)" . // allowed schemes - "(" . // start pattern - "[^ \\/\"\'{$this->wiki->delim}]*\\/" . // no spaces, backslashes, slashes, double-quotes, single quotes, or delimiters; - ")*" . // end pattern - "[^ \\t\\n\\/\"\'{$this->wiki->delim}]*" . - "[A-Za-z0-9\\/?=&~_]"; - } - - - /** - * - * Find three different kinds of URLs in the source text. - * - * @access public - * - */ - - function parse() - { - // ------------------------------------------------------------- - // - // Described-reference (named) URLs. - // - - // the regular expression for this kind of URL - $tmp_regex = '/\[(' . $this->regex . ')[ |]([^\]]+)\]/'; - - // use a custom callback processing method to generate - // the replacement text for matches. - $this->wiki->source = preg_replace_callback( - $tmp_regex, - array(&$this, 'processDescr'), - $this->wiki->source - ); - - - // ------------------------------------------------------------- - // - // Unnamed-reference ('Ordinary'-style) URLs. - // - - // the regular expression for this kind of URL - $tmp_regex = '/\[(' . $this->regex . ')\]/U'; - - // use a custom callback processing method to generate - // the replacement text for matches. - $this->wiki->source = preg_replace_callback( - $tmp_regex, - //array(&$this, 'processFootnote'), - array(&$this, 'processOrdinary'), - $this->wiki->source - ); - - - // ------------------------------------------------------------- - // - // Normal inline URLs. - // - - // the regular expression for this kind of URL - - $tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/'; - - // use the standard callback for inline URLs - $this->wiki->source = preg_replace_callback( - $tmp_regex, - array(&$this, 'process'), - $this->wiki->source - ); - - - //$tmp_regex = '/(^|[^A-Za-z])([a-zA-Z])(.*?)/'; - $tmp_regex = '/(^|\s)([a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+)($|\s)/'; - - // use the standard callback for inline URLs - $this->wiki->source = preg_replace_callback( - $tmp_regex, - array(&$this, 'processWithoutProtocol'), - $this->wiki->source - ); - - $tmp_regex = '/(^|\s|'.$this->wiki->delim.')<([a-zA-Z0-9\-\.%_\+\!\*\'\(\)\,]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+)>(\s|'.$this->wiki->delim.'|$)/'; - - // use the standard callback for inline URLs - $this->wiki->source = preg_replace_callback( - $tmp_regex, - array(&$this, 'processInlineEmail'), - $this->wiki->source - ); - } - - - /** - * - * Process inline URLs. - * - * @param array &$matches - * - * @param array $matches An array of matches from the parse() method - * as generated by preg_replace_callback. $matches[0] is the full - * matched string, $matches[1] is the first matched pattern, - * $matches[2] is the second matched pattern, and so on. - * - * @return string The processed text replacement. - * - */ - - function process(&$matches) - { - // set options - $options = array( - 'type' => 'inline', - 'href' => $matches[2], - 'text' => $matches[2] - ); - - // tokenize - return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[5]; - } - - function processWithoutProtocol(&$matches) - { - // set options - $options = array( - 'type' => 'inline', - 'href' => 'http://'.$matches[2], - 'text' => $matches[2] - ); - - // tokenize - return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[4]; - } - - function processInlineEmail(&$matches) - { - // set options - $options = array( - 'type' => 'inline', - 'href' => 'mailto://'.$matches[2], - 'text' => $matches[2] - ); - - // tokenize - return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[4]; - } - - /** - * - * Process numbered (footnote) URLs. - * - * Token options are: - * @param array &$matches - * - * @param array $matches An array of matches from the parse() method - * as generated by preg_replace_callback. $matches[0] is the full - * matched string, $matches[1] is the first matched pattern, - * $matches[2] is the second matched pattern, and so on. - * - * @return string The processed text replacement. - * - */ - - function processFootnote(&$matches) - { - // keep a running count for footnotes - $this->footnoteCount++; - - // set options - $options = array( - 'type' => 'footnote', - 'href' => $matches[1], - 'text' => $this->footnoteCount - ); - - // tokenize - return $this->wiki->addToken($this->rule, $options); - } - - function processOrdinary(&$matches) - { - // keep a running count for footnotes - $this->footnoteCount++; - - // set options - $options = array( - 'type' => 'descr', - 'href' => $matches[1], - 'text' => $matches[1] - ); - - // tokenize - return $this->wiki->addToken($this->rule, $options); - } - - - /** - * - * Process described-reference (named-reference) URLs. - * - * 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 - * - * @param array $matches An array of matches from the parse() method - * as generated by preg_replace_callback. $matches[0] is the full - * matched string, $matches[1] is the first matched pattern, - * $matches[2] is the second matched pattern, and so on. - * - * @return string The processed text replacement. - * - */ - - function processDescr(&$matches) - { - // set options - $options = array( - 'type' => 'descr', - 'href' => $matches[1], - 'text' => $matches[4] - ); - - // tokenize - return $this->wiki->addToken($this->rule, $options); - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Mediawiki/Wikilink.php b/vendor/Text/Wiki/Parse/Mediawiki/Wikilink.php deleted file mode 100644 index 35e9a2855..000000000 --- a/vendor/Text/Wiki/Parse/Mediawiki/Wikilink.php +++ /dev/null @@ -1,302 +0,0 @@ - - * @author Paul M. Jones - * @copyright 2005 bertrand Gugger - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wikilink.php,v 1.7 2006/02/25 13:34:50 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * Wikilink, Interwiki and Image rules parser class for Mediawiki. - * This class implements a Text_Wiki_Parse to find links marked - * in source by text surrounded by 2 opening/closing brackets as - * [[Wiki page name#Section|Alternate text]] - * On parsing, the link is replaced with a token. - * - * @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_Wikilink extends Text_Wiki_Parse { - - /** - * Configuration for this rule (Wikilink) - * - * @access public - * @var array - */ - var $conf = array( - 'spaceUnderscore' => true, - 'project' => array('demo', 'd'), - 'url' => 'http://example.com/en/page=%s', - 'langage' => 'en' - ); - - /** - * Configuration for the Image rule - * - * @access public - * @var array - */ - var $imageConf = array( - 'prefix' => array('Image', 'image') - ); - - /** - * Configuration for the Interwiki rule - * - * @access public - * @var array - */ - var $interwikiConf = array( - 'sites' => array( - 'manual' => 'http://www.php.net/manual/en/%s', - 'pear' => 'http://pear.php.net/package/%s', - 'bugs' => 'http://pear.php.net/package/%s/bugs' - ), - 'interlangage' => array('en', 'de', 'fr') - ); - - /** - * 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 Text_Wiki_Parse::parse() - */ - var $regex = '/(?conf; - parent::Text_Wiki_Parse($obj); - - // override config options for image if specified - if (in_array('Image', $this->wiki->disable)) { - $this->imageConf['prefix'] = array(); - } else { - if (isset($this->wiki->parseConf['Image']) && - is_array($this->wiki->parseConf['Image'])) { - $this->imageConf = array_merge( - $this->imageConf, - $this->wiki->parseConf['Image'] - ); - } - } - - // override config options for interwiki if specified - if (in_array('Interwiki', $this->wiki->disable)) { - $this->interwikiConf['sites'] = array(); - $this->interwikiConf['interlangage'] = array(); - } else { - if (isset($this->wiki->parseConf['Interwiki']) && - is_array($this->wiki->parseConf['Interwiki'])) { - $this->interwikiConf = array_merge( - $this->interwikiConf, - $this->wiki->parseConf['Interwiki'] - ); - } - if (empty($this->conf['langage'])) { - $this->interwikiConf['interlangage'] = array(); - } - } - // convert the list of recognized schemes to a regex OR, -/* $schemes = $this->getConf('schemes', $default['schemes']); - $this->url = str_replace( '#delim#', $this->wiki->delim, - '#(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://' - . $this->getConf('host_regexp', $default['host_regexp']) - . $this->getConf('path_regexp', $default['path_regexp']) .'#'); */ - } - - /** - * Generates a replacement for the matched text. Token options are: - * - 'page' => the name of the target wiki page - * -'anchor' => the optional section in it - * - 'text' => the optional alternate link text - * - * @access public - * @param array &$matches The array of matches from parse(). - * @return string token to be used as replacement - */ - function process(&$matches) - { - // Starting colon ? - $colon = !empty($matches[1]); - $auto = $interlang = $interwiki = $image = $site = ''; - // Prefix ? - if (!empty($matches[2])) { - $prefix = explode(':', substr($matches[2], 0, -1)); - $count = count($prefix); - $i = -1; - // Autolink - if (isset($this->conf['project']) && - in_array(trim($prefix[0]), $this->conf['project'])) { - $auto = trim($prefix[0]); - unset($prefix[0]); - $i = 0; - } - while (++$i < $count) { - $prefix[$i] = trim($prefix[$i]); - // interlangage - if (!$interlang && - in_array($prefix[$i], $this->interwikiConf['interlangage'])) { - $interlang = $prefix[$i]; - unset($prefix[$i]); - continue; - } - // image - if (!$image && in_array($prefix[$i], $this->imageConf['prefix'])) { - $image = $prefix[$i]; - unset($prefix[$i]); - break; - } - // interwiki - if (isset($this->interwikiConf['sites'][$prefix[$i]])) { - $interwiki = $this->interwikiConf['sites'][$prefix[$i]]; - $site = $prefix[$i]; - unset($prefix[$i]); - } - break; - } - if ($prefix) { - $matches[3] = implode(':', $prefix) . ':' . $matches[3]; - } - } - $text = empty($matches[5]) ? $matches[3] : $matches[5]; - $matches[3] = trim($matches[3]); - $matches[4] = empty($matches[4]) ? '' : trim($matches[4]); - if ($this->conf['spaceUnderscore']) { - $matches[3] = preg_replace('/\s+/', '_', $matches[3]); - $matches[4] = preg_replace('/\s+/', '_', $matches[4]); - } - if ($image) { - return $this->image($matches[3] . (empty($matches[4]) ? '' : '#' . $matches[4]), - $text, $interlang, $colon); - } - if (!$interwiki && $interlang && isset($this->conf['url'])) { - if ($interlang == $this->conf['langage']) { - $interlang = ''; - } else { - $interwiki = $this->conf['url']; - $site = isset($this->conf['project']) ? $this->conf['project'][0] : ''; - } - } - if ($interwiki) { - return $this->interwiki($site, $interwiki, - $matches[3] . (empty($matches[4]) ? '' : '#' . $matches[4]), - $text, $interlang, $colon); - } - if ($interlang) { - $matches[3] = $interlang . ':' . $matches[3]; - $text = (empty($matches[5]) ? $interlang . ':' : '') . $text; - } - // set the options - $options = array( - 'page' => $matches[3], - 'anchor' => (empty($matches[4]) ? '' : $matches[4]), - 'text' => $text - ); - - // create and return the replacement token - return $this->wiki->addToken($this->rule, $options); - } - - /** - * Generates an image token. Token options are: - * - 'src' => the name of the image file - * - 'attr' => an array of attributes for the image: - * | - 'alt' => the optional alternate image text - * | - 'align => 'left', 'center' or 'right' - * - * @access public - * @param array &$matches The array of matches from parse(). - * @return string token to be used as replacement - */ - function image($name, $text, $interlang, $colon) - { - $attr = array('alt' => ''); - // scan text for supplementary attibutes - if (strpos($text, '|') !== false) { - $splits = explode('|', $text); - $sep = ''; - foreach ($splits as $split) { - switch (strtolower($split)) { - case 'left': case 'center': case 'right': - $attr['align'] = strtolower($split); - break; - default: - $attr['alt'] .= $sep . $split; - $sep = '|'; - } - } - } else { - $attr['alt'] = $text; - } - $options = array( - 'src' => ($interlang ? $interlang . ':' : '') . $name, - 'attr' => $attr); - - // create and return the replacement token - return $this->wiki->addToken('Image', $options); - } - - /** - * Generates an interwiki token. Token options are: - * - 'page' => the name of the target wiki page - * - 'site' => the key for external site - * - 'url' => the full target url - * - 'text' => the optional alternate link text - * - * @access public - * @param array &$matches The array of matches from parse(). - * @return string token to be used as replacement - */ - function interwiki($site, $interwiki, $page, $text, $interlang, $colon) - { - if ($interlang) { - $interwiki = preg_replace('/\b' . $this->conf['langage'] . '\b/i', - $interlang, $interwiki); - } - // set the options - $options = array( - 'page' => $page, - 'site' => $site, - 'url' => sprintf($interwiki, $page), - 'text' => $text - ); - - // create and return the replacement token - return $this->wiki->addToken('Interwiki', $options); - } -} -?> diff --git a/vendor/Text/Wiki/Render/Latex/Url.php b/vendor/Text/Wiki/Render/Latex/Url.php index a22b0721d..c81f9e610 100644 --- a/vendor/Text/Wiki/Render/Latex/Url.php +++ b/vendor/Text/Wiki/Render/Latex/Url.php @@ -2,34 +2,40 @@ class Text_Wiki_Render_Latex_Url extends Text_Wiki_Render { - - + + var $conf = array( 'target' => false, 'images' => true, 'img_ext' => array('jpg', 'jpeg', 'gif', 'png') ); - + /** - * + * * 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) { // create local variables from the options array (text, // href, type) extract($options); - return $text . '\footnote{' . $href . '}'; + if ($options['type'] == 'start') { + return ''; + } else if ($options['type'] == 'end') { + return '\footnote{' . $href . '}'; + } else { + return $text . '\footnote{' . $href . '}'; + } } } ?> diff --git a/vendor/Text/Wiki/Render/Plain/Url.php b/vendor/Text/Wiki/Render/Plain/Url.php index 4326c7649..5c758e27c 100644 --- a/vendor/Text/Wiki/Render/Plain/Url.php +++ b/vendor/Text/Wiki/Render/Plain/Url.php @@ -2,24 +2,28 @@ class Text_Wiki_Render_Plain_Url 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']; + if ($options['type'] == 'start' || $options['type'] == 'end') { + return ''; + } else { + return $options['text']; + } } } ?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Render/Xhtml/Address.php b/vendor/Text/Wiki/Render/Xhtml/Address.php new file mode 100644 index 000000000..2f32dd964 --- /dev/null +++ b/vendor/Text/Wiki/Render/Xhtml/Address.php @@ -0,0 +1,54 @@ + + * + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * + * @version CVS: $Id: Address.php,v 1.1 2007/02/01 09:33:00 mic Exp $ + * + * @link http://pear.php.net/package/Text_Wiki + * + */ + +class Text_Wiki_Render_Xhtml_Address 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 ''; + } + } +} +?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Blockquote.php b/vendor/Text/Wiki/Render/Xhtml/Blockquote.php index 7d55926a5..eb1779470 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Blockquote.php +++ b/vendor/Text/Wiki/Render/Xhtml/Blockquote.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Blockquote.php,v 1.7 2005/07/30 08:03:28 toggg Exp $ + * @version CVS: $Id: Blockquote.php,v 1.9 2007/05/26 18:25:23 mic Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -55,6 +55,9 @@ class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render { // pick the css type $css = $this->formatConf(' class="%s"', 'css'); + if (isset($options['css'])) { + $css = ' class="' . $options['css']. '"'; + } // starting if ($type == 'start') { return "$pad"; diff --git a/vendor/Text/Wiki/Render/Xhtml/Bold.php b/vendor/Text/Wiki/Render/Xhtml/Bold.php index 10a8eacb5..30ffb029a 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Bold.php +++ b/vendor/Text/Wiki/Render/Xhtml/Bold.php @@ -46,11 +46,11 @@ class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render { { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); - return ""; + return ""; } if ($options['type'] == 'end') { - return ''; + return ''; } } } diff --git a/vendor/Text/Wiki/Render/Xhtml/Box.php b/vendor/Text/Wiki/Render/Xhtml/Box.php index 63e68aa4f..3870f85e4 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Box.php +++ b/vendor/Text/Wiki/Render/Xhtml/Box.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Box.php,v 1.2 2005/07/30 08:03:28 toggg Exp $ + * @version CVS: $Id: Box.php,v 1.3 2007/03/03 23:00:54 mic Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -26,7 +26,7 @@ class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render { var $conf = array( - 'css' => null + 'css' => 'simplebox' ); /** @@ -45,8 +45,13 @@ class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render { function token($options) { if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return "
      "; + if ($options['css']) { + $css = ' class="' . $options['css']. '"'; + } + else { + $css = $this->formatConf(' class="%s"', 'css'); + } + return "
      "; } if ($options['type'] == 'end') { diff --git a/vendor/Text/Wiki/Render/Xhtml/Center.php b/vendor/Text/Wiki/Render/Xhtml/Center.php index 990245bb4..d565882c5 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Center.php +++ b/vendor/Text/Wiki/Render/Xhtml/Center.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Center.php,v 1.7 2005/07/30 08:03:28 toggg Exp $ + * @version CVS: $Id: Center.php,v 1.8 2007/02/19 08:51:19 mic Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -25,6 +25,10 @@ */ class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render { + var $conf = array( + 'css' => null + ); + /** * * Renders a token into text matching the requested format. @@ -41,7 +45,13 @@ class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render { function token($options) { if ($options['type'] == 'start') { - return '
      '; + $css = $this->getConf('css'); + if ($css) { + return "
      "; + } + else { + return '
      '; + } } if ($options['type'] == 'end') { diff --git a/vendor/Text/Wiki/Render/Xhtml/Code.php b/vendor/Text/Wiki/Render/Xhtml/Code.php index b316be106..a0cb5f2e9 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Code.php +++ b/vendor/Text/Wiki/Render/Xhtml/Code.php @@ -59,38 +59,33 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { $css_filename = $this->formatConf(' class="%s"', 'css_filename'); if ($type == 'php') { - if (substr($options['text'], 0, 5) != '"; + $text = ""; // ... tags) - $h = new PHP_Highlight(true); - $h->loadString($text); - $text = $h->toHtml(true); - + ob_start(); + highlight_string($text); + $text = ob_get_contents(); + ob_end_clean(); + // replace
      tags with simple newlines. // replace non-breaking space with simple spaces. // translate HTML and color to XHTML and style. // courtesy of research by A. Kalin :-). - $map = array( - ' ' => ' ' - //'
      ' => "\n", - //"\n" => "
      ", - //' '' => '
      ', - //'color="' => 'style="color:' + '
      ' => "\n", + ' ' => ' ', + ' '' => '', + 'color="' => 'style="color:' ); - $text = strtr($text, $map); // get rid of the last newline inside the code block @@ -105,10 +100,7 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { } // done - /*$text = " - -
      $text -
      ";*/ + $text = "$text"; } elseif ($type == 'html' || $type == 'xhtml') { @@ -117,25 +109,17 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { // convert tabs to four spaces, // convert entities. $text = str_replace("\t", " ", $text); - //$text = "\n$text\n"; + $text = "\n$text\n"; $text = $this->textEncode($text); - $text = "$text"; + $text = "$text"; - } elseif ($type == 'sql') { - // HTML code example: - // add opening and closing tags, - // convert tabs to four spaces, - // convert entities. - $text = str_replace("\t", " ", $text); - $text = $this->textEncode($text); - $text = "
      $text
      "; } else { // generic code example: // convert tabs to four spaces, // convert entities. $text = str_replace("\t", " ", $text); $text = $this->textEncode($text); - $text = "$text"; + $text = "$text"; } if ($css_filename && isset($attr['filename'])) { diff --git a/vendor/Text/Wiki/Render/Xhtml/Image.php b/vendor/Text/Wiki/Render/Xhtml/Image.php index 4f26d9d1a..5f3ac8cf7 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Image.php +++ b/vendor/Text/Wiki/Render/Xhtml/Image.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Image.php,v 1.16 2006/02/10 23:07:03 toggg Exp $ + * @version CVS: $Id: Image.php,v 1.17 2007/03/15 15:04:50 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -82,15 +82,10 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render { unset($options['attr']['link']); // stephane@metacites.net -- 25/07/2004 - // we make up an align="center" value for the tag. - if (isset($options['attr']['align']) && - $options['attr']['align'] == 'center') { - - // unset so it won't show up as an attribute - unset($options['attr']['align']); - + // use CSS for all alignment + if (isset($options['attr']['align'])) { // make sure we have a style attribute - if (! isset($options['attr']['style'])) { + if (!isset($options['attr']['style'])) { // no style, set up a blank one $options['attr']['style'] = ''; } else { @@ -98,9 +93,18 @@ class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render { $options['attr']['style'] .= ' '; } - // add a "center" style to the existing style. - $options['attr']['style'] .= - 'display: block; margin-left: auto; margin-right: auto;'; + 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 diff --git a/vendor/Text/Wiki/Render/Xhtml/Interwiki.php b/vendor/Text/Wiki/Render/Xhtml/Interwiki.php index f26d0a618..ec1a58fcd 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Interwiki.php +++ b/vendor/Text/Wiki/Render/Xhtml/Interwiki.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Interwiki.php,v 1.14 2006/02/25 05:03:13 toggg Exp $ + * @version CVS: $Id: Interwiki.php,v 1.15 2007/03/15 00:08:47 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -86,7 +86,7 @@ class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render { $output = "formatConf(' class="%s"', 'css'); - return ""; + return ""; } if ($options['type'] == 'end') { - return ''; + return ''; } } } diff --git a/vendor/Text/Wiki/Render/Xhtml/Phplookup.php b/vendor/Text/Wiki/Render/Xhtml/Phplookup.php index 772ddedf6..23b377ba3 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Phplookup.php +++ b/vendor/Text/Wiki/Render/Xhtml/Phplookup.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Phplookup.php,v 1.11 2006/02/10 23:07:03 toggg Exp $ + * @version CVS: $Id: Phplookup.php,v 1.12 2007/03/15 00:08:47 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -54,7 +54,7 @@ class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render { // are we targeting another window? $target = $this->getConf('target', ''); - if ($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); diff --git a/vendor/Text/Wiki/Render/Xhtml/Preformatted.php b/vendor/Text/Wiki/Render/Xhtml/Preformatted.php index debd8ca02..ca12c37c4 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Preformatted.php +++ b/vendor/Text/Wiki/Render/Xhtml/Preformatted.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Preformatted.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ + * @version CVS: $Id: Preformatted.php,v 1.3 2007/02/07 13:40:44 mic Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -40,7 +40,8 @@ class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render { function token($options) { - return '
      '.$options['text'].'
      '; + $text = $this->textEncode($options['text']); + return '
      '.$text.'
      '; } } ?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Underline.php b/vendor/Text/Wiki/Render/Xhtml/Underline.php index 1d5f81283..eb83d1ce0 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Underline.php +++ b/vendor/Text/Wiki/Render/Xhtml/Underline.php @@ -46,11 +46,11 @@ class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render { { if ($options['type'] == 'start') { $css = $this->formatConf(' class="%s"', 'css'); - return ""; + return ""; } if ($options['type'] == 'end') { - return ''; + return ''; } } } diff --git a/vendor/Text/Wiki/Render/Xhtml/Url.php b/vendor/Text/Wiki/Render/Xhtml/Url.php index ff6f74fac..ccae3f2fa 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Url.php +++ b/vendor/Text/Wiki/Render/Xhtml/Url.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Url.php,v 1.13 2006/02/10 23:07:03 toggg Exp $ + * @version CVS: $Id: Url.php,v 1.18 2007/05/26 17:15:41 mic Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -73,46 +73,58 @@ class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render { // generate an image tag $css = $this->formatConf(' class="%s"', 'css_img'); - $output = ""; + $start = ""; } else { // should we build a target clause? if ($href{0} == '#' || - strtolower(substr($href, 0, 7)) == 'mailto:') { - // targets not allowed for on-page anchors - // and mailto: links. + strtolower(substr($href, 0, 7)) == 'mailto:') { + // targets not allowed for on-page anchors + // and mailto: links. $target = ''; } else { - // allow targets on non-anchor non-mailto links + // allow targets on non-anchor non-mailto links $target = $this->getConf('target'); } // generate a regular link (not an image) $text = $this->textEncode($text); $css = $this->formatConf(' class="%s"', "css_$type"); - $output = "textEncode($target); - $output .= " onclick=\"window.open(this.href, '$target');"; - $output .= " return false;\""; + $start .= " onclick=\"window.open(this.href, '$target');"; + $start .= " return false;\""; + } + + if (isset($name)) { + $start .= " id=\"$name\""; } - */ // finish up output - $output .= ">$text"; + $start .= ">"; + $end = ""; // make numbered references look like footnotes when no // CSS class specified, make them superscript by default if ($type == 'footnote' && ! $css) { - $output = '' . $output . ''; + $start = '' . $start; + $end = $end . ''; } } + if ($options['type'] == 'start') { + $output = $start; + } else if ($options['type'] == 'end') { + $output = $end; + } else { + $output = $start . $text . $end; + } return $output; } } diff --git a/vendor/Text/Wiki/Render/Xhtml/Wikilink.php b/vendor/Text/Wiki/Render/Xhtml/Wikilink.php index 994512ff5..ef3073b37 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Wikilink.php +++ b/vendor/Text/Wiki/Render/Xhtml/Wikilink.php @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wikilink.php,v 1.21 2006/07/28 14:52:52 justinpatrin Exp $ + * @version CVS: $Id: Wikilink.php,v 1.22 2006/12/08 21:25:24 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -102,7 +102,7 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render { } // get the CSS class and generate output - $css = sprintf(' class="%s"', $this->textEncode($this->getConf('css'))); + $css = ' class="'.$this->textEncode($this->getConf('css')).'"'; $start = ''; $end = ''; @@ -136,7 +136,7 @@ class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render { } // get the appropriate CSS class and new-link text - $css = sprintf(' class="%s"', $this->textEncode($this->getConf('css_new'))); + $css = ' class="'.$this->textEncode($this->getConf('css_new')).'"'; $new = $this->getConf('new_text'); // what kind of linking are we doing?