Skip to content

Commit 1f7fc1f

Browse files
author
Sam Minnee
committed
FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit. This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
1 parent 28bd939 commit 1f7fc1f

File tree

282 files changed

+4786
-2646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+4786
-2646
lines changed

_register_database.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
'title' => 'SQL Server 2008',
1919
'helperPath' => 'mssql/code/MSSQLDatabaseConfigurationHelper.php',
2020
'supported' => (function_exists('mssql_connect') || function_exists('sqlsrv_connect')),
21-
'missingExtensionText' => 'Neither the <a href="http://php.net/mssql">mssql</a> or <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a> PHP extensions are available. Please install or enable one of them and refresh this page.'
21+
'missingExtensionText' => 'Neither the <a href="http://php.net/mssql">mssql</a> or'
22+
. ' <a href="http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx">sqlsrv</a> PHP extensions are'
23+
. ' available. Please install or enable one of them and refresh this page.'
2224
)
2325
);
2426

@@ -28,7 +30,8 @@
2830
'title' => 'PostgreSQL 8.3+',
2931
'helperPath' => 'postgresql/code/PostgreSQLDatabaseConfigurationHelper.php',
3032
'supported' => function_exists('pg_query'),
31-
'missingExtensionText' => 'The <a href="http://php.net/pgsql">pgsql</a> PHP extension is not available. Please install or enable it and refresh this page.'
33+
'missingExtensionText' => 'The <a href="http://php.net/pgsql">pgsql</a> PHP extension is not available. Please'
34+
. ' install or enable it and refresh this page.'
3235
)
3336
);
3437

@@ -38,11 +41,15 @@
3841
'title' => 'SQLite 3.3+',
3942
'helperPath' => 'sqlite3/code/SQLiteDatabaseConfigurationHelper.php',
4043
'supported' => (class_exists('SQLite3') || class_exists('PDO')),
41-
'missingExtensionText' => 'The <a href="http://php.net/manual/en/book.sqlite3.php">SQLite3</a> and <a href="http://php.net/manual/en/book.pdo.php">PDO</a> classes are not available. Please install or enable one of them and refresh this page.',
44+
'missingExtensionText' => 'The <a href="http://php.net/manual/en/book.sqlite3.php">SQLite3</a> and'
45+
. ' <a href="http://php.net/manual/en/book.pdo.php">PDO</a> classes are not available. Please install or'
46+
. ' enable one of them and refresh this page.',
4247
'fields' => array(
4348
'path' => array(
44-
'title' => 'Database path<br /><small>Absolute path, writeable by the webserver user.<br />Recommended to be outside of your webroot</small>',
45-
'default' => realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . '.db'
49+
'title' => 'Database path<br /><small>Absolute path, writeable by the webserver user.<br />'
50+
. 'Recommended to be outside of your webroot</small>',
51+
'default' => realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR . 'assets'
52+
. DIRECTORY_SEPARATOR . '.db'
4653
),
4754
'database' => array(
4855
'title' => 'Database name',

admin/_config.php

+21-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,33 @@
1111
'cleanup_callback' => "sapphiremce_cleanup",
1212

1313
'use_native_selects' => true, // fancy selects are bug as of SS 2.3.0
14-
'valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]",
15-
'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]",
14+
'valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title"
15+
. "|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],"
16+
. "-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],"
17+
. "-sub[class],-sup[class],-blockquote[dir|class],"
18+
. "-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],"
19+
. "-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],"
20+
. "tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],"
21+
. "#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],"
22+
. "-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],"
23+
. "-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],"
24+
. "-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],"
25+
. "-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],"
26+
. "dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]",
27+
'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name"
28+
. "|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],"
29+
. "object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]",
1630
'spellchecker_rpc_url' => THIRDPARTY_DIR . '/tinymce-spellchecker/rpc.php'
1731
));
1832

1933
HtmlEditorConfig::get('cms')->enablePlugins('media', 'fullscreen', 'inlinepopups');
20-
HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => sprintf('../../../%s/tinymce_ssbuttons/editor_plugin_src.js', THIRDPARTY_DIR)));
34+
HtmlEditorConfig::get('cms')->enablePlugins(array(
35+
'ssbuttons' => sprintf('../../../%s/tinymce_ssbuttons/editor_plugin_src.js', THIRDPARTY_DIR)
36+
));
2137

