当前位置: 首页>>代码示例>>PHP>>正文


PHP removeTrailingSlash函数代码示例

本文整理汇总了PHP中removeTrailingSlash函数的典型用法代码示例。如果您正苦于以下问题:PHP removeTrailingSlash函数的具体用法?PHP removeTrailingSlash怎么用?PHP removeTrailingSlash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了removeTrailingSlash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: LocalFileImpl

 /**
  * Creates a new absolute file.
  *
  * @param FileFactory $file_factory File factory reference.
  * @param String $absolute_path Absolute path to local file.
  * @param String $child_name Name of child file (Optional).
  * @param String $type Optional file type.
  */
 function LocalFileImpl(&$file_factory, $absolute_path, $child_name = "", $type = MC_IS_FILE)
 {
     $this->_fileFactory =& $file_factory;
     $this->_type = $type;
     if ($child_name != "") {
         $this->_absPath = removeTrailingSlash($absolute_path) . "/" . $child_name;
     } else {
         $this->_absPath = $absolute_path;
     }
 }
开发者ID:stormlab,项目名称:Stormlab,代码行数:18,代码来源:LocalFileImpl.php

示例2: addTrailingSlash

function addTrailingSlash($string)
{
    return removeTrailingSlash($string) . '/';
}
开发者ID:Trideon,项目名称:gigolo,代码行数:4,代码来源:file.php

