-
Notifications
You must be signed in to change notification settings - Fork 2
/
wp-discourse-shortcodes.php
67 lines (58 loc) · 2.61 KB
/
wp-discourse-shortcodes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Plugin Name: WP Discourse Shortcodes
* Description: Extends the WP Discourse plugin to add Discourse content to your WordPress site
* Version: 0.24
* Author: scossar
* Text Domain: wpds
* Plugin URI: https://github.com/scossar/wp-discourse-shortcodes
*
* @package WPDiscourse\Shortcodes
*/
namespace WPDiscourse\Shortcodes;
use \WPDiscourse\Admin\OptionsPage as OptionsPage;
use \WPDiscourse\Admin\FormHelper as FormHelper;
define( 'WPDS_VERSION', '0.3' );
add_action( 'plugins_loaded', __NAMESPACE__ . '\\init' );
/**
* Initializes the plugin, checks that WPDiscourse exists before requiring plugin files.
*/
function init() {
if ( class_exists( '\WPDiscourse\Discourse\Discourse' ) ) {
require_once( __DIR__ . '/lib/formatter.php' );
require_once( __DIR__ . '/lib/discourse-shortcodes.php' );
require_once( __DIR__ . '/lib/discourse-link.php' );
require_once( __DIR__ . '/lib/discourse-prefilled-message.php' );
require_once( __DIR__ . '/lib/discourse-topics.php' );
require_once( __DIR__ . '/lib/discourse-groups.php' );
require_once( __DIR__ . '/lib/discourse-user.php' );
require_once( __DIR__ . '/lib/discourse-topic-formatter.php' );
require_once( __DIR__ . '/lib/discourse-user-formatter.php' );
require_once( __DIR__ . '/lib/shortcodes/discourse-topics-shortcode.php' );
require_once( __DIR__ . '/lib/shortcodes/discourse-groups-shortcode.php' );
require_once( __DIR__ . '/lib/shortcodes/discourse-link-shortcode.php' );
require_once( __DIR__ . '/lib/shortcodes/discourse-prefilled-message-shortcode.php' );
require_once( __DIR__ . '/lib/shortcodes/discourse-user-shortcode.php' );
new DiscourseShortcodes();
$topic_formatter = new DiscourseTopicFormatter();
$user_formatter = new DiscourseUserFormatter();
$discourse_topics = new DiscourseTopics( $topic_formatter );
$discourse_link = new DiscourseLink();
$prefilled_message = new DiscoursePrefilledMessage( $discourse_link );
$discourse_groups = new DiscourseGroups( $discourse_link );
$discourse_user = new DiscourseUser( $user_formatter );
new DiscourseLinkShortcode( $discourse_link );
new DiscoursePrefilledMessageShortcode( $prefilled_message );
new DiscourseTopicsShortcode( $discourse_topics );
new DiscourseGroupsShortcode( $discourse_groups );
new DiscourseUserShortcode( $discourse_user );
if ( is_admin() ) {
require_once( __DIR__ . '/admin/admin.php' );
require_once( __DIR__ . '/admin/settings-validator.php' );
$options_page = OptionsPage::get_instance();
$form_helper = FormHelper::get_instance();
new SettingsValidator();
new Admin( $options_page, $form_helper );
}
}
}