X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSample%2FSamplePlugin.php;h=5c34d10bd1664c3377a04b450d1fad36c5f81af4;hb=25198a8d4cee5b2182f1ecb99192a4108a01afa4;hp=913741226b4302cd2c63bc09f439659fe9a89d68;hpb=42834944e07926ab1d42c3fb5c498e1f7da85407;p=quix0rs-gnu-social.git diff --git a/plugins/Sample/SamplePlugin.php b/plugins/Sample/SamplePlugin.php index 913741226b..5c34d10bd1 100644 --- a/plugins/Sample/SamplePlugin.php +++ b/plugins/Sample/SamplePlugin.php @@ -101,7 +101,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class SamplePlugin extends Plugin { /** @@ -129,7 +128,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function initialize() { return true; @@ -143,7 +141,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function cleanup() { return true; @@ -168,7 +165,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onCheckSchema() { $schema = Schema::get(); @@ -176,9 +172,20 @@ class SamplePlugin extends Plugin // For storing user-submitted flags on profiles $schema->ensureTable('user_greeting_count', - array(new ColumnDef('user_id', 'integer', null, - true, 'PRI'), - new ColumnDef('greeting_count', 'integer'))); + array( + 'fields' => array( + 'user_id' => array('type' => 'int', 'not null' => true), + 'greeting_count' => array('type' => 'int'), + ), + 'primary key' => array('user_id'), + 'foreign keys' => array( + // Not all databases will support foreign keys, but even + // when not enforced it's helpful to include these definitions + // as documentation. + 'user_greeting_count_user_id_fkey' => array('user', array('user_id' => 'id')), + ), + ) + ); return true; } @@ -201,7 +208,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onAutoload($cls) { $dir = dirname(__FILE__); @@ -231,7 +237,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onRouterInitialized($m) { $m->connect('main/hello', @@ -256,14 +261,15 @@ class SamplePlugin extends Plugin * * @see Action */ - function onEndPrimaryNav($action) { // common_local_url() gets the correct URL for the action name // we provide - $action->menuItem(common_local_url('hello'), - _m('Hello'), _m('A warm greeting'), false, 'nav_hello'); + // TRANS: Menu item in sample plugin. + _m('Hello'), + // TRANS: Menu item title in sample plugin. + _m('A warm greeting'), false, 'nav_hello'); return true; } @@ -274,8 +280,8 @@ class SamplePlugin extends Plugin 'author' => 'Brion Vibber, Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:Sample', 'rawdescription' => + // TRANS: Plugin description. _m('A sample plugin to show basics of development for new hackers.')); return true; } } -