本文整理汇总了PHP中isEmptyString函数的典型用法代码示例。如果您正苦于以下问题:PHP isEmptyString函数的具体用法?PHP isEmptyString怎么用?PHP isEmptyString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isEmptyString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($config = array())
{
parent::__construct($config = array());
// add the path to the scripts
$this->setScriptPath(APPLICATION_PATH . "/views/scripts/email/");
$this->appname = getAppName();
$config = Zend_Registry::get("config");
// default sign off name and email
$mail = Zend_Registry::get('mail');
$default_sender = $mail->getDefaultFrom();
//$this->signoffname = $default_sender['name'];
//$this->signoffemail = $default_sender['email'];
$this->signoffname = getDefaultAdminName();
$this->signoffemail = getDefaultAdminEmail();
$this->contactusurl = $this->serverUrl($this->baseUrl('contactus'));
$this->logourl = $this->serverUrl($this->baseUrl('images/logo.jpg'));
$this->loginurl = $this->serverUrl($this->baseUrl('user/login'));
$this->baseurl = $this->serverUrl($this->baseUrl());
$this->settingsurl = $this->serverUrl($this->baseUrl('profile/view/tab/account'));
$allcolors = getAllThemeColors();
//debugMessage($allcolors);
$colortxt = getThemeColor();
$themecolor = "blue";
if (!isEmptyString($colortxt)) {
$themecolor = $colortxt;
}
$this->themecolor = $allcolors[$themecolor];
// debugMessage('color is '.$allcolors[$themecolor]);
}
示例2: excelAction
function excelAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
// debugMessage($formvalues);
$title = $this->_getParam('reporttitle');
// debugMessage($formvalues);
$cvsdata = decode($formvalues['csv_text']);
if (!isEmptyString($title)) {
$cvsdata = str_replace('"--"', '""', $cvsdata);
$title = str_replace(', ', ' ', $title);
$cvsdata = $title . "\r\n" . $cvsdata;
}
// debugMessage($cvsdata); exit();
$currenttime = time();
$filename = $currenttime . '.csv';
/*$full_path = BASE_PATH.DIRECTORY_SEPARATOR."temp".DIRECTORY_SEPARATOR.$filename;
file_put_contents($full_path, $cvsdata);*/
$data = stripcslashes($cvsdata);
// debugMessage($data);
// exit();
//OUPUT HEADERS
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$filename}\";");
header("Content-Transfer-Encoding: binary");
//OUTPUT CSV CONTENT
echo $data;
exit;
}
示例3: getActionforACL
/**
* Get the name of the action being accessed
*
* @return String
*/
function getActionforACL()
{
$action = strtolower($this->getRequest()->getActionName());
if ($action == ACTION_INDEX && isEmptyString($this->_getParam('id'))) {
return ACTION_CREATE;
}
if ($action == ACTION_INDEX && !isEmptyString($this->_getParam('id'))) {
return ACTION_EDIT;
}
if ($action == "new") {
return ACTION_CREATE;
}
if ($action == "returntolist") {
return ACTION_LIST;
}
if ($action == "overview") {
return ACTION_LIST;
}
if ($action == "selectchain") {
return ACTION_LIST;
}
if ($action == "listsearch") {
return ACTION_LIST;
}
if ($action == "reject") {
return ACTION_APPROVE;
}
if ($action == "export") {
return ACTION_EXPORT;
}
return $action;
}
示例4: getAllParentResources
/**
* Return an array containing the ids and names of all parent resources for this resource
*
* @return Array an array of all parent resources, the key is the id of the resource while the value is the name of the resource
*/
function getAllParentResources()
{
$parentquery = "SELECT r.name AS optiontext, r.id AS optionvalue FROM aclresource AS r ORDER BY optiontext";
if (!isEmptyString($this->getID())) {
$parentquery .= " AND id <> '" . $this->getID() . "'";
}
return getOptionValuesFromDatabaseQuery($parentquery);
}
示例5: getOptionValuesFromQuery
/**
* Return the values of the options for the lookup type
*
* @return Array containing the lookup types for the values or false if an error occurs
*
*/
function getOptionValuesFromQuery()
{
# get the query to execute
$conn = Doctrine_Manager::connection();
$query = $conn->fetchRow("SELECT querystring FROM lookupquery WHERE name = '" . $this->getName() . "'");
# debugMessage($query);
if (isEmptyString($query['querystring'])) {
return array();
} else {
return getOptionValuesFromDatabaseQuery($query['querystring']);
}
}
示例6: existingPayroll
function existingPayroll()
{
$conn = Doctrine_Manager::connection();
# validate unique username and email
$id_check = "";
if (!isEmptyString($this->getID())) {
$id_check = " AND id <> '" . $this->getID() . "' ";
}
$companyid = getCompanyID();
$query = "SELECT id FROM payroll p WHERE p.companyid = '" . $companyid . "' AND TO_DAYS(p.startdate) = TO_DAYS('" . $this->getStartDate() . "') AND TO_DAYS(p.enddate) = TO_DAYS('" . $this->getEndDate() . "') AND p.type = '" . $this->getType() . "' " . $id_check;
// debugMessage($query);
$result = $conn->fetchOne($query);
return $result;
}
示例7: connect
public function connect()
{
try {
if (isEmptyString($this->config['username']) || isEmptyString($this->config['password'])) {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']));
} else {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']), array('username' => $this->config['username'], 'password' => $this->config['password'], 'db' => $this->config['db']));
}
} catch (Exception $e) {
$this->collection = null;
$this->connection = null;
Logger::ERROR('Connect mongodb error [' . $e->getMessage() . ']', __FILE__, __LINE__, ERROR_LOG_FILE);
}
}
示例8: connect
/**
* 连接数据库
*/
public function connect()
{
try {
if (isEmptyString($this->config['username']) || isEmptyString($this->config['password'])) {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']));
} else {
$this->connection = new MongoClient(sprintf('mongodb://%s:%d', $this->config['host'], $this->config['port']), array('username' => $this->config['username'], 'password' => $this->config['password'], 'db' => $this->config['db']));
}
$this->connection->setReadPreference(MongoClient::RP_SECONDARY_PREFERRED, array());
} catch (Exception $e) {
$this->collection = null;
$this->connection = null;
Logger::write($e->__toString(), ERR);
}
}
示例9: __construct
public function __construct($auserid = "")
{
// do not proceed if no user is defined
if (isEmptyString($auserid)) {
return;
}
$conn = Doctrine_Manager::connection();
// initialize the array of available groups
$this->availableGroups = array();
// the available actions
// get the groups from the database for the specified user
$groups = $conn->fetchAll("SELECT groupid FROM aclusergroup WHERE userid = '" . $auserid . "'");
// get the resources from the database
$resources = $conn->fetchAll("SELECT id FROM aclresource");
// get the permissions for the specified user
// TODO: HM - Remove the need for the c_aclpermission view
$permissions = $conn->fetchAll("SELECT `p`.`groupid` AS `groupid`, LOWER(`re`.`name`) AS `resource`, `p`.`create` AS `create`, `p`.`edit` AS `edit`, `p`.`export` AS `export`,`p`.`approve` AS `approve`, `p`.`view` AS `view`, `p`.`delete` AS `delete`, `p`.`list` AS `list`, p.flag as `flag` FROM ((`aclpermission` `p` JOIN `aclresource` `re`) LEFT JOIN `aclusergroup` `ur` ON ((`p`.`groupid` = `ur`.`groupid`))) WHERE ((`p`.`resourceid` = `re`.`id`) AND ur.userid = '" . $auserid . "')");
// add the groups to the ACL
foreach ($groups as $value) {
$group = new AclGroup();
// load the details of the user group
$group->populate($value['groupid']);
$this->addRole($group);
// add the group to the array of available groups
$this->availableGroups[] = $group;
}
// add the resources to the ACL, the name of the resource and its parent are what are used as identifiers for the resource in the ACL
foreach ($resources as $value) {
$ares = new AclResource();
$ares->populate($value['id']);
$this->add($ares);
}
// process the permissions for all the actions
$allactions = self::getActions();
// add the permissions to the ACL
foreach ($permissions as $value) {
foreach ($allactions as $theaction) {
if ($value[$theaction] == '1') {
// the name of the resource is used as a key while the id of the group is used as a key
$this->allow($value['groupid'], $value['resource'], $theaction);
}
}
}
}
示例10: valueExists
function valueExists($value = '')
{
$conn = Doctrine_Manager::connection();
$id_check = "";
if (!isEmptyString($this->getID())) {
$id_check = " AND id <> '" . $this->getID() . "' ";
}
if (isEmptyString($value)) {
$value = $this->getlookupvaluedescription();
}
# unique value
$value_query = "SELECT id FROM lookuptypevalue WHERE lookupvaluedescription = '" . $value . "' AND lookuptypeid = '" . $this->getLookupTypeID() . "' AND alias = '" . $this->getAlias() . "' " . $id_check;
// debugMessage($value_query);
$value_result = $conn->fetchOne($value_query);
// debugMessage($value_result);
if (isEmptyString($value_result)) {
return false;
}
return true;
}
示例11: nameExists
function nameExists($name = '')
{
$conn = Doctrine_Manager::connection();
# validate unique username and email
$id_check = "";
if (!isEmptyString($this->getID())) {
$id_check = " AND id <> '" . $this->getID() . "' ";
}
if (isEmptyString($name)) {
$name = $this->getName();
}
$query = "SELECT id FROM benefittype WHERE name = '" . $name . "' AND name <> '' " . $id_check;
// debugMessage($query);
$result = $conn->fetchOne($query);
// debugMessage($result);
if (isEmptyString($result)) {
return false;
}
return true;
}
示例12: getUrl
/**
* Return a URL based on whether there were errors while processing the relevant action.
*
* The url forwarded to can be overridden by specifying the sucessurl and failure url properties
*
* @return String the url to which to forward based on whether or not the action was successful.
*/
function getUrl()
{
if ($this->hasError()) {
if (isEmptyString($this->getFailureURL())) {
return "../" . $this->getModuleName() . "/create" . $this->getEntityName() . ".php?id=" . $this->getID() . "&action=" . $this->getAction() . "&modifier=" . $this->getModifier();
} else {
return $this->getFailureURL();
}
} else {
if (isEmptyString($this->getSuccessURL())) {
return "../" . $this->getModuleName() . "/view" . $this->getEntityName() . ".php?id=" . $this->getID() . "&modifier=" . $this->getModifier();
} else {
// check if the success url contains a query string
$separator = "&";
if (strpos($this->getSuccessURL(), "?") === false) {
// do nothing
$separator = "?";
}
return $this->getSuccessURL() . $separator . "id=" . $this->getID();
}
}
}
示例13: processchangepasswordAction
function processchangepasswordAction()
{
$session = SessionWrapper::getInstance();
$this->_translate = Zend_Registry::get("translate");
if (!isEmptyString($this->_getParam('password'))) {
$user = new UserAccount();
$user->populate(decode($this->_getParam('id')));
// debugMessage($user->toArray());
#validate that the passwords aint the same
if ($this->_getParam('oldpassword') == $this->_getParam('password')) {
$session->setVar(SUCCESS_MESSAGE, "New Password should be the same as the current passowrd!");
$this->_redirect($this->view->baseUrl('profile/view/id/' . encode($user->getID()) . '/tab/account'));
}
# Change password
try {
$user->changePassword($this->_getParam('password'));
$session->setVar(SUCCESS_MESSAGE, "Password successfully updated");
$this->_redirect($this->view->baseUrl('index/profileupdatesuccess'));
} catch (Exception $e) {
$session->setVar(ERROR_MESSAGE, "Error in changing Password. " . $e->getMessage());
}
}
}
示例14: setWorksheetTitle
/**
* Set the worksheet title
*
* Checks the string for not allowed characters (:\/?*),
* cuts it to maximum 31 characters and set the title. Damn
* why are not-allowed chars nowhere to be found? Windows
* help's no help...
*
* @access public
* @param string $title Designed title
*/
public function setWorksheetTitle($title)
{
if (isEmptyString($title)) {
$title = "Sheet 1";
}
// strip out special chars first
$title = preg_replace("/[\\\\|:|\\/|\\?|\\*|\\[|\\]]/", "", $title);
// now cut it to the allowed length
$title = substr($title, 0, 31);
// set title
$this->worksheet_title = $title;
}
示例15: hasError
/**
* Whether or not the object has an error
*
* @return boolean true if the object has an error, otherwise false
*/
function hasError()
{
return !isEmptyString($this->getErrorStackAsString());
}