-
Notifications
You must be signed in to change notification settings - Fork 0
/
protected-pages.php
38 lines (31 loc) · 1.23 KB
/
protected-pages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
Plugin Name: Protected Pages
Plugin URI: https://github.com/dashifen/protected-pages
Description: A WordPress plugin to create protected pages available from from a list of specified domains.
Version: 2.0.5
Author: David Dashifen Kees
Author URI: https://dashifen.com
Text Domain: protected-pages
Domain Path: /languages
*/
// if this file is called directly, abort.
if (!defined("WPINC")) {
die;
}
// in the past, i've edited the version number above without doing so here.
// to avoid this, and because this file is short, i read this file's content
// and rip the version out of the comment for our definition here.
$content = file_get_contents(__FILE__);
preg_match("/Version: ([\.0-9]+)/", $content, $matches);
define("PROTECTED_PAGES_VERSION", $matches[1]);
// now, there's two files to include: our PSR-4 autoloader and the
// PHP file which initializes our plugin. my IDE gets confused when
// trying to include these files as it finds the $path variable
// incomprehensible in this context. but, it ignores dynamic includes
// so we'll do that instead.
$path = plugin_dir_path(__FILE__);
$autoloader = $path . "vendor/autoload.php";
$plugin = $path . "src/protected-pages.php";
require_once $autoloader;
require_once $plugin;