From b1d46a40d6e04fe14ac83e5d761cdb8db8bac7f1 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 8 Feb 2011 04:49:25 +0000 Subject: Running plugins' blurb, description, name, and screenshot->description through elgg_echo(). git-svn-id: http://code.elgg.org/elgg/trunk@8069 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginManifest.php | 40 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index 34af6cd21..7a261a755 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -215,15 +215,20 @@ class ElggPluginManifest { /** * Returns the plugin name * + * @param bool $elgg_echo Run the name through elgg_echo. * @return string */ - public function getName() { + public function getName($elgg_echo = true) { $name = $this->parser->getAttribute('name'); if (!$name && $this->pluginID) { $name = ucwords(str_replace('_', ' ', $this->pluginID)); } + if ($elgg_echo) { + $name = elgg_echo($name); + } + return $name; } @@ -231,21 +236,33 @@ class ElggPluginManifest { /** * Return the description * + * @param bool $elgg_echo Run the description through elgg_echo. * @return string */ - public function getDescription() { - return elgg_echo($this->parser->getAttribute('description')); + public function getDescription($elgg_echo = true) { + $desc = $this->parser->getAttribute('description'); + + if ($elgg_echo) { + return elgg_echo($desc); + } else { + return $desc; + } } /** * Return the short description * + * @param bool $elgg_echo Run the blurb through elgg_echo. * @return string */ - public function getBlurb() { - $blurb = elgg_echo($this->parser->getAttribute('blurb')); + public function getBlurb($elgg_echo = true) { + $blurb = $this->parser->getAttribute('blurb'); - if (!$blurb) { + if ($blurb) { + if ($elgg_echo) { + $blurb = elgg_echo($blurb); + } + } else { $blurb = elgg_get_excerpt($this->getDescription()); } @@ -322,9 +339,10 @@ class ElggPluginManifest { /** * Return the screenshots listed. * + * @param bool $elgg_echo Run the screenshot's description through elgg_echo. * @return array */ - public function getScreenshots() { + public function getScreenshots($elgg_echo = true) { $ss = $this->parser->getAttribute('screenshot'); if (!$ss) { @@ -333,7 +351,13 @@ class ElggPluginManifest { $normalized = array(); foreach ($ss as $s) { - $normalized[] = $this->buildStruct($this->screenshotStruct, $s); + $normalized_s = $this->buildStruct($this->screenshotStruct, $s); + + if ($elgg_echo) { + $normalized_s['description'] = elgg_echo($normalized_s['description']); + } + + $normalized[] = $normalized_s; } return $normalized; -- cgit v1.2.3