开发者

Matters in plugin systems (PHP)

开发者 https://www.devze.com 2023-03-19 08:56 出处:网络
I made a plugin system with help of the WP idea. But there are some points that I can\'t realize what should user do at that moments for example if a user wrote a plugin for his s开发者_JS百科elf and

I made a plugin system with help of the WP idea. But there are some points that I can't realize what should user do at that moments for example if a user wrote a plugin for his s开发者_JS百科elf and the functions or methods name was same as the other plugins so what should he do after that ?. Of course I explained that when the function doesn't exist and use your plugin name at first of every function then define it in my plugin system definition.

if ( ! function_exists ( plugin_... ) ) {
  function plugin_... () {

  }
}

any idea ?

BTW is pure the taxonomy and concept of WP plugin system ?

Thanks in advance.


When designing a plugin system, the plugins really should be classes. Then the only possible name conflict is the class name.

As an alternative, you can use a naming convention that all plugin functions should have a prefix. This is sort of accomplishing the same thing as classes, but it's repetitive.


PHP Namespaces are exactly for this.http://php.net/manual/en/language.namespaces.php

0

精彩评论

暂无评论...
验证码 换一张
取 消