<?php

class PeepSoGettingStarted
{
    public static function init()
    {
        $PeepSoInput = new PeepSoInput();

        $section = $PeepSoInput->value('section', 'peepso', FALSE); // SQL Safe
        $step = $PeepSoInput->int('step', 1);

        if ('peepso' === $section) {
            wp_enqueue_media();

            wp_localize_script('peepso-getting-started-wizard', 'peepsogettingstarteddata', array(
                'initialStep' => max(1, min(5, $step)),
                'selectedType' => '',
                'saved' => array(
                    'header' => (string) PeepSo::get_option('site_registration_header', ''),
                    'callout' => (string) PeepSo::get_option('site_registration_callout', ''),
                    'buttonText' => (string) PeepSo::get_option('site_registration_buttontext', ''),
                    'customImage' => (string) PeepSo::get_option('landing_page_image', ''),
                    'customImageIsDefault' => empty(PeepSo::get_option('landing_page_image', '')),
                    'defaultImage' => PeepSo::get_asset('images/landing/register-bg.jpg'),
                ),
            ));
        }

        PeepSoTemplate::exec_template('gettingstarted', $section, array(
            'step' => $step,
            'license' => '',
        ));
    }

    public static function get_youtube_video()
    {
        $yt = file_get_contents('https://cdn.peepso.com/upsell/yt.txt');

        if (NULL === $yt) {
            return '';
        }

        return $yt;
    }
}
