Skip to content
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

Updating to 1.2.1, minor documentation changes. #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can install this using all the usual methods. The only thing different is th

= Where is the documentation for the API? =

Take a look at the [github page](http://github.com/remkade/multisite-json-api/) for the full documentation.
Take a look at the [github page](https://github.com/remkade/multisite-json-api/) for the full documentation.

== Screenshots ==

Expand Down
2 changes: 1 addition & 1 deletion admin/class-multisite-json-api-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Multisite_JSON_API_Admin
* @author Kyle Leaders <[email protected]>
* @license GPL-2.0+
* @link http://github.com/remkade/multisite-json-api/
* @link https://github.com/remkade/multisite-json-api/
* @copyright 2014 Kyle Leaders
*/

Expand Down
4 changes: 2 additions & 2 deletions includes/class-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function respond_with_json($payload, $status=200) {
* @since '0.0.1'
* @return void
*/
public function error($error, $error_id, $status=400, $url='http://github.com/remkade/multisite-json-api/wiki') {
public function error($error, $error_id, $status=400, $url='https://github.com/remkade/multisite-json-api/wiki') {
$output = array('id'=> $error_id, 'message' => $error, 'url' => $url);
$this->respond_with_json($output, $status);
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public function get_site_by_id($id) {
public function content_for_admin_site_creation_notification($site_id) {
$site = $this->get_site_by_id($site_id);
if($site) {
$url = 'http://'.$site->domain.$site->path;
$url = 'https://'.$site->domain.$site->path;
return sprintf("New site created by Multisite JSON API\n\n\tUser: %s\n\n\n\tAddress: %s",
wp_get_current_user()->login,
$url);
Expand Down
8 changes: 4 additions & 4 deletions includes/exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ class GenericException extends \Exception {
public $url;
public $id;

public function __construct($message = '', $id = '', $url = 'http://github.com/remkade/multisite-json-api', $code = 400, Exception $previous = null) {
public function __construct($message = '', $id = '', $url = 'https://github.com/remkade/multisite-json-api', $code = 400, Exception $previous = null) {
parent::__construct($message, $code);
$this->url = $url;
$this->id = $id;
}
}

class SiteNotFoundException extends GenericException {
public function __construct($message = 'Unable to Find Site', $id = 'site_not_found', $url = 'http://github.com/remkade/multisite-json-api') {
public function __construct($message = 'Unable to Find Site', $id = 'site_not_found', $url = 'https://github.com/remkade/multisite-json-api') {
parent::__construct($message, $id, $url, 404);
}
}
class SiteCreationException extends GenericException {
public function __construct($message = 'Error Creating Site', $id = 'site_creation_error', $url = 'http://github.com/remkade/multisite-json-api') {
public function __construct($message = 'Error Creating Site', $id = 'site_creation_error', $url = 'https://github.com/remkade/multisite-json-api') {
parent::__construct($message, $id, $url, 400);
}
}

class UserCreationException extends GenericException {
public function __construct($message = 'Error Creating User', $id = 'user_creation_error', $url = 'http://github.com/remkade/multisite-json-api') {
public function __construct($message = 'Error Creating User', $id = 'user_creation_error', $url = 'https://github.com/remkade/multisite-json-api') {
parent::__construct($message, $id, $url, 400);
}
}
15 changes: 7 additions & 8 deletions multisite-json-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
* also follow WordPress Coding Standards and PHP best practices.
*
* @package Multisite_JSON_API
* @author Kyle Leaders <kyle@technicasites.com>
* @author Kyle Leaders <kyle.leaders@gmail.com>
* @license GPL-2.0+
* @link http://technicasites.com
* @copyright 2014 Technica Sites LLC
* @link https://technicasites.com/
* @copyright 2023 Technica Sites LLC
*
* @wordpress-plugin
* Plugin Name: Multisite JSON API
* Plugin URI: http://github.com/remkade/multisite-json-api
* Plugin URI: https://github.com/remkade/multisite-json-api
* Description: A JSON API for managing multisite sites
* Version: 1.2.0
* Version: 1.2.1
* Author: Kyle Leaders
* Author URI: http://github.com/remkade
* Author URI: https://github.com/remkade
* Text Domain: en_US
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/remkade/multisite-json-api
* WordPress-Plugin-Boilerplate: v2.6.1
Expand Down Expand Up @@ -58,5 +58,4 @@
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
require_once( plugin_dir_path( __FILE__ ) . 'admin/class-multisite-json-api-admin.php' );
add_action( 'plugins_loaded', array( 'Multisite_JSON_API_Admin', 'get_instance' ) );

}
6 changes: 3 additions & 3 deletions public/class-multisite-json-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package Multsite_JSON_API
* @author Kyle Leaders <[email protected]>
* @license GPL-2.0+
* @link http://github.com/remkade/multisite-json-api
* @copyright 2014 Kyle Leaders
* @link https://github.com/remkade/multisite-json-api
* @copyright 2023 Technica Sites LLC
*/

/**
Expand All @@ -30,7 +30,7 @@ class Multisite_JSON_API {
*
* @var string
*/
const VERSION = '1.2.0';
const VERSION = '1.2.1';

/**
* @TODO - Rename "plugin-name" to the name of your plugin
Expand Down
10 changes: 5 additions & 5 deletions tests/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ protected function setUp() : void {
}

public function testErrorConformsToHerokuErrors(){
$this->expectOutputString("{\n \"id\": \"error_id\",\n \"message\": \"Error!\",\n \"url\": \"http://github.com/remkade/multisite-json-api/wiki\"\n}");
$this->expectOutputString("{\n \"id\": \"error_id\",\n \"message\": \"Error!\",\n \"url\": \"https://github.com/remkade/multisite-json-api/wiki\"\n}");
$this->api->error("Error!", "error_id", 400);
}

public function testJSONException(){
$this->expectOutputString("{\n \"id\": \"site_creation_error\",\n \"message\": \"Error Creating Site\",\n \"url\": \"http://github.com/remkade/multisite-json-api\"\n}");
$this->expectOutputString("{\n \"id\": \"site_creation_error\",\n \"message\": \"Error Creating Site\",\n \"url\": \"https://github.com/remkade/multisite-json-api\"\n}");
$this->api->json_exception(new SiteCreationException());
}

Expand Down Expand Up @@ -264,7 +264,7 @@ public function testGetMissingSiteById() {

public function testContentsForAdminSiteNotification() {
$output = $this->api->content_for_admin_site_creation_notification(2);
$this->assertEquals("New site created by Multisite JSON API\n\n\tUser: user\n\n\n\tAddress: http://widgets.example.com/", $output);
$this->assertEquals("New site created by Multisite JSON API\n\n\tUser: user\n\n\n\tAddress: https://widgets.example.com/", $output);
}

public function testContentsForAdminSiteNotificationWithMissingSite() {
Expand All @@ -275,14 +275,14 @@ public function testContentsForAdminSiteNotificationWithMissingSite() {
public function testSanityCheckWhenNotMultisiteButActive() {
self::$is_multisite = false;
self::$plugin_is_active = true;
$this->expectOutputString("{\n \"id\": \"not_multisite\",\n \"message\": \"This is not a multisite install! Please enable multisite to use this plugin.\",\n \"url\": \"http://codex.wordpress.org/Create_A_Network\"\n}");
$this->expectOutputString("{\n \"id\": \"not_multisite\",\n \"message\": \"This is not a multisite install! Please enable multisite to use this plugin.\",\n \"url\": \"https://codex.wordpress.org/Create_A_Network\"\n}");
$this->api->sanity_check();
}

public function testSanityCheckWhenActivatedButNotMultiSite() {
self::$is_multisite = true;
self::$plugin_is_active = false;
$this->expectOutputString("{\n \"id\": \"plugin_not_active\",\n \"message\": \"This plugin is not active, please activate it network wide before using.\",\n \"url\": \"http://codex.wordpress.org/Create_A_Network\"\n}");
$this->expectOutputString("{\n \"id\": \"plugin_not_active\",\n \"message\": \"This plugin is not active, please activate it network wide before using.\",\n \"url\": \"https://codex.wordpress.org/Create_A_Network\"\n}");
$this->api->sanity_check();
}

Expand Down