b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 2.4) [ class tree: plugins ] [ index: plugins ] [ all elements ]

Source for file _test.plugin.php

Documentation is available at _test.plugin.php

  1. <?php
  2. /**
  3.  * This file implements the TEST plugin.
  4.  *
  5.  * For the most recent and complete Plugin API documentation
  6.  * see {@link Plugin} in ../evocore/_plugin.class.php.
  7.  *
  8.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  9.  * See also {@link http://sourceforge.net/projects/evocms/}.
  10.  *
  11.  * @copyright (c)2003-2008 by Francois PLANQUE - {@link http://fplanque.net/}
  12.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  13.  *
  14.  *  {@internal License choice
  15.  *  - If you have received this file as part of a package, please find the license.txt file in
  16.  *    the same folder or the closest folder above for complete license terms.
  17.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  18.  *    then you must choose one of the following licenses before using the file:
  19.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  20.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  21.  *  }}}
  22.  *
  23.  *  {@internal Open Source relicensing agreement:
  24.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  25.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  26.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  27.  *  }}}
  28.  *
  29.  * @package plugins
  30.  *
  31.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  32.  * @author fplanque: Francois PLANQUE - {@link http://fplanque.net/}
  33.  * @author blueyed: Daniel HAHLER
  34.  *
  35.  * @version $Id: _test.plugin.php,v 1.72 2008/01/21 09:35:41 fplanque Exp $
  36.  */
  37. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  38.  
  39.  
  40. /**
  41.  * TEST Plugin
  42.  *
  43.  * This plugin responds to virtually all possible plugin events :P
  44.  *
  45.  * @package plugins
  46.  */
  47. class test_plugin extends Plugin
  48. {
  49.     /**
  50.      * Variables below MUST be overriden by plugin implementations,
  51.      * either in the subclass declaration or in the subclass constructor.
  52.      */
  53.     var $name = 'Test';
  54.     var $code = 'evo_TEST';
  55.     var $priority = 50;
  56.     var $version = '1.9-dev';
  57.     var $author = 'The b2evo Group';
  58.     var $help_url = '';  // empty URL defaults to manual wiki
  59.  
  60.     /*
  61.      * These variables MAY be overriden.
  62.      */
  63.     var $apply_rendering = 'opt-out';
  64.     var $number_of_installs = 1;
  65.     var $group = 'test';
  66.  
  67.  
  68.     /**
  69.      * Init
  70.      *
  71.      * This gets called after a plugin has been registered/instantiated.
  72.      */
  73.     function PluginInit$params )
  74.     {
  75.         $this->short_desc = 'Test plugin';
  76.         $this->long_desc = 'This plugin responds to virtually all possible plugin events :P';
  77.     }
  78.  
  79.  
  80.     /**
  81.      * Get the settings that the plugin can use.
  82.      *
  83.      * Those settings are transfered into a Settings member object of the plugin
  84.      * and can be edited in the backoffice (Settings / Plugins).
  85.      *
  86.      * @see Plugin::GetDefaultSettings()
  87.      * @see PluginSettings
  88.      * @see Plugin::PluginSettingsValidateSet()
  89.      * @return array 
  90.      */
  91.     function GetDefaultSettings$params )
  92.     {
  93.         $r array(
  94.             'click_me' => array(
  95.                 'label' => 'Click me!',
  96.                 'defaultvalue' => '1',
  97.                 'type' => 'checkbox',
  98.             ),
  99.             'input_me' => array(
  100.                 'label' => 'How are you?',
  101.                 'defaultvalue' => '',
  102.                 'note' => 'Welcome to b2evolution',
  103.             ),
  104.             'number' => array(
  105.                 'label' => 'Number',
  106.                 'defaultvalue' => '8',
  107.                 'note' => '1-9',
  108.                 'valid_range' => array'min'=>1'max'=>),
  109.             ),
  110.             'my_select' => array(
  111.                 'label' => 'Selector',
  112.                 'id' => $this->classname.'_my_select',
  113.                 'onchange' => 'document.getElementById("'.$this->classname.'_a_disabled_one").disabled = ( this.value == "sun" );',
  114.                 'defaultvalue' => 'one',
  115.                 'type' => 'select',
  116.                 'options' => array'sun' => 'Sunday''mon' => 'Monday' ),
  117.             ),
  118.             'a_disabled_one' => array(
  119.                 'label' => 'This one is disabled',
  120.                 'id' => $this->classname.'_a_disabled_one',
  121.                 'type' => 'checkbox',
  122.                 'defaultvalue' => '1',
  123.                 'disabled' => true// this can be useful if you detect that something cannot be changed. You probably want to add a 'note' then, too.
  124.                 'note' => 'Change the above select input to "Monday" to enable it.',
  125.             ),
  126.             'blog' => array(
  127.                 'label' => 'A blog',
  128.                 'type' => 'select_blog',  // TODO: does not scale with 500 blogs
  129.                 'allow_none' => true,
  130.             ),
  131.             'blogs' => array(
  132.                 'label' => 'A set of blogs',
  133.                 'type' => 'select_blog',    // TODO: BROKEN + does not scale with 500 blogs
  134.                 'multiple' => true,
  135.                 'allow_none' => true,
  136.             ),
  137.             'sets' => array(
  138.                 'type' => 'array',
  139.                 'min_count' => 0,
  140.                 'max_count' => 3,
  141.                 'entries' => array(
  142.                     'user' => array(
  143.                         'label' => 'A user',
  144.                         'type' => 'select_user',        // TODO: does not scale with 500 users
  145.                         'allow_none' => true,
  146.                     ),
  147.                 ),
  148.             ),
  149.             'maxlen' => array(
  150.                 'label' => 'Max',
  151.                 'type' => 'textarea',
  152.                 'maxlength' => 10,
  153.                 'note' => 'Maximum length is 10 here.',
  154.             ),
  155.         );
  156.  
  157.         if$params['for_editing')
  158.         // we're asked for the settings for editing:
  159.             if$this->Settings->get('my_select'== 'mon' )
  160.             {
  161.                 $r['a_disabled_one']['disabled'false;
  162.             }
  163.         }
  164.  
  165.         return $r;
  166.     }
  167.  
  168.  
  169.     /**
  170.      * User settings.
  171.      *
  172.      * @see Plugin::GetDefaultUserSettings()
  173.      * @see PluginUserSettings
  174.      * @see Plugin::PluginUserSettingsValidateSet()
  175.      * @return array 
  176.      */
  177.     function GetDefaultUserSettings()
  178.     {
  179.         return array(
  180.                 'echo_random' => array(
  181.                     'label' => 'Echo a random number in AdminBeginPayload event',
  182.                     'type' => 'checkbox',
  183.                     'defaultvalue' => '0',
  184.                 ),
  185.                 'deactivate' => array(
  186.                     'label' => 'Deactivate',
  187.                     'type' => 'checkbox',
  188.                     'defaultvalue' => '0',
  189.                 ),
  190.             );
  191.     }
  192.  
  193.  
  194.     /**
  195.      * We trigger an extra event ourself (which we also provide ourselves).
  196.      *
  197.      * @return array 
  198.      */
  199.     function GetExtraEvents()
  200.     {
  201.         return array(
  202.                 // Gets "min" and "max" as params and should return a random number in between:
  203.                 'test_plugin_get_random' => 'TEST event that returns a random number.',
  204.             );
  205.     }
  206.  
  207.  
  208.     /**
  209.      * Define a test cron job
  210.      */
  211.     function GetCronJobs$params )
  212.     {
  213.         return array(
  214.                 array(
  215.                     'name' => 'TEST plugin - cron job',
  216.                     'ctrl' => 'test_job',
  217.                     'params' => array'param' => ),
  218.                 ),
  219.             );
  220.     }
  221.  
  222.  
  223.     /**
  224.      * Execute/Handle a test/sample cronjob.
  225.      */
  226.     function ExecCronJob$params )
  227.     {
  228.         if$params['ctrl'== 'test_job' )
  229.         {
  230.             return array'code' => 1'message' => 'Test successful.' );
  231.         }
  232.     }
  233.  
  234.  
  235.     /**
  236.      * Deactive the plugin for the current request if the user wants it so.
  237.      * @see Plugin::AppendLoginRegisteredUser()
  238.      */
  239.     function AppendLoginRegisteredUser()
  240.     {
  241.         if$this->UserSettings->get('deactivate') )
  242.         {
  243.             $this->forget_events();
  244.         }
  245.     }
  246.  
  247.  
  248.     /**
  249.      * Define some dependencies.
  250.      *
  251.      * @see Plugin::GetDependencies()
  252.      * @return array 
  253.      */
  254.     function GetDependencies()
  255.     {
  256.         return array(
  257.                 'recommends' => array(
  258.                     'events_by_one' => arrayarray('Foo''Bar')array('FooBar''BarFoo') )// a plugin that provides "Foo" and "Bar", and one (may be the same) that provides "FooBar" and "BarFoo"
  259.                     'events' => array'some_event''some_other_event' ),
  260.                     'plugins' => arrayarray'some_plugin''1' ) )// at least version 1 of some_plugin
  261.                 ),
  262.  
  263.                 'requires' => array(
  264.                     // Same syntax as with the 'recommends' class above, but would prevent the plugin from being installed.
  265.                 ),
  266.             );
  267.     }
  268.  
  269.  
  270.     /**
  271.      * Gets asked for, if user settings get updated.
  272.      *
  273.      * We just add a note.
  274.      *
  275.      * @see Plugin::PluginUserSettingsUpdateAction()
  276.      */
  277.     function PluginUserSettingsUpdateAction()
  278.     {
  279.         if$this->UserSettings->get('echo_random') )
  280.         {
  281.             $this->msg'TEST plugin: Random numbers have been disabled.' );
  282.         }
  283.         else
  284.         {
  285.             $this->msg'TEST plugin: Random numbers have been enabled.' );
  286.         }
  287.  
  288.         return true;
  289.     }
  290.  
  291.  
  292.     /**
  293.      * Event handlers:
  294.      */
  295.  
  296.     /**
  297.      * Event handler: Called when ending the admin html head section.
  298.      *
  299.      * @see Plugin::AdminEndHtmlHead()
  300.      * @param array Associative array of parameters
  301.      * @return boolean did we do something?
  302.      */
  303.     function AdminEndHtmlHead$params )
  304.     {
  305.         echo '<!-- This comment was added by the TEST plugin -->';
  306.  
  307.         return true;
  308.     }
  309.  
  310.  
  311.     /**
  312.      * Event handler: Called right after displaying the admin page footer.
  313.      *
  314.      * @see Plugin::AdminAfterPageFooter()
  315.      * @param array Associative array of parameters
  316.      * @return boolean did we do something?
  317.      */
  318.     function AdminAfterPageFooter$params )
  319.     {
  320.         echo '<p class="footer">This is the TEST plugin responding to the AdminAfterPageFooter event!</p>';
  321.  
  322.         return true;
  323.     }
  324.  
  325.  
  326.     /**
  327.      * Event handler: Called when displaying editor toolbars.
  328.      *
  329.      * @see Plugin::AdminDisplayToolbar()
  330.      * @param array Associative array of parameters
  331.      * @return boolean did we display a toolbar?
  332.      */
  333.     function AdminDisplayToolbar$params )
  334.     {
  335.         echo '<div class="edit_toolbar">This is the TEST Toolbar</div>';
  336.  
  337.         return true;
  338.     }
  339.  
  340.  
  341.     /**
  342.      * Event handler: Called when displaying editor buttons.
  343.      *
  344.      * @see Plugin::AdminDisplayEditorButton()
  345.      * @param array Associative array of parameters
  346.      * @return boolean did we display ?
  347.      */
  348.     function AdminDisplayEditorButton$params )
  349.     {
  350.         if$params['edit_layout'== 'simple' )
  351.         // this is the "simple" layout, we do nothing
  352.             return false;
  353.         }
  354.         ?>
  355.         <input type="button" value="TEST" onclick="alert('Hi! This is the TEST plugin (AdminDisplayEditorButton)!');" />
  356.         <?php
  357.         return true;
  358.     }
  359.  
  360.  
  361.     /**
  362.      * @see Plugin::AdminDisplayItemFormFieldset()
  363.      */
  364.     function AdminDisplayItemFormFieldset$params )
  365.     {
  366.         $params['Form']->begin_fieldset'TEST plugin' );
  367.         $params['Form']->info_field'TEST plugin''This is the TEST plugin responding to the AdminDisplayItemFormFieldset event.' );
  368.         $params['Form']->end_fieldset'Foo' );
  369.     }
  370.  
  371.     /**
  372.      * @see Plugin::SkinBeginHtmlHead()
  373.      */
  374.  
  375.   function SkinBeginHtmlHead()
  376.   {
  377.     require_js'#jquery#');
  378.   }
  379.   
  380.     /**
  381.      * @see Plugin::AdminBeforeItemEditCreate()
  382.      */
  383.     function AdminBeforeItemEditCreate$params )
  384.     {
  385.         $this->msg'This is the TEST plugin responding to the AdminBeforeItemEditCreate event.' );
  386.     }
  387.  
  388.  
  389.     /**
  390.      * @see Plugin::AdminBeforeItemEditUpdate()
  391.      */
  392.     function AdminBeforeItemEditUpdate$params )
  393.     {
  394.         $this->msg'This is the TEST plugin responding to the AdminBeforeItemEditUpdate event.' );
  395.     }
  396.  
  397.  
  398.     /**
  399.      * @see Plugin::AdminDisplayCommentFormFieldset()
  400.      */
  401.     function AdminDisplayCommentFormFieldset$params )
  402.     {
  403.         $params['Form']->begin_fieldset'TEST plugin' );
  404.         $params['Form']->info_field'TEST plugin''This is the TEST plugin responding to the AdminDisplayCommentFormFieldset event.' );
  405.         $params['Form']->end_fieldset'Foo' );
  406.     }
  407.  
  408.  
  409.     /**
  410.      * Event handler: Gets invoked in /admin.php for every backoffice page after
  411.      *                the menu structure is build. You can use the {@link $AdminUI} object
  412.      *                to modify it.
  413.      *
  414.      * This is the hook to register menu entries. See {@link register_menu_entry()}.
  415.      *
  416.      * @see Plugin::AdminAfterMenuInit()
  417.      */
  418.     function AdminAfterMenuInit()
  419.     {
  420.         $this->register_menu_entry'Test tab' );
  421.     }
  422.  
  423.  
  424.     /**
  425.      * Event handler: Called when handling actions for the "Tools" menu.
  426.      *
  427.      * Use {@link $Messages} to add Messages for the user.
  428.      *
  429.      * @see Plugin::AdminToolAction()
  430.      */
  431.     function AdminToolAction$params )
  432.     {
  433.         global $Messages;
  434.  
  435.         $Messages->add'Hello, This is the AdminToolAction for the TEST plugin.' );
  436.     }
  437.  
  438.  
  439.     /**
  440.      * Event handler: Called when displaying the block in the "Tools" menu.
  441.      *
  442.      * @see Plugin::AdminToolPayload()
  443.      */
  444.     function AdminToolPayload$params )
  445.     {
  446.         echo 'Hello, This is the AdminToolPayload for the TEST plugin.';
  447.     }
  448.  
  449.  
  450.     /**
  451.      * Event handler: Method that gets invoked when our tab (?tab=plug_ID_X) is selected.
  452.      *
  453.      * You should catch params (GET/POST) here and do actions (no output!).
  454.      * Use {@link $Messages} to add messages for the user.
  455.      *
  456.      * @see Plugin::AdminTabAction()
  457.      */
  458.     function AdminTabAction()
  459.     {
  460.         global $Plugins;
  461.  
  462.         $this->text_from_AdminTabAction '<p>This is text from AdminTabAction for the TEST plugin.</p>'
  463.             .'<p>Here is a random number: '
  464.             .$Plugins->get_trigger_event_first_return('test_plugin_get_random'array'min'=>-1000'max'=>1000 )).'</p>';
  465.  
  466.         if$this->param_text param$this->get_class_id('text') ) )
  467.         {
  468.             $this->text_from_AdminTabAction .= '<p>You have said: '.$this->param_text.'</p>';
  469.         }
  470.     }
  471.  
  472.  
  473.     /**
  474.      * Event handler: Gets invoked when our tab is selected and should get displayed.
  475.      *
  476.      * @see Plugin::AdminTabPayload()
  477.      */
  478.     function AdminTabPayload()
  479.     {
  480.         echo 'Hello, this is the AdminTabPayload for the TEST plugin.';
  481.  
  482.         echo $this->text_from_AdminTabAction;
  483.  
  484.         // TODO: this is tedious.. should either be a global function (get_admin_Form()) or a plugin helper..
  485.         $Form new Form();
  486.         $Form->begin_form();
  487.         $Form->hidden_ctrl()// needed to pass the "ctrl=tools" param
  488.         $Form->hiddens_by_keyget_memorized() )// needed to pass all other memorized params, especially "tab"
  489.  
  490.         $Form->text_input$this->get_class_id().'_text'$this->param_text'20''Text' );
  491.  
  492.         $Form->button_input()// default "submit" button
  493.  
  494.         $Form->end_form();
  495.     }
  496.  
  497.  
  498.     /**
  499.      * Event handler: Gets invoked before the main payload in the backoffice.
  500.      *
  501.      * @see Plugin::AdminBeginPayload()
  502.      */
  503.     function AdminBeginPayload()
  504.     {
  505.         global $Plugins;
  506.  
  507.         echo '<div class="panelblock center">TEST plugin: AdminBeginPayload event.</div>';
  508.  
  509.         if$this->UserSettings->get('echo_random') )
  510.         {
  511.             echo '<div class="panelblock center">TEST plugin: A random number requested by user setting: '
  512.                     .$Plugins->get_trigger_event_first_return('test_plugin_get_random'array'min'=>0'max'=>1000 ) ).'</div>';
  513.         }
  514.     }
  515.  
  516.  
  517.     /**
  518.      * Event handler: Called when rendering item/post contents as HTML.
  519.      *
  520.      * Note: return value is ignored. You have to change $params['content'].
  521.      *
  522.      * @see Plugin::RenderItemAsHtml()
  523.      */
  524.     function RenderItemAsHtml$params )
  525.     {
  526.         $params['data''TEST['.$params['data'].']TEST';
  527.     }
  528.  
  529.  
  530.     /**
  531.      * Event handler: Called when rendering item/post contents as XML.
  532.      *
  533.      * Note: return value is ignored. You have to change $params['content'].
  534.      *
  535.      * @see Plugin::RenderItemAsXml()
  536.      */
  537.     function RenderItemAsXml$params )
  538.     {
  539.         // Do the same as with HTML:
  540.         $this->RenderItemAsHtml$params );
  541.     }
  542.  
  543.  
  544.     /**
  545.      * Event handler: Called when rendering item/post contents as text.
  546.      *
  547.      * Note: return value is ignored. You have to change $params['content'].
  548.      *
  549.      * @see Plugin::RenderItemAsText()
  550.      */
  551.     function RenderItemAsText$params )
  552.     {
  553.         // Do nothing.
  554.     }
  555.  
  556.  
  557.     /**
  558.      * Event handler: Called when displaying item/post contents as HTML.
  559.      *
  560.      * Note: return value is ignored. You have to change $params['content'].
  561.      *
  562.      * @see Plugin::DisplayItemAsHtml()
  563.      */
  564.     function DisplayItemAsHtml$params )
  565.     {
  566.         $params['data'$params['data']."\n<br />-- test_plugin::DisplayItemAsHtml()";
  567.     }
  568.  
  569.  
  570.     /**
  571.      * Event handler: Called when displaying item/post contents as XML.
  572.      *
  573.      * Note: return value is ignored. You have to change $params['content'].
  574.      *
  575.      * @see Plugin::DisplayItemAsXml()
  576.      */
  577.     function DisplayItemAsXml$params )
  578.     {
  579.         $params['data'$params['data']."\n<br />-- test_plugin::DisplayItemAsXml()";
  580.     }
  581.  
  582.  
  583.     /**
  584.      * Event handler: Called when displaying item/post contents as text.
  585.      *
  586.      * Note: return value is ignored. You have to change $params['content'].
  587.      *
  588.      * @see Plugin::DisplayItemAsText()
  589.      */
  590.     function DisplayItemAsText$params )
  591.     {
  592.         $params['data'$params['data']."\n<br />-- test_plugin::DisplayItemAsText()";
  593.     }
  594.  
  595.  
  596.     /**
  597.      * Wrap a to be displayed IP address.
  598.      * @see Plugin::FilterIpAddress()
  599.      */
  600.     function FilterIpAddress$params )
  601.     {
  602.         $params['data''[[IP:'.$params['data'].' (TEST plugin)]]';
  603.     }
  604.  
  605.  
  606.     /**
  607.      * Event handler: Called before the plugin is installed.
  608.      * @see Plugin::BeforeInstall()
  609.      */
  610.     function BeforeInstall()
  611.     {
  612.         global $Plugins;
  613.         $this->msg'TEST plugin: BeforeInstall event.' );
  614.         return true;
  615.     }
  616.  
  617.  
  618.     /**
  619.      * Event handler: Called when the plugin has been installed.
  620.      * @see Plugin::AfterInstall()
  621.      */
  622.     function AfterInstall()
  623.     {
  624.         $this->msg'TEST plugin sucessfully installed. All the hard work we did was adding this message in the AfterInstall event.. ;)' );
  625.     }
  626.  
  627.  
  628.     /**
  629.      * Event handler: Called before the plugin is going to be un-installed.
  630.      * @see Plugin::BeforeUninstall()
  631.      */
  632.     function BeforeUninstall()
  633.     {
  634.         $this->msg'TEST plugin sucessfully un-installed. All the hard work we did was adding this message.. ;)' );
  635.         return true;
  636.     }
  637.  
  638.  
  639.     /**
  640.      * Event handler: called when a new user has registered.
  641.      * @see Plugin::AfterUserRegistration()
  642.      */
  643.     function AfterUserRegistration$params )
  644.     {
  645.         $this->msg'The TEST plugin welcomes the new user '.$params['User']->dget('login').'!' );
  646.     }
  647.  
  648.  
  649.     /**
  650.      * Event handler: Called at the end of the "Login" form.
  651.      * @see Plugin::DisplayLoginFormFieldset()
  652.      */
  653.     function DisplayLoginFormFieldset$params )
  654.     {
  655.         $params['Form']->info_field'TEST plugin''This is the TEST plugin hooking the DisplayLoginFormFieldset event.' );
  656.     }
  657.  
  658.  
  659.     /**
  660.      * Event handler: Called when a user tries to login.
  661.      * @see Plugin::LoginAttempt()
  662.      */
  663.     function LoginAttempt()
  664.     {
  665.         // $this->msg( 'NO LOGIN!', 'login_error' );
  666.         $this->msg'This the TEST plugin responding to the LoginAttempt event.''note' );
  667.     }
  668.  
  669.  
  670.     /**
  671.      * Event handler: Do we need a raw password in {@link LoginAttempt()}?
  672.      * @see Plugin::LoginAttemptNeedsRawPassword()
  673.      */
  674.     function LoginAttemptNeedsRawPassword()
  675.     {
  676.         return false;    // No we don't need raw. (do not implement this method if the answer is no)
  677.     }
  678.  
  679.  
  680.     /**
  681.      * Automagically login every user as "demouser" who is not logged in and does not
  682.      * try to currently.
  683.      *
  684.      * To enable/test it, change the "if-0" check below to "if( 1 )".
  685.      *
  686.      * @see Plugin::AlternateAuthentication()
  687.      */
  688.     function AlternateAuthentication()
  689.     {
  690.         if// you should only enable it for test purposes, because it automagically logs every user in as "demouser"!
  691.         {
  692.             global $Session$Messages;
  693.  
  694.             $UserCache get_Cache'UserCache' );
  695.             if$demo_User $UserCache->get_by_login('demouser') )
  696.             // demouser exists:
  697.                 $Session->set_User$demo_User );
  698.                 $Messages->add'Logged in as demouser.''success' );
  699.                 return true;
  700.             }
  701.         }
  702.     }
  703.  
  704.  
  705.     /**
  706.      * @see Plugin::DisplayValidateAccountFormFieldset()
  707.      */
  708.     function DisplayValidateAccountFormFieldset$params )
  709.     {
  710.         $params['Form']->info'TEST plugin''This is the TEST plugin responding to the ValidateAccountFormSent event.' );
  711.     }
  712.  
  713.  
  714.     /**
  715.      * Gets provided as plugin event (and gets also used internally for demonstration).
  716.      *
  717.      * @param array Associative array of parameters
  718.      *               'min': mininum number
  719.      *               'max': maxinum number
  720.      * @return integer 
  721.      */
  722.     function test_plugin_get_random$params )
  723.     {
  724.         return rand$params['min']$params['max');
  725.     }
  726.  
  727. }
  728.  
  729.  
  730. /*
  731.  * $Log: _test.plugin.php,v $
  732.  * Revision 1.72  2008/01/21 09:35:41  fplanque
  733.  * (c) 2008
  734.  *
  735.  * Revision 1.71  2007/06/24 17:48:40  personman2
  736.  * changed jquery alias to #jquery#
  737.  *
  738.  * Revision 1.70  2007/06/24 15:43:33  personman2
  739.  * Reworking the process for a skin or plugin to add js and css files to a blog display.  Removed the custom header for nifty_corners.
  740.  *
  741.  * Revision 1.69  2007/06/19 20:42:53  fplanque
  742.  * basic demo of widget params handled by autoform_*
  743.  *
  744.  * Revision 1.68  2007/06/19 00:03:26  fplanque
  745.  * doc / trying to make sense of automatic settings forms generation.
  746.  *
  747.  * Revision 1.67  2007/06/16 20:28:04  blueyed
  748.  * Added more info in DisplayLoginFormFieldset event
  749.  *
  750.  * Revision 1.66  2007/04/26 00:11:04  fplanque
  751.  * (c) 2007
  752.  *
  753.  * Revision 1.65  2007/01/24 00:48:58  fplanque
  754.  * Refactoring
  755.  *
  756.  * Revision 1.64  2007/01/20 23:48:10  blueyed
  757.  * Changed plugin default URL to manual.b2evolution.net/classname_plugin
  758.  *
  759.  * Revision 1.63  2006/12/26 00:08:01  fplanque
  760.  * reduce strain on translators. plugin devs need to understand english anyway.
  761.  *
  762.  * Revision 1.62  2006/12/22 22:29:35  blueyed
  763.  * Support for "multiple" attribute in SELECT elements, especially for GetDefault(User)Settings plugin callback
  764.  *
  765.  * Revision 1.61  2006/12/10 12:42:40  blueyed
  766.  * "maxlength" handling for textarea fields through javascript
  767.  *
  768.  * Revision 1.60  2006/12/06 23:32:35  fplanque
  769.  * Rollback to Daniel's most reliable password hashing design. (which is not the last one)
  770.  * This not only strengthens the login by providing less failure points, it also:
  771.  * - Fixes the login in IE7
  772.  * - Removes the double "do you want to memorize this password' in FF.
  773.  *
  774.  * Revision 1.59  2006/12/05 01:57:32  blueyed
  775.  * Added more settings
  776.  *
  777.  * Revision 1.57  2006/12/01 16:26:34  blueyed
  778.  * Added AdminDisplayCommentFormFieldset hook
  779.  *
  780.  * Revision 1.56  2006/11/24 18:27:27  blueyed
  781.  * Fixed link to b2evo CVS browsing interface in file docblocks
  782.  *
  783.  * Revision 1.55  2006/10/30 19:00:37  blueyed
  784.  * Lazy-loading of Plugin (User)Settings for PHP5 through overloading
  785.  *
  786.  * Revision 1.54  2006/10/01 15:11:08  blueyed
  787.  * Added DisplayItemAs* equivs to RenderItemAs*; removed DisplayItemAllFormats; clearing of pre-rendered cache, according to plugin event changes
  788.  *
  789.  * Revision 1.53  2006/09/30 20:53:49  blueyed
  790.  * Added hook RenderItemAsText, removed general RenderItem
  791.  *
  792.  * Revision 1.52  2006/09/11 22:23:05  blueyed
  793.  * (Re-)enabled AdminDisplayEditorButton for "simple" edit_layout, after adding appropriate doc.
  794.  *
  795.  * Revision 1.51  2006/08/29 16:44:47  blueyed
  796.  * Logical fix for cron job return value.
  797.  *
  798.  * Revision 1.50  2006/08/28 20:16:30  blueyed
  799.  * Added GetCronJobs/ExecCronJob Plugin hooks.
  800.  *
  801.  * Revision 1.49  2006/08/19 07:56:32  fplanque
  802.  * Moved a lot of stuff out of the automatic instanciation in _main.inc
  803.  *
  804.  * Revision 1.48  2006/07/10 22:53:38  blueyed
  805.  * Grouping of plugins added, based on a patch from balupton
  806.  *
  807.  * Revision 1.47  2006/07/10 20:19:30  blueyed
  808.  * Fixed PluginInit behaviour. It now gets called on both installed and non-installed Plugins, but with the "is_installed" param appropriately set.
  809.  *
  810.  * Revision 1.46  2006/07/07 21:26:49  blueyed
  811.  * Bumped to 1.9-dev
  812.  *
  813.  * Revision 1.45  2006/07/06 19:56:29  fplanque
  814.  * no message
  815.  *
  816.  * Revision 1.44  2006/06/16 21:30:57  fplanque
  817.  * Started clean numbering of plugin versions (feel free do add dots...)
  818.  *
  819.  * Revision 1.43  2006/06/13 21:33:40  blueyed
  820.  * Add note when updating PluginUserSettings
  821.  *
  822.  * Revision 1.42  2006/06/06 20:35:50  blueyed
  823.  * Plugins can define extra events that they trigger themselves.
  824.  *
  825.  * Revision 1.41  2006/05/30 19:39:55  fplanque
  826.  * plugin cleanup
  827.  *
  828.  * Revision 1.40  2006/05/24 20:43:19  blueyed
  829.  * Pass "Item" as param to Render* event methods.
  830.  *
  831.  * Revision 1.39  2006/05/22 20:35:37  blueyed
  832.  * Passthrough some attribute of plugin settings, allowing to use JS handlers. Also fixed submitting of disabled form elements.
  833.  *
  834.  * Revision 1.38  2006/05/05 19:36:24  blueyed
  835.  * New events
  836.  *
  837.  * Revision 1.37  2006/05/02 01:47:58  blueyed
  838.  * Normalization
  839.  *
  840.  * Revision 1.36  2006/04/24 15:43:37  fplanque
  841.  * no message
  842.  *
  843.  * Revision 1.35  2006/04/22 02:36:39  blueyed
  844.  * Validate users on registration through email link (+cleanup around it)
  845.  *
  846.  * Revision 1.34  2006/04/21 16:53:27  blueyed
  847.  * Bumping TODO, please comment.
  848.  *
  849.  * Revision 1.33  2006/04/20 22:24:08  blueyed
  850.  * plugin hooks cleanup
  851.  *
  852.  * Revision 1.32  2006/04/19 22:26:25  blueyed
  853.  * cleanup/polish
  854.  *
  855.  * Revision 1.31  2006/04/19 20:14:03  fplanque
  856.  * do not restrict to :// (does not catch subdomains, not even www.)
  857.  *
  858.  * Revision 1.30  2006/04/19 18:55:37  blueyed
  859.  * Added login handling hook: AlternateAuthentication
  860.  *
  861.  * Revision 1.29  2006/04/18 17:06:14  blueyed
  862.  * Added "disabled" to plugin (user) settings (Thanks to balupton)
  863.  *
  864.  * Revision 1.28  2006/04/11 21:22:26  fplanque
  865.  * partial cleanup
  866.  *
  867.  */
  868. ?>

Documentation generated on Sat, 06 Mar 2010 03:41:04 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).