Phalcon Framework 3.0.1

Error: Call to a member function getId() on boolean

/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%main.volt.php (96)
#0unknown
#1Phalcon\Mvc\View\Engine\Volt->render(/var/www/gnli.com/public_html/app/modules/Publication/views/../../../views/main.volt, Array([publication] => Object(Publication\Model\Publication)), true)
#2Phalcon\Mvc\View->_engineRender(Array([.volt] => Object(Application\Mvc\View\Engine\Volt), [.phtml] => Object(Phalcon\Mvc\View\Engine\Php)), ../../../views/main, true, true, null)
#3Phalcon\Mvc\View->render(index, publication, Array([type] => video, [slug] => woman-leaves-the-homosexual-lifestyle-to-pursue-christianity))
/var/www/gnli.com/public_html/app/Bootstrap.php (452)
<?php
 
namespace CMCi;
 
 
class Bootstrap
{
    private $di;
 
    private $services = [
        'config',
        'registry',
        'loader',
        'db',
        'view',
        'url',
        'security',
        'cache',
        'cms',
        'flash',
        'helper',
        'session',
        'acl',
        'assets',
    ];
 
    /**
     * Constructor
     *
     * @param $di
     */
    public function __construct()
    {
        $this->di = new \Phalcon\DI\FactoryDefault();
    }
 
    public function run()
    {
 
        foreach ($this->services as $service) {
            $function = 'init' . ucfirst($service);
            $this->$function();
        }
 
        // Application
        $application = new \Phalcon\Mvc\Application();
        $application->registerModules($this->di['config']->modules->toArray());
 
        // Events Manager, Dispatcher
        $this->initEventsmanager();
 
        // Routing
        $this->initRouter($application);
 
        $application->setDI($this->di);
 
        // Main dispatching process
        $this->dispatch();
 
    }
 
    private function initConfig()
    {
        // Config
        require_once APPLICATION_PATH . '/modules/Cms/Config.php';
        $config = \Cms\Config::get();
        $this->di->setShared('config', $config);
    }
 
    private function initRegistry()
    {
        // Registry
        $registry = new \Phalcon\Registry();
        $this->di->set('registry', $registry);
    }
 
    private function initLoader()
    {
        // Loader
        $loader = new \Phalcon\Loader();
        $loader->registerNamespaces($this->di['config']->loader->namespaces->toArray());
        $loader->registerDirs([APPLICATION_PATH . "/plugins/"]);
        $loader->register();
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
    }
 
    private function initDb()
    {
        $config = $this->di['config'];
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql( $config->database->toArray() );
        $this->di->set('db', $db);
    }
 
    public function initRouter($application)
    {
        $config = $this->di['config'];
        //$loader = $this->di['loader'];
        $this->di->setShared('router', function () use ($config, $application) {
            $router = new \Application\Mvc\Router\DefaultRouter();
            //$router->setDefaultModule('common');
            /*if (SUBDOMAIN == 'm') {
                $router->setDefaultModule('common');
            }*/
            //$router->setDi($this->di);
            foreach ($application->getModules() as $module) {
                $routesClassName = str_replace('Module', 'Routes', $module['className']);
                if (class_exists($routesClassName)) {
                    $routesClass = new $routesClassName();
                    $router = $routesClass->init($router);
                }
                $initClassName = str_replace('Module', 'Init', $module['className']);
                if (class_exists($initClassName)) {
                    new $initClassName();
                }
            }
 
            $router->removeExtraSlashes(true);
 
            return $router;
        });
    }
 
    private function initAssets()
    {
        $config = $this->di->get('config');
        $assetsManager = new \Application\Assets\Manager();
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        // Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        // Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new \Application\Assets\Filter\Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . '/modules/Admin/assets/admin.less');
 
        $this->di->set('assets', $assetsManager);
    }
 
