/libraries/joomla/filesystem/wrapper/file.php

https://gitlab.com/vitaliylukin91/alex-lavka · PHP · 201 lines · 50 code · 13 blank · 138 comment · 0 complexity · 272e98669d17e9a812644d40f62c4f10 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Platform
  4. * @subpackage Filesystem
  5. *
  6. * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE
  8. */
  9. defined('JPATH_PLATFORM') or die;
  10. jimport('joomla.filesystem.file');
  11. /**
  12. * Wrapper class for JFile
  13. *
  14. * @package Joomla.Platform
  15. * @subpackage Filesystem
  16. * @since 3.4
  17. */
  18. class JFilesystemWrapperFile
  19. {
  20. /**
  21. * Helper wrapper method for getExt
  22. *
  23. * @param string $file The file name.
  24. *
  25. * @return string The file extension.
  26. *
  27. * @see JFile::getExt()
  28. * @since 3.4
  29. */
  30. public function getExt($file)
  31. {
  32. return JFile::getExt($file);
  33. }
  34. /**
  35. * Helper wrapper method for stripExt
  36. *
  37. * @param string $file The file name.
  38. *
  39. * @return string The file name without the extension.
  40. *
  41. * @see JFile::stripExt()
  42. * @since 3.4
  43. */
  44. public function stripExt($file)
  45. {
  46. return JFile::stripExt($file);
  47. }
  48. /**
  49. * Helper wrapper method for makeSafe
  50. *
  51. * @param string $file The name of the file [not full path].
  52. *
  53. * @return string The sanitised string.
  54. *
  55. * @see JFile::makeSafe()
  56. * @since 3.4
  57. */
  58. public function makeSafe($file)
  59. {
  60. return JFile::makeSafe($file);
  61. }
  62. /**
  63. * Helper wrapper method for copy
  64. *
  65. * @param string $src The path to the source file.
  66. * @param string $dest The path to the destination file.
  67. * @param string $path An optional base path to prefix to the file names.
  68. * @param boolean $use_streams True to use streams.
  69. *
  70. * @return boolean True on success.
  71. *
  72. * @see JFile::copy()
  73. * @since 3.4
  74. */
  75. public function copy($src, $dest, $path = null, $use_streams = false)
  76. {
  77. return JFile::copy($src, $dest, $path, $use_streams);
  78. }
  79. /**
  80. * Helper wrapper method for delete
  81. *
  82. * @param mixed $file The file name or an array of file names
  83. *
  84. * @return boolean True on success.
  85. *
  86. * @see JFile::delete()
  87. * @since 3.4
  88. */
  89. public function delete($file)
  90. {
  91. return JFile::delete($file);
  92. }
  93. /**
  94. * Helper wrapper method for move
  95. *
  96. * @param string $src The path to the source file.
  97. * @param string $dest The path to the destination file.
  98. * @param string $path An optional base path to prefix to the file names.
  99. * @param boolean $use_streams True to use streams.
  100. *
  101. * @return boolean True on success.
  102. *
  103. * @see JFile::move()
  104. * @since 3.4
  105. */
  106. public function move($src, $dest, $path = '', $use_streams = false)
  107. {
  108. return JFile::move($src, $dest, $path, $use_streams);
  109. }
  110. /**
  111. * Helper wrapper method for read
  112. *
  113. * @param string $filename The full file path.
  114. * @param boolean $incpath Use include path.
  115. * @param integer $amount Amount of file to read.
  116. * @param integer $chunksize Size of chunks to read.
  117. * @param integer $offset Offset of the file.
  118. *
  119. * @return mixed Returns file contents or boolean False if failed.
  120. *
  121. * @see JFile::read()
  122. * @since 3.4
  123. */
  124. public function read($filename, $incpath = false, $amount = 0, $chunksize = 8192, $offset = 0)
  125. {
  126. return JFile::read($filename, $incpath, $amount, $chunksize, $offset);
  127. }
  128. /**
  129. * Helper wrapper method for write
  130. *
  131. * @param string $file The full file path.
  132. * @param string &$buffer The buffer to write.
  133. * @param boolean $use_streams Use streams.
  134. *
  135. * @return boolean True on success.
  136. *
  137. * @see JFile::write()
  138. * @since 3.4
  139. */
  140. public function write($file, &$buffer, $use_streams = false)
  141. {
  142. return JFile::write($file, $buffer, $use_streams);
  143. }
  144. /**
  145. * Helper wrapper method for upload
  146. *
  147. * @param string $src The name of the php (temporary) uploaded file.
  148. * @param string $dest The path (including filename) to move the uploaded file to.
  149. * @param boolean $use_streams True to use streams.
  150. *
  151. * @return boolean True on success.
  152. *
  153. * @see JFile::upload()
  154. * @since 3.4
  155. */
  156. public function upload($src, $dest, $use_streams = false)
  157. {
  158. return JFile::upload($src, $dest, $use_streams);
  159. }
  160. /**
  161. * Helper wrapper method for exists
  162. *
  163. * @param string $file File path.
  164. *
  165. * @return boolean True if path is a file.
  166. *
  167. * @see JFile::exists()
  168. * @since 3.4
  169. */
  170. public function exists($file)
  171. {
  172. return JFile::exists($file);
  173. }
  174. /**
  175. * Helper wrapper method for getName
  176. *
  177. * @param string $file File path.
  178. *
  179. * @return string filename.
  180. *
  181. * @see JFile::getName()
  182. * @since 3.4
  183. */
  184. public function getName($file)
  185. {
  186. return JFile::getName($file);
  187. }
  188. }