theme_info = array( 'name' => $theme->get( 'Name' ), 'version' => $theme->get( 'Version' ), 'description' => $theme->get( 'Description' ), 'author' => $theme->get( 'Author' ), 'author_uri' => $theme->get( 'AuthorURI' ), 'theme_uri' => $theme->get( 'ThemeURI' ), ); // Initialize admin modules $this->init_modules(); // Enqueue admin scripts and styles add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); // Handle AJAX for dismissing plugin notice add_action( 'wp_ajax_accepta_dismiss_plugin_notice', array( $this, 'dismiss_plugin_notice' ) ); // Add admin footer to theme pages add_action( 'accepta_admin_footer', array( $this, 'render_admin_footer' ) ); } /** * Initialize admin modules */ private function init_modules() { // Initialize the customizer module $this->modules['customizer'] = Accepta_Admin_Customizer::instance( $this ); // Initialize the menus module $this->modules['menus'] = Accepta_Admin_Menus::instance( $this ); // Initialize the plugins module $this->modules['plugins'] = Accepta_Admin_Plugins::instance( $this ); } /** * Enqueue scripts and styles for the admin pages */ public function admin_scripts( $hook ) { // Always load admin styles (needed for menu icon on all admin pages) wp_enqueue_style( 'accepta-admin-style', get_template_directory_uri() . '/inc/admin/assets/css/admin.css', array(), filemtime( get_template_directory() . '/inc/admin/assets/css/admin.css' ) ); // Add inline CSS for menu icon with correct SVG path and positioning $icon_url = get_template_directory_uri() . '/inc/admin/assets/images/accepta-icon.svg'; $custom_css = " #toplevel_page_accepta .wp-menu-image, #toplevel_page_accepta.wp-has-current-submenu .wp-menu-image, #toplevel_page_accepta.wp-menu-open .wp-menu-image, #toplevel_page_accepta:hover .wp-menu-image, #toplevel_page_accepta a .wp-menu-image { width: 36px !important; height: 34px !important; display: flex !important; align-items: center !important; justify-content: center !important; background-image: url('" . esc_url( $icon_url ) . "') !important; background-size: 20px 20px !important; background-position: center center !important; }"; wp_add_inline_style( 'accepta-admin-style', $custom_css ); // Only load scripts on Accepta theme pages if ( strpos( $hook, 'accepta' ) === false ) { return; } // Admin scripts wp_enqueue_script( 'accepta-admin-script', get_template_directory_uri() . '/inc/admin/assets/js/admin.js', array( 'jquery' ), filemtime( get_template_directory() . '/inc/admin/assets/js/admin.js' ), true ); } /** * Add a dashboard widget with theme information */ public function add_dashboard_widget() { wp_add_dashboard_widget( 'accepta_dashboard_widget', esc_html__( 'Accepta Theme Information', 'accepta' ), array( $this, 'render_dashboard_widget' ) ); } /** * Render the dashboard widget content */ public function render_dashboard_widget() { ?>

theme_info['name'] ); ?>

theme_info['description'] ); ?>

theme_info; } /** * Add UTM parameters to a URL for tracking * * @param string $url The original URL. * @param string $content The content identifier for utm_content. * @return string URL with UTM parameters. */ public function add_utm_params( $url, $content = '' ) { $utm_params = array( 'utm_source' => 'wpadmin', 'utm_medium' => 'accepta', 'utm_campaign' => 'accepta_free', ); if ( ! empty( $content ) ) { $utm_params['utm_content'] = $content; } $separator = strpos( $url, '?' ) !== false ? '&' : '?'; return $url . $separator . http_build_query( $utm_params ); } /** * Get module instance * * @param string $module Module name. * @return object|null Module instance or null if not found. */ public function get_module( $module ) { return isset( $this->modules[ $module ] ) ? $this->modules[ $module ] : null; } /** * Render the admin footer on theme pages */ public function render_admin_footer() { // Only show on Accepta theme pages $screen = get_current_screen(); if ( strpos( $screen->id, 'accepta' ) === false ) { return; } // Don't display on the welcome page as it includes the footer directly if ( $screen->id === 'toplevel_page_accepta' ) { return; } echo ''; } } // Initialize the admin class on init hook (after textdomain is loaded) add_action( 'init', function() { Accepta_Admin::instance(); }, 11 );