當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StringHelper::isNullOrEmpty方法代碼示例

本文整理匯總了PHP中StringHelper::isNullOrEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringHelper::isNullOrEmpty方法的具體用法?PHP StringHelper::isNullOrEmpty怎麽用?PHP StringHelper::isNullOrEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在StringHelper的用法示例。


在下文中一共展示了StringHelper::isNullOrEmpty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: afterFind

 protected function afterFind()
 {
     if (StringHelper::isNullOrEmpty($this->icon_src)) {
         $this->icon_src = Group::DEFAULT_IMG_PATH;
     }
     return parent::afterFind();
 }
開發者ID:kittolau,項目名稱:gcm,代碼行數:7,代碼來源:Group.php

示例2: _validateDbConfigFile

 /**
  * Make sure the basics are in place in the db connection file before we actually try to connect later on.
  *
  * @throws DbConnectException
  */
 private function _validateDbConfigFile()
 {
     $messages = array();
     $databaseServerName = craft()->config->getDbItem('server');
     $databaseAuthName = craft()->config->getDbItem('user');
     $databaseName = craft()->config->getDbItem('database');
     $databasePort = craft()->config->getDbItem('port');
     $databaseCharset = craft()->config->getDbItem('charset');
     $databaseCollation = craft()->config->getDbItem('collation');
     if (StringHelper::isNullOrEmpty($databaseServerName)) {
         $messages[] = Craft::t('The database server name isn’t set in your db config file.');
     }
     if (StringHelper::isNullOrEmpty($databaseAuthName)) {
         $messages[] = Craft::t('The database user name isn’t set in your db config file.');
     }
     if (StringHelper::isNullOrEmpty($databaseName)) {
         $messages[] = Craft::t('The database name isn’t set in your db config file.');
     }
     if (StringHelper::isNullOrEmpty($databasePort)) {
         $messages[] = Craft::t('The database port isn’t set in your db config file.');
     }
     if (StringHelper::isNullOrEmpty($databaseCharset)) {
         $messages[] = Craft::t('The database charset isn’t set in your db config file.');
     }
     if (StringHelper::isNullOrEmpty($databaseCollation)) {
         $messages[] = Craft::t('The database collation isn’t set in your db config file.');
     }
     if (!empty($messages)) {
         throw new DbConnectException(Craft::t('Database configuration errors: {errors}', array('errors' => implode(PHP_EOL, $messages))));
     }
     $this->_isDbConfigValid = true;
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:37,代碼來源:WebApp.php

示例3: _setSmtpSettings

 /**
  * Sets SMTP settings on a given email.
  *
  * @param $email
  * @param $emailSettings
  *
  * @throws Exception
  * @return null
  */
 private function _setSmtpSettings(&$email, $emailSettings)
 {
     $email->isSMTP();
     if (isset($emailSettings['smtpAuth']) && $emailSettings['smtpAuth'] == 1) {
         $email->SMTPAuth = true;
         if (!isset($emailSettings['username']) && StringHelper::isNullOrEmpty($emailSettings['username']) || !isset($emailSettings['password']) && StringHelper::isNullOrEmpty($emailSettings['password'])) {
             throw new Exception(Craft::t('Username and password are required.  Check your email settings.'));
         }
         $email->Username = $emailSettings['username'];
         $email->Password = $emailSettings['password'];
     }
     if (isset($emailSettings['smtpKeepAlive']) && $emailSettings['smtpKeepAlive'] == 1) {
         $email->SMTPKeepAlive = true;
     }
     $email->SMTPSecure = $emailSettings['smtpSecureTransportType'] != 'none' ? $emailSettings['smtpSecureTransportType'] : null;
     if (!isset($emailSettings['host'])) {
         throw new Exception(Craft::t('You must specify a host name in your email settings.'));
     }
     if (!isset($emailSettings['port'])) {
         throw new Exception(Craft::t('You must specify a port in your email settings.'));
     }
     if (!isset($emailSettings['timeout'])) {
         $emailSettings['timeout'] = $this->_defaultEmailTimeout;
     }
     $email->Host = $emailSettings['host'];
     $email->Port = $emailSettings['port'];
     $email->Timeout = $emailSettings['timeout'];
 }
開發者ID:codeforamerica,項目名稱:oakland-beta,代碼行數:37,代碼來源:EmailService.php


注:本文中的StringHelper::isNullOrEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。