| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: JSON API Auth |
| 5 |
Plugin URI: http://downloads.wordpress.org/plugin/json-api-auth.zip |
| 6 |
Description: Extends the JSON API for user authentiocation utilizing the Wordpress cookie validation and generation. |
| 7 |
Version: 1.0 |
| 8 |
Author: mattberg, Ali Qureshi |
| 9 |
Author URI: http://www.parorrey.com |
| 10 |
License: GPLv3 |
| 11 |
*/ |
| 12 |
|
| 13 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 14 |
define('JSON_API_AUTH_HOME', dirname(__FILE__)); |
| 15 |
|
| 16 |
if (!is_plugin_active('json-api/json-api.php')) { |
| 17 |
add_action('admin_notices', 'pim_auth_draw_notice_json_api'); |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
add_filter('json_api_controllers', 'pimAuthJsonApiController'); |
| 22 |
add_filter('json_api_auth_controller_path', 'setAuthControllerPath'); |
| 23 |
load_plugin_textdomain('json-api-auth', false, basename(dirname(__FILE__)) . '/languages'); |
| 24 |
|
| 25 |
function pim_auth_draw_notice_json_api() { |
| 26 |
echo '<div id="message" class="error fade"><p style="line-height: 150%">'; |
| 27 |
_e('<strong>JSON API Auth</strong></a> requires the JSON API plugin to be activated. Please <a href="wordpress.org/plugins/json-api/">install / activate JSON API</a> first.', 'json-api-user'); |
| 28 |
echo '</p></div>'; |
| 29 |
} |
| 30 |
|
| 31 |
function pimAuthJsonApiController($aControllers) { |
| 32 |
$aControllers[] = 'Auth'; |
| 33 |
return $aControllers; |
| 34 |
} |
| 35 |
|
| 36 |
function setAuthControllerPath($sDefaultPath) { |
| 37 |
return dirname(__FILE__) . '/controllers/Auth.php'; |
| 38 |
} |