Plugin Directory

Changeset 1943420


Ignore:
Timestamp:
09/19/2018 04:19:56 AM (8 years ago)
Author:
egany
Message:

cuong.vo submit v.1.2.7

Location:
ultimate-wp-rest/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ultimate-wp-rest/trunk/includes/plugin-module-rest-api.php

    r1938717 r1943420  
    3131    $this->addApiCustomInSetting();
    3232
    33     define('UTM_WP_REST_API_AUTH_MODE', $this->PWP->setting->getOption('UTM_WP_REST_AUTH_MODE')[0]);
     33    $this->PWP->setting->setOption('UTM_WP_REST_AUTH_MODE', ['jwt']);
     34
     35    define('UTM_WP_REST_API_AUTH_MODE', $this->PWP->setting->getOption('UTM_WP_REST_AUTH_MODE')[0]);   
    3436
    3537    // Auth by Nonce
     
    198200      'section'  => 'utm_wp_restauth_api',
    199201      'type'     => 'array',
    200       'value'    => ['nonce'],
     202      'value'    => ['jwt'],
    201203      'elements' => [
    202204        ['htmltag' => 'template',
     
    214216          ],
    215217          'option'   => [
    216             'nonce' => __('Auth by Account', UTM_WP_REST_TEXTDOMAIN),
     218            //'nonce' => __('Auth by Account', UTM_WP_REST_TEXTDOMAIN),
    217219            'jwt'   => __('Auth by JWT', UTM_WP_REST_TEXTDOMAIN),
    218220          ],
  • ultimate-wp-rest/trunk/includes/rest-api/rest-api-settings.php

    r1938717 r1943420  
    1212
    1313  public function registerRestRoute() {
     14    // Get option by name
     15    register_rest_route(UTM_WP_REST_API_NAMESPACE, UTM_WP_REST_API_SETTINGS . '/option', [
     16      [
     17        'methods'  => WP_REST_Server::READABLE,
     18        'callback' => [$this, 'getOptions'],
     19      ],
     20    ]);
     21
    1422    // Get current version
    1523    register_rest_route(UTM_WP_REST_API_NAMESPACE, UTM_WP_REST_API_SETTINGS . '/version', [
     
    1927      ],
    2028    ]);
     29  }
     30
     31  public function getOptions($oRequest) {
     32    $sOptionName = isset($_GET['name']) ? trim(wp_unslash($_GET['name'])) : false;
     33    if ($sOptionName === false) {
     34      $aJson = [
     35        'code'    => 'rest_option_name_empty',
     36        'message' => __('Option name is empty!', UTM_WP_REST_TEXTDOMAIN),
     37      ];
     38      return new WP_Error($aJson, 404);
     39    }
     40
     41    $aJson = [
     42      'name'  => $sOptionName,
     43      'value' => $this->PWP->setting->getOption($sOptionName),
     44    ];
     45
     46    return new WP_REST_Response($aJson, 200);
    2147  }
    2248
  • ultimate-wp-rest/trunk/readme.txt

    r1938717 r1943420  
    5151 
    5252== Changelog ==
     53= 1.2.6 =
     54* Add API settings/option (GET)
     55* /settings/option?name=[option_name]
     56= 1.2.6 =
     57* Disable Auth by User Account
    5358= 1.2.5 =
    5459* Fixed bug UserInfo - User email existing
  • ultimate-wp-rest/trunk/ultimate_wp_rest.php

    r1938717 r1943420  
    33 * Plugin Name: Ultimate WP REST
    44 * Description: This is a plug-in for the Menus, Thumb APIs, JWT authentication, caching, and many advanced features that help you develop web and mobile applications.
    5  * Version: 1.2.5
     5 * Version: 1.2.7
    66 * Text Domain: wpr
    77 * Author: EGANY
Note: See TracChangeset for help on using the changeset viewer.