    private function initEventsmanager()
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher    = new \Phalcon\Mvc\Dispatcher();
        $di            = $this->di;
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \CMCi\Plugin\CheckPoint($di->get('request'));
            new \CMCi\Plugin\Acl($di->get('acl'), $dispatcher, $this->di->get('view'));
            new \CMCi\Plugin\MobileDetect($di->get('session'), $this->di->get('view'), $di->get('request'));
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \CMCi\Plugin\Title($di);
        });
 
        // Profiler
        $registry = $this->di->get('registry');
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        /**
         * acl
         */
        /**$acl = $this->di->get('acl');
        $eventsManager->attach("acl", function ($event, $acl) {
            if ($event->getType() == "beforeCheckAccess") {
                echo   $acl->getActiveRole(),
                    //$acl->getActiveResource(),
                $acl->getActiveAccess();die();
            }
        });
        $acl->setEventsManager($eventsManager);**/
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    private function initView()
    {
 
        $view = new \Phalcon\Mvc\View();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $this->di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $this->di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
 
        $ajax = $this->di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $this->di->set('view', $view);
 
        return $view;
    }
 
    private function initUrl()
    {
        $config  = $this->di['config'];
        $request = $this->di['request'];
        /**
         * The URL component is used to generate all kind of urls in the
         * application
         */
        $this->di->setShared('url', function () use ($config, $request) {
            $url = new \Phalcon\Mvc\Url();
 
            /*if (SUBDOMAIN == 'm') {
                $config->app_baseUri = 'm.' . $config->app_baseUri;
            }*/
 
            $url->setBaseUri($config->base_path);
            $url->setStaticBaseUri($config->resource_path);
            return $url;
        });
    }
 
    private function initSecurity()
    {
        $this->di->setShared('security', function () {
            $security = new \Phalcon\Security;
            //security->setWorkFactor( 12 );
            return $security;
        });
    }
 
    private function initCache()
    {
        $config = $this->di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 172800,
            "prefix"   => HOST_HASH,
        ]);
 
        $cache = null;
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcached':
                /**$cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);**/
                 $cache = new \Phalcon\Cache\Backend\Libmemcached($cacheFrontend, [
                    "servers" => [
                       $config->memcache->toArray()
                    ],
                     "client" => [
                         \Memcached::OPT_HASH => \Memcached::HASH_MD5,
                         \Memcached::OPT_PREFIX_KEY => 'gnli.',
                     ]
                ]);
                break;
        }
        $this->di->set('cache', $cache, true);
        $this->di->set('modelsCache', $cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $this->di->set('modelsMetadata', $modelsMetadata);
    }
 
    private function initCms()
    {
        // CMS
        $registry = $this->di['registry'];
        $cmsModel = new \Cms\Model\Configuration();
        $registry->cms = $cmsModel->getConfig(); //
    }
 
    private function initFlash()
    {
        // Flash helper
        $flash = new \Phalcon\Flash\Session([
            'error'   => 'ui red inverted segment alert-danger',
            'success' => 'ui green inverted segment alert-success',
            'notice'  => 'ui blue inverted segment alert-info',
            'warning' => 'ui orange inverted segment',
        ]);
        $this->di->setShared('flash', $flash);
    }
 
    private function initHelper()
    {
        $this->di->set('helper', new \Application\Mvc\Helper());
    }
 
    private function initSession()
    {
        // Session
        /*$session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        $this->di->setShared('session', $session);*/
        $config = $this->di->get('config');
        $session = new \Phalcon\Session\Adapter\Libmemcached([
            'servers' => [$config->memcache->toArray()],
            'client' => array(
                \Memcached::OPT_HASH => \Memcached::HASH_MD5,
                \Memcached::OPT_PREFIX_KEY => 'gnli.',
            ),
            'lifetime' => 172800,
            'prefix'   => 'gnli_'
        ]);
 
        $session->start();
        $this->di->set('session', $session);
    }
 
    private function initAcl()
    {
        //$this->di->set('acl', $acl);
        $this->di->setShared('acl', function() {
            $acl = new \Application\Acl\DefaultAcl();
            //$acl->setDefaultAction(\Phalcon\Acl::DENY);
 
            return $acl;
        });
    }
 
    private function dispatch()
    {
        $di         = $this->di;
        $view       = $di['view'];
        $router     = $di['router'];
        $response   = $di['response'];
        $dispatcher = $di['dispatcher'];
 
 
        $router->handle();
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        /**
         * set dispather default namespace when it detected and set acl;
         */
        if ($router->getNamespaceName()){
            $dispatcher->setNamespaceName($router->getNamespaceName());
            $namespace = strtolower(basename(str_replace('\\', '/', $dispatcher->getNamespaceName())));
            $controllerName = $namespace . '/' . $dispatcher->getControllerName();
 
            $dispatcher->setDefaultNamespace($router->getNamespaceName());
        } else {
            $controllerName = $dispatcher->getControllerName();
            $dispatcher->setDefaultNamespace('\\' . $moduleName . '\Controller');
        }
 
        $ModuleClassName = $moduleName . '\Module';
 
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
            $view->setViewsDir(__DIR__ . '/modules/' .$moduleName . '/views/');
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
 
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                // Errors catching
 
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
 
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setHeader(404, 'Not Found');
                    $view->partial('error/error404');
                } else {
                    $response->setHeader(503, 'Service Unavailable');
                    $view->partial('error/error503');
                }
                $response->sendHeaders();
                echo $response->getContent();
                return;
 
            }
        }
 
        $view->render(
            $controllerName,
            //$dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
 
        $response = $di['response'];
 
        // AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
        if ($_ajax) {
            $contents = $view->getContent();
 
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
 
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
 
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
 
        $_unminify = $request->getQuery('_unminify');
        if ($_unminify) {
            echo $response->getContent();
        } else {
            echo $this->minifyContent($response->getContent());
        }
    }
 
    private function minifyContent($content)
    {
        $search = array(
            '/\>[^\S ]+/s',  // strip whitespaces after tags, except space
            '/[^\S ]+\</s',  // strip whitespaces before tags, except space
            '/(\s)+/s'       // shorten multiple whitespace sequences
        );
 
        $replace = array(
            '>',
            '<',
            '\\1'
        );
 
        $buffer = preg_replace($search, $replace, $content);
 
        return $buffer;
    }
 
}
#4CMCi\Bootstrap->dispatch()
/var/www/gnli.com/public_html/app/Bootstrap.php (58)
<?php
 
