I'm currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions.
My problem is that the different wp functions name their arguments ... different.
Example:
This is how you change the text for the "Next" link.
wp_link_page()='nextpagelink'paginate_links()='next_text'
After retrieving the input in the class, I wp_parse_args( $args, $this->defaults ); my arguments and then extract them.
Problem:
When I now allow both 'nextpagelink' & 'next_text' as valid arguments, how would i deal with them? Which would I check first? Do I need to set some priority, so one overrules (if both are set) the other?
Example:
This example shows my dilemmas:
- Which one has the higher priority? How can I avoid deciding?
- It's really long code just for deciding what to do with 2 vars.
Code:
if ( $nextpagelink && $next_text )
{
// CASE 1: both are set
// which one should I take now?
}
elseif ( $nextpagelink )
{
// CASE 2: only one is set - should this one override the next one?
// set something
}
elseif ( $next_text )
{
// CASE 3: only one is set - should this be overridden by the previous one?
// set
}
else
{
// CASE 4: none is set - apply default
// set default
}
