@@ -39,90 +39,90 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | class LoggerLoggingEvent { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var string Fully Qualified Class Name of the calling category class. |
|
| 44 | - */ |
|
| 45 | - public $fqcn; |
|
| 42 | + /** |
|
| 43 | + * @var string Fully Qualified Class Name of the calling category class. |
|
| 44 | + */ |
|
| 45 | + public $fqcn; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var Logger reference |
|
| 49 | - */ |
|
| 50 | - public $logger = null; |
|
| 47 | + /** |
|
| 48 | + * @var Logger reference |
|
| 49 | + */ |
|
| 50 | + public $logger = null; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * The category (logger) name. |
|
| 54 | - * This field will be marked as private in future |
|
| 55 | - * releases. Please do not access it directly. |
|
| 56 | - * Use the {@link getLoggerName()} method instead. |
|
| 57 | - * @deprecated |
|
| 58 | - */ |
|
| 59 | - public $categoryName; |
|
| 52 | + /** |
|
| 53 | + * The category (logger) name. |
|
| 54 | + * This field will be marked as private in future |
|
| 55 | + * releases. Please do not access it directly. |
|
| 56 | + * Use the {@link getLoggerName()} method instead. |
|
| 57 | + * @deprecated |
|
| 58 | + */ |
|
| 59 | + public $categoryName; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Level of logging event. |
|
| 63 | - * <p> This field should not be accessed directly. You shoud use the |
|
| 64 | - * {@link getLevel()} method instead. |
|
| 65 | - * |
|
| 66 | - * @deprecated |
|
| 67 | - * @var LoggerLevel |
|
| 68 | - */ |
|
| 69 | - public $level; |
|
| 61 | + /** |
|
| 62 | + * Level of logging event. |
|
| 63 | + * <p> This field should not be accessed directly. You shoud use the |
|
| 64 | + * {@link getLevel()} method instead. |
|
| 65 | + * |
|
| 66 | + * @deprecated |
|
| 67 | + * @var LoggerLevel |
|
| 68 | + */ |
|
| 69 | + public $level; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @var string The nested diagnostic context (NDC) of logging event. |
|
| 73 | - */ |
|
| 74 | - public $ndc; |
|
| 71 | + /** |
|
| 72 | + * @var string The nested diagnostic context (NDC) of logging event. |
|
| 73 | + */ |
|
| 74 | + public $ndc; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Have we tried to do an NDC lookup? If we did, there is no need |
|
| 78 | - * to do it again. Note that its value is always false when |
|
| 79 | - * serialized. Thus, a receiving SocketNode will never use it's own |
|
| 80 | - * (incorrect) NDC. See also writeObject method. |
|
| 81 | - * @var boolean |
|
| 82 | - */ |
|
| 83 | - public $ndcLookupRequired = true; |
|
| 76 | + /** |
|
| 77 | + * Have we tried to do an NDC lookup? If we did, there is no need |
|
| 78 | + * to do it again. Note that its value is always false when |
|
| 79 | + * serialized. Thus, a receiving SocketNode will never use it's own |
|
| 80 | + * (incorrect) NDC. See also writeObject method. |
|
| 81 | + * @var boolean |
|
| 82 | + */ |
|
| 83 | + public $ndcLookupRequired = true; |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Have we tried to do an MDC lookup? If we did, there is no need |
|
| 87 | - * to do it again. Note that its value is always false when |
|
| 88 | - * serialized. See also the getMDC and getMDCCopy methods. |
|
| 89 | - * @var boolean |
|
| 90 | - */ |
|
| 91 | - public $mdcCopyLookupRequired = true; |
|
| 85 | + /** |
|
| 86 | + * Have we tried to do an MDC lookup? If we did, there is no need |
|
| 87 | + * to do it again. Note that its value is always false when |
|
| 88 | + * serialized. See also the getMDC and getMDCCopy methods. |
|
| 89 | + * @var boolean |
|
| 90 | + */ |
|
| 91 | + public $mdcCopyLookupRequired = true; |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * @var mixed The application supplied message of logging event. |
|
| 95 | - */ |
|
| 96 | - public $message; |
|
| 93 | + /** |
|
| 94 | + * @var mixed The application supplied message of logging event. |
|
| 95 | + */ |
|
| 96 | + public $message; |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * The application supplied message rendered through the log4php |
|
| 100 | - * objet rendering mechanism. At present renderedMessage == message. |
|
| 101 | - * @var string |
|
| 102 | - */ |
|
| 103 | - public $renderedMessage; |
|
| 98 | + /** |
|
| 99 | + * The application supplied message rendered through the log4php |
|
| 100 | + * objet rendering mechanism. At present renderedMessage == message. |
|
| 101 | + * @var string |
|
| 102 | + */ |
|
| 103 | + public $renderedMessage; |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * The name of thread in which this logging event was generated. |
|
| 107 | - * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} |
|
| 108 | - * @var mixed |
|
| 109 | - */ |
|
| 110 | - public $threadName = null; |
|
| 105 | + /** |
|
| 106 | + * The name of thread in which this logging event was generated. |
|
| 107 | + * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} |
|
| 108 | + * @var mixed |
|
| 109 | + */ |
|
| 110 | + public $threadName = null; |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * The number of seconds elapsed from 1/1/1970 until logging event |
|
| 114 | - * was created plus microseconds if available. |
|
| 115 | - * @var float |
|
| 116 | - */ |
|
| 117 | - public $timeStamp; |
|
| 112 | + /** |
|
| 113 | + * The number of seconds elapsed from 1/1/1970 until logging event |
|
| 114 | + * was created plus microseconds if available. |
|
| 115 | + * @var float |
|
| 116 | + */ |
|
| 117 | + public $timeStamp; |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * @var LoggerLocationInfo Location information for the caller. |
|
| 121 | - */ |
|
| 122 | - public $locationInfo = null; |
|
| 119 | + /** |
|
| 120 | + * @var LoggerLocationInfo Location information for the caller. |
|
| 121 | + */ |
|
| 122 | + public $locationInfo = null; |
|
| 123 | 123 | |
| 124 | - // Serialization |
|
| 125 | - /* |
|
| 124 | + // Serialization |
|
| 125 | + /* |
|
| 126 | 126 | public $serialVersionUID = -868428216207166145L; |
| 127 | 127 | public $PARAM_ARRAY = array(); |
| 128 | 128 | public $TO_LEVEL = "toLevel"; |
@@ -130,252 +130,252 @@ discard block |
||
| 130 | 130 | public $methodCache = array(); // use a tiny table |
| 131 | 131 | */ |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Instantiate a LoggingEvent from the supplied parameters. |
|
| 135 | - * |
|
| 136 | - * <p>Except {@link $timeStamp} all the other fields of |
|
| 137 | - * LoggerLoggingEvent are filled when actually needed. |
|
| 138 | - * |
|
| 139 | - * @param string $fqcn name of the caller class. |
|
| 140 | - * @param mixed &$logger The {@link Logger} category of this event or the logger name. |
|
| 141 | - * @param LoggerLevel $priority The level of this event. |
|
| 142 | - * @param mixed $message The message of this event. |
|
| 143 | - * @param integer $timeStamp the timestamp of this logging event. |
|
| 144 | - */ |
|
| 145 | - public function LoggerLoggingEvent($fqcn, &$logger, $priority, $message, $timeStamp = null) |
|
| 146 | - { |
|
| 147 | - $this->fqcn = $fqcn; |
|
| 148 | - if (is_a($logger, 'logger')) { |
|
| 149 | - $this->logger =& $logger; |
|
| 150 | - $this->categoryName = $logger->getName(); |
|
| 151 | - } else { |
|
| 152 | - $this->categoryName = (string)$logger; |
|
| 153 | - } |
|
| 154 | - $this->level = $priority; |
|
| 155 | - $this->message = $message; |
|
| 156 | - if ($timeStamp !== null && is_float($timeStamp)) { |
|
| 157 | - $this->timeStamp = $timeStamp; |
|
| 158 | - } else { |
|
| 159 | - if (function_exists('microtime')) { |
|
| 160 | - list($usecs, $secs) = explode(' ', microtime()); |
|
| 161 | - $this->timeStamp = ((float)$usecs + (float)$secs); |
|
| 162 | - } else { |
|
| 163 | - $this->timeStamp = time(); |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } |
|
| 133 | + /** |
|
| 134 | + * Instantiate a LoggingEvent from the supplied parameters. |
|
| 135 | + * |
|
| 136 | + * <p>Except {@link $timeStamp} all the other fields of |
|
| 137 | + * LoggerLoggingEvent are filled when actually needed. |
|
| 138 | + * |
|
| 139 | + * @param string $fqcn name of the caller class. |
|
| 140 | + * @param mixed &$logger The {@link Logger} category of this event or the logger name. |
|
| 141 | + * @param LoggerLevel $priority The level of this event. |
|
| 142 | + * @param mixed $message The message of this event. |
|
| 143 | + * @param integer $timeStamp the timestamp of this logging event. |
|
| 144 | + */ |
|
| 145 | + public function LoggerLoggingEvent($fqcn, &$logger, $priority, $message, $timeStamp = null) |
|
| 146 | + { |
|
| 147 | + $this->fqcn = $fqcn; |
|
| 148 | + if (is_a($logger, 'logger')) { |
|
| 149 | + $this->logger =& $logger; |
|
| 150 | + $this->categoryName = $logger->getName(); |
|
| 151 | + } else { |
|
| 152 | + $this->categoryName = (string)$logger; |
|
| 153 | + } |
|
| 154 | + $this->level = $priority; |
|
| 155 | + $this->message = $message; |
|
| 156 | + if ($timeStamp !== null && is_float($timeStamp)) { |
|
| 157 | + $this->timeStamp = $timeStamp; |
|
| 158 | + } else { |
|
| 159 | + if (function_exists('microtime')) { |
|
| 160 | + list($usecs, $secs) = explode(' ', microtime()); |
|
| 161 | + $this->timeStamp = ((float)$usecs + (float)$secs); |
|
| 162 | + } else { |
|
| 163 | + $this->timeStamp = time(); |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Set the location information for this logging event. The collected |
|
| 170 | - * information is cached for future use. |
|
| 171 | - * |
|
| 172 | - * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists) |
|
| 173 | - * to collect informations about caller.</p> |
|
| 174 | - * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p> |
|
| 175 | - * @return LoggerLocationInfo |
|
| 176 | - */ |
|
| 177 | - public function getLocationInformation() |
|
| 178 | - { |
|
| 179 | - if($this->locationInfo === null) { |
|
| 168 | + /** |
|
| 169 | + * Set the location information for this logging event. The collected |
|
| 170 | + * information is cached for future use. |
|
| 171 | + * |
|
| 172 | + * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists) |
|
| 173 | + * to collect informations about caller.</p> |
|
| 174 | + * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p> |
|
| 175 | + * @return LoggerLocationInfo |
|
| 176 | + */ |
|
| 177 | + public function getLocationInformation() |
|
| 178 | + { |
|
| 179 | + if($this->locationInfo === null) { |
|
| 180 | 180 | |
| 181 | - $locationInfo = array(); |
|
| 181 | + $locationInfo = array(); |
|
| 182 | 182 | |
| 183 | - if (function_exists('debug_backtrace')) { |
|
| 184 | - $trace = debug_backtrace(); |
|
| 185 | - $prevHop = null; |
|
| 186 | - // make a downsearch to identify the caller |
|
| 187 | - $hop = array_pop($trace); |
|
| 188 | - while ($hop !== null) { |
|
| 189 | - $className = @$hop['class']; |
|
| 190 | - if ( !empty($className) && ($className == 'logger' || get_parent_class($className) == 'logger') ) { |
|
| 191 | - $locationInfo['line'] = $hop['line']; |
|
| 192 | - $locationInfo['file'] = $hop['file']; |
|
| 193 | - break; |
|
| 194 | - } |
|
| 195 | - $prevHop = $hop; |
|
| 196 | - $hop = array_pop($trace); |
|
| 197 | - } |
|
| 198 | - $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main'; |
|
| 199 | - if (isset($prevHop['function']) && |
|
| 200 | - $prevHop['function'] !== 'include' && |
|
| 201 | - $prevHop['function'] !== 'include_once' && |
|
| 202 | - $prevHop['function'] !== 'require' && |
|
| 203 | - $prevHop['function'] !== 'require_once') { |
|
| 183 | + if (function_exists('debug_backtrace')) { |
|
| 184 | + $trace = debug_backtrace(); |
|
| 185 | + $prevHop = null; |
|
| 186 | + // make a downsearch to identify the caller |
|
| 187 | + $hop = array_pop($trace); |
|
| 188 | + while ($hop !== null) { |
|
| 189 | + $className = @$hop['class']; |
|
| 190 | + if ( !empty($className) && ($className == 'logger' || get_parent_class($className) == 'logger') ) { |
|
| 191 | + $locationInfo['line'] = $hop['line']; |
|
| 192 | + $locationInfo['file'] = $hop['file']; |
|
| 193 | + break; |
|
| 194 | + } |
|
| 195 | + $prevHop = $hop; |
|
| 196 | + $hop = array_pop($trace); |
|
| 197 | + } |
|
| 198 | + $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main'; |
|
| 199 | + if (isset($prevHop['function']) && |
|
| 200 | + $prevHop['function'] !== 'include' && |
|
| 201 | + $prevHop['function'] !== 'include_once' && |
|
| 202 | + $prevHop['function'] !== 'require' && |
|
| 203 | + $prevHop['function'] !== 'require_once') { |
|
| 204 | 204 | |
| 205 | - $locationInfo['function'] = $prevHop['function']; |
|
| 206 | - } else { |
|
| 207 | - $locationInfo['function'] = 'main'; |
|
| 208 | - } |
|
| 209 | - } |
|
| 205 | + $locationInfo['function'] = $prevHop['function']; |
|
| 206 | + } else { |
|
| 207 | + $locationInfo['function'] = 'main'; |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - $this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn); |
|
| 212 | - } |
|
| 213 | - return $this->locationInfo; |
|
| 214 | - } |
|
| 211 | + $this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn); |
|
| 212 | + } |
|
| 213 | + return $this->locationInfo; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Return the level of this event. Use this form instead of directly |
|
| 218 | - * accessing the {@link $level} field. |
|
| 219 | - * @return LoggerLevel |
|
| 220 | - */ |
|
| 221 | - public function getLevel() |
|
| 222 | - { |
|
| 223 | - return $this->level; |
|
| 224 | - } |
|
| 216 | + /** |
|
| 217 | + * Return the level of this event. Use this form instead of directly |
|
| 218 | + * accessing the {@link $level} field. |
|
| 219 | + * @return LoggerLevel |
|
| 220 | + */ |
|
| 221 | + public function getLevel() |
|
| 222 | + { |
|
| 223 | + return $this->level; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - /** |
|
| 227 | - * Return the name of the logger. Use this form instead of directly |
|
| 228 | - * accessing the {@link $categoryName} field. |
|
| 229 | - * @return string |
|
| 230 | - */ |
|
| 231 | - public function getLoggerName() |
|
| 232 | - { |
|
| 233 | - return $this->categoryName; |
|
| 234 | - } |
|
| 226 | + /** |
|
| 227 | + * Return the name of the logger. Use this form instead of directly |
|
| 228 | + * accessing the {@link $categoryName} field. |
|
| 229 | + * @return string |
|
| 230 | + */ |
|
| 231 | + public function getLoggerName() |
|
| 232 | + { |
|
| 233 | + return $this->categoryName; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - /** |
|
| 237 | - * Return the message for this logging event. |
|
| 238 | - * |
|
| 239 | - * <p>Before serialization, the returned object is the message |
|
| 240 | - * passed by the user to generate the logging event. After |
|
| 241 | - * serialization, the returned value equals the String form of the |
|
| 242 | - * message possibly after object rendering. |
|
| 243 | - * @return mixed |
|
| 244 | - */ |
|
| 245 | - public function getMessage() |
|
| 246 | - { |
|
| 247 | - if($this->message !== null) { |
|
| 248 | - return $this->message; |
|
| 249 | - } else { |
|
| 250 | - return $this->getRenderedMessage(); |
|
| 251 | - } |
|
| 252 | - } |
|
| 236 | + /** |
|
| 237 | + * Return the message for this logging event. |
|
| 238 | + * |
|
| 239 | + * <p>Before serialization, the returned object is the message |
|
| 240 | + * passed by the user to generate the logging event. After |
|
| 241 | + * serialization, the returned value equals the String form of the |
|
| 242 | + * message possibly after object rendering. |
|
| 243 | + * @return mixed |
|
| 244 | + */ |
|
| 245 | + public function getMessage() |
|
| 246 | + { |
|
| 247 | + if($this->message !== null) { |
|
| 248 | + return $this->message; |
|
| 249 | + } else { |
|
| 250 | + return $this->getRenderedMessage(); |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * This method returns the NDC for this event. It will return the |
|
| 256 | - * correct content even if the event was generated in a different |
|
| 257 | - * thread or even on a different machine. The {@link LoggerNDC::get()} method |
|
| 258 | - * should <b>never</b> be called directly. |
|
| 259 | - * @return string |
|
| 260 | - */ |
|
| 261 | - public function getNDC() |
|
| 262 | - { |
|
| 263 | - if ($this->ndcLookupRequired) { |
|
| 264 | - $this->ndcLookupRequired = false; |
|
| 265 | - $this->ndc = implode(' ',LoggerNDC::get()); |
|
| 266 | - } |
|
| 267 | - return $this->ndc; |
|
| 268 | - } |
|
| 254 | + /** |
|
| 255 | + * This method returns the NDC for this event. It will return the |
|
| 256 | + * correct content even if the event was generated in a different |
|
| 257 | + * thread or even on a different machine. The {@link LoggerNDC::get()} method |
|
| 258 | + * should <b>never</b> be called directly. |
|
| 259 | + * @return string |
|
| 260 | + */ |
|
| 261 | + public function getNDC() |
|
| 262 | + { |
|
| 263 | + if ($this->ndcLookupRequired) { |
|
| 264 | + $this->ndcLookupRequired = false; |
|
| 265 | + $this->ndc = implode(' ',LoggerNDC::get()); |
|
| 266 | + } |
|
| 267 | + return $this->ndc; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Returns the the context corresponding to the <code>key</code> |
|
| 273 | - * parameter. |
|
| 274 | - * @return string |
|
| 275 | - */ |
|
| 276 | - public function getMDC($key) |
|
| 277 | - { |
|
| 278 | - return LoggerMDC::get($key); |
|
| 279 | - } |
|
| 271 | + /** |
|
| 272 | + * Returns the the context corresponding to the <code>key</code> |
|
| 273 | + * parameter. |
|
| 274 | + * @return string |
|
| 275 | + */ |
|
| 276 | + public function getMDC($key) |
|
| 277 | + { |
|
| 278 | + return LoggerMDC::get($key); |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * Render message. |
|
| 283 | - * @return string |
|
| 284 | - */ |
|
| 285 | - public function getRenderedMessage() |
|
| 286 | - { |
|
| 287 | - if($this->renderedMessage === null && $this->message !== null) { |
|
| 288 | - if (is_string($this->message)) { |
|
| 289 | - $this->renderedMessage = $this->message; |
|
| 290 | - } else { |
|
| 291 | - if ($this->logger !== null) { |
|
| 292 | - $repository =& $this->logger->getLoggerRepository(); |
|
| 293 | - } else { |
|
| 294 | - $repository =& LoggerManager::getLoggerRepository(); |
|
| 295 | - } |
|
| 296 | - if (method_exists($repository, 'getrenderermap')) { |
|
| 297 | - $rendererMap =& $repository->getRendererMap(); |
|
| 298 | - $this->renderedMessage= $rendererMap->findAndRender($this->message); |
|
| 299 | - } else { |
|
| 300 | - $this->renderedMessage = (string)$this->message; |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - } |
|
| 304 | - return $this->renderedMessage; |
|
| 305 | - } |
|
| 281 | + /** |
|
| 282 | + * Render message. |
|
| 283 | + * @return string |
|
| 284 | + */ |
|
| 285 | + public function getRenderedMessage() |
|
| 286 | + { |
|
| 287 | + if($this->renderedMessage === null && $this->message !== null) { |
|
| 288 | + if (is_string($this->message)) { |
|
| 289 | + $this->renderedMessage = $this->message; |
|
| 290 | + } else { |
|
| 291 | + if ($this->logger !== null) { |
|
| 292 | + $repository =& $this->logger->getLoggerRepository(); |
|
| 293 | + } else { |
|
| 294 | + $repository =& LoggerManager::getLoggerRepository(); |
|
| 295 | + } |
|
| 296 | + if (method_exists($repository, 'getrenderermap')) { |
|
| 297 | + $rendererMap =& $repository->getRendererMap(); |
|
| 298 | + $this->renderedMessage= $rendererMap->findAndRender($this->message); |
|
| 299 | + } else { |
|
| 300 | + $this->renderedMessage = (string)$this->message; |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | + return $this->renderedMessage; |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * Returns the time when the application started, in seconds |
|
| 309 | - * elapsed since 01.01.1970 plus microseconds if available. |
|
| 310 | - * |
|
| 311 | - * @return float |
|
| 312 | - * @static |
|
| 313 | - */ |
|
| 314 | - public function getStartTime() |
|
| 315 | - { |
|
| 316 | - static $startTime; |
|
| 307 | + /** |
|
| 308 | + * Returns the time when the application started, in seconds |
|
| 309 | + * elapsed since 01.01.1970 plus microseconds if available. |
|
| 310 | + * |
|
| 311 | + * @return float |
|
| 312 | + * @static |
|
| 313 | + */ |
|
| 314 | + public function getStartTime() |
|
| 315 | + { |
|
| 316 | + static $startTime; |
|
| 317 | 317 | |
| 318 | - if (!isset($startTime)) { |
|
| 319 | - if (function_exists('microtime')) { |
|
| 320 | - list($usec, $sec) = explode(' ', microtime()); |
|
| 321 | - $startTime = ((float)$usec + (float)$sec); |
|
| 322 | - } else { |
|
| 323 | - $startTime = time(); |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - return $startTime; |
|
| 327 | - } |
|
| 318 | + if (!isset($startTime)) { |
|
| 319 | + if (function_exists('microtime')) { |
|
| 320 | + list($usec, $sec) = explode(' ', microtime()); |
|
| 321 | + $startTime = ((float)$usec + (float)$sec); |
|
| 322 | + } else { |
|
| 323 | + $startTime = time(); |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + return $startTime; |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | - /** |
|
| 330 | - * @return float |
|
| 331 | - */ |
|
| 332 | - public function getTimeStamp() |
|
| 333 | - { |
|
| 334 | - return $this->timeStamp; |
|
| 335 | - } |
|
| 329 | + /** |
|
| 330 | + * @return float |
|
| 331 | + */ |
|
| 332 | + public function getTimeStamp() |
|
| 333 | + { |
|
| 334 | + return $this->timeStamp; |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - /** |
|
| 338 | - * @return mixed |
|
| 339 | - */ |
|
| 340 | - public function getThreadName() |
|
| 341 | - { |
|
| 342 | - if ($this->threadName === null) |
|
| 343 | - $this->threadName = (string)getmypid(); |
|
| 344 | - return $this->threadName; |
|
| 345 | - } |
|
| 337 | + /** |
|
| 338 | + * @return mixed |
|
| 339 | + */ |
|
| 340 | + public function getThreadName() |
|
| 341 | + { |
|
| 342 | + if ($this->threadName === null) |
|
| 343 | + $this->threadName = (string)getmypid(); |
|
| 344 | + return $this->threadName; |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - /** |
|
| 348 | - * @return mixed null |
|
| 349 | - */ |
|
| 350 | - public function getThrowableInformation() |
|
| 351 | - { |
|
| 352 | - return null; |
|
| 353 | - } |
|
| 347 | + /** |
|
| 348 | + * @return mixed null |
|
| 349 | + */ |
|
| 350 | + public function getThrowableInformation() |
|
| 351 | + { |
|
| 352 | + return null; |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | - /** |
|
| 356 | - * Serialize this object |
|
| 357 | - * @return string |
|
| 358 | - */ |
|
| 359 | - public function toString() |
|
| 360 | - { |
|
| 361 | - serialize($this); |
|
| 362 | - } |
|
| 355 | + /** |
|
| 356 | + * Serialize this object |
|
| 357 | + * @return string |
|
| 358 | + */ |
|
| 359 | + public function toString() |
|
| 360 | + { |
|
| 361 | + serialize($this); |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | - /** |
|
| 365 | - * Avoid serialization of the {@link $logger} object |
|
| 366 | - */ |
|
| 367 | - public function __sleep() |
|
| 368 | - { |
|
| 369 | - return array( |
|
| 370 | - 'fqcn','categoryName', |
|
| 371 | - 'level', |
|
| 372 | - 'ndc','ndcLookupRequired', |
|
| 373 | - 'message','renderedMessage', |
|
| 374 | - 'threadName', |
|
| 375 | - 'timestamp', |
|
| 376 | - 'locationInfo' |
|
| 377 | - ); |
|
| 378 | - } |
|
| 364 | + /** |
|
| 365 | + * Avoid serialization of the {@link $logger} object |
|
| 366 | + */ |
|
| 367 | + public function __sleep() |
|
| 368 | + { |
|
| 369 | + return array( |
|
| 370 | + 'fqcn','categoryName', |
|
| 371 | + 'level', |
|
| 372 | + 'ndc','ndcLookupRequired', |
|
| 373 | + 'message','renderedMessage', |
|
| 374 | + 'threadName', |
|
| 375 | + 'timestamp', |
|
| 376 | + 'locationInfo' |
|
| 377 | + ); |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
@@ -79,35 +79,35 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | class LoggerFilter { |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain. |
|
| 84 | - */ |
|
| 85 | - public $next; |
|
| 82 | + /** |
|
| 83 | + * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain. |
|
| 84 | + */ |
|
| 85 | + public $next; |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Usually filters options become active when set. We provide a |
|
| 89 | - * default do-nothing implementation for convenience. |
|
| 90 | - */ |
|
| 91 | - public function activateOptions() |
|
| 92 | - { |
|
| 93 | - return; |
|
| 94 | - } |
|
| 87 | + /** |
|
| 88 | + * Usually filters options become active when set. We provide a |
|
| 89 | + * default do-nothing implementation for convenience. |
|
| 90 | + */ |
|
| 91 | + public function activateOptions() |
|
| 92 | + { |
|
| 93 | + return; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Decide what to do. |
|
| 98 | - * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be |
|
| 99 | - * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next |
|
| 100 | - * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then |
|
| 101 | - * the event will be logged without consulting with other filters in |
|
| 102 | - * the chain. |
|
| 103 | - * |
|
| 104 | - * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon. |
|
| 105 | - * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT} |
|
| 106 | - */ |
|
| 107 | - public function decide($event) |
|
| 108 | - { |
|
| 109 | - return LOG4PHP_LOGGER_FILTER_NEUTRAL; |
|
| 110 | - } |
|
| 96 | + /** |
|
| 97 | + * Decide what to do. |
|
| 98 | + * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be |
|
| 99 | + * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next |
|
| 100 | + * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then |
|
| 101 | + * the event will be logged without consulting with other filters in |
|
| 102 | + * the chain. |
|
| 103 | + * |
|
| 104 | + * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon. |
|
| 105 | + * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT} |
|
| 106 | + */ |
|
| 107 | + public function decide($event) |
|
| 108 | + { |
|
| 109 | + return LOG4PHP_LOGGER_FILTER_NEUTRAL; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | ?> |
| 114 | 114 | \ No newline at end of file |
@@ -53,109 +53,109 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | class LoggerPropertySetter { |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var object the target object |
|
| 58 | - * @access private |
|
| 59 | - */ |
|
| 60 | - public $obj; |
|
| 56 | + /** |
|
| 57 | + * @var object the target object |
|
| 58 | + * @access private |
|
| 59 | + */ |
|
| 60 | + public $obj; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Create a new LoggerPropertySetter for the specified Object. |
|
| 64 | - * This is done in prepartion for invoking {@link setProperty()} |
|
| 65 | - * one or more times. |
|
| 66 | - * @param object &$obj the object for which to set properties |
|
| 67 | - */ |
|
| 68 | - public function LoggerPropertySetter(&$obj) |
|
| 69 | - { |
|
| 70 | - $this->obj =& $obj; |
|
| 71 | - } |
|
| 62 | + /** |
|
| 63 | + * Create a new LoggerPropertySetter for the specified Object. |
|
| 64 | + * This is done in prepartion for invoking {@link setProperty()} |
|
| 65 | + * one or more times. |
|
| 66 | + * @param object &$obj the object for which to set properties |
|
| 67 | + */ |
|
| 68 | + public function LoggerPropertySetter(&$obj) |
|
| 69 | + { |
|
| 70 | + $this->obj =& $obj; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Set the properties of an object passed as a parameter in one |
|
| 75 | - * go. The <code>properties</code> are parsed relative to a |
|
| 76 | - * <code>prefix</code>. |
|
| 77 | - * |
|
| 78 | - * @param object &$obj The object to configure. |
|
| 79 | - * @param array $properties An array containing keys and values. |
|
| 80 | - * @param string $prefix Only keys having the specified prefix will be set. |
|
| 81 | - * @static |
|
| 82 | - */ |
|
| 83 | - public function setPropertiesByObject(&$obj, $properties, $prefix) |
|
| 84 | - { |
|
| 85 | - $pSetter = new LoggerPropertySetter($obj); |
|
| 86 | - return $pSetter->setProperties($properties, $prefix); |
|
| 87 | - } |
|
| 73 | + /** |
|
| 74 | + * Set the properties of an object passed as a parameter in one |
|
| 75 | + * go. The <code>properties</code> are parsed relative to a |
|
| 76 | + * <code>prefix</code>. |
|
| 77 | + * |
|
| 78 | + * @param object &$obj The object to configure. |
|
| 79 | + * @param array $properties An array containing keys and values. |
|
| 80 | + * @param string $prefix Only keys having the specified prefix will be set. |
|
| 81 | + * @static |
|
| 82 | + */ |
|
| 83 | + public function setPropertiesByObject(&$obj, $properties, $prefix) |
|
| 84 | + { |
|
| 85 | + $pSetter = new LoggerPropertySetter($obj); |
|
| 86 | + return $pSetter->setProperties($properties, $prefix); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Set the properites for the object that match the |
|
| 92 | - * <code>prefix</code> passed as parameter. |
|
| 93 | - * |
|
| 94 | - * @param array $properties An array containing keys and values. |
|
| 95 | - * @param string $prefix Only keys having the specified prefix will be set. |
|
| 96 | - */ |
|
| 97 | - public function setProperties($properties, $prefix) |
|
| 98 | - { |
|
| 99 | - LoggerLog::debug("LoggerOptionConverter::setProperties():prefix=[{$prefix}]"); |
|
| 90 | + /** |
|
| 91 | + * Set the properites for the object that match the |
|
| 92 | + * <code>prefix</code> passed as parameter. |
|
| 93 | + * |
|
| 94 | + * @param array $properties An array containing keys and values. |
|
| 95 | + * @param string $prefix Only keys having the specified prefix will be set. |
|
| 96 | + */ |
|
| 97 | + public function setProperties($properties, $prefix) |
|
| 98 | + { |
|
| 99 | + LoggerLog::debug("LoggerOptionConverter::setProperties():prefix=[{$prefix}]"); |
|
| 100 | 100 | |
| 101 | - $len = strlen($prefix); |
|
| 102 | - while (list($key,) = each($properties)) { |
|
| 103 | - if (strpos($key, $prefix) === 0) { |
|
| 104 | - if (strpos($key, '.', ($len + 1)) > 0) |
|
| 105 | - continue; |
|
| 106 | - $value = LoggerOptionConverter::findAndSubst($key, $properties); |
|
| 107 | - $key = substr($key, $len); |
|
| 108 | - if ($key == 'layout' && is_a($this->obj, 'loggerappender')) { |
|
| 109 | - continue; |
|
| 110 | - } |
|
| 111 | - $this->setProperty($key, $value); |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - $this->activate(); |
|
| 115 | - } |
|
| 101 | + $len = strlen($prefix); |
|
| 102 | + while (list($key,) = each($properties)) { |
|
| 103 | + if (strpos($key, $prefix) === 0) { |
|
| 104 | + if (strpos($key, '.', ($len + 1)) > 0) |
|
| 105 | + continue; |
|
| 106 | + $value = LoggerOptionConverter::findAndSubst($key, $properties); |
|
| 107 | + $key = substr($key, $len); |
|
| 108 | + if ($key == 'layout' && is_a($this->obj, 'loggerappender')) { |
|
| 109 | + continue; |
|
| 110 | + } |
|
| 111 | + $this->setProperty($key, $value); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + $this->activate(); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Set a property on this PropertySetter's Object. If successful, this |
|
| 119 | - * method will invoke a setter method on the underlying Object. The |
|
| 120 | - * setter is the one for the specified property name and the value is |
|
| 121 | - * determined partly from the setter argument type and partly from the |
|
| 122 | - * value specified in the call to this method. |
|
| 123 | - * |
|
| 124 | - * <p>If the setter expects a String no conversion is necessary. |
|
| 125 | - * If it expects an int, then an attempt is made to convert 'value' |
|
| 126 | - * to an int using new Integer(value). If the setter expects a boolean, |
|
| 127 | - * the conversion is by new Boolean(value). |
|
| 128 | - * |
|
| 129 | - * @param string $name name of the property |
|
| 130 | - * @param string $value String value of the property |
|
| 131 | - */ |
|
| 132 | - public function setProperty($name, $value) |
|
| 133 | - { |
|
| 134 | - LoggerLog::debug("LoggerOptionConverter::setProperty():name=[{$name}]:value=[{$value}]"); |
|
| 117 | + /** |
|
| 118 | + * Set a property on this PropertySetter's Object. If successful, this |
|
| 119 | + * method will invoke a setter method on the underlying Object. The |
|
| 120 | + * setter is the one for the specified property name and the value is |
|
| 121 | + * determined partly from the setter argument type and partly from the |
|
| 122 | + * value specified in the call to this method. |
|
| 123 | + * |
|
| 124 | + * <p>If the setter expects a String no conversion is necessary. |
|
| 125 | + * If it expects an int, then an attempt is made to convert 'value' |
|
| 126 | + * to an int using new Integer(value). If the setter expects a boolean, |
|
| 127 | + * the conversion is by new Boolean(value). |
|
| 128 | + * |
|
| 129 | + * @param string $name name of the property |
|
| 130 | + * @param string $value String value of the property |
|
| 131 | + */ |
|
| 132 | + public function setProperty($name, $value) |
|
| 133 | + { |
|
| 134 | + LoggerLog::debug("LoggerOptionConverter::setProperty():name=[{$name}]:value=[{$value}]"); |
|
| 135 | 135 | |
| 136 | - if ($value === null) return; |
|
| 136 | + if ($value === null) return; |
|
| 137 | 137 | |
| 138 | - $method = "set" . ucfirst($name); |
|
| 138 | + $method = "set" . ucfirst($name); |
|
| 139 | 139 | |
| 140 | - if (!method_exists($this->obj, $method)) { |
|
| 141 | - LoggerLog::warn( |
|
| 142 | - "LoggerOptionConverter::setProperty() No such setter method for [{$name}] property in " . |
|
| 143 | - get_class($this->obj) . "." |
|
| 144 | - ); |
|
| 145 | - } else { |
|
| 146 | - return call_user_func(array(&$this->obj, $method), $value); |
|
| 147 | - } |
|
| 148 | - } |
|
| 140 | + if (!method_exists($this->obj, $method)) { |
|
| 141 | + LoggerLog::warn( |
|
| 142 | + "LoggerOptionConverter::setProperty() No such setter method for [{$name}] property in " . |
|
| 143 | + get_class($this->obj) . "." |
|
| 144 | + ); |
|
| 145 | + } else { |
|
| 146 | + return call_user_func(array(&$this->obj, $method), $value); |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - public function activate() |
|
| 151 | - { |
|
| 152 | - LoggerLog::debug("LoggerOptionConverter::activate()"); |
|
| 150 | + public function activate() |
|
| 151 | + { |
|
| 152 | + LoggerLog::debug("LoggerOptionConverter::activate()"); |
|
| 153 | 153 | |
| 154 | - if (method_exists($this->obj, 'activateoptions')) { |
|
| 155 | - return call_user_func(array(&$this->obj, 'activateoptions')); |
|
| 156 | - } else { |
|
| 157 | - LoggerLog::debug("LoggerOptionConverter::activate() Nothing to activate."); |
|
| 158 | - } |
|
| 159 | - } |
|
| 154 | + if (method_exists($this->obj, 'activateoptions')) { |
|
| 155 | + return call_user_func(array(&$this->obj, 'activateoptions')); |
|
| 156 | + } else { |
|
| 157 | + LoggerLog::debug("LoggerOptionConverter::activate() Nothing to activate."); |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | 160 | } |
| 161 | 161 | ?> |
| 162 | 162 | \ No newline at end of file |
@@ -52,196 +52,196 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | class LoggerHierarchy { |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var object currently unused |
|
| 57 | - */ |
|
| 58 | - public $defaultFactory; |
|
| 55 | + /** |
|
| 56 | + * @var object currently unused |
|
| 57 | + */ |
|
| 58 | + public $defaultFactory; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var boolean activate internal logging |
|
| 62 | - * @see LoggerLog |
|
| 63 | - */ |
|
| 64 | - public $debug = false; |
|
| 60 | + /** |
|
| 61 | + * @var boolean activate internal logging |
|
| 62 | + * @see LoggerLog |
|
| 63 | + */ |
|
| 64 | + public $debug = false; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @var array hierarchy tree. saves here all loggers |
|
| 68 | - */ |
|
| 69 | - public $ht = array(); |
|
| 66 | + /** |
|
| 67 | + * @var array hierarchy tree. saves here all loggers |
|
| 68 | + */ |
|
| 69 | + public $ht = array(); |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @var LoggerRoot |
|
| 73 | - */ |
|
| 74 | - public $root = null; |
|
| 71 | + /** |
|
| 72 | + * @var LoggerRoot |
|
| 73 | + */ |
|
| 74 | + public $root = null; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @var LoggerRendererMap |
|
| 78 | - */ |
|
| 79 | - public $rendererMap; |
|
| 76 | + /** |
|
| 77 | + * @var LoggerRendererMap |
|
| 78 | + */ |
|
| 79 | + public $rendererMap; |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @var LoggerLevel main level threshold |
|
| 83 | - */ |
|
| 84 | - public $threshold; |
|
| 81 | + /** |
|
| 82 | + * @var LoggerLevel main level threshold |
|
| 83 | + */ |
|
| 84 | + public $threshold; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @var boolean currently unused |
|
| 88 | - */ |
|
| 89 | - public $emittedNoAppenderWarning = false; |
|
| 86 | + /** |
|
| 87 | + * @var boolean currently unused |
|
| 88 | + */ |
|
| 89 | + public $emittedNoAppenderWarning = false; |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * @var boolean currently unused |
|
| 93 | - */ |
|
| 94 | - public $emittedNoResourceBundleWarning = false; |
|
| 91 | + /** |
|
| 92 | + * @var boolean currently unused |
|
| 93 | + */ |
|
| 94 | + public $emittedNoResourceBundleWarning = false; |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /* --------------------------------------------------------------------------*/ |
| 98 | 98 | /* --------------------------------------------------------------------------*/ |
| 99 | 99 | /* --------------------------------------------------------------------------*/ |
| 100 | 100 | |
| 101 | - public function &singleton() |
|
| 102 | - { |
|
| 103 | - static $instance; |
|
| 101 | + public function &singleton() |
|
| 102 | + { |
|
| 103 | + static $instance; |
|
| 104 | 104 | |
| 105 | - if (!isset($instance)) |
|
| 106 | - $instance = new LoggerHierarchy(new LoggerRoot()); |
|
| 107 | - return $instance; |
|
| 108 | - } |
|
| 105 | + if (!isset($instance)) |
|
| 106 | + $instance = new LoggerHierarchy(new LoggerRoot()); |
|
| 107 | + return $instance; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Create a new logger hierarchy. |
|
| 112 | - * @param object $root the root logger |
|
| 113 | - */ |
|
| 114 | - public function LoggerHierarchy($root) |
|
| 115 | - { |
|
| 116 | - $this->root =& $root; |
|
| 117 | - // Enable all level levels by default. |
|
| 118 | - $this->setThreshold(LoggerLevel::getLevelAll()); |
|
| 119 | - $this->root->setHierarchy($this); |
|
| 120 | - $this->rendererMap = new LoggerRendererMap(); |
|
| 121 | - $this->defaultFactory = new LoggerDefaultCategoryFactory(); |
|
| 122 | - } |
|
| 110 | + /** |
|
| 111 | + * Create a new logger hierarchy. |
|
| 112 | + * @param object $root the root logger |
|
| 113 | + */ |
|
| 114 | + public function LoggerHierarchy($root) |
|
| 115 | + { |
|
| 116 | + $this->root =& $root; |
|
| 117 | + // Enable all level levels by default. |
|
| 118 | + $this->setThreshold(LoggerLevel::getLevelAll()); |
|
| 119 | + $this->root->setHierarchy($this); |
|
| 120 | + $this->rendererMap = new LoggerRendererMap(); |
|
| 121 | + $this->defaultFactory = new LoggerDefaultCategoryFactory(); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Add a HierarchyEventListener event to the repository. |
|
| 126 | - * Not Yet Impl. |
|
| 127 | - */ |
|
| 128 | - public function addHierarchyEventListener($listener) |
|
| 129 | - { |
|
| 130 | - return; |
|
| 131 | - } |
|
| 124 | + /** |
|
| 125 | + * Add a HierarchyEventListener event to the repository. |
|
| 126 | + * Not Yet Impl. |
|
| 127 | + */ |
|
| 128 | + public function addHierarchyEventListener($listener) |
|
| 129 | + { |
|
| 130 | + return; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Add an object renderer for a specific class. |
|
| 135 | - * Not Yet Impl. |
|
| 136 | - */ |
|
| 137 | - public function addRenderer($classToRender, $or) |
|
| 138 | - { |
|
| 139 | - $this->rendererMap->put($classToRender, $or); |
|
| 140 | - } |
|
| 133 | + /** |
|
| 134 | + * Add an object renderer for a specific class. |
|
| 135 | + * Not Yet Impl. |
|
| 136 | + */ |
|
| 137 | + public function addRenderer($classToRender, $or) |
|
| 138 | + { |
|
| 139 | + $this->rendererMap->put($classToRender, $or); |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * This call will clear all logger definitions from the internal hashtable. |
|
| 144 | - */ |
|
| 145 | - public function clear() |
|
| 146 | - { |
|
| 147 | - $this->ht = array(); |
|
| 148 | - } |
|
| 142 | + /** |
|
| 143 | + * This call will clear all logger definitions from the internal hashtable. |
|
| 144 | + */ |
|
| 145 | + public function clear() |
|
| 146 | + { |
|
| 147 | + $this->ht = array(); |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - public function emitNoAppenderWarning($cat) |
|
| 151 | - { |
|
| 152 | - return; |
|
| 153 | - } |
|
| 150 | + public function emitNoAppenderWarning($cat) |
|
| 151 | + { |
|
| 152 | + return; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Check if the named logger exists in the hierarchy. |
|
| 157 | - * @param string $name |
|
| 158 | - * @return boolean |
|
| 159 | - */ |
|
| 160 | - public function exists($name) |
|
| 161 | - { |
|
| 162 | - return in_array($name, array_keys($this->ht)); |
|
| 163 | - } |
|
| 155 | + /** |
|
| 156 | + * Check if the named logger exists in the hierarchy. |
|
| 157 | + * @param string $name |
|
| 158 | + * @return boolean |
|
| 159 | + */ |
|
| 160 | + public function exists($name) |
|
| 161 | + { |
|
| 162 | + return in_array($name, array_keys($this->ht)); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - public function fireAddAppenderEvent($logger, $appender) |
|
| 166 | - { |
|
| 167 | - return; |
|
| 168 | - } |
|
| 165 | + public function fireAddAppenderEvent($logger, $appender) |
|
| 166 | + { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * @deprecated Please use {@link getCurrentLoggers()} instead. |
|
| 172 | - */ |
|
| 173 | - public function &getCurrentCategories() |
|
| 174 | - { |
|
| 175 | - return $this->getCurrentLoggers(); |
|
| 176 | - } |
|
| 170 | + /** |
|
| 171 | + * @deprecated Please use {@link getCurrentLoggers()} instead. |
|
| 172 | + */ |
|
| 173 | + public function &getCurrentCategories() |
|
| 174 | + { |
|
| 175 | + return $this->getCurrentLoggers(); |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Returns all the currently defined categories in this hierarchy as an array. |
|
| 180 | - * @return array |
|
| 181 | - */ |
|
| 182 | - public function &getCurrentLoggers() |
|
| 183 | - { |
|
| 184 | - $loggers = array(); |
|
| 185 | - $loggerNames = array_keys($this->ht); |
|
| 186 | - $enumLoggers = sizeof($loggerNames); |
|
| 187 | - for ($i = 0; $i < $enumLoggers; $i++) { |
|
| 188 | - $loggerName = $loggerNames[$i]; |
|
| 189 | - $loggers[] =& $this->ht[$loggerName]; |
|
| 190 | - } |
|
| 191 | - return $loggers; |
|
| 192 | - } |
|
| 178 | + /** |
|
| 179 | + * Returns all the currently defined categories in this hierarchy as an array. |
|
| 180 | + * @return array |
|
| 181 | + */ |
|
| 182 | + public function &getCurrentLoggers() |
|
| 183 | + { |
|
| 184 | + $loggers = array(); |
|
| 185 | + $loggerNames = array_keys($this->ht); |
|
| 186 | + $enumLoggers = sizeof($loggerNames); |
|
| 187 | + for ($i = 0; $i < $enumLoggers; $i++) { |
|
| 188 | + $loggerName = $loggerNames[$i]; |
|
| 189 | + $loggers[] =& $this->ht[$loggerName]; |
|
| 190 | + } |
|
| 191 | + return $loggers; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * Return a new logger instance named as the first parameter using the default factory. |
|
| 196 | - * |
|
| 197 | - * @param string $name logger name |
|
| 198 | - * @param LoggerFactory $factory a {@link LoggerFactory} instance or null |
|
| 199 | - * @return Logger |
|
| 200 | - */ |
|
| 201 | - public function &getLogger($name, $factory = null) |
|
| 202 | - { |
|
| 203 | - if ($factory === null) { |
|
| 204 | - return $this->getLoggerByFactory($name, $this->defaultFactory); |
|
| 205 | - } else { |
|
| 206 | - return $this->getLoggerByFactory($name, $factory); |
|
| 207 | - } |
|
| 208 | - } |
|
| 194 | + /** |
|
| 195 | + * Return a new logger instance named as the first parameter using the default factory. |
|
| 196 | + * |
|
| 197 | + * @param string $name logger name |
|
| 198 | + * @param LoggerFactory $factory a {@link LoggerFactory} instance or null |
|
| 199 | + * @return Logger |
|
| 200 | + */ |
|
| 201 | + public function &getLogger($name, $factory = null) |
|
| 202 | + { |
|
| 203 | + if ($factory === null) { |
|
| 204 | + return $this->getLoggerByFactory($name, $this->defaultFactory); |
|
| 205 | + } else { |
|
| 206 | + return $this->getLoggerByFactory($name, $factory); |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * Return a new logger instance named as the first parameter using the default factory. |
|
| 212 | - * |
|
| 213 | - * @param string $name logger name |
|
| 214 | - * @return Logger |
|
| 215 | - * @todo merge with {@link getLogger()} |
|
| 216 | - */ |
|
| 217 | - public function &getLoggerByFactory($name, $factory) |
|
| 218 | - { |
|
| 219 | - if (!isset($this->ht[$name])) { |
|
| 220 | - LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger..."); |
|
| 221 | - $this->ht[$name] = $factory->makeNewLoggerInstance($name); |
|
| 222 | - $this->ht[$name]->setHierarchy($this); |
|
| 223 | - $nodes = explode('.', $name); |
|
| 224 | - $firstNode = array_shift($nodes); |
|
| 225 | - if ( $firstNode != $name && isset($this->ht[$firstNode])) { |
|
| 226 | - LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]"); |
|
| 227 | - $this->ht[$name]->parent =& $this->ht[$firstNode]; |
|
| 228 | - } else { |
|
| 229 | - LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]"); |
|
| 230 | - $this->ht[$name]->parent =& $this->root; |
|
| 231 | - } |
|
| 232 | - if (sizeof($nodes) > 0) { |
|
| 233 | - // find parent node |
|
| 234 | - foreach ($nodes as $node) { |
|
| 235 | - $parentNode = "$firstNode.$node"; |
|
| 236 | - if (isset($this->ht[$parentNode]) && $parentNode != $name) { |
|
| 237 | - LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]"); |
|
| 238 | - $this->ht[$name]->parent =& $this->ht[$parentNode]; |
|
| 239 | - } |
|
| 240 | - $firstNode .= ".$node"; |
|
| 241 | - } |
|
| 242 | - } |
|
| 243 | - // update children |
|
| 244 | - /* |
|
| 210 | + /** |
|
| 211 | + * Return a new logger instance named as the first parameter using the default factory. |
|
| 212 | + * |
|
| 213 | + * @param string $name logger name |
|
| 214 | + * @return Logger |
|
| 215 | + * @todo merge with {@link getLogger()} |
|
| 216 | + */ |
|
| 217 | + public function &getLoggerByFactory($name, $factory) |
|
| 218 | + { |
|
| 219 | + if (!isset($this->ht[$name])) { |
|
| 220 | + LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger..."); |
|
| 221 | + $this->ht[$name] = $factory->makeNewLoggerInstance($name); |
|
| 222 | + $this->ht[$name]->setHierarchy($this); |
|
| 223 | + $nodes = explode('.', $name); |
|
| 224 | + $firstNode = array_shift($nodes); |
|
| 225 | + if ( $firstNode != $name && isset($this->ht[$firstNode])) { |
|
| 226 | + LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]"); |
|
| 227 | + $this->ht[$name]->parent =& $this->ht[$firstNode]; |
|
| 228 | + } else { |
|
| 229 | + LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]"); |
|
| 230 | + $this->ht[$name]->parent =& $this->root; |
|
| 231 | + } |
|
| 232 | + if (sizeof($nodes) > 0) { |
|
| 233 | + // find parent node |
|
| 234 | + foreach ($nodes as $node) { |
|
| 235 | + $parentNode = "$firstNode.$node"; |
|
| 236 | + if (isset($this->ht[$parentNode]) && $parentNode != $name) { |
|
| 237 | + LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]"); |
|
| 238 | + $this->ht[$name]->parent =& $this->ht[$parentNode]; |
|
| 239 | + } |
|
| 240 | + $firstNode .= ".$node"; |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | + // update children |
|
| 244 | + /* |
|
| 245 | 245 | $children = array(); |
| 246 | 246 | foreach (array_keys($this->ht) as $nodeName) { |
| 247 | 247 | if ($nodeName != $name && substr($nodeName, 0, strlen($name)) == $name) { |
@@ -249,140 +249,140 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | */ |
| 252 | - } |
|
| 253 | - return $this->ht[$name]; |
|
| 254 | - } |
|
| 252 | + } |
|
| 253 | + return $this->ht[$name]; |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - /** |
|
| 257 | - * @return LoggerRendererMap Get the renderer map for this hierarchy. |
|
| 258 | - */ |
|
| 259 | - public function &getRendererMap() |
|
| 260 | - { |
|
| 261 | - return $this->rendererMap; |
|
| 262 | - } |
|
| 256 | + /** |
|
| 257 | + * @return LoggerRendererMap Get the renderer map for this hierarchy. |
|
| 258 | + */ |
|
| 259 | + public function &getRendererMap() |
|
| 260 | + { |
|
| 261 | + return $this->rendererMap; |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - /** |
|
| 265 | - * @return LoggerRoot Get the root of this hierarchy. |
|
| 266 | - */ |
|
| 267 | - public function &getRootLogger() |
|
| 268 | - { |
|
| 269 | - if (!isset($this->root) || $this->root == null) |
|
| 270 | - $this->root = new LoggerRoot(); |
|
| 271 | - return $this->root; |
|
| 272 | - } |
|
| 264 | + /** |
|
| 265 | + * @return LoggerRoot Get the root of this hierarchy. |
|
| 266 | + */ |
|
| 267 | + public function &getRootLogger() |
|
| 268 | + { |
|
| 269 | + if (!isset($this->root) || $this->root == null) |
|
| 270 | + $this->root = new LoggerRoot(); |
|
| 271 | + return $this->root; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - /** |
|
| 275 | - * @return LoggerLevel Returns the threshold Level. |
|
| 276 | - */ |
|
| 277 | - public function getThreshold() |
|
| 278 | - { |
|
| 279 | - return $this->threshold; |
|
| 280 | - } |
|
| 274 | + /** |
|
| 275 | + * @return LoggerLevel Returns the threshold Level. |
|
| 276 | + */ |
|
| 277 | + public function getThreshold() |
|
| 278 | + { |
|
| 279 | + return $this->threshold; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * This method will return true if this repository is disabled |
|
| 284 | - * for level object passed as parameter and false otherwise. |
|
| 285 | - * @return boolean |
|
| 286 | - */ |
|
| 287 | - public function isDisabled($level) |
|
| 288 | - { |
|
| 289 | - return ($this->threshold->level > $level->level); |
|
| 290 | - } |
|
| 282 | + /** |
|
| 283 | + * This method will return true if this repository is disabled |
|
| 284 | + * for level object passed as parameter and false otherwise. |
|
| 285 | + * @return boolean |
|
| 286 | + */ |
|
| 287 | + public function isDisabled($level) |
|
| 288 | + { |
|
| 289 | + return ($this->threshold->level > $level->level); |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * @deprecated Deprecated with no replacement. |
|
| 294 | - */ |
|
| 295 | - public function overrideAsNeeded($override) |
|
| 296 | - { |
|
| 297 | - return; |
|
| 298 | - } |
|
| 292 | + /** |
|
| 293 | + * @deprecated Deprecated with no replacement. |
|
| 294 | + */ |
|
| 295 | + public function overrideAsNeeded($override) |
|
| 296 | + { |
|
| 297 | + return; |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * Reset all values contained in this hierarchy instance to their |
|
| 302 | - * default. |
|
| 303 | - * |
|
| 304 | - * This removes all appenders from all categories, sets |
|
| 305 | - * the level of all non-root categories to <i>null</i>, |
|
| 306 | - * sets their additivity flag to <i>true</i> and sets the level |
|
| 307 | - * of the root logger to {@link LOGGER_LEVEL_DEBUG}. Moreover, |
|
| 308 | - * message disabling is set its default "off" value. |
|
| 309 | - * |
|
| 310 | - * <p>Existing categories are not removed. They are just reset. |
|
| 311 | - * |
|
| 312 | - * <p>This method should be used sparingly and with care as it will |
|
| 313 | - * block all logging until it is completed.</p> |
|
| 314 | - */ |
|
| 315 | - public function resetConfiguration() |
|
| 316 | - { |
|
| 317 | - $root =& $this->getRootLogger(); |
|
| 300 | + /** |
|
| 301 | + * Reset all values contained in this hierarchy instance to their |
|
| 302 | + * default. |
|
| 303 | + * |
|
| 304 | + * This removes all appenders from all categories, sets |
|
| 305 | + * the level of all non-root categories to <i>null</i>, |
|
| 306 | + * sets their additivity flag to <i>true</i> and sets the level |
|
| 307 | + * of the root logger to {@link LOGGER_LEVEL_DEBUG}. Moreover, |
|
| 308 | + * message disabling is set its default "off" value. |
|
| 309 | + * |
|
| 310 | + * <p>Existing categories are not removed. They are just reset. |
|
| 311 | + * |
|
| 312 | + * <p>This method should be used sparingly and with care as it will |
|
| 313 | + * block all logging until it is completed.</p> |
|
| 314 | + */ |
|
| 315 | + public function resetConfiguration() |
|
| 316 | + { |
|
| 317 | + $root =& $this->getRootLogger(); |
|
| 318 | 318 | |
| 319 | - $root->setLevel(LoggerLevel::getLevelDebug()); |
|
| 320 | - $this->setThreshold(LoggerLevel::getLevelAll()); |
|
| 321 | - $this->shutDown(); |
|
| 322 | - $loggers =& $this->getCurrentLoggers(); |
|
| 323 | - $enumLoggers = sizeof($loggers); |
|
| 324 | - for ($i = 0; $i < $enumLoggers; $i++) { |
|
| 325 | - $loggers[$i]->setLevel(null); |
|
| 326 | - $loggers[$i]->setAdditivity(true); |
|
| 327 | - $loggers[$i]->setResourceBundle(null); |
|
| 328 | - } |
|
| 329 | - $this->rendererMap->clear(); |
|
| 330 | - } |
|
| 319 | + $root->setLevel(LoggerLevel::getLevelDebug()); |
|
| 320 | + $this->setThreshold(LoggerLevel::getLevelAll()); |
|
| 321 | + $this->shutDown(); |
|
| 322 | + $loggers =& $this->getCurrentLoggers(); |
|
| 323 | + $enumLoggers = sizeof($loggers); |
|
| 324 | + for ($i = 0; $i < $enumLoggers; $i++) { |
|
| 325 | + $loggers[$i]->setLevel(null); |
|
| 326 | + $loggers[$i]->setAdditivity(true); |
|
| 327 | + $loggers[$i]->setResourceBundle(null); |
|
| 328 | + } |
|
| 329 | + $this->rendererMap->clear(); |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - /** |
|
| 333 | - * @deprecated Deprecated with no replacement. |
|
| 334 | - */ |
|
| 335 | - public function setDisableOverride($override) |
|
| 336 | - { |
|
| 337 | - return; |
|
| 338 | - } |
|
| 332 | + /** |
|
| 333 | + * @deprecated Deprecated with no replacement. |
|
| 334 | + */ |
|
| 335 | + public function setDisableOverride($override) |
|
| 336 | + { |
|
| 337 | + return; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - /** |
|
| 341 | - * Used by subclasses to add a renderer to the hierarchy passed as parameter. |
|
| 342 | - * @param string $renderedClass a LoggerRenderer class name |
|
| 343 | - * @param LoggerRenderer $renderer |
|
| 344 | - * |
|
| 345 | - */ |
|
| 346 | - public function setRenderer($renderedClass, $renderer) |
|
| 347 | - { |
|
| 348 | - $this->rendererMap->put($renderedClass, $renderer); |
|
| 349 | - } |
|
| 340 | + /** |
|
| 341 | + * Used by subclasses to add a renderer to the hierarchy passed as parameter. |
|
| 342 | + * @param string $renderedClass a LoggerRenderer class name |
|
| 343 | + * @param LoggerRenderer $renderer |
|
| 344 | + * |
|
| 345 | + */ |
|
| 346 | + public function setRenderer($renderedClass, $renderer) |
|
| 347 | + { |
|
| 348 | + $this->rendererMap->put($renderedClass, $renderer); |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - /** |
|
| 352 | - * set a new threshold level |
|
| 353 | - * |
|
| 354 | - * @param LoggerLevel $l |
|
| 355 | - */ |
|
| 356 | - public function setThreshold($l) |
|
| 357 | - { |
|
| 358 | - if ($l !== null) |
|
| 359 | - $this->threshold = $l; |
|
| 360 | - } |
|
| 351 | + /** |
|
| 352 | + * set a new threshold level |
|
| 353 | + * |
|
| 354 | + * @param LoggerLevel $l |
|
| 355 | + */ |
|
| 356 | + public function setThreshold($l) |
|
| 357 | + { |
|
| 358 | + if ($l !== null) |
|
| 359 | + $this->threshold = $l; |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - /** |
|
| 363 | - * Shutting down a hierarchy will <i>safely</i> close and remove |
|
| 364 | - * all appenders in all categories including the root logger. |
|
| 365 | - * |
|
| 366 | - * <p>Some appenders such as {@link LoggerSocketAppender} |
|
| 367 | - * need to be closed before the |
|
| 368 | - * application exists. Otherwise, pending logging events might be |
|
| 369 | - * lost. |
|
| 370 | - * |
|
| 371 | - * <p>The shutdown method is careful to close nested |
|
| 372 | - * appenders before closing regular appenders. This is allows |
|
| 373 | - * configurations where a regular appender is attached to a logger |
|
| 374 | - * and again to a nested appender. |
|
| 375 | - */ |
|
| 376 | - public function shutdown() |
|
| 377 | - { |
|
| 378 | - $this->root->removeAllAppenders(); |
|
| 379 | - $cats =& $this->getCurrentLoggers(); |
|
| 380 | - $enumCats = sizeof($cats); |
|
| 381 | - if ($enumCats > 0) { |
|
| 382 | - for ($i = 0; $i < $enumCats; $i++) { |
|
| 383 | - $cats[$i]->removeAllAppenders(); |
|
| 384 | - } |
|
| 385 | - } |
|
| 386 | - } |
|
| 362 | + /** |
|
| 363 | + * Shutting down a hierarchy will <i>safely</i> close and remove |
|
| 364 | + * all appenders in all categories including the root logger. |
|
| 365 | + * |
|
| 366 | + * <p>Some appenders such as {@link LoggerSocketAppender} |
|
| 367 | + * need to be closed before the |
|
| 368 | + * application exists. Otherwise, pending logging events might be |
|
| 369 | + * lost. |
|
| 370 | + * |
|
| 371 | + * <p>The shutdown method is careful to close nested |
|
| 372 | + * appenders before closing regular appenders. This is allows |
|
| 373 | + * configurations where a regular appender is attached to a logger |
|
| 374 | + * and again to a nested appender. |
|
| 375 | + */ |
|
| 376 | + public function shutdown() |
|
| 377 | + { |
|
| 378 | + $this->root->removeAllAppenders(); |
|
| 379 | + $cats =& $this->getCurrentLoggers(); |
|
| 380 | + $enumCats = sizeof($cats); |
|
| 381 | + if ($enumCats > 0) { |
|
| 382 | + for ($i = 0; $i < $enumCats; $i++) { |
|
| 383 | + $cats[$i]->removeAllAppenders(); |
|
| 384 | + } |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | } |
| 388 | 388 | ?> |
| 389 | 389 | \ No newline at end of file |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @var boolean currently unused |
| 88 | 88 | */ |
| 89 | - public $emittedNoAppenderWarning = false; |
|
| 89 | + public $emittedNoAppenderWarning = false; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @var boolean currently unused |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function LoggerHierarchy($root) |
| 115 | 115 | { |
| 116 | - $this->root =& $root; |
|
| 116 | + $this->root = & $root; |
|
| 117 | 117 | // Enable all level levels by default. |
| 118 | 118 | $this->setThreshold(LoggerLevel::getLevelAll()); |
| 119 | 119 | $this->root->setHierarchy($this); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $enumLoggers = sizeof($loggerNames); |
| 187 | 187 | for ($i = 0; $i < $enumLoggers; $i++) { |
| 188 | 188 | $loggerName = $loggerNames[$i]; |
| 189 | - $loggers[] =& $this->ht[$loggerName]; |
|
| 189 | + $loggers[] = & $this->ht[$loggerName]; |
|
| 190 | 190 | } |
| 191 | 191 | return $loggers; |
| 192 | 192 | } |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | public function &getLoggerByFactory($name, $factory) |
| 218 | 218 | { |
| 219 | 219 | if (!isset($this->ht[$name])) { |
| 220 | - LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger..."); |
|
| 220 | + LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[" . get_class($factory) . "] creating a new logger..."); |
|
| 221 | 221 | $this->ht[$name] = $factory->makeNewLoggerInstance($name); |
| 222 | 222 | $this->ht[$name]->setHierarchy($this); |
| 223 | 223 | $nodes = explode('.', $name); |
| 224 | 224 | $firstNode = array_shift($nodes); |
| 225 | - if ( $firstNode != $name && isset($this->ht[$firstNode])) { |
|
| 225 | + if ($firstNode != $name && isset($this->ht[$firstNode])) { |
|
| 226 | 226 | LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]"); |
| 227 | - $this->ht[$name]->parent =& $this->ht[$firstNode]; |
|
| 227 | + $this->ht[$name]->parent = & $this->ht[$firstNode]; |
|
| 228 | 228 | } else { |
| 229 | 229 | LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]"); |
| 230 | - $this->ht[$name]->parent =& $this->root; |
|
| 230 | + $this->ht[$name]->parent = & $this->root; |
|
| 231 | 231 | } |
| 232 | 232 | if (sizeof($nodes) > 0) { |
| 233 | 233 | // find parent node |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $parentNode = "$firstNode.$node"; |
| 236 | 236 | if (isset($this->ht[$parentNode]) && $parentNode != $name) { |
| 237 | 237 | LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]"); |
| 238 | - $this->ht[$name]->parent =& $this->ht[$parentNode]; |
|
| 238 | + $this->ht[$name]->parent = & $this->ht[$parentNode]; |
|
| 239 | 239 | } |
| 240 | 240 | $firstNode .= ".$node"; |
| 241 | 241 | } |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function resetConfiguration() |
| 316 | 316 | { |
| 317 | - $root =& $this->getRootLogger(); |
|
| 317 | + $root = & $this->getRootLogger(); |
|
| 318 | 318 | |
| 319 | 319 | $root->setLevel(LoggerLevel::getLevelDebug()); |
| 320 | 320 | $this->setThreshold(LoggerLevel::getLevelAll()); |
| 321 | 321 | $this->shutDown(); |
| 322 | - $loggers =& $this->getCurrentLoggers(); |
|
| 322 | + $loggers = & $this->getCurrentLoggers(); |
|
| 323 | 323 | $enumLoggers = sizeof($loggers); |
| 324 | 324 | for ($i = 0; $i < $enumLoggers; $i++) { |
| 325 | 325 | $loggers[$i]->setLevel(null); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | public function shutdown() |
| 377 | 377 | { |
| 378 | 378 | $this->root->removeAllAppenders(); |
| 379 | - $cats =& $this->getCurrentLoggers(); |
|
| 379 | + $cats = & $this->getCurrentLoggers(); |
|
| 380 | 380 | $enumCats = sizeof($cats); |
| 381 | 381 | if ($enumCats > 0) { |
| 382 | 382 | for ($i = 0; $i < $enumCats; $i++) { |
@@ -39,146 +39,146 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | class LoggerRendererMap { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var array |
|
| 44 | - */ |
|
| 45 | - public $map; |
|
| 42 | + /** |
|
| 43 | + * @var array |
|
| 44 | + */ |
|
| 45 | + public $map; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var LoggerDefaultRenderer |
|
| 49 | - */ |
|
| 50 | - public $defaultRenderer; |
|
| 47 | + /** |
|
| 48 | + * @var LoggerDefaultRenderer |
|
| 49 | + */ |
|
| 50 | + public $defaultRenderer; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Constructor |
|
| 54 | - */ |
|
| 55 | - public function LoggerRendererMap() |
|
| 56 | - { |
|
| 57 | - $this->map = array(); |
|
| 58 | - $this->defaultRenderer = new LoggerDefaultRenderer(); |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * Constructor |
|
| 54 | + */ |
|
| 55 | + public function LoggerRendererMap() |
|
| 56 | + { |
|
| 57 | + $this->map = array(); |
|
| 58 | + $this->defaultRenderer = new LoggerDefaultRenderer(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Add a renderer to a hierarchy passed as parameter. |
|
| 63 | - * Note that hierarchy must implement getRendererMap() and setRenderer() methods. |
|
| 64 | - * |
|
| 65 | - * @param LoggerHierarchy &$repository a logger repository. |
|
| 66 | - * @param string &$renderedClassName |
|
| 67 | - * @param string &$renderingClassName |
|
| 68 | - * @static |
|
| 69 | - */ |
|
| 70 | - public function addRenderer(&$repository, $renderedClassName, $renderingClassName) |
|
| 71 | - { |
|
| 72 | - LoggerLog::debug("LoggerRendererMap::addRenderer() Rendering class: [{$renderingClassName}], Rendered class: [{$renderedClassName}]."); |
|
| 73 | - $renderer = LoggerObjectRenderer::factory($renderingClassName); |
|
| 74 | - if($renderer == null) { |
|
| 75 | - LoggerLog::warn("LoggerRendererMap::addRenderer() Could not instantiate renderer [{$renderingClassName}]."); |
|
| 76 | - return; |
|
| 77 | - } else { |
|
| 78 | - $repository->setRenderer($renderedClassName, $renderer); |
|
| 79 | - } |
|
| 80 | - } |
|
| 61 | + /** |
|
| 62 | + * Add a renderer to a hierarchy passed as parameter. |
|
| 63 | + * Note that hierarchy must implement getRendererMap() and setRenderer() methods. |
|
| 64 | + * |
|
| 65 | + * @param LoggerHierarchy &$repository a logger repository. |
|
| 66 | + * @param string &$renderedClassName |
|
| 67 | + * @param string &$renderingClassName |
|
| 68 | + * @static |
|
| 69 | + */ |
|
| 70 | + public function addRenderer(&$repository, $renderedClassName, $renderingClassName) |
|
| 71 | + { |
|
| 72 | + LoggerLog::debug("LoggerRendererMap::addRenderer() Rendering class: [{$renderingClassName}], Rendered class: [{$renderedClassName}]."); |
|
| 73 | + $renderer = LoggerObjectRenderer::factory($renderingClassName); |
|
| 74 | + if($renderer == null) { |
|
| 75 | + LoggerLog::warn("LoggerRendererMap::addRenderer() Could not instantiate renderer [{$renderingClassName}]."); |
|
| 76 | + return; |
|
| 77 | + } else { |
|
| 78 | + $repository->setRenderer($renderedClassName, $renderer); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Find the appropriate renderer for the class type of the |
|
| 85 | - * <var>o</var> parameter. |
|
| 86 | - * |
|
| 87 | - * This is accomplished by calling the {@link getByObject()} |
|
| 88 | - * method if <var>o</var> is object or using {@link LoggerDefaultRenderer}. |
|
| 89 | - * Once a renderer is found, it is applied on the object <var>o</var> and |
|
| 90 | - * the result is returned as a string. |
|
| 91 | - * |
|
| 92 | - * @param mixed $o |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 95 | - public function findAndRender($o) |
|
| 96 | - { |
|
| 97 | - if($o == null) { |
|
| 98 | - return null; |
|
| 99 | - } else { |
|
| 100 | - if (is_object($o)) { |
|
| 101 | - $renderer = $this->getByObject($o); |
|
| 102 | - if ($renderer !== null) { |
|
| 103 | - return $renderer->doRender($o); |
|
| 104 | - } else { |
|
| 105 | - return null; |
|
| 106 | - } |
|
| 107 | - } else { |
|
| 108 | - $renderer = $this->defaultRenderer; |
|
| 109 | - return $renderer->doRender($o); |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - } |
|
| 83 | + /** |
|
| 84 | + * Find the appropriate renderer for the class type of the |
|
| 85 | + * <var>o</var> parameter. |
|
| 86 | + * |
|
| 87 | + * This is accomplished by calling the {@link getByObject()} |
|
| 88 | + * method if <var>o</var> is object or using {@link LoggerDefaultRenderer}. |
|
| 89 | + * Once a renderer is found, it is applied on the object <var>o</var> and |
|
| 90 | + * the result is returned as a string. |
|
| 91 | + * |
|
| 92 | + * @param mixed $o |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | + public function findAndRender($o) |
|
| 96 | + { |
|
| 97 | + if($o == null) { |
|
| 98 | + return null; |
|
| 99 | + } else { |
|
| 100 | + if (is_object($o)) { |
|
| 101 | + $renderer = $this->getByObject($o); |
|
| 102 | + if ($renderer !== null) { |
|
| 103 | + return $renderer->doRender($o); |
|
| 104 | + } else { |
|
| 105 | + return null; |
|
| 106 | + } |
|
| 107 | + } else { |
|
| 108 | + $renderer = $this->defaultRenderer; |
|
| 109 | + return $renderer->doRender($o); |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the |
|
| 116 | - * class of the object parameter. |
|
| 117 | - * |
|
| 118 | - * @param mixed $o |
|
| 119 | - * @return string |
|
| 120 | - */ |
|
| 121 | - public function &getByObject($o) |
|
| 122 | - { |
|
| 123 | - return ($o == null) ? null : $this->getByClassName(get_class($o)); |
|
| 124 | - } |
|
| 114 | + /** |
|
| 115 | + * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the |
|
| 116 | + * class of the object parameter. |
|
| 117 | + * |
|
| 118 | + * @param mixed $o |
|
| 119 | + * @return string |
|
| 120 | + */ |
|
| 121 | + public function &getByObject($o) |
|
| 122 | + { |
|
| 123 | + return ($o == null) ? null : $this->getByClassName(get_class($o)); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Search the parents of <var>clazz</var> for a renderer. |
|
| 129 | - * |
|
| 130 | - * The renderer closest in the hierarchy will be returned. If no |
|
| 131 | - * renderers could be found, then the default renderer is returned. |
|
| 132 | - * |
|
| 133 | - * @param string $class |
|
| 134 | - * @return LoggerObjectRenderer |
|
| 135 | - */ |
|
| 136 | - public function &getByClassName($class) |
|
| 137 | - { |
|
| 138 | - $r = null; |
|
| 139 | - for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) { |
|
| 140 | - if (isset($this->map[$c])) { |
|
| 141 | - return $this->map[$c]; |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - return $this->defaultRenderer; |
|
| 145 | - } |
|
| 127 | + /** |
|
| 128 | + * Search the parents of <var>clazz</var> for a renderer. |
|
| 129 | + * |
|
| 130 | + * The renderer closest in the hierarchy will be returned. If no |
|
| 131 | + * renderers could be found, then the default renderer is returned. |
|
| 132 | + * |
|
| 133 | + * @param string $class |
|
| 134 | + * @return LoggerObjectRenderer |
|
| 135 | + */ |
|
| 136 | + public function &getByClassName($class) |
|
| 137 | + { |
|
| 138 | + $r = null; |
|
| 139 | + for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) { |
|
| 140 | + if (isset($this->map[$c])) { |
|
| 141 | + return $this->map[$c]; |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + return $this->defaultRenderer; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * @return LoggerDefaultRenderer |
|
| 149 | - */ |
|
| 150 | - public function &getDefaultRenderer() |
|
| 151 | - { |
|
| 152 | - return $this->defaultRenderer; |
|
| 153 | - } |
|
| 147 | + /** |
|
| 148 | + * @return LoggerDefaultRenderer |
|
| 149 | + */ |
|
| 150 | + public function &getDefaultRenderer() |
|
| 151 | + { |
|
| 152 | + return $this->defaultRenderer; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - public function clear() |
|
| 157 | - { |
|
| 158 | - $this->map = array(); |
|
| 159 | - } |
|
| 156 | + public function clear() |
|
| 157 | + { |
|
| 158 | + $this->map = array(); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Register a {@link LoggerObjectRenderer} for <var>clazz</var>. |
|
| 163 | - * @param string $class |
|
| 164 | - * @param LoggerObjectRenderer $or |
|
| 165 | - */ |
|
| 166 | - public function put($class, $or) |
|
| 167 | - { |
|
| 168 | - $this->map[strtolower($class)] = $or; |
|
| 169 | - } |
|
| 161 | + /** |
|
| 162 | + * Register a {@link LoggerObjectRenderer} for <var>clazz</var>. |
|
| 163 | + * @param string $class |
|
| 164 | + * @param LoggerObjectRenderer $or |
|
| 165 | + */ |
|
| 166 | + public function put($class, $or) |
|
| 167 | + { |
|
| 168 | + $this->map[strtolower($class)] = $or; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * @param string $class |
|
| 173 | - * @return boolean |
|
| 174 | - */ |
|
| 175 | - public function rendererExists($class) |
|
| 176 | - { |
|
| 177 | - $class = basename($class); |
|
| 178 | - if (!class_exists($class)) { |
|
| 179 | - @include_once(LOG4PHP_DIR ."/or/{$class}.php"); |
|
| 180 | - } |
|
| 181 | - return class_exists($class); |
|
| 182 | - } |
|
| 171 | + /** |
|
| 172 | + * @param string $class |
|
| 173 | + * @return boolean |
|
| 174 | + */ |
|
| 175 | + public function rendererExists($class) |
|
| 176 | + { |
|
| 177 | + $class = basename($class); |
|
| 178 | + if (!class_exists($class)) { |
|
| 179 | + @include_once(LOG4PHP_DIR ."/or/{$class}.php"); |
|
| 180 | + } |
|
| 181 | + return class_exists($class); |
|
| 182 | + } |
|
| 183 | 183 | } |
| 184 | 184 | ?> |
| 185 | 185 | \ No newline at end of file |
@@ -84,526 +84,526 @@ |
||
| 84 | 84 | */ |
| 85 | 85 | class LoggerDOMConfigurator extends LoggerConfigurator { |
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @var LoggerHierarchy |
|
| 89 | - */ |
|
| 90 | - public $repository; |
|
| 87 | + /** |
|
| 88 | + * @var LoggerHierarchy |
|
| 89 | + */ |
|
| 90 | + public $repository; |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * @var array state stack |
|
| 94 | - */ |
|
| 95 | - public $state; |
|
| 92 | + /** |
|
| 93 | + * @var array state stack |
|
| 94 | + */ |
|
| 95 | + public $state; |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * @var Logger parsed Logger |
|
| 99 | - */ |
|
| 100 | - public $logger; |
|
| 97 | + /** |
|
| 98 | + * @var Logger parsed Logger |
|
| 99 | + */ |
|
| 100 | + public $logger; |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * @var LoggerAppender parsed LoggerAppender |
|
| 104 | - */ |
|
| 105 | - public $appender; |
|
| 102 | + /** |
|
| 103 | + * @var LoggerAppender parsed LoggerAppender |
|
| 104 | + */ |
|
| 105 | + public $appender; |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * @var LoggerFilter parsed LoggerFilter |
|
| 109 | - */ |
|
| 110 | - public $filter; |
|
| 107 | + /** |
|
| 108 | + * @var LoggerFilter parsed LoggerFilter |
|
| 109 | + */ |
|
| 110 | + public $filter; |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * @var LoggerLayout parsed LoggerLayout |
|
| 114 | - */ |
|
| 115 | - public $layout; |
|
| 112 | + /** |
|
| 113 | + * @var LoggerLayout parsed LoggerLayout |
|
| 114 | + */ |
|
| 115 | + public $layout; |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Constructor |
|
| 119 | - */ |
|
| 120 | - public function LoggerDOMConfigurator() |
|
| 121 | - { |
|
| 122 | - $this->state = array(); |
|
| 123 | - $this->logger = null; |
|
| 124 | - $this->appender = null; |
|
| 125 | - $this->filter = null; |
|
| 126 | - $this->layout = null; |
|
| 127 | - } |
|
| 117 | + /** |
|
| 118 | + * Constructor |
|
| 119 | + */ |
|
| 120 | + public function LoggerDOMConfigurator() |
|
| 121 | + { |
|
| 122 | + $this->state = array(); |
|
| 123 | + $this->logger = null; |
|
| 124 | + $this->appender = null; |
|
| 125 | + $this->filter = null; |
|
| 126 | + $this->layout = null; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Configure the default repository using the resource pointed by <b>url</b>. |
|
| 131 | - * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function. |
|
| 132 | - * Note that the resource will be search with <i>use_include_path</i> parameter |
|
| 133 | - * set to "1". |
|
| 134 | - * |
|
| 135 | - * @param string $url |
|
| 136 | - * @static |
|
| 137 | - */ |
|
| 138 | - public function configure($url = '') |
|
| 139 | - { |
|
| 140 | - $configurator = new LoggerDOMConfigurator(); |
|
| 141 | - $repository =& LoggerManager::getLoggerRepository(); |
|
| 142 | - return $configurator->doConfigure($url, $repository); |
|
| 143 | - } |
|
| 129 | + /** |
|
| 130 | + * Configure the default repository using the resource pointed by <b>url</b>. |
|
| 131 | + * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function. |
|
| 132 | + * Note that the resource will be search with <i>use_include_path</i> parameter |
|
| 133 | + * set to "1". |
|
| 134 | + * |
|
| 135 | + * @param string $url |
|
| 136 | + * @static |
|
| 137 | + */ |
|
| 138 | + public function configure($url = '') |
|
| 139 | + { |
|
| 140 | + $configurator = new LoggerDOMConfigurator(); |
|
| 141 | + $repository =& LoggerManager::getLoggerRepository(); |
|
| 142 | + return $configurator->doConfigure($url, $repository); |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Configure the given <b>repository</b> using the resource pointed by <b>url</b>. |
|
| 147 | - * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function. |
|
| 148 | - * Note that the resource will be search with <i>use_include_path</i> parameter |
|
| 149 | - * set to "1". |
|
| 150 | - * |
|
| 151 | - * @param string $url |
|
| 152 | - * @param LoggerHierarchy &$repository |
|
| 153 | - */ |
|
| 154 | - public function doConfigure($url = '', &$repository) |
|
| 155 | - { |
|
| 156 | - $xmlData = ''; |
|
| 157 | - if (!empty($url)) |
|
| 158 | - $xmlData = implode('', file($url, 1)); |
|
| 159 | - return $this->doConfigureByString($xmlData, $repository); |
|
| 160 | - } |
|
| 145 | + /** |
|
| 146 | + * Configure the given <b>repository</b> using the resource pointed by <b>url</b>. |
|
| 147 | + * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function. |
|
| 148 | + * Note that the resource will be search with <i>use_include_path</i> parameter |
|
| 149 | + * set to "1". |
|
| 150 | + * |
|
| 151 | + * @param string $url |
|
| 152 | + * @param LoggerHierarchy &$repository |
|
| 153 | + */ |
|
| 154 | + public function doConfigure($url = '', &$repository) |
|
| 155 | + { |
|
| 156 | + $xmlData = ''; |
|
| 157 | + if (!empty($url)) |
|
| 158 | + $xmlData = implode('', file($url, 1)); |
|
| 159 | + return $this->doConfigureByString($xmlData, $repository); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * Configure the given <b>repository</b> using the configuration written in <b>xmlData</b>. |
|
| 164 | - * Do not call this method directly. Use {@link doConfigure()} instead. |
|
| 165 | - * @param string $xmlData |
|
| 166 | - * @param LoggerHierarchy &$repository |
|
| 167 | - */ |
|
| 168 | - public function doConfigureByString($xmlData, &$repository) |
|
| 169 | - { |
|
| 170 | - return $this->parse($xmlData, $repository); |
|
| 171 | - } |
|
| 162 | + /** |
|
| 163 | + * Configure the given <b>repository</b> using the configuration written in <b>xmlData</b>. |
|
| 164 | + * Do not call this method directly. Use {@link doConfigure()} instead. |
|
| 165 | + * @param string $xmlData |
|
| 166 | + * @param LoggerHierarchy &$repository |
|
| 167 | + */ |
|
| 168 | + public function doConfigureByString($xmlData, &$repository) |
|
| 169 | + { |
|
| 170 | + return $this->parse($xmlData, $repository); |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * @param LoggerHierarchy &$repository |
|
| 175 | - */ |
|
| 176 | - public function doConfigureDefault(&$repository) |
|
| 177 | - { |
|
| 178 | - return $this->doConfigureByString(LOG4PHP_LOGGER_DOM_CONFIGURATOR_DEFAULT_CONFIGURATION, $repository); |
|
| 179 | - } |
|
| 173 | + /** |
|
| 174 | + * @param LoggerHierarchy &$repository |
|
| 175 | + */ |
|
| 176 | + public function doConfigureDefault(&$repository) |
|
| 177 | + { |
|
| 178 | + return $this->doConfigureByString(LOG4PHP_LOGGER_DOM_CONFIGURATOR_DEFAULT_CONFIGURATION, $repository); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * @param string $xmlData |
|
| 183 | - */ |
|
| 184 | - public function parse($xmlData, &$repository) |
|
| 185 | - { |
|
| 186 | - // LoggerManager::resetConfiguration(); |
|
| 187 | - $this->repository =& $repository; |
|
| 181 | + /** |
|
| 182 | + * @param string $xmlData |
|
| 183 | + */ |
|
| 184 | + public function parse($xmlData, &$repository) |
|
| 185 | + { |
|
| 186 | + // LoggerManager::resetConfiguration(); |
|
| 187 | + $this->repository =& $repository; |
|
| 188 | 188 | |
| 189 | - $parser = xml_parser_create_ns(); |
|
| 189 | + $parser = xml_parser_create_ns(); |
|
| 190 | 190 | |
| 191 | - xml_set_object($parser, &$this); |
|
| 192 | - xml_set_element_handler($parser, "tagOpen", "tagClose"); |
|
| 191 | + xml_set_object($parser, &$this); |
|
| 192 | + xml_set_element_handler($parser, "tagOpen", "tagClose"); |
|
| 193 | 193 | |
| 194 | - $result = xml_parse($parser, $xmlData, true); |
|
| 195 | - if (!$result) { |
|
| 196 | - $errorCode = xml_get_error_code($parser); |
|
| 197 | - $errorStr = xml_error_string($errorCode); |
|
| 198 | - $errorLine = xml_get_current_line_number($parser); |
|
| 199 | - LoggerLog::warn( |
|
| 200 | - "LoggerDOMConfigurator::parse() ". |
|
| 201 | - "Parsing error [{$errorCode}] {$errorStr}, line {$errorLine}" |
|
| 202 | - ); |
|
| 203 | - $this->repository->resetConfiguration(); |
|
| 204 | - } else { |
|
| 205 | - xml_parser_free($parser); |
|
| 206 | - } |
|
| 207 | - return $result; |
|
| 208 | - } |
|
| 194 | + $result = xml_parse($parser, $xmlData, true); |
|
| 195 | + if (!$result) { |
|
| 196 | + $errorCode = xml_get_error_code($parser); |
|
| 197 | + $errorStr = xml_error_string($errorCode); |
|
| 198 | + $errorLine = xml_get_current_line_number($parser); |
|
| 199 | + LoggerLog::warn( |
|
| 200 | + "LoggerDOMConfigurator::parse() ". |
|
| 201 | + "Parsing error [{$errorCode}] {$errorStr}, line {$errorLine}" |
|
| 202 | + ); |
|
| 203 | + $this->repository->resetConfiguration(); |
|
| 204 | + } else { |
|
| 205 | + xml_parser_free($parser); |
|
| 206 | + } |
|
| 207 | + return $result; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * @param mixed $parser |
|
| 212 | - * @param string $tag |
|
| 213 | - * @param array $attribs |
|
| 214 | - * |
|
| 215 | - * @todo In 'LOGGER' case find a better way to detect 'getLogger()' method |
|
| 216 | - */ |
|
| 217 | - public function tagOpen($parser, $tag, $attribs) |
|
| 218 | - { |
|
| 219 | - switch ($tag) { |
|
| 210 | + /** |
|
| 211 | + * @param mixed $parser |
|
| 212 | + * @param string $tag |
|
| 213 | + * @param array $attribs |
|
| 214 | + * |
|
| 215 | + * @todo In 'LOGGER' case find a better way to detect 'getLogger()' method |
|
| 216 | + */ |
|
| 217 | + public function tagOpen($parser, $tag, $attribs) |
|
| 218 | + { |
|
| 219 | + switch ($tag) { |
|
| 220 | 220 | |
| 221 | - case 'CONFIGURATION' : |
|
| 222 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION': |
|
| 221 | + case 'CONFIGURATION' : |
|
| 222 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION': |
|
| 223 | 223 | |
| 224 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() CONFIGURATION"); |
|
| 224 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() CONFIGURATION"); |
|
| 225 | 225 | |
| 226 | - if (isset($attribs['THRESHOLD'])) { |
|
| 226 | + if (isset($attribs['THRESHOLD'])) { |
|
| 227 | 227 | |
| 228 | - $this->repository->setThreshold( |
|
| 229 | - LoggerOptionConverter::toLevel( |
|
| 230 | - $this->subst($attribs['THRESHOLD']), |
|
| 231 | - $this->repository->getThreshold() |
|
| 232 | - ) |
|
| 233 | - ); |
|
| 234 | - } |
|
| 235 | - if (isset($attribs['DEBUG'])) { |
|
| 236 | - $debug = LoggerOptionConverter::toBoolean($this->subst($attribs['DEBUG']), LoggerLog::internalDebugging()); |
|
| 237 | - $this->repository->debug = $debug; |
|
| 238 | - LoggerLog::internalDebugging($debug); |
|
| 239 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOG4PHP:CONFIGURATION. Internal Debug turned ".($debug ? 'on':'off')); |
|
| 228 | + $this->repository->setThreshold( |
|
| 229 | + LoggerOptionConverter::toLevel( |
|
| 230 | + $this->subst($attribs['THRESHOLD']), |
|
| 231 | + $this->repository->getThreshold() |
|
| 232 | + ) |
|
| 233 | + ); |
|
| 234 | + } |
|
| 235 | + if (isset($attribs['DEBUG'])) { |
|
| 236 | + $debug = LoggerOptionConverter::toBoolean($this->subst($attribs['DEBUG']), LoggerLog::internalDebugging()); |
|
| 237 | + $this->repository->debug = $debug; |
|
| 238 | + LoggerLog::internalDebugging($debug); |
|
| 239 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOG4PHP:CONFIGURATION. Internal Debug turned ".($debug ? 'on':'off')); |
|
| 240 | 240 | |
| 241 | - } |
|
| 242 | - break; |
|
| 241 | + } |
|
| 242 | + break; |
|
| 243 | 243 | |
| 244 | - case 'APPENDER' : |
|
| 245 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER': |
|
| 244 | + case 'APPENDER' : |
|
| 245 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER': |
|
| 246 | 246 | |
| 247 | - unset($this->appender); |
|
| 248 | - $this->appender = null; |
|
| 247 | + unset($this->appender); |
|
| 248 | + $this->appender = null; |
|
| 249 | 249 | |
| 250 | - $name = $this->subst(@$attribs['NAME']); |
|
| 251 | - $class = $this->subst(@$attribs['CLASS']); |
|
| 250 | + $name = $this->subst(@$attribs['NAME']); |
|
| 251 | + $class = $this->subst(@$attribs['CLASS']); |
|
| 252 | 252 | |
| 253 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen():tag=[$tag]:name=[$name]:class=[$class]"); |
|
| 253 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen():tag=[$tag]:name=[$name]:class=[$class]"); |
|
| 254 | 254 | |
| 255 | - $this->appender =& LoggerAppender::singleton($name, $class); |
|
| 256 | - if ($this->appender === null) { |
|
| 257 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER cannot instantiate appender '$name'"); |
|
| 258 | - } |
|
| 259 | - $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE; |
|
| 260 | - break; |
|
| 255 | + $this->appender =& LoggerAppender::singleton($name, $class); |
|
| 256 | + if ($this->appender === null) { |
|
| 257 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER cannot instantiate appender '$name'"); |
|
| 258 | + } |
|
| 259 | + $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE; |
|
| 260 | + break; |
|
| 261 | 261 | |
| 262 | - case 'APPENDER_REF' : |
|
| 263 | - case 'APPENDER-REF' : |
|
| 264 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER_REF': |
|
| 265 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER-REF': |
|
| 262 | + case 'APPENDER_REF' : |
|
| 263 | + case 'APPENDER-REF' : |
|
| 264 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER_REF': |
|
| 265 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER-REF': |
|
| 266 | 266 | |
| 267 | 267 | |
| 268 | - if (isset($attribs['REF']) && !empty($attribs['REF'])) { |
|
| 269 | - $appenderName = $this->subst($attribs['REF']); |
|
| 268 | + if (isset($attribs['REF']) && !empty($attribs['REF'])) { |
|
| 269 | + $appenderName = $this->subst($attribs['REF']); |
|
| 270 | 270 | |
| 271 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref='$appenderName'"); |
|
| 271 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref='$appenderName'"); |
|
| 272 | 272 | |
| 273 | - $appender =& LoggerAppender::singleton($appenderName); |
|
| 274 | - if ($appender !== null) { |
|
| 275 | - switch (end($this->state)) { |
|
| 276 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE: |
|
| 277 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE: |
|
| 278 | - $this->logger->addAppender($appender); |
|
| 279 | - break; |
|
| 280 | - } |
|
| 281 | - } else { |
|
| 282 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref '$appenderName' points to a null appender"); |
|
| 283 | - } |
|
| 284 | - } else { |
|
| 285 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref not set or empty"); |
|
| 286 | - } |
|
| 287 | - break; |
|
| 273 | + $appender =& LoggerAppender::singleton($appenderName); |
|
| 274 | + if ($appender !== null) { |
|
| 275 | + switch (end($this->state)) { |
|
| 276 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE: |
|
| 277 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE: |
|
| 278 | + $this->logger->addAppender($appender); |
|
| 279 | + break; |
|
| 280 | + } |
|
| 281 | + } else { |
|
| 282 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref '$appenderName' points to a null appender"); |
|
| 283 | + } |
|
| 284 | + } else { |
|
| 285 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref not set or empty"); |
|
| 286 | + } |
|
| 287 | + break; |
|
| 288 | 288 | |
| 289 | - case 'FILTER' : |
|
| 290 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER': |
|
| 289 | + case 'FILTER' : |
|
| 290 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER': |
|
| 291 | 291 | |
| 292 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() FILTER"); |
|
| 292 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() FILTER"); |
|
| 293 | 293 | |
| 294 | - unset($this->filter); |
|
| 295 | - $this->filter = null; |
|
| 294 | + unset($this->filter); |
|
| 295 | + $this->filter = null; |
|
| 296 | 296 | |
| 297 | - $filterName = basename($this->subst(@$attribs['CLASS'])); |
|
| 298 | - if (!empty($filterName)) { |
|
| 299 | - if (!class_exists($filterName)) { |
|
| 300 | - @include_once(LOG4PHP_DIR . "/varia/{$filterName}.php"); |
|
| 301 | - } |
|
| 302 | - if (class_exists($filterName)) { |
|
| 303 | - $this->filter = new $filterName(); |
|
| 304 | - } else { |
|
| 305 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER. class '$filterName' doesnt exist"); |
|
| 306 | - } |
|
| 307 | - $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE; |
|
| 308 | - } else { |
|
| 309 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER filter name cannot be empty"); |
|
| 310 | - } |
|
| 311 | - break; |
|
| 297 | + $filterName = basename($this->subst(@$attribs['CLASS'])); |
|
| 298 | + if (!empty($filterName)) { |
|
| 299 | + if (!class_exists($filterName)) { |
|
| 300 | + @include_once(LOG4PHP_DIR . "/varia/{$filterName}.php"); |
|
| 301 | + } |
|
| 302 | + if (class_exists($filterName)) { |
|
| 303 | + $this->filter = new $filterName(); |
|
| 304 | + } else { |
|
| 305 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER. class '$filterName' doesnt exist"); |
|
| 306 | + } |
|
| 307 | + $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE; |
|
| 308 | + } else { |
|
| 309 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER filter name cannot be empty"); |
|
| 310 | + } |
|
| 311 | + break; |
|
| 312 | 312 | |
| 313 | - case 'LAYOUT': |
|
| 314 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT': |
|
| 313 | + case 'LAYOUT': |
|
| 314 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT': |
|
| 315 | 315 | |
| 316 | - $class = @$attribs['CLASS']; |
|
| 316 | + $class = @$attribs['CLASS']; |
|
| 317 | 317 | |
| 318 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LAYOUT class='{$class}'"); |
|
| 318 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LAYOUT class='{$class}'"); |
|
| 319 | 319 | |
| 320 | - $this->layout = LoggerLayout::factory($this->subst($class)); |
|
| 321 | - if ($this->layout === null) |
|
| 322 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LAYOUT unable to instanciate class='{$class}'"); |
|
| 320 | + $this->layout = LoggerLayout::factory($this->subst($class)); |
|
| 321 | + if ($this->layout === null) |
|
| 322 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LAYOUT unable to instanciate class='{$class}'"); |
|
| 323 | 323 | |
| 324 | - $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE; |
|
| 325 | - break; |
|
| 324 | + $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE; |
|
| 325 | + break; |
|
| 326 | 326 | |
| 327 | - case 'LOGGER': |
|
| 328 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LOGGER': |
|
| 327 | + case 'LOGGER': |
|
| 328 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LOGGER': |
|
| 329 | 329 | |
| 330 | - // $this->logger is assigned by reference. |
|
| 331 | - // Only '$this->logger=null;' destroys referenced object |
|
| 332 | - unset($this->logger); |
|
| 333 | - $this->logger = null; |
|
| 330 | + // $this->logger is assigned by reference. |
|
| 331 | + // Only '$this->logger=null;' destroys referenced object |
|
| 332 | + unset($this->logger); |
|
| 333 | + $this->logger = null; |
|
| 334 | 334 | |
| 335 | - $loggerName = $this->subst(@$attribs['NAME']); |
|
| 336 | - if (!empty($loggerName)) { |
|
| 337 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOGGER. name='$loggerName'"); |
|
| 335 | + $loggerName = $this->subst(@$attribs['NAME']); |
|
| 336 | + if (!empty($loggerName)) { |
|
| 337 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOGGER. name='$loggerName'"); |
|
| 338 | 338 | |
| 339 | - $class = $this->subst(@$attribs['CLASS']); |
|
| 340 | - if (empty($class)) { |
|
| 341 | - $this->logger =& $this->repository->getLogger($loggerName); |
|
| 342 | - } else { |
|
| 343 | - $className = basename($class); |
|
| 344 | - if (!class_exists($className)) |
|
| 345 | - @include_once("{$class}.php"); |
|
| 346 | - if (!class_exists($className)) { |
|
| 347 | - LoggerLog::warn( |
|
| 348 | - "LoggerDOMConfigurator::tagOpen() LOGGER. ". |
|
| 349 | - "cannot find '$className'." |
|
| 350 | - ); |
|
| 351 | - } else { |
|
| 339 | + $class = $this->subst(@$attribs['CLASS']); |
|
| 340 | + if (empty($class)) { |
|
| 341 | + $this->logger =& $this->repository->getLogger($loggerName); |
|
| 342 | + } else { |
|
| 343 | + $className = basename($class); |
|
| 344 | + if (!class_exists($className)) |
|
| 345 | + @include_once("{$class}.php"); |
|
| 346 | + if (!class_exists($className)) { |
|
| 347 | + LoggerLog::warn( |
|
| 348 | + "LoggerDOMConfigurator::tagOpen() LOGGER. ". |
|
| 349 | + "cannot find '$className'." |
|
| 350 | + ); |
|
| 351 | + } else { |
|
| 352 | 352 | |
| 353 | - if (in_array('getlogger', get_class_methods($className))) { |
|
| 354 | - $this->logger =& call_user_func(array($className, 'getlogger'), $loggerName); |
|
| 355 | - } else { |
|
| 356 | - LoggerLog::warn( |
|
| 357 | - "LoggerDOMConfigurator::tagOpen() LOGGER. ". |
|
| 358 | - "class '$className' doesnt implement 'getLogger()' method." |
|
| 359 | - ); |
|
| 360 | - } |
|
| 361 | - } |
|
| 362 | - } |
|
| 363 | - if ($this->logger !== null && isset($attribs['ADDITIVITY'])) { |
|
| 364 | - $additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true); |
|
| 365 | - $this->logger->setAdditivity($additivity); |
|
| 366 | - } |
|
| 367 | - } else { |
|
| 368 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LOGGER. Attribute 'name' is not set or is empty."); |
|
| 369 | - } |
|
| 370 | - $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE;; |
|
| 371 | - break; |
|
| 353 | + if (in_array('getlogger', get_class_methods($className))) { |
|
| 354 | + $this->logger =& call_user_func(array($className, 'getlogger'), $loggerName); |
|
| 355 | + } else { |
|
| 356 | + LoggerLog::warn( |
|
| 357 | + "LoggerDOMConfigurator::tagOpen() LOGGER. ". |
|
| 358 | + "class '$className' doesnt implement 'getLogger()' method." |
|
| 359 | + ); |
|
| 360 | + } |
|
| 361 | + } |
|
| 362 | + } |
|
| 363 | + if ($this->logger !== null && isset($attribs['ADDITIVITY'])) { |
|
| 364 | + $additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true); |
|
| 365 | + $this->logger->setAdditivity($additivity); |
|
| 366 | + } |
|
| 367 | + } else { |
|
| 368 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LOGGER. Attribute 'name' is not set or is empty."); |
|
| 369 | + } |
|
| 370 | + $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE;; |
|
| 371 | + break; |
|
| 372 | 372 | |
| 373 | - case 'LEVEL': |
|
| 374 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LEVEL': |
|
| 375 | - case 'PRIORITY': |
|
| 376 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PRIORITY': |
|
| 373 | + case 'LEVEL': |
|
| 374 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LEVEL': |
|
| 375 | + case 'PRIORITY': |
|
| 376 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PRIORITY': |
|
| 377 | 377 | |
| 378 | - if (!isset($attribs['VALUE'])) { |
|
| 379 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value not set"); |
|
| 380 | - break; |
|
| 381 | - } |
|
| 378 | + if (!isset($attribs['VALUE'])) { |
|
| 379 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value not set"); |
|
| 380 | + break; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value={$attribs['VALUE']}"); |
|
| 383 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value={$attribs['VALUE']}"); |
|
| 384 | 384 | |
| 385 | - if ($this->logger === null) { |
|
| 386 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null"); |
|
| 387 | - break; |
|
| 388 | - } |
|
| 385 | + if ($this->logger === null) { |
|
| 386 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null"); |
|
| 387 | + break; |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | - switch (end($this->state)) { |
|
| 391 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE: |
|
| 392 | - $this->logger->setLevel( |
|
| 393 | - LoggerOptionConverter::toLevel( |
|
| 394 | - $this->subst($attribs['VALUE']), |
|
| 395 | - $this->logger->getLevel() |
|
| 396 | - ) |
|
| 397 | - ); |
|
| 398 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL root level is now '{$attribs['VALUE']}' "); |
|
| 399 | - break; |
|
| 400 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE: |
|
| 401 | - $this->logger->setLevel( |
|
| 402 | - LoggerOptionConverter::toLevel( |
|
| 403 | - $this->subst($attribs['VALUE']), |
|
| 404 | - $this->logger->getLevel() |
|
| 405 | - ) |
|
| 406 | - ); |
|
| 407 | - break; |
|
| 408 | - default: |
|
| 409 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL state '{$this->state}' not allowed here"); |
|
| 410 | - } |
|
| 411 | - break; |
|
| 390 | + switch (end($this->state)) { |
|
| 391 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE: |
|
| 392 | + $this->logger->setLevel( |
|
| 393 | + LoggerOptionConverter::toLevel( |
|
| 394 | + $this->subst($attribs['VALUE']), |
|
| 395 | + $this->logger->getLevel() |
|
| 396 | + ) |
|
| 397 | + ); |
|
| 398 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL root level is now '{$attribs['VALUE']}' "); |
|
| 399 | + break; |
|
| 400 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE: |
|
| 401 | + $this->logger->setLevel( |
|
| 402 | + LoggerOptionConverter::toLevel( |
|
| 403 | + $this->subst($attribs['VALUE']), |
|
| 404 | + $this->logger->getLevel() |
|
| 405 | + ) |
|
| 406 | + ); |
|
| 407 | + break; |
|
| 408 | + default: |
|
| 409 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL state '{$this->state}' not allowed here"); |
|
| 410 | + } |
|
| 411 | + break; |
|
| 412 | 412 | |
| 413 | - case 'PARAM': |
|
| 414 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PARAM': |
|
| 413 | + case 'PARAM': |
|
| 414 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PARAM': |
|
| 415 | 415 | |
| 416 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() PARAM"); |
|
| 416 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() PARAM"); |
|
| 417 | 417 | |
| 418 | - if (!isset($attribs['NAME'])) { |
|
| 419 | - LoggerLog::warn( |
|
| 420 | - "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 421 | - "attribute 'name' not defined." |
|
| 422 | - ); |
|
| 423 | - break; |
|
| 424 | - } |
|
| 425 | - if (!isset($attribs['VALUE'])) { |
|
| 426 | - LoggerLog::warn( |
|
| 427 | - "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 428 | - "attribute 'value' not defined." |
|
| 429 | - ); |
|
| 430 | - break; |
|
| 431 | - } |
|
| 418 | + if (!isset($attribs['NAME'])) { |
|
| 419 | + LoggerLog::warn( |
|
| 420 | + "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 421 | + "attribute 'name' not defined." |
|
| 422 | + ); |
|
| 423 | + break; |
|
| 424 | + } |
|
| 425 | + if (!isset($attribs['VALUE'])) { |
|
| 426 | + LoggerLog::warn( |
|
| 427 | + "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 428 | + "attribute 'value' not defined." |
|
| 429 | + ); |
|
| 430 | + break; |
|
| 431 | + } |
|
| 432 | 432 | |
| 433 | - switch (end($this->state)) { |
|
| 434 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE: |
|
| 435 | - if ($this->appender !== null) { |
|
| 436 | - $this->setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 437 | - } else { |
|
| 438 | - LoggerLog::warn( |
|
| 439 | - "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 440 | - " trying to set property to a null appender." |
|
| 441 | - ); |
|
| 442 | - } |
|
| 443 | - break; |
|
| 444 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE: |
|
| 445 | - if ($this->layout !== null) { |
|
| 446 | - $this->setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 447 | - } else { |
|
| 448 | - LoggerLog::warn( |
|
| 449 | - "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 450 | - " trying to set property to a null layout." |
|
| 451 | - ); |
|
| 452 | - } |
|
| 453 | - break; |
|
| 454 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE: |
|
| 455 | - if ($this->filter !== null) { |
|
| 456 | - $this->setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 457 | - } else { |
|
| 458 | - LoggerLog::warn( |
|
| 459 | - "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 460 | - " trying to set property to a null filter." |
|
| 461 | - ); |
|
| 462 | - } |
|
| 463 | - break; |
|
| 464 | - default: |
|
| 465 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here"); |
|
| 466 | - } |
|
| 467 | - break; |
|
| 433 | + switch (end($this->state)) { |
|
| 434 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE: |
|
| 435 | + if ($this->appender !== null) { |
|
| 436 | + $this->setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 437 | + } else { |
|
| 438 | + LoggerLog::warn( |
|
| 439 | + "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 440 | + " trying to set property to a null appender." |
|
| 441 | + ); |
|
| 442 | + } |
|
| 443 | + break; |
|
| 444 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE: |
|
| 445 | + if ($this->layout !== null) { |
|
| 446 | + $this->setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 447 | + } else { |
|
| 448 | + LoggerLog::warn( |
|
| 449 | + "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 450 | + " trying to set property to a null layout." |
|
| 451 | + ); |
|
| 452 | + } |
|
| 453 | + break; |
|
| 454 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE: |
|
| 455 | + if ($this->filter !== null) { |
|
| 456 | + $this->setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE'])); |
|
| 457 | + } else { |
|
| 458 | + LoggerLog::warn( |
|
| 459 | + "LoggerDOMConfigurator::tagOpen() PARAM. ". |
|
| 460 | + " trying to set property to a null filter." |
|
| 461 | + ); |
|
| 462 | + } |
|
| 463 | + break; |
|
| 464 | + default: |
|
| 465 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here"); |
|
| 466 | + } |
|
| 467 | + break; |
|
| 468 | 468 | |
| 469 | - case 'RENDERER': |
|
| 470 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':RENDERER': |
|
| 469 | + case 'RENDERER': |
|
| 470 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':RENDERER': |
|
| 471 | 471 | |
| 472 | - $renderedClass = $this->subst(@$attribs['RENDEREDCLASS']); |
|
| 473 | - $renderingClass = $this->subst(@$attribs['RENDERINGCLASS']); |
|
| 472 | + $renderedClass = $this->subst(@$attribs['RENDEREDCLASS']); |
|
| 473 | + $renderingClass = $this->subst(@$attribs['RENDERINGCLASS']); |
|
| 474 | 474 | |
| 475 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass='$renderedClass' renderingClass='$renderingClass'"); |
|
| 475 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass='$renderedClass' renderingClass='$renderingClass'"); |
|
| 476 | 476 | |
| 477 | - if (!empty($renderedClass) && !empty($renderingClass)) { |
|
| 478 | - $renderer = LoggerObjectRenderer::factory($renderingClass); |
|
| 479 | - if ($renderer === null) { |
|
| 480 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER cannot instantiate '$renderingClass'"); |
|
| 481 | - } else { |
|
| 482 | - $this->repository->setRenderer($renderedClass, $renderer); |
|
| 483 | - } |
|
| 484 | - } else { |
|
| 485 | - LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass or renderingClass is empty"); |
|
| 486 | - } |
|
| 487 | - break; |
|
| 477 | + if (!empty($renderedClass) && !empty($renderingClass)) { |
|
| 478 | + $renderer = LoggerObjectRenderer::factory($renderingClass); |
|
| 479 | + if ($renderer === null) { |
|
| 480 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER cannot instantiate '$renderingClass'"); |
|
| 481 | + } else { |
|
| 482 | + $this->repository->setRenderer($renderedClass, $renderer); |
|
| 483 | + } |
|
| 484 | + } else { |
|
| 485 | + LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass or renderingClass is empty"); |
|
| 486 | + } |
|
| 487 | + break; |
|
| 488 | 488 | |
| 489 | - case 'ROOT': |
|
| 490 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT': |
|
| 489 | + case 'ROOT': |
|
| 490 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT': |
|
| 491 | 491 | |
| 492 | - LoggerLog::debug("LoggerDOMConfigurator::tagOpen() ROOT"); |
|
| 492 | + LoggerLog::debug("LoggerDOMConfigurator::tagOpen() ROOT"); |
|
| 493 | 493 | |
| 494 | - $this->logger =& LoggerManager::getRootLogger(); |
|
| 494 | + $this->logger =& LoggerManager::getRootLogger(); |
|
| 495 | 495 | |
| 496 | - $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE; |
|
| 497 | - break; |
|
| 496 | + $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE; |
|
| 497 | + break; |
|
| 498 | 498 | |
| 499 | - } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - } |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | 503 | |
| 504 | - /** |
|
| 505 | - * @param mixed $parser |
|
| 506 | - * @param string $tag |
|
| 507 | - */ |
|
| 508 | - public function tagClose($parser, $tag) |
|
| 509 | - { |
|
| 510 | - switch ($tag) { |
|
| 504 | + /** |
|
| 505 | + * @param mixed $parser |
|
| 506 | + * @param string $tag |
|
| 507 | + */ |
|
| 508 | + public function tagClose($parser, $tag) |
|
| 509 | + { |
|
| 510 | + switch ($tag) { |
|
| 511 | 511 | |
| 512 | - case 'CONFIGURATION' : |
|
| 513 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION': |
|
| 512 | + case 'CONFIGURATION' : |
|
| 513 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION': |
|
| 514 | 514 | |
| 515 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() CONFIGURATION"); |
|
| 516 | - break; |
|
| 515 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() CONFIGURATION"); |
|
| 516 | + break; |
|
| 517 | 517 | |
| 518 | - case 'APPENDER' : |
|
| 519 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER': |
|
| 518 | + case 'APPENDER' : |
|
| 519 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER': |
|
| 520 | 520 | |
| 521 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() APPENDER"); |
|
| 521 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() APPENDER"); |
|
| 522 | 522 | |
| 523 | - if ($this->appender !== null) { |
|
| 524 | - if ($this->appender->requiresLayout() && $this->appender->layout === null) { |
|
| 525 | - $appenderName = $this->appender->getName(); |
|
| 526 | - LoggerLog::warn( |
|
| 527 | - "LoggerDOMConfigurator::tagClose() APPENDER. ". |
|
| 528 | - "'$appenderName' requires a layout that is not defined. ". |
|
| 529 | - "Using a simple layout" |
|
| 530 | - ); |
|
| 531 | - $this->appender->setLayout(LoggerLayout::factory('LoggerLayoutSimple')); |
|
| 532 | - } |
|
| 533 | - $this->appender->activateOptions(); |
|
| 534 | - } |
|
| 535 | - array_pop($this->state); |
|
| 536 | - break; |
|
| 523 | + if ($this->appender !== null) { |
|
| 524 | + if ($this->appender->requiresLayout() && $this->appender->layout === null) { |
|
| 525 | + $appenderName = $this->appender->getName(); |
|
| 526 | + LoggerLog::warn( |
|
| 527 | + "LoggerDOMConfigurator::tagClose() APPENDER. ". |
|
| 528 | + "'$appenderName' requires a layout that is not defined. ". |
|
| 529 | + "Using a simple layout" |
|
| 530 | + ); |
|
| 531 | + $this->appender->setLayout(LoggerLayout::factory('LoggerLayoutSimple')); |
|
| 532 | + } |
|
| 533 | + $this->appender->activateOptions(); |
|
| 534 | + } |
|
| 535 | + array_pop($this->state); |
|
| 536 | + break; |
|
| 537 | 537 | |
| 538 | - case 'FILTER' : |
|
| 539 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER': |
|
| 538 | + case 'FILTER' : |
|
| 539 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER': |
|
| 540 | 540 | |
| 541 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() FILTER"); |
|
| 541 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() FILTER"); |
|
| 542 | 542 | |
| 543 | - if ($this->filter !== null) { |
|
| 544 | - $this->filter->activateOptions(); |
|
| 545 | - $this->appender->addFilter($this->filter); |
|
| 546 | - $this->filter = null; |
|
| 547 | - } |
|
| 548 | - array_pop($this->state); |
|
| 549 | - break; |
|
| 543 | + if ($this->filter !== null) { |
|
| 544 | + $this->filter->activateOptions(); |
|
| 545 | + $this->appender->addFilter($this->filter); |
|
| 546 | + $this->filter = null; |
|
| 547 | + } |
|
| 548 | + array_pop($this->state); |
|
| 549 | + break; |
|
| 550 | 550 | |
| 551 | - case 'LAYOUT': |
|
| 552 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT': |
|
| 551 | + case 'LAYOUT': |
|
| 552 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT': |
|
| 553 | 553 | |
| 554 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() LAYOUT"); |
|
| 554 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() LAYOUT"); |
|
| 555 | 555 | |
| 556 | - if ($this->appender !== null && $this->layout !== null && $this->appender->requiresLayout()) { |
|
| 557 | - $this->layout->activateOptions(); |
|
| 558 | - $this->appender->setLayout($this->layout); |
|
| 559 | - $this->layout = null; |
|
| 560 | - } |
|
| 561 | - array_pop($this->state); |
|
| 562 | - break; |
|
| 556 | + if ($this->appender !== null && $this->layout !== null && $this->appender->requiresLayout()) { |
|
| 557 | + $this->layout->activateOptions(); |
|
| 558 | + $this->appender->setLayout($this->layout); |
|
| 559 | + $this->layout = null; |
|
| 560 | + } |
|
| 561 | + array_pop($this->state); |
|
| 562 | + break; |
|
| 563 | 563 | |
| 564 | - case 'LOGGER': |
|
| 565 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LOGGER': |
|
| 564 | + case 'LOGGER': |
|
| 565 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LOGGER': |
|
| 566 | 566 | |
| 567 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() LOGGER"); |
|
| 567 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() LOGGER"); |
|
| 568 | 568 | |
| 569 | - array_pop($this->state); |
|
| 570 | - break; |
|
| 569 | + array_pop($this->state); |
|
| 570 | + break; |
|
| 571 | 571 | |
| 572 | - case 'ROOT': |
|
| 573 | - case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT': |
|
| 572 | + case 'ROOT': |
|
| 573 | + case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT': |
|
| 574 | 574 | |
| 575 | - LoggerLog::debug("LoggerDOMConfigurator::tagClose() ROOT"); |
|
| 575 | + LoggerLog::debug("LoggerDOMConfigurator::tagClose() ROOT"); |
|
| 576 | 576 | |
| 577 | - array_pop($this->state); |
|
| 578 | - break; |
|
| 579 | - } |
|
| 580 | - } |
|
| 577 | + array_pop($this->state); |
|
| 578 | + break; |
|
| 579 | + } |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | - /** |
|
| 583 | - * @param object $object |
|
| 584 | - * @param string $name |
|
| 585 | - * @param mixed $value |
|
| 586 | - */ |
|
| 587 | - public function setter(&$object, $name, $value) |
|
| 588 | - { |
|
| 589 | - if (empty($name)) { |
|
| 590 | - LoggerLog::debug("LoggerDOMConfigurator::setter() 'name' param cannot be empty"); |
|
| 591 | - return false; |
|
| 592 | - } |
|
| 593 | - $methodName = 'set'.ucfirst($name); |
|
| 594 | - if (method_exists($object, $methodName)) { |
|
| 595 | - LoggerLog::debug("LoggerDOMConfigurator::setter() Calling ".get_class($object)."::{$methodName}({$value})"); |
|
| 596 | - return call_user_func(array(&$object, $methodName), $value); |
|
| 597 | - } else { |
|
| 598 | - LoggerLog::warn("LoggerDOMConfigurator::setter() ".get_class($object)."::{$methodName}() does not exists"); |
|
| 599 | - return false; |
|
| 600 | - } |
|
| 601 | - } |
|
| 582 | + /** |
|
| 583 | + * @param object $object |
|
| 584 | + * @param string $name |
|
| 585 | + * @param mixed $value |
|
| 586 | + */ |
|
| 587 | + public function setter(&$object, $name, $value) |
|
| 588 | + { |
|
| 589 | + if (empty($name)) { |
|
| 590 | + LoggerLog::debug("LoggerDOMConfigurator::setter() 'name' param cannot be empty"); |
|
| 591 | + return false; |
|
| 592 | + } |
|
| 593 | + $methodName = 'set'.ucfirst($name); |
|
| 594 | + if (method_exists($object, $methodName)) { |
|
| 595 | + LoggerLog::debug("LoggerDOMConfigurator::setter() Calling ".get_class($object)."::{$methodName}({$value})"); |
|
| 596 | + return call_user_func(array(&$object, $methodName), $value); |
|
| 597 | + } else { |
|
| 598 | + LoggerLog::warn("LoggerDOMConfigurator::setter() ".get_class($object)."::{$methodName}() does not exists"); |
|
| 599 | + return false; |
|
| 600 | + } |
|
| 601 | + } |
|
| 602 | 602 | |
| 603 | - public function subst($value) |
|
| 604 | - { |
|
| 605 | - return LoggerOptionConverter::substVars($value); |
|
| 606 | - } |
|
| 603 | + public function subst($value) |
|
| 604 | + { |
|
| 605 | + return LoggerOptionConverter::substVars($value); |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | 608 | } |
| 609 | 609 | ?> |
| 610 | 610 | \ No newline at end of file |
@@ -49,216 +49,216 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | class LoggerLevel { |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var integer |
|
| 54 | - */ |
|
| 55 | - public $level; |
|
| 52 | + /** |
|
| 53 | + * @var integer |
|
| 54 | + */ |
|
| 55 | + public $level; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - public $levelStr; |
|
| 57 | + /** |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + public $levelStr; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @var integer |
|
| 64 | - */ |
|
| 65 | - public $syslogEquivalent; |
|
| 62 | + /** |
|
| 63 | + * @var integer |
|
| 64 | + */ |
|
| 65 | + public $syslogEquivalent; |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Constructor |
|
| 69 | - * |
|
| 70 | - * @param integer $level |
|
| 71 | - * @param string $levelStr |
|
| 72 | - * @param integer $syslogEquivalent |
|
| 73 | - */ |
|
| 74 | - public function LoggerLevel($level, $levelStr, $syslogEquivalent) |
|
| 75 | - { |
|
| 76 | - $this->level = $level; |
|
| 77 | - $this->levelStr = $levelStr; |
|
| 78 | - $this->syslogEquivalent = $syslogEquivalent; |
|
| 79 | - } |
|
| 67 | + /** |
|
| 68 | + * Constructor |
|
| 69 | + * |
|
| 70 | + * @param integer $level |
|
| 71 | + * @param string $levelStr |
|
| 72 | + * @param integer $syslogEquivalent |
|
| 73 | + */ |
|
| 74 | + public function LoggerLevel($level, $levelStr, $syslogEquivalent) |
|
| 75 | + { |
|
| 76 | + $this->level = $level; |
|
| 77 | + $this->levelStr = $levelStr; |
|
| 78 | + $this->syslogEquivalent = $syslogEquivalent; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Two priorities are equal if their level fields are equal. |
|
| 83 | - * |
|
| 84 | - * @param object $o |
|
| 85 | - * @return boolean |
|
| 86 | - */ |
|
| 87 | - public function equals($o) |
|
| 88 | - { |
|
| 89 | - if (is_a($o, 'loggerlevel')) { |
|
| 90 | - return ($this->level == $o->level); |
|
| 91 | - } else { |
|
| 92 | - return false; |
|
| 93 | - } |
|
| 94 | - } |
|
| 81 | + /** |
|
| 82 | + * Two priorities are equal if their level fields are equal. |
|
| 83 | + * |
|
| 84 | + * @param object $o |
|
| 85 | + * @return boolean |
|
| 86 | + */ |
|
| 87 | + public function equals($o) |
|
| 88 | + { |
|
| 89 | + if (is_a($o, 'loggerlevel')) { |
|
| 90 | + return ($this->level == $o->level); |
|
| 91 | + } else { |
|
| 92 | + return false; |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Returns an Off Level |
|
| 98 | - * @static |
|
| 99 | - * @return LoggerLevel |
|
| 100 | - */ |
|
| 101 | - public function &getLevelOff() |
|
| 102 | - { |
|
| 103 | - static $level; |
|
| 104 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0); |
|
| 105 | - return $level; |
|
| 106 | - } |
|
| 96 | + /** |
|
| 97 | + * Returns an Off Level |
|
| 98 | + * @static |
|
| 99 | + * @return LoggerLevel |
|
| 100 | + */ |
|
| 101 | + public function &getLevelOff() |
|
| 102 | + { |
|
| 103 | + static $level; |
|
| 104 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0); |
|
| 105 | + return $level; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns a Fatal Level |
|
| 110 | - * @static |
|
| 111 | - * @return LoggerLevel |
|
| 112 | - */ |
|
| 113 | - public function &getLevelFatal() |
|
| 114 | - { |
|
| 115 | - static $level; |
|
| 116 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0); |
|
| 117 | - return $level; |
|
| 118 | - } |
|
| 108 | + /** |
|
| 109 | + * Returns a Fatal Level |
|
| 110 | + * @static |
|
| 111 | + * @return LoggerLevel |
|
| 112 | + */ |
|
| 113 | + public function &getLevelFatal() |
|
| 114 | + { |
|
| 115 | + static $level; |
|
| 116 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0); |
|
| 117 | + return $level; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Returns an Error Level |
|
| 122 | - * @static |
|
| 123 | - * @return LoggerLevel |
|
| 124 | - */ |
|
| 125 | - public function &getLevelError() |
|
| 126 | - { |
|
| 127 | - static $level; |
|
| 128 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3); |
|
| 129 | - return $level; |
|
| 130 | - } |
|
| 120 | + /** |
|
| 121 | + * Returns an Error Level |
|
| 122 | + * @static |
|
| 123 | + * @return LoggerLevel |
|
| 124 | + */ |
|
| 125 | + public function &getLevelError() |
|
| 126 | + { |
|
| 127 | + static $level; |
|
| 128 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3); |
|
| 129 | + return $level; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Returns a Warn Level |
|
| 134 | - * @static |
|
| 135 | - * @return LoggerLevel |
|
| 136 | - */ |
|
| 137 | - public function &getLevelWarn() |
|
| 138 | - { |
|
| 139 | - static $level; |
|
| 140 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4); |
|
| 141 | - return $level; |
|
| 142 | - } |
|
| 132 | + /** |
|
| 133 | + * Returns a Warn Level |
|
| 134 | + * @static |
|
| 135 | + * @return LoggerLevel |
|
| 136 | + */ |
|
| 137 | + public function &getLevelWarn() |
|
| 138 | + { |
|
| 139 | + static $level; |
|
| 140 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4); |
|
| 141 | + return $level; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Returns an Info Level |
|
| 146 | - * @static |
|
| 147 | - * @return LoggerLevel |
|
| 148 | - */ |
|
| 149 | - public function &getLevelInfo() |
|
| 150 | - { |
|
| 151 | - static $level; |
|
| 152 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6); |
|
| 153 | - return $level; |
|
| 154 | - } |
|
| 144 | + /** |
|
| 145 | + * Returns an Info Level |
|
| 146 | + * @static |
|
| 147 | + * @return LoggerLevel |
|
| 148 | + */ |
|
| 149 | + public function &getLevelInfo() |
|
| 150 | + { |
|
| 151 | + static $level; |
|
| 152 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6); |
|
| 153 | + return $level; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Returns a Debug Level |
|
| 158 | - * @static |
|
| 159 | - * @return LoggerLevel |
|
| 160 | - */ |
|
| 161 | - public function &getLevelDebug() |
|
| 162 | - { |
|
| 163 | - static $level; |
|
| 164 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7); |
|
| 165 | - return $level; |
|
| 166 | - } |
|
| 156 | + /** |
|
| 157 | + * Returns a Debug Level |
|
| 158 | + * @static |
|
| 159 | + * @return LoggerLevel |
|
| 160 | + */ |
|
| 161 | + public function &getLevelDebug() |
|
| 162 | + { |
|
| 163 | + static $level; |
|
| 164 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7); |
|
| 165 | + return $level; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Returns an All Level |
|
| 170 | - * @static |
|
| 171 | - * @return LoggerLevel |
|
| 172 | - */ |
|
| 173 | - public function &getLevelAll() |
|
| 174 | - { |
|
| 175 | - static $level; |
|
| 176 | - if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7); |
|
| 177 | - return $level; |
|
| 178 | - } |
|
| 168 | + /** |
|
| 169 | + * Returns an All Level |
|
| 170 | + * @static |
|
| 171 | + * @return LoggerLevel |
|
| 172 | + */ |
|
| 173 | + public function &getLevelAll() |
|
| 174 | + { |
|
| 175 | + static $level; |
|
| 176 | + if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7); |
|
| 177 | + return $level; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Return the syslog equivalent of this priority as an integer. |
|
| 182 | - * @final |
|
| 183 | - * @return integer |
|
| 184 | - */ |
|
| 185 | - public function getSyslogEquivalent() |
|
| 186 | - { |
|
| 187 | - return $this->syslogEquivalent; |
|
| 188 | - } |
|
| 180 | + /** |
|
| 181 | + * Return the syslog equivalent of this priority as an integer. |
|
| 182 | + * @final |
|
| 183 | + * @return integer |
|
| 184 | + */ |
|
| 185 | + public function getSyslogEquivalent() |
|
| 186 | + { |
|
| 187 | + return $this->syslogEquivalent; |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * Returns <i>true</i> if this level has a higher or equal |
|
| 192 | - * level than the level passed as argument, <i>false</i> |
|
| 193 | - * otherwise. |
|
| 194 | - * |
|
| 195 | - * <p>You should think twice before overriding the default |
|
| 196 | - * implementation of <i>isGreaterOrEqual</i> method. |
|
| 197 | - * |
|
| 198 | - * @param LoggerLevel $r |
|
| 199 | - * @return boolean |
|
| 200 | - */ |
|
| 201 | - public function isGreaterOrEqual($r) |
|
| 202 | - { |
|
| 203 | - return $this->level >= $r->level; |
|
| 204 | - } |
|
| 190 | + /** |
|
| 191 | + * Returns <i>true</i> if this level has a higher or equal |
|
| 192 | + * level than the level passed as argument, <i>false</i> |
|
| 193 | + * otherwise. |
|
| 194 | + * |
|
| 195 | + * <p>You should think twice before overriding the default |
|
| 196 | + * implementation of <i>isGreaterOrEqual</i> method. |
|
| 197 | + * |
|
| 198 | + * @param LoggerLevel $r |
|
| 199 | + * @return boolean |
|
| 200 | + */ |
|
| 201 | + public function isGreaterOrEqual($r) |
|
| 202 | + { |
|
| 203 | + return $this->level >= $r->level; |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - /** |
|
| 207 | - * Returns the string representation of this priority. |
|
| 208 | - * @return string |
|
| 209 | - * @final |
|
| 210 | - */ |
|
| 211 | - public function toString() |
|
| 212 | - { |
|
| 213 | - return $this->levelStr; |
|
| 214 | - } |
|
| 206 | + /** |
|
| 207 | + * Returns the string representation of this priority. |
|
| 208 | + * @return string |
|
| 209 | + * @final |
|
| 210 | + */ |
|
| 211 | + public function toString() |
|
| 212 | + { |
|
| 213 | + return $this->levelStr; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Returns the integer representation of this level. |
|
| 218 | - * @return integer |
|
| 219 | - */ |
|
| 220 | - public function toInt() |
|
| 221 | - { |
|
| 222 | - return $this->level; |
|
| 223 | - } |
|
| 216 | + /** |
|
| 217 | + * Returns the integer representation of this level. |
|
| 218 | + * @return integer |
|
| 219 | + */ |
|
| 220 | + public function toInt() |
|
| 221 | + { |
|
| 222 | + return $this->level; |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * Convert the string passed as argument to a level. If the |
|
| 227 | - * conversion fails, then this method returns a DEBUG Level. |
|
| 228 | - * |
|
| 229 | - * @param mixed $arg |
|
| 230 | - * @param LoggerLevel $default |
|
| 231 | - * @static |
|
| 232 | - */ |
|
| 233 | - public function &toLevel($arg, $defaultLevel = null) |
|
| 234 | - { |
|
| 235 | - if ($defaultLevel === null) { |
|
| 236 | - return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug()); |
|
| 237 | - } else { |
|
| 238 | - if (is_int($arg)) { |
|
| 239 | - switch($arg) { |
|
| 240 | - case LOG4PHP_LEVEL_ALL_INT: return LoggerLevel::getLevelAll(); |
|
| 241 | - case LOG4PHP_LEVEL_DEBUG_INT: return LoggerLevel::getLevelDebug(); |
|
| 242 | - case LOG4PHP_LEVEL_INFO_INT: return LoggerLevel::getLevelInfo(); |
|
| 243 | - case LOG4PHP_LEVEL_WARN_INT: return LoggerLevel::getLevelWarn(); |
|
| 244 | - case LOG4PHP_LEVEL_ERROR_INT: return LoggerLevel::getLevelError(); |
|
| 245 | - case LOG4PHP_LEVEL_FATAL_INT: return LoggerLevel::getLevelFatal(); |
|
| 246 | - case LOG4PHP_LEVEL_OFF_INT: return LoggerLevel::getLevelOff(); |
|
| 247 | - default: return $defaultLevel; |
|
| 248 | - } |
|
| 249 | - } else { |
|
| 250 | - switch(strtoupper($arg)) { |
|
| 251 | - case 'ALL': return LoggerLevel::getLevelAll(); |
|
| 252 | - case 'DEBUG': return LoggerLevel::getLevelDebug(); |
|
| 253 | - case 'INFO': return LoggerLevel::getLevelInfo(); |
|
| 254 | - case 'WARN': return LoggerLevel::getLevelWarn(); |
|
| 255 | - case 'ERROR': return LoggerLevel::getLevelError(); |
|
| 256 | - case 'FATAL': return LoggerLevel::getLevelFatal(); |
|
| 257 | - case 'OFF': return LoggerLevel::getLevelOff(); |
|
| 258 | - default: return $defaultLevel; |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - } |
|
| 225 | + /** |
|
| 226 | + * Convert the string passed as argument to a level. If the |
|
| 227 | + * conversion fails, then this method returns a DEBUG Level. |
|
| 228 | + * |
|
| 229 | + * @param mixed $arg |
|
| 230 | + * @param LoggerLevel $default |
|
| 231 | + * @static |
|
| 232 | + */ |
|
| 233 | + public function &toLevel($arg, $defaultLevel = null) |
|
| 234 | + { |
|
| 235 | + if ($defaultLevel === null) { |
|
| 236 | + return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug()); |
|
| 237 | + } else { |
|
| 238 | + if (is_int($arg)) { |
|
| 239 | + switch($arg) { |
|
| 240 | + case LOG4PHP_LEVEL_ALL_INT: return LoggerLevel::getLevelAll(); |
|
| 241 | + case LOG4PHP_LEVEL_DEBUG_INT: return LoggerLevel::getLevelDebug(); |
|
| 242 | + case LOG4PHP_LEVEL_INFO_INT: return LoggerLevel::getLevelInfo(); |
|
| 243 | + case LOG4PHP_LEVEL_WARN_INT: return LoggerLevel::getLevelWarn(); |
|
| 244 | + case LOG4PHP_LEVEL_ERROR_INT: return LoggerLevel::getLevelError(); |
|
| 245 | + case LOG4PHP_LEVEL_FATAL_INT: return LoggerLevel::getLevelFatal(); |
|
| 246 | + case LOG4PHP_LEVEL_OFF_INT: return LoggerLevel::getLevelOff(); |
|
| 247 | + default: return $defaultLevel; |
|
| 248 | + } |
|
| 249 | + } else { |
|
| 250 | + switch(strtoupper($arg)) { |
|
| 251 | + case 'ALL': return LoggerLevel::getLevelAll(); |
|
| 252 | + case 'DEBUG': return LoggerLevel::getLevelDebug(); |
|
| 253 | + case 'INFO': return LoggerLevel::getLevelInfo(); |
|
| 254 | + case 'WARN': return LoggerLevel::getLevelWarn(); |
|
| 255 | + case 'ERROR': return LoggerLevel::getLevelError(); |
|
| 256 | + case 'FATAL': return LoggerLevel::getLevelFatal(); |
|
| 257 | + case 'OFF': return LoggerLevel::getLevelOff(); |
|
| 258 | + default: return $defaultLevel; |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | 263 | } |
| 264 | 264 | ?> |
| 265 | 265 | \ No newline at end of file |
@@ -36,66 +36,66 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class LoggerRoot extends Logger { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var string name of logger |
|
| 41 | - */ |
|
| 42 | - public $name = 'root'; |
|
| 39 | + /** |
|
| 40 | + * @var string name of logger |
|
| 41 | + */ |
|
| 42 | + public $name = 'root'; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var object must be null for LoggerRoot |
|
| 46 | - */ |
|
| 47 | - public $parent = null; |
|
| 44 | + /** |
|
| 45 | + * @var object must be null for LoggerRoot |
|
| 46 | + */ |
|
| 47 | + public $parent = null; |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Constructor |
|
| 52 | - * |
|
| 53 | - * @param integer $level initial log level |
|
| 54 | - */ |
|
| 55 | - public function LoggerRoot($level = null) |
|
| 56 | - { |
|
| 57 | - $this->Logger($this->name); |
|
| 58 | - if ($level == null) |
|
| 59 | - $level = LoggerLevel::getLevelAll(); |
|
| 60 | - $this->setLevel($level); |
|
| 61 | - } |
|
| 50 | + /** |
|
| 51 | + * Constructor |
|
| 52 | + * |
|
| 53 | + * @param integer $level initial log level |
|
| 54 | + */ |
|
| 55 | + public function LoggerRoot($level = null) |
|
| 56 | + { |
|
| 57 | + $this->Logger($this->name); |
|
| 58 | + if ($level == null) |
|
| 59 | + $level = LoggerLevel::getLevelAll(); |
|
| 60 | + $this->setLevel($level); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @return integer the level |
|
| 65 | - */ |
|
| 66 | - public function getChainedLevel() |
|
| 67 | - { |
|
| 68 | - return $this->level; |
|
| 69 | - } |
|
| 63 | + /** |
|
| 64 | + * @return integer the level |
|
| 65 | + */ |
|
| 66 | + public function getChainedLevel() |
|
| 67 | + { |
|
| 68 | + return $this->level; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Setting a null value to the level of the root category may have catastrophic results. |
|
| 73 | - * @param LoggerLevel $level |
|
| 74 | - */ |
|
| 75 | - public function setLevel($level) |
|
| 76 | - { |
|
| 77 | - $this->level = $level; |
|
| 78 | - } |
|
| 71 | + /** |
|
| 72 | + * Setting a null value to the level of the root category may have catastrophic results. |
|
| 73 | + * @param LoggerLevel $level |
|
| 74 | + */ |
|
| 75 | + public function setLevel($level) |
|
| 76 | + { |
|
| 77 | + $this->level = $level; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Please use setLevel() instead. |
|
| 82 | - * @param LoggerLevel $level |
|
| 83 | - * @deprecated |
|
| 84 | - */ |
|
| 85 | - public function setPriority($level) |
|
| 86 | - { |
|
| 87 | - $this->setLevel($level); |
|
| 88 | - } |
|
| 80 | + /** |
|
| 81 | + * Please use setLevel() instead. |
|
| 82 | + * @param LoggerLevel $level |
|
| 83 | + * @deprecated |
|
| 84 | + */ |
|
| 85 | + public function setPriority($level) |
|
| 86 | + { |
|
| 87 | + $this->setLevel($level); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Always returns false. |
|
| 92 | - * Because LoggerRoot has no parents, it returns false. |
|
| 93 | - * @param Logger $parent |
|
| 94 | - * @return boolean |
|
| 95 | - */ |
|
| 96 | - public function setParent($parent) |
|
| 97 | - { |
|
| 98 | - return false; |
|
| 99 | - } |
|
| 90 | + /** |
|
| 91 | + * Always returns false. |
|
| 92 | + * Because LoggerRoot has no parents, it returns false. |
|
| 93 | + * @param Logger $parent |
|
| 94 | + * @return boolean |
|
| 95 | + */ |
|
| 96 | + public function setParent($parent) |
|
| 97 | + { |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 100 | 100 | } |
| 101 | 101 | ?> |
| 102 | 102 | \ No newline at end of file |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * @var string name of logger |
| 41 | 41 | */ |
| 42 | - public $name = 'root'; |
|
| 42 | + public $name = 'root'; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @var object must be null for LoggerRoot |
@@ -14,35 +14,35 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class wsdl extends nusoap_base { |
| 16 | 16 | // URL or filename of the root of this WSDL |
| 17 | - public $wsdl; |
|
| 18 | - // define internal arrays of bindings, ports, operations, messages, etc. |
|
| 19 | - public $schemas = array(); |
|
| 20 | - public $currentSchema; |
|
| 21 | - public $message = array(); |
|
| 22 | - public $complexTypes = array(); |
|
| 23 | - public $messages = array(); |
|
| 24 | - public $currentMessage; |
|
| 25 | - public $currentOperation; |
|
| 26 | - public $portTypes = array(); |
|
| 27 | - public $currentPortType; |
|
| 28 | - public $bindings = array(); |
|
| 29 | - public $currentBinding; |
|
| 30 | - public $ports = array(); |
|
| 31 | - public $currentPort; |
|
| 32 | - public $opData = array(); |
|
| 33 | - public $status = ''; |
|
| 34 | - public $documentation = false; |
|
| 35 | - public $endpoint = ''; |
|
| 36 | - // array of wsdl docs to import |
|
| 37 | - public $import = array(); |
|
| 38 | - // parser vars |
|
| 39 | - public $parser; |
|
| 40 | - public $position = 0; |
|
| 41 | - public $depth = 0; |
|
| 42 | - public $depth_array = array(); |
|
| 17 | + public $wsdl; |
|
| 18 | + // define internal arrays of bindings, ports, operations, messages, etc. |
|
| 19 | + public $schemas = array(); |
|
| 20 | + public $currentSchema; |
|
| 21 | + public $message = array(); |
|
| 22 | + public $complexTypes = array(); |
|
| 23 | + public $messages = array(); |
|
| 24 | + public $currentMessage; |
|
| 25 | + public $currentOperation; |
|
| 26 | + public $portTypes = array(); |
|
| 27 | + public $currentPortType; |
|
| 28 | + public $bindings = array(); |
|
| 29 | + public $currentBinding; |
|
| 30 | + public $ports = array(); |
|
| 31 | + public $currentPort; |
|
| 32 | + public $opData = array(); |
|
| 33 | + public $status = ''; |
|
| 34 | + public $documentation = false; |
|
| 35 | + public $endpoint = ''; |
|
| 36 | + // array of wsdl docs to import |
|
| 37 | + public $import = array(); |
|
| 38 | + // parser vars |
|
| 39 | + public $parser; |
|
| 40 | + public $position = 0; |
|
| 41 | + public $depth = 0; |
|
| 42 | + public $depth_array = array(); |
|
| 43 | 43 | // for getting wsdl |
| 44 | 44 | public $proxyhost = ''; |
| 45 | - public $proxyport = ''; |
|
| 45 | + public $proxyport = ''; |
|
| 46 | 46 | public $proxyusername = ''; |
| 47 | 47 | public $proxypassword = ''; |
| 48 | 48 | public $timeout = 0; |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | public $authtype = ''; // Type of HTTP authentication |
| 56 | 56 | public $certRequest = array(); // Certificate for HTTP SSL authentication |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * constructor |
|
| 60 | - * |
|
| 61 | - * @param string $wsdl WSDL document URL |
|
| 58 | + /** |
|
| 59 | + * constructor |
|
| 60 | + * |
|
| 61 | + * @param string $wsdl WSDL document URL |
|
| 62 | 62 | * @param string $proxyhost |
| 63 | 63 | * @param string $proxyport |
| 64 | 64 | * @param string $proxyusername |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param integer $response_timeout set the response timeout |
| 68 | 68 | * @param array $curl_options user-specified cURL options |
| 69 | 69 | * @param boolean $use_curl try to use cURL |
| 70 | - * @access public |
|
| 71 | - */ |
|
| 72 | - public function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
|
| 70 | + * @access public |
|
| 71 | + */ |
|
| 72 | + public function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
|
| 73 | 73 | parent::nusoap_base(); |
| 74 | 74 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
| 75 | - $this->proxyhost = $proxyhost; |
|
| 76 | - $this->proxyport = $proxyport; |
|
| 75 | + $this->proxyhost = $proxyhost; |
|
| 76 | + $this->proxyport = $proxyport; |
|
| 77 | 77 | $this->proxyusername = $proxyusername; |
| 78 | 78 | $this->proxypassword = $proxypassword; |
| 79 | 79 | $this->timeout = $timeout; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->curl_options = $curl_options; |
| 83 | 83 | $this->use_curl = $use_curl; |
| 84 | 84 | $this->fetchWSDL($wsdl); |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * fetches the WSDL document and parses it |
@@ -92,28 +92,28 @@ discard block |
||
| 92 | 92 | public function fetchWSDL($wsdl) { |
| 93 | 93 | $this->debug("parse and process WSDL path=$wsdl"); |
| 94 | 94 | $this->wsdl = $wsdl; |
| 95 | - // parse wsdl file |
|
| 96 | - if ($this->wsdl != "") { |
|
| 97 | - $this->parseWSDL($this->wsdl); |
|
| 98 | - } |
|
| 99 | - $imported_urls = array(); |
|
| 100 | - $imported = 1; |
|
| 101 | - while ($imported > 0) { |
|
| 102 | - $imported = 0; |
|
| 103 | - // Schema imports |
|
| 104 | - foreach ($this->schemas as $ns => $list) { |
|
| 105 | - foreach ($list as $xs) { |
|
| 95 | + // parse wsdl file |
|
| 96 | + if ($this->wsdl != "") { |
|
| 97 | + $this->parseWSDL($this->wsdl); |
|
| 98 | + } |
|
| 99 | + $imported_urls = array(); |
|
| 100 | + $imported = 1; |
|
| 101 | + while ($imported > 0) { |
|
| 102 | + $imported = 0; |
|
| 103 | + // Schema imports |
|
| 104 | + foreach ($this->schemas as $ns => $list) { |
|
| 105 | + foreach ($list as $xs) { |
|
| 106 | 106 | $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
| 107 | - foreach ($xs->imports as $ns2 => $list2) { |
|
| 108 | - for ($ii = 0; $ii < count($list2); $ii++) { |
|
| 109 | - if (! $list2[$ii]['loaded']) { |
|
| 110 | - /* |
|
| 107 | + foreach ($xs->imports as $ns2 => $list2) { |
|
| 108 | + for ($ii = 0; $ii < count($list2); $ii++) { |
|
| 109 | + if (! $list2[$ii]['loaded']) { |
|
| 110 | + /* |
|
| 111 | 111 | * Substituted with line below |
| 112 | 112 | * because of error "Warning: attempt to modify property of non-object" |
| 113 | 113 | * GitHub issue #1 |
| 114 | 114 | */ |
| 115 | - $list2[$ii]['loaded'] = true; |
|
| 116 | - $url = $list2[$ii]['location']; |
|
| 115 | + $list2[$ii]['loaded'] = true; |
|
| 116 | + $url = $list2[$ii]['location']; |
|
| 117 | 117 | if ($url != '') { |
| 118 | 118 | $urlparts = parse_url($url); |
| 119 | 119 | if (!isset($urlparts['host'])) { |
@@ -121,25 +121,25 @@ discard block |
||
| 121 | 121 | substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
| 122 | 122 | } |
| 123 | 123 | if (! in_array($url, $imported_urls)) { |
| 124 | - $this->parseWSDL($url); |
|
| 125 | - $imported++; |
|
| 126 | - $imported_urls[] = $url; |
|
| 127 | - } |
|
| 124 | + $this->parseWSDL($url); |
|
| 125 | + $imported++; |
|
| 126 | + $imported_urls[] = $url; |
|
| 127 | + } |
|
| 128 | 128 | } else { |
| 129 | 129 | $this->debug("Unexpected scenario: empty URL for unloaded import"); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - } |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - // WSDL imports |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + // WSDL imports |
|
| 137 | 137 | $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
| 138 | - foreach ($this->import as $ns => $list) { |
|
| 139 | - for ($ii = 0; $ii < count($list); $ii++) { |
|
| 140 | - if (! $list[$ii]['loaded']) { |
|
| 141 | - $this->import[$ns][$ii]['loaded'] = true; |
|
| 142 | - $url = $list[$ii]['location']; |
|
| 138 | + foreach ($this->import as $ns => $list) { |
|
| 139 | + for ($ii = 0; $ii < count($list); $ii++) { |
|
| 140 | + if (! $list[$ii]['loaded']) { |
|
| 141 | + $this->import[$ns][$ii]['loaded'] = true; |
|
| 142 | + $url = $list[$ii]['location']; |
|
| 143 | 143 | if ($url != '') { |
| 144 | 144 | $urlparts = parse_url($url); |
| 145 | 145 | if (!isset($urlparts['host'])) { |
@@ -147,70 +147,70 @@ discard block |
||
| 147 | 147 | substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
| 148 | 148 | } |
| 149 | 149 | if (! in_array($url, $imported_urls)) { |
| 150 | - $this->parseWSDL($url); |
|
| 151 | - $imported++; |
|
| 152 | - $imported_urls[] = $url; |
|
| 153 | - } |
|
| 150 | + $this->parseWSDL($url); |
|
| 151 | + $imported++; |
|
| 152 | + $imported_urls[] = $url; |
|
| 153 | + } |
|
| 154 | 154 | } else { |
| 155 | 155 | $this->debug("Unexpected scenario: empty URL for unloaded import"); |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | } |
| 161 | - // add new data to operation data |
|
| 162 | - foreach($this->bindings as $binding => $bindingData) { |
|
| 163 | - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
|
| 164 | - foreach($bindingData['operations'] as $operation => $data) { |
|
| 165 | - $this->debug('post-parse data gathering for ' . $operation); |
|
| 166 | - $this->bindings[$binding]['operations'][$operation]['input'] = |
|
| 161 | + // add new data to operation data |
|
| 162 | + foreach($this->bindings as $binding => $bindingData) { |
|
| 163 | + if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
|
| 164 | + foreach($bindingData['operations'] as $operation => $data) { |
|
| 165 | + $this->debug('post-parse data gathering for ' . $operation); |
|
| 166 | + $this->bindings[$binding]['operations'][$operation]['input'] = |
|
| 167 | 167 | isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
| 168 | 168 | array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
| 169 | 169 | $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
| 170 | - $this->bindings[$binding]['operations'][$operation]['output'] = |
|
| 170 | + $this->bindings[$binding]['operations'][$operation]['output'] = |
|
| 171 | 171 | isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
| 172 | 172 | array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
| 173 | 173 | $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
| 174 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
|
| 174 | + if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
|
| 175 | 175 | $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
| 176 | 176 | } |
| 177 | 177 | if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
| 178 | - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
| 179 | - } |
|
| 180 | - // Set operation style if necessary, but do not override one already provided |
|
| 178 | + $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
| 179 | + } |
|
| 180 | + // Set operation style if necessary, but do not override one already provided |
|
| 181 | 181 | if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
| 182 | - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
|
| 183 | - } |
|
| 184 | - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
|
| 185 | - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; |
|
| 186 | - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - } |
|
| 182 | + $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
|
| 183 | + } |
|
| 184 | + $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
|
| 185 | + $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; |
|
| 186 | + $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * parses the wsdl document |
|
| 194 | - * |
|
| 195 | - * @param string $wsdl path or URL |
|
| 196 | - * @access private |
|
| 197 | - */ |
|
| 198 | - public function parseWSDL($wsdl = '') { |
|
| 192 | + /** |
|
| 193 | + * parses the wsdl document |
|
| 194 | + * |
|
| 195 | + * @param string $wsdl path or URL |
|
| 196 | + * @access private |
|
| 197 | + */ |
|
| 198 | + public function parseWSDL($wsdl = '') { |
|
| 199 | 199 | $this->debug("parse WSDL at path=$wsdl"); |
| 200 | 200 | |
| 201 | - if ($wsdl == '') { |
|
| 202 | - $this->debug('no wsdl passed to parseWSDL()!!'); |
|
| 203 | - $this->setError('no wsdl passed to parseWSDL()!!'); |
|
| 204 | - return false; |
|
| 205 | - } |
|
| 201 | + if ($wsdl == '') { |
|
| 202 | + $this->debug('no wsdl passed to parseWSDL()!!'); |
|
| 203 | + $this->setError('no wsdl passed to parseWSDL()!!'); |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - // parse $wsdl for url format |
|
| 208 | - $wsdl_props = parse_url($wsdl); |
|
| 207 | + // parse $wsdl for url format |
|
| 208 | + $wsdl_props = parse_url($wsdl); |
|
| 209 | 209 | |
| 210 | - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { |
|
| 211 | - $this->debug('getting WSDL http(s) URL ' . $wsdl); |
|
| 212 | - // get wsdl |
|
| 213 | - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
|
| 210 | + if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { |
|
| 211 | + $this->debug('getting WSDL http(s) URL ' . $wsdl); |
|
| 212 | + // get wsdl |
|
| 213 | + $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
|
| 214 | 214 | $tr->request_method = 'GET'; |
| 215 | 215 | $tr->useSOAPAction = false; |
| 216 | 216 | if($this->proxyhost && $this->proxyport){ |
@@ -226,239 +226,239 @@ discard block |
||
| 226 | 226 | if($err = $tr->getError() ){ |
| 227 | 227 | $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
| 228 | 228 | $this->debug($errstr); |
| 229 | - $this->setError($errstr); |
|
| 229 | + $this->setError($errstr); |
|
| 230 | 230 | unset($tr); |
| 231 | - return false; |
|
| 231 | + return false; |
|
| 232 | 232 | } |
| 233 | 233 | unset($tr); |
| 234 | 234 | $this->debug("got WSDL URL"); |
| 235 | - } else { |
|
| 236 | - // $wsdl is not http(s), so treat it as a file URL or plain file path |
|
| 237 | - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
|
| 238 | - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
| 239 | - } else { |
|
| 240 | - $path = $wsdl; |
|
| 241 | - } |
|
| 242 | - $this->debug('getting WSDL file ' . $path); |
|
| 243 | - if ($fp = @fopen($path, 'r')) { |
|
| 244 | - $wsdl_string = ''; |
|
| 245 | - while ($data = fread($fp, 32768)) { |
|
| 246 | - $wsdl_string .= $data; |
|
| 247 | - } |
|
| 248 | - fclose($fp); |
|
| 249 | - } else { |
|
| 250 | - $errstr = "Bad path to WSDL file $path"; |
|
| 251 | - $this->debug($errstr); |
|
| 252 | - $this->setError($errstr); |
|
| 253 | - return false; |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - $this->debug('Parse WSDL'); |
|
| 257 | - // end new code added |
|
| 258 | - // Create an XML parser. |
|
| 259 | - $this->parser = xml_parser_create(); |
|
| 260 | - // Set the options for parsing the XML data. |
|
| 261 | - // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); |
|
| 262 | - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); |
|
| 263 | - // Set the object for the parser. |
|
| 264 | - xml_set_object($this->parser, $this); |
|
| 265 | - // Set the element handlers for the parser. |
|
| 266 | - xml_set_element_handler($this->parser, 'start_element', 'end_element'); |
|
| 267 | - xml_set_character_data_handler($this->parser, 'character_data'); |
|
| 268 | - // Parse the XML file. |
|
| 269 | - if (!xml_parse($this->parser, $wsdl_string, true)) { |
|
| 270 | - // Display an error message. |
|
| 271 | - $errstr = sprintf( |
|
| 235 | + } else { |
|
| 236 | + // $wsdl is not http(s), so treat it as a file URL or plain file path |
|
| 237 | + if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
|
| 238 | + $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
| 239 | + } else { |
|
| 240 | + $path = $wsdl; |
|
| 241 | + } |
|
| 242 | + $this->debug('getting WSDL file ' . $path); |
|
| 243 | + if ($fp = @fopen($path, 'r')) { |
|
| 244 | + $wsdl_string = ''; |
|
| 245 | + while ($data = fread($fp, 32768)) { |
|
| 246 | + $wsdl_string .= $data; |
|
| 247 | + } |
|
| 248 | + fclose($fp); |
|
| 249 | + } else { |
|
| 250 | + $errstr = "Bad path to WSDL file $path"; |
|
| 251 | + $this->debug($errstr); |
|
| 252 | + $this->setError($errstr); |
|
| 253 | + return false; |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + $this->debug('Parse WSDL'); |
|
| 257 | + // end new code added |
|
| 258 | + // Create an XML parser. |
|
| 259 | + $this->parser = xml_parser_create(); |
|
| 260 | + // Set the options for parsing the XML data. |
|
| 261 | + // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); |
|
| 262 | + xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); |
|
| 263 | + // Set the object for the parser. |
|
| 264 | + xml_set_object($this->parser, $this); |
|
| 265 | + // Set the element handlers for the parser. |
|
| 266 | + xml_set_element_handler($this->parser, 'start_element', 'end_element'); |
|
| 267 | + xml_set_character_data_handler($this->parser, 'character_data'); |
|
| 268 | + // Parse the XML file. |
|
| 269 | + if (!xml_parse($this->parser, $wsdl_string, true)) { |
|
| 270 | + // Display an error message. |
|
| 271 | + $errstr = sprintf( |
|
| 272 | 272 | 'XML error parsing WSDL from %s on line %d: %s', |
| 273 | 273 | $wsdl, |
| 274 | - xml_get_current_line_number($this->parser), |
|
| 275 | - xml_error_string(xml_get_error_code($this->parser)) |
|
| 276 | - ); |
|
| 277 | - $this->debug($errstr); |
|
| 274 | + xml_get_current_line_number($this->parser), |
|
| 275 | + xml_error_string(xml_get_error_code($this->parser)) |
|
| 276 | + ); |
|
| 277 | + $this->debug($errstr); |
|
| 278 | 278 | $this->debug("XML payload:\n" . $wsdl_string); |
| 279 | - $this->setError($errstr); |
|
| 280 | - return false; |
|
| 281 | - } |
|
| 279 | + $this->setError($errstr); |
|
| 280 | + return false; |
|
| 281 | + } |
|
| 282 | 282 | // free the parser |
| 283 | - xml_parser_free($this->parser); |
|
| 284 | - $this->debug('Parsing WSDL done'); |
|
| 283 | + xml_parser_free($this->parser); |
|
| 284 | + $this->debug('Parsing WSDL done'); |
|
| 285 | 285 | // catch wsdl parse errors |
| 286 | 286 | if($this->getError()){ |
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | - return true; |
|
| 290 | - } |
|
| 289 | + return true; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * start-element handler |
|
| 294 | - * |
|
| 295 | - * @param string $parser XML parser object |
|
| 296 | - * @param string $name element name |
|
| 297 | - * @param string $attrs associative array of attributes |
|
| 298 | - * @access private |
|
| 299 | - */ |
|
| 300 | - public function start_element($parser, $name, $attrs) |
|
| 301 | - { |
|
| 302 | - if ($this->status == 'schema') { |
|
| 303 | - $this->currentSchema->schemaStartElement($parser, $name, $attrs); |
|
| 304 | - $this->appendDebug($this->currentSchema->getDebug()); |
|
| 305 | - $this->currentSchema->clearDebug(); |
|
| 306 | - } elseif (preg_match('/schema$/', $name)) { |
|
| 307 | - $this->debug('Parsing WSDL schema'); |
|
| 308 | - $this->status = 'schema'; |
|
| 309 | - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); |
|
| 310 | - $this->currentSchema->schemaStartElement($parser, $name, $attrs); |
|
| 311 | - $this->appendDebug($this->currentSchema->getDebug()); |
|
| 312 | - $this->currentSchema->clearDebug(); |
|
| 313 | - } else { |
|
| 314 | - // position in the total number of elements, starting from 0 |
|
| 315 | - $pos = $this->position++; |
|
| 316 | - $depth = $this->depth++; |
|
| 317 | - // set self as current value for this depth |
|
| 318 | - $this->depth_array[$depth] = $pos; |
|
| 319 | - $this->message[$pos] = array('cdata' => ''); |
|
| 320 | - // process attributes |
|
| 321 | - if (count($attrs) > 0) { |
|
| 292 | + /** |
|
| 293 | + * start-element handler |
|
| 294 | + * |
|
| 295 | + * @param string $parser XML parser object |
|
| 296 | + * @param string $name element name |
|
| 297 | + * @param string $attrs associative array of attributes |
|
| 298 | + * @access private |
|
| 299 | + */ |
|
| 300 | + public function start_element($parser, $name, $attrs) |
|
| 301 | + { |
|
| 302 | + if ($this->status == 'schema') { |
|
| 303 | + $this->currentSchema->schemaStartElement($parser, $name, $attrs); |
|
| 304 | + $this->appendDebug($this->currentSchema->getDebug()); |
|
| 305 | + $this->currentSchema->clearDebug(); |
|
| 306 | + } elseif (preg_match('/schema$/', $name)) { |
|
| 307 | + $this->debug('Parsing WSDL schema'); |
|
| 308 | + $this->status = 'schema'; |
|
| 309 | + $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); |
|
| 310 | + $this->currentSchema->schemaStartElement($parser, $name, $attrs); |
|
| 311 | + $this->appendDebug($this->currentSchema->getDebug()); |
|
| 312 | + $this->currentSchema->clearDebug(); |
|
| 313 | + } else { |
|
| 314 | + // position in the total number of elements, starting from 0 |
|
| 315 | + $pos = $this->position++; |
|
| 316 | + $depth = $this->depth++; |
|
| 317 | + // set self as current value for this depth |
|
| 318 | + $this->depth_array[$depth] = $pos; |
|
| 319 | + $this->message[$pos] = array('cdata' => ''); |
|
| 320 | + // process attributes |
|
| 321 | + if (count($attrs) > 0) { |
|
| 322 | 322 | // register namespace declarations |
| 323 | - foreach($attrs as $k => $v) { |
|
| 324 | - if (preg_match('/^xmlns/',$k)) { |
|
| 325 | - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
|
| 326 | - $this->namespaces[$ns_prefix] = $v; |
|
| 327 | - } else { |
|
| 328 | - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; |
|
| 329 | - } |
|
| 330 | - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { |
|
| 331 | - $this->XMLSchemaVersion = $v; |
|
| 332 | - $this->namespaces['xsi'] = $v . '-instance'; |
|
| 333 | - } |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - // expand each attribute prefix to its namespace |
|
| 337 | - foreach($attrs as $k => $v) { |
|
| 338 | - $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
| 339 | - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { |
|
| 340 | - $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
| 341 | - } |
|
| 342 | - $eAttrs[$k] = $v; |
|
| 343 | - } |
|
| 344 | - $attrs = $eAttrs; |
|
| 345 | - } else { |
|
| 346 | - $attrs = array(); |
|
| 347 | - } |
|
| 348 | - // get element prefix, namespace and name |
|
| 349 | - if (preg_match('/:/', $name)) { |
|
| 350 | - // get ns prefix |
|
| 351 | - $prefix = substr($name, 0, strpos($name, ':')); |
|
| 352 | - // get ns |
|
| 353 | - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; |
|
| 354 | - // get unqualified name |
|
| 355 | - $name = substr(strstr($name, ':'), 1); |
|
| 356 | - } |
|
| 323 | + foreach($attrs as $k => $v) { |
|
| 324 | + if (preg_match('/^xmlns/',$k)) { |
|
| 325 | + if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
|
| 326 | + $this->namespaces[$ns_prefix] = $v; |
|
| 327 | + } else { |
|
| 328 | + $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; |
|
| 329 | + } |
|
| 330 | + if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { |
|
| 331 | + $this->XMLSchemaVersion = $v; |
|
| 332 | + $this->namespaces['xsi'] = $v . '-instance'; |
|
| 333 | + } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + // expand each attribute prefix to its namespace |
|
| 337 | + foreach($attrs as $k => $v) { |
|
| 338 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
| 339 | + if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { |
|
| 340 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
| 341 | + } |
|
| 342 | + $eAttrs[$k] = $v; |
|
| 343 | + } |
|
| 344 | + $attrs = $eAttrs; |
|
| 345 | + } else { |
|
| 346 | + $attrs = array(); |
|
| 347 | + } |
|
| 348 | + // get element prefix, namespace and name |
|
| 349 | + if (preg_match('/:/', $name)) { |
|
| 350 | + // get ns prefix |
|
| 351 | + $prefix = substr($name, 0, strpos($name, ':')); |
|
| 352 | + // get ns |
|
| 353 | + $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; |
|
| 354 | + // get unqualified name |
|
| 355 | + $name = substr(strstr($name, ':'), 1); |
|
| 356 | + } |
|
| 357 | 357 | // process attributes, expanding any prefixes to namespaces |
| 358 | - // find status, register data |
|
| 359 | - switch ($this->status) { |
|
| 360 | - case 'message': |
|
| 361 | - if ($name == 'part') { |
|
| 362 | - if (isset($attrs['type'])) { |
|
| 363 | - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
| 364 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
|
| 365 | - } |
|
| 366 | - if (isset($attrs['element'])) { |
|
| 367 | - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
| 368 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
| 369 | - } |
|
| 370 | - } |
|
| 371 | - break; |
|
| 372 | - case 'portType': |
|
| 373 | - switch ($name) { |
|
| 374 | - case 'operation': |
|
| 375 | - $this->currentPortOperation = $attrs['name']; |
|
| 376 | - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); |
|
| 377 | - if (isset($attrs['parameterOrder'])) { |
|
| 378 | - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; |
|
| 379 | - } |
|
| 380 | - break; |
|
| 381 | - case 'documentation': |
|
| 382 | - $this->documentation = true; |
|
| 383 | - break; |
|
| 384 | - // merge input/output data |
|
| 385 | - default: |
|
| 386 | - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; |
|
| 387 | - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; |
|
| 388 | - break; |
|
| 358 | + // find status, register data |
|
| 359 | + switch ($this->status) { |
|
| 360 | + case 'message': |
|
| 361 | + if ($name == 'part') { |
|
| 362 | + if (isset($attrs['type'])) { |
|
| 363 | + $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
| 364 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
|
| 365 | + } |
|
| 366 | + if (isset($attrs['element'])) { |
|
| 367 | + $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
| 368 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
| 369 | + } |
|
| 389 | 370 | } |
| 390 | - break; |
|
| 371 | + break; |
|
| 372 | + case 'portType': |
|
| 373 | + switch ($name) { |
|
| 374 | + case 'operation': |
|
| 375 | + $this->currentPortOperation = $attrs['name']; |
|
| 376 | + $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); |
|
| 377 | + if (isset($attrs['parameterOrder'])) { |
|
| 378 | + $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; |
|
| 379 | + } |
|
| 380 | + break; |
|
| 381 | + case 'documentation': |
|
| 382 | + $this->documentation = true; |
|
| 383 | + break; |
|
| 384 | + // merge input/output data |
|
| 385 | + default: |
|
| 386 | + $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; |
|
| 387 | + $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; |
|
| 388 | + break; |
|
| 389 | + } |
|
| 390 | + break; |
|
| 391 | 391 | case 'binding': |
| 392 | - switch ($name) { |
|
| 393 | - case 'binding': |
|
| 394 | - // get ns prefix |
|
| 395 | - if (isset($attrs['style'])) { |
|
| 396 | - $this->bindings[$this->currentBinding]['prefix'] = $prefix; |
|
| 397 | - } |
|
| 398 | - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); |
|
| 399 | - break; |
|
| 392 | + switch ($name) { |
|
| 393 | + case 'binding': |
|
| 394 | + // get ns prefix |
|
| 395 | + if (isset($attrs['style'])) { |
|
| 396 | + $this->bindings[$this->currentBinding]['prefix'] = $prefix; |
|
| 397 | + } |
|
| 398 | + $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); |
|
| 399 | + break; |
|
| 400 | 400 | case 'header': |
| 401 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; |
|
| 402 | - break; |
|
| 401 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; |
|
| 402 | + break; |
|
| 403 | 403 | case 'operation': |
| 404 | - if (isset($attrs['soapAction'])) { |
|
| 405 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; |
|
| 406 | - } |
|
| 407 | - if (isset($attrs['style'])) { |
|
| 408 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; |
|
| 409 | - } |
|
| 410 | - if (isset($attrs['name'])) { |
|
| 411 | - $this->currentOperation = $attrs['name']; |
|
| 412 | - $this->debug("current binding operation: $this->currentOperation"); |
|
| 413 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; |
|
| 414 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; |
|
| 415 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; |
|
| 416 | - } |
|
| 417 | - break; |
|
| 404 | + if (isset($attrs['soapAction'])) { |
|
| 405 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; |
|
| 406 | + } |
|
| 407 | + if (isset($attrs['style'])) { |
|
| 408 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; |
|
| 409 | + } |
|
| 410 | + if (isset($attrs['name'])) { |
|
| 411 | + $this->currentOperation = $attrs['name']; |
|
| 412 | + $this->debug("current binding operation: $this->currentOperation"); |
|
| 413 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; |
|
| 414 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; |
|
| 415 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; |
|
| 416 | + } |
|
| 417 | + break; |
|
| 418 | 418 | case 'input': |
| 419 | - $this->opStatus = 'input'; |
|
| 420 | - break; |
|
| 419 | + $this->opStatus = 'input'; |
|
| 420 | + break; |
|
| 421 | 421 | case 'output': |
| 422 | - $this->opStatus = 'output'; |
|
| 423 | - break; |
|
| 422 | + $this->opStatus = 'output'; |
|
| 423 | + break; |
|
| 424 | 424 | case 'body': |
| 425 | - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { |
|
| 426 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); |
|
| 427 | - } else { |
|
| 428 | - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; |
|
| 429 | - } |
|
| 430 | - break; |
|
| 425 | + if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { |
|
| 426 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); |
|
| 427 | + } else { |
|
| 428 | + $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; |
|
| 429 | + } |
|
| 430 | + break; |
|
| 431 | 431 | } |
| 432 | 432 | break; |
| 433 | 433 | case 'service': |
| 434 | 434 | switch ($name) { |
| 435 | - case 'port': |
|
| 436 | - $this->currentPort = $attrs['name']; |
|
| 437 | - $this->debug('current port: ' . $this->currentPort); |
|
| 438 | - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
|
| 435 | + case 'port': |
|
| 436 | + $this->currentPort = $attrs['name']; |
|
| 437 | + $this->debug('current port: ' . $this->currentPort); |
|
| 438 | + $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
|
| 439 | 439 | |
| 440 | - break; |
|
| 441 | - case 'address': |
|
| 442 | - $this->ports[$this->currentPort]['location'] = $attrs['location']; |
|
| 443 | - $this->ports[$this->currentPort]['bindingType'] = $namespace; |
|
| 444 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
| 445 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
| 446 | - break; |
|
| 440 | + break; |
|
| 441 | + case 'address': |
|
| 442 | + $this->ports[$this->currentPort]['location'] = $attrs['location']; |
|
| 443 | + $this->ports[$this->currentPort]['bindingType'] = $namespace; |
|
| 444 | + $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
| 445 | + $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
| 446 | + break; |
|
| 447 | 447 | } |
| 448 | 448 | break; |
| 449 | 449 | } |
| 450 | 450 | // set status |
| 451 | 451 | switch ($name) { |
| 452 | 452 | case 'import': |
| 453 | - if (isset($attrs['location'])) { |
|
| 454 | - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
|
| 455 | - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
|
| 453 | + if (isset($attrs['location'])) { |
|
| 454 | + $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
|
| 455 | + $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
|
| 456 | 456 | } else { |
| 457 | - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
|
| 457 | + $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
|
| 458 | 458 | if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
| 459 | 459 | $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
| 460 | 460 | } |
| 461 | - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
|
| 461 | + $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
|
| 462 | 462 | } |
| 463 | 463 | break; |
| 464 | 464 | //wait for schema |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | if (isset($attrs['name'])) { |
| 480 | 480 | // get binding name |
| 481 | 481 | if (strpos($attrs['name'], ':')) { |
| 482 | - $this->currentBinding = $this->getLocalPart($attrs['name']); |
|
| 482 | + $this->currentBinding = $this->getLocalPart($attrs['name']); |
|
| 483 | 483 | } else { |
| 484 | - $this->currentBinding = $attrs['name']; |
|
| 484 | + $this->currentBinding = $attrs['name']; |
|
| 485 | 485 | } |
| 486 | 486 | $this->status = 'binding'; |
| 487 | 487 | $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); |
@@ -503,20 +503,20 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
| 506 | - * end-element handler |
|
| 507 | - * |
|
| 508 | - * @param string $parser XML parser object |
|
| 509 | - * @param string $name element name |
|
| 510 | - * @access private |
|
| 511 | - */ |
|
| 506 | + * end-element handler |
|
| 507 | + * |
|
| 508 | + * @param string $parser XML parser object |
|
| 509 | + * @param string $name element name |
|
| 510 | + * @access private |
|
| 511 | + */ |
|
| 512 | 512 | public function end_element($parser, $name){ |
| 513 | 513 | // unset schema status |
| 514 | 514 | if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
| 515 | 515 | $this->status = ""; |
| 516 | - $this->appendDebug($this->currentSchema->getDebug()); |
|
| 517 | - $this->currentSchema->clearDebug(); |
|
| 516 | + $this->appendDebug($this->currentSchema->getDebug()); |
|
| 517 | + $this->currentSchema->clearDebug(); |
|
| 518 | 518 | $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; |
| 519 | - $this->debug('Parsing WSDL schema done'); |
|
| 519 | + $this->debug('Parsing WSDL schema done'); |
|
| 520 | 520 | } |
| 521 | 521 | if ($this->status == 'schema') { |
| 522 | 522 | $this->currentSchema->schemaEndElement($parser, $name); |
@@ -549,14 +549,14 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
| 552 | - * if authenticating, set user credentials here |
|
| 553 | - * |
|
| 554 | - * @param string $username |
|
| 555 | - * @param string $password |
|
| 556 | - * @param string $authtype (basic|digest|certificate|ntlm) |
|
| 557 | - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) |
|
| 558 | - * @access public |
|
| 559 | - */ |
|
| 552 | + * if authenticating, set user credentials here |
|
| 553 | + * |
|
| 554 | + * @param string $username |
|
| 555 | + * @param string $password |
|
| 556 | + * @param string $authtype (basic|digest|certificate|ntlm) |
|
| 557 | + * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) |
|
| 558 | + * @access public |
|
| 559 | + */ |
|
| 560 | 560 | public function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { |
| 561 | 561 | $this->debug("setCredentials username=$username authtype=$authtype certRequest="); |
| 562 | 562 | $this->appendDebug($this->varDump($certRequest)); |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | // note that we could/should also check the namespace here |
| 637 | 637 | if ($operation == $bOperation) { |
| 638 | 638 | $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
| 639 | - return $opData; |
|
| 639 | + return $opData; |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | // loop through operations for the binding |
| 665 | 665 | foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
| 666 | 666 | if ($opData['soapAction'] == $soapAction) { |
| 667 | - return $opData; |
|
| 667 | + return $opData; |
|
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | 670 | } |
@@ -672,23 +672,23 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | /** |
| 675 | - * returns an array of information about a given type |
|
| 676 | - * returns false if no type exists by the given name |
|
| 677 | - * |
|
| 678 | - * typeDef = array( |
|
| 679 | - * 'elements' => array(), // refs to elements array |
|
| 680 | - * 'restrictionBase' => '', |
|
| 681 | - * 'phpType' => '', |
|
| 682 | - * 'order' => '(sequence|all)', |
|
| 683 | - * 'attrs' => array() // refs to attributes array |
|
| 684 | - * ) |
|
| 685 | - * |
|
| 686 | - * @param string $type the type |
|
| 687 | - * @param string $ns namespace (not prefix) of the type |
|
| 688 | - * @return mixed |
|
| 689 | - * @access public |
|
| 690 | - * @see nusoap_xmlschema |
|
| 691 | - */ |
|
| 675 | + * returns an array of information about a given type |
|
| 676 | + * returns false if no type exists by the given name |
|
| 677 | + * |
|
| 678 | + * typeDef = array( |
|
| 679 | + * 'elements' => array(), // refs to elements array |
|
| 680 | + * 'restrictionBase' => '', |
|
| 681 | + * 'phpType' => '', |
|
| 682 | + * 'order' => '(sequence|all)', |
|
| 683 | + * 'attrs' => array() // refs to attributes array |
|
| 684 | + * ) |
|
| 685 | + * |
|
| 686 | + * @param string $type the type |
|
| 687 | + * @param string $ns namespace (not prefix) of the type |
|
| 688 | + * @return mixed |
|
| 689 | + * @access public |
|
| 690 | + * @see nusoap_xmlschema |
|
| 691 | + */ |
|
| 692 | 692 | public function getTypeDef($type, $ns) { |
| 693 | 693 | $this->debug("in getTypeDef: type=$type, ns=$ns"); |
| 694 | 694 | if ((! $ns) && isset($this->namespaces['tns'])) { |
@@ -744,13 +744,13 @@ discard block |
||
| 744 | 744 | return false; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - /** |
|
| 748 | - * prints html description of services |
|
| 749 | - * |
|
| 750 | - * @access private |
|
| 751 | - */ |
|
| 752 | - public function webDescription(){ |
|
| 753 | - global $HTTP_SERVER_VARS; |
|
| 747 | + /** |
|
| 748 | + * prints html description of services |
|
| 749 | + * |
|
| 750 | + * @access private |
|
| 751 | + */ |
|
| 752 | + public function webDescription(){ |
|
| 753 | + global $HTTP_SERVER_VARS; |
|
| 754 | 754 | |
| 755 | 755 | if (isset($_SERVER)) { |
| 756 | 756 | $PHP_SELF = $_SERVER['PHP_SELF']; |
@@ -844,29 +844,29 @@ discard block |
||
| 844 | 844 | Click on an operation name to view it's details.</p> |
| 845 | 845 | <ul>'; |
| 846 | 846 | foreach($this->getOperations() as $op => $data){ |
| 847 | - $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
|
| 848 | - // create hidden div |
|
| 849 | - $b .= "<div id='$op' class='hidden'> |
|
| 847 | + $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
|
| 848 | + // create hidden div |
|
| 849 | + $b .= "<div id='$op' class='hidden'> |
|
| 850 | 850 | <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>"; |
| 851 | - foreach($data as $donnie => $marie){ // loop through opdata |
|
| 851 | + foreach($data as $donnie => $marie){ // loop through opdata |
|
| 852 | 852 | if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
| 853 | - $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
|
| 854 | - foreach($marie as $captain => $tenille){ // loop through data |
|
| 853 | + $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
|
| 854 | + foreach($marie as $captain => $tenille){ // loop through data |
|
| 855 | 855 | if($captain == 'parts'){ // loop thru parts |
| 856 | - $b .= " $captain:<br>"; |
|
| 857 | - //if(is_array($tenille)){ |
|
| 858 | - foreach($tenille as $joanie => $chachi){ |
|
| 856 | + $b .= " $captain:<br>"; |
|
| 857 | + //if(is_array($tenille)){ |
|
| 858 | + foreach($tenille as $joanie => $chachi){ |
|
| 859 | 859 | $b .= " $joanie: $chachi<br>"; |
| 860 | - } |
|
| 861 | - //} |
|
| 860 | + } |
|
| 861 | + //} |
|
| 862 | 862 | } else { |
| 863 | - $b .= " $captain: $tenille<br>"; |
|
| 863 | + $b .= " $captain: $tenille<br>"; |
|
| 864 | 864 | } |
| 865 | - } |
|
| 865 | + } |
|
| 866 | 866 | } else { |
| 867 | - $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>"; |
|
| 867 | + $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>"; |
|
| 868 | 868 | } |
| 869 | - } |
|
| 869 | + } |
|
| 870 | 870 | $b .= '</div>'; |
| 871 | 871 | } |
| 872 | 872 | $b .= ' |
@@ -874,15 +874,15 @@ discard block |
||
| 874 | 874 | </div> |
| 875 | 875 | </div></body></html>'; |
| 876 | 876 | return $b; |
| 877 | - } |
|
| 877 | + } |
|
| 878 | 878 | |
| 879 | 879 | /** |
| 880 | - * serialize the parsed wsdl |
|
| 881 | - * |
|
| 882 | - * @param mixed $debug whether to put debug=1 in endpoint URL |
|
| 883 | - * @return string serialization of WSDL |
|
| 884 | - * @access public |
|
| 885 | - */ |
|
| 880 | + * serialize the parsed wsdl |
|
| 881 | + * |
|
| 882 | + * @param mixed $debug whether to put debug=1 in endpoint URL |
|
| 883 | + * @return string serialization of WSDL |
|
| 884 | + * @access public |
|
| 885 | + */ |
|
| 886 | 886 | public function serialize($debug = 0) |
| 887 | 887 | { |
| 888 | 888 | $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
@@ -928,19 +928,19 @@ discard block |
||
| 928 | 928 | foreach($msgParts as $partName => $partType) { |
| 929 | 929 | // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
| 930 | 930 | if (strpos($partType, ':')) { |
| 931 | - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
|
| 931 | + $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
|
| 932 | 932 | } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { |
| 933 | - // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
|
| 934 | - $typePrefix = 'xsd'; |
|
| 933 | + // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
|
| 934 | + $typePrefix = 'xsd'; |
|
| 935 | 935 | } else { |
| 936 | - foreach($this->typemap as $ns => $types) { |
|
| 937 | - if (isset($types[$partType])) { |
|
| 938 | - $typePrefix = $this->getPrefixFromNamespace($ns); |
|
| 939 | - } |
|
| 940 | - } |
|
| 941 | - if (!isset($typePrefix)) { |
|
| 942 | - die("$partType has no namespace!"); |
|
| 943 | - } |
|
| 936 | + foreach($this->typemap as $ns => $types) { |
|
| 937 | + if (isset($types[$partType])) { |
|
| 938 | + $typePrefix = $this->getPrefixFromNamespace($ns); |
|
| 939 | + } |
|
| 940 | + } |
|
| 941 | + if (!isset($typePrefix)) { |
|
| 942 | + die("$partType has no namespace!"); |
|
| 943 | + } |
|
| 944 | 944 | } |
| 945 | 945 | $ns = $this->getNamespaceFromPrefix($typePrefix); |
| 946 | 946 | $localPart = $this->getLocalPart($partType); |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | $binding_xml .= "\n" . ' </operation>'; |
| 986 | 986 | $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"'; |
| 987 | 987 | if (isset($opParts['parameterOrder'])) { |
| 988 | - $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
| 988 | + $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
| 989 | 989 | } |
| 990 | 990 | $portType_xml .= '>'; |
| 991 | 991 | if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
@@ -1280,34 +1280,34 @@ discard block |
||
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | // if a soapval has been supplied, let its type override the WSDL |
| 1283 | - if (is_object($value) && get_class($value) == 'soapval') { |
|
| 1284 | - if ($value->type_ns) { |
|
| 1285 | - $type = $value->type_ns . ':' . $value->type; |
|
| 1286 | - $forceType = true; |
|
| 1287 | - $this->debug("in serializeType: soapval overrides type to $type"); |
|
| 1288 | - } elseif ($value->type) { |
|
| 1289 | - $type = $value->type; |
|
| 1290 | - $forceType = true; |
|
| 1291 | - $this->debug("in serializeType: soapval overrides type to $type"); |
|
| 1292 | - } else { |
|
| 1293 | - $forceType = false; |
|
| 1294 | - $this->debug("in serializeType: soapval does not override type"); |
|
| 1295 | - } |
|
| 1296 | - $attrs = $value->attributes; |
|
| 1297 | - $value = $value->value; |
|
| 1298 | - $this->debug("in serializeType: soapval overrides value to $value"); |
|
| 1299 | - if ($attrs) { |
|
| 1300 | - if (!is_array($value)) { |
|
| 1301 | - $value['!'] = $value; |
|
| 1302 | - } |
|
| 1303 | - foreach ($attrs as $n => $v) { |
|
| 1304 | - $value['!' . $n] = $v; |
|
| 1305 | - } |
|
| 1306 | - $this->debug("in serializeType: soapval provides attributes"); |
|
| 1307 | - } |
|
| 1308 | - } else { |
|
| 1309 | - $forceType = false; |
|
| 1310 | - } |
|
| 1283 | + if (is_object($value) && get_class($value) == 'soapval') { |
|
| 1284 | + if ($value->type_ns) { |
|
| 1285 | + $type = $value->type_ns . ':' . $value->type; |
|
| 1286 | + $forceType = true; |
|
| 1287 | + $this->debug("in serializeType: soapval overrides type to $type"); |
|
| 1288 | + } elseif ($value->type) { |
|
| 1289 | + $type = $value->type; |
|
| 1290 | + $forceType = true; |
|
| 1291 | + $this->debug("in serializeType: soapval overrides type to $type"); |
|
| 1292 | + } else { |
|
| 1293 | + $forceType = false; |
|
| 1294 | + $this->debug("in serializeType: soapval does not override type"); |
|
| 1295 | + } |
|
| 1296 | + $attrs = $value->attributes; |
|
| 1297 | + $value = $value->value; |
|
| 1298 | + $this->debug("in serializeType: soapval overrides value to $value"); |
|
| 1299 | + if ($attrs) { |
|
| 1300 | + if (!is_array($value)) { |
|
| 1301 | + $value['!'] = $value; |
|
| 1302 | + } |
|
| 1303 | + foreach ($attrs as $n => $v) { |
|
| 1304 | + $value['!' . $n] = $v; |
|
| 1305 | + } |
|
| 1306 | + $this->debug("in serializeType: soapval provides attributes"); |
|
| 1307 | + } |
|
| 1308 | + } else { |
|
| 1309 | + $forceType = false; |
|
| 1310 | + } |
|
| 1311 | 1311 | |
| 1312 | 1312 | $xml = ''; |
| 1313 | 1313 | if (strpos($type, ':')) { |
@@ -1339,8 +1339,8 @@ discard block |
||
| 1339 | 1339 | // JBoss/Axis does this sometimes |
| 1340 | 1340 | return $this->serialize_val($value, $name, false, false, false, false, $use); |
| 1341 | 1341 | } |
| 1342 | - if ($uqType == 'boolean') { |
|
| 1343 | - if ((is_string($value) && $value == 'false') || (! $value)) { |
|
| 1342 | + if ($uqType == 'boolean') { |
|
| 1343 | + if ((is_string($value) && $value == 'false') || (! $value)) { |
|
| 1344 | 1344 | $value = 'false'; |
| 1345 | 1345 | } else { |
| 1346 | 1346 | $value = 'true'; |
@@ -1523,9 +1523,9 @@ discard block |
||
| 1523 | 1523 | $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
| 1524 | 1524 | //if (strpos($typeDef['arrayType'], ':') ) { |
| 1525 | 1525 | if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
| 1526 | - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
|
| 1526 | + $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
|
| 1527 | 1527 | } else { |
| 1528 | - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
|
| 1528 | + $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
|
| 1529 | 1529 | } |
| 1530 | 1530 | } |
| 1531 | 1531 | } else { |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | } |
| 1682 | 1682 | // if user took advantage of a minOccurs=0, then only serialize named parameters |
| 1683 | 1683 | if (isset($optionals) |
| 1684 | - && (!isset($xvalue[$eName])) |
|
| 1684 | + && (!isset($xvalue[$eName])) |
|
| 1685 | 1685 | && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
| 1686 | 1686 | ){ |
| 1687 | 1687 | if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
@@ -1692,9 +1692,9 @@ discard block |
||
| 1692 | 1692 | } else { |
| 1693 | 1693 | // get value |
| 1694 | 1694 | if (isset($xvalue[$eName])) { |
| 1695 | - $v = $xvalue[$eName]; |
|
| 1695 | + $v = $xvalue[$eName]; |
|
| 1696 | 1696 | } else { |
| 1697 | - $v = null; |
|
| 1697 | + $v = null; |
|
| 1698 | 1698 | } |
| 1699 | 1699 | if (isset($attrs['form'])) { |
| 1700 | 1700 | $unqualified = ($attrs['form'] == 'unqualified'); |
@@ -1706,24 +1706,24 @@ discard block |
||
| 1706 | 1706 | foreach ($vv as $k => $v) { |
| 1707 | 1707 | if (isset($attrs['type']) || isset($attrs['ref'])) { |
| 1708 | 1708 | // serialize schema-defined type |
| 1709 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1709 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1710 | 1710 | } else { |
| 1711 | 1711 | // serialize generic type (can this ever really happen?) |
| 1712 | - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
| 1713 | - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
| 1712 | + $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
| 1713 | + $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
| 1714 | 1714 | } |
| 1715 | 1715 | } |
| 1716 | 1716 | } else { |
| 1717 | 1717 | if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { |
| 1718 | 1718 | } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { |
| 1719 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1719 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1720 | 1720 | } elseif (isset($attrs['type']) || isset($attrs['ref'])) { |
| 1721 | 1721 | // serialize schema-defined type |
| 1722 | - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1722 | + $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); |
|
| 1723 | 1723 | } else { |
| 1724 | 1724 | // serialize generic type (can this ever really happen?) |
| 1725 | - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
| 1726 | - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
| 1725 | + $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
|
| 1726 | + $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); |
|
| 1727 | 1727 | } |
| 1728 | 1728 | } |
| 1729 | 1729 | } |
@@ -1735,46 +1735,46 @@ discard block |
||
| 1735 | 1735 | } |
| 1736 | 1736 | |
| 1737 | 1737 | /** |
| 1738 | - * adds an XML Schema complex type to the WSDL types |
|
| 1739 | - * |
|
| 1740 | - * @param string $name |
|
| 1741 | - * @param string $typeClass (complexType|simpleType|attribute) |
|
| 1742 | - * @param string $phpType currently supported are array and struct (php assoc array) |
|
| 1743 | - * @param string $compositor (all|sequence|choice) |
|
| 1744 | - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
| 1745 | - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) |
|
| 1746 | - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) |
|
| 1747 | - * @param string $arrayType as namespace:name (xsd:string) |
|
| 1748 | - * @see nusoap_xmlschema |
|
| 1749 | - * @access public |
|
| 1750 | - */ |
|
| 1738 | + * adds an XML Schema complex type to the WSDL types |
|
| 1739 | + * |
|
| 1740 | + * @param string $name |
|
| 1741 | + * @param string $typeClass (complexType|simpleType|attribute) |
|
| 1742 | + * @param string $phpType currently supported are array and struct (php assoc array) |
|
| 1743 | + * @param string $compositor (all|sequence|choice) |
|
| 1744 | + * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
| 1745 | + * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) |
|
| 1746 | + * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) |
|
| 1747 | + * @param string $arrayType as namespace:name (xsd:string) |
|
| 1748 | + * @see nusoap_xmlschema |
|
| 1749 | + * @access public |
|
| 1750 | + */ |
|
| 1751 | 1751 | public function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
| 1752 | 1752 | if (count($elements) > 0) { |
| 1753 | 1753 | $eElements = array(); |
| 1754 | - foreach($elements as $n => $e){ |
|
| 1755 | - // expand each element |
|
| 1756 | - $ee = array(); |
|
| 1757 | - foreach ($e as $k => $v) { |
|
| 1758 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1759 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1760 | - $ee[$k] = $v; |
|
| 1761 | - } |
|
| 1762 | - $eElements[$n] = $ee; |
|
| 1763 | - } |
|
| 1764 | - $elements = $eElements; |
|
| 1754 | + foreach($elements as $n => $e){ |
|
| 1755 | + // expand each element |
|
| 1756 | + $ee = array(); |
|
| 1757 | + foreach ($e as $k => $v) { |
|
| 1758 | + $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1759 | + $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1760 | + $ee[$k] = $v; |
|
| 1761 | + } |
|
| 1762 | + $eElements[$n] = $ee; |
|
| 1763 | + } |
|
| 1764 | + $elements = $eElements; |
|
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | 1767 | if (count($attrs) > 0) { |
| 1768 | - foreach($attrs as $n => $a){ |
|
| 1769 | - // expand each attribute |
|
| 1770 | - foreach ($a as $k => $v) { |
|
| 1771 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1772 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1773 | - $aa[$k] = $v; |
|
| 1774 | - } |
|
| 1775 | - $eAttrs[$n] = $aa; |
|
| 1776 | - } |
|
| 1777 | - $attrs = $eAttrs; |
|
| 1768 | + foreach($attrs as $n => $a){ |
|
| 1769 | + // expand each attribute |
|
| 1770 | + foreach ($a as $k => $v) { |
|
| 1771 | + $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1772 | + $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1773 | + $aa[$k] = $v; |
|
| 1774 | + } |
|
| 1775 | + $eAttrs[$n] = $aa; |
|
| 1776 | + } |
|
| 1777 | + $attrs = $eAttrs; |
|
| 1778 | 1778 | } |
| 1779 | 1779 | |
| 1780 | 1780 | $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
@@ -1785,16 +1785,16 @@ discard block |
||
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | /** |
| 1788 | - * adds an XML Schema simple type to the WSDL types |
|
| 1789 | - * |
|
| 1790 | - * @param string $name |
|
| 1791 | - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
| 1792 | - * @param string $typeClass (should always be simpleType) |
|
| 1793 | - * @param string $phpType (should always be scalar) |
|
| 1794 | - * @param array $enumeration array of values |
|
| 1795 | - * @see nusoap_xmlschema |
|
| 1796 | - * @access public |
|
| 1797 | - */ |
|
| 1788 | + * adds an XML Schema simple type to the WSDL types |
|
| 1789 | + * |
|
| 1790 | + * @param string $name |
|
| 1791 | + * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) |
|
| 1792 | + * @param string $typeClass (should always be simpleType) |
|
| 1793 | + * @param string $phpType (should always be scalar) |
|
| 1794 | + * @param array $enumeration array of values |
|
| 1795 | + * @see nusoap_xmlschema |
|
| 1796 | + * @access public |
|
| 1797 | + */ |
|
| 1798 | 1798 | public function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
| 1799 | 1799 | $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
| 1800 | 1800 | |
@@ -1803,31 +1803,31 @@ discard block |
||
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 1805 | /** |
| 1806 | - * adds an element to the WSDL types |
|
| 1807 | - * |
|
| 1808 | - * @param array $attrs attributes that must include name and type |
|
| 1809 | - * @see nusoap_xmlschema |
|
| 1810 | - * @access public |
|
| 1811 | - */ |
|
| 1806 | + * adds an element to the WSDL types |
|
| 1807 | + * |
|
| 1808 | + * @param array $attrs attributes that must include name and type |
|
| 1809 | + * @see nusoap_xmlschema |
|
| 1810 | + * @access public |
|
| 1811 | + */ |
|
| 1812 | 1812 | public function addElement($attrs) { |
| 1813 | 1813 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
| 1814 | 1814 | $this->schemas[$typens][0]->addElement($attrs); |
| 1815 | 1815 | } |
| 1816 | 1816 | |
| 1817 | 1817 | /** |
| 1818 | - * register an operation with the server |
|
| 1819 | - * |
|
| 1820 | - * @param string $name operation (method) name |
|
| 1821 | - * @param array $in assoc array of input values: key = param name, value = param type |
|
| 1822 | - * @param array $out assoc array of output values: key = param name, value = param type |
|
| 1823 | - * @param string $namespace optional The namespace for the operation |
|
| 1824 | - * @param string $soapaction optional The soapaction for the operation |
|
| 1825 | - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically |
|
| 1826 | - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) |
|
| 1827 | - * @param string $documentation optional The description to include in the WSDL |
|
| 1828 | - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
| 1829 | - * @access public |
|
| 1830 | - */ |
|
| 1818 | + * register an operation with the server |
|
| 1819 | + * |
|
| 1820 | + * @param string $name operation (method) name |
|
| 1821 | + * @param array $in assoc array of input values: key = param name, value = param type |
|
| 1822 | + * @param array $out assoc array of output values: key = param name, value = param type |
|
| 1823 | + * @param string $namespace optional The namespace for the operation |
|
| 1824 | + * @param string $soapaction optional The soapaction for the operation |
|
| 1825 | + * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically |
|
| 1826 | + * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) |
|
| 1827 | + * @param string $documentation optional The description to include in the WSDL |
|
| 1828 | + * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
|
| 1829 | + * @access public |
|
| 1830 | + */ |
|
| 1831 | 1831 | public function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
| 1832 | 1832 | if ($use == 'encoded' && $encodingStyle == '') { |
| 1833 | 1833 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
@@ -1886,8 +1886,8 @@ discard block |
||
| 1886 | 1886 | $this->messages[$name.'Request'][$pName] = $pType; |
| 1887 | 1887 | } |
| 1888 | 1888 | } else { |
| 1889 | - $this->messages[$name.'Request']= '0'; |
|
| 1890 | - } |
|
| 1889 | + $this->messages[$name.'Request']= '0'; |
|
| 1890 | + } |
|
| 1891 | 1891 | if($out) |
| 1892 | 1892 | { |
| 1893 | 1893 | foreach($out as $pName => $pType) |
@@ -1898,8 +1898,8 @@ discard block |
||
| 1898 | 1898 | $this->messages[$name.'Response'][$pName] = $pType; |
| 1899 | 1899 | } |
| 1900 | 1900 | } else { |
| 1901 | - $this->messages[$name.'Response']= '0'; |
|
| 1902 | - } |
|
| 1901 | + $this->messages[$name.'Response']= '0'; |
|
| 1902 | + } |
|
| 1903 | 1903 | return true; |
| 1904 | 1904 | } |
| 1905 | 1905 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | public $proxypassword = ''; |
| 48 | 48 | public $timeout = 0; |
| 49 | 49 | public $response_timeout = 30; |
| 50 | - public $curl_options = array(); // User-specified cURL options |
|
| 51 | - public $use_curl = false; // whether to always try to use cURL |
|
| 50 | + public $curl_options = array(); // User-specified cURL options |
|
| 51 | + public $use_curl = false; // whether to always try to use cURL |
|
| 52 | 52 | // for HTTP authentication |
| 53 | - public $username = ''; // Username for HTTP authentication |
|
| 54 | - public $password = ''; // Password for HTTP authentication |
|
| 55 | - public $authtype = ''; // Type of HTTP authentication |
|
| 56 | - public $certRequest = array(); // Certificate for HTTP SSL authentication |
|
| 53 | + public $username = ''; // Username for HTTP authentication |
|
| 54 | + public $password = ''; // Password for HTTP authentication |
|
| 55 | + public $authtype = ''; // Type of HTTP authentication |
|
| 56 | + public $certRequest = array(); // Certificate for HTTP SSL authentication |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * constructor |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param boolean $use_curl try to use cURL |
| 70 | 70 | * @access public |
| 71 | 71 | */ |
| 72 | - public function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
|
| 72 | + public function wsdl($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false) { |
|
| 73 | 73 | parent::nusoap_base(); |
| 74 | 74 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
| 75 | 75 | $this->proxyhost = $proxyhost; |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | // Schema imports |
| 104 | 104 | foreach ($this->schemas as $ns => $list) { |
| 105 | 105 | foreach ($list as $xs) { |
| 106 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
| 106 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
| 107 | 107 | foreach ($xs->imports as $ns2 => $list2) { |
| 108 | 108 | for ($ii = 0; $ii < count($list2); $ii++) { |
| 109 | - if (! $list2[$ii]['loaded']) { |
|
| 109 | + if (!$list2[$ii]['loaded']) { |
|
| 110 | 110 | /* |
| 111 | 111 | * Substituted with line below |
| 112 | 112 | * because of error "Warning: attempt to modify property of non-object" |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | if ($url != '') { |
| 118 | 118 | $urlparts = parse_url($url); |
| 119 | 119 | if (!isset($urlparts['host'])) { |
| 120 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . |
|
| 121 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
| 120 | + $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
|
| 121 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path']; |
|
| 122 | 122 | } |
| 123 | - if (! in_array($url, $imported_urls)) { |
|
| 123 | + if (!in_array($url, $imported_urls)) { |
|
| 124 | 124 | $this->parseWSDL($url); |
| 125 | 125 | $imported++; |
| 126 | 126 | $imported_urls[] = $url; |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | // WSDL imports |
| 137 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
| 137 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
| 138 | 138 | foreach ($this->import as $ns => $list) { |
| 139 | 139 | for ($ii = 0; $ii < count($list); $ii++) { |
| 140 | - if (! $list[$ii]['loaded']) { |
|
| 140 | + if (!$list[$ii]['loaded']) { |
|
| 141 | 141 | $this->import[$ns][$ii]['loaded'] = true; |
| 142 | 142 | $url = $list[$ii]['location']; |
| 143 | 143 | if ($url != '') { |
| 144 | 144 | $urlparts = parse_url($url); |
| 145 | 145 | if (!isset($urlparts['host'])) { |
| 146 | 146 | $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
| 147 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
| 147 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path']; |
|
| 148 | 148 | } |
| 149 | - if (! in_array($url, $imported_urls)) { |
|
| 149 | + if (!in_array($url, $imported_urls)) { |
|
| 150 | 150 | $this->parseWSDL($url); |
| 151 | 151 | $imported++; |
| 152 | 152 | $imported_urls[] = $url; |
@@ -159,30 +159,28 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | // add new data to operation data |
| 162 | - foreach($this->bindings as $binding => $bindingData) { |
|
| 162 | + foreach ($this->bindings as $binding => $bindingData) { |
|
| 163 | 163 | if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
| 164 | - foreach($bindingData['operations'] as $operation => $data) { |
|
| 164 | + foreach ($bindingData['operations'] as $operation => $data) { |
|
| 165 | 165 | $this->debug('post-parse data gathering for ' . $operation); |
| 166 | 166 | $this->bindings[$binding]['operations'][$operation]['input'] = |
| 167 | 167 | isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
| 168 | - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
|
| 169 | - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
|
| 168 | + array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input']; |
|
| 170 | 169 | $this->bindings[$binding]['operations'][$operation]['output'] = |
| 171 | 170 | isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
| 172 | - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
|
| 173 | - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
|
| 174 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
|
| 175 | - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
|
| 171 | + array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output']; |
|
| 172 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) { |
|
| 173 | + $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']]; |
|
| 176 | 174 | } |
| 177 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
|
| 178 | - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
| 175 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) { |
|
| 176 | + $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']]; |
|
| 179 | 177 | } |
| 180 | 178 | // Set operation style if necessary, but do not override one already provided |
| 181 | 179 | if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
| 182 | 180 | $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
| 183 | 181 | } |
| 184 | 182 | $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
| 185 | - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; |
|
| 183 | + $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : ''; |
|
| 186 | 184 | $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; |
| 187 | 185 | } |
| 188 | 186 | } |
@@ -213,8 +211,8 @@ discard block |
||
| 213 | 211 | $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
| 214 | 212 | $tr->request_method = 'GET'; |
| 215 | 213 | $tr->useSOAPAction = false; |
| 216 | - if($this->proxyhost && $this->proxyport){ |
|
| 217 | - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
| 214 | + if ($this->proxyhost && $this->proxyport) { |
|
| 215 | + $tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword); |
|
| 218 | 216 | } |
| 219 | 217 | if ($this->authtype != '') { |
| 220 | 218 | $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
@@ -223,8 +221,8 @@ discard block |
||
| 223 | 221 | $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); |
| 224 | 222 | $this->appendDebug($tr->getDebug()); |
| 225 | 223 | // catch errors |
| 226 | - if($err = $tr->getError() ){ |
|
| 227 | - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
|
| 224 | + if ($err = $tr->getError()) { |
|
| 225 | + $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: ' . $err; |
|
| 228 | 226 | $this->debug($errstr); |
| 229 | 227 | $this->setError($errstr); |
| 230 | 228 | unset($tr); |
@@ -283,7 +281,7 @@ discard block |
||
| 283 | 281 | xml_parser_free($this->parser); |
| 284 | 282 | $this->debug('Parsing WSDL done'); |
| 285 | 283 | // catch wsdl parse errors |
| 286 | - if($this->getError()){ |
|
| 284 | + if ($this->getError()) { |
|
| 287 | 285 | return false; |
| 288 | 286 | } |
| 289 | 287 | return true; |
@@ -320,8 +318,8 @@ discard block |
||
| 320 | 318 | // process attributes |
| 321 | 319 | if (count($attrs) > 0) { |
| 322 | 320 | // register namespace declarations |
| 323 | - foreach($attrs as $k => $v) { |
|
| 324 | - if (preg_match('/^xmlns/',$k)) { |
|
| 321 | + foreach ($attrs as $k => $v) { |
|
| 322 | + if (preg_match('/^xmlns/', $k)) { |
|
| 325 | 323 | if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
| 326 | 324 | $this->namespaces[$ns_prefix] = $v; |
| 327 | 325 | } else { |
@@ -334,7 +332,7 @@ discard block |
||
| 334 | 332 | } |
| 335 | 333 | } |
| 336 | 334 | // expand each attribute prefix to its namespace |
| 337 | - foreach($attrs as $k => $v) { |
|
| 335 | + foreach ($attrs as $k => $v) { |
|
| 338 | 336 | $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
| 339 | 337 | if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { |
| 340 | 338 | $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
@@ -441,8 +439,8 @@ discard block |
||
| 441 | 439 | case 'address': |
| 442 | 440 | $this->ports[$this->currentPort]['location'] = $attrs['location']; |
| 443 | 441 | $this->ports[$this->currentPort]['bindingType'] = $namespace; |
| 444 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
| 445 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
| 442 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['bindingType'] = $namespace; |
|
| 443 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['endpoint'] = $attrs['location']; |
|
| 446 | 444 | break; |
| 447 | 445 | } |
| 448 | 446 | break; |
@@ -452,13 +450,13 @@ discard block |
||
| 452 | 450 | case 'import': |
| 453 | 451 | if (isset($attrs['location'])) { |
| 454 | 452 | $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
| 455 | - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
|
| 453 | + $this->debug('parsing import ' . $attrs['namespace'] . ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]) . ')'); |
|
| 456 | 454 | } else { |
| 457 | 455 | $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
| 458 | - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
|
| 459 | - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
|
| 456 | + if (!$this->getPrefixFromNamespace($attrs['namespace'])) { |
|
| 457 | + $this->namespaces['ns' . (count($this->namespaces) + 1)] = $attrs['namespace']; |
|
| 460 | 458 | } |
| 461 | - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
|
| 459 | + $this->debug('parsing import ' . $attrs['namespace'] . ' - [no location] (' . count($this->import[$attrs['namespace']]) . ')'); |
|
| 462 | 460 | } |
| 463 | 461 | break; |
| 464 | 462 | //wait for schema |
@@ -509,7 +507,7 @@ discard block |
||
| 509 | 507 | * @param string $name element name |
| 510 | 508 | * @access private |
| 511 | 509 | */ |
| 512 | - public function end_element($parser, $name){ |
|
| 510 | + public function end_element($parser, $name) { |
|
| 513 | 511 | // unset schema status |
| 514 | 512 | if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
| 515 | 513 | $this->status = ""; |
@@ -592,15 +590,15 @@ discard block |
||
| 592 | 590 | } |
| 593 | 591 | $this->debug("getOperations for port '$portName' bindingType $bindingType"); |
| 594 | 592 | // loop thru ports |
| 595 | - foreach($this->ports as $port => $portData) { |
|
| 593 | + foreach ($this->ports as $port => $portData) { |
|
| 596 | 594 | $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); |
| 597 | 595 | if ($portName == '' || $port == $portName) { |
| 598 | 596 | // binding type of port matches parameter |
| 599 | 597 | if ($portData['bindingType'] == $bindingType) { |
| 600 | 598 | $this->debug("getOperations found port $port bindingType $bindingType"); |
| 601 | 599 | // merge bindings |
| 602 | - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { |
|
| 603 | - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); |
|
| 600 | + if (isset($this->bindings[$portData['binding']]['operations'])) { |
|
| 601 | + $ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']); |
|
| 604 | 602 | } |
| 605 | 603 | } |
| 606 | 604 | } |
@@ -627,15 +625,15 @@ discard block |
||
| 627 | 625 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
| 628 | 626 | } |
| 629 | 627 | // loop thru ports |
| 630 | - foreach($this->ports as $port => $portData) { |
|
| 628 | + foreach ($this->ports as $port => $portData) { |
|
| 631 | 629 | // binding type of port matches parameter |
| 632 | 630 | if ($portData['bindingType'] == $bindingType) { |
| 633 | 631 | // get binding |
| 634 | 632 | //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
| 635 | - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { |
|
| 633 | + foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) { |
|
| 636 | 634 | // note that we could/should also check the namespace here |
| 637 | 635 | if ($operation == $bOperation) { |
| 638 | - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
|
| 636 | + $opData = $this->bindings[$portData['binding']]['operations'][$operation]; |
|
| 639 | 637 | return $opData; |
| 640 | 638 | } |
| 641 | 639 | } |
@@ -658,11 +656,11 @@ discard block |
||
| 658 | 656 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
| 659 | 657 | } |
| 660 | 658 | // loop thru ports |
| 661 | - foreach($this->ports as $port => $portData) { |
|
| 659 | + foreach ($this->ports as $port => $portData) { |
|
| 662 | 660 | // binding type of port matches parameter |
| 663 | 661 | if ($portData['bindingType'] == $bindingType) { |
| 664 | 662 | // loop through operations for the binding |
| 665 | - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
| 663 | + foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) { |
|
| 666 | 664 | if ($opData['soapAction'] == $soapAction) { |
| 667 | 665 | return $opData; |
| 668 | 666 | } |
@@ -691,7 +689,7 @@ discard block |
||
| 691 | 689 | */ |
| 692 | 690 | public function getTypeDef($type, $ns) { |
| 693 | 691 | $this->debug("in getTypeDef: type=$type, ns=$ns"); |
| 694 | - if ((! $ns) && isset($this->namespaces['tns'])) { |
|
| 692 | + if ((!$ns) && isset($this->namespaces['tns'])) { |
|
| 695 | 693 | $ns = $this->namespaces['tns']; |
| 696 | 694 | $this->debug("in getTypeDef: type namespace forced to $ns"); |
| 697 | 695 | } |
@@ -749,7 +747,7 @@ discard block |
||
| 749 | 747 | * |
| 750 | 748 | * @access private |
| 751 | 749 | */ |
| 752 | - public function webDescription(){ |
|
| 750 | + public function webDescription() { |
|
| 753 | 751 | global $HTTP_SERVER_VARS; |
| 754 | 752 | |
| 755 | 753 | if (isset($_SERVER)) { |
@@ -761,7 +759,7 @@ discard block |
||
| 761 | 759 | } |
| 762 | 760 | |
| 763 | 761 | $b = ' |
| 764 | - <html><head><title>NuSOAP: '.$this->serviceName.'</title> |
|
| 762 | + <html><head><title>NuSOAP: '.$this->serviceName . '</title> |
|
| 765 | 763 | <style type="text/css"> |
| 766 | 764 | body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; } |
| 767 | 765 | p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; } |
@@ -838,24 +836,24 @@ discard block |
||
| 838 | 836 | <body> |
| 839 | 837 | <div class=content> |
| 840 | 838 | <br><br> |
| 841 | - <div class=title>'.$this->serviceName.'</div> |
|
| 839 | + <div class=title>'.$this->serviceName . '</div> |
|
| 842 | 840 | <div class=nav> |
| 843 | - <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service. |
|
| 841 | + <p>View the <a href="'.$PHP_SELF . '?wsdl">WSDL</a> for the service. |
|
| 844 | 842 | Click on an operation name to view it's details.</p> |
| 845 | 843 | <ul>'; |
| 846 | - foreach($this->getOperations() as $op => $data){ |
|
| 844 | + foreach ($this->getOperations() as $op => $data) { |
|
| 847 | 845 | $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
| 848 | 846 | // create hidden div |
| 849 | 847 | $b .= "<div id='$op' class='hidden'> |
| 850 | 848 | <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>"; |
| 851 | - foreach($data as $donnie => $marie){ // loop through opdata |
|
| 852 | - if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
|
| 853 | - $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
|
| 854 | - foreach($marie as $captain => $tenille){ // loop through data |
|
| 855 | - if($captain == 'parts'){ // loop thru parts |
|
| 849 | + foreach ($data as $donnie => $marie) { // loop through opdata |
|
| 850 | + if ($donnie == 'input' || $donnie == 'output') { // show input/output data |
|
| 851 | + $b .= "<font color='white'>" . ucfirst($donnie) . ':</font><br>'; |
|
| 852 | + foreach ($marie as $captain => $tenille) { // loop through data |
|
| 853 | + if ($captain == 'parts') { // loop thru parts |
|
| 856 | 854 | $b .= " $captain:<br>"; |
| 857 | 855 | //if(is_array($tenille)){ |
| 858 | - foreach($tenille as $joanie => $chachi){ |
|
| 856 | + foreach ($tenille as $joanie => $chachi) { |
|
| 859 | 857 | $b .= " $joanie: $chachi<br>"; |
| 860 | 858 | } |
| 861 | 859 | //} |
@@ -864,7 +862,7 @@ discard block |
||
| 864 | 862 | } |
| 865 | 863 | } |
| 866 | 864 | } else { |
| 867 | - $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>"; |
|
| 865 | + $b .= "<font color='white'>" . ucfirst($donnie) . ":</font> $marie<br>"; |
|
| 868 | 866 | } |
| 869 | 867 | } |
| 870 | 868 | $b .= '</div>'; |
@@ -887,7 +885,7 @@ discard block |
||
| 887 | 885 | { |
| 888 | 886 | $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
| 889 | 887 | $xml .= "\n<definitions"; |
| 890 | - foreach($this->namespaces as $k => $v) { |
|
| 888 | + foreach ($this->namespaces as $k => $v) { |
|
| 891 | 889 | $xml .= " xmlns:$k=\"$v\""; |
| 892 | 890 | } |
| 893 | 891 | // 10.9.02 - add poulter fix for wsdl and tns declarations |
@@ -900,7 +898,7 @@ discard block |
||
| 900 | 898 | $xml .= '>'; |
| 901 | 899 | // imports |
| 902 | 900 | if (sizeof($this->import) > 0) { |
| 903 | - foreach($this->import as $ns => $list) { |
|
| 901 | + foreach ($this->import as $ns => $list) { |
|
| 904 | 902 | foreach ($list as $ii) { |
| 905 | 903 | if ($ii['location'] != '') { |
| 906 | 904 | $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />'; |
@@ -911,7 +909,7 @@ discard block |
||
| 911 | 909 | } |
| 912 | 910 | } |
| 913 | 911 | // types |
| 914 | - if (count($this->schemas)>=1) { |
|
| 912 | + if (count($this->schemas) >= 1) { |
|
| 915 | 913 | $xml .= "\n<types>\n"; |
| 916 | 914 | foreach ($this->schemas as $ns => $list) { |
| 917 | 915 | foreach ($list as $xs) { |
@@ -922,10 +920,10 @@ discard block |
||
| 922 | 920 | } |
| 923 | 921 | // messages |
| 924 | 922 | if (count($this->messages) >= 1) { |
| 925 | - foreach($this->messages as $msgName => $msgParts) { |
|
| 923 | + foreach ($this->messages as $msgName => $msgParts) { |
|
| 926 | 924 | $xml .= "\n<message name=\"" . $msgName . '">'; |
| 927 | - if(is_array($msgParts)){ |
|
| 928 | - foreach($msgParts as $partName => $partType) { |
|
| 925 | + if (is_array($msgParts)) { |
|
| 926 | + foreach ($msgParts as $partName => $partType) { |
|
| 929 | 927 | // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
| 930 | 928 | if (strpos($partType, ':')) { |
| 931 | 929 | $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
@@ -933,7 +931,7 @@ discard block |
||
| 933 | 931 | // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
| 934 | 932 | $typePrefix = 'xsd'; |
| 935 | 933 | } else { |
| 936 | - foreach($this->typemap as $ns => $types) { |
|
| 934 | + foreach ($this->typemap as $ns => $types) { |
|
| 937 | 935 | if (isset($types[$partType])) { |
| 938 | 936 | $typePrefix = $this->getPrefixFromNamespace($ns); |
| 939 | 937 | } |
@@ -963,13 +961,13 @@ discard block |
||
| 963 | 961 | if (count($this->bindings) >= 1) { |
| 964 | 962 | $binding_xml = ''; |
| 965 | 963 | $portType_xml = ''; |
| 966 | - foreach($this->bindings as $bindingName => $attrs) { |
|
| 964 | + foreach ($this->bindings as $bindingName => $attrs) { |
|
| 967 | 965 | $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">'; |
| 968 | 966 | $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>'; |
| 969 | 967 | $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">'; |
| 970 | - foreach($attrs['operations'] as $opName => $opParts) { |
|
| 968 | + foreach ($attrs['operations'] as $opName => $opParts) { |
|
| 971 | 969 | $binding_xml .= "\n" . ' <operation name="' . $opName . '">'; |
| 972 | - $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>'; |
|
| 970 | + $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="' . $opParts['style'] . '"/>'; |
|
| 973 | 971 | if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { |
| 974 | 972 | $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; |
| 975 | 973 | } else { |
@@ -988,7 +986,7 @@ discard block |
||
| 988 | 986 | $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
| 989 | 987 | } |
| 990 | 988 | $portType_xml .= '>'; |
| 991 | - if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
| 989 | + if (isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
| 992 | 990 | $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>'; |
| 993 | 991 | } |
| 994 | 992 | $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>'; |
@@ -1003,7 +1001,7 @@ discard block |
||
| 1003 | 1001 | // services |
| 1004 | 1002 | $xml .= "\n<service name=\"" . $this->serviceName . '">'; |
| 1005 | 1003 | if (count($this->ports) >= 1) { |
| 1006 | - foreach($this->ports as $pName => $attrs) { |
|
| 1004 | + foreach ($this->ports as $pName => $attrs) { |
|
| 1007 | 1005 | $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">'; |
| 1008 | 1006 | $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>'; |
| 1009 | 1007 | $xml .= "\n" . ' </port>'; |
@@ -1118,7 +1116,7 @@ discard block |
||
| 1118 | 1116 | |
| 1119 | 1117 | // Get encoding style for output and set to current |
| 1120 | 1118 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
| 1121 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
| 1119 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
| 1122 | 1120 | $encodingStyle = $opData['output']['encodingStyle']; |
| 1123 | 1121 | $enc_style = $encodingStyle; |
| 1124 | 1122 | } |
@@ -1213,7 +1211,7 @@ discard block |
||
| 1213 | 1211 | |
| 1214 | 1212 | // Get encoding style for output and set to current |
| 1215 | 1213 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
| 1216 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
| 1214 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
| 1217 | 1215 | $encodingStyle = $opData['output']['encodingStyle']; |
| 1218 | 1216 | $enc_style = $encodingStyle; |
| 1219 | 1217 | } |
@@ -1228,10 +1226,10 @@ discard block |
||
| 1228 | 1226 | if (is_array($parameters)) { |
| 1229 | 1227 | $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
| 1230 | 1228 | $this->debug('have ' . $parametersArrayType . ' parameters'); |
| 1231 | - foreach($opData[$direction]['parts'] as $name => $type) { |
|
| 1232 | - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); |
|
| 1229 | + foreach ($opData[$direction]['parts'] as $name => $type) { |
|
| 1230 | + $this->debug('serializing part "' . $name . '" of type "' . $type . '"'); |
|
| 1233 | 1231 | // Track encoding style |
| 1234 | - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
| 1232 | + if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
| 1235 | 1233 | $encodingStyle = $opData[$direction]['encodingStyle']; |
| 1236 | 1234 | $enc_style = $encodingStyle; |
| 1237 | 1235 | } else { |
@@ -1271,11 +1269,11 @@ discard block |
||
| 1271 | 1269 | * @return string value serialized as an XML string |
| 1272 | 1270 | * @access private |
| 1273 | 1271 | */ |
| 1274 | - public function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) |
|
| 1272 | + public function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false) |
|
| 1275 | 1273 | { |
| 1276 | 1274 | $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); |
| 1277 | 1275 | $this->appendDebug("value=" . $this->varDump($value)); |
| 1278 | - if($use == 'encoded' && $encodingStyle) { |
|
| 1276 | + if ($use == 'encoded' && $encodingStyle) { |
|
| 1279 | 1277 | $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; |
| 1280 | 1278 | } |
| 1281 | 1279 | |
@@ -1319,7 +1317,7 @@ discard block |
||
| 1319 | 1317 | $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); |
| 1320 | 1318 | } |
| 1321 | 1319 | |
| 1322 | - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ |
|
| 1320 | + if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') { |
|
| 1323 | 1321 | $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); |
| 1324 | 1322 | if ($unqualified && $use == 'literal') { |
| 1325 | 1323 | $elementNS = " xmlns=\"\""; |
@@ -1340,7 +1338,7 @@ discard block |
||
| 1340 | 1338 | return $this->serialize_val($value, $name, false, false, false, false, $use); |
| 1341 | 1339 | } |
| 1342 | 1340 | if ($uqType == 'boolean') { |
| 1343 | - if ((is_string($value) && $value == 'false') || (! $value)) { |
|
| 1341 | + if ((is_string($value) && $value == 'false') || (!$value)) { |
|
| 1344 | 1342 | $value = 'false'; |
| 1345 | 1343 | } else { |
| 1346 | 1344 | $value = 'true'; |
@@ -1370,7 +1368,7 @@ discard block |
||
| 1370 | 1368 | $this->debug('in serializeType: appears to be Apache SOAP type'); |
| 1371 | 1369 | if ($uqType == 'Map') { |
| 1372 | 1370 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
| 1373 | - if (! $tt_prefix) { |
|
| 1371 | + if (!$tt_prefix) { |
|
| 1374 | 1372 | $this->debug('in serializeType: Add namespace for Apache SOAP type'); |
| 1375 | 1373 | $tt_prefix = 'ns' . rand(1000, 9999); |
| 1376 | 1374 | $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; |
@@ -1378,11 +1376,11 @@ discard block |
||
| 1378 | 1376 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
| 1379 | 1377 | } |
| 1380 | 1378 | $contents = ''; |
| 1381 | - foreach($value as $k => $v) { |
|
| 1379 | + foreach ($value as $k => $v) { |
|
| 1382 | 1380 | $this->debug("serializing map element: key $k, value $v"); |
| 1383 | 1381 | $contents .= '<item>'; |
| 1384 | - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); |
|
| 1385 | - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); |
|
| 1382 | + $contents .= $this->serialize_val($k, 'key', false, false, false, false, $use); |
|
| 1383 | + $contents .= $this->serialize_val($v, 'value', false, false, false, false, $use); |
|
| 1386 | 1384 | $contents .= '</item>'; |
| 1387 | 1385 | } |
| 1388 | 1386 | if ($use == 'literal') { |
@@ -1404,7 +1402,7 @@ discard block |
||
| 1404 | 1402 | $ns = ''; |
| 1405 | 1403 | $uqType = $type; |
| 1406 | 1404 | } |
| 1407 | - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ |
|
| 1405 | + if (!$typeDef = $this->getTypeDef($uqType, $ns)) { |
|
| 1408 | 1406 | $this->setError("$type ($uqType) is not a supported type."); |
| 1409 | 1407 | $this->debug("in serializeType: $type ($uqType) is not a supported type."); |
| 1410 | 1408 | return false; |
@@ -1421,7 +1419,7 @@ discard block |
||
| 1421 | 1419 | return false; |
| 1422 | 1420 | } |
| 1423 | 1421 | $phpType = $typeDef['phpType']; |
| 1424 | - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); |
|
| 1422 | + $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '')); |
|
| 1425 | 1423 | // if php type == struct, map value to the <all> element names |
| 1426 | 1424 | if ($phpType == 'struct') { |
| 1427 | 1425 | if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { |
@@ -1501,14 +1499,14 @@ discard block |
||
| 1501 | 1499 | ':arrayType="' . |
| 1502 | 1500 | $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . |
| 1503 | 1501 | ':' . |
| 1504 | - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; |
|
| 1502 | + $this->getLocalPart($typeDef['arrayType']) . "[0]\"/>"; |
|
| 1505 | 1503 | } |
| 1506 | 1504 | $this->debug("in serializeType: returning: $xml"); |
| 1507 | 1505 | return $xml; |
| 1508 | 1506 | } |
| 1509 | 1507 | if (isset($typeDef['multidimensional'])) { |
| 1510 | 1508 | $nv = array(); |
| 1511 | - foreach($value as $v) { |
|
| 1509 | + foreach ($value as $v) { |
|
| 1512 | 1510 | $cols = ',' . sizeof($v); |
| 1513 | 1511 | $nv = array_merge($nv, $v); |
| 1514 | 1512 | } |
@@ -1519,10 +1517,10 @@ discard block |
||
| 1519 | 1517 | if (is_array($value) && sizeof($value) >= 1) { |
| 1520 | 1518 | $rows = sizeof($value); |
| 1521 | 1519 | $contents = ''; |
| 1522 | - foreach($value as $k => $v) { |
|
| 1520 | + foreach ($value as $k => $v) { |
|
| 1523 | 1521 | $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
| 1524 | 1522 | //if (strpos($typeDef['arrayType'], ':') ) { |
| 1525 | - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
| 1523 | + if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
| 1526 | 1524 | $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
| 1527 | 1525 | } else { |
| 1528 | 1526 | $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
@@ -1537,11 +1535,11 @@ discard block |
||
| 1537 | 1535 | .$contents |
| 1538 | 1536 | ."</$name>"; |
| 1539 | 1537 | } else { |
| 1540 | - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. |
|
| 1538 | + $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . ':Array" ' . |
|
| 1541 | 1539 | $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') |
| 1542 | 1540 | .':arrayType="' |
| 1543 | 1541 | .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) |
| 1544 | - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" |
|
| 1542 | + .":" . $this->getLocalPart($typeDef['arrayType']) . "[$rows$cols]\">" |
|
| 1545 | 1543 | .$contents |
| 1546 | 1544 | ."</$name>"; |
| 1547 | 1545 | } |
@@ -1621,7 +1619,7 @@ discard block |
||
| 1621 | 1619 | $this->debug("no value provided for attribute $aName"); |
| 1622 | 1620 | } |
| 1623 | 1621 | if ($xname) { |
| 1624 | - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
| 1622 | + $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
| 1625 | 1623 | } |
| 1626 | 1624 | } |
| 1627 | 1625 | } else { |
@@ -1642,7 +1640,7 @@ discard block |
||
| 1642 | 1640 | * @return string value serialized as an XML string |
| 1643 | 1641 | * @access private |
| 1644 | 1642 | */ |
| 1645 | - public function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { |
|
| 1643 | + public function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) { |
|
| 1646 | 1644 | $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); |
| 1647 | 1645 | $xml = ''; |
| 1648 | 1646 | if (isset($typeDef['extensionBase'])) { |
@@ -1669,7 +1667,7 @@ discard block |
||
| 1669 | 1667 | $xvalue = array(); |
| 1670 | 1668 | } |
| 1671 | 1669 | // toggle whether all elements are present - ideally should validate against schema |
| 1672 | - if (count($typeDef['elements']) != count($xvalue)){ |
|
| 1670 | + if (count($typeDef['elements']) != count($xvalue)) { |
|
| 1673 | 1671 | $optionals = true; |
| 1674 | 1672 | } |
| 1675 | 1673 | foreach ($typeDef['elements'] as $eName => $attrs) { |
@@ -1682,8 +1680,8 @@ discard block |
||
| 1682 | 1680 | // if user took advantage of a minOccurs=0, then only serialize named parameters |
| 1683 | 1681 | if (isset($optionals) |
| 1684 | 1682 | && (!isset($xvalue[$eName])) |
| 1685 | - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
| 1686 | - ){ |
|
| 1683 | + && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
| 1684 | + ) { |
|
| 1687 | 1685 | if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
| 1688 | 1686 | $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); |
| 1689 | 1687 | } |
@@ -1748,15 +1746,15 @@ discard block |
||
| 1748 | 1746 | * @see nusoap_xmlschema |
| 1749 | 1747 | * @access public |
| 1750 | 1748 | */ |
| 1751 | - public function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
|
| 1749 | + public function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') { |
|
| 1752 | 1750 | if (count($elements) > 0) { |
| 1753 | 1751 | $eElements = array(); |
| 1754 | - foreach($elements as $n => $e){ |
|
| 1752 | + foreach ($elements as $n => $e) { |
|
| 1755 | 1753 | // expand each element |
| 1756 | 1754 | $ee = array(); |
| 1757 | 1755 | foreach ($e as $k => $v) { |
| 1758 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1759 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1756 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
| 1757 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
| 1760 | 1758 | $ee[$k] = $v; |
| 1761 | 1759 | } |
| 1762 | 1760 | $eElements[$n] = $ee; |
@@ -1765,11 +1763,11 @@ discard block |
||
| 1765 | 1763 | } |
| 1766 | 1764 | |
| 1767 | 1765 | if (count($attrs) > 0) { |
| 1768 | - foreach($attrs as $n => $a){ |
|
| 1766 | + foreach ($attrs as $n => $a) { |
|
| 1769 | 1767 | // expand each attribute |
| 1770 | 1768 | foreach ($a as $k => $v) { |
| 1771 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
| 1772 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
| 1769 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
| 1770 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
| 1773 | 1771 | $aa[$k] = $v; |
| 1774 | 1772 | } |
| 1775 | 1773 | $eAttrs[$n] = $aa; |
@@ -1777,11 +1775,11 @@ discard block |
||
| 1777 | 1775 | $attrs = $eAttrs; |
| 1778 | 1776 | } |
| 1779 | 1777 | |
| 1780 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
| 1781 | - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; |
|
| 1778 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
| 1779 | + $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType; |
|
| 1782 | 1780 | |
| 1783 | 1781 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
| 1784 | - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); |
|
| 1782 | + $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType); |
|
| 1785 | 1783 | } |
| 1786 | 1784 | |
| 1787 | 1785 | /** |
@@ -1795,8 +1793,8 @@ discard block |
||
| 1795 | 1793 | * @see nusoap_xmlschema |
| 1796 | 1794 | * @access public |
| 1797 | 1795 | */ |
| 1798 | - public function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
|
| 1799 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
| 1796 | + public function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) { |
|
| 1797 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
| 1800 | 1798 | |
| 1801 | 1799 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
| 1802 | 1800 | $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); |
@@ -1828,7 +1826,7 @@ discard block |
||
| 1828 | 1826 | * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
| 1829 | 1827 | * @access public |
| 1830 | 1828 | */ |
| 1831 | - public function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
|
| 1829 | + public function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') { |
|
| 1832 | 1830 | if ($use == 'encoded' && $encodingStyle == '') { |
| 1833 | 1831 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
| 1834 | 1832 | } |
@@ -1852,7 +1850,7 @@ discard block |
||
| 1852 | 1850 | } |
| 1853 | 1851 | |
| 1854 | 1852 | // get binding |
| 1855 | - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = |
|
| 1853 | + $this->bindings[$this->serviceName . 'Binding']['operations'][$name] = |
|
| 1856 | 1854 | array( |
| 1857 | 1855 | 'name' => $name, |
| 1858 | 1856 | 'binding' => $this->serviceName . 'Binding', |
@@ -1876,29 +1874,29 @@ discard block |
||
| 1876 | 1874 | 'documentation' => $documentation); |
| 1877 | 1875 | // add portTypes |
| 1878 | 1876 | // add messages |
| 1879 | - if($in) |
|
| 1877 | + if ($in) |
|
| 1880 | 1878 | { |
| 1881 | - foreach($in as $pName => $pType) |
|
| 1879 | + foreach ($in as $pName => $pType) |
|
| 1882 | 1880 | { |
| 1883 | - if(strpos($pType,':')) { |
|
| 1884 | - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
| 1881 | + if (strpos($pType, ':')) { |
|
| 1882 | + $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType); |
|
| 1885 | 1883 | } |
| 1886 | - $this->messages[$name.'Request'][$pName] = $pType; |
|
| 1884 | + $this->messages[$name . 'Request'][$pName] = $pType; |
|
| 1887 | 1885 | } |
| 1888 | 1886 | } else { |
| 1889 | - $this->messages[$name.'Request']= '0'; |
|
| 1887 | + $this->messages[$name . 'Request'] = '0'; |
|
| 1890 | 1888 | } |
| 1891 | - if($out) |
|
| 1889 | + if ($out) |
|
| 1892 | 1890 | { |
| 1893 | - foreach($out as $pName => $pType) |
|
| 1891 | + foreach ($out as $pName => $pType) |
|
| 1894 | 1892 | { |
| 1895 | - if(strpos($pType,':')) { |
|
| 1896 | - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
|
| 1893 | + if (strpos($pType, ':')) { |
|
| 1894 | + $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType); |
|
| 1897 | 1895 | } |
| 1898 | - $this->messages[$name.'Response'][$pName] = $pType; |
|
| 1896 | + $this->messages[$name . 'Response'][$pName] = $pType; |
|
| 1899 | 1897 | } |
| 1900 | 1898 | } else { |
| 1901 | - $this->messages[$name.'Response']= '0'; |
|
| 1899 | + $this->messages[$name . 'Response'] = '0'; |
|
| 1902 | 1900 | } |
| 1903 | 1901 | return true; |
| 1904 | 1902 | } |