Plugin Directory

Changeset 2675763


Ignore:
Timestamp:
02/09/2022 03:17:35 PM (4 years ago)
Author:
bistromatic
Message:
  • tested and released for Wordpress 5.9
  • improved the logic for "always run on home screen"
Location:
n360-splash-screen/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • n360-splash-screen/trunk/includes/splash-screen.php

    r2488676 r2675763  
    1414        $this->version_cookie = get_option( 'n360_version_cookie' );
    1515        $this->cookie_name = $this->version_cookie['cookie_name'];
    16         $this->cookie_expiration = 0;
     16        $this->cookie_expiration = time() + (60*60*24*30); // cookie expires in 30 days
    1717        $this->run = false;
    1818        $this->n360_check_run();
     
    2424            setCookie( $this->cookie_name, "n360_splash_screen", $this->cookie_expiration, "/", $domain, $_SERVER['HTTPS'] );
    2525            require_once ( N360_SPLASH_PAGE_ROOT_PATH . 'templates/default-template.php' );
    26             exit;
     26            exit;
    2727        }
    2828    }
     
    3333
    3434    public function n360_check_run() {
    35         if ( !isset ( $_COOKIE[$this->cookie_name] ) ) {
     35        if ( ! isset($_COOKIE[$this->cookie_name]) ) { // first time here, never ran
    3636            $this->run = true;
    37         }
     37        } elseif ( ! isset($_SESSION['splash']) ) { // we have a cookie but it's a new session
     38            $this->run = isset(get_option('n360_config')['run_always']) ? true : false;
     39        } elseif ( isset(get_option('n360_config')['run_always']) ) { // we have a cookie and a session
     40            if ( $_SESSION['splash'] == false ) {
     41                $this->run = true;
     42            } else {
     43                $_SESSION['splash'] = false;
     44            }   
     45        }
    3846    }
    3947
  • n360-splash-screen/trunk/n360-splash-screen.php

    r2493532 r2675763  
    55 Plugin URI: https://notion360.com/SplashScreen/
    66 Description: Creates a fading splash screen as a landing page for your Wordpress website
    7  Version: 1.0.3
     7 Version: 1.0.4
    88 Author: bistromatic
    99 Author URI: https://notion360.com/
     
    1111 License URI: https://www.gnu.org/licenses/gpl-3.0.html License: GPLv2 or later
    1212 Text Domain: n360splashscreen
    13  Requires at least: 4.0
    14  Tested up to: 5.7
     13 Requires at least: 4.7
     14 Tested up to: 5.9
    1515*/
    1616
     
    1818if ( ! defined( 'ABSPATH' ) ) exit;
    1919
    20 define ( 'N360_SPLASH_PAGE_VERSION', '1.0.0' );
     20define ( 'N360_SPLASH_PAGE_VERSION', '1.0.4' );
    2121define ( 'N360_VERSION_COOKIE', 'n360_version_cookie' );
    2222define ( 'N360_SPLASH_PAGE_ROOT_PATH', plugin_dir_path( __FILE__ ) );
     
    3030        require_once ( N360_SPLASH_PAGE_ROOT_PATH . 'includes/settings-fields.php' );
    3131        require_once ( N360_SPLASH_PAGE_ROOT_PATH . 'includes/admin.php' );
    32     }
    33 
    34     $home_url_rel = wp_make_link_relative(get_home_url()) . '/';
    35    
    36     if ( !is_admin() && !isset($_GET["r"]) && ( $_SERVER['REQUEST_URI'] == $home_url_rel ) ) {
    37         require_once ( N360_SPLASH_PAGE_ROOT_PATH . 'includes/splash-screen.php' );
    38         $splash_screen = new n360_SplashScreen();
    39         if ( $splash_screen->run || isset(get_option('n360_config')['run_always']) ) {
    40             $splash_screen->n360_splash_page();
    41         }
    42     }
     32    } else {
     33        session_start();
     34        $home_url_rel = wp_make_link_relative(get_home_url()) . '/';
     35        if ( $_SERVER['REQUEST_URI'] == $home_url_rel ) {
     36            require_once ( N360_SPLASH_PAGE_ROOT_PATH . 'includes/splash-screen.php' );
     37            $splash_screen = new n360_SplashScreen();
     38            if ( $splash_screen->run ) {
     39                $splash_screen->n360_splash_page();
     40            }
     41        }
     42    }
    4343}
    44 
    4544add_action ( 'init', 'n360_plugin_init' );
  • n360-splash-screen/trunk/readme.txt

    r2493532 r2675763  
    44Tags: splash page, splash screen, splash landing page, responsive design, background image, full screen page, fade-in, fade-out
    55Requires at least: 4.7
    6 Tested up to: 5.7
    7 Stable tag: 1.0.3
     6Tested up to: 5.9
     7Stable tag: 1.0.4
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    5858* tested and released for Wordpress 5.7
    5959* improved splash screen performance
     60= 1.0.4 =
     61* tested and released for Wordpress 5.9
     62* improved the logic for "always run on home screen"
  • n360-splash-screen/trunk/templates/default-template.php

    r2493532 r2675763  
     1<?php
     2$_SESSION['splash'] = true;
     3?>
     4
    15<!DOCTYPE html>
    26
     
    113117
    114118            function n360animationEnd () {
    115                 window.location.replace(window.location.href + '?r');
    116             }
     119                // window.location.replace(window.location.href);
     120                window.location.reload(true);
     121            }
    117122
    118123            function n360docReady(fn) {
Note: See TracChangeset for help on using the changeset viewer.