. * * @category URI * @package StatusNet * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } /** * Mint tag: URIs * * tag: URIs are unique identifiers according to http://tools.ietf.org/html/rfc4151. * * We use them for creating URIs for things that can't be HTTP retrieved. * * @category URI * @package StatusNet * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ class TagURI { /** * Return the base part of a tag URI * * Note: use mint() instead. * * @return string Tag URI base to use */ static function base() { $base = common_config('integration', 'taguri'); if (empty($base)) { $base = common_config('site', 'server').','.date('Y-m-d'); $pathPart = trim(common_config('site', 'path'), '/'); if (!empty($pathPart)) { $base .= ':'.str_replace('/', ':', $pathPart); } } return $base; } /** * Make a new tag URI * * Builds the proper base and creates all the parts * * @return string minted URI */ static function mint() { $base = self::base(); $args = func_get_args(); $format = array_shift($args); $extra = vsprintf($format, $args); return 'tag:'.$base.':'.$extra; } }