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


PHP File::absolute方法代码示例

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


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

示例1: import

 /**
  * libraryをimportする
  * 必要であればダウンロードを試みる
  *
  * @param string $package_path
  */
 public static function import($package_path, $package_server = null)
 {
     if ($package_server !== null) {
         $package_server = self::add($package_server);
     }
     $expand_path = self::$PATH . str_replace(".", "/", $package_path);
     try {
         return self::import_include($expand_path, $package_path);
     } catch (Exception $e) {
         $uri = str_replace(".", "/", $package_path);
         $tgz = File::absolute(self::$PATH, str_replace(".", "_", $package_path) . ".tgz");
         $http = new Http();
         if ($package_server !== null) {
             if (null !== ($result = self::read_server($http, $package_server, $uri, $tgz, $package_path, $expand_path))) {
                 return $result;
             }
         } else {
             foreach (self::$IMPORT_URLS as $server) {
                 if (null !== ($result = self::read_server($http, $server, $uri, $tgz, $package_path, $expand_path))) {
                     return $result;
                 }
             }
         }
     }
     throw new Exception($package_path . " not found");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:32,代码来源:Lib.php

示例2: parse_package

 private static function parse_package($package_root_path, $base_dir, $package, &$tgz_filename)
 {
     $tgz_filename = File::absolute(self::$tgz_dir, str_replace("/", "_", $package) . ".tgz");
     if (is_file($tgz_filename)) {
         return true;
     }
     $package_name = basename($base_dir);
     $search_path = File::absolute($base_dir, preg_replace("/^" . $package_name . "\\//", "", $package));
     $base_name = basename($search_path);
     if (is_file($search_path . ".php")) {
         $isdir = is_dir($search_path);
         $tar = File::pack($base_dir, $search_path . ".php", $package_root_path, !$isdir);
         if ($isdir) {
             $tar .= File::pack($base_dir, $search_path, $package_root_path);
         } else {
             $parent_dir = basename(dirname($search_path));
             $parent_search = dirname(dirname($search_path)) . "/" . $parent_dir . ".php";
             if (is_file($parent_search)) {
                 $tar .= File::pack($base_dir, $parent_search, $package_root_path);
             }
         }
         File::gzwrite($tgz_filename, $tar);
         return true;
     } else {
         if (is_file($search_path . "/" . $base_name . ".php")) {
             File::tgz($tgz_filename, $base_dir, $search_path, $package_root_path);
             return true;
         }
     }
     return false;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:31,代码来源:Packager.php

示例3: do_read

 /**
  * URLからフィードを取得
  *
  * @param string $url
  * @return Atom
  */
 public function do_read($url)
 {
     $urls = func_get_args();
     $feed = null;
     if (!self::$CACHE || File::isExpiry($urls, self::$CACHE_TIME)) {
         foreach ($urls as $url) {
             if (is_string($url) && ($url = trim($url)) && !empty($url)) {
                 if (!self::$CACHE || File::isExpiry($url, self::$CACHE_TIME)) {
                     $src = Tag::xhtmlnize($this->do_get($url)->body(), "link");
                     if (Tag::setof($tag, $src, "head")) {
                         foreach ($tag->in("link") as $link) {
                             if ("alternate" == strtolower($link->inParam("rel")) && strpos(strtolower($link->inParam("type")), "application") === 0 && $url != ($link = File::absolute($url, $link->inParam("href")))) {
                                 $src = $this->do_get($link)->body();
                                 break;
                             }
                         }
                     }
                     $tmp = self::parse($src);
                     if (self::$CACHE) {
                         File::cwrite($url, $tmp);
                     }
                 } else {
                     $tmp = File::cread($url);
                 }
                 if ($feed === null) {
                     if ($this->title !== null) {
                         $tmp->title($this->title());
                     }
                     if ($this->subtitle !== null) {
                         $tmp->subtitle($this->subtitle());
                     }
                     if ($this->id !== null) {
                         $tmp->id($this->id());
                     }
                     if ($this->generator !== null) {
                         $tmp->generator($this->generator());
                     }
                     if ($this->updated !== null) {
                         $tmp->updated($this->updated());
                     }
                     $feed = $tmp;
                 } else {
                     $feed->add($tmp);
                 }
             }
         }
         if (!$feed instanceof Atom) {
             $feed = new Atom();
         }
         $feed->sort();
         if (self::$CACHE) {
             File::cwrite($urls, $feed);
         }
     } else {
         $feed = File::cread($urls);
     }
     return $feed;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:64,代码来源:Feed.php

示例4: diff

 function diff($path, $revA, $revB)
 {
     $url = File::absolute($this->url, $path);
     $result = Command::out(sprintf("%s diff -r %d:%d %s", $this->cmd, $revA, $revB, $url));
     if (empty($result)) {
         throw new Exception("undef");
     }
     return preg_replace("/^\\+{3} .+\n/", "", preg_replace("/^-{3} .+\n/", "", trim(preg_replace("/^.+={60,70}\n(.+)\$/ms", "\\1", str_replace(array("\r\n", "\r"), "\n", $result)))));
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:9,代码来源:SvnViewerShell.php

示例5: create

 public function create()
 {
     try {
         Subversion::cmd('import', array(OpenpearConfig::svn_skeleton(work_path('skeleton')), File::absolute(OpenpearConfig::svn_root(), $this->package()->name())), array('message' => sprintf('[New Package] %s (@%s)', $this->package()->name(), $this->maintainer()->name()), 'username' => OpenpearConfig::system_user('openpear')));
         // $message = new OpenpearMessage();
         // $message->subject('New Package is ready for your commit!');
         $this->delete();
         C($this)->commit();
     } catch (Exception $e) {
         Log::error($e->getMessage());
         $this->trial_count += 1;
         $this->save();
         C($this)->commit();
     }
 }
开发者ID:nequal,项目名称:Openpear,代码行数:15,代码来源:OpenpearNewprojectQueue.php

示例6: download

 public function download($save_dir, $save_filename, $ext = true)
 {
     $b = new Http();
     $b->do_get($this->url() . "&fmt=22");
     if (preg_match("/var[\\s]+swfArgs[\\s]*=[\\s]*(\\{.+?\\})/m", $b->body(), $match)) {
         $json = Text::parse_json($match[1]);
         $base_url = "http://www.youtube.com/get_video?video_id=" . $json["video_id"] . "&t=" . $json["t"];
         $url = $base_url . "&fmt=22";
         if ($b->do_head($url)->status() !== 200) {
             $url = $base_url . "&fmt=18";
         }
         $b->do_download($url, File::absolute($save_dir, $save_filename) . ($ext ? $this->ext : ""));
         return;
     }
     throw new Exception("undef video");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:16,代码来源:YouTubeDataResult.php

示例7: check_repo_exists

 public function check_repo_exists()
 {
     $this->login_required();
     try {
         $package = OpenpearPackage::get_package($this->in_vars('package_id'));
         $info = Subversion::cmd('info', array(File::absolute(OpenpearConfig::svn_root(), implode('/', array($package->name(), 'trunk', $this->in_vars('dir', ''))))));
         if (isset($info['kind']) && $info['kind'] == 'dir') {
             echo 'ok';
         } else {
             throw new RuntimeException('directory is not found');
         }
     } catch (Exception $e) {
         Log::debug($e);
         echo 'ng';
     }
     exit;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:17,代码来源:OpenpearAPI.php

示例8: download

 public function download($save_dir, $save_filename, $ext = true)
 {
     $b = new Http();
     if (!empty($this->original_image_url)) {
         $b->do_download($this->original_image_url, File::absolute($save_dir, $save_filename) . ($ext ? ".jpg" : ""));
         return;
     } else {
         $b->do_get($this->url);
         if (Tag::setof($tag, $b->body(), "body")) {
             foreach ($tag->in("script") as $s) {
                 if (preg_match("/addVariable\\('url', '(.+?)'\\)/", $s->value(), $match)) {
                     $b->do_download(trim($match[1]), File::absolute($save_dir, $save_filename) . ($ext ? ".flv" : ""));
                     return;
                 }
             }
         }
     }
     throw new Exception("undef video");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:19,代码来源:PhotozouSearchResult.php

示例9: parse_package

 private static function parse_package($base_dir, $name, &$tgz_filename)
 {
     $tgz_filename = File::absolute(self::$tgz_dir, $name . ".tgz");
     if (is_file($tgz_filename)) {
         return true;
     }
     $search_path = File::absolute($base_dir, $name);
     if (is_dir($search_path)) {
         $ignore = array("__\\w+__\\.php\$", "^work/", "^work\$");
         File::tgz($tgz_filename, $search_path, $search_path, null, $ignore);
         return true;
     } else {
         if (is_file($search_path . ".php")) {
             File::tgz($tgz_filename, $base_dir, $search_path . ".php");
             return true;
         }
     }
     return false;
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:19,代码来源:Repository.php

示例10: install

 /**
  * libraryをimportする
  * 必要であればダウンロードを試みる
  *
  * @param string $package_path
  */
 public static function install($name, $install_server = null)
 {
     if ($install_server !== null) {
         $install_server = self::add($install_server);
     }
     $tgz = File::absolute(self::$PATH, str_replace(".", "_", $name) . ".tgz");
     $http = new Http();
     if ($install_server !== null) {
         if (self::read_server($http, $install_server, $name, $tgz, $name)) {
             return;
         }
     } else {
         foreach (self::$INST_URLS as $server) {
             if (self::read_server($http, $server, $name, $tgz, $name)) {
                 return;
             }
         }
     }
     throw new Exception($name . " not found");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:26,代码来源:Installer.php

示例11: dirname

<?php

/**
 * 更新を監視してmxmlcする
 */
include_once dirname(__FILE__) . "/__settings__.php";
import("core.Command");
import("core.File");
import("core.Request");
$req = new Request();
$cmd = new Command();
$cmd->open(File::absolute(def("mxmlc@flex_bin"), "fcsh"), null, work_path("mxmlc_error"));
$src = new File(path("flex/src/" . $req->inVars("f", "index.mxml")));
$bin = path("flex/bin/" . $src->oname() . ".swf");
$lib = path("flex/lib/");
$rsl = path("flex/rsl/");
while (true) {
    $lib_last_update = $src_last_update = $rsl_last_update = $id = 0;
    $mxmlc = sprintf("mxmlc -output %s --file-specs %s ", $bin, $src);
    if ($lib_last_update < ($lib_update = File::last_update($lib, true))) {
        $lib_last_update = $lib_update;
        $files = array();
        foreach (File::ls($lib) as $f) {
            $files[] = $f->fullname();
        }
        $mxmlc .= "-library-path+=" . implode(",", $files) . " ";
    }
    if ($rsl_last_update < ($rsl_update = File::last_update($rsl, true))) {
        $rsl_last_update = $rsl;
        $files = array();
        foreach (File::ls($rsl) as $f) {
开发者ID:hisaboh,项目名称:w2t,代码行数:31,代码来源:mxmlc.php

示例12: media

 /**
  * メディアの絶対パスを返す
  * @param string $url ベースのURLに続く相対パス
  * @return string
  */
 public function media($url = null)
 {
     return $this->flow instanceof Flow ? File::absolute($this->flow->media_url(), $url) : null;
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:9,代码来源:Templf.php

示例13: srcpath_link

 public final function srcpath_link(OpenpearPackage $package, $path)
 {
     $ret = '';
     $parent = '';
     foreach (explode('/', $path) as $p) {
         $link = File::absolute(url(sprintf('package/%s/src/%s', $package->name())), implode('/', array($parent, $p)));
         $ret .= sprintf('<a href="%s">%s</a>', $link, $p);
         $parent .= $p;
     }
     return $ret;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:11,代码来源:OpenpearTemplf.php

示例14: request

 private function request($url, $method, array $header = array(), array $vars = array(), $download_path = null, $status_redirect = true)
 {
     Log::debug($url);
     $result = (object) array("url" => $url, "status" => 200, "head" => null, "redirect" => null, "body" => null, "encode" => null, "cmd" => null);
     $h = array_change_key_case($header, CASE_LOWER);
     $raw = null;
     $content_type = isset($h["content-type"]) ? $h["content-type"] : "application/x-www-form-urlencoded";
     $user_agent = isset($h["user-agent"]) ? $h["user-agent"] : (empty($this->agent) ? isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "" : $this->agent);
     $accept = isset($h["accept"]) ? $h["accept"] : (isset($_SERVER["HTTP_ACCEPT"]) ? $_SERVER["HTTP_ACCEPT"] : "");
     $accept_language = isset($h["accept-language"]) ? $h["accept-language"] : (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "");
     $accept_charset = isset($h["accept-charset"]) ? $h["accept-charset"] : (isset($_SERVER["HTTP_ACCEPT_CHARSET"]) ? $_SERVER["HTTP_ACCEPT_CHARSET"] : "");
     unset($h["content-type"], $h["user-agent"], $h["accept"], $h["accept-language"], $h["accept-charset"]);
     if (isset($h["rawdata"])) {
         $raw = $h["rawdata"];
         unset($h["rawdata"]);
     } else {
         if (!empty($vars)) {
             if (strtoupper($method) == "GET") {
                 $url = strpos($url, "?") === false ? $url . "?" : $url . "&";
                 $url .= self::query($vars, null, true, $this->query_array);
                 if (substr($url, -1) === "&") {
                     $url = substr($url, 0, -1);
                 }
             } else {
                 $query_vars = array(array(), array());
                 foreach (self::expand_vars($tmp, $vars, null, false) as $v) {
                     $query_vars[is_string($v[1]) ? 0 : 1][] = $v;
                 }
                 if (empty($query_vars[1])) {
                     $raw = self::query($vars, null, true, $this->query_array);
                     if (substr($raw, -1) === "&") {
                         $raw = substr($raw, 0, -1);
                     }
                 } else {
                     $boundary = "-----------------" . md5(microtime());
                     $content_type = "multipart/form-data;  boundary=" . $boundary;
                     $raws = array();
                     foreach ($query_vars[0] as $v) {
                         $raws[] = sprintf('Content-Disposition: form-data; name="%s"', $v[0]) . "\r\n\r\n" . $v[1] . "\r\n";
                     }
                     foreach ($query_vars[1] as $v) {
                         $raws[] = sprintf('Content-Disposition: form-data; name="%s"; filename="%s"', $v[0], $v[1]->name()) . "\r\n" . sprintf('Content-Type: %s', $v[1]->mime()) . "\r\n" . sprintf('Content-Transfer-Encoding: %s', "binary") . "\r\n\r\n" . $v[1]->get() . "\r\n";
                     }
                     $raw = "--" . $boundary . "\r\n" . implode("--" . $boundary . "\r\n", $raws) . "\r\n--" . $boundary . "--\r\n" . "\r\n";
                 }
             }
         }
     }
     $ulist = parse_url(preg_match("/^([\\w]+:\\/\\/)(.+?):(.+)(@.+)\$/", $url, $m) ? $m[1] . urlencode($m[2]) . ":" . urlencode($m[3]) . $m[4] : $url);
     $ssl = isset($ulist["scheme"]) && ($ulist["scheme"] == "ssl" || $ulist["scheme"] == "https");
     try {
         $fp = fsockopen(($ssl ? "ssl://" : "") . $ulist["host"], !isset($ulist["port"]) ? $ssl ? 443 : 80 : $ulist["port"], $errorno, $errormsg, $this->timeout);
     } catch (Exception $e) {
         throw new InvalidArgumentException("connection fail " . $url);
     }
     if ($fp == false || false == stream_set_blocking($fp, 1) || false == stream_set_timeout($fp, $this->timeout)) {
         throw new InvalidArgumentException("connection fail [" . $url . "] " . $errormsg . " " . $errorno);
     }
     $cmd = sprintf("%s %s%s HTTP/1.1\r\n", $method, !isset($ulist["path"]) ? "/" : $ulist["path"], isset($ulist["query"]) ? sprintf("?%s", $ulist["query"]) : "") . sprintf("Host: %s\r\n", $ulist["host"]) . (empty($user_agent) ? "" : sprintf("User-Agent: %s\r\n", $user_agent)) . (empty($accept) ? "" : sprintf("Accept: %s\r\n", $accept)) . (empty($accept_language) ? "" : sprintf("Accept-Language: %s\r\n", $accept_language)) . (empty($accept_charset) ? "" : sprintf("Accept-Charset: %s\r\n", $accept_charset)) . sprintf("Content-Type: %s\r\n", $content_type) . sprintf("Connection: Close\r\n") . (isset($ulist["user"]) && isset($ulist["pass"]) ? sprintf("Authorization: Basic %s\r\n", base64_encode(sprintf("%s:%s", urldecode($ulist["user"]), urldecode($ulist["pass"])))) : "");
     foreach ($h as $key => $value) {
         $cmd .= sprintf("%s: %s\r\n", $key, $value);
     }
     if (!empty($raw)) {
         $cmd .= "Content-length: " . strlen($raw) . "\r\n\r\n" . $raw;
     }
     fwrite($fp, $result->cmd = $cmd . "\r\n");
     stream_set_timeout($fp, $this->timeout);
     while (!feof($fp) && !preg_match("/\r\n\r\n\$/", $result->head)) {
         $result->head .= fgets($fp, 4096);
     }
     $result->status = preg_match("/HTTP\\/.+[ ](\\d\\d\\d)/i", $result->head, $httpCode) ? intval($httpCode[1]) : 0;
     $result->encode = preg_match("/Content-Type.+charset[\\s]*=[\\s]*([\\-\\w]+)/", $result->head, $match) ? trim($match[1]) : null;
     $result->url = $url;
     switch ($result->status) {
         case 300:
         case 301:
         case 302:
         case 303:
         case 307:
             if (preg_match("/Location:[ ](.*)/i", $result->head, $redirect_url)) {
                 $result->redirect = preg_replace("/[\r\n]/", "", File::absolute($url, $redirect_url[1]));
                 if ($status_redirect) {
                     fclose($fp);
                     if ($method === "GET") {
                         $vars = array();
                     }
                     return $this->request($result->redirect, "GET", $h, $vars, $download_path, $status_redirect);
                 }
             }
     }
     $download_handle = $download_path !== null && File::mkdir(dirname($download_path)) === null ? fopen($download_path, "wb") : null;
     if (preg_match("/^Content\\-Length:[\\s]+([0-9]+)\r\n/i", $result->head, $m)) {
         if (0 < ($length = $m[1])) {
             $rest = $length % 4096;
             $count = ($length - $rest) / 4096;
             while (!feof($fp)) {
                 if ($count-- > 0) {
                     self::write_body($result, $download_handle, fread($fp, 4096));
                 } else {
                     self::write_body($result, $download_handle, fread($fp, $rest));
//.........这里部分代码省略.........
开发者ID:satully,项目名称:dev_socialapp,代码行数:101,代码来源:Http.php

示例15: delete

 /**
  * Storeから削除する
  * @param string $key キー名
  * @return boolean
  */
 public static function delete($key = null)
 {
     $id = self::id($key);
     if (Object::C(__CLASS__)->has_module("store_delete")) {
         return Object::C(__CLASS__)->call_module("store_delete", $id);
     }
     return self::rm(File::absolute(App::work("store"), $id));
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:13,代码来源:Store.php


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