src/MocaBonita.php
private function runHookCurrentAction()
    {
        //Check if needed add the hook
        if (!$this->getMbRequest()->isMocaBonitaPage() || $this->getMbRequest()->isBlogAdmin()) {
            return false;
        }

        //Check if a user is logged in Wordpress
        if ($this->mbRequest->isLogged()) {
            //Check if the current request is ajax
            if ($this->mbRequest->isAjax()) {
                //add hook admin_ajax
                $actionHook = "wp_ajax_{$this->getAction()}";
            } else {
                //add hook admin_post
                $actionHook = "admin_post_{$this->getAction()}";
            }

        } else {
            //Check if the current request is ajax
            if ($this->mbRequest->isAjax()) {
                //add hook nopriv_ajax
                $actionHook = "wp_ajax_nopriv_{$this->getAction()}";
            } else {
                //add hook nopriv_post
                $actionHook = "admin_post_nopriv_{$this->getAction()}";
            }
        }

        //Register WordpressHook
        MbWPActionHook::addAction($actionHook, $this, 'sendContent');

        return true;
    }
private function runHookCurrentAction()
    {
        //Check if needed add the hook
        if (!$this->getMbRequest()->isMocaBonitaPage() || $this->getMbRequest()->isBlogAdmin()) {
            return false;
        }

        //Check if a user is logged in Wordpress
        if ($this->mbRequest->isLogged()) {
            //Check if the current request is ajax
            if ($this->mbRequest->isAjax()) {
                //add hook admin_ajax
                $actionHook = "wp_ajax_{$this->getAction()}";
            } else {
                //add hook admin_post
                $actionHook = "admin_post_{$this->getAction()}";
            }

        } else {
            //Check if the current request is ajax
            if ($this->mbRequest->isAjax()) {
                //add hook nopriv_ajax
                $actionHook = "wp_ajax_nopriv_{$this->getAction()}";
            } else {
                //add hook nopriv_post
                $actionHook = "admin_post_nopriv_{$this->getAction()}";
            }
        }

        //Register WordpressHook
        MbWPActionHook::addAction($actionHook, $this, 'sendContent');

        return true;
    }
private function runHookCurrentAction ( ) { //Check if needed add the hook if ( ! $ this -> getMbRequest ( ) -> isMocaBonitaPage ( ) || $ this -> getMbRequest ( ) -> isBlogAdmin ( ) ) { return false ; } //Check if a user is logged in Wordpress if ( $ this -> mbRequest -> isLogged ( ) ) { //Check if the current request is ajax if ( $ this -> mbRequest -> isAjax ( ) ) { //add hook admin_ajax $ actionHook = "wp_ajax_{$this->getAction()}" ; } else { //add hook admin_post $ actionHook = "admin_post_{$this->getAction()}" ; } } else { //Check if the current request is ajax if ( $ this -> mbRequest -> isAjax ( ) ) { //add hook nopriv_ajax $ actionHook = "wp_ajax_nopriv_{$this->getAction()}" ; } else { //add hook nopriv_post $ actionHook = "admin_post_nopriv_{$this->getAction()}" ; } } //Register WordpressHook MbWPActionHook :: addAction ( $ actionHook , $ this , 'sendContent' ) ; return true ; }
Add Wordpress Hook for current action if needed

@return boolean
Add Wordpress Hook for current action if needed