Skip to content

Fixed Documentation and minor code errors #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,27 @@ Authentication
--------------
All of the enpoints require you to authenticate with an existing wordpress user. Currently all require the superadmin role, but that may change.

Username and password are passed with the HTTP Headers `Username` and `Password` respectively. These are plain text so you need to be using SSL (which you are doing already right?).
Username and password are passed with the HTTP Headers `User` and `Password` respectively. These are plain text so you need to be using SSL (which you are doing already right?).

Create Site
-----------
- **URL:** /wp-content/multisite-json-api/endpoints/create-site.php
- **URL:** /wp-content/plugins/multisite-json-api/endpoints/create-site.php
- **Method:** POST
- **Works with subdomains?:** yes
- **Works with subdirectories?** yes
- **Payload example:** `{"email": "user@example.com", "site_name": "awesomeblog", "title": "Awesome Blog"}`
- **Description:** Creates a site. If the email address does not exist this will create a new user with that email address. The `site_name` is the the path or subdomain you would like to use.

List Sites
----------
- **URL:** /wp-content/multisite-json-api/endpoints/list-sites.php
- **URL:** /wp-content/plugins/multisite-json-api/endpoints/list-sites.php
- **Method:** GET
- **Works with subdomains?:** yes
- **Works with subdirectories?** yes
- **Payload example:** No payload, only GET variables
- **GET Variables:** public, spam, archived, deleted
- **Description:** Lists sites by wordpress tags. All of the variables are boolean 0 or 1, and will list sites where that variable is set to the boolean provided. For example: `?public=1&deleted=0` will list all sites that are public but not deleted.

Delete Site
-----------
- **URL:** /wp-content/multisite-json-api/endpoints/delete-site.php
- **URL:** /wp-content/plugins/multisite-json-api/endpoints/delete-site.php
- **Method:** DELETE
- **Works with subdomains?:** yes
- **Works with subdirectories?** yes
- **Payload example:** `{"blog_id": 49, "drop": false}`
- **Description:** Deletes a site. If `drop` is set to `true` wordpress will remove the site from the database completely. Otherwise the only thing this does is set the `deleted` attribute on the site to `true`.

Expand Down
10 changes: 0 additions & 10 deletions admin/class-multisite-json-api-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ class Multisite_JSON_API_Admin {
*/
private function __construct() {

/*
* @TODO :
*
* - Uncomment following lines if the admin class should only be available for super admins
*/
if( ! is_super_admin() ) {
return;
}
Expand Down Expand Up @@ -83,11 +78,6 @@ private function __construct() {
*/
public static function get_instance() {

/*
* @TODO :
*
* - Uncomment following lines if the admin class should only be available for super admins
*/
if( ! is_super_admin() ) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion endpoints/create-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$errors = array();
// Domain is valid?
if(!$api->is_valid_sitename($api->json->site_name)) {
$api->errors("invalid_site_name", "Invalid site_name '" . $api->json->site_name . "'", 400);
$api->error("invalid_site_name", "Invalid site_name '" . $api->json->site_name . "'", 400);
die();
}
// Next check Email is valid
Expand Down
2 changes: 1 addition & 1 deletion endpoints/list-sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if(isset($_GET['deleted']))
$deleted = $_GET['deleted'];

$sites = wp_get_sites(array(
$sites = get_sites(array(
"public" => $public,
"spam" => $spam,
"archived" => $archived,
Expand Down