function actionDefault() { // Create the URL object $url = new YDUrl('http://www.yellowduck.be/index.xml'); // The different parts echo '<br>URL: ' . $url->getUrl(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Query: ' . $url->getQuery(); echo '<br>Fragment: ' . $url->getFragment(); // Get the contents YDDebugUtil::dump($url->getContents(), 'URL contents'); }
/** * This function registers a named database instance. * * @param $name The name of the database instance. * @param $driver Name of the database driver, DNS string or array containing drivername, file name and class name. * @param $db (optional) Database name to use for the connection. If empty, we are using a DSN string in driver. * @param $user (optional) User name to use for the connection. * @param $pass (optional) Password to use for the connection. * @param $host (optional) Host name to use for the connection. * * @static */ function registerInstance($name, $driver, $db = '', $user = '', $pass = '', $host = '') { // Check if the global array exists YDDatabase::_initNamedInstances(); // Check if we are using a DSN string, e.g. "mysql://*****:*****@host/database" if ($db == '') { $dsn = new YDUrl($driver); $driver = $dsn->getScheme(); $db = substr($dsn->getPath(), 1); $user = $dsn->getUser(); $pass = $dsn->getPassword(); $host = $dsn->getHost(); } // Register the instance $GLOBALS['YD_DB_INSTANCES'][strtolower($name)] = array($driver, $db, $user, $pass, $host); }
function actionDefault() { // Create the URL object $url = new YDUrl('http://www.yellowduck.be/directory/test/index.xml'); // The different parts echo '<br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>isDirectory( test ): ' . var_export($url->isDirectory('test'), 1); echo '<br>isDirectory( xx ): ' . var_export($url->isDirectory('xx'), 1); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Create the URL object $url = new YDUrl('http://pieter@www.yellowduck.be/directory/test/index?x[]=22&x[]=23#22'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Create the URL object $url = new YDUrl('http://*****:*****@www.yellowduck.be:8080/directory/test/?do=x&id=1#10'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); echo '<br>Getting query variable do: ' . $url->getQueryVar('do'); echo '<br>Setting query variable do to y: ' . $url->setQueryVar('do', 'y'); echo '<br>New URL: ' . $url->getUrl(); echo '<br>Deleting query variable do: ' . $url->deleteQueryVar('do'); echo '<br>New URL: ' . $url->getUrl(); // Create the URL object $url = new YDUrl('http://ydframework.berlios.de/ydf2_changelog_summary.xml'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Test the getPathSubdirectories function $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubdirectories('ydf2'), "getPathSubdirectories('ydf2')"); YDDebugUtil::dump($url->getPathSubdirectories('forum'), "getPathSubdirectories('forum')"); YDDebugUtil::dump($url->getPathSubdirectories('test'), "getPathSubdirectories('test')"); $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubdirectories('ydf2'), "getPathSubdirectories('ydf2')"); YDDebugUtil::dump($url->getPathSubdirectories('forum'), "getPathSubdirectories('forum')"); YDDebugUtil::dump($url->getPathSubdirectories('test'), "getPathSubdirectories('test')"); // Test the getPathSubsegments function $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubsegments('ydf2'), "getPathSubsegments('ydf2')"); YDDebugUtil::dump($url->getPathSubsegments('forum'), "getPathSubsegments('forum')"); YDDebugUtil::dump($url->getPathSubsegments('test'), "getPathSubsegments('test')"); $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubsegments('ydf2'), "getPathSubsegments('ydf2')"); YDDebugUtil::dump($url->getPathSubsegments('forum'), "getPathSubsegments('forum')"); YDDebugUtil::dump($url->getPathSubsegments('test'), "getPathSubsegments('test')"); // Do some more testing $x = 'http://localhostexamples/form2.php?form2_tmp%5Bday%5D=1&form2_tmp%5Bmonth%5D=1&form2_tmp%5Byear%5D=2000&do=test'; $url = new YDUrl($x); YDDebugUtil::dump($url, $x); YDDebugUtil::dump($url->getUrl(), 'Original url'); // Do some more testing $x = 'http://localhostexamples/form2.php?form2_tmp%5Bday%5D=1&form2_tmp%5Bmonth%5D=1&form2_tmp%5Byear%5D=2000&do=test'; $url = new YDUrl($x); YDDebugUtil::dump($url, $x); YDDebugUtil::dump($url->getUrl(), 'Original url'); // Get the contents $url = new YDUrl('http://ydframework.berlios.de/ydf2_changelog_summary.xml'); YDDebugUtil::dump($url->getContents(), 'URL contents'); }
function actionDefault() { // Create the URL object $url = new YDUrl('http://www.yellowduck.be/directory/test/index.xml'); // The different parts echo '<br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>isDirectory( test ): ' . var_export($url->isDirectory('test'), 1); echo '<br>isDirectory( xx ): ' . var_export($url->isDirectory('xx'), 1); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Create the URL object $url = new YDUrl('http://pieter@www.yellowduck.be/directory/test/index?x[]=22&x[]=23#22'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Create the URL object $url = new YDUrl('http://*****:*****@www.yellowduck.be:8080/directory/test/?do=x&id=1#10'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); echo '<br>Getting query variable do: ' . $url->getQueryVar('do'); echo '<br>Setting query variable do to y: ' . $url->setQueryVar('do', 'y'); echo '<br>New URL: ' . $url->getUrl(); echo '<br>Deleting query variable do: ' . $url->deleteQueryVar('do'); echo '<br>New URL: ' . $url->getUrl(); // Create the URL object $url = new YDUrl('http://www.yellowduck.be/rss.xml'); // The different parts echo '<br><br>Original URL: ' . $url->_url; echo '<br>URL: ' . $url->getUrl(); echo '<br>URI: ' . $url->getUri(); echo '<br>Scheme: ' . $url->getScheme(); echo '<br>Host: ' . $url->getHost(); echo '<br>Port: ' . $url->getPort(); echo '<br>User: '******'<br>Password: '******'<br>Path: ' . $url->getPath(); echo '<br>Path segments: ' . implode(', ', $url->getPathSegments()); echo '<br>Path directories: ' . implode(', ', $url->getPathDirectories()); echo '<br>Query: ' . var_export($url->getQuery(), 1); echo '<br>Fragment: ' . $url->getFragment(); // Test the getPathSubdirectories function $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubdirectories('ydf2'), "getPathSubdirectories('ydf2')"); YDDebugUtil::dump($url->getPathSubdirectories('forum'), "getPathSubdirectories('forum')"); YDDebugUtil::dump($url->getPathSubdirectories('test'), "getPathSubdirectories('test')"); $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubdirectories('ydf2'), "getPathSubdirectories('ydf2')"); YDDebugUtil::dump($url->getPathSubdirectories('forum'), "getPathSubdirectories('forum')"); YDDebugUtil::dump($url->getPathSubdirectories('test'), "getPathSubdirectories('test')"); // Test the getPathSubsegments function $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubsegments('ydf2'), "getPathSubsegments('ydf2')"); YDDebugUtil::dump($url->getPathSubsegments('forum'), "getPathSubsegments('forum')"); YDDebugUtil::dump($url->getPathSubsegments('test'), "getPathSubsegments('test')"); $url = new YDUrl('http://www.yellowduck.be/ydf2/forum/ydf2/forum/cool.html'); YDDebugUtil::dump($url->getUrl()); YDDebugUtil::dump($url->getPathSubsegments('ydf2'), "getPathSubsegments('ydf2')"); YDDebugUtil::dump($url->getPathSubsegments('forum'), "getPathSubsegments('forum')"); YDDebugUtil::dump($url->getPathSubsegments('test'), "getPathSubsegments('test')"); // Get the contents $url = new YDUrl('http://www.yellowduck.be/rss.xml'); YDDebugUtil::dump($url->getContents(), 'URL contents'); }