bricks all the bricks
This commit is contained in:
50
repositories/pluginRepository.php
Normal file
50
repositories/pluginRepository.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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.
|
||||
}
|
||||
}
|
||||
14
repositories/repository.php
Normal file
14
repositories/repository.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace cooini\iniRepo\repositories;
|
||||
|
||||
abstract class repository implements repositoryInterface
|
||||
{
|
||||
public string $url;
|
||||
public string $auth_token;
|
||||
public function __construct($repo_url, $auth)
|
||||
{
|
||||
$this->url = $repo_url;
|
||||
$this->auth_token = $auth;
|
||||
}
|
||||
}
|
||||
9
repositories/repositoryInterface.php
Normal file
9
repositories/repositoryInterface.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace cooini\iniRepo\repositories;
|
||||
|
||||
interface repositoryInterface
|
||||
{
|
||||
public function getLicensed(string $type) ;
|
||||
public function get(string $item_name) : array;
|
||||
public function isItemLicensed(string $item_name) : bool;
|
||||
}
|
||||
Reference in New Issue
Block a user