src/MocaBonita.php
private function runPlugin()
    {
        //Call MbEvent from wordpress (START_WORDPRESS)
        MbEvent::callEvents($this, MbEvent::START_WORDPRESS, $this);

        if (!$this->getMbResponse()->isRedirection()) {

            //Call the MbAsset from WordPress
            $this->getMbAssets(true)->runAssets('*');

            //Get all query params from url
            $paramsQuery = $this->mbRequest->query();

            //Check if there is a pagination attribute
            if (isset($paramsQuery[MbDatabaseQueryBuilder::getPagination()])) {
                $pagination = $paramsQuery[MbDatabaseQueryBuilder::getPagination()];
                unset($paramsQuery[MbDatabaseQueryBuilder::getPagination()]);
            } else {
                $pagination = 1;
            }

            //Get url without pagination query
            $urlWihtouPagination = $this->mbRequest->urlQuery($paramsQuery);

            //Set url without pagination query to the Paginator Resolver
            Paginator::currentPathResolver(function () use ($urlWihtouPagination) {
                return $urlWihtouPagination;
            });

            //Set current pagination to the Paginator Resolver
            Paginator::currentPageResolver(function () use ($pagination) {
                return is_numeric($pagination) ? (int) $pagination : 1;
            });

            //Call the Shortcode from plugin
            foreach ($this->mbShortCodes as $shortcode) {
                $shortcode->runShortcode($this->getMbAssets(), $this->mbRequest, $this->mbResponse);
            }

            //Add wordpress administrative menu if needed
            if ($this->getMbRequest()->isBlogAdmin()) {
                MbWPActionHook::addAction('admin_menu', $this, 'addAdminMenuToWordpress');
            }

            if ($this->isMocabonitaPage()) {

                //Get current MbPage
                $mbPage = $this->getMbPage($this->page);

                //Set current MbPage to MbRequest
                $this->getMbRequest()->setMbPage($mbPage);

                try {

                    //Call MvEvent from page (BEFORE_PAGE)
                    MbEvent::callEvents($this, MbEvent::BEFORE_PAGE, $mbPage);

                    //Call the MbAsset from plugin
                    $this->getMbAssets()->runAssets('plugin');

                    //Call the MbAsset from page
                    $mbPage->getMbAsset()->runAssets($this->page);

                    //Run current page
                    $this->runCurrentPage($mbPage);

                    //Call MvEvent from page (AFTER_PAGE)
                    MbEvent::callEvents($this, MbEvent::AFTER_PAGE, $mbPage);
                } catch (\Exception $e) {
                    //Call MvEvent from page (EXCEPTION_PAGE)
                    MbEvent::callEvents($this, MbEvent::EXCEPTION_PAGE, $e);
                    throw $e;
                } finally {
                    //Call MvEvent from page (FINISH_PAGE)
                    MbEvent::callEvents($this, MbEvent::FINISH_PAGE, $mbPage);
                }
            }

        }

        //Call MbEvent from wordpress (FINISH_WORDPRESS)
        MbEvent::callEvents($this, MbEvent::FINISH_WORDPRESS, $this);

    }
private function runPlugin()
    {
        //Call MbEvent from wordpress (START_WORDPRESS)
        MbEvent::callEvents($this, MbEvent::START_WORDPRESS, $this);

        if (!$this->getMbResponse()->isRedirection()) {

            //Call the MbAsset from WordPress
            $this->getMbAssets(true)->runAssets('*');

            //Get all query params from url
            $paramsQuery = $this->mbRequest->query();

            //Check if there is a pagination attribute
            if (isset($paramsQuery[MbDatabaseQueryBuilder::getPagination()])) {
                $pagination = $paramsQuery[MbDatabaseQueryBuilder::getPagination()];
                unset($paramsQuery[MbDatabaseQueryBuilder::getPagination()]);
            } else {
                $pagination = 1;
            }

            //Get url without pagination query
            $urlWihtouPagination = $this->mbRequest->urlQuery($paramsQuery);

            //Set url without pagination query to the Paginator Resolver
            Paginator::currentPathResolver(function () use ($urlWihtouPagination) {
                return $urlWihtouPagination;
            });

            //Set current pagination to the Paginator Resolver
            Paginator::currentPageResolver(function () use ($pagination) {
                return is_numeric($pagination) ? (int) $pagination : 1;
            });

            //Call the Shortcode from plugin
            foreach ($this->mbShortCodes as $shortcode) {
                $shortcode->runShortcode($this->getMbAssets(), $this->mbRequest, $this->mbResponse);
            }

            //Add wordpress administrative menu if needed
            if ($this->getMbRequest()->isBlogAdmin()) {
                MbWPActionHook::addAction('admin_menu', $this, 'addAdminMenuToWordpress');
            }

            if ($this->isMocabonitaPage()) {

                //Get current MbPage
                $mbPage = $this->getMbPage($this->page);

                //Set current MbPage to MbRequest
                $this->getMbRequest()->setMbPage($mbPage);

                try {

                    //Call MvEvent from page (BEFORE_PAGE)
                    MbEvent::callEvents($this, MbEvent::BEFORE_PAGE, $mbPage);

                    //Call the MbAsset from plugin
                    $this->getMbAssets()->runAssets('plugin');

                    //Call the MbAsset from page
                    $mbPage->getMbAsset()->runAssets($this->page);

                    //Run current page
                    $this->runCurrentPage($mbPage);

                    //Call MvEvent from page (AFTER_PAGE)
                    MbEvent::callEvents($this, MbEvent::AFTER_PAGE, $mbPage);
                } catch (\Exception $e) {
                    //Call MvEvent from page (EXCEPTION_PAGE)
                    MbEvent::callEvents($this, MbEvent::EXCEPTION_PAGE, $e);
                    throw $e;
                } finally {
                    //Call MvEvent from page (FINISH_PAGE)
                    MbEvent::callEvents($this, MbEvent::FINISH_PAGE, $mbPage);
                }
            }

        }

        //Call MbEvent from wordpress (FINISH_WORDPRESS)
        MbEvent::callEvents($this, MbEvent::FINISH_WORDPRESS, $this);

    }
