Posts: 117
Threads: 21
Joined: Nov 2013
2013-12-17, 03:56:24
(This post was last modified: 2013-12-17, 03:56:45 by mganko.)
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
I guess you're right. I've just added it to the frontend hooks.
Posts: 6,266
Threads: 181
Joined: Sep 2011
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.
Posts: 117
Threads: 21
Joined: Nov 2013
(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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
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;
}
}
Posts: 117
Threads: 21
Joined: Nov 2013
(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