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


PHP path::clean方法代码示例

本文整理汇总了PHP中path::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP path::clean方法的具体用法?PHP path::clean怎么用?PHP path::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在path的用法示例。


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

示例1: decode

 public static function decode($path)
 {
     $p = array('$modules' => ZPATH_MODULES);
     $path = strtr($path, $p);
     $path = path::clean($path);
     return $path;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:7,代码来源:path.php

示例2: actionSelect

 public function actionSelect($field = '', $dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $path = site::template();
     $path = $path . DS . str_replace('/', DS, $dir);
     $path = path::clean($path);
     $folders = folder::folders($path);
     $files = folder::files($path);
     $position = '<a href="' . zotop::url('system/template/select') . '">' . zotop::t('根目录') . '</a><em> : //</em> ';
     if (!empty($dir)) {
         $dirs = arr::dirpath($dir, '/');
         foreach ($dirs as $d) {
             $position .= '<a href="' . zotop::url('system/template/select', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a> <em>/</em>';
         }
     }
     $page = new dialog();
     $page->title = zotop::t('模板管理');
     $page->set('field', $field);
     $page->set('dir', $dir);
     $page->set('position', $position);
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:25,代码来源:template.php

示例3: decode

 public static function decode($path)
 {
     $p = array('$system' => ZOTOP_PATH_SYSTEM, '$modules' => ZOTOP_PATH_MODULES);
     $path = strtr($path, $p);
     $path = path::clean($path);
     return $path;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:7,代码来源:path.php

示例4: delete

 /**
  * 删除文件
  * @param string $file
  * @return boolean
  */
 public static function delete($file)
 {
     if (file::exists($file)) {
         $file = path::clean($file);
         return @unlink($file);
     }
     return true;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:13,代码来源:file.php

示例5: includeFile

 public function includeFile($attr)
 {
     if (!isset($attr['src'])) {
         return;
     }
     $src = path::clean($attr['src']);
     $tpl_file = $this->getFilePath($src);
     if (!$tpl_file) {
         return;
     }
     if (in_array($tpl_file, $this->compile_stack)) {
         return;
     }
     return '<?php try { ' . 'echo ' . $this->self_name . "->getData('" . str_replace("'", "\\'", $src) . "'); " . '} catch (Exception $e) {} ?>';
 }
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:15,代码来源:class.template.php

示例6: install

 public function install($id, $path = '')
 {
     $path = empty($path) ? $id : $path;
     $modulePath = ZOTOP_MODULES . DS . $id;
     $modulePath = path::clean($modulePath);
     $moduleFile = $modulePath . DS . 'module.php';
     $module = @(include $moduleFile);
     $module['path'] = $path;
     $module['type'] = '1';
     $module['url'] = $path;
     $module['status'] = 1;
     $module['order'] = $this->max() + 1;
     $module['installtime'] = time::now();
     $module['updatetime'] = time::now();
     if (is_array($module)) {
         $insert = $this->insert($module);
         if ($insert) {
             return $this->reload();
         }
     }
     return false;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:22,代码来源:module.php

示例7: actionIndex

 public function actionIndex($dir = '')
 {
     $dir = url::clean($dir);
     $path = ZOTOP_PATH_ROOT . DS . trim($dir, DS);
     $path = path::clean($path);
     //获取当前目录的子目录及子文件
     $folders = (array) dir::folders($path);
     $files = (array) dir::files($path);
     $position = '<a href="' . zotop::url('webftp/index/index') . '">wwwroot</a>';
     $dirs = arr::dirpath($dir, '/');
     foreach ($dirs as $d) {
         $position .= ' / <a href="' . zotop::url('webftp/index/index', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a>';
     }
     $page = new page();
     $page->title = '文件管理器';
     $page->set('position', $position);
     $page->set('navbar', $this->navbar($dir));
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->set('path', $path);
     $page->set('dir', $dir);
     $page->display();
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:23,代码来源:index.php

示例8: file

 public static function file($file, $value = '', $expire = 0)
 {
     static $files = array();
     $file = path::clean($file);
     //echo $file.'<br>';
     if ('' !== $value) {
         if (is_null($value)) {
             $result = unlink($file);
             if ($result) {
                 unset($files[$file]);
             }
             return $result;
         } else {
             $content = "<?php\nif (!defined('ZOTOP')) exit();\n//" . sprintf('%012d', $expire) . "\nreturn " . var_export($value, true) . ";\n?>";
             $result = file_put_contents($file, $content);
             $files[$file] = $value;
         }
         return true;
     }
     if (isset($files[$file])) {
         return $files[$file];
     }
     if (file_exists($file) && false !== ($content = file_get_contents($file))) {
         //注意:Dreamweaver会在文件最前面插入两个未知字符,39
         $expire = (int) substr($content, strpos($content, '//') + 2, 12);
         if ($expire != 0 && time() > filemtime($file) + $expire) {
             //过期删除
             unlink($file);
             return false;
         }
         $value = eval(substr($content, strpos($content, '//') + 14, -2));
         $files[$file] = $value;
     } else {
         $value = false;
     }
     return $value;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:37,代码来源:zotop.php

示例9: newMediaObject

 private function newMediaObject($blog_id, $user, $pwd, $file)
 {
     if (empty($file['name'])) {
         throw new Exception('No file name');
     }
     if (empty($file['bits'])) {
         throw new Exception('No file content');
     }
     $file_name = $file['name'];
     $file_bits = base64_decode($file['bits']);
     $this->setUser($user, $pwd);
     $this->setBlog();
     $media = new dcMedia($this->core);
     $dir_name = path::clean(dirname($file_name));
     $file_name = basename($file_name);
     $dir_name = preg_replace('!^/!', '', $dir_name);
     if ($dir_name != '') {
         $dir = explode('/', $dir_name);
         $cwd = './';
         foreach ($dir as $v) {
             $v = files::tidyFileName($v);
             $cwd .= $v . '/';
             $media->makeDir($v);
             $media->chdir($cwd);
         }
     }
     $media_id = $media->uploadBits($file_name, $file_bits);
     $f = $media->getFile($media_id);
     return array('file' => $file_name, 'url' => $f->file_url, 'type' => files::getMimeType($file_name));
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:30,代码来源:class.dc.xmlrpc.php

示例10: removeDir

 /**
  * Remove item
  *
  * Removes a directory <var>$d</var> which is relative to working directory.
  *
  * @param string	$d			Directory to remove
  */
 public function removeDir($d)
 {
     $d = path::real($this->pwd . '/' . path::clean($d));
     if (!$this->inJail($d)) {
         throw new Exception(__('Directory is not in jail.'));
     }
     if (!files::isDeletable($d)) {
         throw new Exception(__('Directory cannot be removed.'));
     }
     if (@rmdir($d) === false) {
         throw new Exception(__('Directory cannot be removed.'));
     }
 }
开发者ID:HackerMajor,项目名称:root,代码行数:20,代码来源:class.filemanager.php

示例11: jsCandyUpload

 public static function jsCandyUpload($params = array(), $base_url = null)
 {
     if (!$base_url) {
         $base_url = path::clean(dirname(preg_replace('/(\\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/';
     }
     $params = array_merge($params, array('sess_id=' . session_id(), 'sess_uid=' . $_SESSION['sess_browser_uid'], 'xd_check=' . $GLOBALS['core']->getNonce()));
     return '<link rel="stylesheet" type="text/css" href="style/candyUpload/style.css" />' . "\n" . self::jsLoad('js/jquery/jquery.candyUpload.js') . '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . "dotclear.candyUpload = {};\n" . self::jsVar('dotclear.msg.activate_enhanced_uploader', __('Activate enhanced uploader')) . self::jsVar('dotclear.msg.disable_enhanced_uploader', __('Disable enhanced uploader')) . self::jsVar('$._candyUpload.prototype.locales.file_uploaded', __('File successfully uploaded.')) . self::jsVar('$._candyUpload.prototype.locales.max_file_size', __('Maximum file size allowed:')) . self::jsVar('$._candyUpload.prototype.locales.limit_exceeded', __('Limit exceeded.')) . self::jsVar('$._candyUpload.prototype.locales.size_limit_exceeded', __('File size exceeds allowed limit.')) . self::jsVar('$._candyUpload.prototype.locales.canceled', __('Canceled.')) . self::jsVar('$._candyUpload.prototype.locales.http_error', __('HTTP Error:')) . self::jsVar('$._candyUpload.prototype.locales.error', __('Error:')) . self::jsVar('$._candyUpload.prototype.locales.choose_file', __('Choose file')) . self::jsVar('$._candyUpload.prototype.locales.choose_files', __('Choose files')) . self::jsVar('$._candyUpload.prototype.locales.cancel', __('Cancel')) . self::jsVar('$._candyUpload.prototype.locales.clean', __('Clean')) . self::jsVar('$._candyUpload.prototype.locales.upload', __('Upload')) . self::jsVar('$._candyUpload.prototype.locales.no_file_in_queue', __('No file in queue.')) . self::jsVar('$._candyUpload.prototype.locales.file_in_queue', __('1 file in queue.')) . self::jsVar('$._candyUpload.prototype.locales.files_in_queue', __('%d files in queue.')) . self::jsVar('$._candyUpload.prototype.locales.queue_error', __('Queue error:')) . self::jsVar('dotclear.candyUpload.base_url', $base_url) . self::jsVar('dotclear.candyUpload.movie_url', $base_url . 'index.php?pf=swfupload.swf') . self::jsVar('dotclear.candyUpload.params', implode('&', $params)) . "\n//]]>\n" . "</script>\n";
 }
开发者ID:HackerMajor,项目名称:root,代码行数:8,代码来源:lib.dc.page.php

示例12: removeFile

 /**
 Removes a file.
 
 @param	f		<b>fileItem</b>	fileItem object
 */
 public function removeFile($f)
 {
     if (!$this->okt->checkPerm('media') && !$this->okt->checkPerm('media_admin')) {
         throw new Exception(__('Permission denied.'));
     }
     $media_file = $this->relpwd ? path::clean($this->relpwd . '/' . $f) : path::clean($f);
     $strReq = 'DELETE FROM ' . $this->t_media . ' ' . "WHERE media_path = '" . $this->db->escapeStr($this->path) . "' " . "AND media_file = '" . $this->db->escapeStr($media_file) . "' ";
     if (!$this->okt->checkPerm('media_admin')) {
         $strReq .= 'AND user_id = ' . (int) $this->okt->user->id . ' ';
     }
     $this->db->execute($strReq);
     if ($this->db->affectedRows() == 0) {
         throw new Exception(__('File does not exist in the database.'));
     }
     parent::removeFile($f);
     $this->callFileHandler(files::getMimeType($media_file), 'remove', $f);
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:22,代码来源:class.oktMedia.php

示例13: getimagesize

    $S = getimagesize($file->file);
    echo '<li><strong>' . __('Image width:') . '</strong> ' . $S[0] . ' px</li>' . '<li><strong>' . __('Image height:') . '</strong> ' . $S[1] . ' px</li>';
    unset($S);
}
echo '<li><strong>' . __('File size:') . '</strong> ' . files::size($file->size) . '</li>' . '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->file_url . '">' . $file->file_url . '</a></li>' . '</ul>';
if (empty($_GET['find_posts'])) {
    echo '<p><a class="button" href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("find_posts" => 1, "tab" => "media-details-tab"))) . '">' . __('Show entries containing this media') . '</a></p>';
} else {
    echo '<h3>' . __('Entries containing this media') . '</h3>';
    $params = array('post_type' => '', 'from' => 'LEFT OUTER JOIN ' . $core->prefix . 'post_media PM ON P.post_id = PM.post_id ', 'sql' => 'AND (' . 'PM.media_id = ' . (int) $id . ' ' . "OR post_content_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' " . "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' ");
    if ($file->media_image) {
        # We look for thumbnails too
        if (preg_match('#^http(s)?://#', $core->blog->settings->system->public_url)) {
            $media_root = $core->blog->settings->system->public_url;
        } else {
            $media_root = $core->blog->host . path::clean($core->blog->settings->system->public_url) . '/';
        }
        foreach ($file->media_thumb as $v) {
            $v = preg_replace('/^' . preg_quote($media_root, '/') . '/', '', $v);
            $params['sql'] .= "OR post_content_xhtml LIKE '%" . $core->con->escape($v) . "%' ";
            $params['sql'] .= "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($v) . "%' ";
        }
    }
    $params['sql'] .= ') ';
    $rs = $core->blog->getPosts($params);
    if ($rs->isEmpty()) {
        echo '<p>' . __('No entry seems contain this media.') . '</p>';
    } else {
        echo '<ul>';
        while ($rs->fetch()) {
            $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:media_item.php

示例14: dirname

# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('admin');
# -- Loading themes --
$core->themes = new dcThemes($core);
$core->themes->loadModules($core->blog->themes_path, null);
# -- Page helper --
$list = new adminThemesList($core->themes, $core->blog->themes_path, $core->blog->settings->system->store_theme_url);
adminThemesList::$distributed_modules = explode(',', DC_DISTRIB_THEMES);
# -- Theme screenshot --
if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) {
    $f = path::real(empty($_GET['src']) ? $core->blog->themes_path . '/' . $_GET['shot'] . '/screenshot.jpg' : $core->blog->themes_path . '/' . $_GET['shot'] . '/' . path::clean($_GET['src']));
    if (!file_exists($f)) {
        $f = dirname(__FILE__) . '/images/noscreenshot.png';
    }
    http::cache(array_merge(array($f), get_included_files()));
    header('Content-Type: ' . files::getMimeType($f));
    header('Content-Length: ' . filesize($f));
    readfile($f);
    exit;
}
# -- Display module configuration page --
if ($list->setConfiguration($core->blog->settings->system->theme)) {
    # Get content before page headers
    include $list->includeConfiguration();
    # Gather content
    $list->getConfiguration();
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:blog_theme.php

示例15: exists

 function exists($path)
 {
     return is_dir(path::clean($path));
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:4,代码来源:folder.php


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