示例3: elseif

    $error = ERR_RENAME_EXISTS;
} elseif (is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS))) {
    $error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
} elseif (!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'])) {
    $error = ERR_RENAME_FAILED;
} else {
    //update record of session if image exists in session for cut or copy
    include_once CLASS_SESSION_ACTION;
    $sessionAction = new SessionAction();
    $selectedDocuments = $sessionAction->get();
    if (removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments)) {
        if (($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false) {
            $selectedDocuments[$key] = $_POST['name'];
            $sessionAction->set($selectedDocuments);
        }
    } elseif (removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path'])) {
        $sessionAction->setFolder($_POST['original_path']);
    }
    $path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
    if (is_file($path)) {
        include_once CLASS_FILE;
        $file = new file($path);
        $fileInfo = $file->getFileInfo();
        $fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
    } else {
        include_once CLASS_MANAGER;
        $manager = new manager($path, false);
        $fileInfo = $manager->getFolderInfo();
        $fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
    }
    event_system(LOG_MY_FOLDER_CHANGE, LOG_MY_FOLDER_PATH, $_POST['original_path']);
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:ajax_save_name.php

示例4: repositoriesAreTheSame

 private function repositoriesAreTheSame($repository)
 {
     return removeTrailingSlash($repository) == $this->getRepositoryUrl();
 }
开发者ID:jwcastillo,项目名称:deeployer,代码行数:4,代码来源:Deployer.php

示例5: getRepositoryUrl

 /**
  * Get repository full URL
  * 
  * @return string
  */
 public function getRepositoryUrl()
 {
     return removeTrailingSlash($this->payload->repository->url);
 }
开发者ID:jwcastillo,项目名称:deeployer,代码行数:9,代码来源:Github.php

示例6: getFolderListing

         /**
          * get the list of folder under a specified folder
          * which will be used for drop-down menu
          * @param string $path the path of the specified folder
          * @param array $outputs
          * @param string $indexNumber
          * @param string $prefixNumber the prefix before the index number
          * @param string $prefixName the prefix before the folder name
          * @return array
          */
         function getFolderListing($path,$indexNumber=null, $prefixNumber =' ', $prefixName =' - ',  $outputs=array())
         {
                   $path = removeTrailingSlash(backslashToSlash($path));
                   if(is_null($indexNumber))
                   {
                   	$outputs[IMG_LBL_ROOT_FOLDER] = removeTrailingSlash(backslashToSlash($path));
                   }
                   $fh = @opendir($path);
                   if($fh)
                   {
                            $count = 1;                          
                            while($file = @readdir($fh))
                            {
                                     $newPath = removeTrailingSlash(backslashToSlash($path . "/" . $file));
                                     if(isListingDocument($newPath) && $file != '.' && $file != '..' && is_dir($newPath))
                                     {                                          
                                               if(!empty($indexNumber))
                                               {//this is not root folder
                                               					
                                                        $outputs[$prefixNumber . $indexNumber . "." . $count . $prefixName . $file] = $newPath;
                                                        getFolderListing($newPath,  $prefixNumber . $indexNumber . "." . $count , $prefixNumber, $prefixName, $outputs);                                                 
                                               }else 
                                               {//this is root folder

                                                        $outputs[$count . $prefixName . $file] = $newPath;
                                                        getFolderListing($newPath, $count, $prefixNumber, $prefixName, $outputs);
                                               }
                                               $count++;
                                     }                                    
                            }
                            @closedir($fh);
                   }
                   return $outputs;
         }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:44,代码来源:function.base.php

示例7: copyTo

 /**
  * Copy a file, or recursively copy a folder and its contents
  * @author      Aidan Lister <aidan@php.net>
  * @author      Paul Scott
  * @version     1.0.1
  * @param       string   $source    Source path
  * @param       string   $dest      Destination path
  * @return      bool     Returns TRUE on success, FALSE on failure
  */
 function copyTo($source, $dest)
 {
     $source = removeTrailingSlash(backslashToSlash($source));
     $dest = removeTrailingSlash(backslashToSlash($dest));
     if (!file_exists($dest) || !is_dir($dest)) {
         if (!$this->mkdir($dest)) {
             $this->_debug('Unable to create folder (' . $dest . ")");
             return false;
         }
     }
     // Copy in to your self?
     if (getAbsPath($source) == getAbsPath($dest)) {
         $this->_debug('Unable to copy itself. source: ' . getAbsPath($source) . "; dest: " . getAbsPath($dest));
         return false;
     }
     // Simple copy for a file
     if (is_file($source)) {
         $dest = addTrailingSlash($dest) . basename($source);
         if (file_exists($dest)) {
             return false;
         } else {
             return copy($source, $dest);
         }
     } elseif (is_dir($source)) {
         // Loop through the folder
         if (file_exists(addTrailingSlash($dest) . basename($source))) {
             return false;
         } else {
             if (!file_exists(addTrailingSlash($dest) . basename($source)) || !is_dir(addTrailingSlash($dest) . basename($source))) {
                 if (!$this->mkdir(addTrailingSlash($dest) . basename($source))) {
                     $this->_debug('Unable to create folder (' . addTrailingSlash($dest) . basename($source) . ")");
                     return false;
                 }
             }
             $handle = opendir($source);
             while (false !== ($readdir = readdir($handle))) {
                 if ($readdir != '.' && $readdir != '..') {
                     $path = addTrailingSlash($source) . '/' . $readdir;
                     $this->copyTo($path, addTrailingSlash($dest) . basename($source));
                 }
             }
             closedir($handle);
             return true;
         }
     }
     return false;
 }
开发者ID:rip-projects,项目名称:judge,代码行数:56,代码来源:class.file.php

示例8: removeTrailingSlash

<script type="text/javascript" src="js/jqModal.js"></script>
<script type="text/javascript" src="js/rotate.js"></script>
<script type="text/javascript" src="js/interface.js"></script>-->


<script type="text/javascript" src="js/ajaximageeditor.js"></script>






<script type="text/javascript">
	var imageHistory = false;
	var currentFolder =  '<?php 
echo removeTrailingSlash(backslashToSlash(dirname($path)));
?>
';
	var warningLostChanges = '<?php 
echo IMG_WARNING_LOST_CHANAGES;
?>
';
	var warningReset = '<?php 
echo IMG_WARNING_REST;
?>
';
	var warningResetEmpty = '<?php 
echo IMG_WARNING_EMPTY_RESET;
?>
';
	var warningEditorClose = '<?php 
开发者ID:rip-projects,项目名称:judge,代码行数:31,代码来源:ajax_image_editor.php

示例9: foreach

    $fileCount = 0;
    $dirCount = 0;
    $sizeSum = 0;
    foreach ($files as $file) {
        if ($file->isFile()) {
            $fileCount++;
        } else {
            $dirCount++;
        }
        $sizeSum += $file->length();
    }
    $data['files'] = $fileCount;
    $data['subdirs'] = $dirCount;
    $data['filessize'] = getSizeStr($sizeSum);
} else {
    $path = $file->getAbsolutePath();
    $wwwroot = removeTrailingSlash(toUnixPath(getWWWRoot($config)));
    $urlprefix = removeTrailingSlash(toUnixPath($config['preview.urlprefix']));
    $urlsuffix = toUnixPath($config['preview.urlsuffix']);
    $pos = strpos($path, $wwwroot);
    if ($pos !== false && $pos == 0) {
        $data['previewurl'] = $urlprefix . substr($path, strlen($wwwroot)) . $urlsuffix;
    }
}
// Redirect
if ($redirect == "true") {
    header('location: ' . $data['previewurl']);
    die;
}
// Render output
renderPage("preview.tpl.php", $data);
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:31,代码来源:preview.php

