Environment::get PHP Method

get() public static method

public static get ( )
    public static function get()
    {
        // if APPLICATION_ENV constant exists (set in Apache configs)
        // then return content of APPLICATION_ENV
        // else return "development"
        return getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : "development";
    }

Usage Example

 /**
  * Send a lost password e-mail
  * @param object
  */
 protected function sendPasswordLink($objMember)
 {
     $objNotification = \NotificationCenter\Model\Notification::findByPk($this->nc_notification);
     if ($objNotification === null) {
         $this->log('The notification was not found ID ' . $this->nc_notification, __METHOD__, TL_ERROR);
         return;
     }
     $confirmationId = md5(uniqid(mt_rand(), true));
     // Store the confirmation ID
     $objMember = \MemberModel::findByPk($objMember->id);
     $objMember->activation = $confirmationId;
     $objMember->save();
     $arrTokens = array();
     // Add member tokens
     foreach ($objMember->row() as $k => $v) {
         $arrTokens['member_' . $k] = $v;
     }
     $arrTokens['recipient_email'] = $objMember->email;
     $arrTokens['domain'] = \Idna::decode(\Environment::get('host'));
     $arrTokens['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . ($GLOBALS['TL_CONFIG']['disableAlias'] || strpos(\Environment::get('request'), '?') !== false ? '&' : '?') . 'token=' . $confirmationId;
     $objNotification->send($arrTokens);
     $this->log('A new password has been requested for user ID ' . $objMember->id . ' (' . $objMember->email . ')', __METHOD__, TL_ACCESS);
     // Check whether there is a jumpTo page
     if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null) {
         $this->jumpToOrReload($objJumpTo->row());
     }
     $this->reload();
 }
All Usage Examples Of Environment::get
Environment