{"id":12605,"date":"2011-03-23T06:01:48","date_gmt":"2011-03-23T06:01:48","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/absolute-to-relative-urls\/"},"modified":"2013-03-28T13:43:54","modified_gmt":"2013-03-28T13:43:54","slug":"absolute-to-relative-urls","status":"publish","type":"plugin","link":"https:\/\/nb.wordpress.org\/plugins\/absolute-to-relative-urls\/","author":1345092,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.3.4","stable_tag":"trunk","tested":"3.4.2","requires":"3.2","requires_php":"","requires_plugins":"","header_name":"Absolute-to-Relative URLs","header_author":"Steven Vachon","header_description":"","assets_banners_color":"","last_updated":"2013-03-28 13:43:54","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/www.svachon.com\/blog\/absolute-to-relative-urls\/","header_author_uri":"http:\/\/www.svachon.com\/","rating":5,"author_block_rating":0,"active_installs":20,"downloads":7040,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1","0.2","0.3","0.3.1","0.3.2","0.3.3","0.3.4"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1757,1759,537,175],"plugin_category":[],"plugin_contributors":[79256],"plugin_business_model":[],"class_list":["post-12605","plugin","type-plugin","status-publish","hentry","plugin_tags-absolute","plugin_tags-function","plugin_tags-link","plugin_tags-links","plugin_contributors-prometh","plugin_committers-prometh"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/absolute-to-relative-urls.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>If you were to use this on a website like <em>http;\/\/example.com\/test\/testing\/<\/em>, you would get results like these:<\/p>\n\n<ol>\n<li>\n\n<ul>\n<li><strong>Before:<\/strong> http;\/\/example.com\/test\/another-test\/#anchor<\/li>\n<li><strong>After:<\/strong> ..\/another-test\/#anchor<\/li>\n<\/ul><\/li>\n<li>\n\n<ul>\n<li><strong>Before:<\/strong> http;\/\/example.com\/wp-content\/themes\/twentyten\/style.css<\/li>\n<li><strong>After:<\/strong> \/wp-content\/themes\/twentyten\/style.css<\/li>\n<\/ul><\/li>\n<li>\n\n<ul>\n<li><strong>Before:<\/strong> http<em>s<\/em>;\/\/example.com\/wp-content\/themes\/twentyten\/style.css<\/li>\n<li><strong>After:<\/strong> http<em>s<\/em>;\/\/example.com\/wp-content\/themes\/twentyten\/style.css<\/li>\n<\/ul><\/li>\n<li>\n\n<ul>\n<li><strong>Before:<\/strong> http;\/\/google.com\/test\/<\/li>\n<li><strong>After:<\/strong> \/\/google.com\/test\/<\/li>\n<\/ul><\/li>\n<li>\n\n<ul>\n<li><strong>Before:<\/strong> ..\/..\/..\/..\/..\/..\/..\/..\/#anchor<\/li>\n<li><strong>After:<\/strong> \/#anchor<\/li>\n<li><strong>After<\/strong> (<code>$output_type=1<\/code>)<strong>:<\/strong> ..\/..\/#anchor<\/li>\n<\/ul><\/li>\n<\/ol>\n\n<p><strong>All string parsing. <em>No<\/em> directory browsing.<\/strong><\/p>\n\n<p>If you're looking for a plugin that will <em>automatically<\/em> convert all URLs on your WordPress site, instead check out my other plugin, <strong><a href=\"http:\/\/wordpress.org\/extend\/plugins\/wp-html-compression\/\">WP-HTML-Compression<\/a><\/strong>.\n<strong>Before you copy this code and add it into your own<\/strong>, keep in mind that there will probably be future updates. Keeping the code within an installed plugin will make sure that you're notified.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Download the plugin (zip file).<\/li>\n<li>Upload and activate the plugin through the \"Plugins\" menu in the WordPress admin.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Why isn't this automatic?<\/dt>\n<dd><p>Check out <strong><a href=\"http:\/\/wordpress.org\/extend\/plugins\/wp-html-compression\/\">WP-HTML-Compression<\/a><\/strong> instead.<\/p><\/dd>\n<dt>How does this work?<\/dt>\n<dd><p>Just use <code>absolute_to_relative_url($url)<\/code>.<\/p><\/dd>\n<dt>Will this plugin work for WordPress version x.x.x?<\/dt>\n<dd><p>This plugin has only been tested with versions of WordPress as early as 3.2. For anything older, you'll have to see for yourself.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>0.3.4<\/h4>\n\n<ul>\n<li>Empty, hash-only anchors (<code>\"#\"<\/code>) are no longer invalidated to <code>\"\/\"<\/code><\/li>\n<\/ul>\n\n<h4>0.3.3<\/h4>\n\n<ul>\n<li>JavaScript URIs (<code>\"javascript:\"<\/code>) are no longer invalidated as paths<\/li>\n<\/ul>\n\n<h4>0.3.2<\/h4>\n\n<ul>\n<li>Data URIs (<code>\"data:\"<\/code>) are no longer invalidated as paths<\/li>\n<\/ul>\n\n<h4>0.3.1<\/h4>\n\n<ul>\n<li>Domains with and without \"www.\" are no longer considered to be identical by default, but can still be overridden<\/li>\n<\/ul>\n\n<h4>0.3<\/h4>\n\n<ul>\n<li>Scheme-relative URLs (<code>\/\/domain.com<\/code>) now supported on input and output<\/li>\n<li>Cleans up the ports and paths of external URLs<\/li>\n<li>Optionally, output only host-relative URLs (<code>\/root-dir\/<\/code>)<\/li>\n<li>Speed optimizations<\/li>\n<li>Minor bug fixes<\/li>\n<\/ul>\n\n<h4>0.2<\/h4>\n\n<ul>\n<li>Path-relatve URLs (<code>..\/<\/code>), or parenting, now supported on input and output<\/li>\n<li>Differentiates schemes\/protocols, usernames, passwords, hosts, ports, paths, resources\/files, queries and fragments\/hashes<\/li>\n<li>Considers domains with and without \"www.\" to be identical, and can be overridden<\/li>\n<li>Outputs the shortest url (host- or path-relative) by default, and can be overridden<\/li>\n<li>Custom site URL support, but only with a separate <code>new Absolute_to_Relative_URLs()<\/code> instance<\/li>\n<\/ul>\n\n<h4>0.1<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"A function() for use in shortening URL links. This plugin is meant for dev work and does not automatically shorten URLs.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/12605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=12605"}],"author":[{"embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/prometh"}],"wp:attachment":[{"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=12605"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=12605"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=12605"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=12605"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=12605"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/nb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=12605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}