/** * Initialize the plugin by loading admin scripts & styles and adding a * settings page and menu. * * @since 1.0.0 */ private function __construct() { // settings try { $this->set_api_key(get_option('api_key')); // $this->set_client_id(get_option('client_id')); // $this->set_client_secret(get_option('client_secret')); } catch (Exception $e) { $this->error_message = $e->getMessage(); add_action('admin_notices', array($this, 'settings_missing_message')); } $plugin = Maps::get_instance(); $this->plugin_slug = $plugin->get_plugin_slug(); // Load admin style sheet and JavaScript. add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); // Add the options page and menu item. add_action('admin_menu', array($this, 'add_plugin_admin_menu')); // Add an action link pointing to the options page. $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php'); add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links')); add_action('init', array($this, 'maps_register_locations')); add_action('save_post', array($this, 'save_map_meta')); //call register settings function add_action('admin_init', array($this, 'register_mysettings')); add_action('init', array($this, 'maps_acf_register_fields')); }