[Klasse] extends [anderes Plugin, Klasse]

Asked by Adrian Liechti

Wie erstelle ich eine Klasse die eine andere Klasse in einem anderen Plugin erweitert?

Question information

Language:
German Edit question
Status:
Solved
For:
PHPDevShell Edit question
Assignee:
No assignee Edit question
Solved by:
TitanKing
Solved:
Last query:
Last reply:
Revision history for this message
TitanKing (titan-phpdevshell) said :
#1

Hi Jahweh,

You can create a plugin class calling other plugin classes by registering them. See more detail here:
http://www.phpdevshell.org/content/plugins

Revision history for this message
Adrian Liechti (jahweh) said :
#2

Hey TitanKing

My Solution is to load the File manualy:
$this->PHPDS_core()->loadFile('/plugins/StandardLogin/includes/StandardLogin.class.php');
class adLogin extends StandardLogin {
...

All other ways it ends with:
PHPDS_exception: Can't find definition for class "StandardLogin".

Here is my plugin config:
...
 <versionurl current="1004"></versionurl>
 <install version="1004">
...
  <dependencies>
   <dependence class="StandardLogin" plugin="StandardLogin" />
   <dependence class="adLDAP" plugin="adLDAP" />
  </dependencies>
  <classes>
   <class name="adLogin" alias="StandardLogin" plugin="adLogin" rank="last" />
   <class name="adUserActions" alias="userActions" plugin="adLogin" rank="last" />
  </classes>
...
 </install>
</config>

where is the fault?

Revision history for this message
TitanKing (titan-phpdevshell) said :
#3

From the instructions I see you are attempting to create an LDAP user login? Is that correct? If so, one of the lead developers namely Greg already created an LDAP plugin, it is not really public yet but he will hook you up without any problems.

He will be online shortly, he will most certainly reply to this.

In the meanwhile, please also read:
http://www.phpdevshell.org/content/substitute-plugin

Revision history for this message
Greg (gregfr) said :
#4

Indeed, I'm rewriting the whole login for it to be cleaner and more extendable. You can contact me directly at <email address hidden> (please use English ;). I'm interested in how you want to provide your LDAP server coordonates so the plugin could work in most cases.

On another topic, you can use

require_once '/plugins/StandardLogin/includes/StandardLogin.class.php';

instead of $this->PHPDS_core()->loadFile('/plugins/StandardLogin/includes/StandardLogin.class.php');

so the file is known at compile time.

greg

Revision history for this message
Adrian Liechti (jahweh) said :
#5

Hmm now i logged out and cant login, always errors =)
Can i deactivate Plugins Manually? So i had also problems with updating plugins...

Why do I have to manually load these files, classes, I thought this is done automatically?

Now i have an other problem:
PHPDS_exception: Can't find definition for class "adLDAP"
I created a plugin adLDAP, registered in the configuration I have it too. Is that the same problem?

Revision history for this message
Best TitanKing (titan-phpdevshell) said :
#6

You dont have to manually load files, after registering a class you simply need to $this->factory('myCustomClass');
In the plugin manager simply uninstall the plugins you dont want anymore. Note that core installed plugins are always needed.

I suggest you look at the example plugin provided with the distribution and replicate that class action to understand better. Wait for V3.1.0 thas has LDAP included if you would like to wait about 2 weeks.

Revision history for this message
Adrian Liechti (jahweh) said :
#7

Thanks TitanKing, that solved my question.