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


PHP resolve_path函数代码示例

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


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

示例1: suivre_lien

function suivre_lien($url, $lien) {

	if (preg_match(',^(mailto|javascript):,iS', $lien))
		return $lien;
	if (preg_match(',^([a-z0-9]+://.*?)(/.*)?$,iS', $lien, $r))
		return $r[1].resolve_path($r[2]);

	# L'url site spip est un lien absolu aussi
	if ($lien == $GLOBALS['meta']['adresse_site']){
		return $lien;
	}

	# lien relatif, il faut verifier l'url de base
	# commencer par virer la chaine de get de l'url de base
	if (preg_match(',^(.*?://[^/]+)(/.*?/?)?([^/#?]*)([?][^#]*)?(#.*)?$,S', $url, $regs)) {
		$debut = $regs[1];
		$dir = !strlen($regs[2]) ? '/' : $regs[2];
		$mot = $regs[3];
		$get = isset($regs[4])?$regs[4]:"";
		$hash = isset($regs[5])?$regs[5]:"";
	}
	#var_dump(array('url'=>$url,'debut'=>$debut,'dir'=>$dir,'mot'=>$mot,'get'=>$get,'hash'=>$hash));
	switch (substr($lien,0,1)) {
		case '/':
			return $debut . resolve_path($lien);
		case '#':
			return $debut . resolve_path($dir.$mot.$get.$lien);
		case '':
			return $debut . resolve_path($dir.$mot.$get.$hash);
		default:
			return $debut . resolve_path($dir.$lien);
	}
}
开发者ID:rhertzog,项目名称:lcs,代码行数:33,代码来源:filtres_mini.php

示例2: suivre_lien

function suivre_lien($url, $lien)
{
    if (preg_match(',^(mailto|javascript|data):,iS', $lien)) {
        return $lien;
    }
    if (preg_match(';^((?:[a-z]{3,7}:)?//.*?)(/.*)?$;iS', $lien, $r)) {
        return $r[1] . resolve_path($r[2]);
    }
    # L'url site spip est un lien absolu aussi
    if ($lien == $GLOBALS['meta']['adresse_site']) {
        return $lien;
    }
    # lien relatif, il faut verifier l'url de base
    # commencer par virer la chaine de get de l'url de base
    if (preg_match(';^((?:[a-z]{3,7}:)?//[^/]+)(/.*?/?)?([^/#?]*)([?][^#]*)?(#.*)?$;S', $url, $regs)) {
        $debut = $regs[1];
        $dir = !strlen($regs[2]) ? '/' : $regs[2];
        $mot = $regs[3];
        $get = isset($regs[4]) ? $regs[4] : "";
        $hash = isset($regs[5]) ? $regs[5] : "";
    }
    switch (substr($lien, 0, 1)) {
        case '/':
            return $debut . resolve_path($lien);
        case '#':
            return $debut . resolve_path($dir . $mot . $get . $lien);
        case '':
            return $debut . resolve_path($dir . $mot . $get . $hash);
        default:
            return $debut . resolve_path($dir . $lien);
    }
}
开发者ID:genma,项目名称:spip_ynh,代码行数:32,代码来源:filtres_mini.php

示例3: addPluginsDir

 public static function addPluginsDir($dir)
 {
     $t = debug_backtrace();
     $path = str_replace("\\", "/", $t[0]['file']);
     $path = resolve_path($path . "/../" . $dir);
     self::$PLUGINS_DIR[] = $path;
     return $path;
 }
开发者ID:rudraks,项目名称:boot,代码行数:8,代码来源:Smarty.php

示例4: load_file

/**
 * Loads a file in `/dsa/php/` path
 * 
 * @param  string $file Relative file path/name
 * 
 * @return boolean      True if success, false otherwise
 */
function load_file($file)
{
    $path = resolve_path($file);
    if ($path) {
        require $path;
        return true;
    }
    return false;
}
开发者ID:adhocore,项目名称:dsa,代码行数:16,代码来源:autoload.php

