ccead50116
- Custom post type with likes, replies, moderation, shortcodes - Beep icon and logo assets - CSS and JS for frontend
51 lines
1.3 KiB
PHP
Executable File
51 lines
1.3 KiB
PHP
Executable File
<?php
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class Beep_Plugin {
|
|
|
|
public static function init() {
|
|
Beep_CPT::init();
|
|
Beep_Likes::init();
|
|
Beep_Replies::init();
|
|
Beep_Moderation::init();
|
|
Beep_Shortcode::init();
|
|
|
|
add_action('wp_enqueue_scripts', [__CLASS__, 'enqueue_assets']);
|
|
}
|
|
|
|
public static function activate() {
|
|
Beep_CPT::register();
|
|
Beep_Likes::create_table();
|
|
flush_rewrite_rules();
|
|
}
|
|
|
|
public static function deactivate() {
|
|
flush_rewrite_rules();
|
|
}
|
|
|
|
public static function enqueue_assets() {
|
|
wp_enqueue_style(
|
|
'beep',
|
|
BEEP_URL . 'assets/beep.css',
|
|
[],
|
|
BEEP_VERSION
|
|
);
|
|
wp_enqueue_script(
|
|
'beep',
|
|
BEEP_URL . 'assets/beep.js',
|
|
[],
|
|
BEEP_VERSION,
|
|
true
|
|
);
|
|
wp_localize_script('beep', 'BeepConfig', [
|
|
'restUrl' => esc_url_raw(rest_url('beep/v1/')),
|
|
'nonce' => wp_create_nonce('wp_rest'),
|
|
'charLimit' => BEEP_CHAR_LIMIT,
|
|
'loginUrl' => esc_url_raw(wp_login_url(is_singular() ? get_permalink() : home_url('/'))),
|
|
'isLoggedIn' => is_user_logged_in(),
|
|
]);
|
|
}
|
|
}
|