Plugin Directory

Changeset 2833264


Ignore:
Timestamp:
12/13/2022 07:56:31 PM (3 years ago)
Author:
aixeiger
Message:

refactor main class and document it

Location:
lock-login/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lock-login/trunk/Readme.txt

    r2825392 r2833264  
    33Tags: security, login, lock, unlock, login failed
    44Tested up to: 6.1
    5 Stable tag: 0.1.4
     5Stable tag: 0.1.5
    66Requires PHP: 7.4
    77License: GPLv2 or later
     
    24240.1.3       31-oct-22       Add an admin panel for unlock users gracefully
    25250.1.4       28-nov-22       Add the version of the browser for understand if is a bot or a real browser
     260.1.5       13-dic-22       Refactor the main class application for one step on instantiation and document the App class
  • lock-login/trunk/includes/App.php

    r2825392 r2833264  
    66class App
    77{
     8    private static $instance = null;
     9
    810    private $db;
    911
     
    2426        add_action('admin_init', array($this, 'unlock_users'));
    2527        add_action('admin_menu', array($this, 'register_admin_menu'));
     28    }
     29
     30    /**
     31     * Static function for boot the application
     32     */
     33    public static function boot()
     34    {
     35        if(static::$instance === null){
     36            static::$instance = new static();
     37        }
    2638    }
    2739
     
    6274    }
    6375
     76    /**
     77     * @param   $error_code     array
     78     *
     79     * @return  $error_cores    array
     80     */
    6481    public function failure_shake($error_code)
    6582    {
     
    6885    }
    6986
     87    /**
     88     * @return  anonymous   array
     89     */
    7090    private function get_server_data()
    7191    {
     
    82102    }
    83103
     104    /**
     105     * Add two more types of schedules, one for 20 minutes and other for 30 minutes
     106     *
     107     * @param   $schedules  array
     108     *
     109     * @return  $schedules  array
     110     */
    84111    public function cron_schedules($schedules)
    85112    {
     
    97124    }
    98125
     126    /**
     127     * Unlock a determinated user for allow to login once again
     128     */
    99129    public function unlock_users()
    100130    {
     
    106136    }
    107137
     138    /**
     139     * Register the admin menu for the wordpress panel
     140     */
    108141    public function register_admin_menu()
    109142    {
     
    118151    }
    119152
     153    /**
     154     * Callback function for construct the admin page
     155     */
    120156    public function admin_callback()
    121157    {
  • lock-login/trunk/locklogin.php

    r2825392 r2833264  
    55 * Author: TocinoDev
    66 * Author URI: https://tocino.mx
    7  * Version: 0.1.4
     7 * Version: 0.1.5
    88 * Tested up to: 6.0
    99 * Requires PHP: 7.4
     
    2020require 'vendor/autoload.php';
    2121
    22 function lockloginstart()
    23 {
    24     static $instance = null;
    25 
    26     if($instance === null){
    27         $instance = new LockloginApp();
    28     }
    29 
    30     return $instance;
    31 }
    32 
    33 lockloginstart();
     22LockloginApp::boot();
Note: See TracChangeset for help on using the changeset viewer.