Consolidate HG WordPress plugins
This commit is contained in:
commit
dccb8ed9bd
18 files changed
+1701
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: HG Social Feed
|
||||
* Description: Toont recente berichten en profiellinks van Instagram, Facebook en X.
|
||||
* Version: 0.2.0
|
||||
* Requires at least: 6.5
|
||||
* Requires PHP: 8.1
|
||||
* Author: Hippogrief
|
||||
* License: GPL-2.0-or-later
|
||||
* Text Domain: hg-socialfeed
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
define('HGSF_VERSION', '0.2.0');
|
||||
define('HGSF_PLUGIN_FILE', __FILE__);
|
||||
|
||||
require_once __DIR__ . '/includes/sources.php';
|
||||
require_once __DIR__ . '/includes/instagram.php';
|
||||
require_once __DIR__ . '/includes/facebook.php';
|
||||
require_once __DIR__ . '/includes/x.php';
|
||||
require_once __DIR__ . '/includes/shortcode.php';
|
||||
|
||||
if (is_admin()) {
|
||||
require_once __DIR__ . '/includes/hg-admin-menu.php';
|
||||
require_once __DIR__ . '/includes/admin.php';
|
||||
}
|
||||
|
||||
add_action('hgsf_sync_instagram', 'hgsf_sync_instagram');
|
||||
add_action('hgsf_sync_facebook', static fn () => hgsf_sync_source('facebook'));
|
||||
add_action('hgsf_sync_x', static fn () => hgsf_sync_source('x'));
|
||||
|
||||
register_activation_hook(__FILE__, 'hgsf_schedule_events');
|
||||
register_deactivation_hook(__FILE__, static function (): void {
|
||||
foreach (array_keys(HGSF_SOURCES) as $source) {
|
||||
wp_clear_scheduled_hook('hgsf_sync_' . $source);
|
||||
}
|
||||
});
|
||||
|
||||
add_action('admin_init', static function (): void {
|
||||
if (get_option('hgsf_cron_version') !== HGSF_VERSION) {
|
||||
hgsf_schedule_events();
|
||||
}
|
||||
});
|
||||
add_shortcode('hg_socialfeed', 'hgsf_shortcode');
|
||||
add_shortcode('hg_sociallinks', 'hgsf_sociallinks_shortcode');
|
||||
|
||||
add_filter('plugin_action_links_' . plugin_basename(__FILE__), static function (array $links): array {
|
||||
if (current_user_can('manage_options')) {
|
||||
$links[] = '<a href="' . esc_url(admin_url('admin.php?page=hg-socialfeed')) . '">Instellingen</a>';
|
||||
}
|
||||
return $links;
|
||||
});
|
||||
Reference in new issue
Block a user