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


PHP rel2abs函数代码示例

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


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

示例1: GetFileName

 public static function GetFileName($file_name = '')
 {
     $dir_name = self::GetAbsoluteRoot();
     $file_name = rel2abs("/", "/" . $file_name);
     $i = 0;
     while (true) {
         $i++;
         if ($file_name == '/') {
             $dir_add = md5(mt_rand());
         } elseif ($i < 25) {
             $dir_add = substr(md5(mt_rand()), 0, 3);
         } else {
             $dir_add = md5(mt_rand());
         }
         $temp_path = $dir_name . "/" . $dir_add . $file_name;
         if (!file_exists($temp_path)) {
             //Delayed unlink
             if (empty(self::$arFiles)) {
                 register_shutdown_function(array('CTempFile', 'Cleanup'));
             }
             self::$arFiles[$temp_path] = $dir_name . "/" . $dir_add;
             //Function ends only here
             return $temp_path;
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:file_temp.php

示例2: perfect_url

function perfect_url($u,$b){
 $bp=parse_url($b);
 if(($bp['path']!="/" && $bp['path']!="") || $bp['path']==''){
  if($bp['scheme']==""){$scheme="http";}else{$scheme=$bp['scheme'];}
  $b=$scheme."://".$bp['host']."/";
 }
 if(substr($u,0,2)=="//"){
  $u="http:".$u;
 }
 if(substr($u,0,4)!="http"){
  $u=rel2abs($u,$b);
 }
 return $u;
}
开发者ID:robertbenparkinson,项目名称:phpwebcrawler,代码行数:14,代码来源:crawler.php

示例3: quick_upload

 public function quick_upload()
 {
     $assetdir = Setting::value('assets_folder', 'iu-assets') . '/' . $this->user->id;
     @mkdir($assetdir, 0777, true);
     $assetpath = realpath(trim($assetdir, '/')) . '/';
     $assetbase = rel2abs($assetdir, trim(base_url(), '/') . '/');
     // Optional: instance name (might be used to adjust the server folders for example)
     $CKEditor = $_GET['CKEditor'];
     // Required: Function number as indicated by CKEditor.
     $funcNum = $_GET['CKEditorFuncNum'];
     // Optional: To provide localized messages
     $langCode = $_GET['langCode'];
     // The returned url of the uploaded file
     $url = '';
     // Optional message to show to the user (file renamed, invalid file, not authenticated...)
     $message = '';
     // in CKEditor the file is sent as 'upload'
     if (isset($_FILES['upload'])) {
         $config = array();
         $config['upload_path'] = $assetdir;
         $config['allowed_types'] = '*';
         $this->load->library('upload', $config);
         if (!$this->upload->do_upload('upload')) {
             $message = $this->upload->display_errors();
         } else {
             $data = $this->upload->data();
             if (stripos(current_url(), 'instant-update.com') && empty($data['is_image'])) {
                 die(json_encode($result));
             }
             $url = $assetbase . '/' . $data['file_name'];
             //$result['url'] = base_url() . 'iu-assets/'.$this->user->id.'/'.$data['file_name'];
             $message = 'The file has been uploaded';
         }
     } else {
         $message = 'No file has been sent';
     }
     // ------------------------
     // Write output
     // ------------------------
     // We are in an iframe, so we must talk to the object in window.parent
     echo "<script type='text/javascript'> window.parent.CKEDITOR.tools.callFunction({$funcNum}, '{$url}', '{$message}')</script>";
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:42,代码来源:assets.php

示例4: process404

 /**
  * Performs actions enabled by its parameters.
  *
  * @param string $message Message to show with bitrix:system.show_message component.
  * @param bool $defineConstant If true then ERROR_404 constant defined.
  * @param bool $setStatus If true sets http response status.
  * @param bool $showPage If true then work area will be cleaned and /404.php will be included.
  * @param string $pageFile Alternative file to /404.php.
  *
  * @return void
  */
 public static function process404($message = "", $defineConstant = true, $setStatus = true, $showPage = false, $pageFile = "")
 {
     /** @global \CMain $APPLICATION */
     global $APPLICATION;
     if ($message != "") {
         $APPLICATION->includeComponent("bitrix:system.show_message", ".default", array("MESSAGE" => $message, "STYLE" => "errortext"), null, array("HIDE_ICONS" => "Y"));
     }
     if ($defineConstant && !defined("ERROR_404")) {
         define("ERROR_404", "Y");
     }
     if ($setStatus) {
         \CHTTP::setStatus("404 Not Found");
     }
     if ($showPage) {
         if ($APPLICATION->RestartWorkarea()) {
             if ($pageFile) {
                 require \Bitrix\Main\Application::getDocumentRoot() . rel2abs("/", "/" . $pageFile);
             } else {
                 require \Bitrix\Main\Application::getDocumentRoot() . "/404.php";
             }
             die;
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:35,代码来源:tools.php

示例5: get_link_list

function get_link_list($url)
{
    global $run_environment;
    global $max_records;
    $html = scraperWiki::scrape($url);
    $dom = new simple_html_dom();
    $dom->load($html);
    $content = $dom->find("td[id=main_content]", 0)->find("table", 0)->find("span[class=bodytext]", 1);
    $count = 1;
    foreach ($content->find("a") as $link) {
        if ($link->href && strpos($link->plaintext, 'CBs') !== FALSE) {
            $url = rel2abs($link->href, $url);
            $name = substr($link->plaintext, 0, strpos($link->plaintext, ' CBs'));
            $borough['source'] = $url;
            $borough['name'] = $name;
            $links[] = $borough;
            $count++;
        }
    }
    // Clear memory
    $dom->__destruct();
    $content->__destruct();
    return $links;
}
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:24,代码来源:city_representatives_-_nyc_community_boards_2.php

示例6: preg_replace

$FILE_NAME = false;
$ABS_FILE_NAME = false;
$WORK_DIR_NAME = false;
if ($arParams["USE_TEMP_DIR"] === "Y" && strlen($_SESSION["BX_HL_IMPORT"]["TEMP_DIR"]) > 0) {
    $DIR_NAME = $_SESSION["BX_HL_IMPORT"]["TEMP_DIR"];
} else {
    $DIR_NAME = $_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/1c_highloadblock/";
}
if (isset($_GET["filename"]) && strlen($_GET["filename"]) > 0 && strlen($DIR_NAME) > 0) {
    //This check for 1c server on linux
    $filename = preg_replace("#^(/tmp/|upload/1c/webdata)#", "", $_GET["filename"]);
    $filename = trim(str_replace("\\", "/", trim($filename)), "/");
    $io = CBXVirtualIo::GetInstance();
    $bBadFile = HasScriptExtension($filename) || IsFileUnsafe($filename) || !$io->ValidatePathString("/" . $filename);
    if (!$bBadFile) {
        $FILE_NAME = rel2abs($DIR_NAME, "/" . $filename);
        if (strlen($FILE_NAME) > 1 && $FILE_NAME === "/" . $filename) {
            $ABS_FILE_NAME = $DIR_NAME . $FILE_NAME;
            $WORK_DIR_NAME = substr($ABS_FILE_NAME, 0, strrpos($ABS_FILE_NAME, "/") + 1);
        }
    }
}
ob_start();
//This is the first exchange command
if ($_GET["mode"] == "checkauth" && $USER->IsAuthorized()) {
    if (COption::GetOptionString("main", "use_session_id_ttl", "N") == "Y" && COption::GetOptionInt("main", "session_id_ttl", 0) > 0 && !defined("BX_SESSION_ID_CHANGE")) {
        echo "failure\n", GetMessage("CC_BCIH_ERROR_SESSION_ID_CHANGE");
    } else {
        echo "success\n";
        echo session_name() . "\n";
        echo session_id() . "\n";
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例7: array

<?php

require '../rel2abs.php';
require '../url_to_absolute.php';
require 'phpuri.php';
$tests = array(array('rel' => 'g:h', 'result' => 'g:h'), array('rel' => 'g', 'result' => 'http://a/b/c/g'), array('rel' => './g', 'result' => 'http://a/b/c/g'), array('rel' => 'g/', 'result' => 'http://a/b/c/g/'), array('rel' => '/g', 'result' => 'http://a/g'), array('rel' => '//g', 'result' => 'http://g'), array('rel' => 'g?y', 'result' => 'http://a/b/c/g?y'), array('rel' => '#s', 'result' => 'http://a/b/c/d;p?q#s'), array('rel' => 'g#s', 'result' => 'http://a/b/c/g#s'), array('rel' => 'g?y#s', 'result' => 'http://a/b/c/g?y#s'), array('rel' => ';x', 'result' => 'http://a/b/c/;x'), array('rel' => 'g;x', 'result' => 'http://a/b/c/g;x'), array('rel' => 'g;x?y#s', 'result' => 'http://a/b/c/g;x?y#s'), array('rel' => '.', 'result' => 'http://a/b/c/'), array('rel' => './', 'result' => 'http://a/b/c/'), array('rel' => '..', 'result' => 'http://a/b/'), array('rel' => '../', 'result' => 'http://a/b/'), array('rel' => '../g', 'result' => 'http://a/b/g'), array('rel' => '../..', 'result' => 'http://a/'), array('rel' => '../../', 'result' => 'http://a/'), array('rel' => '../../g', 'result' => 'http://a/g'), array('rel' => 'g.', 'result' => 'http://a/b/c/g.'), array('rel' => '.g', 'result' => 'http://a/b/c/.g'), array('rel' => 'g..', 'result' => 'http://a/b/c/g..'), array('rel' => '..g', 'result' => 'http://a/b/c/..g'), array('rel' => './../g', 'result' => 'http://a/b/g'), array('rel' => './g/.', 'result' => 'http://a/b/c/g/'), array('rel' => 'g/./h', 'result' => 'http://a/b/c/g/h'), array('rel' => 'g/../h', 'result' => 'http://a/b/c/h'), array('rel' => 'g;x=1/./y', 'result' => 'http://a/b/c/g;x=1/y'), array('rel' => 'g;x=1/../y', 'result' => 'http://a/b/c/y'), array('rel' => 'g?y/./x', 'result' => 'http://a/b/c/g?y/./x'), array('rel' => 'g?y/../x', 'result' => 'http://a/b/c/g?y/../x'), array('rel' => 'g#s/./x', 'result' => 'http://a/b/c/g#s/./x'), array('rel' => 'g#s/../x', 'result' => 'http://a/b/c/g#s/../x'));
# rel2abs
$start = microtime();
$base = 'http://a/b/c/d;p?q';
list($successes, $failures) = array(0, 0);
foreach ($tests as $test) {
    if (($r = rel2abs($test['rel'], $base)) == $test['result']) {
        $successes++;
    } else {
        $failures++;
    }
}
$elapsed = microtime() - $start;
echo "rel2abs:         successes -> {$successes}, failures => {$failures}, elapsed time: {$elapsed}\n";
# url_to_absolute
$start = microtime();
$base = 'http://a/b/c/d;p?q';
list($successes, $failures) = array(0, 0);
foreach ($tests as $test) {
    if (($r = url_to_absolute($base, $test['rel'])) == $test['result']) {
        $successes++;
    } else {
        $failures++;
    }
}
$elapsed = microtime() - $start;
开发者ID:dmitry-dimon-darkdim,项目名称:parser,代码行数:31,代码来源:test.php

示例8: elseif

         echo "file_limit=0\n";
     }
 } elseif ($_GET["mode"] == "file") {
     $DIR_NAME = "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/1c_exchange/";
     $ABS_FILE_NAME = false;
     $WORK_DIR_NAME = false;
     if (isset($_GET["filename"]) && strlen($_GET["filename"]) > 0) {
         //This check for 1c server on linux
         $filename = preg_replace("#^(/tmp/|upload/1c/webdata)#", "", $_GET["filename"]);
         //Filter file name crap all alone
         $filename = preg_replace("/[^a-zA-Z0-9_.\\/\\\\]/", "", $filename);
         $io = CBXVirtualIo::GetInstance();
         $bBadFile = HasScriptExtension($filename) || IsFileUnsafe($filename) || !$io->ValidatePathString("/" . $filename);
         if (!$bBadFile) {
             $filename = trim(str_replace("\\", "/", trim($filename)), "/");
             $FILE_NAME = rel2abs($_SERVER["DOCUMENT_ROOT"] . $DIR_NAME, "/" . $filename);
             if (strlen($FILE_NAME) > 1 && $FILE_NAME === "/" . $filename) {
                 $ABS_FILE_NAME = $_SERVER["DOCUMENT_ROOT"] . $DIR_NAME . $FILE_NAME;
                 $WORK_DIR_NAME = substr($ABS_FILE_NAME, 0, strrpos($ABS_FILE_NAME, "/") + 1);
             }
         }
     }
     if ($ABS_FILE_NAME) {
         if (function_exists("file_get_contents")) {
             $DATA = file_get_contents("php://input");
         } elseif (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
             $DATA =& $GLOBALS["HTTP_RAW_POST_DATA"];
         } else {
             $DATA = false;
         }
         if ($DATA !== false) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例9: UnZip

 public static function UnZip($file_name, $last_zip_entry = "", $start_time = 0, $interval = 0)
 {
     global $APPLICATION;
     $io = CBXVirtualIo::GetInstance();
     //Function and securioty checks
     if (!function_exists("zip_open")) {
         return false;
     }
     $dir_name = substr($file_name, 0, strrpos($file_name, "/") + 1);
     if (strlen($dir_name) <= strlen($_SERVER["DOCUMENT_ROOT"])) {
         return false;
     }
     $hZip = zip_open($file_name);
     if (!$hZip) {
         return false;
     }
     //Skip from last step
     if ($last_zip_entry) {
         while ($entry = zip_read($hZip)) {
             if (zip_entry_name($entry) == $last_zip_entry) {
                 break;
             }
         }
     }
     $io = CBXVirtualIo::GetInstance();
     //Continue unzip
     while ($entry = zip_read($hZip)) {
         $entry_name = zip_entry_name($entry);
         //Check for directory
         zip_entry_open($hZip, $entry);
         if (zip_entry_filesize($entry)) {
             $file_name = trim(str_replace("\\", "/", trim($entry_name)), "/");
             $file_name = $APPLICATION->ConvertCharset($file_name, "cp866", LANG_CHARSET);
             $file_name = preg_replace("#^import_files/tmp/webdata/\\d+/\\d+/import_files/#", "import_files/", $file_name);
             $bBadFile = HasScriptExtension($file_name) || IsFileUnsafe($file_name) || !$io->ValidatePathString("/" . $file_name);
             if (!$bBadFile) {
                 $file_name = $io->GetPhysicalName($dir_name . rel2abs("/", $file_name));
                 CheckDirPath($file_name);
                 $fout = fopen($file_name, "wb");
                 if (!$fout) {
                     return false;
                 }
                 while ($data = zip_entry_read($entry, 102400)) {
                     $data_len = function_exists('mb_strlen') ? mb_strlen($data, 'latin1') : strlen($data);
                     $result = fwrite($fout, $data);
                     if ($result !== $data_len) {
                         return false;
                     }
                 }
             }
         }
         zip_entry_close($entry);
         //Jump to next step
         if ($interval > 0 && time() - $start_time > $interval) {
             zip_close($hZip);
             return $entry_name;
         }
     }
     zip_close($hZip);
     return true;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:61,代码来源:cml2.php

示例10: elseif

 } elseif ($_REQUEST["server_action"] == "start") {
     $bWindowsHosting = false;
     $strCurrentOS = PHP_OS;
     if (StrToUpper(substr($strCurrentOS, 0, 3)) === "WIN") {
         $bWindowsHosting = true;
     }
     $phpPath = COption::GetOptionString("xmpp", "php_path", $bWindowsHosting ? "../apache/php.exe -c ../apache/php.ini" : "php -c /etc/php.ini");
     $serverPath = COption::GetOptionString("xmpp", "server_path", "./bitrix/modules/xmpp/xmppd.php");
     //$serverLogPath = COption::GetOptionString("xmpp", "server_log_path", "xmppd.log");
     chdir($_SERVER["DOCUMENT_ROOT"]);
     if ($phpPath == "../apache/php.exe -c ../apache/php.ini" && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/../apache/php.exe") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/../apache2/zendserver/bin/php.exe")) {
         $phpPath = "../Apache2/zendserver/bin/php.exe -c ../Apache2/zendserver/etc/php.ini";
     }
     if (trim($phpPath) == "../Apache2/zendserver/bin/php.exe -c ../Apache2/zendserver/etc/php.ini") {
         $phpPath = "./Apache2/zendserver/bin/php.exe -c ./Apache2/zendserver/etc/php.ini";
         $serverPath = '"' . rel2abs($_SERVER['DOCUMENT_ROOT'], $serverPath) . '"';
         chdir("..");
     }
     $startErrorMessage = "";
     $p = $phpPath . " " . ($bWindowsHosting ? $serverPath : $_SERVER['DOCUMENT_ROOT'] . ltrim($serverPath, '.')) . " test_mode";
     if (!$bWindowsHosting) {
         $p .= " 2>&1";
     } else {
         $p = str_replace("/", "\\", $p);
     }
     exec($p, $execOutput, $execReturnVar);
     $s = strtolower(implode("\n", $execOutput));
     if ($execReturnVar == 0) {
         if (strlen($s) <= 0) {
             $startErrorMessage .= "Unknown error";
         } elseif (strpos($s, "server started") === false || strpos($s, "error") !== false) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:xmpp_server.php

示例11: ImportXMLFile

/**
 * Imports an xml file into iblock. File may be an .tar.gz archive.
 *
 * @param string $file_name Name of the file to import
 * @param string $iblock_type IBlock type ID to import iblock to
 * @param string|array $site_id ID of the site or array of IDs to bind iblock to
 * @param string $section_action What to do with sections missed in the file. D - delete or A - deactivate.
 * @param string $element_action What to do with elements missed in the file. D - delete or A - deactivate.
 * @param bool $use_crc Whenever to use CRC check for optimizi=ation or force an update
 * @param bool $preview If true when use iblock settings to generate preview pictures from detail.
 * @param bool $sync If true uses alternative set of tables in order not to interfere with other import processes
 * @param bool $return_last_error If true will return string with error description in case of failure
 * @param bool $return_iblock_id If true will return iblock identifier (int) in case of success
 * @return bool|int|string
 */
function ImportXMLFile($file_name, $iblock_type = "-", $site_id = '', $section_action = "D", $element_action = "D", $use_crc = false, $preview = false, $sync = false, $return_last_error = false, $return_iblock_id = false)
{
    /** @global CMain $APPLICATION */
    global $APPLICATION;
    $ABS_FILE_NAME = false;
    if (strlen($file_name) > 0) {
        if (file_exists($file_name) && is_file($file_name) && (substr($file_name, -4) === ".xml" || substr($file_name, -7) === ".tar.gz")) {
            $ABS_FILE_NAME = $file_name;
        } else {
            $filename = trim(str_replace("\\", "/", trim($file_name)), "/");
            $FILE_NAME = rel2abs($_SERVER["DOCUMENT_ROOT"], "/" . $filename);
            if (strlen($FILE_NAME) > 1 && $FILE_NAME === "/" . $filename && $APPLICATION->GetFileAccessPermission($FILE_NAME) >= "W") {
                $ABS_FILE_NAME = $_SERVER["DOCUMENT_ROOT"] . $FILE_NAME;
            }
        }
    }
    if (!$ABS_FILE_NAME) {
        return GetMessage("IBLOCK_XML2_FILE_ERROR");
    }
    $WORK_DIR_NAME = substr($ABS_FILE_NAME, 0, strrpos($ABS_FILE_NAME, "/") + 1);
    if (substr($ABS_FILE_NAME, -7) == ".tar.gz") {
        include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/tar_gz.php";
        $obArchiver = new CArchiver($ABS_FILE_NAME);
        if (!$obArchiver->ExtractFiles($WORK_DIR_NAME)) {
            $strError = "";
            if (is_object($APPLICATION)) {
                $arErrors = $obArchiver->GetErrors();
                if (count($arErrors)) {
                    foreach ($arErrors as $error) {
                        $strError .= $error[1] . "<br>";
                    }
                }
            }
            if ($strError != "") {
                return $strError;
            } else {
                return GetMessage("IBLOCK_XML2_FILE_ERROR");
            }
        }
        $IMP_FILE_NAME = substr($ABS_FILE_NAME, 0, -7) . ".xml";
    } else {
        $IMP_FILE_NAME = $ABS_FILE_NAME;
    }
    $fp = fopen($IMP_FILE_NAME, "rb");
    if (!$fp) {
        return GetMessage("IBLOCK_XML2_FILE_ERROR");
    }
    if ($sync) {
        $table_name = "b_xml_tree_sync";
    } else {
        $table_name = "b_xml_tree";
    }
    $NS = array("STEP" => 0);
    $obCatalog = new CIBlockCMLImport();
    $obCatalog->Init($NS, $WORK_DIR_NAME, $use_crc, $preview, false, false, false, $table_name);
    if ($sync) {
        if (!$obCatalog->StartSession(bitrix_sessid())) {
            return GetMessage("IBLOCK_XML2_TABLE_CREATE_ERROR");
        }
        $obCatalog->ReadXMLToDatabase($fp, $NS, 0, 1024);
        $xml_root = $obCatalog->GetSessionRoot();
        $bUpdateIBlock = false;
    } else {
        $obCatalog->DropTemporaryTables();
        if (!$obCatalog->CreateTemporaryTables()) {
            return GetMessage("IBLOCK_XML2_TABLE_CREATE_ERROR");
        }
        $obCatalog->ReadXMLToDatabase($fp, $NS, 0, 1024);
        if (!$obCatalog->IndexTemporaryTables()) {
            return GetMessage("IBLOCK_XML2_INDEX_ERROR");
        }
        $xml_root = 1;
        $bUpdateIBlock = true;
    }
    fclose($fp);
    $result = $obCatalog->ImportMetaData($xml_root, $iblock_type, $site_id, $bUpdateIBlock);
    if ($result !== true) {
        return GetMessage("IBLOCK_XML2_METADATA_ERROR") . implode("\n", $result);
    }
    $obCatalog->ImportSections();
    $obCatalog->DeactivateSections($section_action);
    $obCatalog->SectionsResort();
    $obCatalog = new CIBlockCMLImport();
    $obCatalog->Init($NS, $WORK_DIR_NAME, $use_crc, $preview, false, false, false, $table_name);
    if ($sync) {
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:iblock.php

示例12: prepUrl

 public function prepUrl($link, $url, $domain)
 {
     //basic filtering of URLs we don't need
     //filter out links starting with '#'
     if ($link[0] == '#') {
         return false;
     }
     //filter out external links
     if ((strpos($link, 'http://') !== false || strpos($link, 'https://') !== false) && strpos($ancor, $domain) === false) {
         return false;
     }
     //absolute or relative URL
     if (0 === strpos($link, "http") || 0 === strpos($link, "https") || 0 === strpos($link, "/")) {
         //absolute
         if (0 === strpos($link, "/")) {
             //absolute without domain, append domain
             return "http://" . $domain . $link;
         } else {
             //nothing to do
             return $link;
         }
     } else {
         //relative
         //echo rel2abs($link, $url)."<br>";
         return rel2abs($link, $url);
     }
 }
开发者ID:QuijoteShin,项目名称:statiq,代码行数:27,代码来源:crawlmodel.php

示例13: in_array

        if ($time > date('YmdHis')) {
            continue;
        }
        $title = in_array($elem['bt_type'], array('article', 'link', 'note')) ? $elem['bt_title'] : $elem['bt_author'];
        $tag = 'tag:' . parse_url($GLOBALS['racine'], PHP_URL_HOST) . ',' . date_create_from_format('YmdHis', $time)->format('Y-m-d') . ':' . $elem['bt_type'] . '-' . $elem['bt_id'];
        // normal code
        $xml_post .= '<entry>' . "\n";
        $xml_post .= '<title>' . $title . '</title>' . "\n";
        $xml_post .= '<id>' . $tag . '</id>' . "\n";
        $xml_post .= '<updated>' . date_create_from_format('YmdHis', $time)->format('c') . '</updated>' . "\n";
        if ($elem['bt_type'] == 'link') {
            if ($invert) {
                $xml_post .= '<link href="' . $GLOBALS['racine'] . '?id=' . $elem['bt_id'] . '"/>' . "\n";
                $xml_post .= '<content type="html">' . htmlspecialchars(rel2abs($elem['bt_content']) . '<br/> — (<a href="' . $elem['bt_link'] . '">link</a>)') . '</content>' . "\n";
            } else {
                $xml_post .= '<link href="' . $elem['bt_link'] . '"/>' . "\n";
                $xml_post .= '<content type="html">' . htmlspecialchars(rel2abs($elem['bt_content']) . '<br/> — (<a href="' . $GLOBALS['racine'] . '?id=' . $elem['bt_id'] . '">permalink</a>)') . '</content>' . "\n";
            }
        } else {
            $xml_post .= '<link href="' . $elem['bt_link'] . '"/>' . "\n";
            $xml_post .= '<content type="html">' . htmlspecialchars(rel2abs($elem['bt_content'])) . '</content>' . "\n";
        }
        $xml_post .= '</entry>' . "\n";
    }
    $xml .= '<updated>' . date_create_from_format('YmdHis', $main_updated)->format('c') . '</updated>' . "\n";
    $xml .= $xml_post;
    echo $xml;
}
$end = microtime(TRUE);
echo '<!-- generated in ' . round($end - $begin, 6) . ' seconds -->' . "\n";
echo '</feed>';
开发者ID:wazari972,项目名称:blogotext,代码行数:31,代码来源:atom.php

示例14: mysql_fetch_assoc

                $RecipArray[$RecipIndex][0] = mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
            }
        }
        $RecipIndex++;
    }
    @session_start();
    $_SESSION[$EmailRef . "_Status"] = $GLOBALS[$EmailRef . "_Status"];
    $_SESSION[$EmailRef . "_Index"] = $GLOBALS[$EmailRef . "_Index"];
    $_SESSION[$EmailRef . "_From"] = $GLOBALS[$EmailRef . "_From"];
    $_SESSION[$EmailRef . "_To"] = $GLOBALS[$EmailRef . "_To"];
    $_SESSION[$EmailRef . "_Subject"] = $GLOBALS[$EmailRef . "_Subject"];
    $_SESSION[$EmailRef . "_Body"] = $GLOBALS[$EmailRef . "_Body"];
    $_SESSION[$EmailRef . "_Header"] = $GLOBALS[$EmailRef . "_Header"];
    $_SESSION[$EmailRef . "_Log"] = $GLOBALS[$EmailRef . "_Log"];
    if (function_exists("rel2abs")) {
        $GoToPage = $GoToPage ? rel2abs($GoToPage, dirname(__FILE__)) : "";
    }
    if ($GoToPage != "") {
        header("Location: " . $GoToPage);
    }
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
</head>

<body>
开发者ID:Mayoh,项目名称:grupo-ha,代码行数:30,代码来源:correo.php

示例15: searchInDir

        $zip->close();
        $res = searchInDir(array('\\.(js)$'), $build_directory, TRUE);
        $zipFilename = str_replace('.min.js', '.zip', basename($res[0]));
        header('Content-Type: application/zip');
        header('Content-Disposition: attachment; filename="' . $zipFilename . '"');
        header('Content-Length: ' . filesize($pathZipFile));
        readfile($pathZipFile);
        unlink($pathZipFile);
        exit;
    } else {
        if ($format == 'code') {
            $typeFile = 'js';
            if (strtolower(param('file')) == 'css') {
                $typeFile = 'css';
            }
            $files = searchInDir(array('\\.' . $typeFile . '$'), $build_directory, TRUE);
            echo file_get_contents($files[0]);
        } else {
            if ($format == 'json') {
                // Return Json object
                echo json_encode(array('status' => 'success', 'result' => array('guid' => $guid, 'filenames' => array_map(function ($path) {
                    $relativePath = getRelativePath(WINK_DIRECTORY, $path);
                    $baseURL = 'http://' . $_SERVER['SERVER_NAME'] . '/' . basename(realpath(WINK_DIRECTORY)) . '/';
                    return rel2abs($relativePath, $baseURL);
                }, searchInDir(array('\\.(css|js)$'), $build_directory, TRUE)))));
            }
        }
    }
} catch (Exception $e) {
    echo json_encode(array('status' => 'fail', 'result' => array('code' => $e->getCode(), 'message' => $e->getMessage())));
}
开发者ID:jupiterben,项目名称:wink,代码行数:31,代码来源:builder.php


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