Exemplo n.º 1
0
 /**
  * Provides a backtrace for deprecated methods and functions, will be in the error section of debug
  * This takes the place of icms_deprecated()
  *
  * @param string $replacement Method or function to be used instead of the deprecated method or function
  * @param string $extra Additional information to provide about the change
  */
 public static function setDeprecated($replacement = '', $extra = '')
 {
     if (defined("ICMS_TRACK_DEPRECATED") and !ICMS_TRACK_DEPRECATED) {
         //error_log("icms_core_Debug::setDeprecated('$replacement', '$extra');");
         return;
         // if we're not actively upgrading deprecated functions, no need to spend time tracking them
     }
     icms_loadLanguageFile('core', 'core');
     $trace = debug_backtrace();
     array_shift($trace);
     $level = $msg = $message = '';
     $pre = '<strong><em>(' . _CORE_DEPRECATED . ')</em></strong> - ';
     if ($trace[0]['function'] != 'include' && $trace[0]['function'] != 'include_once' && $trace[0]['function'] != 'require' && $trace[0]['function'] != 'require_once') {
         $pre .= $trace[0]['function'] . ': ';
     }
     foreach ($trace as $step) {
         $level .= '-';
         if (isset($step['file'])) {
             $message .= $level . $msg . (isset($step['class']) ? $step['class'] : '') . (isset($step['type']) ? $step['type'] : '') . sprintf(_CORE_DEPRECATED_MSG, $step['function'], str_replace(array(ICMS_TRUST_PATH, ICMS_ROOT_PATH), array("TRUSTPATH", "ROOTPATH"), $step['file']), $step['line']);
         }
         $msg = _CORE_DEPRECATED_CALLEDBY;
     }
     $logger = icms_core_Logger::instance();
     $logger->addDeprecated($pre . ($replacement ? ' <strong><em>' . sprintf(_CORE_DEPRECATED_REPLACEMENT, $replacement) . '</em></strong>.' : '') . ($extra ? ' <strong><em>' . $extra . '</em></strong>' : '') . _CORE_DEPRECATED_CALLSTACK . $message);
 }
Exemplo n.º 2
0
 /**
  * Provides a backtrace for deprecated methods and functions, will be in the error section of debug
  * This takes the place of icms_deprecated()
  *
  * @param string $replacement Method or function to be used instead of the deprecated method or function
  * @param string $extra Additional information to provide about the change
  */
 public static function setDeprecated($replacement = '', $extra = '')
 {
     icms_loadLanguageFile('core', 'core');
     $trace = debug_backtrace();
     array_shift($trace);
     $level = $msg = $message = '';
     $pre = '<strong><em>(' . _CORE_DEPRECATED . ')</em></strong> - ';
     if ($trace[0]['function'] != 'include' && $trace[0]['function'] != 'include_once' && $trace[0]['function'] != 'require' && $trace[0]['function'] != 'require_once') {
         $pre .= $trace[0]['function'] . ': ';
     }
     foreach ($trace as $step) {
         $level .= '-';
         if (isset($step['file'])) {
             $message .= $level . $msg . (isset($step['class']) ? $step['class'] : '') . (isset($step['type']) ? $step['type'] : '') . sprintf(_CORE_DEPRECATED_MSG, $step['function'], str_replace(array(ICMS_TRUST_PATH, ICMS_ROOT_PATH), array("TRUSTPATH", "ROOTPATH"), $step['file']), $step['line']);
         }
         $msg = _CORE_DEPRECATED_CALLEDBY;
     }
     $logger = icms_core_Logger::instance();
     $logger->addDeprecated($pre . ($replacement ? ' <strong><em>' . sprintf(_CORE_DEPRECATED_REPLACEMENT, $replacement) . '</em></strong>.' : '') . ($extra ? ' <strong><em>' . $extra . '</em></strong>' : '') . _CORE_DEPRECATED_CALLSTACK . $message);
 }
Exemplo n.º 3
0
 /**
  * Get a reference to the only instance of database class and connects to DB
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * @static
  * @staticvar   object  The only instance of database class
  * @return      object  Reference to the only instance of database class
  */
 public static function &instance()
 {
     static $instance;
     if (!isset($instance)) {
         if (defined('XOOPS_DB_ALTERNATIVE') && class_exists(XOOPS_DB_ALTERNATIVE)) {
             $class = XOOPS_DB_ALTERNATIVE;
         } elseif (!defined('XOOPS_DB_PROXY')) {
             $class = 'icms_db_legacy_' . XOOPS_DB_TYPE . '_Safe';
         } else {
             $class = 'icms_db_legacy_' . XOOPS_DB_TYPE . '_Proxy';
         }
         $instance = new $class();
         $instance->setLogger(icms_core_Logger::instance());
         $instance->setPrefix(XOOPS_DB_PREFIX);
         if (!$instance->connect()) {
             icms_loadLanguageFile('core', 'core');
             trigger_error(_CORE_DB_NOTRACEDB, E_USER_ERROR);
         }
     }
     return $instance;
 }
Exemplo n.º 4
0
 function db_manager()
 {
     $this->db = icms_db_legacy_Factory::getDatabase();
     $this->db->setPrefix(XOOPS_DB_PREFIX);
     $this->db->setLogger(icms_core_Logger::instance());
 }
Exemplo n.º 5
0
 public function __construct()
 {
     parent::instance();
     $this->_deprecated = icms_core_Debug::setDeprecated('icms_core_Logger', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }