File indexing completed on 2025-01-19 05:21:20
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_OpenId 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * Abstract extension class for Zend_OpenId 0025 * 0026 * @category Zend 0027 * @package Zend_OpenId 0028 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0029 * @license http://framework.zend.com/license/new-bsd New BSD License 0030 */ 0031 abstract class Zend_OpenId_Extension 0032 { 0033 0034 /** 0035 * Calls given function with given argument for all extensions 0036 * 0037 * @param mixed $extensions list of extensions or one extension 0038 * @param string $func function to be called 0039 * @param mixed &$params argument to pass to given funcion 0040 * @return bool 0041 */ 0042 static public function forAll($extensions, $func, &$params) 0043 { 0044 if ($extensions !== null) { 0045 if (is_array($extensions)) { 0046 foreach ($extensions as $ext) { 0047 if ($ext instanceof Zend_OpenId_Extension) { 0048 if (!$ext->$func($params)) { 0049 return false; 0050 } 0051 } else { 0052 return false; 0053 } 0054 } 0055 } else if (!is_object($extensions) || 0056 !($extensions instanceof Zend_OpenId_Extension) || 0057 !$extensions->$func($params)) { 0058 return false; 0059 } 0060 } 0061 return true; 0062 } 0063 0064 /** 0065 * Method to add additional data to OpenId 'checkid_immediate' or 0066 * 'checkid_setup' request. This method addes nothing but inherited class 0067 * may add additional data into request. 0068 * 0069 * @param array &$params request's var/val pairs 0070 * @return bool 0071 */ 0072 public function prepareRequest(&$params) 0073 { 0074 return true; 0075 } 0076 0077 /** 0078 * Method to parse OpenId 'checkid_immediate' or 'checkid_setup' request 0079 * and initialize object with passed data. This method parses nothing but 0080 * inherited class may override this method to do somthing. 0081 * 0082 * @param array $params request's var/val pairs 0083 * @return bool 0084 */ 0085 public function parseRequest($params) 0086 { 0087 return true; 0088 } 0089 0090 /** 0091 * Method to add additional data to OpenId 'id_res' response. This method 0092 * addes nothing but inherited class may add additional data into response. 0093 * 0094 * @param array &$params response's var/val pairs 0095 * @return bool 0096 */ 0097 public function prepareResponse(&$params) 0098 { 0099 return true; 0100 } 0101 0102 /** 0103 * Method to parse OpenId 'id_res' response and initialize object with 0104 * passed data. This method parses nothing but inherited class may override 0105 * this method to do somthing. 0106 * 0107 * @param array $params response's var/val pairs 0108 * @return bool 0109 */ 0110 public function parseResponse($params) 0111 { 0112 return true; 0113 } 0114 0115 /** 0116 * Method to prepare data to store it in trusted servers database. 0117 * 0118 * @param array &$data data to be stored in tusted servers database 0119 * @return bool 0120 */ 0121 public function getTrustData(&$data) 0122 { 0123 return true; 0124 } 0125 0126 /** 0127 * Method to check if data from trusted servers database is enough to 0128 * sutisfy request. 0129 * 0130 * @param array $data data from tusted servers database 0131 * @return bool 0132 */ 0133 public function checkTrustData($data) 0134 { 0135 return true; 0136 } 0137 }