Caldera_Forms_API_Util

Utility functions for Caldera Forms REST API.

Defined (1)

The class is defined in the following location(s).

/classes/api/util.php  
  1. class Caldera_Forms_API_Util { 
  2.  
  3. /** 
  4. * The namespace for Caldera Forms REST API 
  5. * @since 1.4.4 
  6. * @return string 
  7. */ 
  8. public static function api_namespace() { 
  9. return 'cf-api/v2'; 
  10.  
  11. /** 
  12. * The URL for Caldera Forms REST API 
  13. * @since 1.4.4 
  14. * @param string $endpoint Optional. Endpoint. 
  15. * @return string 
  16. */ 
  17. public static function url( $endpoint = '' ) { 
  18. return rest_url( self::api_namespace() . '/' . $endpoint ); 
  19.  
  20. public static function check_api_token( WP_REST_Request $request ) { 
  21. $allowed = false; 
  22. if( false != ( $token = $request->get_header( 'x_cf_entry_token') ) && is_string( $request[ 'form_id' ] ) ) { 
  23. $allowed = Caldera_Forms_API_Token::check_token( $token, $request[ 'form_id' ] ); 
  24.  
  25. return $allowed; 
  26.