Browse Source

Add PHP5-style constructor

pdontthink 8 năm trước cách đây
mục cha
commit
4acb55491d
1 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 11 2
      class/mime/ContentType.class.php

+ 11 - 2
class/mime/ContentType.class.php

@@ -41,11 +41,11 @@ class ContentType {
     var $properties = '';
 
     /**
-     * Constructor function.
+     * Constructor (PHP5 style, required in some future version of PHP)
      * Prepared type0 and type1 properties
      * @param string $type content type string without auxiliary information
      */
-    function ContentType($type) {
+    function __construct($type) {
         $type = strtolower($type);
         $pos = strpos($type, '/');
         if ($pos > 0) {
@@ -56,4 +56,13 @@ class ContentType {
         }
         $this->properties = array();
     }
+
+    /**
+     * Constructor (PHP4 style, kept for compatibility reasons)
+     * Prepared type0 and type1 properties
+     * @param string $type content type string without auxiliary information
+     */
+    function ContentType($type) {
+       self::__construct($name);
+    }
 }