/**
* The expected structure of a requires element
*/
- private $_depsRequiresStructPlugin = array(
+ private $depsRequiresStructPlugin = array(
'type' => '',
'name' => '',
'version' => '',
/*
* The expected structure of elgg and elgg_release requires element
*/
- private $_depsRequiresStructElgg = array(
+ private $depsRequiresStructElgg = array(
'type' => '',
'version' => '',
'comparison' => 'ge'
/**
* The expected structure of a requires php_ini dependency element
*/
- private $_depsRequiresStructPhpIni = array(
+ private $depsRequiresStructPhpIni = array(
'type' => '',
'name' => '',
'value' => '',
/**
* The expected structure of a requires php_extension dependency element
*/
- private $_depsRequiresStructPhpExtension = array(
+ private $depsRequiresStructPhpExtension = array(
'type' => '',
'name' => '',
'version' => '',
/**
* The expected structure of a conflicts depedency element
*/
- private $_depsConflictsStruct = array(
+ private $depsConflictsStruct = array(
'type' => '',
'name' => '',
'version' => '',
/**
* The expected structure of a provides dependency element.
*/
- private $_depsProvidesStruct = array(
+ private $depsProvidesStruct = array(
'type' => '',
'name' => '',
'version' => ''
/**
* The expected structure of a screenshot element
*/
- private $_screenshotStruct = array(
+ private $screenshotStruct = array(
'description' => '',
'path' => ''
);
$normalized = array();
foreach ($ss as $s) {
- $normalized[] = $this->buildStruct($this->_screenshotStruct, $s);
+ $normalized[] = $this->buildStruct($this->screenshotStruct, $s);
}
return $normalized;
$normalized = array();
foreach ($provides as $provide) {
- $normalized[] = $this->buildStruct($this->_depsProvidesStruct, $provide);
+ $normalized[] = $this->buildStruct($this->depsProvidesStruct, $provide);
}
return $normalized;
switch ($req['type']) {
case 'elgg_version':
case 'elgg_release':
- $struct = $this->_depsRequiresStructElgg;
+ $struct = $this->depsRequiresStructElgg;
break;
case 'plugin':
- $struct = $this->_depsRequiresStructPlugin;
+ $struct = $this->depsRequiresStructPlugin;
break;
case 'php_extension':
- $struct = $this->_depsRequiresStructPhpExtension;
+ $struct = $this->depsRequiresStructPhpExtension;
break;
case 'php_ini':
- $struct = $this->_depsRequiresStructPhpIni;
+ $struct = $this->depsRequiresStructPhpIni;
// also normalize boolean values
if (isset($req['value'])) {
$normalized = array();
foreach ($conflicts as $conflict) {
- $normalized[] = $this->buildStruct($this->_depsConflictsStruct, $conflict);
+ $normalized[] = $this->buildStruct($this->depsConflictsStruct, $conflict);
}
return $normalized;
*
* @var array
*/
- private $_requiredFiles = array(
+ private $requiredFiles = array(
'start.php', 'manifest.xml'
);
*
* @var array
*/
- private $_providesSupportedTypes = array(
+ private $providesSupportedTypes = array(
'plugin', 'php_extension'
);
*
* @var array
*/
- private $_depsSupportedTypes = array(
+ private $depsSupportedTypes = array(
'elgg_version', 'elgg_release', 'php_extension', 'php_ini', 'plugin'
);
/**
* An invalid plugin error.
*/
- private $_invalidPluginError = '';
+ private $invalidPluginError = '';
/**
* Any dependencies messages
*/
- private $_depsMsgs = array();
+ private $depsMsgs = array();
/**
* The plugin's manifest object
}
if ($validate && !$this->isValid()) {
- if ($this->_invalidPluginError) {
+ if ($this->invalidPluginError) {
throw new PluginException(elgg_echo('PluginException:InvalidPlugin:Details',
- array($plugin, $this->_invalidPluginError)));
+ array($plugin, $this->invalidPluginError)));
} else {
throw new PluginException(elgg_echo('PluginException:InvalidPlugin', array($plugin)));
}
// check required files.
$have_req_files = true;
- foreach ($this->_requiredFiles as $file) {
+ foreach ($this->requiredFiles as $file) {
if (!is_readable($this->path . $file)) {
$have_req_files = false;
- $this->_invalidPluginError =
+ $this->invalidPluginError =
elgg_echo('ElggPluginPackage:InvalidPlugin:MissingFile', array($file));
break;
}
}
// check for valid manifest.
- if (!$this->_loadManifest()) {
+ if (!$this->loadManifest()) {
$valid = false;
}
// can't require or conflict with yourself or something you provide.
// make sure provides are all valid.
- if (!$this->_isSaneDeps()) {
+ if (!$this->isSaneDeps()) {
$valid = false;
}
*
* @return bool
*/
- private function _isSaneDeps() {
+ private function isSaneDeps() {
$conflicts = $this->getManifest()->getConflicts();
$requires = $this->getManifest()->getRequires();
$provides = $this->getManifest()->getProvides();
foreach ($provides as $provide) {
// only valid provide types
- if (!in_array($provide['type'], $this->_providesSupportedTypes)) {
- $this->_invalidPluginError =
+ if (!in_array($provide['type'], $this->providesSupportedTypes)) {
+ $this->invalidPluginError =
elgg_echo('ElggPluginPackage:InvalidPlugin:InvalidProvides', array($provide['type']));
return false;
}
$name = $provide['name'];
foreach (array('conflicts', 'requires') as $dep_type) {
foreach (${$dep_type} as $dep) {
- if (!in_array($dep['type'], $this->_depsSupportedTypes)) {
- $this->_invalidPluginError =
+ if (!in_array($dep['type'], $this->depsSupportedTypes)) {
+ $this->invalidPluginError =
elgg_echo('ElggPluginPackage:InvalidPlugin:InvalidDependency', array($dep['type']));
return false;
}
$version_compare = version_compare($provide['version'], $dep['version'], $dep['comparison']);
if ($version_compare) {
- $this->_invalidPluginError =
+ $this->invalidPluginError =
elgg_echo('ElggPluginPackage:InvalidPlugin:CircularDep',
array($dep['type'], $dep['name'], $this->id));
*/
public function getManifest() {
if (!$this->manifest) {
- $this->_loadManifest();
+ $this->loadManifest();
}
return $this->manifest;
*
* @return bool
*/
- private function _loadManifest() {
+ private function loadManifest() {
$file = $this->path . 'manifest.xml';
$this->manifest = new ElggPluginManifest($file, $this->id);
foreach (${$dep_type} as $dep) {
switch ($dep['type']) {
case 'elgg_version':
- $result = $this->_checkDepElgg($dep, get_version());
+ $result = $this->checkDepElgg($dep, get_version());
break;
case 'elgg_release':
- $result = $this->_checkDepElgg($dep, get_version(true));
+ $result = $this->checkDepElgg($dep, get_version(true));
break;
case 'plugin':
- $result = $this->_checkDepPlugin($dep, $enabled_plugins, $inverse);
+ $result = $this->checkDepPlugin($dep, $enabled_plugins, $inverse);
break;
case 'php_extension':
- $result = $this->_checkDepPhpExtension($dep);
+ $result = $this->checkDepPhpExtension($dep);
break;
case 'php_ini':
- $result = $this->_checkDepPhpIni($dep);
+ $result = $this->checkDepPhpIni($dep);
break;
}
* @param bool $inverse Inverse the results to use as a conflicts.
* @return bool
*/
- private function _checkDepPlugin(array $dep, array $plugins, $inverse = false) {
+ private function checkDepPlugin(array $dep, array $plugins, $inverse = false) {
$r = elgg_check_plugins_provides('plugin', $dep['name'], $dep['version'], $dep['comparison']);
if ($inverse) {
* @param bool $inverse Inverse the result to use as a conflicts.
* @return bool
*/
- private function _checkDepElgg(array $dep, $elgg_version, $inverse = false) {
+ private function checkDepElgg(array $dep, $elgg_version, $inverse = false) {
$r = version_compare($elgg_version, $dep['version'], $dep['comparison']);
if ($inverse) {
* @param array $dep An Elgg manifest.xml deps array
* @return bool
*/
- private function _checkDepPhpExtension(array $dep) {
+ private function checkDepPhpExtension(array $dep) {
$name = $dep['name'];
$version = $dep['version'];
$comparison = $dep['comparison'];
* @param array $dep An Elgg manifest.xml deps array
* @return bool
*/
- private function _checkDepPhpIni($dep) {
+ private function checkDepPhpIni($dep) {
$name = $dep['name'];
$value = $dep['value'];
$comparison = $dep['comparison'];
foreach ($requires as $require) {
switch ($require['type']) {
case 'elgg_version':
- $result = $this->_checkRequiresElgg($require, get_version());
+ $result = $this->checkRequiresElgg($require, get_version());
break;
case 'elgg_release':
- $result = $this->_checkRequiresElgg($require, get_version(true));
+ $result = $this->checkRequiresElgg($require, get_version(true));
break;
case 'plugin':
- $result = $this->_checkDepsPlugin($require, $enabled_plugins);
+ $result = $this->checkDepsPlugin($require, $enabled_plugins);
break;
case 'php_extension':
- $result = $this->_checkRequiresPhpExtension($require);
+ $result = $this->checkRequiresPhpExtension($require);
break;
case 'php_ini':
- $result = $this->_checkRequiresPhpIni($require);
+ $result = $this->checkRequiresPhpIni($require);
break;
default:
* @param array $plugins A list of plugins as returned by get_installed_plugins();
* @return array
*/
- private function _checkRequiresPlugin(array $require, array $plugins = array()) {
+ private function checkRequiresPlugin(array $require, array $plugins = array()) {
$status = true;
$message = '';
* @param array $elgg_version An Elgg version (either YYYYMMDDXX or X.Y.Z)
* @return array
*/
- private function _checkRequiresElgg(array $require, $elgg_version) {
+ private function checkRequiresElgg(array $require, $elgg_version) {
$status = true;
$message = '';
$version = $require['version'];
* @param array $require An Elgg manifest.xml deps array
* @return array
*/
- private function _checkRequiresPhpExtension($require) {
+ private function checkRequiresPhpExtension($require) {
$status = true;
$message = '';
* @param array $require An Elgg manifest.xml requires array
* @return array
*/
- private function _checkRequiresPhpIni($require) {
+ private function checkRequiresPhpIni($require) {
$status = true;
$message = '';