PageRenderTime 16ms CodeModel.GetById 7ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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