PluginProbe
BetterLinks – Link Shortener, Link Cloaking, Redirects, Affiliate Link Manager & MCP / 2.4.13
BetterLinks – Link Shortener, Link Cloaking, Redirects, Affiliate Link Manager & MCP v2.4.13
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 2.4.13, at includes/API.php

33 lines 846 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\AIBulkLinks();
14 }
15 public static function dispatch_hook() {
16 $self = new self();
17 add_filter( 'jwt_auth_whitelist', array( $self, 'whitelist_API' ) );
18 add_filter( 'rest_url', array( $self, 'rest_url_ssl' ) );
19 }
20 public function whitelist_API( $endpoints ) {
21 $endpoints[] = '/wp-json/' . BETTERLINKS_PLUGIN_SLUG . '/v1/*';
22 $endpoints[] = '/index.php?rest_route=/' . BETTERLINKS_PLUGIN_SLUG . '/v1/*';
23 return $endpoints;
24 }
25 public function rest_url_ssl( $url ) {
26 if ( is_ssl() || ( is_admin() && force_ssl_admin() ) ) {
27 $url = set_url_scheme( $url, 'https' );
28 return $url;
29 }
30 return $url;
31 }
32 }
33