HEX
Server: Apache/2.4.65 (Debian)
System: Linux wordpress-7cb4c6b6f6-qgbk2 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: www-data (33)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/jet-engine/framework/workflows/includes/remote-api.php
<?php
/**
 * Workflows UI
 */
namespace Croblock\Workflows;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

class Remote_API {

	protected $api_url = 'https://api.crocoblock.com/interactive-tutorials/tutorials.json';

	/**
	 * Set API url for current instance
	 */
	public function set_api_url( $api_url = '' ) {
		$this->api_url = $api_url;
	}

	/**
	 * Remote retrieve items
	 * 
	 * @return [type] [description]
	 */
	public function get_items() {

		$workflows = [];
		$response  = wp_remote_get( $this->api_url );

		if ( ! $response || is_wp_error( $response ) ) {
			return $workflows;
		}

		$body = wp_remote_retrieve_body( $response );

		if ( ! $body ) {
			return $workflows;
		}

		$workflows = json_decode( $body, true );

		return $workflows;

	}

}