50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace cooini\iniRepo\repositories;
|
|
|
|
use cooini\Inirepo\pluginManager\pluginInstaller;
|
|
|
|
class pluginRepository extends repository
|
|
{
|
|
|
|
public function getPluginInstaller()
|
|
{
|
|
return new pluginInstaller($this);
|
|
}
|
|
|
|
public function getRequiredPlugins(): array
|
|
{
|
|
// TODO: Implement getRequiredPlugins() method.
|
|
}
|
|
|
|
public function getLicensedPlugins(): array
|
|
{
|
|
return $this->getLicensed("plugin");
|
|
}
|
|
|
|
public function getLicensed(string $type='plugin')
|
|
{
|
|
$plugins_request = wp_remote_post("https://internal-devrepo.courselauncher.io/test.php", ['body'=>['site'=>get_site_url() ]] );
|
|
|
|
if( is_wp_error( $plugins_request ) ) {
|
|
return false; // Bail early
|
|
}
|
|
$plugins_response = json_decode( wp_remote_retrieve_body( $plugins_request ));
|
|
if ($plugins_response and isset($plugins_response->result))
|
|
{
|
|
return $plugins_response->result;
|
|
}
|
|
else
|
|
throw new \Exception("Invalid return determining licensed plugins");
|
|
}
|
|
|
|
public function get(string $item_name): array
|
|
{
|
|
// TODO: Implement get() method.
|
|
}
|
|
|
|
public function isItemLicensed(string $item_name): bool
|
|
{
|
|
// TODO: Implement isItemLicensed() method.
|
|
}
|
|
} |