:eyes: Some source code analysis tools can help to find opportunities for improving software components.
:thought_balloon: I propose to increase the usage of combined operators accordingly.
diff --git a/admin/inc/ZipArchive.php b/admin/inc/ZipArchive.php
index 22db69ad..1d83a269 100644
--- a/admin/inc/ZipArchive.php
+++ b/admin/inc/ZipArchive.php
@@ -175,7 +175,7 @@ class ZipArchive {
//create temp dir
$tempDir = sys_get_temp_dir();
if( $tempDir[strlen($tempDir)-1] != DIRECTORY_SEPARATOR ){
- $tempDir = $tempDir . DIRECTORY_SEPARATOR;
+ $tempDir .= DIRECTORY_SEPARATOR;
}
$this->tempDirPath = $tempDir.__CLASS__. uniqid();
if( @mkdir($this->tempDirPath) !== true ) {
diff --git a/admin/inc/assets.php b/admin/inc/assets.php
index 43321664..6cb2a648 100644
--- a/admin/inc/assets.php
+++ b/admin/inc/assets.php
@@ -378,7 +378,7 @@ function queue_script($handle,$where){
}
$GS_scripts[$handle]['load'] = true;
- $GS_scripts[$handle]['where'] = $GS_scripts[$handle]['where'] | $where;
+ $GS_scripts[$handle]['where'] |= $where;
}
}
@@ -396,7 +396,7 @@ function dequeue_script($handle, $where){
global $GS_scripts;
if (array_key_exists($handle, $GS_scripts)){
$GS_scripts[$handle]['load'] = false;
- $GS_scripts[$handle]['where'] = $GS_scripts[$handle]['where'] & ~ $where;
+ $GS_scripts[$handle]['where'] &= ~ $where;
}
}
@@ -491,7 +491,7 @@ function queue_style($handle,$where = 1){
}
$GS_styles[$handle]['load'] = true;
- $GS_styles[$handle]['where'] = $GS_styles[$handle]['where'] | $where;
+ $GS_styles[$handle]['where'] |= $where;
}
}
@@ -509,7 +509,7 @@ function dequeue_style($handle,$where){
global $GS_styles;
if (array_key_exists($handle, $GS_styles)){
$GS_styles[$handle]['load'] = false;
- $GS_styles[$handle]['where'] = $GS_styles[$handle]['where'] & ~$where;
+ $GS_styles[$handle]['where'] &= ~$where;
}
}
diff --git a/admin/inc/basic.php b/admin/inc/basic.php
index c970df7f..7ad5371d 100644
--- a/admin/inc/basic.php
+++ b/admin/inc/basic.php
@@ -547,7 +547,7 @@ function createPageXml($title, $url = null, $data = array(), $overwrite = false)
// If overwrite is false do not use existing slugs, get next incremental slug, eg. "slug-count"
if ( !$overwrite && (file_exists(GSDATAPAGESPATH . $url .".xml") || in_array($url,$reservedSlugs)) ) {
list($newfilename,$count) = getNextFileName(GSDATAPAGESPATH,$url.'.xml');
- $url = $url .'-'. $count;
+ $url .= '-'. $count;
// die($url.' '.$newfilename.' '.$count);
}
diff --git a/admin/inc/caching_functions.php b/admin/inc/caching_functions.php
index ab84c4a6..8b8ad5a9 100644
--- a/admin/inc/caching_functions.php
+++ b/admin/inc/caching_functions.php
@@ -273,7 +273,7 @@ function fixupPageFilenames($path,$file,$id,$pageXml){
// get slug from filename and increment if exists
// if(file_exists(GSDATAPAGESPATH . $id .".xml")){
// list($id,$count) = getNextFileName(GSDATAPAGESPATH,$id.'.xml');
- // $id = $id .'-'. $count;
+ // $id .= '-'. $count;
// }
debugLog(__FUNCTION__ . ' ' .$id . ' -> ' . $file);
backup_datafile(GSDATAPAGESPATH.$file);
diff --git a/admin/inc/imagemanipulation.php b/admin/inc/imagemanipulation.php
index 2b776791..f9cbdb17 100644
--- a/admin/inc/imagemanipulation.php
+++ b/admin/inc/imagemanipulation.php
@@ -114,15 +114,15 @@ class ImageManipulation {
$cropsize = 0;
if($this->crop == true){
- // $size = $size*2;
+ // $size *= 2;
list($image_width,$image_height) = $this->getCropSize();
$cropsize += round( ($image_width * $image_height * ($image_bits * $image_channels) / 8) );
}
// print_r('src:'.toBytesShorthand($size,'m',true)."<br>");
// print_r('crop:'.toBytesShorthand($cropsize,'m',true)."<br>");
- $size = $size + $cropsize;
- return $size = $size * $adjust;
+ $size += $cropsize;
+ return $size *= $adjust;
}
/**
diff --git a/admin/inc/template_functions.php b/admin/inc/template_functions.php
index 170ee4ad..ca0d4b63 100644
--- a/admin/inc/template_functions.php
+++ b/admin/inc/template_functions.php
@@ -405,7 +405,7 @@ function clone_page($id){
$newxml = getPageXML($id);
$newurl = getFileName($cloneurl);
$newxml->url = getFileName($cloneurl);
- $newxml->title = $newxml->title.' ['.sprintf(i18n_r('COPY_N',i18n_r('COPY')),$count).']';
+ $newxml->title .= ' ['.sprintf(i18n_r('COPY_N',i18n_r('COPY')),$count).']';
$newxml->pubDate = date('r');
$status = XMLsave($newxml, GSDATAPAGESPATH.$cloneurl);
if($status) return $newurl;
@@ -926,7 +926,7 @@ function get_link_menu_array($parent='', $array=array(), $level=0) {
foreach ($items as $page) {
$dash="";
if ($page['parent'] != '') {
- $page['parent'] = $page['parent']."/";
+ $page['parent'] .= "/";
}
for ($i=0;$i<=$level-1;$i++){
if ($i!=$level-1){
@@ -1025,7 +1025,7 @@ function getPagesRow($page,$level,$index,$parent,$children){
// add expanders in php
// $expander = '<span class="tree-expander tree-expander-expanded"></span>';
// $expander = $isParent ? $expander : '<span class="tree-indent"></span>';
- // $indentation = $indentation . $expander;
+ // $indentation .= $expander;
// depth level identifiers
$class = 'depth-'.$level;
@@ -1255,7 +1255,7 @@ function get_pages_menu($parent = '',$menu = '',$level = '') {
$depth = $page['depth']; continue;
}
else if(($page['depth'] == $depth)) return $menu; // we are back to starting depth so stop
- $level = $level - ($depth+1);
+ $level -= $depth + 1;
}
// provide special row if this is a missing parent
@@ -1300,7 +1300,7 @@ function get_pages_menu_dropdown($parentitem, $menu, $level, $id = null, $idleve
$dash="";
if ($page['parent'] != '') {
- $page['parent'] = $page['parent']."/";
+ $page['parent'] .= "/";
}
for ($i=0;$i<=$level-1;$i++){
diff --git a/admin/theme-edit.php b/admin/theme-edit.php
index fb89e51f..0670036a 100644
--- a/admin/theme-edit.php
+++ b/admin/theme-edit.php
@@ -210,7 +210,7 @@ function editor_array2ul($array, $hideEmpty = true, $recurse = true) {
}
}
- $out=$out."</ul>";
+ $out .= "</ul>";
return $out;
}
diff --git a/admin/upload.php b/admin/upload.php
index 0b2e7dda..1e878828 100644
--- a/admin/upload.php
+++ b/admin/upload.php
@@ -227,7 +227,7 @@ $isUnixHost = !hostIsWindows();
$ss = @stat($path . $file);
$filesArray[$count]['date'] = @date('M j, Y',$ss['ctime']);
$filesArray[$count]['size'] = fSize($ss['size']);
- $totalsize = $totalsize + $ss['size'];
+ $totalsize += $ss['size'];
$count++;
}
}