summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-02 17:16:10 -0400
committerEvan Prodromou <evan@status.net>2010-09-02 17:16:10 -0400
commit925381707b921315ba76418ed0d1dd50f9548e80 (patch)
tree66b44361c2569f350e7a4cba2c848a9217dce7c8 /plugins
parentc7d81f2d9d8cf318db80b82d68807f4f333692f8 (diff)
show notice title on shownotice page
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NoticeTitle/NoticeTitlePlugin.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php
index f7fb1e4d0..9f53173db 100644
--- a/plugins/NoticeTitle/NoticeTitlePlugin.php
+++ b/plugins/NoticeTitle/NoticeTitlePlugin.php
@@ -278,5 +278,54 @@ class NoticeTitlePlugin extends Plugin
return true;
}
+
+ /**
+ * If a notice has a title, show it in the <title> element
+ *
+ * @param Action $action Action being executed
+ *
+ * @return boolean hook value
+ */
+
+ function onStartShowHeadTitle($action)
+ {
+ $actionName = $action->trimmed('action');
+
+ if ($actionName == 'shownotice') {
+ $title = Notice_title::fromNotice($action->notice);
+ if (!empty($title)) {
+ $action->element('title', null,
+ // TRANS: Page title. %1$s is the title, %2$s is the site name.
+ sprintf(_("%1\$s - %2\$s"),
+ $title,
+ common_config('site', 'name')));
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * If a notice has a title, show it in the <h1> element
+ *
+ * @param Action $action Action being executed
+ *
+ * @return boolean hook value
+ */
+
+ function onStartShowPageTitle($action)
+ {
+ $actionName = $action->trimmed('action');
+
+ if ($actionName == 'shownotice') {
+ $title = Notice_title::fromNotice($action->notice);
+ if (!empty($title)) {
+ $action->element('h1', null, $title);
+ return false;
+ }
+ }
+
+ return true;
+ }
}