2014-06-01 19:35:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* API for loading and interacting with plugins
|
2014-06-11 10:27:07 +00:00
|
|
|
* contains getters and setters
|
2014-06-11 06:22:57 +00:00
|
|
|
*
|
|
|
|
* @author shubham meena mentored by Matthew Lagoe
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Plugincache {
|
|
|
|
private $id;
|
|
|
|
private $plugin_name;
|
|
|
|
private $plugin_type;
|
|
|
|
private $plugin_permission;
|
|
|
|
private $plugin_status;
|
|
|
|
private $plugin_info = array();
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* A constructor.
|
|
|
|
* Empty constructor
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set( $values ) {
|
|
|
|
$this -> setId( $values['Id'] );
|
|
|
|
$this -> setPluginName( $values['Name'] );
|
|
|
|
$this -> setPluginType( $values['Type'] );
|
|
|
|
$this -> setPluginPermission( $values['Permission'] );
|
|
|
|
$this -> setPluginStatus( $values['Status'] );
|
2014-06-11 10:27:07 +00:00
|
|
|
$this -> setPluginInfo( json_decode( $values['Info'] ) );
|
2014-06-11 06:22:57 +00:00
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* loads the object's attributes.
|
|
|
|
*/
|
|
|
|
public function load_With_SID() {
|
|
|
|
$dbl = new DBLayer( "lib" );
|
|
|
|
$statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" );
|
|
|
|
$row = $statement -> fetch();
|
|
|
|
$this -> set( $row );
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
2014-06-11 06:22:57 +00:00
|
|
|
/**
|
|
|
|
* get plugin id attribute of the object.
|
|
|
|
*
|
|
|
|
* @return integer id
|
|
|
|
*/
|
|
|
|
public function getId() {
|
|
|
|
return $this -> Id;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* get plugin permission attribute of the object.
|
|
|
|
*/
|
|
|
|
public function getPluginPermission() {
|
|
|
|
return $this -> plugin_permission;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
2014-06-11 06:22:57 +00:00
|
|
|
/**
|
|
|
|
* get plugin Type attribute of the object.
|
|
|
|
*/
|
|
|
|
public function getPluginType() {
|
|
|
|
return $this -> plugin_version;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* get plugin status attribute of the object.
|
|
|
|
*/
|
|
|
|
public function getPluginStatus() {
|
|
|
|
return $this -> plugin_status;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* get plugin name attribute of the object.
|
|
|
|
*/
|
|
|
|
public function getPluginName() {
|
|
|
|
return $this -> plugin_name;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* get plugin info array attribute of the object.
|
|
|
|
*/
|
|
|
|
public function getPluginInfo() {
|
|
|
|
return $this -> plugin_info;
|
|
|
|
}
|
|
|
|
|
2014-06-01 19:35:37 +00:00
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* set plugin id attribute of the object.
|
|
|
|
*
|
|
|
|
* @param $s integer id
|
|
|
|
*/
|
|
|
|
public function setId( $s ) {
|
|
|
|
$this -> Id = $s;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
2014-06-11 06:22:57 +00:00
|
|
|
/**
|
|
|
|
* set plugin permission attribute of the object.
|
|
|
|
*
|
|
|
|
* @param $t type of the query, set permission
|
|
|
|
*/
|
|
|
|
public function setPluginPermission( $t ) {
|
|
|
|
$this -> plugin_permission = $t;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* set plugin version attribute of the object.
|
|
|
|
*
|
|
|
|
* @param $q string to set plugin version
|
|
|
|
*/
|
|
|
|
public function setPluginType( $q ) {
|
|
|
|
$this -> plugin_version = $q;
|
|
|
|
}
|
|
|
|
|
2014-06-01 19:35:37 +00:00
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* set plugin status attribute of the object.
|
|
|
|
*
|
|
|
|
* @param $d status code type int
|
|
|
|
*/
|
|
|
|
public function setPluginStatus( $d ) {
|
|
|
|
$this -> plugin_status = $d;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* set plugin name attribute of the object.
|
|
|
|
*
|
|
|
|
* @param $p_n string to set plugin name.
|
|
|
|
*/
|
|
|
|
public function setPluginName( $p_n ) {
|
|
|
|
$this -> plugin_name = $p_n;
|
|
|
|
}
|
|
|
|
|
2014-06-01 19:35:37 +00:00
|
|
|
/**
|
2014-06-11 06:22:57 +00:00
|
|
|
* set plugin info attribute array of the object.
|
|
|
|
*
|
|
|
|
* @param $p_n array
|
|
|
|
*/
|
|
|
|
public function setPluginInfo( $p_n ) {
|
|
|
|
$this -> plugin_info = $p_n;
|
|
|
|
}
|
2014-06-01 19:35:37 +00:00
|
|
|
|
2014-06-11 10:27:07 +00:00
|
|
|
}
|