b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 2.4) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Procedural File: _url.funcs.php

Source Location: /blogs/inc/_core/_url.funcs.php

Page Details

URL manipulation functions

This file is part of the b2evolution/evocms project - http://b2evolution.net/. See also http://sourceforge.net/projects/evocms/.

Author:  blueyed: Daniel HAHLER
Author:  Danny Ferguson
Version:  $Id: _url.funcs.php,v 1.9.2.4 2008/04/14 16:02:14 fplanque Exp $
Copyright:  (c)2003-2008 by Francois PLANQUE - http://fplanque.net/. Parts of this file are copyright (c)2006 by Daniel HAHLER - http://daniel.hahler.de/.
Filesource:  Source Code for this file
License:  GNU General Public License (GPL)
Functions
disp_url  [line 607]

void disp_url( string $url, [integer $max_length = NULL]  )

Display an URL, constrained to a max length

Parameters:
string   $url: 
integer   $max_length: 


[ Top ]
fetch_remote_page  [line 256]

string|false fetch_remote_page( string $url, array &$info  )

Fetch remote page

Attempt to retrieve a remote page, first with cURL, then fsockopen, then fopen.

Parameters:
string   $url:  URL
array   &$info:  Info (by reference) 'error': holds error message, if any 'status': HTTP status (e.g. 200 or 404) 'used_method': Used method ("curl", "fopen", "fsockopen" or null if no method is available)

API Tags:
Return:  The remote page as a string; false in case of error

Information Tags:
Todo:  dh> Should we try remaining methods, if the previous one(s) failed?

[ Top ]
get_allowed_uri_schemes  [line 196]

array get_allowed_uri_schemes( [string $context = 'posting']  )
Parameters:
string   $context: 


[ Top ]
make_rel_links_abs  [line 587]

string make_rel_links_abs( string $s, [string $host = NULL]  )

Make links in $s absolute.

It searches for "src" and "href" HTML tag attributes and makes the absolute.

Parameters:
string   $s:  content
string   $host:  Hostname including scheme, e.g. http://example.com; defaults to $ReqHost

API Tags:
Uses:  url_absolute()


[ Top ]
url_absolute  [line 561]

string url_absolute( string $url, [string $host = NULL]  )

Make an $url absolute according to $host, if it is not absolute yet.

Parameters:
string   $url:  URL
string   $host:  Host (including protocol, e.g. 'http://example.com'); defaults to $ReqHost

API Tags:
Usedby:  make_rel_links_abs()


[ Top ]
url_add_param  [line 445]

void url_add_param( string $url, string $param, [string $glue = '&']  )

Add param(s) at the end of an URL, using either "?" or "&" depending on existing url

Parameters:
string   $url:  existing url
string   $param:  params to add
string   $glue:  delimiter to use for more params


[ Top ]
url_add_tail  [line 479]

void url_add_tail( string $url, string $tail  )

Add a tail (starting with "/") at the end of an URL before any params (starting with "?")

Parameters:
string   $url:  existing url
string   $tail:  tail to add


[ Top ]
url_rel_to_same_host  [line 505]

string url_rel_to_same_host( string $url, string $target_url  )

Try to make $url relative to $target_url, if scheme, host, user and pass matches.

This is useful for redirect_to params, to keep them short and avoid mod_security rejecting the request as "Not Acceptable" (whole URL as param).

Parameters:
string   $url:  URL to handle
string   $target_url:  URL where we want to make $url relative to


[ Top ]
url_same_protocol  [line 409]

string url_same_protocol( string $url, [string $other_url = NULL]  )

Get $url with the same protocol (http/https) as $other_url.

Parameters:
string   $url:  URL
string   $other_url:  other URL (defaults to $ReqHost)


[ Top ]
validate_url  [line 45]

mixed validate_url( string $url, [string $context = 'posting'], [boolean $antispam_check = true]  )

Check the validity of a given URL

Checks allowed URI schemes and URL ban list. URL can be empty.

Note: We have a problem when trying to "antispam" a keyword which is already blacklisted If that keyword appears in the URL... then the next page has a bad referer! :/

Parameters:
string   $url:  Url to validate
string   $context: 
boolean   $antispam_check:  also do an antispam check on the url

API Tags:
Return:  false (which means OK) or error message


[ Top ]


Documentation generated on Sat, 06 Mar 2010 03:41:32 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).