[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] svn: /phd/trunk/phpdotnet/phd/Package/PHP/ Factory.php TocFeed.php
From:       Moacir_de_Oliveira_Miranda_JĂșnior <moacir () php ! net>
Date:       2009-11-27 3:37:46
Message-ID: svn-moacir-1259293066-291343-1474613767 () svn ! php ! net
[Download RAW message or body]

moacir                                   Fri, 27 Nov 2009 03:37:46 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291343

Log:
Adding the TocFeed format in the PHP package

Changed paths:
    U   phd/trunk/phpdotnet/phd/Package/PHP/Factory.php
    A   phd/trunk/phpdotnet/phd/Package/PHP/TocFeed.php

Modified: phd/trunk/phpdotnet/phd/Package/PHP/Factory.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/PHP/Factory.php	2009-11-27 03:27:58 UTC (rev 291342)
+++ phd/trunk/phpdotnet/phd/Package/PHP/Factory.php	2009-11-27 03:37:46 UTC (rev 291343)
@@ -13,6 +13,7 @@
         'bigpdf'        => 'Package_PHP_BigPDF',
         'kdevelop'      => 'Package_PHP_KDevelop',
         'chm'           => 'Package_PHP_CHM',
+        'tocfeed'       => 'Package_PHP_TocFeed',
     );

     public function __construct() {

Added: phd/trunk/phpdotnet/phd/Package/PHP/TocFeed.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/PHP/TocFeed.php	                        (rev 0)
+++ phd/trunk/phpdotnet/phd/Package/PHP/TocFeed.php	2009-11-27 03:37:46 UTC (rev 291343)
@@ -0,0 +1,148 @@
+<?php
+namespace phpdotnet\phd;
+/* $Id$ */
+
+/**
+ * Generates Atom feed of Table of Contents for
+ * each chunk.
+ *
+ * @category PhD
+ * @package  PhD_PHP
+ * @author   Christian Weiske <cweiske@php.net>
+ * @author   Moacir de Oliveira <moacir@php.net>
+ * @license  http://www.opensource.org/licenses/bsd-license.php BSD Style
+ * @link     http://doc.php.net/phd/
+ */
+class Package_PHP_TocFeed extends Package_Generic_TocFeed
+{
+    /**
+     * Mapping of docbook tags to class methods.
+     * php.net especific chunks.
+     *
+     * @var array
+     */
+    private $myelementmap = array(
+        'phpdoc:classref'       => 'format_chunk',
+        'phpdoc:exceptionref'   => 'format_chunk',
+        'phpdoc:varentry'       => 'format_chunk',
+        'section'               => array(
+            /* DEFAULT */          false,
+            'sect1'                => 'format_chunk',
+            'chapter'              => 'format_chunk',
+            'appendix'             => 'format_chunk',
+            'article'              => 'format_chunk',
+            'part'                 => 'format_chunk',
+            'reference'            => 'format_chunk',
+            'refentry'             => 'format_chunk',
+            'index'                => 'format_chunk',
+            'bibliography'         => 'format_chunk',
+            'glossary'             => 'format_chunk',
+            'colopone'             => 'format_chunk',
+            'book'                 => 'format_chunk',
+            'set'                  => 'format_chunk',
+            'setindex'             => 'format_chunk',
+            'legalnotice'          => 'format_chunk',
+        ),
+    );
+
+    /**
+     * Name of TOC feed format used by PhD internally.
+     *
+     * Inheriting classes should change this.
+     *
+     * @var string
+     */
+    protected $formatName = 'PHP-TocFeed';
+
+    /**
+     * File extension with leading dot for
+     * links from atom feed to chunks.
+     *
+     * Inheriting classes should change this if neccessary.
+     *
+     * @var    string
+     * @usedby createTargetLink()
+     */
+    protected $targetExt = '.php';
+
+    /**
+     * Base URI for links from atom feed to chunks.
+     *
+     * Inheriting classes should change this if neccessary.
+     *
+     * @var    string
+     * @usedby createTargetLink()
+     */
+    protected $targetBaseUri = 'http://php.net/manual/{language}/';
+
+    /**
+     * Base URI for the feed files themselves.
+     *
+     * Inheriting classes should change this if neccessary.
+     * If this variable is not set, __construct() sets
+     * it to $targetBaseUri
+     *
+     * @var    string
+     * @usedby createLink()
+     */
+    protected $feedBaseUri = 'http://php.net/manual/{language}/feeds/';
+
+    /**
+     * Author string used in atom feed files.
+     *
+     * Inheriting classes should change this.
+     *
+     * @var    string
+     * @usedby header()
+     */
+    protected $author = 'PHP Documentation Group';
+
+    /**
+     * Prefix for atom entry id values.
+     *
+     * @internal
+     * We are using tag URIs here.
+     * @link http://www.faqs.org/rfcs/rfc4151.html
+     * @link http://diveintomark.org/archives/2004/05/28/howto-atom-id
+     *
+     * And no, this date should never be changed.
+     *
+     * @var string
+     */
+    protected $idprefix = 'tag:php.net,2009-10-13:/manual/{language}/';
+
+    /**
+     * Overriding the update() method to extend the parent element map.
+     * Only the Render::STANDALONE event is overrided.
+     */
+    public function update($event, $val = null) {
+        switch($event) {
+        case Render::STANDALONE:
+            if ($val) {
+                $this->registerElementMap(array_merge(
+                    parent::getDefaultElementMap(),
+                    $this->myelementmap));
+            }
+            break;
+        default:
+            parent::update($event, $val);
+        }
+    }
+
+    /**
+     * Create new instance.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+
+        $language = Config::language();
+        $variables = array('targetBaseUri', 'feedBaseUri', 'idprefix');
+        foreach ($variables as $varname) {
+            $this->$varname = str_replace(
+                '{language}', $language, $this->$varname
+            );
+        }
+    }
+
+}


Property changes on: phd/trunk/phpdotnet/phd/Package/PHP/TocFeed.php
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native



-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic