'sanitize_text_field', 'default' => '', ]); } public function createNavPage() { add_options_page( esc_html__('Allsource', 'allsource'), esc_html__('Allsource', 'allsource'), 'manage_options', 'allsource-settings', [$this, 'adminView'] ); } public function adminView() { require_once ALLSOURCE_PLUGIN_PATH . 'admin/views/allsource-settings.php'; } public function enqueueScripts() { $pixel_client_id = sanitize_text_field(get_option('allsource_pixel_client_id')); $plugin_url = plugins_url('', __FILE__); if ($pixel_client_id) { $script_url = plugins_url('includes/js/allsource-pixel.js', __FILE__); wp_register_script( 'allsource_pixel_script', $script_url, [], null, true ); wp_localize_script('allsource_pixel_script', 'allsourceConfig', [ 'pixelClientId' => $pixel_client_id, 'pluginUrl' => $plugin_url ]); wp_enqueue_script('allsource_pixel_script'); } } public function enqueueAdminStyles() { if (isset($_GET['page']) && $_GET['page'] === 'allsource-settings') { wp_register_style( 'allsource_custom_admin_style', plugins_url('admin/static/allsource-admin-style.css', __FILE__), [], ALLSOURCE_PLUGIN_VERSION ); wp_enqueue_style('allsource_custom_admin_style'); } } private function updatePluginVersion() { if (get_option('allsource_version') !== ALLSOURCE_PLUGIN_VERSION) { update_option('allsource_version', ALLSOURCE_PLUGIN_VERSION); } } public function maybeInstall() { if (is_admin() && is_plugin_active(plugin_basename(__FILE__))) { $this->updatePluginVersion(); } } public function pluginActionLinks($links) { $plugin_links = [ '' . esc_html__('Settings', 'allsource') . '', '' . esc_html__('Support', 'allsource') . '', ]; return array_merge($plugin_links, $links); } } Allsource::getInstance(); } }