private function runPlugin ( ) { //Call MbEvent from wordpress (START_WORDPRESS) MbEvent :: callEvents ( $ this , MbEvent :: START_WORDPRESS , $ this ) ; if ( ! $ this -> getMbResponse ( ) -> isRedirection ( ) ) { //Call the MbAsset from WordPress $ this -> getMbAssets ( true ) -> runAssets ( '*' ) ; //Get all query params from url $ paramsQuery = $ this -> mbRequest -> query ( ) ; //Check if there is a pagination attribute if ( isset ( $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ) ) { $ pagination = $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ; unset ( $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ) ; } else { $ pagination = 1 ; } //Get url without pagination query $ urlWihtouPagination = $ this -> mbRequest -> urlQuery ( $ paramsQuery ) ; //Set url without pagination query to the Paginator Resolver Paginator :: currentPathResolver ( function ( ) use ( $ urlWihtouPagination ) { return $ urlWihtouPagination ; } ) ; //Set current pagination to the Paginator Resolver Paginator :: currentPageResolver ( function ( ) use ( $ pagination ) { return is_numeric ( $ pagination ) ? ( int ) $ pagination : 1 ; } ) ; //Call the Shortcode from plugin foreach ( $ this -> mbShortCodes as $ shortcode ) { $ shortcode -> runShortcode ( $ this -> getMbAssets ( ) , $ this -> mbRequest , $ this -> mbResponse ) ; } //Add wordpress administrative menu if needed if ( $ this -> getMbRequest ( ) -> isBlogAdmin ( ) ) { MbWPActionHook :: addAction ( 'admin_menu' , $ this , 'addAdminMenuToWordpress' ) ; } if ( $ this -> isMocabonitaPage ( ) ) { //Get current MbPage $ mbPage = $ this -> getMbPage ( $ this -> page ) ; //Set current MbPage to MbRequest $ this -> getMbRequest ( ) -> setMbPage ( $ mbPage ) ; try { //Call MvEvent from page (BEFORE_PAGE) MbEvent :: callEvents ( $ this , MbEvent :: BEFORE_PAGE , $ mbPage ) ; //Call the MbAsset from plugin $ this -> getMbAssets ( ) -> runAssets ( 'plugin' ) ; //Call the MbAsset from page $ mbPage -> getMbAsset ( ) -> runAssets ( $ this -> page ) ; //Run current page $ this -> runCurrentPage ( $ mbPage ) ; //Call MvEvent from page (AFTER_PAGE) MbEvent :: callEvents ( $ this , MbEvent :: AFTER_PAGE , $ mbPage ) ; } catch ( \ Exception $ e ) { //Call MvEvent from page (EXCEPTION_PAGE) MbEvent :: callEvents ( $ this , MbEvent :: EXCEPTION_PAGE , $ e ) ; throw $ e ; } finally { //Call MvEvent from page (FINISH_PAGE) MbEvent :: callEvents ( $ this , MbEvent :: FINISH_PAGE , $ mbPage ) ; } } } //Call MbEvent from wordpress (FINISH_WORDPRESS) MbEvent :: callEvents ( $ this , MbEvent :: FINISH_WORDPRESS , $ this ) ; }
Initialize the processing of the plugin and its resources.

@throws \Exception

@return void
Initialize the processing of the plugin and its resources .