mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Correct line length and indentation
This commit is contained in:
parent
ba6fde6816
commit
151baeede1
@ -49,8 +49,10 @@ class LeftAndMainTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', $admin->ID);
|
$this->session()->inst_set('loggedInAs', $admin->ID);
|
||||||
$response = $this->get('LeftAndMainTest_Controller');
|
$response = $this->get('LeftAndMainTest_Controller');
|
||||||
|
|
||||||
$this->assertRegExp('/tests\/assets\/LeftAndMainTest.css/i', $response->getBody(), "body should contain custom css");
|
$this->assertRegExp('/tests\/assets\/LeftAndMainTest.css/i', $response->getBody(),
|
||||||
$this->assertRegExp('/tests\/assets\/LeftAndMainTest.js/i', $response->getBody(), "body should contain custom js");
|
"body should contain custom css");
|
||||||
|
$this->assertRegExp('/tests\/assets\/LeftAndMainTest.js/i', $response->getBody(),
|
||||||
|
"body should contain custom js");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,6 @@ class XMLDataFormatter extends DataFormatter {
|
|||||||
$items = $obj->$relName();
|
$items = $obj->$relName();
|
||||||
if ($items) {
|
if ($items) {
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
//$href = Director::absoluteURL($this->config()->api_base . "$className/$id/$relName/$item->ID");
|
|
||||||
$href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID");
|
$href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID");
|
||||||
$xml .= "<$relClass href=\"$href.xml\" id=\"{$item->ID}\"></$relClass>\n";
|
$xml .= "<$relClass href=\"$href.xml\" id=\"{$item->ID}\"></$relClass>\n";
|
||||||
}
|
}
|
||||||
|
2
cache/Cache.php
vendored
2
cache/Cache.php
vendored
@ -257,7 +257,7 @@ class SS_Cache {
|
|||||||
|
|
||||||
foreach(array('any', $for) as $name) {
|
foreach(array('any', $for) as $name) {
|
||||||
if(isset(self::$backend_picks[$name])) {
|
if(isset(self::$backend_picks[$name])) {
|
||||||
if(self::$backend_picks[$name]['priority'] > $backend_priority) {
|
if(self::$backend_picks[$name]['priority'] > $backend_priority) {
|
||||||
$backend_name = self::$backend_picks[$name]['name'];
|
$backend_name = self::$backend_picks[$name]['name'];
|
||||||
$backend_priority = self::$backend_picks[$name]['priority'];
|
$backend_priority = self::$backend_picks[$name]['priority'];
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,8 @@ require_once("model/DB.php");
|
|||||||
if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
|
if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
|
||||||
echo "\nPlease configure your database connection details. You can do this by creating a file
|
echo "\nPlease configure your database connection details. You can do this by creating a file
|
||||||
called _ss_environment.php in either of the following locations:\n\n";
|
called _ss_environment.php in either of the following locations:\n\n";
|
||||||
echo " - " . BASE_PATH . DIRECTORY_SEPARATOR . "_ss_environment.php\n - " . dirname(BASE_PATH) . DIRECTORY_SEPARATOR . "_ss_environment.php\n\n";
|
echo " - " . BASE_PATH . DIRECTORY_SEPARATOR . "_ss_environment.php\n - ";
|
||||||
|
echo dirname(BASE_PATH) . DIRECTORY_SEPARATOR . "_ss_environment.php\n\n";
|
||||||
echo <<<ENVCONTENT
|
echo <<<ENVCONTENT
|
||||||
|
|
||||||
Put the following content into this file:
|
Put the following content into this file:
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
* @subpackage testing
|
* @subpackage testing
|
||||||
*/
|
*/
|
||||||
class BehatFixtureFactory extends \FixtureFactory {
|
class BehatFixtureFactory extends \FixtureFactory {
|
||||||
public function createObject($name, $identifier, $data = null) {
|
public function createObject($name, $identifier, $data = null) {
|
||||||
if(!$data) $data = array();
|
if(!$data) $data = array();
|
||||||
|
|
||||||
// Copy identifier to some visible property unless its already defined.
|
// Copy identifier to some visible property unless its already defined.
|
||||||
// Exclude files, since they generate their own named based on the file path.
|
// Exclude files, since they generate their own named based on the file path.
|
||||||
if(!$name != 'File' && !is_subclass_of($name, 'File')) {
|
if(!$name != 'File' && !is_subclass_of($name, 'File')) {
|
||||||
foreach(array('Name', 'Title') as $fieldName) {
|
foreach(array('Name', 'Title') as $fieldName) {
|
||||||
if(singleton($name)->hasField($fieldName) && !isset($data[$fieldName])) {
|
if(singleton($name)->hasField($fieldName) && !isset($data[$fieldName])) {
|
||||||
$data[$fieldName] = $identifier;
|
$data[$fieldName] = $identifier;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::createObject($name, $identifier, $data);
|
return parent::createObject($name, $identifier, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -210,7 +210,8 @@ class CsvBulkLoader extends BulkLoader {
|
|||||||
if(is_string($duplicateCheck)) {
|
if(is_string($duplicateCheck)) {
|
||||||
$SQL_fieldName = Convert::raw2sql($duplicateCheck);
|
$SQL_fieldName = Convert::raw2sql($duplicateCheck);
|
||||||
|
|
||||||
if(!isset($record[$SQL_fieldName]) || empty($record[$SQL_fieldName])) { //skip current duplicate check if field value is empty
|
if(!isset($record[$SQL_fieldName]) || empty($record[$SQL_fieldName])) {
|
||||||
|
//skip current duplicate check if field value is empty
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,12 +501,24 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function assertContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE) {
|
public static function assertContains(
|
||||||
|
$needle,
|
||||||
|
$haystack,
|
||||||
|
$message = '',
|
||||||
|
$ignoreCase = FALSE,
|
||||||
|
$checkForObjectIdentity = TRUE
|
||||||
|
) {
|
||||||
if ($haystack instanceof DBField) $haystack = (string)$haystack;
|
if ($haystack instanceof DBField) $haystack = (string)$haystack;
|
||||||
parent::assertContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity);
|
parent::assertContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE) {
|
public static function assertNotContains(
|
||||||
|
$needle,
|
||||||
|
$haystack,
|
||||||
|
$message = '',
|
||||||
|
$ignoreCase = FALSE,
|
||||||
|
$checkForObjectIdentity = TRUE
|
||||||
|
) {
|
||||||
if ($haystack instanceof DBField) $haystack = (string)$haystack;
|
if ($haystack instanceof DBField) $haystack = (string)$haystack;
|
||||||
parent::assertNotContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity);
|
parent::assertNotContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity);
|
||||||
}
|
}
|
||||||
|
@ -255,9 +255,11 @@ class ImagickBackend extends Imagick implements Image_Backend {
|
|||||||
$new->setBackgroundColor($backgroundColor);
|
$new->setBackgroundColor($backgroundColor);
|
||||||
|
|
||||||
if(($geo['width']/$width) < ($geo['height']/$height)){
|
if(($geo['width']/$width) < ($geo['height']/$height)){
|
||||||
$new->cropImage($geo['width'], floor($height*$geo['width']/$width), 0, (($geo['height']-($height*$geo['width']/$width))/2));
|
$new->cropImage($geo['width'], floor($height*$geo['width']/$width),
|
||||||
|
0, (($geo['height']-($height*$geo['width']/$width))/2));
|
||||||
}else{
|
}else{
|
||||||
$new->cropImage(ceil($width*$geo['height']/$height), $geo['height'], (($geo['width']-($width*$geo['height']/$height))/2), 0);
|
$new->cropImage(ceil($width*$geo['height']/$height), $geo['height'],
|
||||||
|
(($geo['width']-($width*$geo['height']/$height))/2), 0);
|
||||||
}
|
}
|
||||||
$new->ThumbnailImage($width,$height,true);
|
$new->ThumbnailImage($width,$height,true);
|
||||||
return $new;
|
return $new;
|
||||||
|
@ -56,7 +56,9 @@ class CheckboxField_Readonly extends ReadonlyField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function Value() {
|
public function Value() {
|
||||||
return Convert::raw2xml($this->value ? _t('CheckboxField.YESANSWER', 'Yes') : _t('CheckboxField.NOANSWER', 'No'));
|
return Convert::raw2xml($this->value ?
|
||||||
|
_t('CheckboxField.YESANSWER', 'Yes') :
|
||||||
|
_t('CheckboxField.NOANSWER', 'No'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,8 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
public function saveInto(DataObjectInterface $record) {
|
public function saveInto(DataObjectInterface $record) {
|
||||||
$fieldname = $this->name;
|
$fieldname = $this->name;
|
||||||
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
|
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
|
||||||
if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
|
if($fieldname && $record && $relation &&
|
||||||
|
($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
|
||||||
$idList = array();
|
$idList = array();
|
||||||
if($this->value) foreach($this->value as $id => $bool) {
|
if($this->value) foreach($this->value as $id => $bool) {
|
||||||
if($bool) {
|
if($bool) {
|
||||||
|
@ -66,7 +66,7 @@ class ConfirmedPasswordField extends FormField {
|
|||||||
*
|
*
|
||||||
* @var FieldList
|
* @var FieldList
|
||||||
*/
|
*/
|
||||||
public $children;
|
public $children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
@ -360,7 +360,8 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
'<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'),
|
'<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'),
|
||||||
$remoteURL = new TextField('RemoteURL', 'http://'),
|
$remoteURL = new TextField('RemoteURL', 'http://'),
|
||||||
new LiteralField('addURLImage',
|
new LiteralField('addURLImage',
|
||||||
'<button class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">'._t('HtmlEditorField.BUTTONADDURL', 'Add url').'</button>')
|
'<button class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">' .
|
||||||
|
_t('HtmlEditorField.BUTTONADDURL', 'Add url').'</button>')
|
||||||
);
|
);
|
||||||
|
|
||||||
$remoteURL->addExtraClass('remoteurl');
|
$remoteURL->addExtraClass('remoteurl');
|
||||||
@ -640,7 +641,8 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
*/
|
*/
|
||||||
protected function getFieldsForImage($url, $file) {
|
protected function getFieldsForImage($url, $file) {
|
||||||
if($file->File instanceof Image) {
|
if($file->File instanceof Image) {
|
||||||
$formattedImage = $file->File->generateFormattedImage('SetWidth', Config::inst()->get('Image', 'asset_preview_width'));
|
$formattedImage = $file->File->generateFormattedImage('SetWidth',
|
||||||
|
Config::inst()->get('Image', 'asset_preview_width'));
|
||||||
$thumbnailURL = $formattedImage ? $formattedImage->URL : $url;
|
$thumbnailURL = $formattedImage ? $formattedImage->URL : $url;
|
||||||
} else {
|
} else {
|
||||||
$thumbnailURL = $url;
|
$thumbnailURL = $url;
|
||||||
|
@ -179,7 +179,8 @@ class ListboxField extends DropdownField {
|
|||||||
if($this->multiple) {
|
if($this->multiple) {
|
||||||
$fieldname = $this->name;
|
$fieldname = $this->name;
|
||||||
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
|
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
|
||||||
if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
|
if($fieldname && $record && $relation &&
|
||||||
|
($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
|
||||||
$idList = (is_array($this->value)) ? array_values($this->value) : array();
|
$idList = (is_array($this->value)) ? array_values($this->value) : array();
|
||||||
if(!$record->ID) {
|
if(!$record->ID) {
|
||||||
$record->write(); // record needs to have an ID in order to set relationships
|
$record->write(); // record needs to have an ID in order to set relationships
|
||||||
|
@ -676,7 +676,8 @@ class i18n extends Object implements TemplateGlobalProvider {
|
|||||||
),
|
),
|
||||||
'be' => array(
|
'be' => array(
|
||||||
'name' => 'Belarusian',
|
'name' => 'Belarusian',
|
||||||
'native' => 'Беларуская мова'
|
'native' =>
|
||||||
|
'Беларуская мова'
|
||||||
),
|
),
|
||||||
'bn' => array(
|
'bn' => array(
|
||||||
'name' => 'Bengali',
|
'name' => 'Bengali',
|
||||||
@ -1024,7 +1025,8 @@ class i18n extends Object implements TemplateGlobalProvider {
|
|||||||
),
|
),
|
||||||
'be_BY' => array(
|
'be_BY' => array(
|
||||||
'name' => 'Belarusian',
|
'name' => 'Belarusian',
|
||||||
'native' => 'Беларуская мова'
|
'native' =>
|
||||||
|
'Беларуская мова'
|
||||||
),
|
),
|
||||||
'bn_BD' => array(
|
'bn_BD' => array(
|
||||||
'name' => 'Bengali',
|
'name' => 'Bengali',
|
||||||
|
@ -1157,7 +1157,7 @@ abstract class SS_Query implements Iterator {
|
|||||||
$result .= "<tr>";
|
$result .= "<tr>";
|
||||||
foreach($record as $k => $v) {
|
foreach($record as $k => $v) {
|
||||||
$result .= "<th>" . Convert::raw2xml($k) . "</th> ";
|
$result .= "<th>" . Convert::raw2xml($k) . "</th> ";
|
||||||
}
|
}
|
||||||
$result .= "</tr> \n";
|
$result .= "</tr> \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,7 +1234,7 @@ abstract class SS_Query implements Iterator {
|
|||||||
*/
|
*/
|
||||||
public function valid() {
|
public function valid() {
|
||||||
if(!$this->queryHasBegun) $this->next();
|
if(!$this->queryHasBegun) $this->next();
|
||||||
return $this->currentRecord !== false;
|
return $this->currentRecord !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,13 +98,15 @@ class Hierarchy extends DataExtension {
|
|||||||
* should not change this.
|
* should not change this.
|
||||||
* @param int $nodeCountThreshold See {@link self::$node_threshold_total}
|
* @param int $nodeCountThreshold See {@link self::$node_threshold_total}
|
||||||
* @param callable $nodeCountCallback Called with the node count, which gives the callback an opportunity
|
* @param callable $nodeCountCallback Called with the node count, which gives the callback an opportunity
|
||||||
* to intercept the query. Useful e.g. to avoid excessive children listings (Arguments: $parent, $numChildren)
|
* to intercept the query. Useful e.g. to avoid excessive children listings
|
||||||
|
* (Arguments: $parent, $numChildren)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getChildrenAsUL($attributes = "", $titleEval = '"<li>" . $child->Title', $extraArg = null,
|
public function getChildrenAsUL($attributes = "", $titleEval = '"<li>" . $child->Title', $extraArg = null,
|
||||||
$limitToMarked = false, $childrenMethod = "AllChildrenIncludingDeleted",
|
$limitToMarked = false, $childrenMethod = "AllChildrenIncludingDeleted",
|
||||||
$numChildrenMethod = "numChildren", $rootCall = true, $nodeCountThreshold = null, $nodeCountCallback = null) {
|
$numChildrenMethod = "numChildren", $rootCall = true,
|
||||||
|
$nodeCountThreshold = null, $nodeCountCallback = null) {
|
||||||
|
|
||||||
if(!is_numeric($nodeCountThreshold)) {
|
if(!is_numeric($nodeCountThreshold)) {
|
||||||
$nodeCountThreshold = Config::inst()->get('Hierarchy', 'node_threshold_total');
|
$nodeCountThreshold = Config::inst()->get('Hierarchy', 'node_threshold_total');
|
||||||
@ -154,8 +156,8 @@ class Hierarchy extends DataExtension {
|
|||||||
$output .= $nodeCountWarning;
|
$output .= $nodeCountWarning;
|
||||||
$child->markClosed();
|
$child->markClosed();
|
||||||
} else {
|
} else {
|
||||||
$output .= $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked, $childrenMethod,
|
$output .= $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked,
|
||||||
$numChildrenMethod, false, $nodeCountThreshold);
|
$childrenMethod, $numChildrenMethod, false, $nodeCountThreshold);
|
||||||
}
|
}
|
||||||
} elseif($child->isTreeOpened()) {
|
} elseif($child->isTreeOpened()) {
|
||||||
// Since we're not loading children, don't mark it as open either
|
// Since we're not loading children, don't mark it as open either
|
||||||
|
@ -245,12 +245,14 @@ class ShortcodeParser {
|
|||||||
|
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
$err = 'Close tag "'.$tags[$i]['close'].'" is the first found tag, so has no related open tag';
|
$err = 'Close tag "'.$tags[$i]['close'].'" is the first found tag, so has no related open tag';
|
||||||
}
|
}
|
||||||
else if (!$tags[$i-1]['open']) {
|
else if (!$tags[$i-1]['open']) {
|
||||||
$err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'.$tags[$i-1]['close'].'"';
|
$err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'.
|
||||||
|
$tags[$i-1]['close'].'"';
|
||||||
}
|
}
|
||||||
else if ($tags[$i]['close'] != $tags[$i-1]['open']) {
|
else if ($tags[$i]['close'] != $tags[$i-1]['open']) {
|
||||||
$err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'.$tags[$i-1]['open'].'"';
|
$err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'.
|
||||||
|
$tags[$i-1]['open'].'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($err) {
|
if($err) {
|
||||||
@ -332,7 +334,8 @@ class ShortcodeParser {
|
|||||||
$tags = $this->extractTags($node->nodeValue);
|
$tags = $this->extractTags($node->nodeValue);
|
||||||
|
|
||||||
if($tags) {
|
if($tags) {
|
||||||
$node->nodeValue = $this->replaceTagsWithText($node->nodeValue, $tags, function($idx, $tag) use ($parser){
|
$node->nodeValue = $this->replaceTagsWithText($node->nodeValue, $tags,
|
||||||
|
function($idx, $tag) use ($parser){
|
||||||
$content = $parser->callShortcode($tag['open'], $tag['attrs'], $tag['content']);
|
$content = $parser->callShortcode($tag['open'], $tag['attrs'], $tag['content']);
|
||||||
|
|
||||||
if ($content === false) {
|
if ($content === false) {
|
||||||
@ -381,7 +384,8 @@ class ShortcodeParser {
|
|||||||
do {
|
do {
|
||||||
$parent = $parent->parentNode;
|
$parent = $parent->parentNode;
|
||||||
}
|
}
|
||||||
while($parent instanceof DOMElement && !in_array(strtolower($parent->tagName), self::$block_level_elements));
|
while($parent instanceof DOMElement &&
|
||||||
|
!in_array(strtolower($parent->tagName), self::$block_level_elements));
|
||||||
|
|
||||||
$node->setAttribute('data-parentid', count($parents));
|
$node->setAttribute('data-parentid', count($parents));
|
||||||
$parents[] = $parent;
|
$parents[] = $parent;
|
||||||
@ -451,7 +455,8 @@ class ShortcodeParser {
|
|||||||
else if($location == self::INLINE) {
|
else if($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',
|
||||||
E_USER_WARNING
|
E_USER_WARNING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -484,7 +489,7 @@ class ShortcodeParser {
|
|||||||
$content = $tag['text'];
|
$content = $tag['text'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// self::$error_behavior == self::STRIP - NOP
|
// self::$error_behavior == self::STRIP - NOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +554,8 @@ class ShortcodeParser {
|
|||||||
|
|
||||||
if(!$parent) {
|
if(!$parent) {
|
||||||
if($location !== self::INLINE) {
|
if($location !== self::INLINE) {
|
||||||
user_error("Parent block for shortcode couldn't be found, but location wasn't INLINE", E_USER_ERROR);
|
user_error("Parent block for shortcode couldn't be found, but location wasn't INLINE",
|
||||||
|
E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -113,11 +113,13 @@ class Group extends DataObject {
|
|||||||
} elseif($record && $record->ID) {
|
} elseif($record && $record->ID) {
|
||||||
// TODO Mark disabled once chosen.js supports it
|
// TODO Mark disabled once chosen.js supports it
|
||||||
// $groupsField->setDisabledItems(array($group->ID));
|
// $groupsField->setDisabledItems(array($group->ID));
|
||||||
$form->Fields()->replaceField('DirectGroups', $groupsField->performReadonlyTransformation());
|
$form->Fields()->replaceField('DirectGroups',
|
||||||
|
$groupsField->performReadonlyTransformation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$memberList = GridField::create('Members',false, $this->DirectMembers(), $config)->addExtraClass('members_grid');
|
$memberList = GridField::create('Members',false, $this->DirectMembers(), $config)
|
||||||
|
->addExtraClass('members_grid');
|
||||||
// @todo Implement permission checking on GridField
|
// @todo Implement permission checking on GridField
|
||||||
//$memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
|
//$memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
|
||||||
$fields->addFieldToTab('Root.Members', $memberList);
|
$fields->addFieldToTab('Root.Members', $memberList);
|
||||||
|
@ -689,7 +689,7 @@ class Security extends Controller {
|
|||||||
* @return Form Returns the lost password form
|
* @return Form Returns the lost password form
|
||||||
*/
|
*/
|
||||||
public function ChangePasswordForm() {
|
public function ChangePasswordForm() {
|
||||||
return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
|
return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ class FeatureContext extends SilverStripeContext
|
|||||||
* Initializes context.
|
* Initializes context.
|
||||||
* Every scenario gets it's own context object.
|
* Every scenario gets it's own context object.
|
||||||
*
|
*
|
||||||
* @param array $parameters context parameters (set them up through behat.yml)
|
* @param array $parameters context parameters (set them up through behat.yml)
|
||||||
*/
|
*/
|
||||||
public function __construct(array $parameters)
|
public function __construct(array $parameters)
|
||||||
{
|
{
|
||||||
@ -47,22 +47,22 @@ class FeatureContext extends SilverStripeContext
|
|||||||
$this->useContext('FixtureContext', $fixtureContext);
|
$this->useContext('FixtureContext', $fixtureContext);
|
||||||
|
|
||||||
// Use blueprints to set user name from identifier
|
// Use blueprints to set user name from identifier
|
||||||
$factory = $fixtureContext->getFixtureFactory();
|
$factory = $fixtureContext->getFixtureFactory();
|
||||||
$blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member');
|
$blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member');
|
||||||
$blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) {
|
$blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) {
|
||||||
if(!isset($data['FirstName'])) $data['FirstName'] = $identifier;
|
if(!isset($data['FirstName'])) $data['FirstName'] = $identifier;
|
||||||
});
|
});
|
||||||
$factory->define('Member', $blueprint);
|
$factory->define('Member', $blueprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMinkParameters(array $parameters)
|
public function setMinkParameters(array $parameters)
|
||||||
{
|
{
|
||||||
parent::setMinkParameters($parameters);
|
parent::setMinkParameters($parameters);
|
||||||
|
|
||||||
if(isset($parameters['files_path'])) {
|
if(isset($parameters['files_path'])) {
|
||||||
$this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']);
|
$this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return FixtureFactory
|
* @return FixtureFactory
|
||||||
|
@ -130,7 +130,8 @@ class HTTPTest extends SapphireTest {
|
|||||||
// background-image
|
// background-image
|
||||||
// Note that using /./ in urls is absolutely acceptable
|
// Note that using /./ in urls is absolutely acceptable
|
||||||
$test->assertEquals(
|
$test->assertEquals(
|
||||||
'<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">Content</div>',
|
'<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">'.
|
||||||
|
'Content</div>',
|
||||||
HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>')
|
HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -169,7 +170,8 @@ class HTTPTest extends SapphireTest {
|
|||||||
// background
|
// background
|
||||||
// Note that using /./ in urls is absolutely acceptable
|
// Note that using /./ in urls is absolutely acceptable
|
||||||
$test->assertEquals(
|
$test->assertEquals(
|
||||||
'<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>',
|
'<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">'.
|
||||||
|
'SS Blog</div>',
|
||||||
HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>')
|
HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -210,8 +212,10 @@ class HTTPTest extends SapphireTest {
|
|||||||
|
|
||||||
// data uri
|
// data uri
|
||||||
$test->assertEquals(
|
$test->assertEquals(
|
||||||
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
|
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38'.
|
||||||
HTTP::absoluteURLs('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'),
|
'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
|
||||||
|
HTTP::absoluteURLs('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH'.
|
||||||
|
'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'),
|
||||||
'Data URI links are not rewritten'
|
'Data URI links are not rewritten'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,15 +24,17 @@ class CoreTest extends SapphireTest {
|
|||||||
$user = getTempFolderUsername();
|
$user = getTempFolderUsername();
|
||||||
|
|
||||||
// A typical Windows location for where sites are stored on IIS
|
// A typical Windows location for where sites are stored on IIS
|
||||||
$this->assertEquals(sys_get_temp_dir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user,
|
$this->assertEquals(sys_get_temp_dir() .
|
||||||
|
'/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user,
|
||||||
getTempFolder('C:\\inetpub\\wwwroot\\silverstripe-test-project'));
|
getTempFolder('C:\\inetpub\\wwwroot\\silverstripe-test-project'));
|
||||||
|
|
||||||
// A typical Mac OS X location for where sites are stored
|
// A typical Mac OS X location for where sites are stored
|
||||||
$this->assertEquals(sys_get_temp_dir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user,
|
$this->assertEquals(sys_get_temp_dir() .
|
||||||
|
'/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user,
|
||||||
getTempFolder('/Users/joebloggs/Sites/silverstripe-test-project'));
|
getTempFolder('/Users/joebloggs/Sites/silverstripe-test-project'));
|
||||||
|
|
||||||
// A typical Linux location for where sites are stored
|
// A typical Linux location for where sites are stored
|
||||||
$this->assertEquals(sys_get_temp_dir() . '/silverstripe-cache-var-www-silverstripe-test-project/' . $user,
|
$this->assertEquals(sys_get_temp_dir() .'/silverstripe-cache-var-www-silverstripe-test-project/' . $user,
|
||||||
getTempFolder('/var/www/silverstripe-test-project'));
|
getTempFolder('/var/www/silverstripe-test-project'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ DOC;
|
|||||||
nowdoc
|
nowdoc
|
||||||
DOC;
|
DOC;
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
// Assigning multiple values
|
// Assigning multiple values
|
||||||
static $onone, $onull = null, $oint = 1, $ofloat = 2.5, $ostring = 'string', $oarray = array(1, 2, array(3, 4), 5), $oheredoc = <<<DOC
|
static $onone, $onull = null, $oint = 1, $ofloat = 2.5, $ostring = 'string', $oarray = array(1, 2, array(3, 4), 5), $oheredoc = <<<DOC
|
||||||
heredoc
|
heredoc
|
||||||
@ -35,6 +36,7 @@ DOC
|
|||||||
, $onowdoc = <<<'DOC'
|
, $onowdoc = <<<'DOC'
|
||||||
nowdoc
|
nowdoc
|
||||||
DOC;
|
DOC;
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
static
|
static
|
||||||
$mnone,
|
$mnone,
|
||||||
|
@ -48,11 +48,11 @@ class TemplateManifestTest extends SapphireTest {
|
|||||||
'main' => "{$this->base}/module/subfolder/templates/Subfolder.ss"
|
'main' => "{$this->base}/module/subfolder/templates/Subfolder.ss"
|
||||||
),
|
),
|
||||||
'customthemepage' => array (
|
'customthemepage' => array (
|
||||||
'Layout' => "{$this->base}/module/templates/Layout/CustomThemePage.ss",
|
'Layout' => "{$this->base}/module/templates/Layout/CustomThemePage.ss",
|
||||||
'themes' =>
|
'themes' =>
|
||||||
array(
|
array(
|
||||||
'theme' => array('main' => "{$this->base}/themes/theme/templates/CustomThemePage.ss",)
|
'theme' => array('main' => "{$this->base}/themes/theme/templates/CustomThemePage.ss",)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'include' => array('themes' => array(
|
'include' => array('themes' => array(
|
||||||
'theme' => array(
|
'theme' => array(
|
||||||
|
@ -256,11 +256,13 @@ class RequirementsTest extends SapphireTest {
|
|||||||
$html = $backend->includeInHTML(false, self::$html_template);
|
$html = $backend->includeInHTML(false, self::$html_template);
|
||||||
|
|
||||||
/* Javascript has correct path */
|
/* Javascript has correct path */
|
||||||
$this->assertTrue((bool)preg_match('/src=".*\/RequirementsTest_a\.js\?m=\d\d+&test=1&test=2&test=3/', $html),
|
$this->assertTrue(
|
||||||
|
(bool)preg_match('/src=".*\/RequirementsTest_a\.js\?m=\d\d+&test=1&test=2&test=3/',$html),
|
||||||
'javascript has correct path');
|
'javascript has correct path');
|
||||||
|
|
||||||
/* CSS has correct path */
|
/* CSS has correct path */
|
||||||
$this->assertTrue((bool)preg_match('/href=".*\/RequirementsTest_a\.css\?m=\d\d+&test=1&test=2&test=3/',$html),
|
$this->assertTrue(
|
||||||
|
(bool)preg_match('/href=".*\/RequirementsTest_a\.css\?m=\d\d+&test=1&test=2&test=3/',$html),
|
||||||
'css has correct path');
|
'css has correct path');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,8 @@ class HTMLTextTest extends SapphireTest {
|
|||||||
'<h1>should ignore</h1><p>First Mr. sentence. Second sentence.</p>' => 'First Mr. sentence.',
|
'<h1>should ignore</h1><p>First Mr. sentence. Second sentence.</p>' => 'First Mr. sentence.',
|
||||||
"<h1>should ignore</h1><p>Sentence with {$many}words. Second sentence.</p>"
|
"<h1>should ignore</h1><p>Sentence with {$many}words. Second sentence.</p>"
|
||||||
=> "Sentence with {$many}words.",
|
=> "Sentence with {$many}words.",
|
||||||
'<p>This classic picture book features a repetitive format that lends itself to audience interaction. Illustrator Eric Carle submitted new, bolder artwork for the 25th anniversary edition.</p>'
|
'<p>This classic picture book features a repetitive format that lends itself to audience interaction.'.
|
||||||
|
' Illustrator Eric Carle submitted new, bolder artwork for the 25th anniversary edition.</p>'
|
||||||
=> 'This classic picture book features a repetitive format that lends itself to audience interaction.'
|
=> 'This classic picture book features a repetitive format that lends itself to audience interaction.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ class ValidationExceptionTest extends SapphireTest
|
|||||||
$this->assertEquals(E_USER_WARNING, $exception->getCode());
|
$this->assertEquals(E_USER_WARNING, $exception->getCode());
|
||||||
$this->assertEquals('An error has occurred', $exception->getMessage());
|
$this->assertEquals('An error has occurred', $exception->getMessage());
|
||||||
$this->assertEquals(false, $exception->getResult()->valid());
|
$this->assertEquals(false, $exception->getResult()->valid());
|
||||||
$this->assertEquals('A spork is not a knife; A knife is not a back scratcher', $exception->getResult()->message());
|
$this->assertEquals('A spork is not a knife; A knife is not a back scratcher',
|
||||||
|
$exception->getResult()->message());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -145,8 +145,9 @@ class ShortcodeParserTest extends SapphireTest {
|
|||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'[[Doesnt shortcode get confused by double ]] characters',
|
'[[Doesnt shortcode get confused by double ]] characters',
|
||||||
$this->parser->parse('[[Doesnt [test_shortcode]shortcode[/test_shortcode] get confused by double ]] characters'
|
$this->parser->parse(
|
||||||
));
|
'[[Doesnt [test_shortcode]shortcode[/test_shortcode] get confused by double ]] characters')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnquotedArguments() {
|
public function testUnquotedArguments() {
|
||||||
|
@ -1002,7 +1002,8 @@ class SSTemplateParser extends Parser {
|
|||||||
// non-dynamically calculated
|
// non-dynamically calculated
|
||||||
$text = preg_replace(
|
$text = preg_replace(
|
||||||
'/href\s*\=\s*\"\#/',
|
'/href\s*\=\s*\"\#/',
|
||||||
'href="\' . (Config::inst()->get(\'SSViewer\', \'rewrite_hash_links\') ? strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") .
|
'href="\' . (Config::inst()->get(\'SSViewer\', \'rewrite_hash_links\') ?' .
|
||||||
|
' strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") .
|
||||||
\'#',
|
\'#',
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user