forked from GNUsocial/gnu-social
* i18n/L10n review.
* add onPluginVersion()
This commit is contained in:
parent
08054e85fe
commit
0f4f6fdb01
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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'));
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user