namespace CMCi;
 
 
class Bootstrap
{
    private $di;
 
    private $services = [
        'config',
        'registry',
        'loader',
        'db',
        'view',
        'url',
        'security',
        'cache',
        'cms',
        'flash',
        'helper',
        'session',
        'acl',
        'assets',
    ];
 
    /**
     * Constructor
     *
     * @param $di
     */
    public function __construct()
    {
        $this->di = new \Phalcon\DI\FactoryDefault();
    }
 
    public function run()
    {
 
        foreach ($this->services as $service) {
            $function = 'init' . ucfirst($service);
            $this->$function();
        }
 
        // Application
        $application = new \Phalcon\Mvc\Application();
        $application->registerModules($this->di['config']->modules->toArray());
 
        // Events Manager, Dispatcher
        $this->initEventsmanager();
 
        // Routing
        $this->initRouter($application);
 
        $application->setDI($this->di);
 
        // Main dispatching process
        $this->dispatch();
 
    }
 
    private function initConfig()
    {
        // Config
        require_once APPLICATION_PATH . '/modules/Cms/Config.php';
        $config = \Cms\Config::get();
        $this->di->setShared('config', $config);
    }
 
    private function initRegistry()
    {
        // Registry
        $registry = new \Phalcon\Registry();
        $this->di->set('registry', $registry);
    }
 
    private function initLoader()
    {
        // Loader
        $loader = new \Phalcon\Loader();
        $loader->registerNamespaces($this->di['config']->loader->namespaces->toArray());
        $loader->registerDirs([APPLICATION_PATH . "/plugins/"]);
        $loader->register();
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
    }
 
    private function initDb()
    {
        $config = $this->di['config'];
 
        // Database
        $db = new \Phalcon\Db\Adapter\Pdo\Mysql( $config->database->toArray() );
        $this->di->set('db', $db);
    }
 
    public function initRouter($application)
    {
        $config = $this->di['config'];
        //$loader = $this->di['loader'];
        $this->di->setShared('router', function () use ($config, $application) {
            $router = new \Application\Mvc\Router\DefaultRouter();
            //$router->setDefaultModule('common');
            /*if (SUBDOMAIN == 'm') {
                $router->setDefaultModule('common');
            }*/
            //$router->setDi($this->di);
            foreach ($application->getModules() as $module) {
                $routesClassName = str_replace('Module', 'Routes', $module['className']);
                if (class_exists($routesClassName)) {
                    $routesClass = new $routesClassName();
                    $router = $routesClass->init($router);
                }
                $initClassName = str_replace('Module', 'Init', $module['className']);
                if (class_exists($initClassName)) {
                    new $initClassName();
                }
            }
 
            $router->removeExtraSlashes(true);
 
            return $router;
        });
    }
 
