示例#1
0
 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');
 }
示例#2
0
 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&amp;form2_tmp%5Bmonth%5D=1&amp;form2_tmp%5Byear%5D=2000&amp;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');
 }
示例#3
0
 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');
 }