1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Filesystem
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 jimport('joomla.filesystem.path');
13
14 /**
15 * Wrapper class for JPath
16 *
17 * @package Joomla.Platform
18 * @subpackage Filesystem
19 * @since 3.4
20 */
21 class JFilesystemWrapperPath
22 {
23 /**
24 * Helper wrapper method for canChmod
25 *
26 * @param string $path Path to check.
27 *
28 * @return boolean True if path can have mode changed.
29 *
30 * @see JPath::canChmod()
31 * @since 3.4
32 */
33 public function canChmod($path)
34 {
35 return JPath::canChmod($path);
36 }
37
38 /**
39 * Helper wrapper method for setPermissions
40 *
41 * @param string $path Root path to begin changing mode [without trailing slash].
42 * @param string $filemode Octal representation of the value to change file mode to [null = no change].
43 * @param string $foldermode Octal representation of the value to change folder mode to [null = no change].
44 *
45 * @return boolean True if successful [one fail means the whole operation failed].
46 *
47 * @see JPath::setPermissions()
48 * @since 3.4
49 */
50 public function setPermissions($path, $filemode = '0644', $foldermode = '0755')
51 {
52 return JPath::setPermissions($path, $filemode, $foldermode);
53 }
54
55 /**
56 * Helper wrapper method for getPermissions
57 *
58 * @param string $path The path of a file/folder.
59 *
60 * @return string Filesystem permissions.
61 *
62 * @see JPath::getPermissions()
63 * @since 3.4
64 */
65 public function getPermissions($path)
66 {
67 return JPath::getPermissions($path);
68 }
69
70 /**
71 * Helper wrapper method for check
72 *
73 * @param string $path A file system path to check.
74 *
75 * @return string A cleaned version of the path or exit on error.
76 *
77 * @see JPath::check()
78 * @since 3.4
79 * @throws Exception
80 */
81 public function check($path)
82 {
83 return JPath::check($path);
84 }
85
86 /**
87 * Helper wrapper method for clean
88 *
89 * @param string $path The path to clean.
90 * @param string $ds Directory separator (optional).
91 *
92 * @return string The cleaned path.
93 *
94 * @see JPath::clean()
95 * @since 3.4
96 * @throws UnexpectedValueException
97 */
98 public function clean($path, $ds = DIRECTORY_SEPARATOR)
99 {
100 return JPath::clean($path, $ds);
101 }
102
103 /**
104 * Helper wrapper method for isOwner
105 *
106 * @param string $path Path to check ownership.
107 *
108 * @return boolean True if the php script owns the path passed.
109 *
110 * @see JPath::isOwner()
111 * @since 3.4
112 */
113 public function isOwner($path)
114 {
115 return JPath::isOwner($path);
116 }
117
118 /**
119 * Helper wrapper method for find
120 *
121 * @param mixed $paths An path string or array of path strings to search in
122 * @param string $file The file name to look for.
123 *
124 * @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.
125 *
126 * @see JPath::find()
127 * @since 3.4
128 */
129 public function find($paths, $file)
130 {
131 return JPath::find($paths, $file);
132 }
133 }
134