get( 'any-ipsum-api-request' ) === '1' ) { $this->handle_api_request(); } } function handle_api_request() { header( 'Access-Control-Allow-Origin: *' ); $type = WPAnyIpsumCore::get_request( 'type' ); $callback = WPAnyIpsumCore::get_request( 'callback' ); if ( ! empty ( $type ) || ! empty ( $callback ) ) { $args = apply_filters( 'anyipsum-parse-request-args', $_SERVER['REQUEST_METHOD'] === 'POST' ? $_REQUEST : $_SERVER['QUERY_STRING'] ); $paras = apply_filters( 'anyipsum-generate-filler', $args ); if ( ! empty( $args['callback'] ) ) { header( "Content-Type: application/javascript" ); echo $args['callback'] . '(' . json_encode( $paras ) . ');'; } else { header( "Content-Type: application/json; charset=utf-8" ); echo json_encode( $paras ); } exit; } } } }