示例5: remote_filemtime

function remote_filemtime($url, $recurse = 0)
{
    // We hate infinite loops!
    if (++$recurse > 5) {
        return 0;
    }
    // Caching the remote mtime is a Really Good Idea.
    static $remote_files = array();
    if (isset($remote_files[$url])) {
        return $remote_files[$url];
    }
    $uri = parse_url($url);
    $uri['proto'] = isset($uri['proto']) && $uri['proto'] == 'https' ? 'ssl://' : '';
    $uri['port'] = isset($uri['port']) ? $uri['port'] : 80;
    $uri['path'] = isset($uri['path']) ? $uri['path'] : '/';
    $uri['query'] = isset($uri['query']) ? '?' . $uri['query'] : '';
    $path = $uri['path'] . $uri['query'];
    $auth = isset($uri['user']) || isset($uri['pass']) ? 'Authentication: Basic ' . base64_encode(@$uri['user'] . ':' . @$uri['pass']) . "\r\n" : '';
    $handle = @fsockopen($uri['proto'] . $uri['host'], $uri['port']);
    if (!$handle) {
        $remote_files[$url] = 0;
        return 0;
    }
    fputs($handle, "HEAD {$path} HTTP/1.1\r\nHost: {$uri['host']}\r\n{$auth}Connection: close\r\n\r\n");
    $headers = array();
    while (!feof($handle)) {
        $line = trim(fgets($handle, 1024));
        if (empty($line)) {
            break;
        }
        $headers[] = $line;
    }
    fclose($handle);
    $result = 0;
    array_shift($headers);
    foreach ($headers as $header) {
        list($key, $value) = explode(':', $header, 2);
        $value = trim($value);
        switch (strtolower(trim($key))) {
            case 'location':
                // Redirect
                $result = remote_filemtime(resolve_path($url, $value), $recurse);
                break;
            case 'last-modified':
                // Got it!
                $result = strtotime($value);
                break;
        }
        if ($result) {
            break;
        }
    }
    $remote_files[$url] = $result;
    return $result;
}
开发者ID:bilsan,项目名称:schedule-generator,代码行数:55,代码来源:date_functions.php

示例6: resolve_url

function resolve_url($url, $base = null)
{
    if (!$base) {
        $base_parts = parse_url($_SERVER['REQUEST_URI']);
        $base_parts['host'] = $_SERVER['HTTP_HOST'];
        $base_parts['scheme'] = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http';
    } else {
        $base_parts = parse_url($base);
    }
    $url_parts = parse_url($url);
    if (isset($url_parts['scheme'])) {
        return $url;
    }
    if (isset($base_parts['scheme'])) {
        $url_parts['scheme'] = $base_parts['scheme'];
    }
    if (!isset($url_parts['host'])) {
        if (isset($base_parts['host'])) {
            $url_parts['host'] = $base_parts['host'];
        }
        $url_parts['path'] = resolve_path($url_parts['path'], $base_parts['path']);
    }
    return build_url($url_parts);
}
开发者ID:mariomulansky,项目名称:website,代码行数:24,代码来源:url.php

