forked from kieranmasterton/wpurl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpadmin.php
53 lines (43 loc) · 1.38 KB
/
wpadmin.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
#!/usr/bin/env php
<?php
/**
* wpadmin
*
* Coded to Zend's coding standards:
* http://framework.zend.com/manual/en/coding-standard.html
*
* File format: UNIX
* File encoding: UTF8
* File indentation: Spaces (4). No tabs
*
* @copyright Copyright (c) 2011 88mph. (http://88mph.co)
* @license GNU
*/
/**
* @file
* wpadmin is a PHP script implementing a command line shell for WordPress.
*
* @requires PHP CLI 5.2.0, or newer.
* @since 0.0.1
*/
// Start output buffering to stop WordPress from spitting out its usual output.
ob_start("strip_tags");
define('WPADMIN_BASE_PATH', dirname(__FILE__));
define('WPADMIN_LIBS_PATH', dirname(__FILE__) . '/lib');
// Does the user have access to read the directory? If so, allow them to use the
// command line tool.
if(true == is_readable('wp-load.php')){
// Load WordPress libs.
require_once('wp-load.php');
require_once(ABSPATH . WPINC . '/template-loader.php');
require_once(ABSPATH . 'wp-admin/includes/admin.php');
// Load wpdmin libs.
require_once WPADMIN_LIBS_PATH . '/WpAdmin.php';
require_once WPADMIN_LIBS_PATH . '/WpAdmin/User.php';
require_once WPADMIN_LIBS_PATH . '/WpAdmin/Option.php';
WpAdmin::exec($argv);
}else{
die("Either this is not a WordPress document root or you do not have
permission to administer this site. \n");
}
ob_end_flush();