Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
dd(Language::getInstance()->getLanguages()));
add_action('plugins_loaded', function () {
new RestrictionController();
new MessageController();
new AppearanceController();
new AdvancedController();
new AccessController();
new ContentController();
new ToolsController();
new PostController();
new Toolbar();
new TroubleShootingController();
});
add_action('admin_notices', [$this, 'notices']);
$basename = plugin_basename(AGE_GATE_PATH . 'age-gate.php');
add_filter("plugin_action_links_" . $basename, [$this, 'actionLinks']);
add_filter('plugin_row_meta', [$this, 'websiteLink'], 10, 2);
}
public function notices()
{
global $pagenow;
// $req = wp_remote_get(rest_url('/age-gate/v3/check'), [
// 'sslverify' => false
// ]);
if (!is_php_version_compatible('7.4') && strpos(sanitize_text_field($_GET['page'] ?? ''), 'age-gate') !== false) {
echo '' . esc_html__('Age Gate requires a minimum PHP version of 7.4 which your system does not have. You may experience some issues.', 'age-gate') . '
';
}
// if (wp_remote_retrieve_response_code($req) !== 200 && current_user_can(Constants::RESTRICTIONS) && strpos(sanitize_text_field($_GET['page'] ?? ''), 'age-gate-advanced') !== false) {
// echo '' . esc_html__('Age Gate is having trouble contacting the Wordpress REST API. Is something blocking it?', 'age-gate') . '
';
// }
// is it an age gate page?
if ($pagenow === 'admin.php' && isset($_GET['m']) && strpos((sanitize_text_field($_GET['page'] ?? '')), 'age-gate') === 0) {
switch ((int) $_GET['m']) {
case 1:
$status = 'success';
$message = esc_html__('Settings saved', 'age-gate');
break;
case 0:
$status = 'error';
$message = esc_html__('Something went wrong', 'age-gate');
break;
}
echo sprintf('', esc_attr($status), esc_html($message));
}
if (Settings::getInstance()->devWarning && current_user_can(Constants::TOOLS)) {
$data = get_plugin_data(AGE_GATE_PATH . 'age-gate.php');
$dev = preg_split('/\-|\+/', $data['Version']);
if ($dev[1] ?? false) {
$pattern = sprintf('/(%s|%s)/', $dev[1], AGE_GATE_VERSION);
/* translators: %1$s: Sub version number. %2$s: Full version number. */
$messageText = sprintf(__('You are using the %1$s version of Age Gate %2$s. This may not be suitable for production websites.', 'age-gate'), $dev[1], AGE_GATE_VERSION);
echo '' . preg_replace($pattern, '$1', esc_html($messageText)) . '
';
}
}
if (Settings::getInstance()->devEndpoint && current_user_can(Constants::TOOLS)) {
echo '' . esc_html__('The developer endpoint is enabled. You should disable this unless you have an open support topic', 'age-gate') . '
';
}
if (Settings::getInstance()->disableAgeGate && current_user_can(Constants::TOOLS)) {
echo '' . esc_html__('Age Gate is currently disabled in the Tools section and will not show for any users', 'age-gate') . '
';
}
foreach (Notice::get() ?? [] as $notice) {
echo '' . esc_html($notice['message']) . '
';
}
if (is_plugin_active('age-gate-user-registration/age-gate-user-registration.php')) {
$data = get_plugin_data(WP_PLUGIN_DIR . '/age-gate-user-registration/age-gate-user-registration.php');
if ($data['Version'] ?? false) {
if (version_compare($data['Version'], '1.0.0', '<')) {
echo '' . esc_html(sprintf(__('Your version of Age Gate User Registration (%s) is not compatible with Age Gate %s. Please download a supported version from our website', 'age-gate'), $data['Version'], AGE_GATE_VERSION)) . '
';
}
}
}
}
public function actionLinks($links)
{
$settings = sprintf('%s', admin_url('admin.php?page=age-gate'), esc_html__('Settings', 'age-gate'));
$donate = '' . esc_html__('Donate', 'age-gate') . '';
array_unshift($links, $settings);
array_push($links, $donate);
return $links;
}
public function websiteLink($meta, $file)
{
$basename = plugin_basename(AGE_GATE_PATH) . '/age-gate.php';
if ($basename === $file) {
$meta[] = sprintf(
'%s',
'https://agegate.io/docs',
esc_html__('Documentation', 'age-gate')
);
$meta[] = sprintf(
'%s',
'https://agegate.io/release-notes',
esc_html__('What’s new?', 'age-gate')
);
}
return $meta;
}
}