From: <se...@us...> - 2009-10-30 15:10:02
|
Revision: 22759 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=22759&view=rev Author: sept_7 Date: 2009-10-30 15:09:54 +0000 (Fri, 30 Oct 2009) Log Message: ----------- [ENH] coding style avoir function in for loop, PHPCS Modified Paths: -------------- trunk/tiki-objectpermissions.php Modified: trunk/tiki-objectpermissions.php =================================================================== --- trunk/tiki-objectpermissions.php 2009-10-30 15:02:53 UTC (rev 22758) +++ trunk/tiki-objectpermissions.php 2009-10-30 15:09:54 UTC (rev 22759) @@ -348,10 +348,10 @@ foreach ($candidates['data'] as $perm) { $perm['label'] = tra($perm['permDesc']) . ' <em>(' . $perm['permName'] . ')</em>' . '<span style="display:none;">' . tra($perm['level'] . '</span>'); - for( $i = 0; $i < count($groupNames); $i++) { - $p = $displayedPermissions->has( $groupNames[$i], $perm['permName'] ) ? 'y' : 'n'; - $perm[$groupNames[$i] . '_hasPerm'] = $p; - $perm[$groupIndices[$i]] = $p; + foreach( $groupNames as $index => $groupName ) { + $p = $displayedPermissions->has( $groupName, $perm['permName'] ) ? 'y' : 'n'; + $perm[$groupName . '_hasPerm'] = $p; + $perm[$groupIndices[$index]] = $p; } if (($feature_filter === false || in_array( $perm['type'], $feature_filter)) && ($restrictions === false || in_array( $perm['permName'], $restrictions ))) { @@ -386,14 +386,13 @@ // Create JS to set up checkboxs (showing group inheritance) $js = ''; -for( $i = 0; $i < count($groupNames); $i++) { - - $groupName = addslashes($groupNames[$i]); +foreach( $groupNames as $groupName ) { + $groupName = addslashes($groupName); $beneficiaries = ''; - for( $j = 0; $j < count($groupInheritance); $j++) { - if (is_array($groupInheritance[$j]) && in_array($groupName, $groupInheritance[$j])) { + foreach( $groupInheritance as $index => $gi ) { + if ( is_array($gi) && in_array($groupName, $gi) ) { $beneficiaries .= !empty($beneficiaries) ? ',' : ''; - $beneficiaries .='input[name="perm['. addslashes($groupNames[$j]).'][]"]'; + $beneficiaries .='input[name="perm['. addslashes($groupNames[$index]).'][]"]'; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |