aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-25 18:12:10 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-25 18:12:10 +0000
commit113b813b5a5ec8b93ee72d4f259d8e38f9a9c5e4 (patch)
tree1148cbb2db3811082755710097ae1e1504b4535b /engine/classes
parent822496eed6a0b1b7e53f5b4104bfa47369f3aaf7 (diff)
downloadelgg-113b813b5a5ec8b93ee72d4f259d8e38f9a9c5e4.tar.gz
elgg-113b813b5a5ec8b93ee72d4f259d8e38f9a9c5e4.tar.bz2
Fixes #2899, #2870. Added README.txt, CHANGES.txt, COPYRIGHT.txt, LICENSE.txt, and INSTALL.txt as markdown files for plugins. Added page handler to parse and serve them. Added links in plugin admin. Refs #3236. Problems with displaying parsed markdown because of missing parts of the admin theme's CSS.
git-svn-id: http://code.elgg.org/elgg/trunk@9022 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggPlugin.php29
-rw-r--r--engine/classes/ElggPluginPackage.php19
2 files changed, 36 insertions, 12 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index f8a6d9b5c..20a8673de 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -30,7 +30,6 @@ class ElggPlugin extends ElggObject {
$this->access_id = ACCESS_PUBLIC;
}
-
/**
* Loads the plugin by GUID or path.
*
@@ -91,7 +90,6 @@ class ElggPlugin extends ElggObject {
}
}
-
/**
* Save the plugin object. Make sure required values exist.
*
@@ -138,7 +136,6 @@ class ElggPlugin extends ElggObject {
return sanitise_filepath($this->path);
}
-
/**
* Sets the location of this plugin.
*
@@ -149,6 +146,23 @@ class ElggPlugin extends ElggObject {
return $this->attributes['title'] = $id;
}
+ /**
+ * Returns an array of available markdown files for this plugin
+ *
+ * @return array
+ */
+ public function getAvailableTextFiles() {
+ $filenames = $this->package->getTextFilenames();
+
+ $files = array();
+ foreach ($filenames as $filename) {
+ if ($this->canReadFile($filename)) {
+ $files[$filename] = "$this->path/$filename";
+ }
+ }
+
+ return $files;
+ }
// Load Priority
@@ -162,7 +176,6 @@ class ElggPlugin extends ElggObject {
return $this->$name;
}
-
/**
* Sets the priority of the plugin
*
@@ -324,7 +337,6 @@ class ElggPlugin extends ElggObject {
return $this->set($name, $value);
}
-
/**
* Removes a plugin setting name and value.
*
@@ -336,7 +348,6 @@ class ElggPlugin extends ElggObject {
return remove_private_setting($this->guid, $name);
}
-
/**
* Removes all settings for this plugin.
*
@@ -496,7 +507,6 @@ class ElggPlugin extends ElggObject {
return remove_private_setting($user->guid, $name);
}
-
/**
* Removes all User Settings for this plugin
*
@@ -517,7 +527,6 @@ class ElggPlugin extends ElggObject {
return delete_data($q);
}
-
/**
* Removes this plugin's user settings for all users.
*
@@ -566,7 +575,6 @@ class ElggPlugin extends ElggObject {
return true;
}
-
/**
* Is this plugin active?
*
@@ -591,7 +599,6 @@ class ElggPlugin extends ElggObject {
return check_entity_relationship($this->guid, 'active_plugin', $site->guid);
}
-
/**
* Checks if this plugin can be activated on the current
* Elgg installation.
@@ -660,7 +667,6 @@ class ElggPlugin extends ElggObject {
return false;
}
-
/**
* Deactivates the plugin.
*
@@ -694,7 +700,6 @@ class ElggPlugin extends ElggObject {
}
}
-
/**
* Start the plugin.
*
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index b2ec20549..4daab381e 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -28,6 +28,15 @@ class ElggPluginPackage {
);
/**
+ * The optional files that can be read and served through the markdown page handler
+ * @var array
+ */
+ private $textFiles = array(
+ 'README.txt', 'CHANGES.txt',
+ 'INSTALL.txt', 'COPYRIGHT.txt', 'LICENSE.txt'
+ );
+
+ /**
* Valid types for provides.
*
* @var array
@@ -286,6 +295,16 @@ class ElggPluginPackage {
return false;
}
+ /****************
+ * Readme Files *
+ ***************/
+
+ /**
+ * Returns an array of present and readable text files
+ */
+ public function getTextFilenames() {
+ return $this->textFiles;
+ }
/***********************
* Dependencies system *