]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Autocomplete/AutocompletePlugin.php
Merge branch 'master' into testing
[quix0rs-gnu-social.git] / plugins / Autocomplete / AutocompletePlugin.php
index 49b6d42b1e4e8b8539897860c2426a5d91bcea26..d586631a4a09dd4542784c1c7c0c2b239c9b137c 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
+require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php');
+
 class AutocompletePlugin extends Plugin
 {
     function __construct()
@@ -40,13 +42,6 @@ class AutocompletePlugin extends Plugin
 
     function onEndShowScripts($action){
         if (common_logged_in()) {
-            $current_user = common_current_user();
-            $js_string = <<<EOT
-<script type="text/javascript">
-var current_user = { id: '$current_user->id' };
-</script>
-EOT;
-            $action->raw($js_string);
             $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js');
             $action->script('plugins/Autocomplete/Autocomplete.js');
         }
@@ -59,5 +54,23 @@ EOT;
         }
     }
 
+    function onRouterInitialized($m)
+    {
+        if (common_logged_in()) {
+            $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete'));
+        }
+    }
+
+    function onPluginVersion(&$versions)
+    {
+        $versions[] = array('name' => 'Autocomplete',
+                            'version' => STATUSNET_VERSION,
+                            'author' => 'Craig Andrews',
+                            'homepage' => 'http://status.net/wiki/Plugin:Autocomplete',
+                            'rawdescription' =>
+                            _m('The autocomplete plugin allows users to autocomplete screen names in @ replies. When an "@" is typed into the notice text area, an autocomplete box is displayed populated with the user\'s friend\' screen names.'));
+        return true;
+    }
+
 }
 ?>