Jeremy Newman : use class autoloading, add some error handling functions

Jeremy Newman jnewman at winehq.org
Thu Apr 12 14:53:42 CDT 2012


Module: website
Branch: master
Commit: 5d3f0d0ecdf591b011423b099f4a5627140c3111
URL:    http://source.winehq.org/git/website.git/?a=commit;h=5d3f0d0ecdf591b011423b099f4a5627140c3111

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Thu Apr 12 14:24:45 2012 -0500

use class autoloading, add some error handling functions

---

 include/incl.php |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/include/incl.php b/include/incl.php
index d6f334e..457b684 100644
--- a/include/incl.php
+++ b/include/incl.php
@@ -10,23 +10,32 @@
  * Main Include Library
  */
 
-// load config class
-require("{$file_root}/include/config.php");
-
-// create config object
-$config = new config($file_root."/include/"."winehq.conf", $file_root."/include/"."globals.conf");
+// Require PHP version 5.3 or higher
+if (version_compare(phpversion(), '5.3.0') < 0)
+{
+    trigger_error("PHP 5.3 or Higher Required!", E_USER_ERROR);
+}
 
 // load global functions lib
 require_once("{$file_root}/include/utils.php");
 
+// Set Up the Class AutoLoader
+spl_autoload_register("check_and_require");
+
+// create config object
+$config = new config("{$file_root}/include/winehq.conf", "{$file_root}/include/globals.conf");
+
 // load data lib
-check_and_require("data");
 $data = new data();
 
-// load html lib
-check_and_require("html");
-
 // create html object
 $html = new html($file_root);
 
+// setup html error handler when not at CLI
+if (!defined('STDIN'))
+{
+    set_error_handler(array(&$html, 'error_handler'));
+    register_shutdown_function(array(&$html, 'error_shutdown'));
+}
+
 ?>




More information about the wine-cvs mailing list