svn: /web/doc-editor/trunk/ error_type.php php/ToolsError.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Tue, 02 Aug 2011 18:21:32 +0000

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

Log:
Add a new error check to trow an error if the default's sgml dtd file isn't "~/.phpdoc/manual.ced"

Changed paths:
    U   web/doc-editor/trunk/error_type.php
    U   web/doc-editor/trunk/php/ToolsError.php

Modified: web/doc-editor/trunk/error_type.php
===================================================================
--- web/doc-editor/trunk/error_type.php	2011-08-02 18:12:51 UTC (rev 314121)
+++ web/doc-editor/trunk/error_type.php	2011-08-02 18:21:32 UTC (rev 314122)
@@ -269,6 +269,9 @@
 $error['documentNotUTF8']['head'] = 'Document encoding is not UTF-8';
 $error['documentNotUTF8']['desc'] = 'We recommand to set your document in UTF-8 encoding.';

+$error['SgmlDefaultDTDFile']['head'] = 'Wrong Sgml default dtd file';
+$error['SgmlDefaultDTDFile']['desc'] = 'You must set is like this : <br><br><b>sgml-default-dtd-file:"~/.phpdoc/manual.ced"</b>';
+
 $to_display = array();

 // If $error_to_display is an empty array, we add it all errors (default page)

Modified: web/doc-editor/trunk/php/ToolsError.php
===================================================================
--- web/doc-editor/trunk/php/ToolsError.php	2011-08-02 18:12:51 UTC (rev 314121)
+++ web/doc-editor/trunk/php/ToolsError.php	2011-08-02 18:21:32 UTC (rev 314122)
@@ -361,6 +361,7 @@
             $this->spaceOrPeriodRefpurposeTag($this->lang);
             $this->tabCharacterInDocument($this->lang);
             $this->documentNotUTF8($this->lang);
+            $this->SgmlDefaultDTDFile($this->lang);
         }

         // Check Error specific to LANG files
@@ -388,11 +389,39 @@
             $this->spaceOrPeriodRefpurposeTag($this->lang);
             $this->tabCharacterInDocument($this->lang);
             $this->documentNotUTF8($this->lang);
+            $this->SgmlDefaultDTDFile($this->lang);
         }

     }

     /**
+     * Check SgmlDefaultDTDFile
+     * Add an entry into the error's stack if the default's sgml dtd file isn't "~/.phpdoc/manual.ced"
+     *
+     */
+    function SgmlDefaultDTDFile($lang)
+    {
+        if( $lang == 'en' ) {
+            $content = $this->en_content;
+        } else {
+            $content = $this->lang_content;
+        }
+
+        $matches = array();
+        preg_match_all('@sgml-default-dtd-file:"(.*)"@', $content, $matches);
+
+        if ( !empty($matches) && $matches[1][0] != '~/.phpdoc/manual.ced')
+        {
+            $this->addError(array(
+                'value_en'   => 'N/A',
+                'value_lang' => 'N/A',
+                'type'       => 'SgmlDefaultDTDFile'
+            ));
+        }
+    }
+
+
+    /**
      * Check all acronyms
      * Add an entry into the error's stack if an acronym is found without <acronym> tag
      *
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.