GetSimple Support Forum

Full Version: 'common' hook - documentation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

In docs http://get-simple.info/wiki/plugins:hooks_filters I can find that common hook is called immediately after the plugin functions are included in common.php and it's described as back-end hook.
In source code I see that this hook is called on front-end too.
It should be added to front-end hooks list.

As I'm wrong please correct me.
I guess you're right. I've just added it to the frontend hooks.
Well it IS called "common"

I consider it a backend administrative hook, even if called on the front end, it is not really a templating hook however. If a hook is needed for the front end after plugins or where common is called, perhaps one should be created ?

There are probably several back end hooks called on front end.
(2013-12-18, 08:14:49)shawn_a Wrote: [ -> ]Well it IS called "common"

I consider it a backend administrative hook, even if called on the front end, it is not really a templating hook however. If a hook is needed for the front end after plugins or where common is called, perhaps one should be created ?

There are probably several back end hooks called on front end.

Ok I see your point of view but when it is not documented and I think that common is called only on back-end I'm not worry for checking is I'm in back-end or not. I can call my expensive PHP code without worry, in oder case my PHP code will execute not needed on front-end too.
You should check backend explicitly.
you can use this since 3.1
basic.php
PHP Code:
/**
 * Check Is FrontEnd
 * 
 * Checks to see if the you are on the frontend or not
 *
 * @since 3.1
 * @return bool
 */
function is_frontend() {
    GLOBAL 
$base;
    if(isset(
$base)) {
        return 
true;
    } else {
        return 
false;
    }

(2013-12-18, 23:46:45)shawn_a Wrote: [ -> ]You should check backend explicitly.
you can use this since 3.1
basic.php
PHP Code:
/**
 * Check Is FrontEnd
 * 
 * Checks to see if the you are on the frontend or not
 *
 * @since 3.1
 * @return bool
 */
function is_frontend() {
    GLOBAL 
$base;
    if(isset(
$base)) {
        return 
true;
    } else {
        return 
false;
    }


thanks for a tip I did not know about this function Smile