Permalink
Browse files

Add codesniffer that ensures indentation is with tabs.

  • Loading branch information...
1 parent ed11970 commit b0121b541c0d2595e8b1c05bdfe3333ad4251b07 @simonwelsh simonwelsh committed Dec 8, 2012
Showing with 3,117 additions and 3,103 deletions.
  1. +2 −1 .travis.yml
  2. +9 −9 admin/code/CMSProfileController.php
  3. +1 −1 admin/code/ModelAdmin.php
  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. +11 −11 control/Director.php
  15. +2 −2 control/HTTP.php
  16. +24 −24 control/HTTPRequest.php
  17. +24 −24 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. +215 −215 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. +14 −14 email/Mailer.php
  34. +48 −48 filesystem/GD.php
  35. +1 −1 forms/AjaxUniqueTextField.php
  36. +1 −1 forms/CheckboxSetField.php
  37. +2 −2 forms/CompositeField.php
  38. +1 −1 forms/CreditCardField.php
  39. +48 −48 forms/DateField.php
  40. +7 −7 forms/FieldGroup.php
  41. +4 −4 forms/Form.php
  42. +9 −9 forms/FormField.php
  43. +5 −5 forms/HtmlEditorField.php
  44. +2 −2 forms/NumericField.php
  45. +6 −6 forms/PhoneNumberField.php
  46. +7 −7 forms/RequiredFields.php
  47. +1 −1 forms/gridfield/GridField.php
  48. +0 −1 javascript/GridField.js
  49. +5 −5 javascript/HtmlEditorField.js
  50. +2 −2 javascript/i18n.js
  51. +2 −2 javascript/jquery-ondemand/jquery.ondemand.js
  52. +23 −23 javascript/tree/tree.js
  53. +16 −16 model/DataList.php
  54. +79 −79 model/DataObject.php
  55. +72 −72 model/DataQuery.php
  56. +3 −3 model/Database.php
  57. +2 −2 model/DatabaseAdmin.php
  58. +8 −8 model/HasManyList.php
  59. +13 −13 model/Hierarchy.php
  60. +11 −11 model/ManyManyList.php
  61. +22 −22 model/MySQLDatabase.php
  62. +5 −5 model/SQLQuery.php
  63. +1 −1 model/Transliterator.php
  64. +4 −4 model/Versioned.php
  65. +5 −5 model/fieldtypes/Date.php
  66. +1 −1 model/fieldtypes/Text.php
  67. +4 −4 model/fieldtypes/Varchar.php
  68. +2 −2 parsers/BBCodeParser.php
  69. +811 −812 parsers/HTML/HTMLBBCodeParser.php
  70. +4 −4 search/SearchContext.php
  71. +151 −151 security/Authenticator.php
  72. +3 −3 security/Group.php
  73. +21 −21 security/Member.php
  74. +103 −103 security/MemberAuthenticator.php
  75. +8 −8 security/MemberLoginForm.php
  76. +2 −2 security/Permission.php
  77. +2 −2 security/PermissionCheckboxSetField.php
  78. +31 −31 security/Security.php
  79. +3 −3 tests/api/RestfulServiceTest.php
  80. +18 −18 tests/behat/features/bootstrap/FeatureContext.php
  81. +72 −72 tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php
  82. +378 −378 tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php
  83. +13 −13 tests/bootstrap.php
  84. +6 −6 tests/control/HTTPTest.php
  85. +1 −1 tests/core/ArrayDataTest.php
  86. +1 −1 tests/core/manifest/fixtures/namespaced_classmanifest/module/classes/ClassB.php
  87. +1 −1 tests/dev/CsvBulkLoaderTest.php
  88. +10 −10 tests/forms/FileFieldTest.php
  89. +2 −2 tests/forms/RequirementsTest.php
  90. +1 −1 tests/forms/uploadfield/UploadFieldTest.php
  91. +2 −2 tests/injector/testservices/SampleService.php
  92. +5 −5 tests/javascript/TreeDropDownField/TreeDropdownField.js
  93. +0 −1 tests/model/ComponentSetTest.php
  94. +2 −2 tests/model/DataListTest.php
  95. +0 −1 tests/model/DataObjectTest.php
  96. +8 −8 tests/model/MoneyTest.php
  97. +4 −4 tests/model/PaginatedListTest.php
  98. +5 −5 tests/model/VersionedTest.php
  99. +18 −0 tests/phpcs/tabs.xml
  100. +22 −22 tests/search/SearchContextTest.php
  101. +67 −67 tests/security/GroupTest.php
  102. +2 −2 tests/security/MemberTest.php
  103. +3 −3 tests/view/ViewableDataTest.php
  104. +1 −1 view/ArrayData.php
  105. +8 −8 view/Requirements.php
  106. +2 −2 view/SSTemplateParser.php.inc
  107. +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:
