<?php

// freemius code starts here
if ( ! function_exists( 'db_fs' ) ) {
	// Create a helper function for easy SDK access.
	function db_fs() {
		global $db_fs;

		if ( ! isset( $db_fs ) ) {
			// Include Freemius SDK.
			require_once dirname( __FILE__ ) . '/freemius/start.php';

			$db_fs = fs_dynamic_init(
				array(
					'id'                  => '12435',
					'slug'                => 'daisy-blog',
					'type'                => 'theme',
					'public_key'          => 'pk_d31ac791b56594d1ccd7587abaccf',
					'is_premium'          => false,
					// If your theme is a serviceware, set this option to false.
					'has_premium_version' => true,
					'has_addons'          => false,
					'has_paid_plans'      => true,
				)
			);
		}

		return $db_fs;
	}

	// Init Freemius.
	db_fs();
	// Signal that SDK was initiated.
	do_action( 'db_fs_loaded' );
}
// freemius code ends here

function daisy_enqueue_styles() {
    // Enqueue the main stylesheet
    wp_enqueue_style('daisy-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'daisy_enqueue_styles');

function daisy_enqueue_editor_styles() {
    // Enqueue the main stylesheet and editor-specific stylesheet for the block editor
    wp_enqueue_style('daisy-style', get_stylesheet_uri());
}
add_action( 'enqueue_block_assets', function () {
	wp_enqueue_style( 'daisy-style', get_stylesheet_uri() );
} );

require_once get_template_directory() . '/inc/theme-info.php';

/**
 * Admin menu highlight (global).
 */
add_action( 'admin_enqueue_scripts', function () {
	$css = '
		#menu-appearance li:last-child a{
			background:#1a7f37 !important;
			color:#fff !important;
		}
		#menu-appearance li:last-child a .wp-menu-name,
		#menu-appearance li:last-child a .wp-menu-image:before{
			color:#fff !important;
		}
	';
	wp_register_style( 'daisy-admin', false );
	wp_enqueue_style( 'daisy-admin' );
	wp_add_inline_style( 'daisy-admin', $css );
} );


// // Register custom block: Social Share
// function daisy_register_social_share_block() {
// 	// Try child/active theme first.
// 	$dir = trailingslashit( get_stylesheet_directory() ) . 'blocks/social-share';
// 	if ( ! file_exists( $dir . '/block.json' ) ) {
// 		// Fallback to parent theme (in case you placed blocks in the parent).
// 		$dir = trailingslashit( get_template_directory() ) . 'blocks/social-share';
// 	}

// 	if ( ! file_exists( $dir . '/block.json' ) ) {
// 		error_log( '[daisy] Social Share block not registered. Missing block.json at: ' . $dir );
// 		return;
// 	}

// 	error_log( '[daisy] Registering Social Share from: ' . $dir );
// 	register_block_type( $dir );
// }
// add_action( 'init', 'daisy_register_social_share_block' );
