# depicter/1.5.2/app/src/Controllers/Ajax/AppInfoAjaxController.php

Depicter — Popup &amp; Slider Builder, version 1.5.2. 64 lines.

- Page: https://pluginprobe.com/plugins/depicter/1.5.2/code/app/src/Controllers/Ajax/AppInfoAjaxController.php
- Raw: https://pluginprobe.com/plugins/depicter/1.5.2/raw/app/src/Controllers/Ajax/AppInfoAjaxController.php
- Modified: 2022-11-27T12:52:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/1.5.2/code/app/src/Controllers/Ajax/AppInfoAjaxController.php#L10-L20`.

```php
<?php
namespace Depicter\Controllers\Ajax;

use Averta\WordPress\Utility\JSON;
use Depicter\GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
use WPEmerge\Requests\RequestInterface;

class AppInfoAjaxController {

	/**
	 * Retrieves Lists of all entries. (GET)
	 *
	 * @param RequestInterface $request
	 * @param string           $view
	 *
	 * @return ResponseInterface
	 * @throws GuzzleException
	 */
	public function changelogs( RequestInterface $request, string $view)
	{
		try {
			$response = \Depicter::remote()->get( 'v1/core/changelogs', [ 'query' => $request->getQueryParams() ] );
			return \Depicter::json(
				JSON::decode( $response->getBody(), true )
			)->withStatus( 200 );

		} catch( \Exception $exception ) {
			return \Depicter::json([
				'errors' => [ $exception->getMessage() ]
			])->withStatus( 503 );
		}
	}

	/**
	 * Retrieves the existing promotion
	 *
	 * @param RequestInterface $request
	 * @param string           $view
	 *
	 * @return ResponseInterface
	 * @throws GuzzleException
	 */
	public function getPromotion( RequestInterface $request, string $view)
	{
		try {
			$response = \Depicter::remote()->get( 'v1/core/announcements', [ 'query' => [ 'category' => 'promotions-wp-dash' ] ] );
			$promotions = JSON::decode( $response->getBody(), true );
			$currentPromotion = [];

			if( ! empty( $promotions['hits'] ) ){
				$currentPromotion = reset($promotions['hits'] );
			}
			return \Depicter::json( $currentPromotion )->withStatus( 200 );

		} catch( \Exception $exception ) {
			return \Depicter::json([
				'errors' => [ $exception->getMessage() ]
			])->withStatus( 503 );
		}
	}

}

```
