| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
/* |
| 6 |
|
| 7 |
Plugin Name: JSON API Auth |
| 8 |
|
| 9 |
Plugin URI: http://downloads.wordpress.org/plugin/json-api-auth.zip |
| 10 |
|
| 11 |
Description: Extends the JSON API for user authentiocation utilizing the Wordpress cookie validation and generation. |
| 12 |
|
| 13 |
Version: 1.1 |
| 14 |
|
| 15 |
Author: mattberg, Ali Qureshi |
| 16 |
|
| 17 |
Author URI: http://www.parorrey.com |
| 18 |
|
| 19 |
License: GPLv3 |
| 20 |
|
| 21 |
*/ |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 26 |
|
| 27 |
define('JSON_API_AUTH_HOME', dirname(__FILE__)); |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
if (!is_plugin_active('json-api/json-api.php')) { |
| 32 |
|
| 33 |
add_action('admin_notices', 'pim_auth_draw_notice_json_api'); |
| 34 |
|
| 35 |
return; |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
add_filter('json_api_controllers', 'pimAuthJsonApiController'); |
| 42 |
|
| 43 |
add_filter('json_api_auth_controller_path', 'setAuthControllerPath'); |
| 44 |
|
| 45 |
load_plugin_textdomain('json-api-auth', false, basename(dirname(__FILE__)) . '/languages'); |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
function pim_auth_draw_notice_json_api() { |
| 50 |
|
| 51 |
echo '<div id="message" class="error fade"><p style="line-height: 150%">'; |
| 52 |
|
| 53 |
_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'); |
| 54 |
|
| 55 |
echo '</p></div>'; |
| 56 |
|
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
function pimAuthJsonApiController($aControllers) { |
| 62 |
|
| 63 |
$aControllers[] = 'Auth'; |
| 64 |
|
| 65 |
return $aControllers; |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
function setAuthControllerPath($sDefaultPath) { |
| 72 |
|
| 73 |
return dirname(__FILE__) . '/controllers/Auth.php'; |
| 74 |
|
| 75 |
} |