* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+
/**
* @package SubMirrorPlugin
* @maintainer Brion Vibber <brion@status.net>
*/
-
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-
-
class SubMirrorPlugin extends Plugin
{
/**
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class AddMirrorAction extends BaseMirrorAction
{
var $feedurl;
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
abstract class BaseMirrorAction extends Action
{
var $user;
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
}
/**
- * @fixme none of this belongs in end classes
+ * @todo FIXME: none of this belongs in end classes
* this stuff belongs in shared code!
*/
function sharedBoilerplate()
{
// Only allow POST requests
-
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
- $this->clientError(_('This action only accepts POST requests.'));
+ $this->clientError(_m('This action only accepts POST requests.'));
return false;
}
// CSRF protection
-
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
- $this->clientError(_('There was a problem with your session token.'.
+ $this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
$this->user = common_current_user();
if (empty($this->user)) {
- $this->clientError(_('Not logged in.'));
+ $this->clientError(_m('Not logged in.'));
return false;
}
return true;
*
* @return void
*/
-
function handle($args)
{
// Throws exception on error
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
- $this->element('title', null, _('Subscribed'));
+ $this->element('title', null, _m('Subscribed'));
$this->elementEnd('head');
$this->elementStart('body');
$unsubscribe = new EditMirrorForm($this, $this->profile);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class EditMirrorAction extends BaseMirrorAction
{
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
{
$mirror = SubMirror::getMirror($this->user, $this->profile);
if (!$mirror) {
- $this->clientError(_m('Requested edit of missing mirror'));
+ // TRANS: Client error thrown when a mirror request is made and no result is retrieved.
+ $this->clientError(_m('Requested edit of missing mirror.'));
}
if ($this->delete) {
*
* @return string Page title
*/
-
function title()
{
+ // TRANS: Title.
return _m('Feed mirror settings');
}
function getInstructions()
{
+ // TRANS: Instructions.
return _m('You can mirror updates from many RSS and Atom feeds ' .
'into your StatusNet timeline!');
}
*
* @return void
*/
-
function showContent()
{
$user = common_current_user();
$this->showAddFeedForm();
-
+
$mirror = new SubMirror();
$mirror->subscriber = $user->id;
if ($mirror->find()) {
*
* @return void
*/
-
function handlePost()
{
}
/**
* Temporary hack to set up the compound index, since we can't do
* it yet through regular Schema interface. (Coming for 1.0...)
- *
+ *
* @param Schema $schema
* @return void
*/
$mirror->created = common_sql_now();
$mirror->modified = common_sql_now();
$mirror->insert();
-
+
return $mirror;
}
* This retains attribution within the site, and other nice things,
* but currently ends up looking like 'RT @foobar bla bla' when
* bridged out over OStatus or TwitterBridge.
- *
+ *
* @param Notice $notice
* @return mixed Notice on successful repeat, true if already repeated, false on failure
*/
* Mirror a notice by emitting a new notice with the same contents.
* Kind of dirty, but if pulling an external data feed into an account
* that may be what you want.
- *
+ *
* @param Notice $notice
* @return mixed Notice on successful repeat, true if already repeated, false on failure
*/
/**
* Get the mirroring setting for a pair of profiles, if existing.
- *
+ *
* @param Profile $subscriber
* @param Profile $subscribed
* @return mixed Profile or empty
class AddMirrorForm extends Form
{
-
/**
* Name of the form
*
*
* @return void
*/
-
function formLegend()
{
}
*
* @return void
*/
-
function formData()
{
$this->out->elementStart('fieldset');
$this->unli();
$this->li();
- $this->out->submit('addmirror-save', _m('Add feed'));
+ $this->out->submit('addmirror-save', _m('BUTTON','Add feed'));
$this->unli();
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
*
* @return void
*/
-
function formActions()
{
}
*
* @return string ID of the form
*/
-
function id()
{
return 'add-mirror-form';
*
* @return string URL to post to
*/
-
function action()
{
return common_local_url('addmirror');
*
* @return string the form's class
*/
-
function formClass()
{
return 'form_settings';
}
-
}
*
* @return void
*/
-
function formLegend()
{
}
*
* @return void
*/
-
function formData()
{
$this->out->elementStart('fieldset');
$this->out->elementEnd('div');
$this->out->elementStart('div');
if ($feed) {
+ // XXX: Why the hard coded space?
$this->out->text(_m('LABEL', 'Remote feed:') . ' ');
//$this->out->element('a', array('href' => $feed), $feed);
$this->out->element('input', array('value' => $feed, 'readonly' => 'readonly', 'style' => 'width: 100%'));
}
$this->out->elementEnd('fieldset');
-
+
$this->out->elementStart('div');
$this->out->submit($this->id() . '-save', _m('Save'));
$this->out->element('input', array('type' => 'submit',
*
* @return string ID of the form
*/
-
function id()
{
return 'edit-mirror-form-' . $this->profile->id;
*
* @return string URL to post to
*/
-
function action()
{
return common_local_url('editmirror');
*
* @return string the form's class
*/
-
function formClass()
{
return 'form_settings';
}
-
}
* @package SubMirror
* @author Brion Vibber <brion@status.net>
*/
-
class MirrorQueueHandler extends QueueHandler
{
function transport()