Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'common' hook - documentation
#1
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.
http://flexphperia.net - my portfolio
Reply
#2
I guess you're right. I've just added it to the frontend hooks.
Reply
#3
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
(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.
http://flexphperia.net - my portfolio
Reply
#5
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;
    }

NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#6
(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
http://flexphperia.net - my portfolio
Reply




Users browsing this thread: 1 Guest(s)