aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-08-04 01:50:01 +0200
committerSem <sembrestels@riseup.net>2012-08-04 01:50:01 +0200
commit18df06b9cd34c62dd8e9b1dfffd2f75e2815d859 (patch)
treee880bce8a7b10a6b3bc8c60168bc5ab35acf40f8 /engine
parent71edfd80a0baf95b86a29547252b01973511828f (diff)
parent4dd2ca9d54b64ebbf5eba3e3036f747cadb40825 (diff)
downloadelgg-18df06b9cd34c62dd8e9b1dfffd2f75e2815d859.tar.gz
elgg-18df06b9cd34c62dd8e9b1dfffd2f75e2815d859.tar.bz2
Merge branch 'translations-fallback-js' of git://github.com/sembrestels/Elgg into lorea-preprod
Conflicts: mod/developers/views/default/theme_preview/grid.php
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggPluginManifest.php28
-rw-r--r--engine/classes/ElggPluginManifestParser18.php11
-rw-r--r--engine/lib/actions.php44
-rw-r--r--engine/lib/entities.php4
-rw-r--r--engine/lib/languages.php3
-rw-r--r--engine/start.php9
-rw-r--r--engine/tests/api/plugins.php18
-rw-r--r--engine/tests/test_files/plugin_18/manifest.xml3
8 files changed, 85 insertions, 35 deletions
diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php
index 6b3932b32..a4f5bb95d 100644
--- a/engine/classes/ElggPluginManifest.php
+++ b/engine/classes/ElggPluginManifest.php
@@ -264,7 +264,7 @@ class ElggPluginManifest {
/**
* Returns the license
*
- * @return sting
+ * @return string
*/
public function getLicense() {
// license vs licence. Use license.
@@ -276,6 +276,32 @@ class ElggPluginManifest {
}
}
+ /**
+ * Returns the repository url
+ *
+ * @return string
+ */
+ public function getRepositoryURL() {
+ return $this->parser->getAttribute('repository');
+ }
+
+ /**
+ * Returns the bug tracker page
+ *
+ * @return string
+ */
+ public function getBugTrackerURL() {
+ return $this->parser->getAttribute('bugtracker');
+ }
+
+ /**
+ * Returns the donations page
+ *
+ * @return string
+ */
+ public function getDonationsPageURL() {
+ return $this->parser->getAttribute('donations');
+ }
/**
* Returns the version of the plugin.
diff --git a/engine/classes/ElggPluginManifestParser18.php b/engine/classes/ElggPluginManifestParser18.php
index 554e28c02..3b753f17b 100644
--- a/engine/classes/ElggPluginManifestParser18.php
+++ b/engine/classes/ElggPluginManifestParser18.php
@@ -13,10 +13,10 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser {
* @var array
*/
protected $validAttributes = array(
- 'name', 'author', 'version', 'blurb', 'description',
- 'website', 'copyright', 'license', 'requires', 'suggests',
- 'screenshot', 'category', 'conflicts', 'provides',
- 'activate_on_install'
+ 'name', 'author', 'version', 'blurb', 'description','website',
+ 'repository', 'bugtracker', 'donations', 'copyright', 'license',
+ 'requires', 'suggests', 'conflicts', 'provides',
+ 'screenshot', 'category', 'activate_on_install'
);
/**
@@ -46,6 +46,9 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser {
case 'website':
case 'copyright':
case 'license':
+ case 'repository':
+ case 'bugtracker':
+ case 'donations':
case 'activate_on_install':
$parsed[$element->name] = $element->content;
break;
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index 3a7c02488..53b185dea 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -82,44 +82,28 @@ function action($action, $forwarder = "") {
$forwarder = str_replace(elgg_get_site_url(), "", $forwarder);
$forwarder = str_replace("http://", "", $forwarder);
$forwarder = str_replace("@", "", $forwarder);
-
if (substr($forwarder, 0, 1) == "/") {
$forwarder = substr($forwarder, 1);
}
- if (isset($CONFIG->actions[$action])) {
- if (elgg_is_admin_logged_in() || ($CONFIG->actions[$action]['access'] !== 'admin')) {
- if (elgg_is_logged_in() || ($CONFIG->actions[$action]['access'] === 'public')) {
-
- // Trigger action event
- // @todo This is only called before the primary action is called.
- $event_result = true;
- $event_result = elgg_trigger_plugin_hook('action', $action, null, $event_result);
-
- // Include action
- // Event_result being false doesn't produce an error
- // since i assume this will be handled in the hook itself.
- // @todo make this better!
- if ($event_result) {
- if (!include($CONFIG->actions[$action]['file'])) {
- register_error(elgg_echo('actionnotfound', array($action)));
- }
- }
- } else {
- register_error(elgg_echo('actionloggedout'));
+ if (!isset($CONFIG->actions[$action])) {
+ register_error(elgg_echo('actionundefined', array($action)));
+ } elseif (!elgg_is_admin_logged_in() && ($CONFIG->actions[$action]['access'] === 'admin')) {
+ register_error(elgg_echo('actionunauthorized'));
+ } elseif (!elgg_is_logged_in() && ($CONFIG->actions[$action]['access'] !== 'public')) {
+ register_error(elgg_echo('actionloggedout'));
+ } else {
+ // Returning falsy doesn't produce an error
+ // We assume this will be handled in the hook itself.
+ if (elgg_trigger_plugin_hook('action', $action, null, true)) {
+ if (!include($CONFIG->actions[$action]['file'])) {
+ register_error(elgg_echo('actionnotfound', array($action)));
}
- } else {
- register_error(elgg_echo('actionunauthorized'));
}
- } else {
- register_error(elgg_echo('actionundefined', array($action)));
}
- if (!empty($forwarder)) {
- forward($forwarder);
- } else {
- forward(REFERER);
- }
+ $forwarder = empty($forwarder) ? REFERER : $forwarder;
+ forward($forwarder);
}
/**
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index abfe07276..66c1475b7 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -313,6 +313,10 @@ function add_subtype($type, $subtype, $class = "") {
/**
* Removes a registered ElggEntity type, subtype, and classname.
*
+ * @warning You do not want to use this function. If you want to unregister
+ * a class for a subtype, use update_subtype(). Using this function will
+ * permanently orphan all the objects created with the specified subtype.
+ *
* @param string $type Type
* @param string $subtype Subtype
*
diff --git a/engine/lib/languages.php b/engine/lib/languages.php
index 15c48f902..98006f7cd 100644
--- a/engine/lib/languages.php
+++ b/engine/lib/languages.php
@@ -50,8 +50,11 @@ function elgg_echo($message_key, $args = array(), $language = "") {
$string = $CONFIG->translations[$language][$message_key];
} else if (isset($CONFIG->translations["en"][$message_key])) {
$string = $CONFIG->translations["en"][$message_key];
+ $lang = $CONFIG->translations["en"][$language];
+ elgg_log(sprintf('Missing %s translation for "%s" language key', $lang, $message_key), 'NOTICE');
} else {
$string = $message_key;
+ elgg_log(sprintf('Missing English translation for "%s" language key', $message_key), 'NOTICE');
}
// only pass through if we have arguments to allow backward compatibility
diff --git a/engine/start.php b/engine/start.php
index 5f4bded45..55b8ffa5b 100644
--- a/engine/start.php
+++ b/engine/start.php
@@ -100,6 +100,15 @@ elgg_trigger_event('boot', 'system');
// Load the plugins that are active
elgg_load_plugins();
+
+// @todo move loading plugins into a single boot function that replaces 'boot', 'system' event
+// and then move this code in there.
+// This validates the view type - first opportunity to do it is after plugins load.
+$view_type = elgg_get_viewtype();
+if (!elgg_is_valid_view_type($view_type)) {
+ elgg_set_viewtype('default');
+}
+
// @todo deprecate as plugins can use 'init', 'system' event
elgg_trigger_event('plugins_boot', 'system');
diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php
index 8ecb0a46c..114f3991b 100644
--- a/engine/tests/api/plugins.php
+++ b/engine/tests/api/plugins.php
@@ -68,6 +68,9 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
'blurb' => 'A concise description.',
'description' => 'A longer, more interesting description.',
'website' => 'http://www.elgg.org/',
+ 'repository' => 'https://github.com/Elgg/Elgg',
+ 'bugtracker' => 'http://trac.elgg.org',
+ 'donations' => 'http://elgg.org/supporter.php',
'copyright' => '(C) Elgg Foundation 2011',
'license' => 'GNU General Public License version 2',
@@ -164,6 +167,21 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest {
$this->assertEqual($this->manifest18->getWebsite(), 'http://www.elgg.org/');
$this->assertEqual($this->manifest17->getWebsite(), 'http://www.elgg.org/');
}
+
+ public function testElggPluginManifestGetRepository() {
+ $this->assertEqual($this->manifest18->getRepositoryURL(), 'https://github.com/Elgg/Elgg');
+ $this->assertEqual($this->manifest17->getRepositoryURL(), '');
+ }
+
+ public function testElggPluginManifestGetBugtracker() {
+ $this->assertEqual($this->manifest18->getBugTrackerURL(), 'http://trac.elgg.org');
+ $this->assertEqual($this->manifest17->getBugTrackerURL(), '');
+ }
+
+ public function testElggPluginManifestGetDonationsPage() {
+ $this->assertEqual($this->manifest18->getDonationsPageURL(), 'http://elgg.org/supporter.php');
+ $this->assertEqual($this->manifest17->getDonationsPageURL(), '');
+ }
public function testElggPluginManifestGetCopyright() {
$this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011');
diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml
index 9654b6422..5d788616a 100644
--- a/engine/tests/test_files/plugin_18/manifest.xml
+++ b/engine/tests/test_files/plugin_18/manifest.xml
@@ -6,6 +6,9 @@
<blurb>A concise description.</blurb>
<description>A longer, more interesting description.</description>
<website>http://www.elgg.org/</website>
+ <repository>https://github.com/Elgg/Elgg</repository>
+ <bugtracker>http://trac.elgg.org</bugtracker>
+ <donations>http://elgg.org/supporter.php</donations>
<copyright>(C) Elgg Foundation 2011</copyright>
<license>GNU General Public License version 2</license>