Quick note on important change: rewrite module was moved out from user modules/ folder into classes/ folder, that is unaccessible from direct url requests and is shared between user and admin section.
This change was needed to make rewrite engine more stable and secured.
Also, rewrite patterns folder renamed from “rewrite_patterns/” into simple “rewrite/”.
From now on rewrite module methods are fully covered by unit tests.
New areas fixed and tested:
* correct_protocol() – bugfixed and covered now, ensures correct protocol for given link (http or https)
* rewrite_replace_links() – accepts string, find internal links and rewrite them all, depending on settings
* get_unique_links() – find framework/project links, skipping all other
* main()->USE_ONLY_HTTPS – force use HTTPS everywhere
* main()->HTTPS_ENABLED_FOR – selected HTTPS usage array of patterns,
now also supports closures as array values, not only patterns
Patterns automatically enclosed into ‘@’.$pattern.’@ims’
You can see details and examples of usage here:
I’ve added useful addition for url(), url_user() and url_admin() functions.
Special params @object @action @id @page inserted from $_GET like this:
@object == $_GET[‘object’]
@action == $_GET[‘action’]
@id == $_GET[‘id’]
@page == $_GET[‘page’]
2 new functions added to make project urls generation more simple and straightforward:
url_user() – intended to generate url for user section, no matter from where it was called
url_admin() – intended to generate url for admin section, no matter from where it was called
Also, these functions will generate url depending on rewrite enabled or not, if rewrite enabled – then result will be fully processed (http://host.dev/testme/some/1),
if rewrite disabled – then urlencoded string will be as result (http://host.dev/?object=testme&action=some&id=1)
Unit tests added: