Generate a class name from path
string
classname
(string $path, [string $namespace = NULL])
-
string
$path: Relative file path to class definition, EG: controller/mycontroller
-
string
$namespace: Alter namespace
Load an instance from a file
mixed
direct
(string $path, [array $arguments = array()], [string $namespace = NULL])
-
string
$path: Relative file path to class definition, EG: controller/mycontroller Include "/*" at the end of path to load all files in path Include "/**" at the end of path to load all files in path and sub directories
-
array
$arguments: Arguments to pass to the constructor
-
string
$namespace: Alter namespace
Load a file
void
file
(string $path, [string $namespace = NULL])
-
string
$path: Relative file path to file, EG: controller/mycontroller
-
string
$namespace: Alter namespace
Get the current namespace
string
get_namespace
()
Generate an instance of a class
mixed
instance
(string $classname, [array $arguments = array()])
-
string
$classname: Name of class
-
array
$arguments: Arguments to pass to the class constructor
Load plugins
This method does not augment the namespace, use set_namespace if it needs to be modified.
Based on the following layout:
- /namespace/plugin/PLUGINPATH/class.php
Where PLUGINPATH is a the plugin's directory or directory path, meaning you could have multiple levels of plugins.
Examples:
- /namespace/plugin/foo/class.php
- /namespace/plugin/foo/bar/class.php
- /namespace/plugin/foo/bar/baz/class.php
Do not name any plugins "base". This is reserved for any plugins that want to use /namespace/plugin/base/class.php as their plugin's base class.
Example Calls to this method
<?php
// If you have the single plugin type layout
$helper->load->plugin(); // Loads all plugins
$helper->load->plugin('*'); // Loads all plugins
$helper->load->plugin('bar'); // Loads a plugin with name 'bar'
// If you have the Multiple plugin type layout
$helper->load->plugin('foo/*'); // This will load all plugins of type foo
$helper->load->plugin('foo/bar'); // This will load the bar plugin of type foo
// If you have arguments, you can use any of the above and then
// keep passing arguments. The arguments will be passed to every
// plugin that gets created
// Loads plugin with name 'one' and passes $arg1 and $arg2 to its constructor
$helper->load->plugin('one', $arg1, $arg2);
// Loads all plugins and passes $arg1 and $arg2 to each plugin's constructor
$helper->load->plugin('*', $arg1, $arg2);
?>
mixed
plugin
([string $plugin = '*'])
-
string
$plugin: The plugin path
Combine path with either passed namespace or with currently set namesapce.
string
resolve_namespace
(string $path, string $namespace)
-
string
$path: Relative file path to class definition, EG: controller/mycontroller
-
string
$namespace: Alter namespace
Set namespace
-
string
$namespace: New namespace, EG: blocks/reports
Set the namespace of the mr_helper that created this instance
Also, set our current namespace
void
_set_helper_namespace
(string $namespace)
-
string
$namespace: The namespace, EG: blocks/helloworld
Redefinition of:
- mr_helper_abstract::_set_helper_namespace()
- Set the namespace of the mr_helper that created this instance
Inherited Methods
Inherited From mr_helper_abstract
mr_helper_abstract::_set_helper_namespace()