Permalink
Browse files

Add codesniffer that ensures indentation is with tabs.

  • Loading branch information...
1 parent 0f8b229 commit fc5dd2994caac9b6c476911de616ea0782911408 @simonwelsh simonwelsh committed Dec 8, 2012
Showing with 3,217 additions and 3,204 deletions.
  1. +2 −1 .travis.yml
  2. +1 −1 admin/code/ModelAdmin.php
  3. +5 −5 admin/javascript/LeftAndMain.AddForm.js
  4. +2 −2 admin/javascript/LeftAndMain.Tree.js
  5. +1 −1 admin/javascript/LeftAndMain.js
  6. +3 −3 admin/javascript/lib.js
  7. +3 −3 api/FormEncodedDataFormatter.php
  8. +4 −4 api/RSSFeed.php
  9. +3 −3 api/RestfulService.php
  10. +14 −14 cli-script.php
  11. +2 −2 conf/ConfigureFromEnv.php
  12. +2 −2 control/ContentNegotiator.php
  13. +2 −2 control/Controller.php
  14. +28 −28 control/Director.php
  15. +2 −2 control/HTTP.php
  16. +24 −24 control/HTTPRequest.php
  17. +23 −23 control/HTTPResponse.php
  18. +1 −1 control/RequestHandler.php
  19. +2 −2 control/injector/AopProxyService.php
  20. +18 −18 core/ArrayLib.php
  21. +470 −470 core/Diff.php
  22. +4 −5 dev/BulkLoader.php
  23. +10 −10 dev/DevelopmentAdmin.php
  24. +12 −12 dev/FunctionalTest.php
  25. +214 −214 dev/Profiler.php
  26. +17 −17 dev/SapphireTestReporter.php
  27. +2 −2 dev/SilverStripeListener.php
  28. +2 −2 dev/TeamCityListener.php
  29. +6 −6 dev/TestListener.php
  30. +8 −8 dev/phpunit/PhpUnitWrapper.php
  31. +3 −3 dev/phpunit/PhpUnitWrapper_3_5.php
  32. +6 −6 email/Email.php
  33. +15 −15 email/Mailer.php
  34. +47 −47 filesystem/GD.php
  35. +1 −1 forms/AjaxUniqueTextField.php
  36. +1 −1 forms/CheckboxSetField.php
  37. +30 −30 forms/ComplexTableField.php
  38. +2 −2 forms/CompositeField.php
  39. +1 −1 forms/CreditCardField.php
  40. +48 −48 forms/DateField.php
  41. +7 −7 forms/FieldGroup.php
  42. +4 −4 forms/Form.php
  43. +9 −9 forms/FormField.php
  44. +5 −5 forms/HtmlEditorField.php
  45. +1 −1 forms/ManyManyComplexTableField.php
  46. +2 −2 forms/NumericField.php
  47. +6 −6 forms/PhoneNumberField.php
  48. +7 −7 forms/RequiredFields.php
  49. +21 −21 forms/SimpleImageField.php
  50. +7 −8 forms/TableField.php
  51. +82 −82 forms/TableListField.php
  52. +1 −1 forms/gridfield/GridField.php
  53. +3 −3 javascript/ComplexTableField.js
  54. +0 −1 javascript/GridField.js
  55. +5 −5 javascript/HtmlEditorField.js
  56. +3 −3 javascript/ImageFormAction.js
  57. +1 −1 javascript/TableField.js
  58. +6 −6 javascript/TableListField.js
  59. +2 −2 javascript/i18n.js
  60. +2 −2 javascript/jquery-ondemand/jquery.ondemand.js
  61. +23 −23 javascript/tree/tree.js
  62. +16 −16 model/DataList.php
  63. +79 −79 model/DataObject.php
  64. +73 −73 model/DataQuery.php
  65. +3 −3 model/Database.php
  66. +2 −2 model/DatabaseAdmin.php
  67. +8 −8 model/HasManyList.php
  68. +13 −13 model/Hierarchy.php
  69. +11 −11 model/ManyManyList.php
  70. +22 −22 model/MySQLDatabase.php
  71. +5 −5 model/SQLQuery.php
  72. +1 −1 model/Transliterator.php
  73. +2 −2 model/Versioned.php
  74. +5 −5 model/fieldtypes/Date.php
  75. +1 −1 model/fieldtypes/Text.php
  76. +4 −4 model/fieldtypes/Varchar.php
  77. +2 −2 parsers/BBCodeParser.php
  78. +811 −812 parsers/HTML/HTMLBBCodeParser.php
  79. +4 −4 search/SearchContext.php
  80. +151 −151 security/Authenticator.php
  81. +3 −3 security/Group.php
  82. +25 −25 security/Member.php
  83. +103 −103 security/MemberAuthenticator.php
  84. +8 −8 security/MemberLoginForm.php
  85. +2 −2 security/Permission.php
  86. +2 −2 security/PermissionCheckboxSetField.php
  87. +31 −31 security/Security.php
  88. +3 −3 tests/api/RestfulServiceTest.php
  89. +18 −18 tests/behat/features/bootstrap/FeatureContext.php
  90. +72 −72 tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php
  91. +294 −294 tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php
  92. +13 −13 tests/bootstrap.php
  93. +6 −6 tests/control/HTTPTest.php
  94. +1 −1 tests/core/ArrayDataTest.php
  95. +1 −1 tests/core/manifest/fixtures/namespaced_classmanifest/module/classes/ClassB.php
  96. +1 −1 tests/dev/CsvBulkLoaderTest.php
  97. +10 −10 tests/forms/FileFieldTest.php
  98. +2 −2 tests/forms/RequirementsTest.php
  99. +17 −17 tests/forms/TableListFieldTest.php
  100. +1 −1 tests/forms/uploadfield/UploadFieldTest.php
  101. +2 −2 tests/injector/testservices/SampleService.php
  102. +5 −5 tests/javascript/TreeDropDownField/TreeDropdownField.js
  103. +0 −1 tests/model/ComponentSetTest.php
  104. +1 −1 tests/model/DataListTest.php
  105. +0 −1 tests/model/DataObjectTest.php
  106. +8 −8 tests/model/MoneyTest.php
  107. +4 −4 tests/model/PaginatedListTest.php
  108. +5 −5 tests/model/VersionedTest.php
  109. +18 −0 tests/phpcs/tabs.xml
  110. +22 −22 tests/search/SearchContextTest.php
  111. +67 −67 tests/security/GroupTest.php
  112. +2 −2 tests/security/MemberTest.php
  113. +3 −3 tests/view/ViewableDataTest.php
  114. +1 −1 view/ArrayData.php
  115. +8 −8 view/Requirements.php
  116. +2 −2 view/SSTemplateParser.php.inc
  117. +5 −5 view/SSViewer.php
