aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggPlugin.php')
-rw-r--r--engine/classes/ElggPlugin.php72
1 files changed, 5 insertions, 67 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index 8c9093834..8f71b79a8 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -36,8 +36,9 @@ class ElggPlugin extends ElggObject {
* @warning Unlike other ElggEntity objects, you cannot null instantiate
* ElggPlugin. You must point it to an actual plugin GUID or location.
*
- * @param mixed $plugin The GUID of the ElggPlugin object or the path of
- * the plugin to load.
+ * @param mixed $plugin The GUID of the ElggPlugin object or the path of the plugin to load.
+ *
+ * @throws PluginException
*/
public function __construct($plugin) {
if (!$plugin) {
@@ -76,68 +77,8 @@ class ElggPlugin extends ElggObject {
// load the rest of the plugin
parent::__construct($existing_guid);
}
- }
- /**
- * Overridden from ElggEntity and ElggObject::load(). Core always inits plugins with
- * a query joined to the objects_entity table, so all the info is there.
- *
- * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
- *
- * @return bool
- * @throws InvalidClassException
- */
- protected function load($guid) {
-
- $expected_attributes = $this->attributes;
- unset($expected_attributes['tables_split']);
- unset($expected_attributes['tables_loaded']);
-
- // this was loaded with a full join
- $needs_loaded = false;
-
- if ($guid instanceof stdClass) {
- $row = (array) $guid;
- $missing_attributes = array_diff_key($expected_attributes, $row);
- if ($missing_attributes) {
- $needs_loaded = true;
- $old_guid = $guid;
- $guid = $row['guid'];
- } else {
- $this->attributes = $row;
- }
- } else {
- $needs_loaded = true;
- }
-
- if ($needs_loaded) {
- $entity = (array) get_entity_as_row($guid);
- $object = (array) get_object_entity_as_row($guid);
-
- if (!$entity || !$object) {
- return false;
- }
-
- $this->attributes = array_merge($this->attributes, $entity, $object);
- }
-
- $this->attributes['tables_loaded'] = 2;
-
- // Check the type
- if ($this->attributes['type'] != 'object') {
- $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
- throw new InvalidClassException($msg);
- }
-
- // guid needs to be an int http://trac.elgg.org/ticket/4111
- $this->attributes['guid'] = (int)$this->attributes['guid'];
-
- // cache the entity
- if ($this->attributes['guid']) {
- cache_entity($this);
- }
-
- return true;
+ _elgg_cache_plugin_by_id($this);
}
/**
@@ -362,10 +303,7 @@ class ElggPlugin extends ElggObject {
$return = array();
foreach ($private_settings as $setting) {
- $name = substr($setting->name, $ps_prefix_len);
- $value = $setting->value;
-
- $return[$name] = $value;
+ $return[$setting->name] = $setting->value;
}
return $return;