setup_hooks(); } private function setup_hooks() { add_action( 'admin_menu', array( $this, 'create_menu' ) ); add_action( 'in_admin_header', array( $this, 'hide_admin_notices' ) ); } public function create_menu() { if ( ! is_child_theme() ) { $theme = wp_get_theme(); } else { $theme = wp_get_theme()->parent(); } /* translators: %s: Theme Name. */ $theme_page_name = sprintf( esc_html__( '%s', 'colormag' ), $theme->Name ); add_theme_page( $theme_page_name, $theme_page_name, 'edit_theme_options', 'colormag', array( $this, 'dashboard_page', ) ); } /** * Hide admin notices from BlockArt admin pages. * * @since 1.0.0 */ public function hide_admin_notices() { // Bail if we're not on a ColorMag screen or page. if ( empty( $_REQUEST['page'] ) || false === strpos( sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ), 'colormag' ) ) { // phpcs:ignore WordPress.Security.NonceVerification return; } global $wp_filter; $ignore_notices = apply_filters( 'colormag_ignore_hide_admin_notices', array() ); foreach ( array( 'user_admin_notices', 'admin_notices', 'all_admin_notices' ) as $wp_notice ) { if ( empty( $wp_filter[ $wp_notice ] ) ) { continue; } $hook_callbacks = $wp_filter[ $wp_notice ]->callbacks; if ( empty( $hook_callbacks ) || ! is_array( $hook_callbacks ) ) { continue; } foreach ( $hook_callbacks as $priority => $hooks ) { foreach ( $hooks as $name => $callback ) { if ( ! empty( $name ) && in_array( $name, $ignore_notices, true ) ) { continue; } if ( ! empty( $callback['function'] ) && ! is_a( $callback['function'], '\Closure' ) && isset( $callback['function'][0], $callback['function'][1] ) && is_object( $callback['function'][0] ) && in_array( $callback['function'][1], $ignore_notices, true ) ) { continue; } unset( $wp_filter[ $wp_notice ]->callbacks[ $priority ][ $name ] ); } } } } public function dashboard_page() { if ( ! is_child_theme() ) { $theme = wp_get_theme(); } else { $theme = wp_get_theme()->parent(); } $admin_url = admin_url(); $tabs = apply_filters( 'colormag_dashboard_tabs', array( 'dashboard' => array( 'name' => esc_html__( 'Dashboard', 'colormag' ), 'callback' => function () { include __DIR__ . '/views/dashbaord.php'; }, ), 'starter-templates' => array( 'name' => esc_html__( 'Starter Templates', 'colormag' ), 'callback' => function () { if ( is_plugin_active( 'themegrill-demo-importer/themegrill-demo-importer.php' ) ) { wp_enqueue_style( 'tg-demo-importer' ); wp_enqueue_script( 'tg-demo-importer' ); $this->demo_packages = get_transient( 'themegrill_demo_importer_packages' ); include_once plugin_dir_path( TGDM_PLUGIN_FILE ) . '/includes/admin/views/html-admin-page-importer.php'; } else { include __DIR__ . '/views/starter-templates.php'; } }, ), 'products' => array( 'name' => esc_html__( 'Products', 'colormag' ), 'callback' => function () { include __DIR__ . '/views/products.php'; }, ), 'free-vs-pro' => array( 'name' => esc_html__( 'Free Vs Pro', 'colormag' ), 'callback' => function () { include __DIR__ . '/views/free-vs-pro.php'; }, ), 'help' => array( 'name' => esc_html__( 'Help', 'colormag' ), 'callback' => function () { include __DIR__ . '/views/help.php'; }, ), ) ) ?>
<?php esc_attr_e( 'ColorMag', 'colormag' ); ?>
    $tab ) : if ( ! is_callable( $tab['callback'] ) ) { continue; } ?>
Version ); ?> <?php esc_attr_e( 'ColorMag', 'colormag' ); ?>

get_items(); // Check if the response contains data if ( $changelog_data ) { // Output the changelog data echo '
'; foreach ( $changelog_data as $entry ) { echo '
'; echo '
'; echo '

Version: ' . esc_html( $entry['version'] ) . '

'; echo '

' . esc_html( $entry['date'] ) . '

'; echo '
'; // cm-changelog__list-head // Display each change echo '
'; foreach ( $entry['changes'] as $tag => $changes ) { echo '
'; echo '' . esc_html( $tag ) . ''; echo '
'; foreach ( $changes as $change ) { echo '

' . esc_html( $change ) . '

'; } echo '
'; // cm-changelog__change-list echo '
'; // cm-changelog__change-item } echo '
'; // cm-changelog__change echo '
'; // cm-changelog__list-item } echo '
'; // cm-changelog } else { echo '

No changelog data available.

'; } ?>