View
@@ -22,7 +22,8 @@ before_script:
script:
- phpunit -c phpunit.xml.dist
- - phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs -np framework
+ - phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml -np framework
+ - phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml -np framework
branches:
except:
@@ -296,7 +296,7 @@ public function getManagedModels() {
*
* @return array Map of model class names to importer instances
*/
- public function getModelImporters() {
+ public function getModelImporters() {
$importerClasses = $this->stat('model_importers');
// fallback to all defined models if not explicitly defined
@@ -123,7 +123,7 @@
refresh: function(selectedNode) {
var tree = this.getTree(),
- selectedNode = selectedNode || $(tree).jstree('get_selected')
+ selectedNode = selectedNode || $(tree).jstree('get_selected')
origOptions = this.getOrigOptions(),
dropdown = this.find('select[name=PageType]'),
disallowed = [],
@@ -142,10 +142,10 @@
}
$.each(origOptions, function(i, optProps) {
- if ($.inArray(i, disallowed) === -1 && optProps) {
- dropdown.append($('<option value="' + optProps.value + '">' + optProps.html + '</option>'));
- disableDropDown = false;
- }
+ if ($.inArray(i, disallowed) === -1 && optProps) {
+ dropdown.append($('<option value="' + optProps.value + '">' + optProps.html + '</option>'));
+ disableDropDown = false;
+ }
});
// Disable dropdown if no elements are selectable
@@ -153,8 +153,8 @@
"select_limit" : 1,
'initially_select': [this.find('.current').attr('id')]
},
- "crrm": {
- 'move': {
+ "crrm": {
+ 'move': {
// Check if a node is allowed to be moved.
// Caution: Runs on every drag over a new node
'check_move': function(data) {
@@ -230,7 +230,7 @@ jQuery.noConflict();
*/
submitForm: function(form, button, callback, ajaxOptions) {
var self = this;
-
+
// look for save button
if(!button) button = this.find('.Actions :submit[name=action_save]');
// default to first button if none given - simulates browser behaviour
View
@@ -170,8 +170,8 @@
convertUrlToDataUrl: function( absUrl ) {
var u = path.parseUrl( absUrl );
if ( path.isEmbeddedPage( u ) ) {
- // For embedded pages, remove the dialog hash key as in getFilePath(),
- // otherwise the Data Url won't match the id of the embedded Page.
+ // For embedded pages, remove the dialog hash key as in getFilePath(),
+ // otherwise the Data Url won't match the id of the embedded Page.
return u.hash.split( dialogHashKey )[0].replace( /^#/, "" );
} else if ( path.isSameDomain( u, documentBase ) ) {
return u.hrefNoHash.replace( documentBase.domain, "" );
@@ -232,4 +232,4 @@
};
$.path = path;
-}(jQuery));
+}(jQuery));
@@ -30,9 +30,9 @@ public function supportedMimeTypes() {
}
public function convertStringToArray($strData) {
- $postArray = array();
- parse_str($strData, $postArray);
- return $postArray;
+ $postArray = array();
+ parse_str($strData, $postArray);
+ return $postArray;
//TODO: It would be nice to implement this function in Convert.php
//return Convert::querystr2array($strData);
}
View
@@ -106,9 +106,9 @@ class RSSFeed extends ViewableData {
* every time the representation does
*/
public function __construct(SS_List $entries, $link, $title,
- $description = null, $titleField = "Title",
- $descriptionField = "Content", $authorField = null,
- $lastModified = null, $etag = null) {
+ $description = null, $titleField = "Title",
+ $descriptionField = "Content", $authorField = null,
+ $lastModified = null, $etag = null) {
$this->entries = $entries;
$this->link = $link;
$this->description = $description;
@@ -269,7 +269,7 @@ class RSSFeed_Entry extends ViewableData {
* Create a new RSSFeed entry.
*/
public function __construct($entry, $titleField, $descriptionField,
- $authorField) {
+ $authorField) {
$this->failover = $entry;
$this->titleField = $titleField;
$this->descriptionField = $descriptionField;
View
@@ -65,7 +65,7 @@ public function setQueryString($params=NULL){
* @param string $password The proxy auth password
* @param boolean $socks Set true to use socks5 proxy instead of http
*/
- public function setProxy($proxy, $port = 80, $user = "", $password = "", $socks = false) {
+ public function setProxy($proxy, $port = 80, $user = "", $password = "", $socks = false) {
$this->proxy = array(
CURLOPT_PROXY => $proxy,
CURLOPT_PROXYUSERPWD => "{$user}:{$password}",
@@ -337,14 +337,14 @@ protected function getRecurseValues($xml,&$data,$parent=""){
$child_count++;
$k = ($parent == "") ? (string)$key : $parent . "_" . (string)$key;
if($this->getRecurseValues($value,$data,$k) == 0){ // no childern, aka "leaf node"
- $conv_value = Convert::raw2xml($value);
+ $conv_value = Convert::raw2xml($value);
}
//Review the fix for similar node names overriding it's predecessor
if(array_key_exists($k, $data) == true) {
$data[$k] = $data[$k] . ",". $conv_value;
}
else {
- $data[$k] = $conv_value;
+ $data[$k] = $conv_value;
}
View
@@ -37,19 +37,19 @@
* fourth => val
*/
if(isset($_SERVER['argv'][2])) {
- $args = array_slice($_SERVER['argv'],2);
- if(!isset($_GET)) $_GET = array();
- if(!isset($_REQUEST)) $_REQUEST = array();
- foreach($args as $arg) {
- if(strpos($arg,'=') == false) {
- $_GET['args'][] = $arg;
- } else {
- $newItems = array();
- parse_str( (substr($arg,0,2) == '--') ? substr($arg,2) : $arg, $newItems );
- $_GET = array_merge($_GET, $newItems);
- }
- }
- $_REQUEST = array_merge($_REQUEST, $_GET);
+ $args = array_slice($_SERVER['argv'],2);
+ if(!isset($_GET)) $_GET = array();
+ if(!isset($_REQUEST)) $_REQUEST = array();
+ foreach($args as $arg) {
+ if(strpos($arg,'=') == false) {
+ $_GET['args'][] = $arg;
+ } else {
+ $newItems = array();
+ parse_str( (substr($arg,0,2) == '--') ? substr($arg,2) : $arg, $newItems );
+ $_GET = array_merge($_GET, $newItems);
+ }
+ }
+ $_REQUEST = array_merge($_REQUEST, $_GET);
}
// Set 'url' GET parameter
@@ -76,7 +76,7 @@
$url = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null;
if(!$url) {
echo 'Please specify an argument to cli-script.php/sake. For more information, visit'
- . ' http://doc.silverstripe.org/framework/en/topics/commandline';
+ . ' http://doc.silverstripe.org/framework/en/topics/commandline';
die();
}
@@ -100,8 +100,8 @@
}
// For schema enabled drivers:
- if(defined('SS_DATABASE_SCHEMA'))
- $databaseConfig["schema"] = SS_DATABASE_SCHEMA;
+ if(defined('SS_DATABASE_SCHEMA'))
+ $databaseConfig["schema"] = SS_DATABASE_SCHEMA;
}
if(defined('SS_SEND_ALL_EMAILS_TO')) {
@@ -45,7 +45,7 @@ public static function set_encoding($encoding) {
* that need to specify the character set make use of this function.
*/
public static function get_encoding() {
- return self::$encoding;
+ return self::$encoding;
}
/**
@@ -96,7 +96,7 @@ public static function process(SS_HTTPResponse $response) {
} else {
// The W3C validator doesn't send an HTTP_ACCEPT header, but it can support xhtml. We put this special
// case in here so that designers don't get worried that their templates are HTML4.
- if(isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, 14) == 'W3C_Validator/') {
+ if(isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, 14) == 'W3C_Validator/') {
$chosenFormat = "xhtml";
} else {
View
@@ -164,7 +164,7 @@ public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
Debug::message("Request handler $body->class object to $this->class controller;"
. "rendering with template returned by $body->class::getViewer()");
}
- $body = $body->getViewer($request->latestParam('Action'))->process($body);
+ $body = $body->getViewer($request->latestParam('Action'))->process($body);
}
$this->response->setBody($body);
@@ -367,7 +367,7 @@ public function render($params = null) {
return $template->process($obj);
}
-
+
/**
* Call this to disable site-wide basic authentication for a specific contoller.
* This must be called before Controller::init(). That is, you must call it in your controller's
View
@@ -376,8 +376,8 @@ public static function absoluteURL($url, $relativeToSiteBase = false) {
$url = dirname($_SERVER['REQUEST_URI'] . 'x') . '/' . $url;
}
- if(substr($url,0,4) != "http") {
- if($url[0] != "/") $url = Director::baseURL() . $url;
+ if(substr($url,0,4) != "http") {
+ if($url[0] != "/") $url = Director::baseURL() . $url;
// Sometimes baseURL() can return a full URL instead of just a path
if(substr($url,0,4) != "http") $url = self::protocolAndHost() . $url;
}
@@ -583,23 +583,23 @@ public static function is_absolute($path) {
*/
public static function is_absolute_url($url) {
$colonPosition = strpos($url, ':');
- return (
- // Base check for existence of a host on a compliant URL
- parse_url($url, PHP_URL_HOST)
- // Check for more than one leading slash without a protocol.
- // While not a RFC compliant absolute URL, it is completed to a valid URL by some browsers,
- // and hence a potential security risk. Single leading slashes are not an issue though.
- || preg_match('/\s*[\/]{2,}/', $url)
- || (
- // If a colon is found, check if it's part of a valid scheme definition
- // (meaning its not preceded by a slash, hash or questionmark).
- // URLs in query parameters are assumed to be correctly urlencoded based on RFC3986,
- // in which case no colon should be present in the parameters.
- $colonPosition !== FALSE
- && !preg_match('![/?#]!', substr($url, 0, $colonPosition))
- )
-
- );
+ return (
+ // Base check for existence of a host on a compliant URL
+ parse_url($url, PHP_URL_HOST)
+ // Check for more than one leading slash without a protocol.
+ // While not a RFC compliant absolute URL, it is completed to a valid URL by some browsers,
+ // and hence a potential security risk. Single leading slashes are not an issue though.
+ || preg_match('/\s*[\/]{2,}/', $url)
+ || (
+ // If a colon is found, check if it's part of a valid scheme definition
+ // (meaning its not preceded by a slash, hash or questionmark).
+ // URLs in query parameters are assumed to be correctly urlencoded based on RFC3986,
+ // in which case no colon should be present in the parameters.
+ $colonPosition !== FALSE
+ && !preg_match('![/?#]!', substr($url, 0, $colonPosition))
+ )
+
+ );
}
/**
@@ -681,21 +681,21 @@ public static function fileExists($file) {
/**
* Returns the Absolute URL of the site root.
*/
- public static function absoluteBaseURL() {
- return Director::absoluteURL(Director::baseURL());
- }
-
+ public static function absoluteBaseURL() {
+ return Director::absoluteURL(Director::baseURL());
+ }
+
/**
* Returns the Absolute URL of the site root, embedding the current basic-auth credentials into the URL.
*/
- public static function absoluteBaseURLWithAuth() {
+ public static function absoluteBaseURLWithAuth() {
$s = "";
$login = "";
- if(isset($_SERVER['PHP_AUTH_USER'])) $login = "$_SERVER[PHP_AUTH_USER]:$_SERVER[PHP_AUTH_PW]@";
+ if(isset($_SERVER['PHP_AUTH_USER'])) $login = "$_SERVER[PHP_AUTH_USER]:$_SERVER[PHP_AUTH_PW]@";
- return Director::protocol() . $login . $_SERVER['HTTP_HOST'] . Director::baseURL();
- }
+ return Director::protocol() . $login . $_SERVER['HTTP_HOST'] . Director::baseURL();
+ }
/**
* Force the site to run on SSL.
@@ -926,7 +926,7 @@ public static function isDev($dontTouchDB = false) {
$result = $_GET['isDev'];
} else {
if($firstTimeCheckingGetVar && DB::connection_attempted()) {
- echo "<p style=\"padding: 3px; margin: 3px; background-color: orange;
+ echo "<p style=\"padding: 3px; margin: 3px; background-color: orange;
color: white; font-weight: bold\">Sorry, you can't use ?isDev=1 until your
Member and Group tables database are available. Perhaps your database
connection is failing?</p>";
View
@@ -171,8 +171,8 @@ public static function findByTagAndAttribute($content, $attributes) {
if($regexes) foreach($regexes as $regex) {
if(preg_match_all($regex, $content, $matches)) {
$result = array_merge_recursive($result, (isset($matches[2]) ? $matches[2] : $matches[1]));
- }
- }
+ }
+ }
return count($result) ? $result : null;
}
Oops, something went wrong.

0 comments on commit fc5dd29

Please sign in to comment.