| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin entry file. |
| 4 |
* |
| 5 |
* Defines the path / file constants, loads the Composer autoloader, |
| 6 |
* loads the text domain, and hands off to {@see Core::instance()} to |
| 7 |
* boot every module in phased order. |
| 8 |
* |
| 9 |
* This file is intentionally minimal — the rule of thumb is "no |
| 10 |
* runtime logic in the bootstrap." Each subsystem (settings storage, |
| 11 |
* session guard, admin UI, REST API, Freemius) lives behind its own |
| 12 |
* class under `includes/` and registers its own hooks from there. |
| 13 |
* |
| 14 |
* @package DuckDev\Loggedin |
| 15 |
* @author Joel James |
| 16 |
* @copyright 2025 Joel James |
| 17 |
* @license GPL-2.0+ |
| 18 |
* |
| 19 |
* @wordpress-plugin |
| 20 |
* Plugin Name: Loggedin - Limit Concurrent Sessions |
| 21 |
* Plugin URI: https://duckdev.com/products/loggedin-limit-active-logins/ |
| 22 |
* Description: Limit an account to a specific number of simultaneous logins across all devices. |
| 23 |
* Version: 3.0.1 |
| 24 |
* Author: Joel James |
| 25 |
* Author URI: https://duckdev.com/ |
| 26 |
* Donate link: https://paypal.me/JoelCJ |
| 27 |
* License: GPL-2.0+ |
| 28 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 29 |
* Text Domain: loggedin |
| 30 |
* Domain Path: /languages |
| 31 |
* Requires PHP: 7.4 |
| 32 |
* Requires at least: 6.0 |
| 33 |
*/ |
| 34 |
|
| 35 |
namespace DuckDev\Loggedin; |
| 36 |
|
| 37 |
defined( 'WPINC' ) || die; |
| 38 |
|
| 39 |
/** |
| 40 |
* Absolute filesystem path to the plugin directory, with trailing slash. |
| 41 |
* |
| 42 |
* Used everywhere we need to include or read a file shipped inside |
| 43 |
* the plugin (the autoloader, the React bundle in `build/`, the |
| 44 |
* language files, etc.). Defined here once so individual classes |
| 45 |
* can read it via `Plugin::dir()` without ever recomputing it. |
| 46 |
*/ |
| 47 |
define( 'LOGGEDIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 48 |
|
| 49 |
/** |
| 50 |
* Absolute filesystem path to *this file*. |
| 51 |
* |
| 52 |
* Freemius needs the main plugin file path during instance creation |
| 53 |
* (it derives the plugin basename from it). Captured here so we don't |
| 54 |
* have to thread it through every constructor. |
| 55 |
*/ |
| 56 |
define( 'LOGGEDIN_FILE', __FILE__ ); |
| 57 |
|
| 58 |
if ( ! function_exists( __NAMESPACE__ . '\\init' ) ) { |
| 59 |
/** |
| 60 |
* Boot the plugin once core has finished loading. |
| 61 |
* |
| 62 |
* Wrapped in a `function_exists` guard so a second copy of the |
| 63 |
* plugin loaded from a different directory (a stray symlink, a |
| 64 |
* dev clone) can't redefine the function and silently shadow the |
| 65 |
* first init call. The function: |
| 66 |
* |
| 67 |
* 1. Loads the plugin text domain so any string surfaced during |
| 68 |
* boot (e.g. an admin notice from the upgrader) is already |
| 69 |
* translatable. |
| 70 |
* 2. Pulls in the Composer autoloader. |
| 71 |
* 3. Hands off to {@see Core::instance()}, which is responsible |
| 72 |
* for wiring every module in order. |
| 73 |
* |
| 74 |
* @since 2.0.0 |
| 75 |
* |
| 76 |
* @return void |
| 77 |
*/ |
| 78 |
function init(): void { |
| 79 |
load_plugin_textdomain( |
| 80 |
'loggedin', |
| 81 |
false, |
| 82 |
dirname( plugin_basename( __FILE__ ) ) . '/languages/' |
| 83 |
); |
| 84 |
|
| 85 |
require __DIR__ . '/vendor/autoload.php'; |
| 86 |
|
| 87 |
Core::instance(); |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\\init' ); |
| 92 |
|