updated core
This commit is contained in:
@@ -23,6 +23,19 @@ use Drupal\Component\Utility\ToStringTrait;
|
||||
* errors are. This is less disruptive than allowing datetime exceptions
|
||||
* to abort processing. The calling script can decide what to do about
|
||||
* errors using hasErrors() and getErrors().
|
||||
*
|
||||
* @method $this add(\DateInterval $interval)
|
||||
* @method static array getLastErrors()
|
||||
* @method $this modify(string $modify)
|
||||
* @method $this setDate(int $year, int $month, int $day)
|
||||
* @method $this setISODate(int $year, int $week, int $day = 1)
|
||||
* @method $this setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0)
|
||||
* @method $this setTimestamp(int $unixtimestamp)
|
||||
* @method $this setTimezone(\DateTimeZone $timezone)
|
||||
* @method $this sub(\DateInterval $interval)
|
||||
* @method int getOffset()
|
||||
* @method int getTimestamp()
|
||||
* @method \DateTimeZone getTimezone()
|
||||
*/
|
||||
class DateTimePlus {
|
||||
|
||||
@@ -53,31 +66,43 @@ class DateTimePlus {
|
||||
|
||||
/**
|
||||
* The value of the time value passed to the constructor.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputTimeRaw = '';
|
||||
|
||||
/**
|
||||
* The prepared time, without timezone, for this date.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputTimeAdjusted = '';
|
||||
|
||||
/**
|
||||
* The value of the timezone passed to the constructor.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputTimeZoneRaw = '';
|
||||
|
||||
/**
|
||||
* The prepared timezone object used to construct this date.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputTimeZoneAdjusted = '';
|
||||
|
||||
/**
|
||||
* The value of the format passed to the constructor.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputFormatRaw = '';
|
||||
|
||||
/**
|
||||
* The prepared format, if provided.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $inputFormatAdjusted = '';
|
||||
|
||||
|
||||
@@ -586,8 +586,7 @@ class Container implements ContainerInterface, ResettableContainerInterface {
|
||||
/**
|
||||
* Ensure that cloning doesn't work.
|
||||
*/
|
||||
private function __clone()
|
||||
{
|
||||
private function __clone() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class PoItem {
|
||||
/**
|
||||
* The language code this translation is in.
|
||||
*
|
||||
* @car string
|
||||
* @var string
|
||||
*/
|
||||
private $_langcode;
|
||||
|
||||
@@ -27,7 +27,8 @@ class PoItem {
|
||||
/**
|
||||
* The source string or array of strings if it has plurals.
|
||||
*
|
||||
* @var string or array
|
||||
* @var string|array
|
||||
*
|
||||
* @see $_plural
|
||||
*/
|
||||
private $_source;
|
||||
@@ -49,7 +50,7 @@ class PoItem {
|
||||
/**
|
||||
* The translation string or array of strings if it has plurals.
|
||||
*
|
||||
* @var string or array
|
||||
* @var string|array
|
||||
* @see $_plural
|
||||
*/
|
||||
private $_translation;
|
||||
|
||||
@@ -138,34 +138,42 @@ EOF;
|
||||
* The directory path.
|
||||
* @param int $mode
|
||||
* The mode, permissions, the directory should have.
|
||||
* @param bool $is_backwards_recursive
|
||||
* Internal use only.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the directory exists or has been created, FALSE otherwise.
|
||||
*/
|
||||
protected function createDirectory($directory, $mode = 0777, $is_backwards_recursive = FALSE) {
|
||||
protected function createDirectory($directory, $mode = 0777) {
|
||||
// If the directory exists already, there's nothing to do.
|
||||
if (is_dir($directory)) {
|
||||
return TRUE;
|
||||
}
|
||||
// Otherwise, try to create the directory and ensure to set its permissions,
|
||||
// because mkdir() obeys the umask of the current process.
|
||||
if (is_dir($parent = dirname($directory))) {
|
||||
// If the parent directory exists, then the backwards recursion must end,
|
||||
// regardless of whether the subdirectory could be created.
|
||||
if ($status = mkdir($directory)) {
|
||||
// Only try to chmod() if the subdirectory could be created.
|
||||
$status = chmod($directory, $mode);
|
||||
}
|
||||
return $is_backwards_recursive ? TRUE : $status;
|
||||
|
||||
// If the parent directory doesn't exist, try to create it.
|
||||
$parent_exists = is_dir($parent = dirname($directory));
|
||||
if (!$parent_exists) {
|
||||
$parent_exists = $this->createDirectory($parent, $mode);
|
||||
}
|
||||
// If the parent directory and the requested directory does not exist and
|
||||
// could not be created above, walk the requested directory path back up
|
||||
// until an existing directory is hit, and from there, recursively create
|
||||
// the sub-directories. Only if that recursion succeeds, create the final,
|
||||
// originally requested subdirectory.
|
||||
return $this->createDirectory($parent, $mode, TRUE) && mkdir($directory) && chmod($directory, $mode);
|
||||
|
||||
// If parent exists, try to create the directory and ensure to set its
|
||||
// permissions, because mkdir() obeys the umask of the current process.
|
||||
if ($parent_exists) {
|
||||
// We hide warnings and ignore the return because there may have been a
|
||||
// race getting here and the directory could already exist.
|
||||
@mkdir($directory);
|
||||
// Only try to chmod() if the subdirectory could be created.
|
||||
if (is_dir($directory)) {
|
||||
// Avoid writing permissions if possible.
|
||||
if (fileperms($directory) !== $mode) {
|
||||
return chmod($directory, $mode);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
// Something failed and the directory doesn't exist.
|
||||
trigger_error('mkdir(): Permission Denied', E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -603,11 +603,13 @@ EOD;
|
||||
*
|
||||
* @param string $string
|
||||
* The header to encode.
|
||||
* @param bool $shorten
|
||||
* If TRUE, only return the first chunk of a multi-chunk encoded string.
|
||||
*
|
||||
* @return string
|
||||
* The mime-encoded header.
|
||||
*/
|
||||
public static function mimeHeaderEncode($string) {
|
||||
public static function mimeHeaderEncode($string, $shorten = FALSE) {
|
||||
if (preg_match('/[^\x20-\x7E]/', $string)) {
|
||||
// floor((75 - strlen("=?UTF-8?B??=")) * 0.75);
|
||||
$chunk_size = 47;
|
||||
@@ -616,6 +618,9 @@ EOD;
|
||||
while ($len > 0) {
|
||||
$chunk = static::truncateBytes($string, $chunk_size);
|
||||
$output .= ' =?UTF-8?B?' . base64_encode($chunk) . "?=\n";
|
||||
if ($shorten) {
|
||||
break;
|
||||
}
|
||||
$c = strlen($chunk);
|
||||
$string = substr($string, $c);
|
||||
$len -= $c;
|
||||
|
||||
Reference in New Issue
Block a user