2238
HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'styleselect');
23-
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'ssmedia', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator','code', 'fullscreen', 'separator');
39+
HtmlEditorConfig::get('cms')->addButtonsToLine(2,
40+
'ssmedia', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator','code', 'fullscreen', 'separator');
2441

2542
HtmlEditorConfig::get('cms')->removeButtons('tablecontrols');
2643
HtmlEditorConfig::get('cms')->addButtonsToLine(3, 'tablecontrols');

admin/code/AdminRootController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class AdminRootController extends Controller {
1313
/**
1414
* @var string
1515
* @config
16-
* The LeftAndMain child that will be used as the initial panel to display if none is selected (i.e. if you visit /admin)
16+
* The LeftAndMain child that will be used as the initial panel to display if none is selected (i.e. if you
17+
* visit /admin)
1718
*/
1819
static $default_panel = 'SecurityAdmin';
1920

admin/code/CMSBatchActionHandler.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ public function handleAction($request) {
8585
foreach($ids as $k => $v) if(!is_numeric($v)) unset($ids[$k]);
8686

8787
if($ids) {
88-
if(class_exists('Translatable') && Object::has_extension('SiteTree','Translatable')) Translatable::disable_locale_filter();
88+
if(class_exists('Translatable') && Object::has_extension('SiteTree','Translatable')) {
89+
Translatable::disable_locale_filter();
90+
}
8991

9092
$pages = DataObject::get(
9193
$this->recordClass,
@@ -96,7 +98,9 @@ public function handleAction($request) {
9698
)
9799
);
98100

99-
if(class_exists('Translatable') && Object::has_extension('SiteTree','Translatable')) Translatable::enable_locale_filter();
101+
if(class_exists('Translatable') && Object::has_extension('SiteTree','Translatable')) {
102+
Translatable::enable_locale_filter();
103+
}
100104

101105
if(Object::has_extension($this->recordClass, 'Versioned')) {
102106
// If we didn't query all the pages, then find the rest on the live site

admin/code/CMSMenu.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ protected static function menuitem_for_controller($controllerClass) {
7777
* @param string $code A unique identifier (used to create a CSS ID and its key in {@link $menu_items})
7878
* @param string $menuTitle The link's title in the CMS menu
7979
* @param string $url The url of the link
80-
* @param integer $priority The menu priority (sorting order) of the menu item. Higher priorities will be further left.
80+
* @param integer $priority The menu priority (sorting order) of the menu item. Higher priorities will be further
81+
* left.
8182
* @return boolean The result of the operation.
8283
*/
8384
public static function add_link($code, $menuTitle, $url, $priority = -1) {

admin/code/GroupImportForm.php

+12-9
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ public function __construct($controller, $name, $fields = null, $actions = null,
1717
if(!$fields) {
1818
$helpHtml = _t(
1919
'GroupImportForm.Help1',
20-
'<p>Import one or more groups in <em>CSV</em> format (comma-separated values). <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>'
20+
'<p>Import one or more groups in <em>CSV</em> format (comma-separated values).'
21+
. ' <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>'
2122
);
2223
$helpHtml .= _t(
2324
'GroupImportForm.Help2',
2425
'<div class="advanced">
2526
<h4>Advanced usage</h4>
2627
<ul>
2728
<li>Allowed columns: <em>%s</em></li>
28-
<li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the imported file</li>
29+
<li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the
30+
imported file</li>
2931
<li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li>
30-
<li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not cleared.</li>
32+
<li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not
33+
cleared.</li>
3134
</ul>
3235
</div>');
3336

@@ -48,12 +51,12 @@ public function __construct($controller, $name, $fields = null, $actions = null,
4851
$fileField->getValidator()->setAllowedExtensions(array('csv'));
4952
}
5053

51-
if(!$actions) $actions = new FieldList(
52-
$importAction = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'))
53-
);
54-
55-
$importAction->addExtraClass('ss-ui-button');
56-
54+
if(!$actions) {
55+
$action = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'));
56+
$action->addExtraClass('ss-ui-button');
57+
$actions = new FieldList($action);
58+
}
59+
5760
if(!$validator) $validator = new RequiredFields('CsvFile');
5861

5962
parent::__construct($controller, $name, $fields, $actions, $validator);

admin/code/LeftAndMain.php

+50-24
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ public function init() {
200200

201201
// if no alternate menu items have matched, return a permission error
202202
$messageSet = array(
203-
'default' => _t('LeftAndMain.PERMDEFAULT',"Please choose an authentication method and enter your credentials to access the CMS."),
204-
'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY',"I'm sorry, but you can't access that part of the CMS. If you want to log in as someone else, do so below"),
205-
'logInAgain' => _t('LeftAndMain.PERMAGAIN',"You have been logged out of the CMS. If you would like to log in again, enter a username and password below."),
203+
'default' => _t('LeftAndMain.PERMDEFAULT',
204+
"Please choose an authentication method and enter your credentials to access the CMS."),
205+
'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY',
206+
"I'm sorry, but you can't access that part of the CMS. If you want to log in as someone else, do"
207+
. " so below"),
208+
'logInAgain' => _t('LeftAndMain.PERMAGAIN',
209+
"You have been logged out of the CMS. If you would like to log in again, enter a username and"
210+
. " password below."),
206211
);
207212

208213
return Security::permissionFailure($this, $messageSet);
@@ -683,7 +688,9 @@ public function SiteTreeAsUL() {
683688
* Children, AllChildrenIncludingDeleted, or AllHistoricalChildren
684689
* @return String Nested unordered list with links to each page
685690
*/
686-
public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
691+
public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null,
692+
$filterFunction = null, $minNodeCount = 30) {
693+
687694
// Filter criteria
688695
$params = $this->request->getVar('q');
689696
if(isset($params['FilterClass']) && $filterClass = $params['FilterClass']){
@@ -696,7 +703,10 @@ public function getSiteTreeFor($className, $rootID = null, $childrenMethod = nul
696703
}
697704

698705
// Default childrenMethod and numChildrenMethod
699-
if(!$childrenMethod) $childrenMethod = ($filter && $filter->getChildrenMethod()) ? $filter->getChildrenMethod() : 'AllChildrenIncludingDeleted';
706+
if(!$childrenMethod) $childrenMethod = ($filter && $filter->getChildrenMethod())
707+
? $filter->getChildrenMethod()
708+
: 'AllChildrenIncludingDeleted';
709+
700710
if(!$numChildrenMethod) $numChildrenMethod = 'numChildren';
701711
if(!$filterFunction) $filterFunction = ($filter) ? array($filter, 'isPageIncluded') : null;
702712

@@ -714,7 +724,8 @@ public function getSiteTreeFor($className, $rootID = null, $childrenMethod = nul
714724

715725
// NOTE: SiteTree/CMSMain coupling :-(
716726
if(class_exists('SiteTree')) {
717-
SiteTree::prepopulate_permission_cache('CanEditType', $obj->markedNodeIDs(), 'SiteTree::can_edit_multiple');
727+
SiteTree::prepopulate_permission_cache('CanEditType', $obj->markedNodeIDs(),
728+
'SiteTree::can_edit_multiple');
718729
}
719730

720731
// getChildrenAsUL is a flexible and complex way of traversing the tree
@@ -789,20 +800,31 @@ public function updatetreenodes($request) {
789800
$ids = explode(',', $request->getVar('ids'));
790801
foreach($ids as $id) {
791802
$record = $this->getRecord($id);
792-
$recordController = ($this->stat('tree_class') == 'SiteTree') ? singleton('CMSPageEditController') : $this;
803+
$recordController = ($this->stat('tree_class') == 'SiteTree')
804+
? singleton('CMSPageEditController')
805+
: $this;
793806

794807
// Find the next & previous nodes, for proper positioning (Sort isn't good enough - it's not a raw offset)
795808
// TODO: These methods should really be in hierarchy - for a start it assumes Sort exists
796809
$next = $prev = null;
797810

798811
$className = $this->stat('tree_class');
799-
$next = DataObject::get($className)->filter('ParentID', $record->ParentID)->filter('Sort:GreaterThan', $record->Sort)->first();
812+
$next = DataObject::get($className)
813+
->filter('ParentID', $record->ParentID)
814+
->filter('Sort:GreaterThan', $record->Sort)
815+
->first();
816+
800817
if (!$next) {
801-
$prev = DataObject::get($className)->filter('ParentID', $record->ParentID)->filter('Sort:LessThan', $record->Sort)->reverse()->first();
818+
$prev = DataObject::get($className)
819+
->filter('ParentID', $record->ParentID)
820+
->filter('Sort:LessThan', $record->Sort)
821+
->reverse()
822+
->first();
802823
}
803824

804825
$link = Controller::join_links($recordController->Link("show"), $record->ID);
805-
$html = LeftAndMain_TreeNode::create($record, $link, $this->isCurrentPage($record))->forTemplate() . '</li>';
826+
$html = LeftAndMain_TreeNode::create($record, $link, $this->isCurrentPage($record))
827+
->forTemplate() . '</li>';
806828

807829
$data[$id] = array(
808830
'html' => $html,
@@ -874,7 +896,8 @@ public function savetreenode($request) {
874896
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
875897
$this->response->setStatusCode(
876898
403,
877-
_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to rearange the site tree. Your change was not saved.")
899+
_t('LeftAndMain.CANT_REORGANISE',
900+
"You do not have permission to rearange the site tree. Your change was not saved.")
878901
);
879902
return;
880903
}
@@ -889,7 +912,8 @@ public function savetreenode($request) {
889912
if(($parentID == '0' || $root == 'root') && !SiteConfig::current_site_config()->canCreateTopLevel()){
890913
$this->response->setStatusCode(
891914
403,
892-
_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to alter Top level pages. Your change was not saved.")
915+
_t('LeftAndMain.CANT_REORGANISE',
916+
"You do not have permission to alter Top level pages. Your change was not saved.")
893917
);
894918
return;
895919
}
@@ -905,8 +929,7 @@ public function savetreenode($request) {
905929
if(!$node) {
906930
$this->response->setStatusCode(
907931
500,
908-
_t(
909-
'LeftAndMain.PLEASESAVE',
932+
_t('LeftAndMain.PLEASESAVE',
910933
"Please Save Page: This page could not be upated because it hasn't been saved yet."
911934
)
912935
);
@@ -933,7 +956,8 @@ public function savetreenode($request) {
933956
}
934957
}
935958

936-
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')));
959+
$this->response->addHeader('X-Status',
960+
rawurlencode(_t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')));
937961
}
938962

939963
// Update sorting
@@ -950,11 +974,13 @@ public function savetreenode($request) {
950974
// Nodes that weren't "actually moved" shouldn't be registered as
951975
// having been edited; do a direct SQL update instead
952976
++$counter;
953-
DB::query(sprintf("UPDATE \"%s\" SET \"Sort\" = %d WHERE \"ID\" = '%d'", $className, $counter, $id));
977+
DB::query(sprintf("UPDATE \"%s\" SET \"Sort\" = %d WHERE \"ID\" = '%d'",
978+
$className, $counter, $id));
954979
}
955980
}
956981

957-
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')));
982+
$this->response->addHeader('X-Status',
983+
rawurlencode(_t('LeftAndMain.REORGANISATIONSUCCESSFUL', 'Reorganised the site tree successfully.')));
958984
}
959985

960986
return Convert::raw2json($statusUpdates);
@@ -1527,7 +1553,8 @@ public function __construct($params = null) {
15271553
// We need to recurse up the tree,
15281554
// finding ParentIDs for each ID until we run out of parents
15291555
while (!empty($parents)) {
1530-
$res = DB::query('SELECT "ParentID", "ID" FROM "SiteTree" WHERE "ID" in ('.implode(',',array_keys($parents)).')');
1556+
$res = DB::query('SELECT "ParentID", "ID" FROM "SiteTree"'
1557+
. ' WHERE "ID" in ('.implode(',',array_keys($parents)).')');
15311558
$parents = array();
15321559

15331560
foreach($res as $row) {
@@ -1623,12 +1650,11 @@ public function __construct($obj, $link = null, $isCurrent = false) {
16231650
*/
16241651
public function forTemplate() {
16251652
$obj = $this->obj;
1626-
return "<li id=\"record-$obj->ID\" data-id=\"$obj->ID\" data-pagetype=\"$obj->ClassName\" class=\"" . $this->getClasses() . "\">" .
1627-
"<ins class=\"jstree-icon\">&nbsp;</ins>" .
1628-
"<a href=\"" . $this->getLink() . "\" title=\"" .
1629-
_t('LeftAndMain.PAGETYPE','Page type: ') .
1630-
"$obj->class\" ><ins class=\"jstree-icon\">&nbsp;</ins><span class=\"text\">" . ($obj->TreeTitle).
1631-
"</span></a>";
1653+
return "<li id=\"record-$obj->ID\" data-id=\"$obj->ID\" data-pagetype=\"$obj->ClassName\" class=\""
1654+
. $this->getClasses() . "\">" . "<ins class=\"jstree-icon\">&nbsp;</ins>"
1655+
. "<a href=\"" . $this->getLink() . "\" title=\"" . _t('LeftAndMain.PAGETYPE','Page type: ')
1656+
. "$obj->class\" ><ins class=\"jstree-icon\">&nbsp;</ins><span class=\"text\">" . ($obj->TreeTitle)
1657+
. "</span></a>";
16321658
}
16331659

16341660
public function getClasses() {

0 commit comments

Comments
 (0)