Menu

#5 Automating the plugin's name in install.php  Edit

Unstable_(example)
closed
lwc
None
1
2014-07-04
2006-10-01
lwc
No

Examples:

whatever($_TABLES['plugins'],'pi_name','multifaq');
should be
DB_delete($_TABLES['plugins'],'pi_name',$pi_name);

And

whatever($_TABLES['plugins'],'pi_version',"pi_name='multifaq'")
should be
whatever($_TABLES['plugins'],'pi_version',"pi_name='$pi_name'")

And if you really want to be impressive:

$NEWFEATURE[$pi_name . 'admin'] = $pi_name . " Admin";
$NEWFEATURE[$pi_name . '.view'] = $pi_name . " Viewer";

But then I'd expect you to go all the way and use (after making sure $_PLG_MULTIFAQ was called in the global):
'{$_PLG_MULTIFAQ["pi_name"]}.admin'
and
'{$_PLG_MULTIFAQ["pi_name"]}.view'
and in the future '{$_PLG_MULTIFAQ["pi_name"]}.edit'
wherever is needed in the other scripts.

Discussion

  •  tokyoahead

    tokyoahead - 2006-10-02

    Logged In: YES
    user_id=562530

    I am not sure what benefit this will bring.
    You still do not have all the functions with a flexible
    name. Finally a search/replace would do all of this in seconds.

     
  • lwc

    lwc - 2006-10-16

    Logged In: YES
    user_id=1520489

    I was taught a good programmer must always think as globally as possible and not rely on "but this could be searched and replaced in seconds" techniques.

    It's like writing "for i=1 to 10" in 50 places instead of "to n" while writing "n=10" in one central place, and saying what's the big deal of searching/replacing 10 in seconds (there's a feature request related to this example).

     

    Last edit: lwc 2014-07-04
  •  tokyoahead

    tokyoahead - 2006-10-17

    Logged In: YES
    user_id=562530

    of course you are right. But if I cannot make it for all of
    the plugin, I dont see a point making it for half of it.

     
  • lwc

    lwc - 2006-10-22

    Logged In: YES
    user_id=1520489

    You should use what you're given and advance further as more options are provided in the future.

    The entire human civilization was built on the concept of one step at a time. Imagine Alexander The Great saying "come on, I'll never get to India so why bothering going to Asia?".

     

    Last edit: lwc 2014-07-04
  •  tokyoahead

    tokyoahead - 2006-10-23

    Logged In: YES
    user_id=562530

    its surely an option to do. However, its not a bug. I will
    keep it in mind in case I have some time leftover to change it.

     
  • lwc

    lwc - 2008-05-15

    Logged In: YES
    user_id=1520489
    Originator: YES

    Of course I meant '.admin' and not 'admin'.

    Anyway, fixed in SVN.

     

Anonymous
Anonymous

Add attachments
Cancel