/libraries/joomla/filesystem/wrapper/path.php

https://gitlab.com/vitaliylukin91/alex-lavka · PHP · 133 lines · 34 code · 9 blank · 90 comment · 0 complexity · f0c3680b6e0072d4b9a28194667ebbde 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.path');
  11. /**
  12. * Wrapper class for JPath
  13. *
  14. * @package Joomla.Platform
  15. * @subpackage Filesystem
  16. * @since 3.4
  17. */
  18. class JFilesystemWrapperPath
  19. {
  20. /**
  21. * Helper wrapper method for canChmod
  22. *
  23. * @param string $path Path to check.
  24. *
  25. * @return boolean True if path can have mode changed.
  26. *
  27. * @see JPath::canChmod()
  28. * @since 3.4
  29. */
  30. public function canChmod($path)
  31. {
  32. return JPath::canChmod($path);
  33. }
  34. /**
  35. * Helper wrapper method for setPermissions
  36. *
  37. * @param string $path Root path to begin changing mode [without trailing slash].
  38. * @param string $filemode Octal representation of the value to change file mode to [null = no change].
  39. * @param string $foldermode Octal representation of the value to change folder mode to [null = no change].
  40. *
  41. * @return boolean True if successful [one fail means the whole operation failed].
  42. *
  43. * @see JPath::setPermissions()
  44. * @since 3.4
  45. */
  46. public function setPermissions($path, $filemode = '0644', $foldermode = '0755')
  47. {
  48. return JPath::setPermissions($path, $filemode, $foldermode);
  49. }
  50. /**
  51. * Helper wrapper method for getPermissions
  52. *
  53. * @param string $path The path of a file/folder.
  54. *
  55. * @return string Filesystem permissions.
  56. *
  57. * @see JPath::getPermissions()
  58. * @since 3.4
  59. */
  60. public function getPermissions($path)
  61. {
  62. return JPath::getPermissions($path);
  63. }
  64. /**
  65. * Helper wrapper method for check
  66. *
  67. * @param string $path A file system path to check.
  68. *
  69. * @return string A cleaned version of the path or exit on error.
  70. *
  71. * @see JPath::check()
  72. * @since 3.4
  73. * @throws Exception
  74. */
  75. public function check($path)
  76. {
  77. return JPath::check($path);
  78. }
  79. /**
  80. * Helper wrapper method for clean
  81. *
  82. * @param string $path The path to clean.
  83. * @param string $ds Directory separator (optional).
  84. *
  85. * @return string The cleaned path.
  86. *
  87. * @see JPath::clean()
  88. * @since 3.4
  89. * @throws UnexpectedValueException
  90. */
  91. public function clean($path, $ds = DIRECTORY_SEPARATOR)
  92. {
  93. return JPath::clean($path, $ds);
  94. }
  95. /**
  96. * Helper wrapper method for isOwner
  97. *
  98. * @param string $path Path to check ownership.
  99. *
  100. * @return boolean True if the php script owns the path passed.
  101. *
  102. * @see JPath::isOwner()
  103. * @since 3.4
  104. */
  105. public function isOwner($path)
  106. {
  107. return JPath::isOwner($path);
  108. }
  109. /**
  110. * Helper wrapper method for find
  111. *
  112. * @param mixed $paths An path string or array of path strings to search in
  113. * @param string $file The file name to look for.
  114. *
  115. * @return mixed The full path and file name for the target file, or boolean false if the file is not found in any of the paths.
  116. *
  117. * @see JPath::find()
  118. * @since 3.4
  119. */
  120. public function find($paths, $file)
  121. {
  122. return JPath::find($paths, $file);
  123. }
  124. }