本文整理汇总了PHP中Util::array2str方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::array2str方法的具体用法?PHP Util::array2str怎么用?PHP Util::array2str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::array2str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
{
if ($attachments != NULL) {
throw new ServiceException("INVALID_CONFIGURATION", "Default mailer does not support sending attachments");
}
if (Logging::isDebug()) {
Logging::logDebug("Sending mail to [" . Util::array2str($to) . "]: [" . $message . "]");
}
if (!$this->enabled) {
return;
}
$isHtml = stripos($message, "<html>") !== FALSE;
$f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
$validRecipients = $this->getValidRecipients($to);
if (count($validRecipients) === 0) {
Logging::logDebug("No valid recipient email addresses, no mail sent");
return;
}
$toAddress = '';
$headers = $isHtml ? 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" : 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n";
$headers .= 'From:' . $f;
if (count($validRecipients) == 1) {
$toAddress = $this->getRecipientString($validRecipients[0]);
} else {
$headers .= PHP_EOL . $this->getBccHeaders($validRecipients);
}
mail($toAddress, $subject, $isHtml ? $message : str_replace("\n", "\r\n", wordwrap($message)), $headers);
}
示例2: processPost
public function processPost()
{
$data = $this->request->data;
if (!isset($data['to']) or !isset($data['title']) or !isset($data['msg']) or !isset($data['items'])) {
throw $this->invalidRequestException("Data missing");
}
$to = $data['to'];
$message = $data['msg'];
$title = $data['title'];
$items = $this->items($data['items']);
if (count($items) == 0) {
throw $this->invalidRequestException("Items missing");
}
if (Logging::isDebug()) {
Logging::logDebug("SENDVIAEMAIL: Sending mail " . $to . ":" . Util::array2str($items));
}
$attachments = array();
foreach ($items as $i) {
$attachments[] = $i->internalPath();
}
//TODO stream
if ($this->env->mailer()->send(array($to), $title, $message, NULL, $attachments)) {
$this->response()->success(array());
} else {
$this->response()->error("REQUEST_FAILED", NULL);
}
}
示例3: send
public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
{
if (!$this->enabled) {
return;
}
$isHtml = stripos($message, "<html>") !== FALSE;
$f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
$validRecipients = $this->getValidRecipients($to);
if (count($validRecipients) === 0) {
Logging::logDebug("No valid recipient email addresses, no mail sent");
return;
}
if (Logging::isDebug()) {
Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
}
set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
require 'class.phpmailer.php';
$mailer = new PHPMailer();
$smtp = $this->env->settings()->setting("mail_smtp");
if ($smtp != NULL and isset($smtp["host"])) {
$mailer->isSMTP();
$mailer->Host = $smtp["host"];
if (isset($smtp["username"]) and isset($smtp["password"])) {
$mailer->SMTPAuth = true;
$mailer->Username = $smtp["username"];
$mailer->Password = $smtp["password"];
}
if (isset($smtp["secure"])) {
$mailer->SMTPSecure = $smtp["secure"];
}
}
$mailer->From = $f;
foreach ($validRecipients as $recipient) {
$mailer->addBCC($recipient["email"], $recipient["name"]);
}
if (!$isHtml) {
$mailer->WordWrap = 50;
} else {
$mailer->isHTML(true);
}
if ($attachments != NULL) {
//TODO use stream
foreach ($attachments as $attachment) {
$mailer->addAttachment($attachment);
}
}
$mailer->Subject = $subject;
$mailer->Body = $message;
try {
if (!$mailer->send()) {
Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
return FALSE;
}
return TRUE;
} catch (Exception $e) {
Logging::logError('Message could not be sent: ' . $e);
return FALSE;
}
}
示例4: globalExceptionHandler
function globalExceptionHandler($e)
{
global $responseHandler;
Logging::logException($e);
Logging::logDebug(Util::array2str(debug_backtrace()));
if ($responseHandler == NULL) {
$responseHandler = new ResponseHandler(new OutputHandler());
}
$responseHandler->unknownServerError($e->getMessage());
die;
}
示例5: log
function log()
{
if (!Logging::isDebug()) {
return;
}
$logged = array_merge(array(), $this->settings);
// remove db password
if (Util::isArrayKey($logged, "db") and is_array($logged["db"])) {
if (Util::isArrayKey($logged["db"], "pw")) {
$logged["db"]["pw"] = "";
}
if (Util::isArrayKey($logged["db"], "password")) {
$logged["db"]["password"] = "";
}
}
Logging::logDebug("SETTINGS: " . Util::array2str($logged));
}
示例6: updateIds
private function updateIds($tables, $ids, $db)
{
if (strcmp("mysql", $db->type()) === 0) {
mysqli_report(MYSQLI_REPORT_OFF);
}
Logging::logDebug("Converting " . count($ids) . " ids in " . Util::array2str($tables));
foreach ($ids as $old => $new) {
$db->update(sprintf("INSERT INTO " . $db->table("item_id") . " (id, path) VALUES (%s,%s)", $db->string($new, TRUE), $db->string($old, TRUE)));
}
foreach ($tables as $t) {
foreach ($ids as $old => $new) {
$db->update(sprintf("update " . $db->table($t) . " set item_id=%s where item_id=%s", $db->string($new, TRUE), $db->string($old, TRUE)));
}
}
if (strcmp("mysql", $db->type()) === 0) {
mysqli_report(MYSQLI_REPORT_ALL);
}
}
示例7: log
public function log()
{
Logging::logDebug("SESSION: is_active=" . $this->isActive() . ", user=" . Util::array2str($this->user) . ", data=" . Util::array2str($this->data));
}
示例8: rollback
public function rollback()
{
if (!$this->db->rollBack()) {
throw new ServiceException("INVALID_CONFIGURATION", "Error rollbacking transaction: " . Util::array2str($this->db->errorInfo()));
}
$this->transaction = FALSE;
}
示例9: log
public function log()
{
Logging::logDebug("REQUEST: method=" . $this->method . ", path=" . Util::array2str($this->parts) . ", ip=" . $this->ip . ", params=" . Util::array2str($this->params) . ", data=" . Util::toString($this->data));
}
示例10: log
public function log()
{
Logging::logDebug("FILESYSTEM: allowed_file_upload_types=" . Util::array2str($this->allowedUploadTypes));
}
示例11: getOpts
function getOpts($args)
{
array_shift($args);
$endofoptions = false;
$ret = array('commands' => array(), 'options' => array(), 'flags' => array(), 'arguments' => array());
while ($arg = array_shift($args)) {
// if we have reached end of options,
//we cast all remaining argvs as arguments
if ($endofoptions) {
$ret['arguments'][] = $arg;
continue;
}
// Is it a command? (prefixed with --)
if (substr($arg, 0, 2) === '--') {
// is it the end of options flag?
if (!isset($arg[3])) {
$endofoptions = true;
// end of options;
continue;
}
$value = "";
$com = substr($arg, 2);
// is it the syntax '--option=argument'?
if (strpos($com, '=')) {
list($com, $value) = explode("=", $com, 2);
} elseif (strpos($args[0], '-') !== 0) {
while (strpos($args[0], '-') !== 0) {
$value .= array_shift($args) . ' ';
}
$value = rtrim($value, ' ');
}
$ret['options'][$com] = !empty($value) ? $value : true;
continue;
}
// Is it a flag or a serial of flags? (prefixed with -)
if (substr($arg, 0, 1) === '-') {
for ($i = 1; isset($arg[$i]); $i++) {
$ret['flags'][] = $arg[$i];
}
continue;
}
// finally, it is not option, nor flag, nor argument
$ret['commands'][] = $arg;
continue;
}
/*if (!count($ret['options']) && !count($ret['flags'])) {
$ret['arguments'] = array_merge($ret['commands'], $ret['arguments']);
$ret['commands'] = array();
}*/
Logging::logDebug("=>" . Util::array2str($ret));
return $ret;
}
示例12: exec
public function exec()
{
Logging::logDebug("WebDAV request: " . Util::array2str($this->httpRequest->getHeaders()));
parent::exec();
}
示例13: Footer
function Footer()
{
if (!$this->isInFooter()) {
return;
}
$y = 0 - $this->opt["height"];
if (Logging::isDebug()) {
Logging::logDebug("Footer " . Util::array2str(array("x" => $this->xd, "y" => $y, "w" => $this->wd, "align" => $this->align, "opt" => $this->opt)));
}
$this->setTextProperties();
$this->setXY($this->xd, $y);
$this->Cell($this->wd, $this->opt["height"], $this->opt["text"], 0, 0, $this->align == "X" ? "L" : $this->align);
}
示例14: toStr
private static function toStr($o)
{
if (is_array($o)) {
return Util::array2str($o);
}
return (string) $o;
}
示例15: addUserProperties
private function addUserProperties($id, $registration, $plugin)
{
$name = $registration["name"];
$groups = $plugin->getSetting("groups", array());
if (count($groups) > 0) {
$existing = array();
foreach ($this->env->configuration()->getAllUserGroups() as $group) {
if (in_array($group['id'], $groups)) {
$existing[] = $group['id'];
}
}
if (count($existing) > 0) {
$this->env->configuration()->addUsersGroups($id, $existing);
}
}
$permissions = $plugin->getSetting("permissions", NULL);
// add user default/generic permissions
if ($permissions != NULL) {
if (!is_array($permissions)) {
$permissions = array("filesystem_item_access" => $permissions);
}
Logging::logDebug("Setting user permissions: " . Util::array2str($permissions));
foreach ($permissions as $pk => $pv) {
//TODO validate permission key (pv) and value (pv)
$this->env->permissions()->addGenericPermission($pk, $id, $pv);
}
}
$folders = $plugin->getSetting("folders", array());
$folderIds = array();
$folderProps = array();
if (Util::isAssocArray($folders)) {
$folderIds = array_keys($folders);
$folderProps = $folders;
} else {
$folderIds = $folders;
}
if (count($folderIds) > 0) {
$existing = array();
foreach ($this->env->configuration()->getFolders() as $folder) {
if (in_array($folder['id'], $folderIds)) {
$existing[] = $folder['id'];
}
}
if (count($existing) > 0) {
//$this->env->configuration()->addUserFolders($id, $existing);
foreach ($existing as $f) {
$fname = NULL;
$fp = array_key_exists($f, $folderProps) ? $folderProps[$f] : array();
if (array_key_exists("name", $fp)) {
$fname = $fp["name"];
}
Logging::logDebug("Assigning user folder: " . $f . " (" . $fname . ")");
$this->env->configuration()->addUserFolder($id, $f, $fname);
// add folder permissions
if (array_key_exists("permissions", $fp)) {
$fs = $this->env->filesystem()->filesystem($this->env->configuration()->getFolder($f));
$permissions = $fp["permissions"];
if (!is_array($permissions)) {
$permissions = array("filesystem_item_access" => $permissions);
}
Logging::logDebug("Setting folder " . $f . " permissions: " . Util::array2str($permissions));
foreach ($permissions as $pk => $pv) {
//TODO validate permission key (pv) and value (pv)
$this->env->permissions()->addFilesystemPermission($fs->root(), $pk, $id, $pv);
}
}
}
}
}
$userFolder = $plugin->getSetting("user_folder", NULL);
if ($userFolder == NULL) {
return;
}
// automatic user folder
if (!isset($userFolder["path"])) {
Logging::logError("Registration: missing configuration for user folder");
return;
}
$basePath = $userFolder["path"];
$folderName = $name;
if (isset($userFolder["folder_name"])) {
$folderName = $userFolder["folder_name"];
}
$folderPath = rtrim($basePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
$type = "local";
$uf = array("type" => $type, "path" => $folderPath, "name" => $folderName);
Logging::logDebug("Creating user folder " . Util::array2str($uf));
$fs = $this->env->filesystem()->filesystem($uf, FALSE);
if ($fs->exists()) {
Logging::logError("Registration: user folder [" . $folderPath . "] already exists, not added");
return;
}
if (!$fs->create()) {
Logging::logError("Registration: user folder [" . $folderPath . "] could not be created, not added");
return;
}
$uf["id"] = $this->env->configuration()->addFolder($name, $folderPath);
$this->env->configuration()->addUserFolder($id, $uf["id"], $uf["name"]);
$fs = $this->env->filesystem()->filesystem($uf, FALSE);
$fsroot = $fs->root();
//.........这里部分代码省略.........