Viewing File: /usr/local/cpanel/3rdparty/wpinstaller/src/WpDownloader/MojoApi.php

<?php
namespace WpDownloader;

use WpDownloader\Log;

class MojoApi extends HttpApi
{
    public static $baseUrl = 'https://www.mojomarketplace.com/mojo-plugin-assets/updater';
    protected static $logFile = 'mojo_api';

    public static function getVersionData()
    {
        $response = self::apiRequest('/', null, [
            'action' => 'plugin_information',
            'request' => 'a:2:{s:4:"slug";s:26:"mojo-marketplace-wp-plugin";s:7:"version";s:5:"0.0.0";}',
        ]);

        if (empty($response->version)) {
            Log::throwException("Version data was missing from API response");
        }

        return [
            'name' => $response->name,
            'slug' => $response->slug,
            'version' => $response->version,
            'last_updated' => $response->last_updated,
            'download_link' => $response->download_link,
        ];
    }

    protected static function unserializeResponse($responseText)
    {
        $toReturn = unserialize($responseText);

        if ($toReturn === false) {
            Log::throwException('Error decoding serialized PHP. Data was: '.substr($responseText, 0, 600));
        }

        return $toReturn;
    }
}
Back to Directory File Manager