CherryFramework / cherry-shortcodes

Сompatibility: Cherry Framework v.4+
GNU General Public License v3.0
2 stars 4 forks source link

cherry-core.php : line 95: undefined method Cherry_Api_Js::get_instance #3

Closed inpratik13 closed 8 years ago

inpratik13 commented 8 years ago

One of my friend had an issue, that when going to admin login page of wordpress, he got the error on line 95 in cherry-core.php.

undefined method Cherry_Api_Js::get_instance

I fixed that by adding singleton pattern to Cherry_Api_JS, and get_instance method (sample code is below) (For now, I didn't changed scope of constructor to 'private' as I wasn't sure about that. But it is recommended)

private static $instance = NULL;

        static function get_instance() {             
            if (NULL == self::$instance) {
               self::$instance = new Cherry_Api_Js();
            }
            return self::$instance;           
        }

After the class, there is an instance created of this class. I modified it as below $Cherry_Api_Js = Cherry_Api_Js::get_instance();

I am not sure if this was because of any problem in installation, or mixed versions wordpress/plugin or something else. Please consider it, and fix the php files accordingly.

For further communication send me email at

in.pratik13@gmail.com Thanks,

cheh commented 8 years ago

@inpratik13, sorry, but cherry-core.php file not exist in this plugin.