    private function initAssets()
    {
        $config = $this->di->get('config');
        $assetsManager = new \Application\Assets\Manager();
        $js_collection = $assetsManager->collection('js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/js.js')
            ->setTargetUri('assets/js.js')
            ->join(true);
        if ($config->assets->js) {
            foreach ($config->assets->js as $js) {
                $js_collection->addJs(ROOT . '/' . $js);
            }
        }
 
        // Admin JS Assets
        $assetsManager->collection('modules-admin-js')
            ->setLocal(true)
            ->addFilter(new \Phalcon\Assets\Filters\Jsmin())
            ->setTargetPath(ROOT . '/assets/modules-admin.js')
            ->setTargetUri('assets/modules-admin.js')
            ->join(true);
 
        // Admin LESS Assets
        $assetsManager->collection('modules-admin-less')
            ->setLocal(true)
            ->addFilter(new \Application\Assets\Filter\Less())
            ->setTargetPath(ROOT . '/assets/modules-admin.less')
            ->setTargetUri('assets/modules-admin.less')
            ->join(true)
            ->addCss(APPLICATION_PATH . '/modules/Admin/assets/admin.less');
 
        $this->di->set('assets', $assetsManager);
    }
 
    private function initEventsmanager()
    {
        $eventsManager = new \Phalcon\Events\Manager();
        $dispatcher    = new \Phalcon\Mvc\Dispatcher();
        $di            = $this->di;
        $eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \CMCi\Plugin\CheckPoint($di->get('request'));
            new \CMCi\Plugin\Acl($di->get('acl'), $dispatcher, $this->di->get('view'));
            new \CMCi\Plugin\MobileDetect($di->get('session'), $this->di->get('view'), $di->get('request'));
        });
 
        $eventsManager->attach("dispatch:afterDispatchLoop", function ($event, $dispatcher) use ($di) {
            new \Seo\Plugin\SeoManager($dispatcher, $di->get('request'), $di->get('router'), $di->get('view'));
            new \CMCi\Plugin\Title($di);
        });
 
        // Profiler
        $registry = $this->di->get('registry');
        if ($registry->cms['PROFILER']) {
            $profiler = new \Phalcon\Db\Profiler();
            $di->set('profiler', $profiler);
 
            $eventsManager->attach('db', function ($event, $db) use ($profiler) {
                if ($event->getType() == 'beforeQuery') {
                    $profiler->startProfile($db->getSQLStatement());
                }
                if ($event->getType() == 'afterQuery') {
                    $profiler->stopProfile();
                }
            });
        }
 
        $db = $di->get('db');
        $db->setEventsManager($eventsManager);
 
        /**
         * acl
         */
        /**$acl = $this->di->get('acl');
        $eventsManager->attach("acl", function ($event, $acl) {
            if ($event->getType() == "beforeCheckAccess") {
                echo   $acl->getActiveRole(),
                    //$acl->getActiveResource(),
                $acl->getActiveAccess();die();
            }
        });
        $acl->setEventsManager($eventsManager);**/
 
        $dispatcher->setEventsManager($eventsManager);
        $di->set('dispatcher', $dispatcher);
    }
 
    private function initView()
    {
 
        $view = new \Phalcon\Mvc\View();
 
        define('MAIN_VIEW_PATH', '../../../views/');
        $view->setMainView(MAIN_VIEW_PATH . 'main');
        $view->setLayoutsDir(MAIN_VIEW_PATH . '/layouts/');
        $view->setLayout('main');
        $view->setPartialsDir(MAIN_VIEW_PATH . '/partials/');
 
        // Volt
        $volt = new \Application\Mvc\View\Engine\Volt($view, $this->di);
        $volt->setOptions(['compiledPath' => APPLICATION_PATH . '/../data/cache/volt/']);
        $volt->initCompiler();
 
 
        $phtml = new \Phalcon\Mvc\View\Engine\Php($view, $this->di);
        $viewEngines = [
            ".volt"  => $volt,
            ".phtml" => $phtml,
        ];
 
        $view->registerEngines($viewEngines);
 
        $ajax = $this->di->get('request')->getQuery('_ajax');
        if ($ajax) {
            $view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_LAYOUT);
        }
 
        $this->di->set('view', $view);
 
        return $view;
    }
 
    private function initUrl()
    {
        $config  = $this->di['config'];
        $request = $this->di['request'];
        /**
         * The URL component is used to generate all kind of urls in the
         * application
         */
        $this->di->setShared('url', function () use ($config, $request) {
            $url = new \Phalcon\Mvc\Url();
 
            /*if (SUBDOMAIN == 'm') {
                $config->app_baseUri = 'm.' . $config->app_baseUri;
            }*/
 
            $url->setBaseUri($config->base_path);
            $url->setStaticBaseUri($config->resource_path);
            return $url;
        });
    }
 
    private function initSecurity()
    {
        $this->di->setShared('security', function () {
            $security = new \Phalcon\Security;
            //security->setWorkFactor( 12 );
            return $security;
        });
    }
 
    private function initCache()
    {
        $config = $this->di->get('config');
 
        $cacheFrontend = new \Phalcon\Cache\Frontend\Data([
            "lifetime" => 172800,
            "prefix"   => HOST_HASH,
        ]);
 
        $cache = null;
        switch ($config->cache) {
            case 'file':
                $cache = new \Phalcon\Cache\Backend\File($cacheFrontend, [
                    "cacheDir" => APPLICATION_PATH . "/../data/cache/backend/"
                ]);
                break;
            case 'memcached':
                /**$cache = new \Phalcon\Cache\Backend\Memcache(
                    $cacheFrontend, [
                    "host" => $config->memcache->host,
                    "port" => $config->memcache->port,
                ]);**/
                 $cache = new \Phalcon\Cache\Backend\Libmemcached($cacheFrontend, [
                    "servers" => [
                       $config->memcache->toArray()
                    ],
                     "client" => [
                         \Memcached::OPT_HASH => \Memcached::HASH_MD5,
                         \Memcached::OPT_PREFIX_KEY => 'gnli.',
                     ]
                ]);
                break;
        }
        $this->di->set('cache', $cache, true);
        $this->di->set('modelsCache', $cache, true);
 
        \Application\Widget\Proxy::$cache = $cache; // Modules Widget System
 
        $modelsMetadata = new \Phalcon\Mvc\Model\Metadata\Memory();
        $this->di->set('modelsMetadata', $modelsMetadata);
    }
 
    private function initCms()
    {
        // CMS
        $registry = $this->di['registry'];
        $cmsModel = new \Cms\Model\Configuration();
        $registry->cms = $cmsModel->getConfig(); //
    }
 
    private function initFlash()
    {
        // Flash helper
        $flash = new \Phalcon\Flash\Session([
            'error'   => 'ui red inverted segment alert-danger',
            'success' => 'ui green inverted segment alert-success',
            'notice'  => 'ui blue inverted segment alert-info',
            'warning' => 'ui orange inverted segment',
        ]);
        $this->di->setShared('flash', $flash);
    }
 
    private function initHelper()
    {
        $this->di->set('helper', new \Application\Mvc\Helper());
    }
 
    private function initSession()
    {
        // Session
        /*$session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        $this->di->setShared('session', $session);*/
        $config = $this->di->get('config');
        $session = new \Phalcon\Session\Adapter\Libmemcached([
            'servers' => [$config->memcache->toArray()],
            'client' => array(
                \Memcached::OPT_HASH => \Memcached::HASH_MD5,
                \Memcached::OPT_PREFIX_KEY => 'gnli.',
            ),
            'lifetime' => 172800,
            'prefix'   => 'gnli_'
        ]);
 
        $session->start();
        $this->di->set('session', $session);
    }
 
    private function initAcl()
    {
        //$this->di->set('acl', $acl);
        $this->di->setShared('acl', function() {
            $acl = new \Application\Acl\DefaultAcl();
            //$acl->setDefaultAction(\Phalcon\Acl::DENY);
 
            return $acl;
        });
    }
 
    private function dispatch()
    {
        $di         = $this->di;
        $view       = $di['view'];
        $router     = $di['router'];
        $response   = $di['response'];
        $dispatcher = $di['dispatcher'];
 
 
        $router->handle();
        $dispatcher->setModuleName($router->getModuleName());
        $dispatcher->setControllerName($router->getControllerName());
        $dispatcher->setActionName($router->getActionName());
        $dispatcher->setParams($router->getParams());
        $moduleName = \Application\Utils\ModuleName::camelize($router->getModuleName());
 
        /**
         * set dispather default namespace when it detected and set acl;
         */
        if ($router->getNamespaceName()){
            $dispatcher->setNamespaceName($router->getNamespaceName());
            $namespace = strtolower(basename(str_replace('\\', '/', $dispatcher->getNamespaceName())));
            $controllerName = $namespace . '/' . $dispatcher->getControllerName();
 
            $dispatcher->setDefaultNamespace($router->getNamespaceName());
        } else {
            $controllerName = $dispatcher->getControllerName();
            $dispatcher->setDefaultNamespace('\\' . $moduleName . '\Controller');
        }
 
        $ModuleClassName = $moduleName . '\Module';
 
        if (class_exists($ModuleClassName)) {
            $module = new $ModuleClassName;
            $module->registerAutoloaders();
            $module->registerServices($di);
            $view->setViewsDir(__DIR__ . '/modules/' .$moduleName . '/views/');
        }
 
        $view->start();
 
        $registry = $di['registry'];
        if ($registry->cms['DEBUG_MODE']) {
            $debug = new \Phalcon\Debug();
            $debug->listen();
 
            $dispatcher->dispatch();
        } else {
            try {
                $dispatcher->dispatch();
            } catch (\Phalcon\Exception $e) {
                // Errors catching
 
                $view->setViewsDir(__DIR__ . '/modules/Index/views/');
                $view->setPartialsDir('');
                $view->e = $e;
 
                if ($e instanceof \Phalcon\Mvc\Dispatcher\Exception) {
                    $response->setHeader(404, 'Not Found');
                    $view->partial('error/error404');
                } else {
                    $response->setHeader(503, 'Service Unavailable');
                    $view->partial('error/error503');
                }
                $response->sendHeaders();
                echo $response->getContent();
                return;
 
            }
        }
 
        $view->render(
            $controllerName,
            //$dispatcher->getControllerName(),
            $dispatcher->getActionName(),
            $dispatcher->getParams()
        );
 
        $view->finish();
 
        $response = $di['response'];
 
        // AJAX
        $request = $di['request'];
        $_ajax = $request->getQuery('_ajax');
        if ($_ajax) {
            $contents = $view->getContent();
 
            $return = new \stdClass();
            $return->html = $contents;
            $return->title = $di->get('helper')->title()->get();
            $return->success = true;
 
            if ($view->bodyClass) {
                $return->bodyClass = $view->bodyClass;
            }
 
            $headers = $response->getHeaders()->toArray();
            if (isset($headers[404]) || isset($headers[503])) {
                $return->success = false;
            }
            $response->setContentType('application/json', 'UTF-8');
            $response->setContent(json_encode($return));
        } else {
            $response->setContent($view->getContent());
        }
 
        $_unminify = $request->getQuery('_unminify');
        if ($_unminify) {
            echo $response->getContent();
        } else {
            echo $this->minifyContent($response->getContent());
        }
    }
 
    private function minifyContent($content)
    {
        $search = array(
            '/\>[^\S ]+/s',  // strip whitespaces after tags, except space
            '/[^\S ]+\</s',  // strip whitespaces before tags, except space
            '/(\s)+/s'       // shorten multiple whitespace sequences
        );
 
        $replace = array(
            '>',
            '<',
            '\\1'
        );
 
        $buffer = preg_replace($search, $replace, $content);
 
        return $buffer;
    }
 
}
#5CMCi\Bootstrap->run()
/var/www/gnli.com/public_html/public/index.php (31)
<?php
/*ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);*/
 
