summaryrefslogtreecommitdiff
path: root/plugins/UserFlag
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserFlag')
-rw-r--r--plugins/UserFlag/UserFlagPlugin.php37
-rw-r--r--plugins/UserFlag/User_flag_profile.php10
-rw-r--r--plugins/UserFlag/adminprofileflag.php36
-rw-r--r--plugins/UserFlag/clearflag.php13
-rw-r--r--plugins/UserFlag/clearflagform.php10
-rw-r--r--plugins/UserFlag/flagprofile.php15
-rw-r--r--plugins/UserFlag/flagprofileform.php11
-rw-r--r--plugins/UserFlag/locale/UserFlag.pot108
8 files changed, 169 insertions, 71 deletions
diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php
index ae3dfe036..e6ad3e37d 100644
--- a/plugins/UserFlag/UserFlagPlugin.php
+++ b/plugins/UserFlag/UserFlagPlugin.php
@@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class UserFlagPlugin extends Plugin
{
const REVIEWFLAGS = 'UserFlagPlugin::reviewflags';
@@ -56,7 +55,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook return
*/
-
function onCheckSchema()
{
$schema = Schema::get();
@@ -83,7 +81,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook return
*/
-
function onRouterInitialized($m)
{
$m->connect('main/flag/profile', array('action' => 'flagprofile'));
@@ -99,7 +96,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook return
*/
-
function onAutoload($cls)
{
switch (strtolower($cls))
@@ -130,7 +126,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onEndProfilePageActionsElements(&$action, $profile)
{
$user = common_current_user();
@@ -140,6 +135,8 @@ class UserFlagPlugin extends Plugin
$action->elementStart('li', 'entity_flag');
if (User_flag_profile::exists($profile->id, $user->id)) {
+ // @todo FIXME: Add a title explaining what 'flagged' means?
+ // TRANS: Message added to a profile if it has been flagged for review.
$action->element('p', 'flagged', _('Flagged'));
} else {
$form = new FlagProfileForm($action, $profile,
@@ -161,7 +158,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onEndProfileListItemActionElements($item)
{
$user = common_current_user();
@@ -189,7 +185,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onEndShowScripts($action)
{
$action->inlineScript('if ($(".form_entity_flag").length > 0) { '.
@@ -210,7 +205,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onUserRightsCheck($user, $right, &$result)
{
switch ($right) {
@@ -233,7 +227,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onEndBlockProfile($user, $profile)
{
if ($this->flagOnBlock && !User_flag_profile::exists($profile->id,
@@ -255,7 +248,6 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onProfileDeleteRelated($profile, &$related)
{
$related[] = 'user_flag_profile';
@@ -272,10 +264,33 @@ class UserFlagPlugin extends Plugin
*
* @return boolean hook result
*/
-
function onUserDeleteRelated($user, &$related)
{
$related[] = 'user_flag_profile';
return true;
}
+
+ /**
+ * Provide plugin version information.
+ *
+ * This data is used when showing the version page.
+ *
+ * @param array &$versions array of version data arrays; see EVENTS.txt
+ *
+ * @return boolean hook value
+ */
+ function onPluginVersion(&$versions)
+ {
+ $url = 'http://status.net/wiki/Plugin:UserFlag';
+
+ $versions[] = array('name' => 'UserFlag',
+ 'version' => STATUSNET_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => $url,
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('This plugin allows flagging of profiles for review and reviewing flagged profiles.'));
+
+ return true;
+ }
}
diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php
index 86b39160b..69fe0f356 100644
--- a/plugins/UserFlag/User_flag_profile.php
+++ b/plugins/UserFlag/User_flag_profile.php
@@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class User_flag_profile extends Memcached_DataObject
{
###START_AUTOCODE
@@ -67,7 +66,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return array array of column definitions
*/
-
function table()
{
return array(
@@ -83,7 +81,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return array key definitions
*/
-
function keys()
{
return array('profile_id' => 'K', 'user_id' => 'K');
@@ -94,7 +91,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return array key definitions
*/
-
function keyTypes()
{
return $this->keys();
@@ -107,7 +103,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return User_flag_profile found object or null
*/
-
function pkeyGet($kv)
{
return Memcached_DataObject::pkeyGet('User_flag_profile', $kv);
@@ -121,7 +116,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return boolean true if exists, else false
*/
-
static function exists($profile_id, $user_id)
{
$ufp = User_flag_profile::pkeyGet(array('profile_id' => $profile_id,
@@ -138,7 +132,6 @@ class User_flag_profile extends Memcached_DataObject
*
* @return boolean success flag
*/
-
static function create($user_id, $profile_id)
{
$ufp = new User_flag_profile();
@@ -148,7 +141,8 @@ class User_flag_profile extends Memcached_DataObject
$ufp->created = common_sql_now();
if (!$ufp->insert()) {
- $msg = sprintf(_("Couldn't flag profile '%d' for review."),
+ // TRANS: Server exception.
+ $msg = sprintf(_m('Couldn\'t flag profile "%d" for review.'),
$profile_id);
throw new ServerException($msg);
}
diff --git a/plugins/UserFlag/adminprofileflag.php b/plugins/UserFlag/adminprofileflag.php
index 17374927b..df0450f66 100644
--- a/plugins/UserFlag/adminprofileflag.php
+++ b/plugins/UserFlag/adminprofileflag.php
@@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class AdminprofileflagAction extends Action
{
var $page = null;
@@ -53,7 +52,6 @@ class AdminprofileflagAction extends Action
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
@@ -109,7 +107,6 @@ class AdminprofileflagAction extends Action
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
@@ -122,10 +119,10 @@ class AdminprofileflagAction extends Action
*
* @return string Title of the page
*/
-
function title()
{
- return _('Flagged profiles');
+ // TRANS: Title for page with a list of profiles that were flagged for review.
+ return _m('Flagged profiles');
}
/**
@@ -133,7 +130,6 @@ class AdminprofileflagAction extends Action
*
* @return void
*/
-
function showContent()
{
$pl = new FlaggedProfileList($this->profiles, $this);
@@ -149,7 +145,6 @@ class AdminprofileflagAction extends Action
*
* @return Profile $profile Profile query results
*/
-
function getProfiles()
{
$ufp = new User_flag_profile();
@@ -196,7 +191,6 @@ class AdminprofileflagAction extends Action
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class FlaggedProfileList extends ProfileList
{
/**
@@ -206,7 +200,6 @@ class FlaggedProfileList extends ProfileList
*
* @return ProfileListItem newly-created item
*/
-
function newListItem($profile)
{
return new FlaggedProfileListItem($this->profile, $this->action);
@@ -222,7 +215,6 @@ class FlaggedProfileList extends ProfileList
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class FlaggedProfileListItem extends ProfileListItem
{
const MAX_FLAGGERS = 5;
@@ -235,7 +227,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showActions()
{
$this->user = common_current_user();
@@ -247,7 +238,8 @@ class FlaggedProfileListItem extends ProfileListItem
$this->startActions();
if (Event::handle('StartProfileListItemActionElements', array($this))) {
$this->out->elementStart('li', 'entity_moderation');
- $this->out->element('p', null, _('Moderate'));
+ // TRANS: Header for moderation menu with action buttons for flagged profiles (like 'sandbox', 'silence', ...).
+ $this->out->element('p', null, _m('Moderate'));
$this->out->elementStart('ul');
$this->showSandboxButton();
$this->showSilenceButton();
@@ -265,7 +257,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showSandboxButton()
{
if ($this->user->hasRight(Right::SANDBOXUSER)) {
@@ -286,7 +277,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showSilenceButton()
{
if ($this->user->hasRight(Right::SILENCEUSER)) {
@@ -307,7 +297,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showDeleteButton()
{
@@ -324,7 +313,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showClearButton()
{
if ($this->user->hasRight(UserFlagPlugin::CLEARFLAGS)) {
@@ -340,7 +328,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function endProfile()
{
$this->showFlaggersList();
@@ -352,7 +339,6 @@ class FlaggedProfileListItem extends ProfileListItem
*
* @return void
*/
-
function showFlaggersList()
{
$flaggers = array();
@@ -394,12 +380,16 @@ class FlaggedProfileListItem extends ProfileListItem
}
if ($cnt > 0) {
- $text = _('Flagged by ');
-
- $text .= implode(', ', $lnks);
-
if ($others > 0) {
- $text .= sprintf(_(' and %d others'), $others);
+ $flagging_users = implode(', ', $lnks);
+ // TRANS: Message displayed on a profile if it has been flagged.
+ // TRANS: %1$s is a comma separated list of at most 5 user nicknames that flagged.
+ // TRANS: %2$d is a positive integer of additional flagging users. Also used for the plural.
+ $text .= sprintf(_m('Flagged by %1$s and %2$d other', 'Flagged by %1$s and %2$d others', $others), $flagging_users, $others);
+ } else {
+ // TRANS: Message displayed on a profile if it has been flagged.
+ // TRANS: %s is a comma separated list of at most 5 user nicknames that flagged.
+ $text .= sprintf(_m('Flagged by %s'), $flagging_users);
}
$this->out->elementStart('p', array('class' => 'flaggers'));
diff --git a/plugins/UserFlag/clearflag.php b/plugins/UserFlag/clearflag.php
index f032527ed..feda29f1b 100644
--- a/plugins/UserFlag/clearflag.php
+++ b/plugins/UserFlag/clearflag.php
@@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class ClearflagAction extends ProfileFormAction
{
/**
@@ -75,7 +74,6 @@ class ClearflagAction extends ProfileFormAction
*
* @return void
*/
-
function handle($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -93,7 +91,6 @@ class ClearflagAction extends ProfileFormAction
*
* @return void
*/
-
function handlePost()
{
$ufp = new User_flag_profile();
@@ -104,7 +101,8 @@ class ClearflagAction extends ProfileFormAction
'AND profile_id = ' . $this->profile->id);
if ($result == false) {
- $msg = sprintf(_("Couldn't clear flags for profile '%s'."),
+ // TRANS: Server exception given when flags could not be cleared.
+ $msg = sprintf(_m('Couldn\'t clear flags for profile "%s".'),
$this->profile->nickname);
throw new ServerException($msg);
}
@@ -121,17 +119,18 @@ class ClearflagAction extends ProfileFormAction
*
* @return void
*/
-
function ajaxResults()
{
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
- $this->element('title', null, _('Flags cleared'));
+ // TRANS: Title for AJAX form to indicated that flags were removed.
+ $this->element('title', null, _m('Flags cleared'));
$this->elementEnd('head');
$this->elementStart('body');
- $this->element('p', 'cleared', _('Cleared'));
+ // TRANS: Body element for "flags cleared" form.
+ $this->element('p', 'cleared', _m('Cleared'));
$this->elementEnd('body');
$this->elementEnd('html');
}
diff --git a/plugins/UserFlag/clearflagform.php b/plugins/UserFlag/clearflagform.php
index eefd15c36..26a884875 100644
--- a/plugins/UserFlag/clearflagform.php
+++ b/plugins/UserFlag/clearflagform.php
@@ -42,7 +42,6 @@ require_once INSTALLDIR.'/lib/form.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ClearFlagForm extends ProfileActionForm
{
/**
@@ -51,7 +50,6 @@ class ClearFlagForm extends ProfileActionForm
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_user_clearflag';
@@ -62,7 +60,6 @@ class ClearFlagForm extends ProfileActionForm
*
* @return string Name of the action, lowercased.
*/
-
function target()
{
return 'clearflag';
@@ -73,10 +70,10 @@ class ClearFlagForm extends ProfileActionForm
*
* @return string Title of the form, internationalized
*/
-
function title()
{
- return _('Clear');
+ // TRANS: Form title for action on a profile.
+ return _m('Clear');
}
/**
@@ -87,6 +84,7 @@ class ClearFlagForm extends ProfileActionForm
function description()
{
- return _('Clear all flags');
+ // Form description for clearing flags from a profile.
+ return _m('Clear all flags');
}
}
diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php
index 018c1e8ac..283eea40c 100644
--- a/plugins/UserFlag/flagprofile.php
+++ b/plugins/UserFlag/flagprofile.php
@@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
-
class FlagprofileAction extends ProfileFormAction
{
/**
@@ -50,7 +49,6 @@ class FlagprofileAction extends ProfileFormAction
*
* @return boolean success flag
*/
-
function prepare($args)
{
if (!parent::prepare($args)) {
@@ -64,7 +62,8 @@ class FlagprofileAction extends ProfileFormAction
if (User_flag_profile::exists($this->profile->id,
$user->id)) {
- $this->clientError(_('Flag already exists.'));
+ // TRANS: Client error when setting flag that has already been set for a profile.
+ $this->clientError(_m('Flag already exists.'));
return false;
}
@@ -81,7 +80,6 @@ class FlagprofileAction extends ProfileFormAction
*
* @return void
*/
-
function handle($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -97,7 +95,6 @@ class FlagprofileAction extends ProfileFormAction
*
* @return void
*/
-
function handlePost()
{
$user = common_current_user();
@@ -119,19 +116,19 @@ class FlagprofileAction extends ProfileFormAction
*
* @return void
*/
-
function ajaxResults()
{
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
- $this->element('title', null, _('Flagged for review'));
+ // TRANS: AJAX form title for a flagged profile.
+ $this->element('title', null, _m('Flagged for review'));
$this->elementEnd('head');
$this->elementStart('body');
- $this->element('p', 'flagged', _('Flagged'));
+ // TRANS: Body text for AJAX form when a profile has been flagged for review.
+ $this->element('p', 'flagged', _m('Flagged'));
$this->elementEnd('body');
$this->elementEnd('html');
}
}
-
diff --git a/plugins/UserFlag/flagprofileform.php b/plugins/UserFlag/flagprofileform.php
index c20929a20..045c9de85 100644
--- a/plugins/UserFlag/flagprofileform.php
+++ b/plugins/UserFlag/flagprofileform.php
@@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/form.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class FlagProfileForm extends ProfileActionForm
{
/**
@@ -53,7 +52,6 @@ class FlagProfileForm extends ProfileActionForm
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_entity_flag';
@@ -64,7 +62,6 @@ class FlagProfileForm extends ProfileActionForm
*
* @return string Name of the action, lowercased.
*/
-
function target()
{
return 'flagprofile';
@@ -75,10 +72,10 @@ class FlagProfileForm extends ProfileActionForm
*
* @return string Title of the form, internationalized
*/
-
function title()
{
- return _('Flag');
+ // TRANS: Form title for flagging a profile for review.
+ return _m('Flag');
}
/**
@@ -86,9 +83,9 @@ class FlagProfileForm extends ProfileActionForm
*
* @return string description of the form, internationalized
*/
-
function description()
{
- return _('Flag profile for review');
+ // TRANS: Form description.
+ return _m('Flag profile for review.');
}
}
diff --git a/plugins/UserFlag/locale/UserFlag.pot b/plugins/UserFlag/locale/UserFlag.pot
new file mode 100644
index 000000000..7e0bc3114
--- /dev/null
+++ b/plugins/UserFlag/locale/UserFlag.pot
@@ -0,0 +1,108 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-10-03 19:53+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#. TRANS: Title for page with a list of profiles that were flagged for review.
+#: adminprofileflag.php:125
+msgid "Flagged profiles"
+msgstr ""
+
+#. TRANS: Header for moderation menu with action buttons for flagged profiles (like 'sandbox', 'silence', ...).
+#: adminprofileflag.php:242
+msgid "Moderate"
+msgstr ""
+
+#. TRANS: Message displayed on a profile if it has been flagged.
+#. TRANS: %1$s is a comma separated list of at most 5 user nicknames that flagged.
+#. TRANS: %2$d is a positive integer of additional flagging users. Also used for the plural.
+#: adminprofileflag.php:388
+#, php-format
+msgid "Flagged by %1$s and %2$d other"
+msgid_plural "Flagged by %1$s and %2$d others"
+msgstr[0] ""
+msgstr[1] ""
+
+#. TRANS: Message displayed on a profile if it has been flagged.
+#. TRANS: %s is a comma separated list of at most 5 user nicknames that flagged.
+#: adminprofileflag.php:392
+#, php-format
+msgid "Flagged by %s"
+msgstr ""
+
+#. TRANS: Client error when setting flag that has already been set for a profile.
+#: flagprofile.php:66
+msgid "Flag already exists."
+msgstr ""
+
+#. TRANS: AJAX form title for a flagged profile.
+#: flagprofile.php:126
+msgid "Flagged for review"
+msgstr ""
+
+#. TRANS: Body text for AJAX form when a profile has been flagged for review.
+#: flagprofile.php:130
+msgid "Flagged"
+msgstr ""
+
+#. TRANS: Plugin description.
+#: UserFlagPlugin.php:292
+msgid ""
+"This plugin allows flagging of profiles for review and reviewing flagged "
+"profiles."
+msgstr ""
+
+#. TRANS: Server exception given when flags could not be cleared.
+#: clearflag.php:105
+#, php-format
+msgid "Couldn't clear flags for profile \"%s\"."
+msgstr ""
+
+#. TRANS: Title for AJAX form to indicated that flags were removed.
+#: clearflag.php:129
+msgid "Flags cleared"
+msgstr ""
+
+#. TRANS: Body element for "flags cleared" form.
+#: clearflag.php:133
+msgid "Cleared"
+msgstr ""
+
+#. TRANS: Form title for flagging a profile for review.
+#: flagprofileform.php:78
+msgid "Flag"
+msgstr ""
+
+#. TRANS: Form description.
+#: flagprofileform.php:89
+msgid "Flag profile for review."
+msgstr ""
+
+#. TRANS: Server exception.
+#: User_flag_profile.php:145
+#, php-format
+msgid "Couldn't flag profile \"%d\" for review."
+msgstr ""
+
+#. TRANS: Form title for action on a profile.
+#: clearflagform.php:76
+msgid "Clear"
+msgstr ""
+
+#: clearflagform.php:88
+msgid "Clear all flags"
+msgstr ""