*/ class Addonify_Quick_View_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Default settings_page_slug * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $settings_page_slug = 'addonify-quick-view'; /** * Initialize the class and set its properties. * * @since 1.0.0 * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Define admin menu item for the plugin page. * * @since 1.0.0 */ public function add_menu_callback() { global $admin_page_hooks; $parent_menu_slug = array_search( 'addonify', $admin_page_hooks, true ); if ( ! $parent_menu_slug ) { add_menu_page( 'Addonify Settings', 'Addonify', 'manage_options', $this->settings_page_slug, array( $this, 'get_settings_screen_contents' ), 'dashicons-superhero', 70 ); add_submenu_page( $this->settings_page_slug, 'Addonify Quick View Settings', 'Quick View', 'manage_options', $this->settings_page_slug, array( $this, 'get_settings_screen_contents' ), 0 ); } else { add_submenu_page( $parent_menu_slug, 'Addonify Quick View Settings', 'Quick View', 'manage_options', $this->settings_page_slug, array( $this, 'get_settings_screen_contents' ), 0 ); } } /** * Add settings link to plugin actions. * * @since 1.0.0 * * @param array $links Plugin actions. */ public function custom_plugin_link_callback( $links ) { $action_links = array( '' . esc_html__( 'Settings', 'addonify-quick-view' ) . '', ); return array_merge( $action_links, $links ); } /** * Show row meta on the plugin screen. * * @since 1.2.13 * * @param mixed $links Plugin Row Meta. * @param mixed $file Plugin Base file. * * @return array */ public function plugin_row_meta( $links, $file ) { if ( ADDONIFY_QUICK_VIEW_BASENAME !== $file ) { return $links; } $row_meta = array( 'docs' => '' . esc_html__( 'Documentation', 'addonify-quick-view' ) . '', 'github' => '' . esc_html__( 'GitHub', 'addonify-quick-view' ) . '', 'support' => '' . esc_html__( 'Community support', 'addonify-quick-view' ) . '', ); return array_merge( $links, $row_meta ); } /** * Get contents from settings page templates and print it * * @since 1.0.0 */ public function get_settings_screen_contents() { ?>