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


PHP fixPath函数代码示例

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


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

示例1: start_comment_feed

function start_comment_feed()
{
    global $atom, $atom_items, $build, $Current_user, $Weblogs, $Current_weblog, $Paths, $Users, $Cfg;
    $link = $Paths['host'] . fixPath($Paths['pivot_url'] . $Weblogs[$Current_weblog]['front_path'] . $Weblogs[$Current_weblog]['front_filename']);
    $link_self = $Paths['host'] . $Paths['pivot_url'] . "commentsfeed.php";
    if (!empty($_SERVER['QUERY_STRING'])) {
        $link_self .= "?" . $_SERVER['QUERY_STRING'];
    }
    $atom_preamble = '<?xml version="1.0" encoding="%charset%"?' . '>
<feed xmlns="http://www.w3.org/2005/Atom"
	xml:lang="%lang%">
	<title>%title% - Comments</title>
	<subtitle>%description%</subtitle>
	<link rel="alternate" type="text/html" href="%link%"/>
	<link rel="self" type="application/atom+xml" href="%link_self%"/>
        <updated>%date%</updated>
        <author>
		<name>%admin-nick%</name>
		<uri>%link%</uri>
		<email>%admin-email%</email>
	</author>
	<id>tag:%sitename_safe%,%year%:%title_safe%</id>
	<generator uri="http://www.pivotlog.net" version="%version%">Pivot</generator>
	<rights>Copyright (c) %year%, Authors of %sitename%</rights>
';
    reset($Users);
    $user = each($Users);
    $user = $user['value'];
    $from = array("%title%", "%title_safe%", "%sitename%", "%sitename_safe%", "%link%", "%link_self%", "%description%", "%author%", "%admin-email%", "%admin-nick%", "%year%", "%date%", "%genagent%", "%version%", "%lang%", "%charset%");
    $to = array(str_replace("&", "&amp;", $Weblogs[$Current_weblog]['name']), str_replace("_", "", safe_string($Weblogs[$Current_weblog]['name'], TRUE)), $Cfg['sitename'], strtolower(str_replace("_", "", safe_string($Cfg['sitename'], TRUE))), $link, $link_self, $Weblogs[$Current_weblog]['payoff'], $Current_user, $user['email'], $user['nick'], date("Y"), date("Y-m-d\\TH:i:s") . rss_offset(), "http://www.pivotlog.net/?ver=" . urlencode($build), $build, snippet_lang(), snippet_charset());
    $atom = str_replace($from, $to, $atom_preamble);
    $atom_items = array();
}
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:33,代码来源:commentsfeed.php

示例2: mkDir

 /**
  * Makes the directory
  * @param string $dirname
  * @param integer $mode
  */
 public function mkDir($dirname, $mode = 0777)
 {
     $dirname = fixPath($dirname);
     if (!file_exists($dirname)) {
         $old = umask(0);
         mkdir($this->config('rootPath') . $dirname, $mode, true);
         chmod($this->config('rootPath') . $dirname, $mode);
         umask($old);
     }
 }
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:15,代码来源:update.php

示例3: listPath

function listPath($path)
{
    global $config;
    $path = fixPath($path);
    $path = rtrim($path, '/');
    if (accessLevel($path) < 1) {
        return array('type' => 'nope', 'path' => $path);
    }
    if (is_dir($config['files'] . $path)) {
        return listDir($path);
    }
    if (is_file($config['files'] . $path)) {
        return listFile($path);
    }
    return list404();
}
开发者ID:Dirbaio,项目名称:TurboFile,代码行数:16,代码来源:list.php

示例4: GetDirs

function GetDirs($path, $type)
{
    $ret = $sort = array();
    $files = listDirectory(fixPath($path), 0);
    foreach ($files as $f) {
        $fullPath = $path . '/' . $f;
        if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') {
            continue;
        }
        $tmp = getFilesNumber(fixPath($fullPath), $type);
        $ret[$fullPath] = array('path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']);
        $sort[$fullPath] = $f;
    }
    natcasesort($sort);
    foreach ($sort as $k => $v) {
        $tmp = $ret[$k];
        echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
        GetDirs($tmp['path'], $type);
    }
}
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:20,代码来源:dirtree.php