//session_set_cookie_params(0, '/', 'localhost');
chdir(dirname(__DIR__));
 
define('ROOT', __DIR__);
define('HOST_HASH', substr(md5($_SERVER['HTTP_HOST']), 0, 12));
 
defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
 
define('APPLICATION_PATH', __DIR__ . '/../app');
 
date_default_timezone_set('America/New_York');
 
if (APPLICATION_ENV == 'development') {
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
}
/**
 * Detect sub domain for routing
 */
$sudomaininfo = explode(".",$_SERVER['HTTP_HOST']);
define('SUBDOMAIN', array_shift($sudomaininfo));
 
require_once APPLICATION_PATH . '/Bootstrap.php';
$bootstrap = new CMCi\Bootstrap();
$bootstrap->run();
KeyValue
_url/video/woman-leaves-the-homosexual-lifestyle-to-pursue-christianity.html
KeyValue
REDIRECT_REDIRECT_STATUS200
REDIRECT_APPLICATION_ENVproduction
REDIRECT_STATUS200
APPLICATION_ENVproduction
HTTP_HOSTgnli.christianpost.com
HTTP_ACCEPT_ENCODINGx-gzip, gzip, deflate
HTTP_USER_AGENTCCBot/2.0 (http://commoncrawl.org/faq/)
HTTP_ACCEPT_LANGUAGEen-us,en-gb,en;q=0.7,*;q=0.3
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SERVER_SIGNATURE<address>Apache/2.4.23 (Ubuntu) Server at gnli.christianpost.com Port 80</address>\n
SERVER_SOFTWAREApache/2.4.23 (Ubuntu)
SERVER_NAMEgnli.christianpost.com
SERVER_ADDR10.7.33.177
SERVER_PORT80
REMOTE_ADDR54.80.50.235
DOCUMENT_ROOT/var/www/gnli.com/public_html
REQUEST_SCHEMEhttp
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/var/www/gnli.com/public_html
SERVER_ADMINsupport@cmcigroup.com
SCRIPT_FILENAME/var/www/gnli.com/public_html/public/index.php
REMOTE_PORT50123
REDIRECT_URL/public/video/woman-leaves-the-homosexual-lifestyle-to-pursue-christianity.html
REDIRECT_QUERY_STRING_url=/video/woman-leaves-the-homosexual-lifestyle-to-pursue-christianity.html
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.0
REQUEST_METHODGET
QUERY_STRING_url=/video/woman-leaves-the-homosexual-lifestyle-to-pursue-christianity.html
REQUEST_URI/video/woman-leaves-the-homosexual-lifestyle-to-pursue-christianity.html
SCRIPT_NAME/public/index.php
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1472475766.395
REQUEST_TIME1472475766
#Path
0/var/www/gnli.com/public_html/public/index.php
1/var/www/gnli.com/public_html/app/Bootstrap.php
2/var/www/gnli.com/public_html/app/modules/Cms/Config.php
3/var/www/gnli.com/public_html/app/config/environment/production.php
4/var/www/gnli.com/public_html/app/config/global.php
5/var/www/gnli.com/public_html/app/config/modules.php
6/var/www/gnli.com/public_html/app/modules/Application/Loader/Modules.php
7/var/www/gnli.com/public_html/vendor/autoload.php
8/var/www/gnli.com/public_html/vendor/composer/autoload_real.php
9/var/www/gnli.com/public_html/vendor/composer/ClassLoader.php
10/var/www/gnli.com/public_html/vendor/composer/autoload_namespaces.php
11/var/www/gnli.com/public_html/vendor/composer/autoload_psr4.php
12/var/www/gnli.com/public_html/vendor/composer/autoload_classmap.php
13/var/www/gnli.com/public_html/vendor/composer/autoload_files.php
14/var/www/gnli.com/public_html/vendor/symfony/polyfill-mbstring/bootstrap.php
15/var/www/gnli.com/public_html/app/modules/Application/Mvc/View/Engine/Volt.php
16/var/www/gnli.com/public_html/app/modules/Application/Widget/Proxy.php
17/var/www/gnli.com/public_html/app/modules/Cms/Model/Configuration.php
18/var/www/gnli.com/public_html/app/modules/Application/Mvc/Helper.php
19/var/www/gnli.com/public_html/app/modules/Menu/Helper/Menu.php
20/var/www/gnli.com/public_html/app/modules/Application/Assets/Manager.php
21/var/www/gnli.com/public_html/app/modules/Application/Assets/Filter/Less.php
22/var/www/gnli.com/public_html/app/modules/Application/Mvc/Router/DefaultRouter.php
23/var/www/gnli.com/public_html/app/modules/Index/Routes.php
24/var/www/gnli.com/public_html/app/modules/Admin/Routes.php
25/var/www/gnli.com/public_html/app/modules/Page/Routes.php
26/var/www/gnli.com/public_html/app/modules/Publication/Routes.php
27/var/www/gnli.com/public_html/app/modules/Publication/Model/Type.php
28/var/www/gnli.com/public_html/app/modules/Application/Mvc/Model/Model.php
29/var/www/gnli.com/public_html/app/modules/Cms/Helper/CmsCache.php
30/var/www/gnli.com/public_html/app/modules/Application/Mvc/Helper/Cache.php
31/var/www/gnli.com/public_html/app/modules/Seo/Routes.php
32/var/www/gnli.com/public_html/app/modules/Category/Routes.php
33/var/www/gnli.com/public_html/app/modules/Category/Model/Category.php
34/var/www/gnli.com/public_html/app/modules/Category/Helper/CategoryCache.php
35/var/www/gnli.com/public_html/app/modules/Category/Init.php
36/var/www/gnli.com/public_html/app/modules/Category/Helper/Data.php
37/var/www/gnli.com/public_html/app/modules/Sitemap/Routes.php
38/var/www/gnli.com/public_html/app/modules/Newsletter/Routes.php
39/var/www/gnli.com/public_html/app/modules/Newsletter/Init.php
40/var/www/gnli.com/public_html/app/modules/Search/Routes.php
41/var/www/gnli.com/public_html/app/modules/Application/Utils/ModuleName.php
42/var/www/gnli.com/public_html/app/modules/Publication/Module.php
43/var/www/gnli.com/public_html/app/plugins/CheckPoint.php
44/var/www/gnli.com/public_html/app/plugins/Acl.php
45/var/www/gnli.com/public_html/app/modules/Application/Acl/DefaultAcl.php
46/var/www/gnli.com/public_html/app/config/acl/guest.php
47/var/www/gnli.com/public_html/app/config/acl/member.php
48/var/www/gnli.com/public_html/app/config/acl/reporter.php
49/var/www/gnli.com/public_html/app/config/acl/editor.php
50/var/www/gnli.com/public_html/app/config/acl/admin.php
51/var/www/gnli.com/public_html/app/config/acl/developer.php
52/var/www/gnli.com/public_html/app/plugins/MobileDetect.php
53/var/www/gnli.com/public_html/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php
54/var/www/gnli.com/public_html/app/modules/Publication/Controller/IndexController.php
55/var/www/gnli.com/public_html/app/modules/Application/Mvc/Controller.php
56/var/www/gnli.com/public_html/app/modules/Publication/Model/Publication.php
57/var/www/gnli.com/public_html/app/modules/Publication/Model/Meta/PublicationMeta.php
58/var/www/gnli.com/public_html/app/modules/Application/Mvc/Model/Meta.php
59/var/www/gnli.com/public_html/app/modules/Publication/Model/ManyToMany/Categories.php
60/var/www/gnli.com/public_html/app/modules/Application/Mvc/Model/ManyToMany.php
61/var/www/gnli.com/public_html/app/modules/Application/Mvc/Helper/Title.php
62/var/www/gnli.com/public_html/app/modules/Application/Mvc/Helper/Meta.php
63/var/www/gnli.com/public_html/app/modules/Seo/Plugin/SeoManager.php
64/var/www/gnli.com/public_html/app/modules/Seo/Model/Manager.php
65/var/www/gnli.com/public_html/app/plugins/Title.php
66/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%modules%%publication%%views%%index%%publication.volt.php
67/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%top.volt.php
68/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%left%%top.volt.php
69/var/www/gnli.com/public_html/app/modules/Publication/Model/Category.php
70/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%div-gpt-ad-middle1.volt.php
71/var/www/gnli.com/public_html/app/modules/Publication/Widget/PublicationWidget.php
72/var/www/gnli.com/public_html/app/modules/Application/Widget/AbstractWidget.php
73/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%right%%video.volt.php
74/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%right%%top.volt.php
75/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%layouts%%main.volt.php
76/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%main%%header.volt.php
77/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%main%%footer.volt.php
78/var/www/gnli.com/public_html/app/modules/Cms/Model/Javascript.php
79/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%main.volt.php
80/var/www/gnli.com/public_html/app/modules/Application/Mvc/Helper/Announce.php
81/var/www/gnli.com/public_html/data/cache/volt/%%var%%www%%gnli.com%%public_html%%app%%views%%partials%%ads%%d%%publication%%head.volt.php
Memory
Usage2097152