Frontend\Modules\Profiles\Engine\Model::parse PHP Method

parse() public static method

Parse the general profiles info into the template.
public static parse ( )
    public static function parse()
    {
        // get the template
        $tpl = FrontendModel::getContainer()->get('templating');
        // logged in
        if (FrontendProfilesAuthentication::isLoggedIn()) {
            // get profile
            $profile = FrontendProfilesAuthentication::getProfile();
            // display name set?
            if ($profile->getDisplayName() != '') {
                $tpl->assign('profileDisplayName', $profile->getDisplayName());
            } else {
                // no display name -> use email
                $tpl->assign('profileDisplayName', $profile->getEmail());
            }
            // show logged in
            $tpl->assign('isLoggedIn', true);
        }
        // ignore these urls in the query string
        $ignoreUrls = array(FrontendNavigation::getURLForBlock('Profiles', 'Login'), FrontendNavigation::getURLForBlock('Profiles', 'Register'), FrontendNavigation::getURLForBlock('Profiles', 'ForgotPassword'));
        // query string
        $queryString = isset($_GET['queryString']) ? SITE_URL . '/' . urldecode($_GET['queryString']) : SELF;
        // check all ignore urls
        foreach ($ignoreUrls as $url) {
            // query string contains a boeboe url
            if (mb_stripos($queryString, $url) !== false) {
                $queryString = '';
                break;
            }
        }
        // no need to add this if its empty
        $queryString = $queryString != '' ? '?queryString=' . rawurlencode($queryString) : '';
        // useful urls
        $tpl->assign('loginUrl', FrontendNavigation::getURLForBlock('Profiles', 'Login') . $queryString);
        $tpl->assign('registerUrl', FrontendNavigation::getURLForBlock('Profiles', 'Register'));
        $tpl->assign('forgotPasswordUrl', FrontendNavigation::getURLForBlock('Profiles', 'ForgotPassword'));
    }