forked from publishpress/PublishPress-Future
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-expirator.php
59 lines (46 loc) · 1.93 KB
/
post-expirator.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Plugin Name: PublishPress Future
* Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
* Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
* Author: PublishPress
* Version: 2.8.2
* Author URI: http://publishpress.com
* Text Domain: post-expirator
* Domain Path: /languages
*/
use PublishPressFuture\Core\DI\ServicesAbstract;
use PublishPressFuture\Core\DI\Container;
if (! defined('PUBLISHPRESS_FUTURE_LOADED')) {
define('PUBLISHPRESS_FUTURE_LOADED', true);
try {
$autoloadPath = __DIR__ . '/vendor/autoload.php';
if (! class_exists('PublishPressFuture\\Core\\Plugin') && is_readable($autoloadPath)) {
require_once $autoloadPath;
}
$pluginFile = __FILE__;
$services = require __DIR__ . '/services.php';
$container = new Container($services);
require_once __DIR__ . '/legacy/defines.php';
require_once __DIR__ . '/legacy/functions.php';
require_once __DIR__ . '/legacy/deprecated-functions.php';
require_once __DIR__ . '/legacy/autoload.php';
$container->get(ServicesAbstract::PLUGIN)->initialize();
} catch (Exception $e) {
$trace = $e->getTrace();
$traceText = '';
foreach ($trace as $item) {
$traceText .= $item['file'] . ':' . $item['line'] . ' ' . $item['function'] . '(), ';
}
$message = sprintf(
"PUBLISHPRESS FUTURE Exception: %s: %s. Backtrace: %s",
get_class($e),
$e->getMessage(),
$traceText
);
// Make the log message binary safe removing any non-printable chars.
$message = addcslashes($message, "\000..\037\177..\377\\");
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log($message);
}
}