示例5: liubo

  For licensing, see LICENSE.txt or http://RoxyFileman.com/license

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('DELETEFILE');
checkAccess('DELETEFILE');
$path = trim($_GET['f']);
verifyPath($path);
if (is_file(fixPath($path))) {
    if (unlink(fixPath($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_DeletеFile') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_DeleteFileInvalidPath'));
}
开发者ID:fzlrhmn,项目名称:sanitasi-salatiga,代码行数:31,代码来源:deletefile.php

示例6: liubo

  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('MOVEFILE');
checkAccess('MOVEFILE');
$path = trim(empty($_GET['f']) ? '' : $_GET['f']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
if (!$newPath) {
    $newPath = getFilesPath();
}
verifyPath($path);
verifyPath($newPath);
if (is_file(fixPath($path))) {
    if (file_exists(fixPath($newPath))) {
        echo getErrorRes(t('E_MoveFileAlreadyExists') . ' ' . basename($newPath));
    } elseif (rename(fixPath($path), fixPath($newPath))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_MoveFile') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_MoveFileInvalisPath'));
}
开发者ID:famry,项目名称:fameCMSv2,代码行数:31,代码来源:movefile.php

示例7: snippet_archive_list

function snippet_archive_list()
{
    global $Weblogs, $Current_weblog, $Archive_array, $Archive_array_html, $Paths;
    if ($Weblogs[$Current_weblog]['archive_unit'] == "none") {
        // if no archives are needed, just return.
        return "";
    }
    // if not yet done, load / make the array of archive filenames (together
    // with at least one date)
    if (!isset($Archive_array)) {
        make_archive_array();
    }
    // if not yet done, compile the html for this archive list
    if (!isset($Archive_array_html[$Current_weblog])) {
        $output = "";
        // maybe flip and reverse it.
        // 2004/11/23 =*=*= JM - changes to avoid array errors
        if (is_array($Archive_array[$Current_weblog])) {
            if ($Weblogs[$Current_weblog]['archive_order'] == 'descending') {
                $mylist = $Archive_array[$Current_weblog];
            } else {
                $mylist = array_reverse($Archive_array[$Current_weblog]);
            }
            foreach ($mylist as $file => $date) {
                // make Mark proud, and make a nice absolute url for the archive..
                $filelink = $Paths['pivot_url'] . $Weblogs[$Current_weblog]['archive_path'] . $file;
                $filelink = fixPath($filelink);
                // fix the rest of the string..
                list($start_date, $stop_date) = getdaterange($date, $Weblogs[$Current_weblog]['archive_unit']);
                $this_output = format_date_range($start_date, $stop_date, $Weblogs[$Current_weblog]['archive_linkfile']);
                $this_output = str_replace("%url%", $filelink, $this_output);
                $output .= "\n" . $this_output;
            }
        }
        // store it for quick access later on..
        $Archive_array_html[$Current_weblog] = $output;
    } else {
        // goodie, it's alread been done, so we just retrieve it.
        $output = $Archive_array_html[$Current_weblog];
    }
    return stripslashes($output);
}
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:42,代码来源:module_snippets.php

示例8: liubo

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('MOVEDIR');
checkAccess('MOVEDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
verifyPath($newPath);
if (is_dir(fixPath($path))) {
    if (mb_strpos($newPath, $path) === 0) {
        echo getErrorRes(t('E_CannotMoveDirToChild'));
    } elseif (file_exists(fixPath($newPath) . '/' . basename($path))) {
        echo getErrorRes(t('E_DirAlreadyExists'));
    } elseif (rename(fixPath($path), fixPath($newPath) . '/' . basename($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_MoveDir') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_MoveDirInvalisPath'));
}
开发者ID:fzlrhmn,项目名称:sanitasi-salatiga,代码行数:31,代码来源:movedir.php

示例9: getFilePath

 /**
  * Return path to the file which can be overridden in the theme
  * @static
  * @param string $theme_name
  * @param string $type
  * @param string $module
  * @param string $filename
  * @return string|false
  */
 public static function getFilePath($theme_name, $type, $module, $filename)
 {
     static $noOverrideTypes = array('models', 'structs', 'classes');
     if (in_array($type, $noOverrideTypes)) {
         $theme_name = 'default';
     }
     if (!$theme_name) {
         $theme_name = self::getCurrentTheme();
     }
     $filename = fixPath($filename);
     $tail = $module . DS . $type . DS . $filename;
     $overriddenThemes = array();
     while (!file_exists($originalFile = self::getFilePathInTheme($tail, $theme_name))) {
         if (empty($theme_name) || $theme_name == 'default') {
             return false;
         }
         //Found nothing!
         $overriddenThemes[] = $theme_name;
         $config = self::getThemeConfig($theme_name);
         $theme_name = $config && !empty($config['parent_theme']) && !in_array($theme_name, $overriddenThemes) && self::themeExists($config['parent_theme']) ? $config['parent_theme'] : 'default';
     }
     if (!is_file($originalFile)) {
         throw new rad_exception("Fatal error discovered while trying to find file {$filename} in module {$module}: {$originalFile} is not a file!");
     }
     return $originalFile;
 }
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:35,代码来源:class.themer.php

示例10: menuHelper

 /**
  * Updates a menu item to have at least a 'link' key.
  *
  * @param  array $item
  * @return array Keys 'link' and possibly 'label', 'title' and 'path'
  */
 private function menuHelper($item)
 {
     if (isset($item['submenu']) && is_array($item['submenu'])) {
         $item['submenu'] = $this->menuHelper($item['submenu']);
     }
     if (isset($item['path']) && $item['path'] == "homepage") {
         $item['link'] = $this->app['paths']['root'];
     } elseif (isset($item['route'])) {
         $param = empty($item['param']) ? array() : $item['param'];
         $add = empty($item['add']) ? '' : $item['add'];
         $item['link'] = path($item['route'], $param, $add);
     } elseif (isset($item['path'])) {
         // if the item is like 'content/1', get that content.
         if (preg_match('#^([a-z0-9_-]+)/([a-z0-9_-]+)$#i', $item['path'])) {
             $content = $this->app['storage']->getContent($item['path']);
         }
         if (!empty($content) && is_object($content) && get_class($content) == 'Bolt\\Content') {
             // We have content.
             if (empty($item['label'])) {
                 $item['label'] = !empty($content->values['title']) ? $content->values['title'] : "";
             }
             if (empty($item['title'])) {
                 $item['title'] = !empty($content->values['subtitle']) ? $content->values['subtitle'] : "";
             }
             if (is_object($content)) {
                 $item['link'] = $content->link();
             }
             $item['record'] = $content;
         } else {
             // we assume the user links to this on purpose.
             $item['link'] = fixPath($this->app['paths']['root'] . $item['path']);
         }
     }
     return $item;
 }
开发者ID:LeonB,项目名称:site,代码行数:41,代码来源:TwigExtension.php

示例11: verifyAction

verifyAction('FILESLIST');
checkAccess('FILESLIST');
$path = empty($_GET['d']) ? getFilesPath() : $_GET['d'];
$type = empty($_GET['type']) ? '' : strtolower($_GET['type']);
if ($type != 'image' && $type != 'flash') {
    $type = '';
}
verifyPath($path);
$files = listDirectory(fixPath($path), 0);
natcasesort($files);
$str = '';
echo '[';
foreach ($files as $f) {
    $fullPath = $path . '/' . $f;
    if (!is_file(fixPath($fullPath)) || $type == 'image' && !RoxyFile::IsImage($f) || $type == 'flash' && !RoxyFile::IsFlash($f)) {
        continue;
    }
    $size = filesize(fixPath($fullPath));
    $time = filemtime(fixPath($fullPath));
    $tmp = @getimagesize(fixPath($fullPath));
    $w = 0;
    $h = 0;
    if ($tmp) {
        $w = $tmp[0];
        $h = $tmp[1];
    }
    $str .= '{"p":"' . mb_ereg_replace('"', '\\"', $fullPath) . '","s":"' . $size . '","t":"' . $time . '","w":"' . $w . '","h":"' . $h . '"},';
}
$str = mb_substr($str, 0, -1);
echo $str;
echo ']';
开发者ID:famry,项目名称:fameCMSv2,代码行数:31,代码来源:fileslist.php

示例12: error_reporting

<?php

error_reporting(E_ALL);
require_once dirname(__FILE__) . '/../infra/kConf.php';
$interactive = true;
if ($argc == 2 && $argv[1] == '-y') {
    $interactive = false;
}
// clear kConf defined cache directories
$path = realpath(kConf::get('cache_root_path'));
askToDelete(fixPath(kConf::get('general_cache_dir')), $interactive);
askToDelete(fixPath(kConf::get('response_cache_dir')), $interactive);
askToDelete(fixPath(kConf::get('cache_root_path')), $interactive);
// clear APC cache
if (function_exists('apc_clear_cache')) {
    // clear apc system cache
    if (!apc_clear_cache()) {
        echo 'Unable to clear APC SYSTEM cache!' . PHP_EOL;
    }
    // clear apc user cache
    if (!apc_clear_cache('user')) {
        echo 'Unable to clear APC USER cache!' . PHP_EOL;
    }
}
function fixPath($path)
{
    $path = str_replace('\\', '/', $path);
    return realpath($path);
}
function askToDelete($path, $interactive)
{
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:clear_cache.php

示例13: liubo

  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('RENAMEDIR');
checkAccess('RENAMEDIR');
$path = trim(empty($_POST['d']) ? '' : $_POST['d']);
$name = trim(empty($_POST['n']) ? '' : $_POST['n']);
verifyPath($path);
if (is_dir(fixPath($path))) {
    if (fixPath($path . '/') == fixPath(getFilesPath() . '/')) {
        echo getErrorRes(t('E_CannotRenameRoot'));
    } elseif (rename(fixPath($path), dirname(fixPath($path)) . '/' . $name)) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_RenameDir') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_RenameDirInvalidPath'));
}
开发者ID:keremcankaya0,项目名称:CakeBlog,代码行数:31,代码来源:renamedir.php

示例14: mkDir

 /**
  * Makes the directory
  * @param string $dirname
  * @param integer $mode
  */
 public function mkDir($dirname, $mode = 0777)
 {
     $dirname = fixPath($dirname);
     $root = '';
     foreach (explode(DS, $dirname) as $cat) {
         $root .= $cat . DS;
         if (!file_exists($root)) {
             $old = umask(0);
             mkdir($root, $mode, true);
             chmod($root, $mode);
             umask($old);
         }
     }
 }
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:19,代码来源:class.update.php

示例15: _renewCache

 private static function _renewCache($module, $file, $type)
 {
     $filename = fixPath($file);
     $cacheFile = CACHEPATH . $type . DS . self::$themeName . DS . $module . DS . $filename;
     $cachePath = dirname($cacheFile);
     if (!file_exists($cachePath)) {
         recursive_mkdir($cachePath);
     }
     if (file_exists($cacheFile) && time() - filemtime($cacheFile) < rad_config::getParam('cache.power.time')) {
         return true;
     }
     if ($fname = rad_themer::getFilePath(self::$themeName, 'jscss', $module, $filename)) {
         return self::copyToCache($fname, $cacheFile);
     }
     return false;
 }
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:16,代码来源:class.jscss.php


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