-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
64 lines (46 loc) · 1.62 KB
/
Copy pathindex.php
File metadata and controls
64 lines (46 loc) · 1.62 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
defined('ABSPATH') or die();
if ( ! function_exists( 'populater' ) ) :
function populater( $arg = false ) {
static $o;
return $arg === false ? $o : ( $o = $arg );
}
endif;
if( defined('POPULATER_IS_PLUGIN') ) {
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/vendor/tangible/fields/index.php';
} else {
require_once __DIR__ . '/../../autoload.php';
require_once __DIR__ . '/../fields/index.php';
}
new class extends stdClass {
public $name = 'populater';
// Remember to update the version - Expected format: YYYYMMDD
public $version = '20230818';
function __construct() {
$name = $this->name;
$priority = 99999999 - absint( $this->version );
remove_all_filters( $name, $priority );
add_action( $name, [ $this, 'load' ], $priority );
$ensure_action = function() use ( $name ) {
if ( ! did_action( $name )) do_action( $name );
};
add_action('plugins_loaded', $ensure_action, 0);
add_action('after_setup_theme', $ensure_action, 0);
}
function __call( $method = '', $args = [] ) {
if ( isset( $this->$method ) ) {
return call_user_func_array( $this->$method, $args );
}
$caller = current( debug_backtrace() );
trigger_error("Undefined method \"$method\" for {$this->name}, called from <b>{$caller['file']}</b> in <b>{$caller['line']}</b><br>", E_USER_WARNING);
}
function load() {
remove_all_filters( $this->name ); // First one to load wins
populater( $this );
$populater = $this;
$fields = tangible_fields();
// Load module features
require_once __DIR__ . '/generators/index.php';
}
};