wp-discourse/lib/discourse-base.php
Angus McLeod 22ee91dfb5
Two Five Seven (#541)
* Don't try to add url to <head> if it's not present

* Update js config and formatting for comment block and sidebar

* PHP Linting

* FIX: Don't auto-publish updates to existing posts.

See: https://meta.discourse.org/t/disable-posting-wordpress-articles-to-discourse-when-theyre-updated/204488

* Bump version and release notes.

* Fix remote-post.php linting

* Update tests.yml to install svn

* Re-generate comments js build
2025-04-15 16:53:23 -07:00

64 lines
1.1 KiB
PHP
Vendored

<?php
/**
* Base WPDiscourse Class
*
* @package WPDiscourse
*/
namespace WPDiscourse;
use WPDiscourse\Shared\PluginUtilities;
use WPDiscourse\Logs\Logger;
/**
* Class DiscourseComment
*/
class DiscourseBase {
use PluginUtilities;
/**
* Gives access to the plugin options.
*
* @access protected
* @var mixed|void
*/
protected $options;
/**
* Instance of Logger
*
* @access protected
* @var \WPDiscourse\Logs\Logger
*/
protected $logger;
/**
* Logger context
*
* @access protected
* @var string
*/
protected $logger_context = 'base';
/**
* Setup options.
*
* @param object $extra_options Extra options used for testing.
*/
public function setup_options( $extra_options = null ) {
$this->options = $this->get_options();
if ( ! empty( $extra_options ) ) {
foreach ( $extra_options as $key => $value ) {
$this->options[ $key ] = $value;
}
}
}
/**
* Setup Logger for the context.
*/
public function setup_logger() {
$this->logger = Logger::create( $this->logger_context, $this->options );
}
}