Changeset 23663
- Timestamp:
- 2014/10/24 10:06:39 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13_3/data/class/util/SC_Utils.php
r23609 r23663 1828 1828 * この関数は, パスの存在チェックを行なわないため注意すること. 1829 1829 * 1830 * use File_Util::isAbsolute 1831 * http://pear.php.net/package/File_Util/ 1832 * 1833 * @param string $path チェック対象のパス 1830 * @param string $realpath チェック対象のパス 1834 1831 * @return boolean 絶対パスの場合 true 1835 1832 */ 1836 public static function isAbsoluteRealPath($path) 1837 { 1838 if (preg_match('/(?:\/|\\\)\.\.(?=\/|$)/', $path)) { 1839 return false; 1840 } 1841 if (DIRECTORY_SEPARATOR == '\\') { 1842 return (($path{0} == '/') || preg_match('/^[a-zA-Z]:(\\\|\/)/', $path)); 1843 } 1844 return ($path{0} == '/') || ($path{0} == '~'); 1833 public static function isAbsoluteRealPath($realpath) 1834 { 1835 if (strpos(PHP_OS, 'WIN') === false) { 1836 return substr($realpath, 0, 1) == '/'; 1837 } else { 1838 return preg_match('/^[a-zA-Z]:(\\\|\/)/', $realpath) ? true : false; 1839 } 1845 1840 } 1846 1841 … … 1848 1843 * ディレクトリを再帰的に作成する. 1849 1844 * 1845 * mkdir 関数の $recursive パラメーターを PHP4 でサポートする. 1846 * 1847 * @param string $pathname ディレクトリのパス 1850 1848 * @param integer $mode 作成するディレクトリのパーミッション 1851 * @param string $path1852 1849 * @return boolean 作成に成功した場合 true; 失敗した場合 false 1853 1850 * @see http://jp.php.net/mkdir 1854 1851 */ 1855 public static function recursiveMkdir($path, $mode = 0777) 1856 { 1857 // Windows環境ではmodeは効かない 1858 return mkdir($path, $mode, true); 1852 public static function recursiveMkdir($pathname, $mode = 0777) 1853 { 1854 /* 1855 * SC_Utils_Ex への再帰は無限ループやメモリリークの懸念 1856 * 自クラスへ再帰する. 1857 */ 1858 is_dir(dirname($pathname)) || SC_Utils::recursiveMkdir(dirname($pathname), $mode); 1859 1860 return is_dir($pathname) || @mkdir($pathname, $mode); 1859 1861 } 1860 1862
Note: See TracChangeset
for help on using the changeset viewer.