示例10: mkdir

 function mkdir($path, $chmod = false, $chown = false, $chgrp = false)
 {
     $path = removeTrailingSlash($this->fixPath($path));
     if (empty($path)) {
         return false;
     }
     return $this->link->mkdir($path);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:8,代码来源:fileSystemSFTPExt.php

示例11: foreach

             }
             if ($exists && $overwrite == "yes") {
                 $fileObject->delete();
                 $zip->extract(PCLZIP_OPT_PATH, $targetFile->getAbsolutePath(), PCLZIP_OPT_BY_NAME, $file['filename']);
             } else {
                 if (!$exists) {
                     $zip->extract(PCLZIP_OPT_PATH, $isDir ? $targetFile->getAbsolutePath() : $targetFile->getAbsolutePath(), PCLZIP_OPT_BY_NAME, $file['filename']);
                 }
             }
         }
     }
 }
 // Check what changed
 foreach ($zipcontents as $filecheck) {
     $isDir = $filecheck['folder'] == 1 ? true : false;
     $absolutefilepath = removeTrailingSlash(toUnixPath($targetFile->getAbsolutePath() . "/" . $filecheck['filename']));
     $filecheckObj = $fileFactory->getFile($absolutefilepath, "", $isDir ? MC_IS_DIRECTORY : MC_IS_FILE);
     // Default status message
     $filecheck['status_message'] = "Passed";
     if ($filecheck['status'] == "Accepted") {
         if ($filecheck['exists'] == "No") {
             if ($filecheckObj->exists()) {
                 $filecheckObj->importFile();
                 $filecheck['status'] = "Passed";
                 $filecheck['exists'] = "Yes";
                 $itemsresult[] = $filecheck;
             } else {
                 $filecheck['status'] = "Failed";
                 $filecheck['status_message'] = "Unzip operation failed, file was not unzipped.";
                 $itemsresult[] = $filecheck;
             }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:31,代码来源:unzip.php

示例12: getFileType

    }
    // File info
    $fileType = getFileType($file->getAbsolutePath());
    $fileItem['icon'] = $fileType['icon'];
    $fileItem['type'] = $fileType['type'];
    $even = !$even;
    $fileList[] = $fileItem;
}
$data['files'] = $fileList;
$data['path'] = $path;
$data['hasReadAccess'] = $targetFile->canRead() && checkBool($config["filesystem.readable"]) ? "true" : "false";
$data['hasWriteAccess'] = $targetFile->canWrite() && checkBool($config["filesystem.writable"]) ? "true" : "false";
$data['hasPasteData'] = isset($_SESSION['MCFileManager_clipboardAction']) ? "true" : "false";
$toolsCommands = explode(',', $config['general.tools']);
$newTools = array();
foreach ($toolsCommands as $command) {
    foreach ($tools as $tool) {
        if ($tool['command'] == $command) {
            $newTools[] = $tool;
        }
    }
}
$data['disabled_tools'] = $config['general.disabled_tools'];
$data['tools'] = $newTools;
$data['short_path'] = getUserFriendlyPath($path);
$data['full_path'] = getUserFriendlyPath($path);
$data['errorMsg'] = $errorMsg;
$data['action'] = $action;
$data['imageManagerURLPrefix'] = removeTrailingSlash($config['imagemanager.urlprefix']);
// Render output
renderPage("filelist.tpl.php", $data, $config);
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:31,代码来源:filelist.php

示例13: getUserFriendlyPath

/**
 * Returns the user path, the path that the users sees.
 *
 * @param String $path Absolute file path.
 * @return String Visual path, user friendly path.
 */
function getUserFriendlyPath($path, $max_len = -1)
{
    global $mcImageManagerConfig;
    if (checkBool($mcImageManagerConfig['general.user_friendly_paths'])) {
        $path = substr($path, strlen(removeTrailingSlash(getRealPath($mcImageManagerConfig, 'filesystem.rootpath'))));
        if ($path == "") {
            $path = "/";
        }
    }
    if ($max_len != -1 && strlen($path) > $max_len) {
        $path = "... " . substr($path, strlen($path) - $max_len);
    }
    // Add slash in front
    if (strlen($path) > 0 && $path[0] != '/') {
        $path = "/" . $path;
    }
    return $path;
}
开发者ID:stormlab,项目名称:Stormlab,代码行数:24,代码来源:general.php

示例14: pclZipUnZip

 /**
  * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the PclZip library.
  *
  * @since 3.0.0
  * @see unzip_file
  * @access private
  *
  * @param string $file Full path and filename of zip archive
  * @param string $to Full path on the filesystem to extract archive to
  * @param array $neededDirs A partial list of required folders needed to be created.
  * @return mixed WP_Error on failure, True on success
  */
 function pclZipUnZip($file, $to, $neededDirs = array())
 {
     //global $GLOBALS['FileSystemObj'];
     // See #15789 - PclZip uses string functions on binary data, If it's overloaded with Multibyte safe functions the results are incorrect.
     if (ini_get('mbstring.func_overload') && function_exists('mb_internal_encoding')) {
         $previous_encoding = mb_internal_encoding();
         mb_internal_encoding('ISO-8859-1');
     }
     require_once APP_ROOT . '/lib/pclzip.php';
     $archive = new PclZip($file);
     $archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING);
     if (isset($previous_encoding)) {
         mb_internal_encoding($previous_encoding);
     }
     // Is the archive valid?
     if (!is_array($archive_files)) {
         //return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true));
         appUpdateMsg('Incompatible Archive ' . $archive->errorInfo(true), true);
         return false;
     }
     if (0 == count($archive_files)) {
         //return new WP_Error('empty_archive', __('Empty archive.'));
         appUpdateMsg('Empty archive', true);
         return false;
     }
     // Determine any children directories needed (From within the archive)
     foreach ($archive_files as $file) {
         if ('__MACOSX/' === substr($file['filename'], 0, 9)) {
             // Skip the OS X-created __MACOSX directory
             continue;
         }
         $neededDirs[] = $to . removeTrailingSlash($file['folder'] ? $file['filename'] : dirname($file['filename']));
     }
     $neededDirs = array_unique($neededDirs);
     foreach ($neededDirs as $dir) {
         // Check the parent folders of the folders all exist within the creation array.
         if (removeTrailingSlash($to) == $dir) {
             // Skip over the working directory, We know this exists (or will exist)
             continue;
         }
         if (strpos($dir, $to) === false) {
             // If the directory is not within the working directory, Skip it
             continue;
         }
         $parentFolder = dirname($dir);
         while (!empty($parentFolder) && removeTrailingSlash($to) != $parentFolder && !in_array($parentFolder, $neededDirs)) {
             $neededDirs[] = $parentFolder;
             $parentFolder = dirname($parentFolder);
         }
     }
     asort($neededDirs);
     // Create those directories if need be:
     foreach ($neededDirs as $_dir) {
         if (!$GLOBALS['FileSystemObj']->mkDir($_dir, FS_CHMOD_DIR) && !$GLOBALS['FileSystemObj']->isDir($_dir)) {
             // Only check to see if the dir exists upon creation failure. Less I/O this way.
             //return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir);
             appUpdateMsg('Could not create directory while unzipping(pclZip) ' . $_dir, true);
             return false;
         }
     }
     unset($neededDirs);
     // Extract the files from the zip
     foreach ($archive_files as $file) {
         if ($file['folder']) {
             continue;
         }
         if ('__MACOSX/' === substr($file['filename'], 0, 9)) {
             // Don't extract the OS X-created __MACOSX directory files
             continue;
         }
         if (!$GLOBALS['FileSystemObj']->putContents($to . $file['filename'], $file['content'], FS_CHMOD_FILE)) {
             //return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']);
             appUpdateMsg('Could not copy file ' . $to . $file['filename'], true);
             return false;
         }
     }
     return true;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:90,代码来源:fileSystemBase.php

示例15: getRepositoryUrl

 /**
  * Get repository full URL
  * 
  * @return string
  */
 public function getRepositoryUrl()
 {
     return removeTrailingSlash($this->payload->canon_url . $this->payload->repository->absolute_url);
 }
开发者ID:jwcastillo,项目名称:deeployer,代码行数:9,代码来源:Bitbucket.php


注:本文中的removeTrailingSlash函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。