options) { $this->options = get_option('ads-bbpress'); } } function show($key) { $this->init_options(); $count = $this->count; if (isset($this->options['test']) && current_user_can('administrator')) { echo '
', $key; if (strpos($key, '_loop_') !== false || strpos($key, '_content') !== false) echo ' [', $count, ']'; echo '
'; return; } if (empty($this->options[$key])) { return; } if (strpos($this->options[$key], '' . $this->options[$key]); $content = ob_get_clean(); echo do_shortcode($content); } else { echo $this->options[$key]; } } function bbp_template_before_single_forum() { $this->show('bbp_template_before_single_forum'); } function bbp_template_after_single_forum() { $this->show('bbp_template_after_single_forum'); } function bbp_theme_before_topic_form() { $this->show('bbp_theme_before_topic_form'); } function bbp_template_before_single_topic() { $this->show('bbp_template_before_single_topic'); } function bbp_template_after_single_topic() { $this->show('bbp_template_after_single_topic'); } function bbp_theme_before_reply_form() { $this->show('bbp_theme_before_reply_form'); } function bbp_theme_before_topic_form_notices() { $this->show('bbp_theme_before_topic_form_notices'); } function bbp_theme_before_reply_form_notices() { $this->show('bbp_theme_before_reply_form_notices'); } function bbp_theme_before_topic_content() { $this->show('bbp_theme_before_topic_content'); } function bbp_theme_after_topic_content() { $this->show('bbp_theme_after_topic_content'); } function bbp_theme_before_reply_content() { $this->show('bbp_theme_before_reply_content'); } function bbp_theme_after_reply_content() { $this->show('bbp_theme_after_reply_content'); } function bbp_template_before_topics_loop() { $this->show('bbp_template_before_topics_loop'); } function bbp_template_after_topics_loop() { $this->show('bbp_template_after_topics_loop'); } function bbp_template_before_replies_loop() { $this->show('bbp_template_before_replies_loop'); } function bbp_template_after_replies_loop() { $this->show('bbp_template_after_replies_loop'); } /** * * @param string $slug is 'loop' * @param string $name can be 'single-reply' */ function get_template_part_loop($slug, $name) { if ($name === 'single-reply' || $name === 'single-topic') { $this->count++; $this->show('get_template_part_loop_' . $name); } } } new AdsBbpress(); // All the admin stuff only if we're in the admin side if (is_admin()) { include __DIR__ . '/admin.php'; }