PluginProbe
BetterLinks – Link Shortener, Link Cloaking, Redirects, Affiliate Link Manager & MCP / trunk
BetterLinks – Link Shortener, Link Cloaking, Redirects, Affiliate Link Manager & MCP vtrunk
3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 3.0.0 2.4.13 2.4.12 2.4.11 2.4.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 110 releases
betterlinks / includes / API.php

API.php in BetterLinks – Link Shortener, Link Cloaking, Redirects, Affiliate Link Manager & MCP trunk, at includes/API.php

34 lines 869 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace BetterLinks;
3 if ( ! defined( 'ABSPATH' ) ) { exit; }
4
5 class API {
6
7 public static function init() {
8 new API\Settings();
9 new API\Links();
10 new API\Terms();
11 new API\Clicks();
12 new API\Geolocation();
13 new API\QuickLink();
14 new API\AIBulkLinks();
15 }
16 public static function dispatch_hook() {
17 $self = new self();
18 add_filter( 'jwt_auth_whitelist', array( $self, 'whitelist_API' ) );
19 add_filter( 'rest_url', array( $self, 'rest_url_ssl' ) );
20 }
21 public function whitelist_API( $endpoints ) {
22 $endpoints[] = '/wp-json/' . BETTERLINKS_PLUGIN_SLUG . '/v1/*';
23 $endpoints[] = '/index.php?rest_route=/' . BETTERLINKS_PLUGIN_SLUG . '/v1/*';
24 return $endpoints;
25 }
26 public function rest_url_ssl( $url ) {
27 if ( is_ssl() || ( is_admin() && force_ssl_admin() ) ) {
28 $url = set_url_scheme( $url, 'https' );
29 return $url;
30 }
31 return $url;
32 }
33 }
34