| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage JFramework 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is included in Joomla! 16 defined( '_JEXEC' ) or die( 'Restricted access' ); 17 18 jimport( 'joomla.plugin.plugin' ); 19 20 /** 21 * Example Authentication Plugin 22 * 23 * @package Joomla 24 * @subpackage JFramework 25 * @since 1.5 26 */ 27 class plgAuthenticationExample extends JPlugin 28 { 29 /** 30 * Constructor 31 * 32 * For php4 compatability we must not use the __constructor as a constructor for plugins 33 * because func_get_args ( void ) returns a copy of all passed arguments NOT references. 34 * This causes problems with cross-referencing necessary for the observer design pattern. 35 * 36 * @param object $subject The object to observe 37 * @param array $config An array that holds the plugin configuration 38 * @since 1.5 39 */ 40 function plgAuthenticationExample(& $subject, $config) 41 { 42 parent::__construct($subject, $config); 43 } 44 45 /** 46 * This method should handle any authentication and report back to the subject 47 * 48 * @access public 49 * @param array $credentials Array holding the user credentials 50 * @param array $options Array of extra options 51 * @param object $response Authentication response object 52 * @return boolean 53 * @since 1.5 54 */ 55 function onAuthenticate( $credentials, $options, &$response ) 56 { 57 /* 58 * Here you would do whatever you need for an authentication routine with the credentials 59 * 60 * In this example the mixed variable $return would be set to false 61 * if the authentication routine fails or an integer userid of the authenticated 62 * user if the routine passes 63 */ 64 $success = true; 65 66 if ($success) 67 { 68 $response->status = JAUTHENTICATE_STATUS_SUCCESS; 69 $response->error_message = ''; 70 // You may also define other variables: 71 /* 72 $yourUser = YourClass::getUser( $credentials ); 73 $response->email = $yourUser->email; 74 $response->fullname = $yourUser->name; 75 */ 76 return true; 77 } 78 else 79 { 80 $response->status = JAUTHENTICATE_STATUS_FAILURE; 81 $response->error_message = 'Could not authenticate'; 82 return false; 83 } 84 } 85 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |