Apache Zeta Components Manual :: File Source for bugzilla.php

Source for file bugzilla.php

Documentation is available at bugzilla.php

  1. <?php
  2. /**
  3.  *
  4.  * Licensed to the Apache Software Foundation (ASF) under one
  5.  * or more contributor license agreements.  See the NOTICE file
  6.  * distributed with this work for additional information
  7.  * regarding copyright ownership.  The ASF licenses this file
  8.  * to you under the Apache License, Version 2.0 (the
  9.  * "License"); you may not use this file except in compliance
  10.  * with the License.  You may obtain a copy of the License at
  11.  * 
  12.  *   http://www.apache.org/licenses/LICENSE-2.0
  13.  * 
  14.  * Unless required by applicable law or agreed to in writing,
  15.  * software distributed under the License is distributed on an
  16.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17.  * KIND, either express or implied.  See the License for the
  18.  * specific language governing permissions and limitations
  19.  * under the License.
  20.  *
  21.  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  22.  * @version //autogentag//
  23.  * @filesource
  24.  * @package MvcTools
  25.  */
  26.  
  27. /**
  28.  * Request filter that ...
  29.  *
  30.  * @package MvcTools
  31.  * @version //autogentag//
  32.  * @mainclass
  33.  */
  34. class ezcMvcMailBugzillaRequestFilter implements ezcMvcRequestFilter
  35. {
  36.     /**
  37.      * This function
  38.      *
  39.      * @param ezcMvcRequest $request 
  40.      */
  41.     public function filterRequestezcMvcRequest $request )
  42.     {
  43.         // set the short_desc from the subject variable and init description
  44.         $request->variables['short_desc'$request->variables['subject'];
  45.         $request->variables['description''';
  46.  
  47.         $lastTag '';
  48.         $inHeader true;
  49.         $lines explode"\n"$request->body );
  50.         foreach $lines as $line )
  51.         {
  52.             $line trim$line );
  53.             // check if we have a tag
  54.             if $inHeader && preg_match'/^@([a-z_]+)\s*=\s*(.*)$/'$line$matches ) )
  55.             {
  56.                 if in_array$matches[1]array'product''component',
  57.                     'version''short_desc''rep_platform',
  58.                     'bug_severity''priority''op_sys',
  59.                     'assigned_to''bug_file_loc',
  60.                     'status_whiteboard''target_milestone',
  61.                     'group_set''qa_contact' ) ) )
  62.                 {
  63.                     $lastTag $matches[1];
  64.                     $request->variables[$lastTag$matches[2];
  65.                 }
  66.             }
  67.             else if $inHeader && !empty$line ) )
  68.             {
  69.                 $request->variables[$lastTag.= ' ' $line;
  70.             }
  71.             else if $inHeader && empty$line ) )
  72.             {
  73.                 $inHeader false;
  74.             }
  75.             else
  76.             {
  77.                 if !empty$line ) )
  78.                 {
  79.                     $request->variables['description'.= ' ' $line;
  80.                 }
  81.             }
  82.         }
  83.         $request->variables['description'trim$request->variables['description');
  84.     }
  85.  
  86.     /**
  87.      * Should not be called with any options, as this filter doesn't support any.
  88.      *
  89.      * @throws ezcMvcFilterHasNoOptionsException if the $options array is not
  90.      *  empty.
  91.      * @param array $options 
  92.      */
  93.     public function setOptionsarray $options )
  94.     {
  95.         if count$options ) )
  96.         {
  97.             throw new ezcMvcFilterHasNoOptionsException__CLASS__ );
  98.         }
  99.     }
  100. }
  101. ?>
Documentation generated by phpDocumentor 1.4.3