/**
 * Implementation of hook_civicrm_install
 */
function donationreceipts_civicrm_install()
{
    setup_custom_data();
    setup_template();
    return _donationreceipts_civix_civicrm_install();
}
function zn_load_template()
{
    check_ajax_referer('zn_framework', 'security');
    define('ZN_PB_AJAX', true);
    if (empty($_POST['template_name'])) {
        return false;
    }
    $post_id = ZN()->pagebuilder->templates->zn_get_post_id();
    $template_data = ZN()->pagebuilder->templates->zn_pb_get_templates('zn_pb_templates', $_POST['template_name'], '=');
    ZN()->pagebuilder->init();
    if (!empty($template_data[0])) {
        $template_data = maybe_unserialize($template_data[0]);
        $pb_template = setup_template($template_data['template']);
        $custom_css = !empty($template_data['custom_css']) ? $template_data['custom_css'] : '';
        // Start output fetching
        ob_start();
        ZN()->pagebuilder->zn_render_elements($pb_template, true);
        // End output fetching
        $html = ob_get_contents();
        $response['template'] = do_shortcode($html);
        $response['current_layout'] = ZN()->pagebuilder->editor->build_options_array($pb_template);
        $response['custom_css'] = $custom_css;
        ob_end_clean();
    } else {
        $response['message'] = 'There was a problem loading the template';
    }
    // Send the response
    wp_send_json($response);
    die;
}