GetSimple Support Forum
'common' hook - documentation - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: 'common' hook - documentation (/showthread.php?tid=5451)



'common' hook - documentation - mganko - 2013-12-17

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.


RE: 'common' hook - documentation - Carlos - 2013-12-18

I guess you're right. I've just added it to the frontend hooks.


RE: 'common' hook - documentation - shawn_a - 2013-12-18

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.


RE: 'common' hook - documentation - mganko - 2013-12-18

(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.


RE: 'common' hook - documentation - shawn_a - 2013-12-18

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;
    }




RE: 'common' hook - documentation - mganko - 2013-12-19

(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