functions.php: allow json API access from src.openmamba.org
This commit is contained in:
parent
ae6269ac58
commit
d250402a3c
@ -209,12 +209,13 @@ function openmamba_download_func( $atts ) {
|
|||||||
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
|
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
|
||||||
$ret .= openmamba_download_link($milestone,$medium,$currarch,$ext,$langs[$outputlang],$outputlang);
|
$ret .= openmamba_download_link($milestone,$medium,$currarch,$ext,$langs[$outputlang],$outputlang);
|
||||||
}
|
}
|
||||||
|
$out .= "";
|
||||||
foreach ($langs as $l => $lang) {
|
foreach ($langs as $l => $lang) {
|
||||||
if ($l == $outputlang) continue;
|
if ($l == $outputlang) continue;
|
||||||
reset($archname);
|
reset($archname);
|
||||||
foreach($archname as $ey => $currarch) {
|
foreach($archname as $ey => $currarch) {
|
||||||
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
|
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
|
||||||
$out = openmamba_download_link($milestone,$medium,$currarch,$ext,$lang,$l);
|
$out .= openmamba_download_link($milestone,$medium,$currarch,$ext,$lang,$l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ret .= do_shortcode("[expand title=\"". __("More languages...","responsive") . "\"]". $out ."[/expand]");
|
$ret .= do_shortcode("[expand title=\"". __("More languages...","responsive") . "\"]". $out ."[/expand]");
|
||||||
@ -437,7 +438,7 @@ add_action('admin_init', 'wpb_imagelink_setup', 10);
|
|||||||
|
|
||||||
/* Security: restrict access to wp-json */
|
/* Security: restrict access to wp-json */
|
||||||
function restrict_rest_api_to_localhost() {
|
function restrict_rest_api_to_localhost() {
|
||||||
$whitelist = [ '127.0.0.1', "::1" ];
|
$whitelist = [ '127.0.0.1', "::1", '176.9.120.93', '2a01:4f8:151:7444::1:3' ];
|
||||||
|
|
||||||
if( ! in_array($_SERVER['REMOTE_ADDR'], $whitelist ) ){
|
if( ! in_array($_SERVER['REMOTE_ADDR'], $whitelist ) ){
|
||||||
die( 'REST API is disabled.' );
|
die( 'REST API is disabled.' );
|
||||||
|
Loading…
Reference in New Issue
Block a user