]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AutoSandbox/AutoSandboxPlugin.php
Introduced common_location_shared() to check if location sharing is always,
[quix0rs-gnu-social.git] / plugins / AutoSandbox / AutoSandboxPlugin.php
index ffd8bf455e29c0e51d179d816d5ee4c8d598ace1..e914977cc90cf61e9ee7cf2de450950211980d77 100644 (file)
@@ -41,7 +41,7 @@ class AutoSandboxPlugin extends Plugin
     var $contact;
     var $debug;
 
-    function onInitializePlugin() 
+    function onInitializePlugin()
     {
         if(!isset($this->debug))
         {
@@ -53,32 +53,38 @@ class AutoSandboxPlugin extends Plugin
            if (!empty($default)) {
                $this->contact = $default;
            }
-        } 
+        }
     }
 
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'AutoSandbox',
-                            'version' => STATUSNET_VERSION,
+                            'version' => GNUSOCIAL_VERSION,
                             'author' => 'Sean Carmody',
                             'homepage' => 'http://status.net/wiki/Plugin:AutoSandbox',
                             'rawdescription' =>
+                            // TRANS: Plugin description.
                             _m('Automatically sandboxes newly registered members.'));
         return true;
     }
 
     function onStartRegistrationFormData($action)
     {
-
-         $instr = 'Note you will initially be "sandboxed" so your posts will not appear in the public timeline.';
+         // TRANS: User instructions after registration.
+         $instr = _m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline.');
 
          if (isset($this->contact)) {
-             $contactuser = User::staticGet('nickname', $this->contact);
-             if (!empty($contactuser)) {
-                 $contactlink = "@<a href=\"$contactuser->uri\">$contactuser->nickname</a>";
-                 $instr = $instr . " Send a message to $contactlink to speed up the unsandboxing process.";
+             $contactuser = User::getKV('nickname', $this->contact);
+             if ($contactuser instanceof User) {
+                 $contactlink = sprintf('@<a href="%s">%s</a>',
+                                        htmlspecialchars($contactuser->getProfile()->getUrl()),
+                                        htmlspecialchars($contactuser->getProfile()->getNickname()));
+                 // TRANS: User instructions after registration.
+                 // TRANS: %s is a clickable OStatus profile URL.
+                 $instr = sprintf(_m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline. '.
+                   'Send a message to %s to speed up the unsandboxing process.'),$contactlink);
              }
-         } 
+         }
 
          $output = common_markup_to_html($instr);
          $action->elementStart('div', 'instructions');
@@ -86,11 +92,11 @@ class AutoSandboxPlugin extends Plugin
          $action->elementEnd('div');
     }
 
-    function onEndUserRegister(&$profile,&$user)
+    public function onEndUserRegister(Profile $profile)
     {
-       $profile->sandbox();
-       if ($this->debug) {
-           common_log(LOG_WARNING, "AutoSandbox: sandboxed of $user->nickname");
+        $profile->sandbox();
+        if ($this->debug) {
+            common_log(LOG_WARNING, "AutoSandbox: sandboxed of $profile->nickname");
         }
     }
 }