Jump to content

Get Controllers And All Public Function Inside It


Blesta Addons

Recommended Posts

Looks like you already search for the files, so then you can find the class methods:

$class = "className"
$methods = get_class_methods($class);

already i'm using this method . but a lot of code ,

$scaned_dir = array_diff(scandir(CONTROLLERDIR), array('..', '.'));

then i have made a regex to rename the file name (admin_client.php --- to AdminClient ) then i use this in the get_class_methods ,

$class_methods = get_class_methods('AdminClient');

foreach ($class_methods as $method_name) {

$result[] = $method_name;

}

all this in side a boucle of result files scan , so there is no built-in function todo this ?

Link to comment
Share on other sites

I don't see a need for all controllers and controller methods to be fetched in/by Blesta.

 

 

then i have made a regex to rename the file name (admin_client.php --- to AdminClient ) then i use this in the get_class_methods ,

You could improve that by using Loader::toCamelCase

Link to comment
Share on other sites

I don't see a need for all controllers and controller methods to be fetched in/by Blesta.

you will see the need when i will release my new magic plugin soon :)

 

You could improve that by using Loader::toCamelCase

this has saved me three like of code :)

EDIT ; still exist a small prob

$controller_name .= Loader::toCamelCase("admin_clients.php");

result

AdminClients.php

what i need just AdminClients

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...