Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-24 15:21:25

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

txp_article - potentially un-needed calls to get_prefs() ...

I notice that txp_article.php seems make calls like this … extract( get_prefs() ); … when the global $prefs array is already populated and accessible via…

<pre>global $prefs;<br/>extract( $prefs );</pre>

I have been thinking of a plugin for per-section custom fields that would benefit from overriding custom field titles in the $prefs array during a pre article-event callback but with the above behaviour I’d need to resort to writing to the prefs table in the pre callback and reverting the result in the post callback (which can be done) or maybe playing with the dom to re-label fields after the page has been created.

Can the get_prefs() calls in txp_article be safely converted to an extract of the global $prefs? Or is there a reason for doing the double get of the prefs?


Steve

Offline

#2 2006-08-25 05:21:42

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp_article - potentially un-needed calls to get_prefs() ...

Or is there a reason for doing the double get of the prefs?

Very likely an oversight/mistake.

Can the get_prefs() calls in txp_article be safely converted to an extract of the global $prefs?

I would think so.

Offline

#3 2006-08-25 06:08:06

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: txp_article - potentially un-needed calls to get_prefs() ...

Thanks for the clarifications Mary. Would you like me to submit a patch for this?


Steve

Offline

#4 2006-08-25 06:56:28

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp_article - potentially un-needed calls to get_prefs() ...

No, don’t bother, it’s only a couple line changes.

Offline

#5 2006-08-29 01:54:12

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: txp_article - potentially un-needed calls to get_prefs() ...

Mary, is it likely that these changes will go into 4.0.4?


Steve

Offline

#6 2006-08-29 02:11:13

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp_article - potentially un-needed calls to get_prefs() ...

I just committed them. Thanks for pointing it out.

Offline

#7 2006-08-29 02:22:36

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: txp_article - potentially un-needed calls to get_prefs() ...

Thank you, that should ease the work on another plugin.


Steve

Offline

Board footer

Powered by FluxBB