Created
August 14, 2010 15:58
-
-
Save alkavan/524424 to your computer and use it in GitHub Desktop.
statusnet simple plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
/** | |
* Description of SimplePlugin | |
* | |
* @author alkavan | |
*/ | |
if (!defined('STATUSNET')) { exit(1); } | |
define('SIMPLE_DIR', dirname(__FILE__)); | |
define('SIMPLE_URL', trim(str_replace(INSTALLDIR, "", SIMPLE_DIR), "/")); | |
//includes | |
//require_once SIMPLE_DIR.'/lib/action.php'; | |
class SimplePlugin extends Plugin | |
{ | |
function onInitializePlugin() | |
{ | |
return true; | |
} | |
function onRouterInitialized($m) | |
{ | |
$m->connect(':nickname/simple', array('action' => 'SimpleIndex')); | |
return true; | |
} | |
function onEndShowStatusNetStyles($action) | |
{ | |
switch(get_class($action)) | |
{ | |
case 'SimpleIndex': | |
$action->cssLink(QNA_URL.'/style.css'); | |
break; | |
} | |
} | |
function onEndShowScripts($action) | |
{ | |
switch(get_class($action)) | |
{ | |
case 'SimpleIndex': | |
$action->script(QNA_URL.'/init.js'); | |
break; | |
} | |
} | |
function onAutoload($cls) | |
{ | |
// auto loading includes here | |
switch($cls) | |
{ | |
case 'SimpleIndexAction': | |
break; | |
} | |
return true; | |
} | |
function onEndPersonalGroupNav(&$action) | |
{ | |
//for users only | |
$cur = common_current_user(); | |
if(!$cur) return true; | |
$action_name = $action->action->trimmed('action'); | |
$action->action->menuItem( | |
common_local_url('SimpleIndex', array('nickname' => $action->action->trimmed('nickname'))), | |
_m('Simple!'), | |
_m("simple action"), | |
$action_name === 'SimpleIndex'); | |
return true; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment