Skip to content

Commit

Permalink
Add compatibility with more API types
Browse files Browse the repository at this point in the history
  • Loading branch information
Darklg committed May 17, 2024
1 parent b931f05 commit 08d2638
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions inc/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@
include dirname( __FILE__ ) . '/values.php';
include dirname( __FILE__ ) . '/classes/csslisible.class.php';

$_posted_values = array();
if(!empty($_POST)){
$_posted_values = $_POST;
}

if (empty($_posted_values) && $_SERVER['REQUEST_METHOD'] === 'POST') {
$input = file_get_contents('php://input');
$_posted_values = json_decode($input, true);
}

$args['listing_proprietes'] = $listing_proprietes;
$CSSLisible = new CSSLisible( $args, $_POST );
$CSSLisible = new CSSLisible( $args, $_posted_values );

if ( isset( $_POST['api'] ) || isset( $_GET['api'] ) ) {
if ( isset( $_posted_values['api'] ) || isset( $_GET['api'] ) ) {
header( 'Content-type: text/css; charset=utf-8' );
exit( $CSSLisible->buffer );
}

0 comments on commit 08d2638

Please sign in to comment.