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


PHP REST::isValidURI方法代码示例

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


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

示例1: htmlspecialchars

        echo REST::html_start('Metadata for handle ' . htmlspecialchars($handle->handle(), ENT_COMPAT, 'UTF-8'));
        echo <<<EOS
<table class="handledata"><tbody><tr>
<th class="idx">idx</th>
<th class="type">type</th>
<th class="data">data</th>
<th class="data">refs</th>
<th class="modified">timestamp</th>
</tr>
EOS;
        foreach ($handle->type as $idx => $type) {
            if (strpos($type, 'HS_') === 0) {
                continue;
            }
            echo '<tr><td class="idx">' . $idx . '</td><td class="type">' . htmlspecialchars($type, ENT_COMPAT, 'UTF-8') . '</td><td class="data">';
            if ($type == 'URL' && REST::isValidURI($handle->data[$idx])) {
                echo '<a href="' . $handle->data[$idx] . '">' . htmlspecialchars($handle->data[$idx]) . '</a>';
            } elseif ($type == 'EMAIL') {
                echo '<a href="mailto:' . $handle->data[$idx] . '">' . htmlspecialchars($handle->data[$idx]) . '</a>';
            } else {
                echo $handle->data[$idx] === mb_convert_encoding(mb_convert_encoding($handle->data[$idx], 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') ? htmlspecialchars($handle->data[$idx], ENT_COMPAT, 'ISO-8859-1') : '<pre>' . htmlspecialchars(addcslashes($handle->data[$idx], "\\..\t\v....ÿ"), ENT_COMPAT, 'ISO-8859-1') . '</pre>';
            }
            echo '</td><td class="refs">' . htmlspecialchars($handle->refs[$idx]) . '</td><td class="modified">' . REST::http_date($handle->timestamp[$idx]) . "</td></tr>\n";
        }
        echo '</tbody></table>' . REST::html_end();
    } elseif ($content_type == 'application/json') {
        $json = array();
        foreach ($handle->type as $idx => $type) {
            if (strpos($type, 'HS_') !== 0) {
                // Was: $type != 'HS_ADMIN'
                $json[$idx] = array('type' => (string) $type, 'data' => (string) $handle->data[$idx], 'timestamp' => (int) $handle->timestamp[$idx], 'refs' => (string) $handle->refs[$idx]);
开发者ID:CatchPlus,项目名称:CATCHPlus-Handle-Service,代码行数:31,代码来源:handle.php

示例2: tempnam

$appversion = @$path_info[1];
$portlet = Portal_App::factory($appname, $appversion);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $user_id = Portal_User::current()->user_id();
    $applicationURL = "http://{$_SERVER['SERVER_NAME']}/gridapps/{$appname}-{$appversion}.tgz";
    $TEMPNAM = tempnam('/tmp', 'portal_');
    register_shutdown_function('myRemoveTempFiles');
    $sandbox = "{$TEMPNAM}.d/";
    mkdir($sandbox);
    $bashcode = $database = '';
    $portlet->doPOST($sandbox, $bashcode, $database);
    if (substr($database, 0, 1) === '/') {
        $database = REST::urlbase() . $database;
    }
    $database = str_replace(REST::urlbase(), 'https://' . $_SERVER['SERVER_NAME'] . ':' . Portal::PORT_SSL_CSA, $database);
    if (!empty($database) && !REST::isValidURI($database)) {
        REST::fatal(REST::HTTP_BAD_REQUEST, "{$database} is not a valid URL.");
    }
    $escdatabase = escapeshellarg($database);
    file_put_contents($sandbox . 'run.sh', <<<EOS
#!/bin/bash

DATABASE={$escdatabase}
APPLICATION='{$applicationURL}'
USER_ID={$user_id}

function runJob() (
{$bashcode}
)

EOS
开发者ID:CatchPlus,项目名称:CATCHPlus-Handle-Service,代码行数:31,代码来源:application.php


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