示例7: Output

 /**
  *Output PDF to some destination
  *
  *@access public
  *@note reproduces the fpdf's behavior
  *@param string name the filename
  *@string dest the destination
  *	by default it's a file ('F')
  *   if 'D'  , download
  *	and 'I' , Send to standard output
  *
  **/
 function Output($name = '', $dest = '')
 {
     //-----------------------------------
     $pdf_file = '';
     if ($this->support == "pdftk") {
         //As PDFTK can only merge FDF files not data directly,
         require_once "lib/url.php";
         //we will need a url support because relative urls for pdf inside fdf files are not supported by PDFTK...
         require_once "export/fdf/fdf.php";
         //...conjointly with my patched/bridged forge_fdf that provides fdf file generation support from array data.
         require_once "export/pdf/pdftk.php";
         //Of course don't forget to bridge to PDFTK!
         $tmp_file = false;
         $pdf_file = resolve_path(fix_path(dirname(__FILE__) . '/' . $this->pdf_source));
         //string: full pathname to the input pdf , a form file
         if ($this->fdf_source) {
             //FDF file provided
             $fdf_file = resolve_path(fix_path(dirname(__FILE__) . '/' . $this->fdf_source));
         } else {
             $pdf_url = getUrlfromDir($pdf_file);
             //Normaly http scheme not local file
             if ($this->fdf_parse_needed) {
                 //fdf source was provided
                 $pdf_data = $this->parseFDFContent();
             } else {
                 //fields data was provided as an array, we have to generate the fdf file
                 $pdf_data = $this->fields;
             }
             $fdf_file = fix_path(FPDM_CACHE) . "fields" . rnunid() . ".fdf";
             $tmp_file = true;
             $ret = output_fdf($pdf_url, $pdf_data, $fdf_file);
             if (!$ret["success"]) {
                 $this->Error("Output failed as something goes wrong (Pdf was {$pdf_url}) <br> during internal FDF generation of file {$fdf_file}, <br>Reason is given by {$ret['return']}");
             }
         }
         //Serializes security options (not deeply tested)
         $security = '';
         if (!is_null($this->security["password"]["owner"])) {
             $security .= ' owner_pw "' . substr($this->security["password"]["owner"], 0, FPDM_PASSWORD_MAX_LEN) . '"';
         }
         if (!is_null($this->security["password"]["user"])) {
             $security .= ' user_pw "' . substr($this->security["password"]["user"], 0, FPDM_PASSWORD_MAX_LEN) . '"';
         }
         if ($this->security["encrypt"] != 0) {
             $security .= ' encrypt_' . $this->security["encrypt"] . 'bit';
         }
         if (count($this->security["allow"]) > 0) {
             $permissions = $this->security["allow"];
             $security .= ' allow ';
             foreach ($permissions as $permission) {
                 $security .= ' ' . $permission;
             }
         }
         //Serialize output modes
         $output_modes = '';
         if ($this->flatten_mode) {
             $output_modes .= ' flatten';
         }
         if ($this->compress_mode) {
             $output_modes .= ' compress';
         }
         if ($this->uncompress_mode) {
             $output_modes .= ' uncompress';
         }
         $ret = pdftk($pdf_file, $fdf_file, array("security" => $security, "output_modes" => $output_modes));
         if ($tmp_file) {
             @unlink($fdf_file);
         }
         //Clear cache
         if ($ret["success"]) {
             $pdf_file = $ret["return"];
         } else {
             $this->Error($ret["return"]);
         }
     }
     $this->buffer = $this->get_buffer($pdf_file);
     $dest = strtoupper($dest);
     if ($dest == '') {
         if ($name == '') {
             $name = 'doc.pdf';
             $dest = 'I';
         } else {
             $dest = 'F';
         }
     }
     //Abort to avoid to polluate output
     if ($this->verbose && ($dest == 'I' || $dest == 'D')) {
         $this->Close($dest);
//.........这里部分代码省略.........
开发者ID:rohmad-st,项目名称:fpdf,代码行数:101,代码来源:fpdm.php

示例8: _find_controller_file

function _find_controller_file($class, $directory, &$found_class, &$found_path)
{
    global $CFG;
    $suffix_pattern = '/' . preg_quote($CFG->config['controller_suffix'], '/') . '$/';
    $search_dir = realpath(resolve_path(APPPATH . 'controllers/' . $directory));
    if ($search_dir !== false) {
        $search_dir = rtrim(str_replace('\\', '/', $search_dir), '/') . '/';
        $found_class = ucfirst($class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = preg_replace($suffix_pattern, '', $found_class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = lcfirst($class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = preg_replace($suffix_pattern, '', $found_class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
    }
    $search_dir = realpath(resolve_path(COMMONPATH . 'controllers/' . $directory));
    if ($search_dir !== false) {
        $search_dir = rtrim(str_replace('\\', '/', $search_dir), '/') . '/';
        $found_class = ucfirst($class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = preg_replace($suffix_pattern, '', $found_class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = lcfirst($class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
        $found_class = preg_replace($suffix_pattern, '', $found_class);
        if (file_exists($search_dir . $found_class . '.php')) {
            $found_path = $search_dir . $found_class . '.php';
            return true;
        }
    }
    $found_class = $class;
    $found_path = '';
    return false;
}
开发者ID:Qnatz,项目名称:starter-public-edition-4,代码行数:56,代码来源:create.php

示例9: urls_decoder_url

/**
 * Décoder une URL en utilisant les fonctions inverses
 *
 * Gère les URLs transformées par le htaccess.
 *
 * @note
 *   `$renommer = 'urls_propres_dist';`
 *   renvoie `array($contexte, $type, $url_redirect, $nfond)`
 *
 *   `$nfond` n'est retourné que si l'URL est définie apres le `?`
 *   et risque d'être effacée par un form en get.
 *   Elle est utilisée par form_hidden exclusivement.
 *
 *   Compat ascendante si le retour est NULL en gérant une sauvegarde/restauration
 *   des globales modifiées par les anciennes fonctions
 *
 * @param string $url
 *   URL à décoder
 * @param string $fond
 *   Fond initial par défaut
 * @param array $contexte
 *   Contexte initial à prendre en compte
 * @param bool $assembler
 *   `true` si l'URL correspond à l'URL principale de la page qu'on est en train d'assembler
 *   dans ce cas la fonction redirigera automatiquement si besoin
 *   et utilisera les eventuelles globales `$_SERVER['REDIRECT_url_propre']` et `$_ENV['url_propre']`
 *   provenant du htaccess
 * @return array
 *   Liste `$fond, $contexte, $url_redirect`.
 *
 *   Si l'url n'est pas valide, $fond restera à la valeur initiale passée.
 *   Il suffit d'appeler la fonction sans $fond et de vérifier qu'à son retour celui-ci
 *   est non vide pour vérifier une URL
 *
 */
function urls_decoder_url($url, $fond = '', $contexte = array(), $assembler = false)
{
    static $current_base = null;
    // les anciennes fonctions modifient directement les globales
    // on les sauve avant l'appel, et on les retablit apres !
    $save = array(isset($GLOBALS['fond']) ? $GLOBALS['fond'] : null, isset($GLOBALS['contexte']) ? $GLOBALS['contexte'] : null, isset($_SERVER['REDIRECT_url_propre']) ? $_SERVER['REDIRECT_url_propre'] : null, isset($_ENV['url_propre']) ? $_ENV['url_propre'] : null, $GLOBALS['profondeur_url']);
    if (is_null($current_base)) {
        include_spip('inc/filtres_mini');
        // le decodage des urls se fait toujours par rapport au site public
        $current_base = url_absolue(_DIR_RACINE ? _DIR_RACINE : './');
    }
    if (strncmp($url, $current_base, strlen($current_base)) == 0) {
        $url = substr($url, strlen($current_base));
    }
    // si on est en train d'assembler la page principale,
    // recuperer l'url depuis les globales url propres si fournies
    // sinon extraire la bonne portion d'url
    if ($assembler) {
        if (isset($_SERVER['REDIRECT_url_propre'])) {
            $url = $_SERVER['REDIRECT_url_propre'];
        } elseif (isset($_ENV['url_propre'])) {
            $url = $_ENV['url_propre'];
        } else {
            $qs = explode("?", $url);
            // ne prendre que le segment d'url qui correspond, en fonction de la profondeur calculee
            $url = ltrim($qs[0], '/');
            $url = explode('/', $url);
            while (count($url) > $GLOBALS['profondeur_url'] + 1) {
                array_shift($url);
            }
            $qs[0] = implode('/', $url);
            $url = implode("?", $qs);
        }
    }
    unset($_SERVER['REDIRECT_url_propre']);
    unset($_ENV['url_propre']);
    include_spip('inc/filtres_mini');
    if (strpos($url, "://") === false) {
        $GLOBALS['profondeur_url'] = substr_count(ltrim(resolve_path("/{$url}"), '/'), '/');
    } else {
        $GLOBALS['profondeur_url'] = max(0, substr_count($url, "/") - substr_count($current_base, "/"));
    }
    $url_redirect = "";
    $renommer = generer_url_entite('', '', '', '', true);
    if (!$renommer and !function_exists('recuperer_parametres_url')) {
        $renommer = charger_fonction('page', 'urls');
    }
    // fallback pour decoder l'url
    if ($renommer) {
        $a = $renommer($url, $fond, $contexte);
        if (is_array($a)) {
            list($ncontexte, $type, $url_redirect, $nfond) = array_pad($a, 4, null);
            if ($url_redirect == $url) {
                $url_redirect = "";
            }
            // securite pour eviter une redirection infinie
            if ($assembler and strlen($url_redirect)) {
                spip_log("Redirige {$url} vers {$url_redirect}");
                include_spip('inc/headers');
                redirige_par_entete($url_redirect, '', 301);
            }
            if (isset($nfond)) {
                $fond = $nfond;
            } else {
                if ($fond == '' or $fond == 'type_urls') {
//.........这里部分代码省略.........
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:101,代码来源:urls.php

示例10: load

 public static function load($file, $file2 = null, $glob_config = array())
 {
     $GLOBALS['CONFIG'] = self::read($glob_config, $file, $file2);
     // print_r($GLOBALS ['CONFIG']['GLOBAL']);
     define_globals($GLOBALS['CONFIG']['GLOBAL']);
     define('Q', isset($_REQUEST['q']) ? $_REQUEST['q'] : NULL);
     $path_info = pathinfo($_SERVER['PHP_SELF']);
     $CONTEXT_PATH = Q == NULL ? strstr($_SERVER['PHP_SELF'], $path_info['basename'], TRUE) : strstr($_SERVER['REQUEST_URI'], Q, true);
     /**
      * TODO:- Fix it wth better solution
      */
     if ($CONTEXT_PATH == null) {
         $CONTEXT_PATH = str_replace($path_info['basename'], "", $_SERVER['PHP_SELF']);
     }
     define('CONTEXT_PATH', $CONTEXT_PATH);
     define('APP_CONTEXT', resolve_path($CONTEXT_PATH . get_include_path()));
     Console::set(TRUE);
 }
开发者ID:rudraks,项目名称:boot,代码行数:18,代码来源:RudraX.php

示例11: defined

<?php

defined('BASEPATH') or exit('No direct script access allowed.');
$config['disabled'] = true;
$config['denyZipDownload'] = true;
$config['denyUpdateCheck'] = true;
$config['denyExtensionRename'] = true;
$config['theme'] = 'oxygen';
$config['uploadURL'] = resolve_path(DEFAULT_BASE_URI . 'editor/');
$config['uploadDir'] = resolve_path(DEFAULTFCPATH . 'editor/');
$config['dirPerms'] = DIR_READ_MODE;
$config['filePerms'] = FILE_READ_MODE;
$config['access'] = array('files' => array('upload' => true, 'delete' => true, 'copy' => true, 'move' => true, 'rename' => true), 'dirs' => array('create' => true, 'delete' => true, 'rename' => true));
$config['deniedExts'] = 'exe com msi bat php phps phtml php3 php4 cgi pl';
// Native CKEditor types
$config['types']['files'] = '';
$config['types']['flash'] = 'swf';
$config['types']['images'] = '*img';
// Native TinyMCE types
$config['types']['file'] = '';
$config['types']['media'] = 'swf flv avi mpg mpeg qt mov wmv asf rm';
$config['types']['image'] = '*img';
$config['filenameChangeChars'] = array();
$config['dirnameChangeChars'] = array();
$config['mime_magic'] = '';
$config['maxImageWidth'] = 0;
$config['maxImageHeight'] = 0;
$config['thumbWidth'] = 100;
$config['thumbHeight'] = 100;
$config['thumbsDir'] = '.thumbs';
$config['jpegQuality'] = 90;
开发者ID:aslijiasheng,项目名称:ciFramework,代码行数:31,代码来源:editor_filemanager_default.php

示例12: load

 /** Load a module controller **/
 public static function load($module)
 {
     is_array($module) ? list($module, $params) = each($module) : ($params = NULL);
     //
     // Removed by Deepak Patil <deepak.patil@relesol.com>, 03-APR-2014.
     // Uniqueness is not distinguished this way.
     //
     /* get the requested controller class name */
     //$alias = strtolower(basename($module));
     /* create or return an existing controller from the registry */
     //if ( ! isset(self::$registry[$alias])) {
     //
     /* find the controller */
     // Modified by Deepak Patil <deepak.patil@relesol.com>, 21-JAN-2014.
     //list($class) = CI::$APP->router->locate(explode('/', $module));
     list($class) = CI::$APP->router->locate(explode('/', $module), false);
     //
     /* controller cannot be located */
     if (empty($class)) {
         return;
     }
     /* set the module directory */
     // Modified by Deepak Patil <deepak.patil@relesol.com>, 16-DEC-2013.
     //$path = APPPATH.'controllers/'.CI::$APP->router->directory;
     $path = resolve_path(APPPATH . 'controllers/' . CI::$APP->router->directory) . '/';
     $path_common = resolve_path(COMMONPATH . 'controllers/' . CI::$APP->router->directory) . '/';
     //
     /* load the controller class */
     // Modified by Deepak Patil <deepak.patil@relesol.com>, 16-DEC-2013.
     //$class = $class.CI::$APP->config->item('controller_suffix');
     if (self::test_load_file(ucfirst($class) . CI::$APP->config->item('controller_suffix'), $path)) {
         $class = ucfirst($class) . CI::$APP->config->item('controller_suffix');
     } elseif (self::test_load_file($class . CI::$APP->config->item('controller_suffix'), $path)) {
         $class = $class . CI::$APP->config->item('controller_suffix');
     } elseif (self::test_load_file(ucfirst($class), $path)) {
         $class = ucfirst($class);
     } elseif (self::test_load_file(ucfirst($class) . CI::$APP->config->item('controller_suffix'), $path_common)) {
         $class = ucfirst($class) . CI::$APP->config->item('controller_suffix');
         $path = $path_common;
     } elseif (self::test_load_file($class . CI::$APP->config->item('controller_suffix'), $path_common)) {
         $class = $class . CI::$APP->config->item('controller_suffix');
         $path = $path_common;
     } elseif (self::test_load_file(ucfirst($class), $path_common)) {
         $class = ucfirst($class);
         $path = $path_common;
     } elseif (self::test_load_file($class, $path_common)) {
         $path = $path_common;
     }
     //
     // Modifications by Deepak Patil <deepak.patil@relesol.com>, 03-APR-2014.
     // The previous check for loaded controller was not precise.
     $location = realpath($path . $class . '.php');
     $key = strtolower($location);
     // Check whether the controller has been loaded, based on its system path.
     if (!isset(self::$registry[$key])) {
         self::load_file($class, $path);
         /* create and register the new controller */
         $controller = ucfirst($class);
         self::$registry[$key] = new $controller($params);
         self::$registry[$key]->path = $location;
     }
     // Added by Deepak Patil <deepak.patil@relesol.com>, 03-APR-2014.
     // A dirty workaround that is needed for Starter 4.
     self::$registry[$key]->load->set_module(CI::$APP->router->fetch_module());
     //
     return self::$registry[$key];
 }
开发者ID:patilstar,项目名称:HMVC-WITH-CI,代码行数:68,代码来源:Modules.php

示例13: foreach

# Check datatype config values
#
foreach (array_keys($default_config) as $key) {
    if (isset($config[$key]) && !(is_string($default_config[$key]) ? is_string($config[$key]) : (is_array($default_config[$key]) ? is_array($config[$key]) : is_int($default_config[$key] ? is_int($config[$key]) : false))) || !isset($config[$key])) {
        $config[$key] = $default_config[$key];
    }
}
$config_destination = resolve_path($config['destination'], true);
if ($config_destination === false) {
    die(sprintf("{destination=%s} directive is not a valid directory", $config['destination']));
}
$config['destination'] = $config_destination;
# Filter directive {directories}
#
foreach (array_keys($config['directories']) as $key) {
    $dir = resolve_path($config['directories'][$key]);
    if ($dir && is_dir($dir)) {
        $config['directories'][$key] = $dir;
        continue;
    }
    unset($config['directories'][$key]);
    continue;
}
while (true) {
    $files = array();
    # Extract all files of the specified extensions
    #
    $extensions = implode('|', $config['extensions']);
    foreach ($config['directories'] as $dir) {
        $files = array_merge($files, list_files($dir, sprintf('/\\.(%s)$/i', $extensions)));
    }
开发者ID:allenlinatoc,项目名称:assetmon,代码行数:31,代码来源:assetmon.php

示例14: join

<?php

#error_reporting(E_ALL);
include "plog-globals.php";
include_once "plog-load_config.php";
include_once "plog-functions.php";
global $config;
// process path here - is set if mod_rewrite is in use
if (!empty($_REQUEST["path"])) {
    // the followling line calculates the path in the album and excludes any subdirectories if
    // Plogger is installed in one
    $path = join("/", array_diff(explode("/", $_SERVER["REQUEST_URI"]), explode("/", $_SERVER["PHP_SELF"])));
    $resolved_path = resolve_path($path);
    if (is_array($resolved_path)) {
        $_GET["level"] = $resolved_path["level"];
        $_GET["id"] = $resolved_path["id"];
        if (isset($resolved_path['mode'])) {
            $_GET['mode'] = $resolved_path['mode'];
        }
        // get page number from url, if present
        $parts = parse_url($_SERVER["REQUEST_URI"]);
        if (isset($parts["query"])) {
            parse_str($parts["query"], $query_parts);
            if (!empty($query_parts["plog_page"])) {
                $_GET["plog_page"] = $query_parts["plog_page"];
            }
        }
        $path = $parts["path"];
    }
}
// Set sorting session variables if they are passed
开发者ID:alanhaggai,项目名称:plogger,代码行数:31,代码来源:gallery.php

示例15: date_default_timezone_set

<?php

if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('America/New_York');
}
$GLOBALS["appDir"] = resolve_path("app");
$GLOBALS["viewables"] = array();
$GLOBALS["configDir"] = resolve_path("config");
$GLOBALS["vendorDir"] = realpath($_SERVER["DOCUMENT_ROOT"] . "/../app/vendor");
$GLOBALS["baseDir"] = realpath($_SERVER["DOCUMENT_ROOT"] . "/..");
$GLOBALS["testsDir"] = realpath($_SERVER["DOCUMENT_ROOT"] . "/../app/tests");
setg("pageName", basename($_SERVER['PHP_SELF']));
function resolve_path($name)
{
    if ($name == ".") {
        $publicRoot = $_SERVER["DOCUMENT_ROOT"] . "/..";
        $appRoot = $_SERVER["DOCUMENT_ROOT"];
    } else {
        if ($_SERVER["DOCUMENT_ROOT"] != "") {
            $publicRoot = $_SERVER["DOCUMENT_ROOT"] . "/../{$name}";
            $appRoot = $_SERVER["DOCUMENT_ROOT"] . "/{$name}";
        } else {
            return "../{$name}";
        }
    }
    return file_exists($publicRoot) ? realpath($publicRoot) : realpath($appRoot);
}
function __autoload($class_name)
{
    if (file_exists($GLOBALS["appDir"] . "/models/{$class_name}.php")) {
        require_once $GLOBALS["appDir"] . "/models/{$class_name}.php";
开发者ID:aforward,项目名称:uas-engine,代码行数:31,代码来源:_autoload.php


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