So I have started a PHP framework called ExCx and I haven't really had much experience in the professional development business.I was just wondering if my structure/layout/methods are up to scratch?EDIT: Forget the URL, added that.Normally I remember to omit the closing php tag...In tandem with this I am building a PHP Blocks type thing, It's still early days for both projects.<?php    /****    *    *   ecCore Provides low-level debugging, error and exception functionality    *   Matthew Day (CFHC Web Development 2011)    *    @package: ExCx    *   @version: 1.0    *    ****/  class ecCore  {    //The following constants allow for pretty call backs to static methods    const backtrace                                 = 'ecCore::backtrace';    const call                                      = 'ecCore::call';    const callback                                  = 'ecCore::callback';    const checkOS                                   = 'ecCore::checkOS';    const checkVersion                              = 'ecCore::checkVersion';    const configureSMTP                             = 'ecCore::configureSMTP';    const debug                                     = 'ecCore::debug';    const detectOpcodeCache                         = 'ecCore::detectOpcodeCache';    const disableContext                            = 'ecCore::disableContext';    const dump                                      = 'ecCore::dump';    const enableDebugging                           = 'ecCore::enableDebugging';    const enableDynamicConstants                    = 'ecCore::enableDynamicConstants';    const enableErrorHandling                       = 'ecCore::enableErrorHandling';    const enableExceptionHandling                   = 'ecCore::enableExceptionHandling';    const expose                                    = 'ecCore::expose';    const getDebug                                  = 'ecCore::getDebug';    const handleError                               = 'ecCore::handleError';    const handleException                           = 'ecCore::handleException';    const registerDebugCallback                     = 'ecCore::registerDebugCallback';    const reset                                     = 'ecCore::reset';    const sendMessagesOnShutdown                    = 'ecCore::sendMessagesOnShutdown';    const startErrorCapture                         = 'ecCore::startErrorCapture';    const stopErrorCapture                          = 'ecCore::stopErrorCapture';    static private $captured_error_level = 0;    static private $captured_error_regex = array();    static private $captured_error_types = array();    static private $captured_errors = array();    static private $captured_errors_previous_handler = array();    static private $context_shown = FALSE;    static private $debug = NULL;    static private $debug_callback = NULL;    static private $dynamic_constants = FALSE;    static private $error_destination = 'html';    static private $error_message_queue = array();    static private $exception_destination = 'html';    static private $exception_handler_callback = NULL;    static private $exception_handler_parameters = array();    static private $exception_message = NULL;    static private $handles_errors = FALSE;    static private $handles_exceptions = FALSE;    static private $show_context = TRUE    static private $smtp_connection = NULL;    static private $smtp_from_email = NULL;    //Creates a nicely formatted backtrace to where the method is initally called    static public function backtrace($remove_lines=0, $backtrace=NULL)    {      if ($remove_lines !== NULL && !is_numeric($remove_lines))      {        $remove_lines = 0;      }      settype($remove_lines, 'integer');      $doc_root = realpath($_SERVER['DOCUMENT_ROOT']);      $doc_root .= (substr($doc_root, -1) != DIRECTORY_SEPERATOR) ? DIRECTORY_SEPERATOR : '';      if ($backtrace === NULL)      {        $backtrace = debug_backtrace();      }      while ($remove_lines > 0)      {        array_shift($backtrace);        $remove_lines--;      }      $backtrace = array_reverse($backtrace);      $bt_string = '';      $i = 0;      foreach ($backtrace as $call)      {        if ($i)        {          $bt_string .= \n;        }         if (isset($call['file']))         {            $bt_string .= str_replace($doc_root, '{doc_root}' . DIRECTORY_SEPARATOR, $call['file']) . '(' . $call['line'] . '): ';         } else         {            $bt_string .= '[internal function]: ';         }         if (isset($call['class']))          {            $bt_string .= $call['class'] . $call['type'];         }        if (isset($call['class']) || isset($call['function']))         {          $bt_string .= $call['function'] . '(';           $j = 0;          if (!isset($call['args']))           {            $call['args'] = array();          }          foreach ($call['args'] as $arg)          {            if ($j)            {                $bt_string .= ', ';            }            if (is_bool($arg))            {                $bt_string .= ($arg) ? 'true' : 'false';            } elseif (is_null($arg))             {                $bt_string .= 'NULL';            } elseif (is_array($arg))            {               $bt_string .= 'Array';            } elseif (is_object($arg))            {                $bt_string .= 'Object(' . get_class($arg) . ')';            } elseif (is_string($arg))             {                // Shorten the UTF-8 string if it is too long                if (strlen(utf8_decode($arg)) > 18)                {                    // If we can't match as unicode, try single byte                    if (!preg_match('#^(.{0,15})#us', $arg, $short_arg))                    {                        preg_match('#^(.{0,15})#s', $arg, $short_arg);                    }                    $arg  = $short_arg[0] . '...';                }                $bt_string .= ' . $arg . ';            } else             {                $bt_string .= (string) $arg;            }        }            $bt_string .= ')';        }        $i++;       }             return $bt_string;    }  // end of the backtrace function    /****    *    * Performs a [http://php.net/call_user_func call_user_func()], while translating PHP 5.2 static callback syntax for PHP 5.1 and 5.0    *    ****/    static public function call($callback, $parameters=array())    {        //Fix PHP 5.0 and 5.1 static callback syntax        if (is_string($callback) && strpos($callback, '::') !== FALSE)        {            $callback = explode('::', $callback);        }        $parameters = array_slice(func_get_args(), 1);        if (sizeof($parameters) == 1 && is_array($parameters[0]))        {            $parameters = $parameters[0];        }        return call_user_func_array($callback, $parameters);    }    /****    *    * Translates a Class::method style static method callback to array style for compatibility with PHP 5.0 and 5.1 and built-in PHP functions    *    ****/    /****    *    *   Checks an error/exception destination to make sure it is valid    *    ****/    static private function checkDestination($destination)        {            if ($destination == 'html') {                return 'html';            }            if (preg_match('~^(?:                                                                         # Allow leading whitespace                               (?:[^\x00-\x20\(\)<>@,;:\\\\\.\[\]]+|[^\\\\\n\r]+)                     # An atom or a quoted string                               (?:\.[ \t]*(?:[^\x00-\x20\(\)<>@,;:\\\\\.\[\]]+|[^\\\\\n\r]+[ \t]*))*  # A . plus another atom or a quoted string, any number of times                              )@(?:                                                                       # The @ symbol                               (?:[a-z0-9\\-]+\.)+[a-z]{2,}|                                              # Domain name                               (?:(?:[01]?\d?\d|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d?\d|2[0-4]\d|25[0-5])    # (or) IP addresses                              )                              (?:\s*,\s*                                                                  # Any number of other emails separated by a comma with surrounding spaces                               (?:                                (?:[^\x00-\x20\(\)<>@,;:\\\\\.\[\]]+|[^\\\\\n\r]+)                                (?:\.[ \t]*(?:[^\x00-\x20\(\)<>@,;:\\\\\.\[\]]+|[^\\\\\n\r]+[ \t]*))*                               )@(?:                                (?:[a-z0-9\\-]+\.)+[a-z]{2,}|                                (?:(?:[01]?\d?\d|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d?\d|2[0-4]\d|25[0-5])                               )                              )*$~xiD', $destination)) {                return 'email';            }            $path_info     = pathinfo($destination);            $dir_exists    = file_exists($path_info['dirname']);            $dir_writable  = ($dir_exists) ? is_writable($path_info['dirname']) : FALSE;            $file_exists   = file_exists($destination);            $file_writable = ($file_exists) ? is_writable($destination) : FALSE;            if (!$dir_exists || ($dir_exists && ((!$file_exists && !$dir_writable) || ($file_exists && !$file_writable)))) {                return FALSE;            }            return 'file';        }  } // End of class?>
Open source PHP framework
php