<?php
/*
Template Name: Embed Widget
*/

/**
 * @package WordPress
 * @subpackage Campoal
 */

global $campoal_options;

use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;

// get params embed
$id = isset($_GET['id']) ? sanitize_text_field($_GET['id']) : '';
$custom_share_link = isset($_GET['custom_id']) ? sanitize_text_field($_GET['custom_id']) : false;
$embed_style = isset($_GET['style']) ? sanitize_text_field($_GET['style']) : '';
$post_type = get_post_type($id);

if (!empty($id) && !empty($embed_style) && $embed_style == 'card' && $post_type == 'petition') {
    echo conikal_embed_petition($id, 'card', false);

    // $PetitionCardInline = new CssToInlineStyles();
    // echo $PetitionCardInline->convert(
    //     conikal_embed_petition($id, 'card', 'html'),
    //     conikal_embed_petition($id, 'card', 'style')
    // );
} else if (!empty($id) && !empty($embed_style) && $embed_style == 'card' && $post_type == 'give_forms') {
    echo conikal_embed_fundraising($id, 'card', false);

    // $FundraisingCardInline = new CssToInlineStyles();
    // echo $FundraisingCardInline->convert(
    //     conikal_embed_fundraising($id, 'card', 'html'),
    //     conikal_embed_fundraising($id, 'card', 'style')
    // );
} else if (!empty($id) && !empty($embed_style) && $embed_style == 'share') {
    echo conikal_share_embed_petition($id, false, $custom_share_link);

    // $SharedInline = new CssToInlineStyles();
    // echo $SharedInline->convert(
    //     conikal_share_embed_petition($id, 'html'),
    //     conikal_share_embed_petition($id, 'style')
    // );
}
?>