Plugin Directory

Changeset 2321317


Ignore:
Timestamp:
06/10/2020 05:10:07 AM (6 years ago)
Author:
wprequal
Message:

Commit v7.7.1

Location:
wprequal/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wprequal/trunk/app/classes/class.Core.php

    r2315196 r2321317  
    168168
    169169        wp_localize_script( 'wprequal_js', 'wprequal', array(
    170             'endpoint'       => $this->entry_endpoint(),
    171             'nonce_endpoint' => $this->nonce_endpoint(),
     170            'endpoint'       => $this->endpoint( 'entry' ),
     171            'nonce_endpoint' => $this->endpoint( 'nonce' ),
    172172            'processing'     => 'Sending'
    173173        ));
     
    210210
    211211    /**
    212      * Entry Endpoint
    213      *
    214      * @since 5.6
     212     * Endpoint.
     213     *
     214     * @param $param
    215215     *
    216216     * @return string
    217217     */
    218218
    219     public function entry_endpoint() {
    220         return site_url( '/wp-json/wprequal/1.0/entry/' );
    221     }
    222 
    223     /**
    224      * Nonce Endpoint
    225      *
    226      * @since 5.6
    227      *
    228      * @return string
    229      */
    230 
    231     public function nonce_endpoint() {
    232         return site_url( '/wp-json/wprequal/' . WPREQUAL_VERSION . '/nonce/' );
     219    public function endpoint( $param ) {
     220
     221        return trailingslashit( join( '/', [
     222            home_url(),
     223            'wp-json',
     224            'wprequal',
     225            WPREQUAL_VERSION,
     226            $param
     227        ] ) );
     228
    233229    }
    234230
  • wprequal/trunk/app/classes/class.Entry.php

    r2315196 r2321317  
    5050
    5151        register_rest_route(
    52             'wprequal/1.0/',
    53             'entry/',
     52            'wprequal/' . WPREQUAL_VERSION,
     53            '/entry/',
    5454            array(
    5555                'methods'  => WP_REST_Server::EDITABLE,
     
    186186
    187187}
    188 
    189 add_action( 'rest_api_init', function() {
    190     $bg_api = Entry::instance();
    191     $bg_api->register_route();
    192 } );
  • wprequal/trunk/app/classes/class.Nonce.php

    r2315196 r2321317  
    4545    }
    4646
     47    /**
     48     * Register route.
     49     */
     50
    4751    public function register_route() {
    4852
     
    5054            'wprequal/' . WPREQUAL_VERSION,
    5155            '/nonce/',
    52             array(
     56            [
    5357                'methods'  => WP_REST_Server::READABLE,
    54                 'callback' => array( $this, 'get_nonce' )
    55             )
     58                'callback' => [ $this, 'nonce' ]
     59            ]
    5660        );
    5761
     
    6468     */
    6569
    66     public function get_nonce() {
    67         return wp_create_nonce( WPREQUAL_NONCE_KEY );;
     70    public function nonce() {
     71        return wp_create_nonce( WPREQUAL_NONCE_KEY );
    6872    }
    6973
    7074}
    71 
    72 add_action( 'rest_api_init', function() {
    73     $nonce = Nonce::instance();
    74     $nonce->register_route();
    75 } );
  • wprequal/trunk/readme.txt

    r2315196 r2321317  
    159159== Change Log ==
    160160
     161= 7.7.1 =
     162* Tweek - Add version to endpoints
     163* Tweek - Consolidare register endpoints
     164* Bug Fix - Use home_url() for WP REST API endpoints
     165
    161166= 7.7 =
    162167* Tweek - Remove global variable $wprequal
  • wprequal/trunk/wprequal.php

    r2315196 r2321317  
    44Plugin URI:  https://wprequal.com
    55Description: Mortgage and Real Estate Lead Capture System
    6 Version:     7.7
     6Version:     7.7.1
    77Author:      WPrequal
    88Author URI:  https://wprequal.com
     
    2828namespace WPrequal;
    2929
     30use WPrequal\App\Entry;
     31use WPrequal\App\Nonce;
     32
    3033$uploads = wp_get_upload_dir();
    3134
     
    3740
    3841$constants = array(
    39     'WPREQUAL_VERSION'            => '7.7',
     42    'WPREQUAL_VERSION'            => '7.7.1',
    4043    'WPREQOAL_PLUGIN'             => plugin_basename( __FILE__ ),
    4144    'WPREQUAL_OPTIONS'            => 'wprequal_options',
     
    7578} );
    7679
     80// Register endpoints.
     81add_action( 'rest_api_init', function() {
     82
     83    // Nonce endpoint.
     84    App\Nonce::instance()->register_route();
     85    // Entry endpoint.
     86    App\Entry::instance()->register_route();
     87
     88} );
     89
    7790// Activate the plugin.
    7891register_activation_hook( __FILE__, 'WPrequal\App\activate' );
Note: See TracChangeset for help on using the changeset viewer.