%s', $match->url, $match->title, $match->subtype ); } return implode( PHP_EOL, $output ); } function no_results( $error = false ) { $response = [ "response_type" => "in_channel", "blocks" => [ [ "type" => "section", "text" => [ "type" => "mrkdwn", "text" => $error ? "Error" : "No results" ] ], [ "type" => "context", "elements" => [ [ "type" => "mrkdwn", "text" => sprintf( '<%s|Source code>', 'https://gist.github.com/trepmal/7fa4df42bf6ddaa8901bd6d859f9588f' ) ], [ "type" => "plain_text", "text" => ':heart: @trepmal' ] ] ], ] ]; header( 'Content-Type: application/json' ); die( json_encode( $response ) ); } $response = [ "response_type" => "in_channel", "blocks" => [ [ "type" => "section", "text" => [ "type" => "mrkdwn", "text" => vipdocs_format_results( vipdocs_fetch( $query ) ) ] ], [ "type" => "context", "elements" => [ [ "type" => "mrkdwn", "text" => sprintf( 'https://docs.wpvip.com?s=%s', rawurlencode( $query ) ) ], [ "type" => "mrkdwn", "text" => sprintf( '<%s|Source code>', 'https://gist.github.com/trepmal/7fa4df42bf6ddaa8901bd6d859f9588f' ) ], [ "type" => "plain_text", "text" => ':heart: @trepmal' ] ] ], ] ]; header( 'Content-Type: application/json' ); die( json_encode( $response ) );