/**
  * Constructor.
  *
  * @param   object  &$subject  The object to observe.
  * @param   array   $config    An optional associative array of configuration settings.
  *
  * @since   1.5
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Log the deprecated API.
     if ($this->params->get('log-deprecated')) {
         JLog::addLogger(array('text_file' => 'deprecated.php'), JLog::ALL, array('deprecated'));
     }
     // Log everything (except deprecated APIs, these are logged separately with the option above).
     if ($this->params->get('log-everything')) {
         JLog::addLogger(array('text_file' => 'everything.php'), JLog::ALL, array('deprecated', 'databasequery'), true);
     }
     // Get the application if not done by JPlugin. This may happen during upgrades from Joomla 2.5.
     if (!$this->app) {
         $this->app = JFactory::getApplication();
     }
     $this->debugLang = $this->app->get('debug_lang');
     // Skip the plugin if debug is off
     if ($this->debugLang == '0' && $this->app->get('debug') == '0') {
         return;
     }
     // Only if debugging or language debug is enabled.
     if (JDEBUG || $this->debugLang) {
         JFactory::getConfig()->set('gzip', 0);
         ob_start();
         ob_implicit_flush(false);
     }
     $this->linkFormat = ini_get('xdebug.file_link_format');
     if ($this->params->get('logs', 1)) {
         $priority = 0;
         foreach ($this->params->get('log_priorities', array()) as $p) {
             $const = 'JLog::' . strtoupper($p);
             if (!defined($const)) {
                 continue;
             }
             $priority |= constant($const);
         }
         // Split into an array at any character other than alphabet, numbers, _, ., or -
         $categories = array_filter(preg_split('/[^A-Z0-9_\\.-]/i', $this->params->get('log_categories', '')));
         $mode = $this->params->get('log_category_mode', 0);
         JLog::addLogger(array('logger' => 'callback', 'callback' => array($this, 'logger')), $priority, $categories, $mode);
     }
     // Prepare disconnect handler for SQL profiling.
     $db = JFactory::getDbo();
     $db->addDisconnectHandler(array($this, 'mysqlDisconnectHandler'));
     // Log deprecated class aliases
     foreach (JLoader::getDeprecatedAliases() as $deprecation) {
         JLog::add(sprintf('%1$s has been aliased to %2$s and the former class name is deprecated. The alias will be removed in %3$s.', $deprecation['old'], $deprecation['new'], $deprecation['version']), JLog::WARNING, 'deprecated');
     }
 }