Plugin Directory

Changeset 1957563


Ignore:
Timestamp:
10/16/2018 03:01:03 PM (7 years ago)
Author:
safly
Message:

1.1.0

Location:
safly-article-lock
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • safly-article-lock/trunk/config.php

    r1957301 r1957563  
    99    'from'      => '2037-01-01',            //...|...,     the right part will be locked
    1010    'to'        => '1970-01-01',            //...|...,     the left part will be locked
    11     'f_t'       => '1970-01-01,2037-01-01', //...|...|..., the middle part will be locked
     11    'f_t'       => '1970-01-01,1970-01-02', //...|...|..., the middle part will be locked
    1212    'home_excl' => true,                    //If true the homepage won't be locked
    1313    'exclude_p' => [],                      //[4,5,6] (Supreme Priority)
     
    2525    'from'      => '2037-01-01',            //...|...,     the right part will be locked
    2626    'to'        => '1970-01-01',            //...|...,     the left part will be locked
    27     'f_t'       => '1970-01-01,2037-01-01', //...|...|..., the middle part will be locked
     27    'f_t'       => '1970-01-01,1970-01-02', //...|...|..., the middle part will be locked
    2828    'home_excl' => true,                    //If true the homepage won't be locked
    2929    'exclude_p' => [],                      //[4,5,6] (Supreme Priority)
     
    3737    'from'      => '2037-01-01',            //...|...,     the right part will be locked
    3838    'to'        => '1970-01-01',            //...|...,     the left part will be locked
    39     'f_t'       => '1970-01-01,2037-01-01', //...|...|..., the middle part will be locked
     39    'f_t'       => '1970-01-01,1970-01-02', //...|...|..., the middle part will be locked
    4040    'home_excl' => true,                    //If true the homepage won't be locked
    4141    'exclude_p' => [],                      //[4,5,6] (Supreme Priority)
  • safly-article-lock/trunk/readme.txt

    r1957301 r1957563  
    44Requires at least: 3.0
    55Tested up to: 4.9.8
    6 Stable tag: 1.0.0
     6Stable tag: 1.1.0
    77License: MPL 2.0
    88License URI: http://mozilla.org/MPL/2.0/
     
    3737== Changelog ==
    3838
    39 = 1.0 =
     39= 1.1.0 =
     40* Bug Fix: Some bugfixes
     41
     42= 1.0.0 =
    4043* Construct the basic framework
  • safly-article-lock/trunk/safly-article-lock.php

    r1957301 r1957563  
    44Plugin URI: https://www.oranme.com
    55Description: A plug-in helps you disable the access to the articles in an appointed range.
    6 Version: 1.0.0
     6Version: 1.1.0
    77Author: OranMe Ltd.
    88Author URI: https://blog.safly.org
     
    3131}
    3232
    33 if (SaFly_Article_Lock($GLOBALS['SaFly_AL'])) {
    34     if (!headers_sent()) {
    35         header($GLOBALS['SaFly_AL']['header']);
    36         header('Location: ' . $GLOBALS['SaFly_AL']['location']);
     33//Add hook
     34add_action('wp', 'SaFly_Article_Lock_Hook');
     35function SaFly_Article_Lock_Hook() {
     36    if (SaFly_Article_Lock($GLOBALS['SaFly_AL'])) {
     37        if (!headers_sent()) {
     38            header($GLOBALS['SaFly_AL']['header']);
     39            header('Location: ' . $GLOBALS['SaFly_AL']['location']);
     40        }
     41        exit('SaFly Article Lock');
    3742    }
    38     exit('SaFly Article Lock');
    3943}
    4044
     
    6468    $post_time = strtotime($post->post_date);
    6569    //Initialize and avoid wrong time set
    66     $f_t    = explode(',', $f_t);
     70    $f_t    = explode(',', $config['f_t']);
    6771    $from   = strtotime($config['from']);
    6872    $to     = strtotime($config['to']);
    6973    $f_t[0] = strtotime($f_t[0]);
    7074    $f_t[1] = strtotime($f_t[1]);
    71     if ($from && $to && $f_t) {
     75    //1970-01-01
     76    $from   = ($from   === 0)?1:$from;
     77    $to     = ($to     === 0)?1:$to;
     78    $f_t[0] = ($f_t[0] === 0)?1:$f_t[0];
     79    $f_t[1] = ($f_t[1] === 0)?1:$f_t[1];
     80    //Mistakes check
     81    if ($from && $to && $f_t[0] && $f_t[1]) {
    7282        //...
    7383    }else {
    74         //Wrong time set, please check
    75         error_log('SaFly Article Lock: Wrong time set');
     84        if (!empty($config['from']) && !empty($config['to']) && !empty($config['f_t'])) {
     85            //Wrong time set, please check
     86            error_log('SaFly Article Lock: Wrong time set');
     87        }
    7688        return false;
    7789    }
Note: See TracChangeset for help on using the changeset viewer.