• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP normalize_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: is_junkblog

function is_junkblog($url, $strict = false)
{
    $url = normalize_url($url);
    $query = XN_Query::create('Content')->filter('owner->relativeUrl', '=', 'someblogs')->filter('type', 'eic', 'Website')->filter('my.url', '=', $url);
    $items = $query->execute();
    if (count($items)) {
        if ($strict === true && !$items[0]->my->verify) {
            return false;
        }
        return $items[0];
    }
    //end if count items
    if ($strict) {
        return false;
    }
    $page = strip_tags(file_get_contents($url));
    $stoplist = array('drunk', 'free links', 'sex', 'cock', 'pussy', 'porn', 'pr0n', 'pron', 'I went', 'I slept', 'slept with', 'my boss', 'loser', 'my cat', 'I love you', 'this update is');
    foreach ($stoplist as $stop) {
        if (stristr($page, ' ' . $stop . ' ')) {
            $dummy = file_get_contents('http://someblogs.ning.com/add.php?xn_auth=no&url=' . urlencode($url));
            return $strict ? false : true;
        }
        //end if stop
    }
    //end foreach stoplist
    return false;
}
开发者ID:singpolyma,项目名称:someblogs,代码行数:27,代码来源:is_junkblog.php


示例2: get_url

 /**
  * build a reference to a version
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - versions/view.php?id=123 or versions/view.php/123 or version-123
  *
  * - other - versions/edit.php?id=123 or versions/edit.php/123 or version-edit/123
  *
  * @param int the id of the version to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view')
 {
     global $context;
     // list versions -- the id has to be an anchor (e.g., 'article:15')
     if ($action == 'list') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'versions/list.php/' . str_replace(':', '/', $id);
         } else {
             return 'versions/list.php?id=' . urlencode($id);
         }
     }
     // check the target action
     if (!preg_match('/^(delete|restore|view)$/', $action)) {
         return 'versions/' . $action . '.php?id=' . urlencode($id);
     }
     // normalize the link
     return normalize_url(array('versions', 'version'), $action, $id);
 }
开发者ID:rair,项目名称:yacs,代码行数:34,代码来源:versions.php


示例3: require_login

<?php

// Make sure user is logged in
require_login();
// Normalize the URL
$href = normalize_url(@$_POST['href']);
// Strip tags, normalize whitespace, shorten if necessary
$summary = summarize($_POST['summary']);
// Filter content to prevent against XSS attacks
$content = filter_content($_POST['content']);
// Escape content for the database to prevent SQL injection
$href = $db->escape($href);
$summary = $db->escape($summary);
$space = $db->escape($_POST['space']);
$content = $db->escape($content);
$version = $db->escape($_POST['version']);
if (isset($_POST['status']) && is_numeric($_POST['status'])) {
    $status = $db->escape($_POST['status']);
} else {
    $status = 1;
}
// Check to make sure we have everything
if (empty($href)) {
    respond(0, "Please specify an 'href' argument.");
} else {
    if (empty($space)) {
        respond(0, "Please specify a 'space' argument.");
    } else {
        if (empty($content)) {
            respond(0, "Please specify a 'content' argument.");
        } else {
开发者ID:kenyattaclark,项目名称:shiftspace,代码行数:31,代码来源:shift.create.php


示例4: ob_flush

				padding-left: 0px;
			}
		</style>
	</head>


	<body>
	<?php 
require 'header.php';
ob_flush();
flush();
if ($_GET['id']) {
    $person_id = mysql_real_escape_string($_GET['id'], $db);
} else {
    require 'normalize_url.php';
    $url = mysql_real_escape_string(normalize_url($_GET['url']), $db);
    if (!isset($_GET['nofetch'])) {
        shell_exec("ruby fetch_profile.rb '{$url}' 2>&1");
    }
    $person_id = @mysql_fetch_assoc(mysql_query("SELECT person_id FROM urls WHERE url='{$url}'", $db));
    $person_id = $person_id['person_id'];
}
//end if id
if (!$person_id) {
    die('No profile found!');
}
if (!isset($_GET['contacts'])) {
    $person = mysql_fetch_assoc(mysql_query("SELECT * FROM people WHERE person_id={$person_id}", $db));
    echo "\t\t" . '<div id="profile" class="vcard">' . "\n";
    $photos = mysql_query("SELECT value FROM fields WHERE type='photo' AND person_id={$person_id}", $db);
    if (mysql_num_rows($photos)) {
开发者ID:singpolyma,项目名称:social-search-me,代码行数:31,代码来源:person.php


示例5: normalize_url

<?php

require_once 'xn-app://someblogs/normalize_url.php';
$_REQUEST['url'] = normalize_url($_REQUEST['url']);
require_once 'is_junkblog.php';
$item = is_junkblog($_REQUEST['url']);
if ($_REQUEST['format'] == 'xml') {
    header('Content-Type: application/xml;charset=utf-8');
    echo '<blog>' . "\n";
    echo '   <result>' . ($item && $item->my->verify ? '1' : '0') . '</result>' . "\n";
    echo '   <blog_url>' . htmlspecialchars($_REQUEST['url']) . '</blog_url>';
    echo '</blog>';
} else {
    if ($item) {
        echo '<h2>Blog Found!</h2><p>' . htmlspecialchars($_REQUEST['url']) . ($item->my->verify ? " is a 'junk' blog.  If you think this listing is in error, please contact us using the 'Report This App' feature from the 'Popular' tab of the Ningbar, above." : " has been suggested as a 'junk' blog.  If you think this listing is in error, please vote 'Not Junk' on <a href=\"/\">the main page</a>.") . '</p>';
    } else {
        echo '<h2>Blog Not Found!</h2><p>' . htmlspecialchars($_REQUEST['url']) . " is not a 'junk' blog.</p>";
    }
    echo '<br /><p><a href="?url=' . $_REQUEST['url'] . '&amp;format=xml">Get these results as XML</a></p>';
}
//end if-else format
开发者ID:singpolyma,项目名称:someblogs,代码行数:21,代码来源:search.php


示例6: explode

        //end while person = fetch people
        echo "], ";
    }
    //end if-else num_rows people
    return $matches;
}
//end function print_results
$n = explode(' ', $_GET['q']);
$nickname = mysql_real_escape_string($_GET['q'], $db);
$given_name = mysql_real_escape_string(array_shift($n), $db);
$family_name = mysql_real_escape_string(array_pop($n), $db);
$additional_name = mysql_real_escape_string(implode(' ', $n), $db);
$results = 0;
if ($_GET['pov']) {
    require 'normalize_url.php';
    $pov = @mysql_fetch_assoc(mysql_query("SELECT person_id FROM urls WHERE url='" . mysql_real_escape_string(normalize_url($_GET['pov']), $db) . "'"));
    $pov = intval($pov['person_id']);
    $people = mysql_query("SELECT people.person_id,people.fn,urls.url FROM contacts,urls,people WHERE contacts.person_id={$pov} AND contacts.url=urls.url AND urls.person_id=people.person_id AND people.fn LIKE '%{$nickname}%'", $db) or die(mysql_error());
    $results += print_results($people, $db, 'Matches from Contacts');
}
//end if pov
$people = mysql_query("SELECT person_id,fn FROM people WHERE `given-name` LIKE '%{$given_name}%' AND `family-name` LIKE '%{$family_name}%' AND `additional-name` LIKE '%{$additional_name}%'" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count']) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Exact matches');
$people = mysql_query("SELECT person_id,value AS fn FROM fields WHERE value LIKE '%{$nickname}%' AND (type='nickname' OR type='email')" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count'] - $results) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Nickname matches');
$people = mysql_query("SELECT person_id,fn FROM people WHERE fn LIKE '%{$nickname}%'" . ($_GET['count'] ? ' LIMIT ' . intval($_GET['count'] - $results) : ''), $db) or die(mysql_error());
$results += print_results($people, $db, 'Fuzzy matches');
echo '}';
if ($_GET['callback']) {
    echo ')';
}
开发者ID:singpolyma,项目名称:social-search-me,代码行数:31,代码来源:search.js.php


示例7: get_url

 /**
  * build a reference to a server
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - servers/view.php?id=123 or servers/view.php/123 or server-123
  *
  * - other - servers/edit.php?id=123 or servers/edit.php/123 or server-edit/123
  *
  * @param int the id of the server to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view')
 {
     global $context;
     // check the target action
     if (!preg_match('/^(delete|edit|test|view)$/', $action)) {
         return 'servers/' . $action . '.php?id=' . urlencode($id);
     }
     // normalize the link
     return normalize_url(array('servers', 'server'), $action, $id);
 }
开发者ID:rair,项目名称:yacs,代码行数:26,代码来源:servers.php


示例8: get_url

 /**
  * build a reference to a section
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - sections/view.php?id=123 or sections/view.php/123 or section-123
  *
  * - other - sections/edit.php?id=123 or sections/edit.php/123 or section-edit/123
  *
  * If a fourth parameter is provided, it will take over the third one. This
  * is used to leverage nick names in YACS, as per the following invocation:
  * [php]
  * Sections::get_url($item['id'], 'view', $item['title'], $item['nick_name']);
  * [/php]
  *
  * @param int the id of the section to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @param string additional data, such as section nick name, if any
  * @param string alternate name, if any, to take over on previous parameter
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view', $name = NULL, $alternate_name = NULL)
 {
     global $context;
     // use nick name instead of regular name, if one is provided
     if ($alternate_name && $context['with_alternate_urls'] == 'Y') {
         $name = str_replace('_', ' ', $alternate_name);
     }
     // the service to check for updates
     if ($action == 'check') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'services/check.php/section/' . rawurlencode($id);
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'services/check.php?id=' . urlencode('section:' . $id);
         } else {
             return 'services/check.php?id=' . urlencode('section:' . $id);
         }
     }
     // the RSD link
     if ($action == 'EditURI') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'services/describe.php/' . rawurlencode($id);
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'services/describe.php/' . rawurlencode($id);
         } else {
             return 'services/describe.php?anchor=' . urlencode($id);
         }
     }
     // the rss feed for files --deprecated to files::get_url()
     if ($action == 'files') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'files/feed.php/section/' . rawurlencode($id);
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'files/feed.php/section/' . rawurlencode($id);
         } else {
             return 'files/feed.php?anchor=' . urlencode('section:' . $id);
         }
     }
     // invite someone to participate
     if ($action == 'invite') {
         if ($name) {
             return 'sections/invite.php?id=' . urlencode($id) . '&amp;invited=' . urlencode($name);
         } else {
             return 'sections/invite.php?id=' . urlencode($id);
         }
     }
     // the prefix for managing content
     if ($action == 'manage') {
         if ($name) {
             return 'sections/manage.php?id=' . urlencode($id) . '&amp;' . urlencode($name) . '=';
         } else {
             return 'sections/manage.php?id=' . urlencode($id);
         }
     }
     // check the target action
     if (!preg_match('/^(delete|describe|duplicate|edit|export|feed|import|invite|lock|mail|navigate|own|print|view)$/', $action)) {
         return 'sections/' . $action . '.php?id=' . urlencode($id) . '&action=' . urlencode($name);
     }
     // normalize the link
     return normalize_url(array('sections', 'section'), $action, $id, $name);
 }
开发者ID:rair,项目名称:yacs,代码行数:84,代码来源:sections.php


示例9: get_url

 /**
  * build a reference to a image
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - images/view.php?id=123 or images/view.php/123 or image-123
  *
  * - other - images/edit.php?id=123 or images/edit.php/123 or image-edit/123
  *
  * @param int the id of the image to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view')
 {
     global $context;
     // check the target action
     if (!preg_match('/^(delete|edit|set_as_icon|set_as_thumbnail|view)$/', $action)) {
         return 'images/' . $action . '.php?id=' . urlencode($id);
     }
     // normalize the link
     return normalize_url(array('images', 'image'), $action, $id);
 }
开发者ID:rair,项目名称:yacs,代码行数:26,代码来源:images.php


示例10: json_response

        $channel->type = 'feeds';
        $channel->save();
        json_response($app, ['result' => 'ok']);
    }
});
$app->post('/channels/discover', function ($format = 'json') use($app) {
    if ($user = require_login_json($app)) {
        $params = $app->request()->params();
        // $feeds = array(
        //   array('url' => 'http://pk.dev/', 'display_url' => friendly_url('http://pk.dev/'), 'type' => 'microformats2'),
        //   array('url' => 'http://pk.dev/articles.atom', 'display_url' => friendly_url('http://pk.dev/articles.atom'), 'type' => 'atom')
        // );
        $feeds = [];
        // Parse the URL and check for microformats h-entry posts, as well as linked rss or atom feeds
        $html = request\get_url($params['url']);
        $url = normalize_url($params['url']);
        if ($html) {
            $mf2 = feeds\parse_mf2($html, $params['url']);
            // check if there are any h-entry posts
            $feed = feeds\find_feed_info($mf2);
            if ($feed) {
                $feeds[] = ['url' => $url, 'display_url' => friendly_url($url), 'icon' => '<i class="icon-microformats"></i>', 'enabled' => true];
            }
            $alternates = feeds\get_alternates($mf2);
            foreach ($alternates as $alt) {
                $feeds[] = ['url' => $alt['url'], 'display_url' => friendly_url($alt['url']), 'icon' => '<i class="fa fa-rss"></i>', 'enabled' => false];
            }
        }
        json_response($app, ['feeds' => $feeds]);
    }
});
开发者ID:diplix,项目名称:Monocle,代码行数:31,代码来源:channels.php


示例11: respond

<?php

// Check for content based on URL
$href = $db->escape(normalize_url(@$_POST['href']));
// Sanity check
if (empty($href)) {
    respond(0, "Please specify an 'href' argument.");
}
$response = array();
if (empty($user)) {
    // Only check for public content
    $response['count'] = $db->value("\n    SELECT COUNT(id)\n    FROM shift\n    WHERE status = 1\n    AND href = '{$href}'\n  ");
} else {
    // Check for both public and private content
    $response['count'] = $db->value("\n    SELECT COUNT(s.id)\n    FROM shift s,\n         user u\n    WHERE (\n      s.status = 1\n      OR (\n        s.status = 2\n        AND s.user_id = {$user->id}\n      )\n    )\n    AND s.user_id = u.id\n    AND s.href = '{$href}'\n  ");
    $response['username'] = $user->username;
    $response['email'] = $user->email;
}
// Done
respond(1, $response);
开发者ID:kenyattaclark,项目名称:shiftspace,代码行数:20,代码来源:query.php


示例12: get_url

 /**
  * build a reference to a category
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - categories/view.php?id=123 or categories/view.php/123 or categorie-123
  *
  * - other - categories/edit.php?id=123 or categories/edit.php/123 or category-edit/123
  *
  * @param int the id of the category to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @param string additional data, such as category name, if any
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view', $name = NULL)
 {
     global $context;
     // select a category for an anchor
     if ($action == 'select') {
         return 'categories/select.php?anchor=' . urlencode($id);
     }
     // check the target action
     if (!preg_match('/^(delete|describe|edit|feed|mail|navigate|print|view)$/', $action)) {
         return 'categories/' . $action . '.php?id=' . urlencode($id) . '&action=' . urlencode($name);
     }
     // normalize the link
     return normalize_url(array('categories', 'category'), $action, $id, $name);
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:categories.php


示例13: get_url

 /**
  * build a reference to a user
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - users/view.php?id=123 or users/view.php/123 or user-123
  *
  * - other - users/edit.php?id=123 or users/edit.php/123 or user-edit/123
  *
  * @param int the id of the user to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @param string user name
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view', $name = NULL)
 {
     global $context;
     // track something -- the id has to be an anchor (e.g., 'article:15')
     if ($action == 'track') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'users/track.php/' . str_replace(':', '/', $id);
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'users/track.php/' . str_replace(':', '/', $id);
         } else {
             return 'users/track.php?anchor=' . urlencode($id);
         }
     }
     // assign users to an anchor
     if ($action == 'select') {
         return 'users/select.php?member=' . urlencode($id);
     }
     // list watchers
     if ($action == 'watch') {
         return 'users/select.php?anchor=' . urlencode($id);
     }
     // check the target action
     if (!preg_match('/^(contact|delete|describe|edit|element|feed|fetch_vcard|leave|mail|navigate|password|print|select_avatar|share|transfer|validate|view|visit)$/', $action)) {
         return 'users/' . $action . '.php?id=' . urlencode($id) . '&action=' . urlencode($name);
     }
     // 		// view user profile --use only the nick name, since it is unique
     // 		if(($action == 'view') && $name) {
     // 			$id = $name;
     // 			$name = '';
     // 		}
     // normalize the link
     return normalize_url(array('users', 'user'), $action, $id, $name);
 }
开发者ID:rair,项目名称:yacs,代码行数:50,代码来源:users.php


示例14: social_networking_get_normalized_urls

function social_networking_get_normalized_urls($url, $level = 0)
{
    global $social_networking_normalized_urls;
    $openIDc = new WordpressOpenIDRegistration();
    $page = social_networking_getTidy($url);
    if (is_int($url[strlen($url) - 1])) {
        unset($url[strlen($url) - 1]);
    }
    $social_networking_normalized_urls[] = $openIDc->normalize_username(normalize_url($url));
    $theParser = xml_parser_create();
    xml_parse_into_struct($theParser, $page, $vals);
    xml_parser_free($theParser);
    foreach ($vals as $el) {
        if (!in_array('me', explode(' ', strtolower(trim($el['attributes']['REL']))))) {
            continue;
        }
        $el['attributes']['HREF'] = trim($el['attributes']['HREF']);
        if (!$level) {
            social_networking_get_normalized_urls($el['attributes']['HREF'], $level + 1);
        }
        if (is_int($el['attributes']['HREF'][strlen($el['attributes']['HREF']) - 1])) {
            unset($el['attributes']['HREF'][strlen($el['attributes']['HREF']) - 1]);
        }
        $tmp[] = $openIDc->normalize_username(normalize_url($el['attributes']['HREF']));
    }
    //end foreach vals as el
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:27,代码来源:social-networking.php


示例15: process_avatarurl

function process_avatarurl($url)
{
    global $vbulletin;
    if ($url == '') {
        return;
    }
    if (stripos($url, 'http:') !== false) {
        return reverse_htmlentities(normalize_url($url));
    } else {
        if (is_vb()) {
            if (strpos($url, '/') === 0) {
                $host = parse_url($vbulletin->options['bburl']);
                return normalize_url($host['scheme'] . '://' . $host['host'] . reverse_htmlentities($url));
            } else {
                return normalize_url($vbulletin->options['bburl'] . '/' . reverse_htmlentities($url));
            }
        } else {
            if (is_phpbb()) {
                return normalize_url(fr_get_phpbb_bburl() . reverse_htmlentities($url));
            } else {
                if (is_xen()) {
                    return normalize_url(fr_get_xenforo_bburl() . '/' . reverse_htmlentities($url));
                }
            }
        }
    }
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:27,代码来源:utils.php


示例16: DOMDocument

<?php

require_once 'xn-app://singpolymaplay/getTidy.php';
require_once 'xn-app://xoxotools/proxy/normalize_url.php';
require_once 'php2yubnubarray.php';
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
if ($_REQUEST['url']) {
    $doc->loadHTML(getTidy(normalize_url($_REQUEST['url'])));
} else {
    $doc->loadHTML($_REQUEST['data']);
}
$xpath = new DOMXPath($doc);
$results = $xpath->query($_REQUEST['query']);
$final = array();
foreach ($results as $node) {
    $newDom = new DOMDocument();
    $newDom->appendChild($newDom->importNode($node, 1));
    $final[] = str_replace("<?xml version=\"1.0\"?>\n", '', $newDom->saveXML());
}
//end foreach results as node
$_REQUEST['as'] = $_REQUEST['as'] ? $_REQUEST['as'] : 'xml';
echo php2yubnubarray($final, $_REQUEST['as'], $_REQUEST['callback']);
开发者ID:singpolyma,项目名称:singpolymaplay,代码行数:23,代码来源:yubnub-xpath.php


示例17: get_url

 /**
  * build a reference to a location
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - locations/view.php?id=123 or locations/view.php/123 or location-123
  *
  * - other - locations/edit.php?id=123 or locations/edit.php/123 or location-edit/123
  *
  * @param int the id of the location to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @param string additional data, such as file name, if any
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view', $name = NULL)
 {
     global $context;
     // check the target action
     if (!preg_match('/^(delete|edit|map_on_earth|map_on_google|view)$/', $action)) {
         return 'locations/' . $action . '.php?id=' . urlencode($id) . '&action=' . urlencode($name);
     }
     // normalize the link
     return normalize_url(array('locations', 'location'), $action, $id, $name);
 }
开发者ID:rair,项目名称:yacs,代码行数:27,代码来源:locations.php


示例18: define

<?php

define('ROOT_DIR', dirname(__FILE__));
set_include_path(get_include_path() . PATH_SEPARATOR . ROOT_DIR . DIRECTORY_SEPARATOR . 'library');
set_include_path(get_include_path() . PATH_SEPARATOR . ROOT_DIR . DIRECTORY_SEPARATOR . 'includes');
require_once 'dump.php';
require_once 'validateurl.php';
$testcases = array(array('HTTP://www.Example.com/', 'http://www.example.com/'), array('http://www.example.com/a%c2%b1b', 'http://www.example.com/a%C2%B1b'), array('http://www.example.com/%7Eusername/', 'http://www.example.com/~username/'), array('http://www.example.com', 'http://www.example.com/'), array('http://www.example.com:80/bar.html', 'http://www.example.com/bar.html'), array('http://www.example.com/../a/b/../c/./d.html', 'http://www.example.com/a/c/d.html'), array('eXAMPLE://a/./b/../b/%63/%7bfoo%7d', 'example://a/b/c/%7Bfoo%7D'), array('http://www.yahoo.com/%a1', 'http://www.yahoo.com/%A1'), array('http://fancysite.nl/links/doit.pl?id=2029', 'http://fancysite.nl/links/doit.pl?id=2029'), array('http://example.com?arg1=1', 'http://example.com/?arg1=1'), array('http://example.com/index.php?arg2=2&arg1=1', 'http://example.com/index.php?arg1=1&arg2=2'), array('http://example.com/?&arg1=1&&arg2', 'http://example.com/?arg1=1'), array('http://example.com/?arg1=', 'http://example.com/'), array('http://example.com/index.html#fragment', 'http://example.com/index.html#fragment'), array('HtTp://User:[email protected]:80/Blah', 'http://User:[email protected]/Blah'), array('http://example.com:81/index.html', 'http://example.com:81/index.html'), array('https://example.com:443', 'https://example.com/'));
foreach ($testcases as $tc) {
    list($url, $normurl) = $tc;
    $newurl = normalize_url($url);
    echo $url, ' => ', $newurl;
    if ($newurl != $normurl) {
        echo ' != ', $normurl;
    }
    echo PHP_EOL;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:17,代码来源:testnormalizeurl.php


示例19: session_start

	</head>

	<body>
		<h1>Twitter to OpenMicroBlogging Bridge</h1>
		<p>Due to <a href="http://laconi.ca/trac/ticket/55">licensing issues</a>, tweeple must have licensed under CC-BY using <a href="http://tweetcc.com">tweetcc</a> for this to work.</p>
<?php 
require 'normalize_url.php';
session_start();
if (isset($_REQUEST['forget'])) {
    unset($_SESSION['profile_url']);
}
if ($_REQUEST['profile_url'] && !strstr($_REQUEST['profile_url'], '.')) {
    $_REQUEST['profile_url'] = 'http://identi.ca/' . $_REQUEST['profile_url'];
}
if ($_REQUEST['profile_url']) {
    $_SESSION['profile_url'] = normalize_url(str_replace("'", '', $_REQUEST['profile_url']));
}
if (!$_SESSION['profile_url']) {
    ?>

<form method="get" action="/"><div>
	<label for="profile_url">Enter your identi.ca <strong>username</strong>
			<br />
		or laconica <strong>profile link</strong>:</label>
	<input type="text" id="profile_url" name="profile_url" />
	<input type="submit" value="Go" />
</div></form>

<?php 
} else {
    if (isset($_REQUEST['done'])) {
开发者ID:singpolyma,项目名称:twitter2omb,代码行数:31,代码来源:index.php


示例20: get_url

 /**
  * build a reference to a date
  *
  * Depending on parameter '[code]with_friendly_urls[/code]' and on action,
  * following results can be observed:
  *
  * - view - dates/view.php?id=123 or dates/view.php/123 or date-123
  *
  * - other - dates/edit.php?id=123 or dates/edit.php/123 or date-edit/123
  *
  * @param int the id of the date to handle
  * @param string the expected action ('view', 'print', 'edit', 'delete', ...)
  * @return string a normalized reference
  *
  * @see control/configure.php
  */
 public static function get_url($id, $action = 'view')
 {
     global $context;
     // get a one-year calendar -- id is the target year (e.g., '1999')
     if ($action == 'year') {
         if ($context['with_friendly_urls'] == 'Y') {
             return 'dates/year.php/' . rawurlencode($id);
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'dates/year.php/' . rawurlencode($id);
         } else {
             return 'dates/year.php?year=' . urlencode($id);
         }
     }
     // get a one-month calendar -- id is the target month (e.g., '199903', '1999-03' or '1999/03')
     if ($action == 'month') {
         // do not accept more than 7 chars
         if (strlen($id) > 7) {
             $id = substr($id, 0, 7);
         }
         // expand the compact form (e.g., '199903' -> '1999/03')
         if (strlen($id) == 6) {
             $id = substr($id, 0, 4) . '/' . substr($id, 5, 2);
         }
         // normalize separator
         $id = str_replace('-', '/', $id);
         if ($context['with_friendly_urls'] == 'Y') {
             return 'dates/month.php/' . $id;
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'dates/month.php/' . $id;
         } else {
             return 'dates/month.php?month=' . urlencode($id);
         }
     }
     // get a one-day calendar -- id is the target day (e.g., '19990325', '1999-03-25' or '1999/03/25')
     if ($action == 'day') {
         // do not accept more than 10 chars
         if (strlen($id) > 10) {
             $id = substr($id, 0, 10);
         }
         // expand the compact form (e.g., '19990325' -> '1999/03/25')
         if (strpos($id, '/') === FALSE) {
             $id = substr($id, 0, 4) . '/' . substr($id, 4, 2) . '/' . substr($id, 6, 2);
         }
         // normalize separator
         $id = str_replace('-', '/', $id);
         if ($context['with_friendly_urls'] == 'Y') {
             return 'dates/day.php/' . $id;
         } elseif ($context['with_friendly_urls'] == 'R') {
             return 'dates/day.php/' . $id;
         } else {
             return 'dates/day.php?day=' . urlencode($id);
         }
     }
     // check the target action
     if (!preg_match('/^(delete|edit|view)$/', $action)) {
         return 'dates/' . $action . '.php?id=' . urlencode($id);
     }
     // normalize the link
     return normalize_url(array('dates', 'date'), $action, $id);
 }
开发者ID:rair,项目名称:yacs,代码行数:76,代码来源:dates.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP normalize_version函数代码示例发布时间:2022-05-15
下一篇:
PHP normalize_phone_to_E164函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap