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


PHP normalize_path函数代码示例

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


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

示例1: user_styles_css

function user_styles_css($params)
{
    if (!is_array($params)) {
        $template_name = $params;
    } else {
        extract($params);
    }
    if (!isset($template_name)) {
        exit;
    }
    $template_name = str_replace('..', '', $template_name);
    if (defined('TEMPLATE_NAME') == false) {
        define('TEMPLATE_NAME', $template_name);
    }
    $custom_fn = TEMPLATES_DIR . $template_name;
    // d( $custom_fn);
    if (is_dir($custom_fn)) {
        $custom_fn = $custom_fn . DS . 'global_styles.php';
        $custom_fn = normalize_path($custom_fn, false);
        if (is_file($custom_fn)) {
            header("Content-type: text/css", true);
            include $custom_fn;
            exit;
        }
        //d( $custom_fn);
    }
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:27,代码来源:unctions.php

示例2: rglob

/**
 *
 *
 * Recursive glob()
 *
 * @access public
 * @package Utils
 * @category Files
 *
 * @uses is_array()
 * @param int|string $pattern
 * the pattern passed to glob()
 * @param int $flags
 * the flags passed to glob()
 * @param string $path
 * the path to scan
 * @return mixed
 * an array of files in the given path matching the pattern.
 */
function rglob($pattern = '*', $flags = 0, $path = '')
{
    if (!$path && ($dir = dirname($pattern)) != '.') {
        if ($dir == '\\' || $dir == '/') {
            $dir = '';
        }
        return rglob(basename($pattern), $flags, $dir . DS);
    }
    $path = normalize_path($path, 1);
    $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
    $files = glob($path . $pattern, $flags);
    if (is_array($paths)) {
        foreach ($paths as $p) {
            $temp = rglob($pattern, false, $p . DS);
            if (is_array($temp) and is_array($files) and !empty($files)) {
                $files = array_merge($files, $temp);
            } else {
                if (is_array($temp) and !empty($temp)) {
                    $files = $temp;
                }
            }
        }
    }
    return $files;
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:44,代码来源:filesystem.php

示例3: installTemplateContent

 private function installTemplateContent($template_name)
 {
     $default_content_folder = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR;
     $default_content_file = $default_content_folder . 'mw_default_content.zip';
     if ($template_name) {
         if (function_exists('templates_path')) {
             $template_dir = templates_path() . DS . $template_name;
             $template_dir = normalize_path($template_dir, true);
             if (is_dir($template_dir)) {
                 $template_default_content = $template_dir . 'mw_default_content.zip';
                 if (is_file($template_default_content) and is_readable($template_default_content)) {
                     $default_content_file = $template_default_content;
                     $default_content_folder = $template_dir;
                 }
             }
         }
     }
     if (is_file($default_content_file)) {
         $restore = new \Microweber\Utils\Backup();
         $restore->backups_folder = $default_content_folder;
         $restore->backup_file = 'mw_default_content.zip';
         ob_start();
         try {
             $rest = $restore->exec_restore();
         } catch (Exception $e) {
             return false;
         }
         ob_get_clean();
         return true;
     } else {
         return false;
     }
 }
开发者ID:Git-Host,项目名称:microweber,代码行数:33,代码来源:TemplateInstaller.php

示例4: get_parent

 public function get_parent(&$cache)
 {
     $parent_abs_path = normalize_path(dirname($this->abs_path));
     if (starts_with($parent_abs_path, $this->app->get_root_abs_path())) {
         return Entry::get($this->app, $parent_abs_path, $cache);
     }
     return null;
 }
开发者ID:avidys,项目名称:camunda.org,代码行数:8,代码来源:Entry.php

示例5: userfiles_path

function userfiles_path()
{
    static $folder;
    if (!$folder) {
        $folder = normalize_path(public_path() . DIRECTORY_SEPARATOR . MW_USERFILES_FOLDER_NAME . DIRECTORY_SEPARATOR);
    }
    return $folder;
}
开发者ID:microweber,项目名称:microweber,代码行数:8,代码来源:paths.php

示例6: __construct

 public function __construct($composer_path = false)
 {
     if ($composer_path == false) {
         $composer_path = normalize_path(base_path() . '/', false);
     }
     $this->composer_home = $composer_path;
     putenv('COMPOSER_HOME=' . $composer_path);
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:8,代码来源:ComposerUpdate.php

示例7: get_abs_path

 public function get_abs_path($abs_href = null)
 {
     if ($abs_href === null) {
         return $this->abs_path;
     }
     $abs_href = substr($abs_href, strlen($this->root_abs_href));
     return normalize_path($this->root_abs_path . "/" . rawurldecode($abs_href));
 }
开发者ID:avidys,项目名称:camunda.org,代码行数:8,代码来源:App.php

示例8: path_segment

 /**
  * Obtiene un segmento de una ruta a partir de la posición de la
  * primera ocurrencia de un substring en $needle.
  *
  * @param  string  $path
  * @param  string  $needle
  * @return mixed
  */
 function path_segment($path, $needle)
 {
     if ($path) {
         $path = normalize_path($path);
         $path = substr($path, strrpos($path, $needle, 0) - 1);
     } else {
         $path = null;
     }
     return $path;
 }
开发者ID:egalink,项目名称:fastener,代码行数:18,代码来源:Paths.php

示例9: to_path

 function to_path($path)
 {
     if (trim($path) == '') {
         return false;
     }
     $path = str_ireplace($this->site_url(), MW_ROOTPATH, $path);
     $path = str_replace('\\', '/', $path);
     $path = str_replace('//', '/', $path);
     return normalize_path($path, false);
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:10,代码来源:UrlManager.php

示例10: createStaticFolderQuery

 public function createStaticFolderQuery()
 {
     $target_path = normalize_path(APPPATH . '../static');
     $link_path = normalize_path(APPPATH . 'static/common');
     @$this->_symlink($target_path, $link_path);
     $target_path = normalize_path(PLUGINSPATH . 'static');
     $link_path = normalize_path(APPPATH . 'static/plugins');
     @$this->_symlink($target_path, $link_path);
     return $this->success(array('title' => '指向成功', 'content' => 'static目录指向成功'), FALSE);
 }
开发者ID:unionbt,项目名称:hanpaimall,代码行数:10,代码来源:ToolsController.php

示例11: setSettingWatermarkFilePath

 /**
  * @param string $path
  */
 public function setSettingWatermarkFilePath($path)
 {
     $path = normalize_path($path);
     if ($this->isImage($path)) {
         $imagePath = $this->folderPath($path);
         $this->fieldSettings['watermark_file_path'] = $imagePath;
         $this->fieldSettings['watermark'] = true;
     } else {
         $this->fieldSettings['watermark'] = false;
         $this->fieldSettings['watermark_file_path'] = null;
     }
 }
开发者ID:KodiComponents,项目名称:module-datasource,代码行数:15,代码来源:Image.php

示例12: run

 public function run()
 {
     $removed = 0;
     $value = mw()->cache_manager->get('create_batch', $this->cache_group);
     if (isset($value['total']) and $value['total'] > 0) {
         if (isset($value['remaining']) and $value['remaining'] > 0) {
             $batch = mw()->media_manager->get_all('limit=30000');
             if ($batch) {
                 foreach ($batch as $k => $v) {
                     if (isset($v['id']) and isset($v['filename']) and $v['filename'] != false) {
                         $process = false;
                         if (stristr($v['filename'], '{SITE_URL}')) {
                             $process = true;
                         } else {
                             if (stristr($v['filename'], site_url())) {
                                 $process = true;
                             }
                         }
                         if ($process) {
                             $v['filename'] = str_ireplace('{SITE_URL}', '', $v['filename']);
                             $v['filename'] = str_ireplace(site_url(), '', $v['filename']);
                             $is_file = false;
                             $file1 = normalize_path(public_path() . DS . $v['filename'], false);
                             $file2 = normalize_path(base_path() . DS . $v['filename'], false);
                             $file3 = normalize_path(media_base_path() . DS . $v['filename'], false);
                             $file4 = normalize_path(userfiles_path() . DS . $v['filename'], false);
                             if (is_file($file1)) {
                                 $is_file = true;
                             } elseif (is_file($file2)) {
                                 $is_file = true;
                             } elseif (is_file($file3)) {
                                 $is_file = true;
                             } elseif (is_file($file4)) {
                                 $is_file = true;
                             }
                             if ($is_file == false) {
                                 mw()->media_manager->delete($v['id']);
                                 $removed++;
                             }
                         }
                     }
                 }
             }
         }
     }
     mw()->cache_manager->delete($this->cache_group);
     $resp = array('success' => "Removed " . $removed . ' items');
     return $resp;
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:49,代码来源:Worker.php

示例13: inst

 /** @return DirItem */
 public static function inst($path, $name = null, $ext = null)
 {
     $absPath = normalize_path(file_path($path, $name, $ext));
     if (!$absPath || DIR_SEPARATOR == $absPath || PATH_BASE_DIR == $absPath || PATH_BASE_DIR == $absPath . DIR_SEPARATOR) {
         $absPath = PATH_BASE_DIR;
     } else {
         if (!starts_with($absPath, PATH_BASE_DIR)) {
             $absPath = next_level_dir(PATH_BASE_DIR, $absPath);
         }
     }
     if (array_key_exists($absPath, self::$items)) {
         return self::$items[$absPath];
     }
     $relPath = cut_string_start($absPath, PATH_BASE_DIR);
     $relPath = ensure_dir_startswith_dir_separator($relPath);
     return self::$items[$absPath] = new DirItem($relPath, $absPath);
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:18,代码来源:DirItem.php

示例14: check

 public function check($mail)
 {
     // list is from here https://gist.github.com/hassanazimi/d6e49469258d7d06f9f4
     $file = __DIR__ . DS . 'disposable_email_addresses.txt';
     $file = normalize_path($file, false);
     $mail_domains_ko = file_get_contents($file);
     $mail_domains_ko = explode("\n", $mail_domains_ko);
     if (empty($mail_domains_ko)) {
         return false;
     }
     foreach ($mail_domains_ko as $ko_mail) {
         list(, $mail_domain) = explode('@', $mail);
         if (strcasecmp($mail_domain, trim($ko_mail)) == 0) {
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:microweber,项目名称:microweber,代码行数:18,代码来源:DisposableEmailChecker.php

示例15: add_hrefs

 private function add_hrefs($hrefs)
 {
     foreach ($hrefs as $href) {
         $d = normalize_path(dirname($href), true);
         $n = basename($href);
         $code = $this->app->get_http_code($d);
         if ($code == App::$MAGIC_SEQUENCE && !$this->app->is_ignored($n)) {
             $real_file = $this->app->get_abs_path($href);
             // $archived_file = preg_replace("!^" . normalize_path($this->app->get_root_abs_path(), true) . "!", "", $real_file);
             $archived_file = preg_replace("!^" . normalize_path($this->app->get_abs_path(), true) . "!", "", $real_file);
             if (is_dir($real_file)) {
                 $this->add_dir($real_file, $archived_file);
             } else {
                 $this->add_file($real_file, $archived_file);
             }
         }
     }
 }
开发者ID:avidys,项目名称:camunda.org,代码行数:18,代码来源:Archive.php


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