Ejemplo n.º 1
0
function wp_splash_page_generate()
{
    wpsp_import_class('WP_Splash_Page', 'inc/class-wp-splash-page.php');
    $wpsp = new WP_Splash_Page();
    if ($wpsp->is_active()) {
        $wpsp->splash_page();
    }
}
<?php

wpsp_import_class('Mobile_Detect', 'inc/mobile-detect/Mobile_Detect.php');
class WP_Splash_Page
{
    private $settings;
    private $state;
    private $cookie_name;
    private $cookie_expiration;
    private $detect;
    private $minor;
    private $opt_in_rejected;
    private $current_url;
    private $template_url;
    public function __construct()
    {
        $this->minor = false;
        $this->opt_in_rejected = false;
        if (isset($_GET['mode']) && $_GET['mode'] == 'wpsp_preview') {
            $this->settings = get_option('wp_splash_page_options_preview');
            $this->state = !current_user_can('manage_options') || !file_exists(WP_SPLASH_PAGE_ROOT_PATH . 'templates/' . $this->settings['template'] . '/splash-page.php') ? false : 'preview';
        } else {
            $this->settings = get_option('wp_splash_page_options');
            $config_options = get_option('wp_splash_page_config');
            $this->cookie_name = $config_options['cookie_name'];
            $this->cookie_expiration = $this->settings['expiration_time'] != 0 ? time() + $this->settings['expiration_time'] * 24 * 3600 : 0;
            $this->detect = new Mobile_Detect();
            $this->state = $this->test() ? 'active' : false;
        }
    }
    public function splash_page()