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, 23 Mar 2010 12:17:10 +0000

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

Log:
Add a new check for ToolsError : tabCharacterInDocument. Available for EN & LANG documentation.

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	2010-03-23 12:02:58 UTC (rev 296667)
+++ web/doc-editor/trunk/error_type.php	2010-03-23 12:17:10 UTC (rev 296668)
@@ -259,6 +259,9 @@
 $error['acronym']['head'] = 'Missing acronym tag';
 $error['acronym']['desc'] = 'An acronym have been found but without <acronym> tag around him.';

+$error['tabCharacterInDocument']['head'] = 'Tab character in the document';
+$error['tabCharacterInDocument']['desc'] = 'A tab character have been found in the document We must change it to spaces.';
+
 $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	2010-03-23 12:02:58 UTC (rev 296667)
+++ web/doc-editor/trunk/php/ToolsError.php	2010-03-23 12:17:10 UTC (rev 296668)
@@ -325,6 +325,7 @@
         {
             $this->checkAcronym();
             $this->spaceOrPeriodRefpurposeTag($this->lang);
+            $this->tabCharacterInDocument($this->lang);
         }

         // Check Error specific to LANG files
@@ -350,6 +351,7 @@
             $this->nbMemberInSeeAlso();
             $this->nbTag();
             $this->spaceOrPeriodRefpurposeTag($this->lang);
+            $this->tabCharacterInDocument($this->lang);
         }

     }
@@ -1093,7 +1095,6 @@
             }
         }
     }
-
     /**
      * Check Space or period at the end of Refpurpose tag
      * Add an entry into the error's stack if an error is found
@@ -1126,6 +1127,30 @@
     }

     /**
+     * Check for tabs into the document
+     * Add an entry into the error's stack if a tab is found in the document
+     *
+     */
+    function tabCharacterInDocument($lang)
+    {
+
+        if( $lang == 'en' ) {
+            $content = $this->en_content;
+        } else {
+            $content = $this->lang_content;
+        }
+
+        if ( strstr($content, "\t")) {
+
+            $this->addError(array(
+                'value_en'   => 'N/A',
+                'value_lang' => 'N/A',
+                'type'       => 'tabCharacterInDocument'
+            ));
+        }
+    }
+
+    /**
      * Check Nb <![CDATA tag
      * Add an entry into the error's stack if an error is found
      *
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.