rajneeshojha / phphooks

Automatically exported from code.google.com/p/phphooks
0 stars 0 forks source link

Example code has issues #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. No plugins turned on in sample code
2. Run the sample code
3. Observe that it says: Plugin 1 LOADED!

Clock plugin LOADED!

Plugin 2 LOADED!

What is the expected output? What do you see instead?

Do not expect to see plugins loaded, but do

What version of the product are you using? On what operating system?

Current verison, Linux, Apache2

Please provide any additional information below.

I believe there are other problems with this code not working.

Original issue reported on code.google.com by r...@vnetworx.net on 12 Jan 2012 at 8:57

GoogleCodeExporter commented 9 years ago
I believe I found the problem.  I replaced phphooks.class.php line 100, which 
was:
if (($this->active_plugins == NULL || in_array ( $file, $this->active_plugins 
)) && strpos ( $from_folder . $file, '.plugin.php' )) { 

with:
if (($this->active_plugins != NULL && in_array ( $file, $this->active_plugins 
)) && strpos ( $file, '.plugin.php' )) {

And now the example works correctly.

Original comment by r...@vnetworx.net on 10 Feb 2012 at 11:56

GoogleCodeExporter commented 9 years ago
Example was loading all de-active plugins... so to fix that we must change 
following line:
if (($this->active_plugins == NULL || in_array ( $file, $this->active_plugins 
)) && strpos ( $from_folder . $file, '.plugin.php' )) {

with:
if (($this->active_plugins != NULL && in_array ( $file, $this->active_plugins 
)) && strpos ( $from_folder . $file, '.plugin.php' )) {

Original comment by nee...@gr8logics.com on 4 Jul 2013 at 6:44

GoogleCodeExporter commented 9 years ago
The example still doesn't work though.

Clock plugin LOADED!

Plugin 2 LOADED!

Plugin 1 LOADED!

some hardcoded stuff, 'test' hook following

no any plugin hooks into TEST!!!

some hardcoded stuff, 'test1' hook following

no any plugin hooks into TEST1!!!

some hardcoded stuff, 'test2' hook following

no any plugin hooks into TEST2!!!

some hardcoded stuff, 'with_args' hook following

no any plugin hooks on with_args!!!

some hardcoded stuff, 'filter' hook following

no any plugin hooks on filter!!!

Print all plugins hearder

Array
(
    [0] => Array
        (
            [filename] => withargs.plugin.php
            [Name] => Plugin Withargs
            [Title] => Plugin Withargs
            [PluginURI] => http://www.instant-update.com/
            [Description] => This is plugin withargs
            [Author] => Nemanja Avramovic
            [AuthorURI] => http://www.instant-update.com/
            [Version] => 1.0
        )

    [1] => Array
        (
            [filename] => plugin2.plugin.php
            [Name] => Plugin2
            [Title] => Plugin2
            [PluginURI] => http://code.google.com/p/phphooks/source/browse/trunk/plugins/plugin2/plugin2.plugin.php
            [Description] => This is plugin2
            [Author] => Eric Wang
            [AuthorURI] => http://www.ericbess.com/
            [Version] => 1.0
        )

    [2] => Array
        (
            [filename] => plugin1.plugin.php
            [Name] => Plugin1
            [Title] => Plugin1
            [PluginURI] => http://code.google.com/p/phphooks/source/browse/trunk/plugins/plugin1.plugin.php
            [Description] => This is plugin1
            [Author] => Eric Wang
            [AuthorURI] => http://www.ericbess.com/
            [Version] => 1.0
        )

)

Original comment by r...@vnetworx.net on 6 Jul 2013 at 9:50