Skip to content

Instantly share code, notes, and snippets.

@alkavan
Created August 14, 2010 15:58
Show Gist options
  • Save alkavan/524424 to your computer and use it in GitHub Desktop.
Save alkavan/524424 to your computer and use it in GitHub Desktop.
statusnet simple plugin
<?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