/** * {@inheritDoc} */ public function log(BWP_Sitemaps_Logger_LogItem $item) { if (!$item instanceof BWP_Sitemaps_Logger_Message_LogItem) { throw new InvalidArgumentException(sprintf('expect an item of type BWP_Sitemaps_Logger_Message_LogItem, "%s" provded.', get_class($item))); } parent::log($item); }
/** * Inits sitemap log property * * @since 1.3.0 * @access private */ private function _init_logs() { $this->message_logger = BWP_Sitemaps_Logger::create_message_logger(25); $this->sitemap_logger = BWP_Sitemaps_Logger::create_sitemap_logger(); // populate logger with logs currently stored in db $logs = $this->bridge->get_option(BWP_GXS_LOG); $logs = $logs && is_array($logs) ? $logs : $this->_get_initial_logs(); foreach ($logs as $key => $log) { // invalid log if (!is_array($log)) { continue; } foreach ($log as $log_item) { // invalid log item if (!is_array($log_item)) { continue; } if ($key == 'sitemaps') { try { $this->_log_sitemap_item($log_item['slug'], $log_item['datetime']); } catch (Exception $e) { continue; } } elseif ($key == 'messages') { try { $this->_log_message_item($log_item['message'], $log_item['type'], $log_item['datetime']); } catch (Exception $e) { continue; } } } } }