Ticket #528 (assigned task)

Opened 2 years ago

Last modified 10 months ago

Change function names, filters to resolve conflict with wordpress and be consistent

Reported by: so1o Assigned to: so1o (accepted)
Priority: normal Milestone: 1.0
Component: Back-end Version: 0.7.3
Severity: normal Keywords:
Cc:

Description (Last modified by mdawaffe)

example bb_get_title and get_user_title.. prefix bb_ is missing in the second one..

Attachments

ticket-528.patch (39.0 kB) - added by so1o on 03/04/07 03:04:40.
ticket patch

Change History

01/05/07 22:14:50 changed by mdawaffe

  • description changed.

bb_get_title is for the title of the page, get_user_title is for a user's title ( "Moderator" or some custom value, for example); very few of the other user template functions are prefaced with bb_.

Anyway, yeah, let's reexamine our function naming for .80 or (more likely) 1.0.

01/10/07 19:08:40 changed by so1o

Can someone take a stab at some guidelines for the function names and hooks..

01/22/07 18:12:36 changed by so1o

any takers?? :)

anyone?

01/22/07 19:13:00 changed by mdawaffe

Just some things off the cuff. Not all of these are specifically about function names.

  1. Any new functions should by prefixed with bb_
  1. bb_get_X always returns
  1. Template functions should use query style args bb_template_functions( 'key=value&so1o=awesome' ); See helper function bb_parse_args() and bb_user_search() for example. Other functions should use this format when appropriate (more than a couple args).

What else?

01/22/07 21:47:38 changed by so1o

  • bb_x displays x
  • there is another group of functions that we need to tackle/standardize. these are the links.. we have to differentiate between link and url..

bb_get_topic_url

 returns 'http://www.somehost.com/topic.php?id=1'

bb_topic_url

 prints 'http://www.somehost.com/topic.php?id=1'

bb_get_topic_link($link_title)

 returns '<a href="http://www.somehost.com/topic.php?id=1">$link_title</a>'

bb_topic_link($link_title)

 prints '<a href="http://www.somehost.com/topic.php?id=1">$link_title</a>'
  • all template functions have to have a filter before return or display

01/22/07 21:48:53 changed by so1o

also one question - do we need to deprecate old functions for next x minor releases or till the next major versions or just drop them coz we are under 1.0?

01/23/07 22:45:00 changed by so1o

do we want take this up?

also advise on back ward compatibility

01/27/07 18:41:33 changed by mdawaffe

Any functions we rename, we need to put into deprecated.php. We may be able to drop them for 1.0.

so

a_fuction() {
     return bb_a_function();
}

Paying careful attention to globals and arguments.

I like your link/url differentiation. What will it break?

01/27/07 21:31:39 changed by so1o

  • owner set to so1o.
  • status changed from new to assigned.

there are a couple of urls and links like the topic_link, author_link... we'll take it as they come and discuss.. i'll start working on these..

02/02/07 01:40:41 changed by so1o

is there a thought about filter hooks' backward compatibility

02/02/07 20:42:49 changed by mdawaffe

We can probably break filter backward compatibility if we have to.

Can you throw up a piece to look at?

02/05/07 21:52:24 changed by mdawaffe

  • milestone changed from 0.80 to 1.0.

Moving this to 1.0.

03/04/07 03:04:40 changed by so1o

  • attachment ticket-528.patch added.

ticket patch

03/04/07 03:07:27 changed by so1o

just added a patch for the ticket.. this includes partial changes..

question.. what about the filters in the functions which we'll change the names for.. how do we maintain backward compatibility?

some of the function we have to change are high profile like get_forums

04/04/07 21:15:51 changed by mdawaffe

(In [792]) bb_ goodness from so1o. re #528

04/04/07 21:19:20 changed by mdawaffe

We can change filter names. There's few enough plugin developers still that we can get the word out pretty well. We can also include deprecated filters in deprecated.php:

function something() {
    return apply_filters( 'something', bb_something() );
}

where appropriate.

I applied your patch, so1o, but took out some things from deprecated.php that are really only used internally. Also, those functions defined in compat.php (there's only one at the moment) are function available in PHP5 but not in 4. So they don't need renaming.

02/04/08 14:06:56 changed by so1o

  • summary changed from Change the function names to consistent to Change function names, filters to resolve conflict with wordpress and be consistent.

need to resolve the conflict of pre_post_status filter in wordpress and bbpress.