public static function init_menu() { add_menu_page(__('JWT Auth', JWT_AUTH_LANG), __('JWT Auth', JWT_AUTH_LANG), 'manage_options', 'jwta', array('JWT_AUTH_Admin', 'render_settings_page'), JWT_AUTH::getPluginDirUrl() . 'assets/img/jwticon.png', 82); add_submenu_page('jwta', __('JWT Auth Settings', JWT_AUTH_LANG), __('Settings', JWT_AUTH_LANG), 'manage_options', 'jwta', array('JWT_AUTH_Admin', 'render_settings_page')); }
private static function autoloader($class) { $path = JWT_AUTH_PLUGIN_DIR; $paths = array(); $exts = array('.php', '.class.php'); $paths[] = $path; $paths[] = $path . 'lib/'; foreach ($paths as $p) { foreach ($exts as $ext) { if (file_exists($p . $class . $ext)) { require_once $p . $class . $ext; return true; } } } return false; } // Add settings link on plugin page public static function wp_add_plugin_settings_link($links) { $settings_link = '<a href="admin.php?page=jwta">Settings</a>'; array_unshift($links, $settings_link); return $links; } public static function getPluginDirUrl() { return plugin_dir_url(__FILE__); } } JWT_AUTH::Init();