• Resolved TiKu

    (@tiku)


    Currently I’m using a highly customized version of your great plugin. Since you’ve added some good filters, I could already reduce my code additions to the plugin’s code a lot. Currently I’m trying to get rid of my code changes in the mpp_toc function.
    I think I have found a problem in your code:
    if ( $i != $page || ! $more && 1 == $page ) {
    In my opinion there are missing paranthesis. Otherwise you have the || operator at the same level as the && operator which rarely is a good idea.

    But my main reason for opening this topic are the filters mpp_toc_pages_row and mpp_toc. In the beginning of the mpp_toc function you retrieve the params and apply the mpp_toc_args filter to it, allowing customizations. But to the mpp_toc filter you pass the original params instead of the customized ones. Of course I could customize the params once again, but wouldn’t it be better to pass $r instead of $args?
    Also $r is not passed to the mpp_toc_pages_row filter. Therefore it is not possible to generate different rows in the filter depending on $r. Passing $r to the mpp_toc_pages_row filter would be really nice.

    Best regards
    TiKu

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sergio De Falco

    (@sgr33n)

    Hi,
    Thanks for your feedback!
    What’s the error generated by the first point?
    Then I pass the raw elements to the filter because the user that is using this filter probably needs to rework the output. If the user wants the multipage original output doesn’t need to use this filter.

    Thread Starter TiKu

    (@tiku)

    What’s the error generated by the first point?

    No syntactical error, but which of the logical operators is executed first? The “||” or the “&&”? And if you can answer this, can you be sure that it will stay like this (because it is properly defined in the PHP language definition)?

    Regarding the filters, I’m also trying to rework the output, but in my case I have no use for the raw elements. I would need the processed ones, held by $r. So I’ll end up duplicating code from the mpp_toc function.

    Plugin Author Sergio De Falco

    (@sgr33n)

    This is the best approach in my opinion.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Some thoughts on mpp_toc function’ is closed to new replies.