@@ -26,15 +26,15 @@ public function getEditForm($id = null, $fields = null) {
$form->Fields()->push(new HiddenField('ID', null, Member::currentUserID()));
$form->Actions()->push(
FormAction::create('save',_t('CMSMain.SAVE', 'Save'))
- ->addExtraClass('ss-ui-button ss-ui-action-constructive')
- ->setAttribute('data-icon', 'accept')
- ->setUseButtonTag(true)
- );
- $form->Actions()->removeByName('delete');
- $form->setValidator(new Member_Validator());
- $form->setTemplate('Form');
- $form->setAttribute('data-pjax-fragment', null);
- if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
+ ->addExtraClass('ss-ui-button ss-ui-action-constructive')
+ ->setAttribute('data-icon', 'accept')
+ ->setUseButtonTag(true)
+ );
+ $form->Actions()->removeByName('delete');
+ $form->setValidator(new Member_Validator());
+ $form->setTemplate('Form');
+ $form->setAttribute('data-pjax-fragment', null);
+ if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->addExtraClass('member-profile-form root-form cms-edit-form cms-panel-padded center');
return $form;
@@ -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
@@ -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) {
@@ -301,7 +301,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
@@ -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;
@@ -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 {
@@ -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
@@ -348,8 +348,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;
}
@@ -630,21 +630,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.
@@ -843,7 +843,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;
}
@@ -296,21 +296,21 @@ public function removeHeader($header) {
public function getURL($includeGetVars = false) {
$url = ($this->getExtension()) ? $this->url . '.' . $this->getExtension() : $this->url;
- if ($includeGetVars) {
- // if we don't unset $vars['url'] we end up with /my/url?url=my/url&foo=bar etc
-
- $vars = $this->getVars();
- unset($vars['url']);
+ if ($includeGetVars) {
+ // if we don't unset $vars['url'] we end up with /my/url?url=my/url&foo=bar etc
+
+ $vars = $this->getVars();
+ unset($vars['url']);
- if (count($vars)) {
- $url .= '?' . http_build_query($vars);
- }
- }
- else if(strpos($url, "?") !== false) {
- $url = substr($url, 0, strpos($url, "?"));
- }
+ if (count($vars)) {
+ $url .= '?' . http_build_query($vars);
+ }
+ }
+ else if(strpos($url, "?") !== false) {
+ $url = substr($url, 0, strpos($url, "?"));
+ }
- return $url;
+ return $url;
}
/**
@@ -501,9 +501,9 @@ public function allParams() {
* @return string
*/
public function shiftAllParams() {
- $keys = array_keys($this->allParams);
- $values = array_values($this->allParams);
- $value = array_shift($values);
+ $keys = array_keys($this->allParams);
+ $values = array_values($this->allParams);
+ $value = array_shift($values);
// push additional unparsed URL parts onto the parameter stack
if(array_key_exists($this->unshiftedButParsedParts, $this->dirParts)) {
@@ -636,10 +636,10 @@ public function allParsed() {
*/
public function getIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
- //check ip from share internet
+ //check ip from share internet
return $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- //to check ip is pass from proxy
+ //to check ip is pass from proxy
return $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif(isset($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
@@ -655,12 +655,12 @@ public function getIP() {
* @return array
*/
public function getAcceptMimetypes($includeQuality = false) {
- $mimetypes = array();
- $mimetypesWithQuality = explode(',',$this->getHeader('Accept'));
- foreach($mimetypesWithQuality as $mimetypeWithQuality) {
- $mimetypes[] = ($includeQuality) ? $mimetypeWithQuality : preg_replace('/;.*/', '', $mimetypeWithQuality);
- }
- return $mimetypes;
+ $mimetypes = array();
+ $mimetypesWithQuality = explode(',',$this->getHeader('Accept'));
+ foreach($mimetypesWithQuality as $mimetypeWithQuality) {
+ $mimetypes[] = ($includeQuality) ? $mimetypeWithQuality : preg_replace('/;.*/', '', $mimetypeWithQuality);
+ }
+ return $mimetypes;
}
/**
Oops, something went wrong.

0 comments on commit b0121b5

Please sign in to comment.