PageRenderTime 27ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Library/Louder/Websphere/Smash.php

http://kumbia-enterprise.googlecode.com/
PHP | 667 lines | 223 code | 85 blank | 359 comment | 6 complexity | 9fb109866c5efdd32839c96ebea63b07 MD5 | raw file
  1. <?php
  2. class DOMDocument {
  3. private $_version;
  4. public function __construct($version=1.0, $encoding='UTF-8'){
  5. $this->_version = $version;
  6. $this->_encoding = $encoding;
  7. }
  8. public function saveXML(){
  9. }
  10. }
  11. /**
  12. * SeekableIterator
  13. *
  14. * Permite cambiar de una posicion a otra estableciendo la posicion
  15. *
  16. * @package SPL
  17. * @copyright Copyright (c) 2005-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
  18. * @copyright PHP Group
  19. */
  20. interface SeekableIterator {
  21. }
  22. /**
  23. * SplFileInfo
  24. *
  25. * The SplFileInfo class offers a high-level object oriented interface to information for an individual file.
  26. *
  27. * @package SPL
  28. * @copyright Copyright (c) 2005-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
  29. * @copyright PHP Group
  30. */
  31. class SplFileInfo {
  32. /**
  33. * Path to the file.
  34. *
  35. * @var string
  36. */
  37. protected $_fileName;
  38. /**
  39. * Construct a new SplFileInfo object
  40. *
  41. * @param string $fileName
  42. */
  43. public function __construct($fileName){
  44. $this->_fileName = $fileName;
  45. }
  46. /**
  47. * Gets the inode change time of the file
  48. *
  49. * @return int
  50. */
  51. public function getATime(){
  52. return fileatime($this->_fileName);
  53. }
  54. /**
  55. * Gets the base name of the file
  56. *
  57. * @param string $suffix
  58. */
  59. public function getBaseName($suffix){
  60. return basename($this->_fileName, $suffix);
  61. }
  62. /**
  63. * Gets the inode change time
  64. *
  65. * @return string
  66. */
  67. public function getCTime(){
  68. return filectime($this->_fileName);
  69. }
  70. /**
  71. * Obtiene el nombre del archivo
  72. *
  73. * @return string
  74. */
  75. public function getFileName(){
  76. return dirname($this->_fileName);
  77. }
  78. /**
  79. * Gets the file group
  80. *
  81. * @return int
  82. */
  83. public function getGroup(){
  84. return filegroup($this->_fileName);
  85. }
  86. /**
  87. * Gets the inode for the file
  88. *
  89. * @return int
  90. */
  91. public function getInode(){
  92. return fileinode($this->_fileName);
  93. }
  94. /**
  95. * Gets the target of a link
  96. *
  97. * @return int
  98. */
  99. public function getLinkTarget(){
  100. return readlink($this->_fileName);
  101. }
  102. /**
  103. * Gets the last modified time
  104. *
  105. * @return int
  106. */
  107. public function getMTime(){
  108. return filemtime($this->_fileName);
  109. }
  110. /**
  111. * Gets the owner of the file
  112. *
  113. * @return string
  114. */
  115. public function getOwner(){
  116. return fileowner($this->_fileName);
  117. }
  118. /**
  119. * Gets the path without filename
  120. *
  121. * @return string
  122. */
  123. public function getPath(){
  124. return dirname($this->_fileName);
  125. }
  126. /**
  127. * Gets an SplFileInfo object for the path
  128. *
  129. * @return SplFileInfo
  130. */
  131. public function getPathInfo(){
  132. return new SplFileInfo($this->getPath());
  133. }
  134. /**
  135. * Gets the path to the file
  136. *
  137. * @return string
  138. */
  139. public function getPathName(){
  140. $pathinfo = pathinfo($this->_fileName, PATHINFO_DIRNAME);
  141. return $pathinfo['dirname'];
  142. }
  143. /**
  144. * Devuelve los permisos del archivo
  145. *
  146. * @return int
  147. */
  148. public function getPerms(){
  149. return fileperms($this->_fileName);
  150. }
  151. /**
  152. * Gets absolute path to file
  153. *
  154. * @return string
  155. */
  156. public function getRealPath(){
  157. return realpath($this->_fileName);
  158. }
  159. /**
  160. * Gets file size
  161. *
  162. * @return int
  163. */
  164. public function getSize(){
  165. return filesize($this->_fileName);
  166. }
  167. /**
  168. * Gets file type
  169. *
  170. * @return string
  171. */
  172. public function getType(){
  173. return filetype($this->_fileName);
  174. }
  175. /**
  176. * Tells if the file is a directory
  177. *
  178. * @return bool
  179. */
  180. public function isDir(){
  181. return is_dir($this->_fileName);
  182. }
  183. /**
  184. * Tells if the file is executable
  185. *
  186. * @return bool
  187. */
  188. public function isExecutable(){
  189. return is_executable($this->_fileName);
  190. }
  191. /**
  192. * Tells if the object references a regular file
  193. *
  194. * @return bool
  195. */
  196. public function isFile(){
  197. return is_file($this->_fileName);
  198. }
  199. /**
  200. * Tells if the file is a link
  201. *
  202. * @return bool
  203. */
  204. public function isLink(){
  205. return is_link($this->_fileName);
  206. }
  207. /**
  208. * Tells if file is readable
  209. *
  210. * @return bool
  211. */
  212. public function isReadable(){
  213. return is_readable($this->_fileName);
  214. }
  215. /**
  216. * Tells if the entry is writable
  217. *
  218. * @return bool
  219. */
  220. public function isWritable(){
  221. return is_writable($this->_fileName);
  222. }
  223. /**
  224. * Gets an SplFileObject object for the file
  225. *
  226. * @return SplFileObject
  227. */
  228. public function openFile(){
  229. }
  230. /**
  231. * Sets the class name used with SplFileInfo::openFile()
  232. *
  233. */
  234. public function setFileClass(){
  235. }
  236. /**
  237. * Sets the class used with getFileInfo and getPathInfo
  238. *
  239. */
  240. public function setInfoClass(){
  241. }
  242. /**
  243. * Returns the path to the file as a string
  244. *
  245. * @return string
  246. */
  247. public function __toString(){
  248. return $this->_fileName;
  249. }
  250. }
  251. /**
  252. * DirectoryIterator
  253. *
  254. * The DirectoryIterator class provides a simple interface for viewing the contents of filesystem directories.
  255. * Due to some strange bug on com.ibm.p8 we need to redefine all the SplFileInfo methdos
  256. *
  257. * @package SPL
  258. * @copyright Copyright (c) 2005-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
  259. * @copyright PHP Group
  260. */
  261. class DirectoryIterator implements Iterator {
  262. /**
  263. * The path of the directory to traverse.
  264. *
  265. * @var string
  266. */
  267. private $_path;
  268. /**
  269. * Directory Handler
  270. *
  271. * @var resource
  272. */
  273. private $_directoryHandler;
  274. /**
  275. * Entty Position
  276. *
  277. * @var int
  278. */
  279. private $_pointer = 0;
  280. /**
  281. * Path to the file.
  282. *
  283. * @var string
  284. */
  285. private $_fileName;
  286. /**
  287. * Constructor de DirectoryIterator
  288. *
  289. * @param string $path
  290. */
  291. public function __construct($path){
  292. $this->_position = 0;
  293. $this->_path = $path;
  294. $this->_fileName = $path;
  295. $this->_directoryHandler = opendir($path);
  296. }
  297. /**
  298. * Gets the inode change time of the file
  299. *
  300. * @return int
  301. */
  302. public function getATime(){
  303. return fileatime($this->_fileName);
  304. }
  305. /**
  306. * Gets the base name of the file
  307. *
  308. * @param string $suffix
  309. */
  310. public function getBaseName($suffix){
  311. return basename($this->_fileName, $suffix);
  312. }
  313. /**
  314. * Gets the inode change time
  315. *
  316. * @return string
  317. */
  318. public function getCTime(){
  319. return filectime($this->_fileName);
  320. }
  321. /**
  322. * Obtiene el nombre del archivo
  323. *
  324. * @return string
  325. */
  326. public function getFileName(){
  327. return dirname($this->_fileName);
  328. }
  329. /**
  330. * Gets the file group
  331. *
  332. * @return int
  333. */
  334. public function getGroup(){
  335. return filegroup($this->_fileName);
  336. }
  337. /**
  338. * Gets the inode for the file
  339. *
  340. * @return int
  341. */
  342. public function getInode(){
  343. return fileinode($this->_fileName);
  344. }
  345. /**
  346. * Gets the target of a link
  347. *
  348. * @return int
  349. */
  350. public function getLinkTarget(){
  351. return readlink($this->_fileName);
  352. }
  353. /**
  354. * Gets the last modified time
  355. *
  356. * @return int
  357. */
  358. public function getMTime(){
  359. return filemtime($this->_fileName);
  360. }
  361. /**
  362. * Gets the owner of the file
  363. *
  364. * @return string
  365. */
  366. public function getOwner(){
  367. return fileowner($this->_fileName);
  368. }
  369. /**
  370. * Gets the path without filename
  371. *
  372. * @return string
  373. */
  374. public function getPath(){
  375. return dirname($this->_fileName);
  376. }
  377. /**
  378. * Gets an SplFileInfo object for the path
  379. *
  380. * @return SplFileInfo
  381. */
  382. public function getPathInfo(){
  383. return new SplFileInfo($this->getPath());
  384. }
  385. /**
  386. * Gets the path to the file
  387. *
  388. * @return string
  389. */
  390. public function getPathName(){
  391. $pathinfo = pathinfo($this->_fileName, PATHINFO_DIRNAME);
  392. return $pathinfo['dirname'];
  393. }
  394. /**
  395. * Devuelve los permisos del archivo
  396. *
  397. * @return int
  398. */
  399. public function getPerms(){
  400. return fileperms($this->_fileName);
  401. }
  402. /**
  403. * Gets absolute path to file
  404. *
  405. * @return string
  406. */
  407. public function getRealPath(){
  408. return realpath($this->_fileName);
  409. }
  410. /**
  411. * Gets file size
  412. *
  413. * @return int
  414. */
  415. public function getSize(){
  416. return filesize($this->_fileName);
  417. }
  418. /**
  419. * Gets file type
  420. *
  421. * @return string
  422. */
  423. public function getType(){
  424. return filetype($this->_fileName);
  425. }
  426. /**
  427. * Tells if the file is a directory
  428. *
  429. * @return bool
  430. */
  431. public function isDir(){
  432. return is_dir($this->_fileName);
  433. }
  434. /**
  435. * Tells if the file is executable
  436. *
  437. * @return bool
  438. */
  439. public function isExecutable(){
  440. return is_executable($this->_fileName);
  441. }
  442. /**
  443. * Tells if the object references a regular file
  444. *
  445. * @return bool
  446. */
  447. public function isFile(){
  448. return is_file($this->_fileName);
  449. }
  450. /**
  451. * Tells if the file is a link
  452. *
  453. * @return bool
  454. */
  455. public function isLink(){
  456. return is_link($this->_fileName);
  457. }
  458. /**
  459. * Tells if file is readable
  460. *
  461. * @return bool
  462. */
  463. public function isReadable(){
  464. return is_readable($this->_fileName);
  465. }
  466. /**
  467. * Tells if the entry is writable
  468. *
  469. * @return bool
  470. */
  471. public function isWritable(){
  472. return is_writable($this->_fileName);
  473. }
  474. /**
  475. * Gets an SplFileObject object for the file
  476. *
  477. * @return SplFileObject
  478. */
  479. public function openFile(){
  480. }
  481. /**
  482. * Sets the class name used with SplFileInfo::openFile()
  483. *
  484. */
  485. public function setFileClass(){
  486. }
  487. /**
  488. * Sets the class used with getFileInfo and getPathInfo
  489. *
  490. */
  491. public function setInfoClass(){
  492. }
  493. /**
  494. * Returns the path to the file as a string
  495. *
  496. * @return string
  497. */
  498. public function __toString(){
  499. return $this->_fileName;
  500. }
  501. /**
  502. * Returns true if current entry is '.' or '..'
  503. *
  504. * @return bool
  505. */
  506. public function isDot(){
  507. if(is_dir($this->_fileName)){
  508. if($this->getFileName()=='.'||$this->getFileName()=='..'){
  509. return true;
  510. } else {
  511. return false;
  512. }
  513. } else {
  514. return false;
  515. }
  516. }
  517. /**
  518. * Return this (needed for Iterator interface)
  519. *
  520. */
  521. public function current(){
  522. return $this;
  523. }
  524. /**
  525. * Clave de la entrada activa
  526. *
  527. * @return int
  528. */
  529. public function key(){
  530. return $this->_pointer;
  531. }
  532. /**
  533. * Mueve el cursor al siguiente registro
  534. *
  535. * @return int
  536. */
  537. public function next(){
  538. $this->position++;
  539. }
  540. /**
  541. * Resetea el cursor
  542. *
  543. */
  544. public function rewind(){
  545. $this->_position = 0;
  546. rewinddir($this->_directoryHandler);
  547. }
  548. /**
  549. * Indica si el iterador tiene mas entradas por devolver
  550. *
  551. * @return bool
  552. */
  553. public function valid(){
  554. $file = readdir($this->_directoryHandler);
  555. if($file!==false){
  556. $this->_fileName = $file;
  557. return true;
  558. } else {
  559. closedir($this->_directoryHandler);
  560. return false;
  561. }
  562. }
  563. }
  564. /**
  565. * Registra una funcion de autocarga
  566. *
  567. * @param callback $callback
  568. */
  569. function spl_autoload_register($callback){
  570. return false;
  571. }
  572. /**
  573. * Memoria utilizada
  574. *
  575. * @param boolean $real
  576. * @return int
  577. */
  578. function memory_get_peak_usage($real){
  579. return memory_get_usage($real);
  580. }
  581. //Establece que se esta ejecutando en Websphere
  582. Core::setIsWebsphere(true);