mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '4.0' into 4.1
This commit is contained in:
commit
e260319823
@ -22,7 +22,7 @@ class CurrencyField_Disabled extends CurrencyField
|
|||||||
{
|
{
|
||||||
if ($this->value) {
|
if ($this->value) {
|
||||||
$val = Convert::raw2xml($this->value);
|
$val = Convert::raw2xml($this->value);
|
||||||
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/', "", $val), 2);
|
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.-]/', "", $val), 2);
|
||||||
$valforInput = Convert::raw2att($val);
|
$valforInput = Convert::raw2att($val);
|
||||||
} else {
|
} else {
|
||||||
$valforInput = '';
|
$valforInput = '';
|
||||||
|
@ -20,7 +20,7 @@ class CurrencyField_Readonly extends ReadonlyField
|
|||||||
{
|
{
|
||||||
if ($this->value) {
|
if ($this->value) {
|
||||||
$val = Convert::raw2xml($this->value);
|
$val = Convert::raw2xml($this->value);
|
||||||
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/', "", $val), 2);
|
$val = _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.-]/', "", $val), 2);
|
||||||
$valforInput = Convert::raw2att($val);
|
$valforInput = Convert::raw2att($val);
|
||||||
} else {
|
} else {
|
||||||
$val = '<i>' . _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . '0.00</i>';
|
$val = '<i>' . _t('SilverStripe\\Forms\\CurrencyField.CURRENCYSYMBOL', '$') . '0.00</i>';
|
||||||
|
@ -4,7 +4,6 @@ namespace SilverStripe\Forms\HTMLEditor;
|
|||||||
|
|
||||||
use DOMAttr;
|
use DOMAttr;
|
||||||
use DOMElement;
|
use DOMElement;
|
||||||
use DOMNode;
|
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
use SilverStripe\View\Parsers\HTMLValue;
|
use SilverStripe\View\Parsers\HTMLValue;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
@ -114,24 +113,20 @@ class HTMLEditorSanitiser
|
|||||||
if ($attrType === '!') {
|
if ($attrType === '!') {
|
||||||
$element->attributesRequired[] = $attrName;
|
$element->attributesRequired[] = $attrName;
|
||||||
$attr->required = true;
|
$attr->required = true;
|
||||||
} // Denied from global
|
} elseif ($attrType === '-') { // Denied from global
|
||||||
elseif ($attrType === '-') {
|
|
||||||
unset($element->attributes[$attrName]);
|
unset($element->attributes[$attrName]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default value
|
// Default value
|
||||||
if ($prefix) {
|
if ($prefix) {
|
||||||
// Default value
|
if ($prefix === '=') { // Default value
|
||||||
if ($prefix === '=') {
|
|
||||||
$element->attributesDefault[$attrName] = $value;
|
$element->attributesDefault[$attrName] = $value;
|
||||||
$attr->defaultValue = $value;
|
$attr->defaultValue = $value;
|
||||||
} // Forced value
|
} elseif ($prefix === ':') { // Forced value
|
||||||
elseif ($prefix === ':') {
|
|
||||||
$element->attributesForced[$attrName] = $value;
|
$element->attributesForced[$attrName] = $value;
|
||||||
$attr->forcedValue = $value;
|
$attr->forcedValue = $value;
|
||||||
} // Required values
|
} elseif ($prefix === '<') { // Required values
|
||||||
elseif ($prefix === '<') {
|
|
||||||
$attr->validValues = explode('?', $value);
|
$attr->validValues = explode('?', $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,8 +285,7 @@ class HTMLEditorSanitiser
|
|||||||
// If it's a script or style, we don't keep contents
|
// If it's a script or style, we don't keep contents
|
||||||
if ($el->tagName === 'script' || $el->tagName === 'style') {
|
if ($el->tagName === 'script' || $el->tagName === 'style') {
|
||||||
$el->parentNode->removeChild($el);
|
$el->parentNode->removeChild($el);
|
||||||
} // Otherwise we replace this node with all it's children
|
} else { // Otherwise we replace this node with all it's children
|
||||||
else {
|
|
||||||
// First, create a new fragment with all of $el's children moved into it
|
// First, create a new fragment with all of $el's children moved into it
|
||||||
$frag = $doc->createDocumentFragment();
|
$frag = $doc->createDocumentFragment();
|
||||||
while ($el->firstChild) {
|
while ($el->firstChild) {
|
||||||
@ -301,8 +295,7 @@ class HTMLEditorSanitiser
|
|||||||
// Then replace $el with the frags contents (which used to be it's children)
|
// Then replace $el with the frags contents (which used to be it's children)
|
||||||
$el->parentNode->replaceChild($frag, $el);
|
$el->parentNode->replaceChild($frag, $el);
|
||||||
}
|
}
|
||||||
} // Otherwise tidy the element
|
} else { // Otherwise tidy the element
|
||||||
else {
|
|
||||||
// First, if we're supposed to pad & this element is empty, fix that
|
// First, if we're supposed to pad & this element is empty, fix that
|
||||||
if ($elementRule->paddEmpty && !$el->firstChild) {
|
if ($elementRule->paddEmpty && !$el->firstChild) {
|
||||||
$el->nodeValue = ' ';
|
$el->nodeValue = ' ';
|
||||||
|
@ -176,9 +176,11 @@ class PDOConnector extends DBConnector
|
|||||||
if (!isset($charset)) {
|
if (!isset($charset)) {
|
||||||
$charset = $connCharset;
|
$charset = $connCharset;
|
||||||
}
|
}
|
||||||
$options = array(
|
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $charset . ' COLLATE ' . $connCollation
|
$options = [];
|
||||||
);
|
if ($parameters['driver'] === 'mysql') {
|
||||||
|
$options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $charset . ' COLLATE ' . $connCollation;
|
||||||
|
}
|
||||||
|
|
||||||
// Set SSL options if they are defined
|
// Set SSL options if they are defined
|
||||||
if (array_key_exists('ssl_key', $parameters) &&
|
if (array_key_exists('ssl_key', $parameters) &&
|
||||||
|
@ -622,8 +622,7 @@ class SQLSelect extends SQLConditionalExpression
|
|||||||
if (!empty($this->having)) {
|
if (!empty($this->having)) {
|
||||||
$records = $this->execute();
|
$records = $this->execute();
|
||||||
return $records->numRecords();
|
return $records->numRecords();
|
||||||
} // Choose a default column
|
} elseif ($column == null) { // Choose a default column
|
||||||
elseif ($column == null) {
|
|
||||||
if ($this->groupby) {
|
if ($this->groupby) {
|
||||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||||
} else {
|
} else {
|
||||||
|
@ -573,8 +573,7 @@ class ShortcodeParser
|
|||||||
} elseif ($location == self::AFTER) {
|
} elseif ($location == self::AFTER) {
|
||||||
// Move after block parent
|
// Move after block parent
|
||||||
$this->insertAfter($node, $parent);
|
$this->insertAfter($node, $parent);
|
||||||
} // Split parent at node
|
} elseif ($location == self::SPLIT) { // Split parent at node
|
||||||
elseif ($location == self::SPLIT) {
|
|
||||||
$at = $node;
|
$at = $node;
|
||||||
$splitee = $node->parentNode;
|
$splitee = $node->parentNode;
|
||||||
|
|
||||||
@ -593,8 +592,7 @@ class ShortcodeParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->insertAfter($node, $parent);
|
$this->insertAfter($node, $parent);
|
||||||
} // Do nothing
|
} elseif ($location == self::INLINE) { // Do nothing
|
||||||
elseif ($location == self::INLINE) {
|
|
||||||
if (in_array(strtolower($node->tagName), self::$block_level_elements)) {
|
if (in_array(strtolower($node->tagName), self::$block_level_elements)) {
|
||||||
user_error(
|
user_error(
|
||||||
'Requested to insert block tag ' . $node->tagName . ' inline - probably this will break HTML compliance',
|
'Requested to insert block tag ' . $node->tagName . ' inline - probably this will break HTML compliance',
|
||||||
@ -638,7 +636,6 @@ class ShortcodeParser
|
|||||||
*/
|
*/
|
||||||
public function parse($content)
|
public function parse($content)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->extend('onBeforeParse', $content);
|
$this->extend('onBeforeParse', $content);
|
||||||
|
|
||||||
$continue = true;
|
$continue = true;
|
||||||
@ -646,11 +643,9 @@ class ShortcodeParser
|
|||||||
// If no shortcodes defined, don't try and parse any
|
// If no shortcodes defined, don't try and parse any
|
||||||
if (!$this->shortcodes) {
|
if (!$this->shortcodes) {
|
||||||
$continue = false;
|
$continue = false;
|
||||||
} // If no content, don't try and parse it
|
} elseif (!trim($content)) { // If no content, don't try and parse it
|
||||||
elseif (!trim($content)) {
|
|
||||||
$continue = false;
|
$continue = false;
|
||||||
} // If no shortcode tag, don't try and parse it
|
} elseif (strpos($content, '[') === false) { // If no shortcode tag, don't try and parse it
|
||||||
elseif (strpos($content, '[') === false) {
|
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +654,7 @@ class ShortcodeParser
|
|||||||
// use a proper DOM
|
// use a proper DOM
|
||||||
list($content, $tags) = $this->replaceElementTagsWithMarkers($content);
|
list($content, $tags) = $this->replaceElementTagsWithMarkers($content);
|
||||||
|
|
||||||
/** @var HTMLValue $htmlvalue */
|
/** @var HTMLValue $htmlvalue */
|
||||||
$htmlvalue = Injector::inst()->create('HTMLValue', $content);
|
$htmlvalue = Injector::inst()->create('HTMLValue', $content);
|
||||||
|
|
||||||
// Now parse the result into a DOM
|
// Now parse the result into a DOM
|
||||||
|
@ -31,7 +31,7 @@ class DirectorTest extends SapphireTest
|
|||||||
Director::config()->set('alternate_base_url', 'http://www.mysite.com:9090/');
|
Director::config()->set('alternate_base_url', 'http://www.mysite.com:9090/');
|
||||||
|
|
||||||
// Ensure redirects enabled on all environments and global state doesn't affect the tests
|
// Ensure redirects enabled on all environments and global state doesn't affect the tests
|
||||||
CanonicalURLMiddleware::singleton()
|
CanonicalURLMiddleware::singleton()
|
||||||
->setForceSSLDomain(null)
|
->setForceSSLDomain(null)
|
||||||
->setForceSSLPatterns([])
|
->setForceSSLPatterns([])
|
||||||
->setEnabledEnvs(true);
|
->setEnabledEnvs(true);
|
||||||
|
@ -30,4 +30,6 @@ class Dingo extends DataObject implements TestOnly
|
|||||||
private static $belongs_many_many = [
|
private static $belongs_many_many = [
|
||||||
'Parents' => Dingo::class,
|
'Parents' => Dingo::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private static $default_sort = '"ID" ASC';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user