[bbDev] [1575] trunk: bb_uri() and bb_get_uri() commit bomb.

Sam Bauers sam at automattic.com
Wed Jul 2 15:07:03 GMT 2008


Just as a further note, this is all backward compatible I believe.

But templates should change their use of bb_option('uri') to bb_uri().

It's fairly trivial now to modify all references to site URIs based on  
the context using a plugin.

All link creation functions pass the context value in their filters,  
so to find out if a call to bb_uri() was made in the action of a form  
for example you would just do this...

---

add_filter('bb_uri', 'is_it_a_form_action');

function is_it_a_form_action($resource, $query, $context) {
	if ($context & BB_URI_CONTEXT_FORM_ACTION) {
		// It is a form action
	}
}

---


...or a stylesheet in the admin area...

---

add_filter('bb_uri', 'is_it_an_admin_stylesheet');

function is_it_an_admin_stylesheet($resource, $query, $context) {
	if ( ($context & BB_URI_CONTEXT_LINK_STYLESHEET_HREF) && ($context &  
BB_URI_CONTEXT_BB_ADMIN) ) {
		// It is a stylesheet in the admin area
	}
}

---

I'm digging the bitwise operations.


Next up I'll setup forcing of SSL when necessary through redirection.

Then I can properly tackle the new cookies from WordPress.


Sam




On 03/07/2008, at 12:53 AM, m at wordpress.org wrote:

> Revision1575AuthorsambauersDate2008-07-02 14:53:07 +0000 (Wed, 02  
> Jul 2008)Log Message
> bb_uri() and bb_get_uri() commit bomb.
>
> BB_URI_CONTEXT_* definitions applied to all link creation functions  
> and passed to their filters.
>
> First stages of SSL support for user forms (login, registration,  
> etc.) and admin area.
>
> Links rewritten for SSL at this stage, but pages are not yet forced  
> to SSL if loaded as non-secure.
>
> bb_force_ssl_user_forms() and bb_force_ssl_admin() also included.
>
> Introducing new config constants, BB_FORCE_SSL_USER_FORMS and  
> BB_FORCE_SSL_ADMIN.
>
> New config variable $bb->uri_ssl, a complete URI for the SSL links  
> to go to. If not set it is based on replacing http with https in $bb- 
> >uri.



---------------------
Sam Bauers
Automattic, Inc.

sam at automattic.com
http://automattic.com
http://wordpress.com
http://wordpress.org
http://bbpress.org
http://unlettered.org
---------------------


More information about the bbDev mailing list