-
Notifications
You must be signed in to change notification settings - Fork 4
/
wpurl.php
49 lines (39 loc) · 1.2 KB
/
wpurl.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
#!/usr/bin/env php
<?php
/**
* wpurl
*
* 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) 2012 88mph. (http://88mph.com)
* @license GNU
*/
/**
* @file
* wpurl is a PHP script implementing a command line shell for WordPress.
*
* @requires PHP CLI 5.2.0, or newer.
* @since 0.1
*/
// Start output buffering to stop WordPress from spitting out its usual output.
ob_start("strip_tags");
define('WPURL_BASE_PATH', dirname(__FILE__));
define('WPURL_LIB_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-config.php')){
// Load WordPress libs.
$wpconfig = file_get_contents('wp-config.php');
// Load wpdmin libs.
require_once WPURL_LIB_PATH . '/WpUrl.php';
// Run WpUrl::exec() method, pass in user input and wpconfig content.
WpUrl::exec($argv, $wpconfig);
}else{
die("Either this is not a WordPress document root or you do not have permission to read these site files. \n");
}
ob_end_flush();