Passed
Pull Request — master (#580)
by Michael
17:40
created
xoops_lib/Xoops.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 
142 142
         $this->paths['www'] = array($root, $url);
143 143
         $this->paths['var'] = array($var, null);
144
-        $this->paths['lib'] = array($lib, $url . '/browse.php');
145
-        $this->paths['XOOPS'] = array($lib, $url . '/browse.php');
144
+        $this->paths['lib'] = array($lib, $url.'/browse.php');
145
+        $this->paths['XOOPS'] = array($lib, $url.'/browse.php');
146 146
         $this->paths['assets'] = array(\XoopsBaseConfig::get('asset-path'), \XoopsBaseConfig::get('asset-url'));
147
-        $this->paths['images'] = array($root . '/images', $url . '/images');
148
-        $this->paths['language'] = array($root . '/language', $url . '/language');
149
-        $this->paths['locale'] = array($root . '/locale', $url . '/locale');
147
+        $this->paths['images'] = array($root.'/images', $url.'/images');
148
+        $this->paths['language'] = array($root.'/language', $url.'/language');
149
+        $this->paths['locale'] = array($root.'/locale', $url.'/locale');
150 150
         $this->paths['media'] = array(\XoopsBaseConfig::get('media-path'), \XoopsBaseConfig::get('media-url'));
151
-        $this->paths['modules'] = array($root . '/modules', $url . '/modules');
151
+        $this->paths['modules'] = array($root.'/modules', $url.'/modules');
152 152
         $this->paths['themes'] = array(\XoopsBaseConfig::get('themes-path'), \XoopsBaseConfig::get('themes-url'));
153 153
         $this->paths['uploads'] = array(\XoopsBaseConfig::get('uploads-path'), \XoopsBaseConfig::get('uploads-url'));
154 154
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     public function path($url, $virtual = false)
374 374
     {
375 375
         $url = $this->normalizePath($url);
376
-        $rootPath = $this->normalizePath(\XoopsBaseConfig::get('root-path') . '/');
376
+        $rootPath = $this->normalizePath(\XoopsBaseConfig::get('root-path').'/');
377 377
         if (0 === strpos($url, $rootPath)) {
378 378
             $url = substr($url, strlen($rootPath));
379 379
         }
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
             list($root, $path) = array('www', $url);
386 386
         }
387 387
         if (!$virtual) { // Returns a physical path
388
-            $path = $this->paths[$root][0] . '/' . $path;
388
+            $path = $this->paths[$root][0].'/'.$path;
389 389
             //$path = str_replace('/', DIRECTORY_SEPARATOR, $path);
390 390
             return $path;
391 391
         }
392
-        return !isset($this->paths[$root][1]) ? '' : ($this->paths[$root][1] . '/' . $path);
392
+        return !isset($this->paths[$root][1]) ? '' : ($this->paths[$root][1].'/'.$path);
393 393
     }
394 394
 
395 395
     /**
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
         }
438 438
         if (!empty($params)) {
439 439
             foreach ($params as $k => $v) {
440
-                $params[$k] = $k . '=' . rawurlencode($v);
440
+                $params[$k] = $k.'='.rawurlencode($v);
441 441
             }
442
-            $url .= '?' . implode('&', $params);
442
+            $url .= '?'.implode('&', $params);
443 443
         }
444 444
         return $url;
445 445
     }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
521 521
             }
522 522
             if (isset($_SERVER['QUERY_STRING'])) {
523
-                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
523
+                $_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
524 524
             }
525 525
         }
526 526
     }
@@ -560,18 +560,18 @@  discard block
 block discarded – undo
560 560
         if ($matched) {
561 561
             $names = array('tpl_name', 'type', 'module', 'file');
562 562
             $ret = array();
563
-            for ($i=0; $i<4; ++$i) {
563
+            for ($i = 0; $i < 4; ++$i) {
564 564
                 $ret[$names[$i]] = $parts[$i];
565 565
             }
566 566
         } else {
567 567
             // this should be eliminated
568
-            $this->events()->triggerEvent('debug.log', "Sloppy template: " . $tpl_name);
568
+            $this->events()->triggerEvent('debug.log', "Sloppy template: ".$tpl_name);
569 569
             $ret = array();
570 570
             $ret['type'] = $this->isAdminSide ? 'admin' : 'module';
571 571
             $info = explode(':', $tpl_name);
572 572
             if (count($info) == 2) {
573 573
                 $ret['type'] = $info[0];
574
-                $tpl_name = str_replace($ret['type'] . ':', '', $tpl_name);
574
+                $tpl_name = str_replace($ret['type'].':', '', $tpl_name);
575 575
             }
576 576
 
577 577
             if ($ret['type'] === 'db') {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
                     $ret['module'] = $this->module->getVar('dirname', 'n');
591 591
                 }
592 592
             }
593
-            $ret['tpl_name'] = $ret['type'] . ':' . $ret['module'] . '/' . $ret['file'];
593
+            $ret['tpl_name'] = $ret['type'].':'.$ret['module'].'/'.$ret['file'];
594 594
         }
595 595
 
596 596
         return $ret;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             $this->events()->triggerEvent('system.class.gui.header');
629 629
             $cpanelTheme = isset($xoopsConfig['cpanel']) ? $xoopsConfig['cpanel'] : 'default';
630 630
             include_once $this->path("modules/system/themes/{$cpanelTheme}/{$cpanelTheme}.php");
631
-            $cpanelClass = 'XoopsGui' . ucfirst($cpanelTheme);
631
+            $cpanelClass = 'XoopsGui'.ucfirst($cpanelTheme);
632 632
             $gui = new $cpanelClass();
633 633
             $gui->header();
634 634
         } else {
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
                 $smarty = $repeat = null;
639 639
                 $this->theme()->headContent(
640 640
                     null,
641
-                    "<base href='" . \XoopsBaseConfig::get('url') . '/modules/'
642
-                    . $this->getConfig('startpage') . "/' />",
641
+                    "<base href='".\XoopsBaseConfig::get('url').'/modules/'
642
+                    . $this->getConfig('startpage')."/' />",
643 643
                     $smarty,
644 644
                     $repeat
645 645
                 );
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         $this->events()->triggerEvent('core.footer.start');
687 687
 
688 688
         if (!headers_sent()) {
689
-            header('Content-Type:text/html; charset=' . XoopsLocale::getCharset());
689
+            header('Content-Type:text/html; charset='.XoopsLocale::getCharset());
690 690
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
691 691
             header('Cache-Control: private, no-cache');
692 692
             header('Pragma: no-cache');
@@ -1014,10 +1014,10 @@  discard block
 block discarded – undo
1014 1014
             }
1015 1015
         }
1016 1016
         if (XoopsLoad::fileExists(
1017
-            $hnd_file = \XoopsBaseConfig::get('root-path') . "/modules/{$module_dir}/class/form/{$name}.php"
1017
+            $hnd_file = \XoopsBaseConfig::get('root-path')."/modules/{$module_dir}/class/form/{$name}.php"
1018 1018
         )) {
1019 1019
             include_once $hnd_file;
1020
-            $class = ucfirst(strtolower($module_dir)) . ucfirst($name) . 'Form';
1020
+            $class = ucfirst(strtolower($module_dir)).ucfirst($name).'Form';
1021 1021
             if (class_exists($class)) {
1022 1022
                 $instance = new $class($obj);
1023 1023
                 if ($instance instanceof \Xoops\Form\Form) {
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         if ((empty($domain) || 'global' === $domain)) {
1064 1064
             $path = '';
1065 1065
         } else {
1066
-            $path = (is_array($domain)) ? array_shift($domain) . '/' : "modules/{$domain}/";
1066
+            $path = (is_array($domain)) ? array_shift($domain).'/' : "modules/{$domain}/";
1067 1067
         }
1068 1068
         $path .= 'language';
1069 1069
 
@@ -1205,9 +1205,9 @@  discard block
 block discarded – undo
1205 1205
         $xoopsConfigMetaFooter = $this->getConfigs();
1206 1206
 
1207 1207
         if (!headers_sent()) {
1208
-            header('Content-Type:text/html; charset=' . XoopsLocale::getCharset());
1208
+            header('Content-Type:text/html; charset='.XoopsLocale::getCharset());
1209 1209
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
1210
-            header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
1210
+            header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
1211 1211
             header(
1212 1212
                 'Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0'
1213 1213
             );
@@ -1216,28 +1216,28 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
         echo "<!DOCTYPE html>\n";
1218 1218
         $xoops_url = \XoopsBaseConfig::get('url');
1219
-        echo '<html lang="' . XoopsLocale::getLangCode() . '">
1219
+        echo '<html lang="'.XoopsLocale::getLangCode().'">
1220 1220
               <head>
1221 1221
               <meta charset="utf-8">
1222 1222
               <meta http-equiv="X-UA-Compatible" content="IE=edge">
1223 1223
               <meta name="viewport" content="width=device-width, initial-scale=1">
1224
-              <meta name="robots" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_robots']) . '" />
1225
-              <meta name="keywords" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_keywords']) . '" />
1226
-              <meta name="description" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_description']) . '" />
1227
-              <meta name="rating" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_rating']) . '" />
1228
-              <meta name="author" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_author']) . '" />
1224
+              <meta name="robots" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_robots']).'" />
1225
+              <meta name="keywords" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_keywords']).'" />
1226
+              <meta name="description" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_description']).'" />
1227
+              <meta name="rating" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_rating']).'" />
1228
+              <meta name="author" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_author']).'" />
1229 1229
               <meta name="generator" content="XOOPS" />
1230
-              <title>' . htmlspecialchars($this->getConfig('sitename')) . '</title>'
1230
+              <title>' . htmlspecialchars($this->getConfig('sitename')).'</title>'
1231 1231
             . $this->theme->renderBaseAssets();
1232 1232
 
1233 1233
         $locale = $this->getConfig('locale');
1234
-        if (XoopsLoad::fileExists($this->path('locale/' . $locale . '/style.css'))) {
1235
-            echo '<link rel="stylesheet" type="text/css" media="all" href="' . $xoops_url
1236
-                . '/locale/' . $locale . '/style.css" />';
1234
+        if (XoopsLoad::fileExists($this->path('locale/'.$locale.'/style.css'))) {
1235
+            echo '<link rel="stylesheet" type="text/css" media="all" href="'.$xoops_url
1236
+                . '/locale/'.$locale.'/style.css" />';
1237 1237
         }
1238 1238
         $themecss = $this->getCss($this->getConfig('theme_set'));
1239 1239
         if ($themecss) {
1240
-            echo '<link rel="stylesheet" type="text/css" media="all" href="' . $themecss . '" />';
1240
+            echo '<link rel="stylesheet" type="text/css" media="all" href="'.$themecss.'" />';
1241 1241
         }
1242 1242
         if ($closehead) {
1243 1243
             echo '</head><body>';
@@ -1337,13 +1337,13 @@  discard block
 block discarded – undo
1337 1337
         foreach ($hiddens as $name => $value) {
1338 1338
             if (is_array($value)) {
1339 1339
                 foreach ($value as $caption => $newvalue) {
1340
-                    $str_hiddens .= '<input type="radio" name="' . $name . '" value="'
1341
-                        . htmlspecialchars($newvalue) . '" > ' . $caption . NWLINE;
1340
+                    $str_hiddens .= '<input type="radio" name="'.$name.'" value="'
1341
+                        . htmlspecialchars($newvalue).'" > '.$caption.NWLINE;
1342 1342
                 }
1343
-                $str_hiddens .= '<br />' . NWLINE;
1343
+                $str_hiddens .= '<br />'.NWLINE;
1344 1344
             } else {
1345
-                $str_hiddens .= '<input type="hidden" name="' . $name . '" value="'
1346
-                    . htmlspecialchars($value) . '" />' . NWLINE;
1345
+                $str_hiddens .= '<input type="hidden" name="'.$name.'" value="'
1346
+                    . htmlspecialchars($value).'" />'.NWLINE;
1347 1347
             }
1348 1348
         }
1349 1349
         if ($addtoken != false) {
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
         $url = trim($url);
1456 1456
         if ($url != '') {
1457 1457
             if (!preg_match('/^(https?|ftps?|ed2k)\:\/\//i', $url)) {
1458
-                $url = 'http://' . $url;
1458
+                $url = 'http://'.$url;
1459 1459
             }
1460 1460
         }
1461 1461
         return $url;
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
         )));
1525 1525
         $this->setTpl($this->theme()->template);
1526 1526
         $this->tpl()->assign(array(
1527
-            'xoops_theme'      => $theme, 'xoops_imageurl' => \XoopsBaseConfig::get('themes-url') . '/' . $theme . '/',
1527
+            'xoops_theme'      => $theme, 'xoops_imageurl' => \XoopsBaseConfig::get('themes-url').'/'.$theme.'/',
1528 1528
             'xoops_themecss'   => $this->getCss($theme),
1529 1529
             'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES),
1530 1530
             'xoops_sitename'   => htmlspecialchars($this->getConfig('sitename'), ENT_QUOTES),
@@ -1536,8 +1536,8 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
         $this->tpl()->assign('time', (int)($time));
1538 1538
         if (!empty($_SERVER['REQUEST_URI']) && $addredirect && strstr($url, 'user.php')) {
1539
-            $joiner = (false===strpos($url, '?')) ? '?' : '&amp;';
1540
-            $url .= $joiner . 'xoops_redirect=' . urlencode($_SERVER['REQUEST_URI']);
1539
+            $joiner = (false === strpos($url, '?')) ? '?' : '&amp;';
1540
+            $url .= $joiner.'xoops_redirect='.urlencode($_SERVER['REQUEST_URI']);
1541 1541
         }
1542 1542
         $url = preg_replace("/&amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
1543 1543
         $this->tpl()->assign('url', $url);
@@ -1601,25 +1601,25 @@  discard block
 block discarded – undo
1601 1601
         }
1602 1602
         $xoops_theme_path = \XoopsBaseConfig::get('themes-path');
1603 1603
         $xoops_theme_url = \XoopsBaseConfig::get('themes-url');
1604
-        if (is_dir($xoops_theme_path . '/' . $theme)) {
1605
-            if (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/' . $str_css)) {
1606
-                return $xoops_theme_url . '/' . $theme . '/' . $str_css;
1607
-            } elseif (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/style.css')) {
1608
-                return $xoops_theme_url . '/' . $theme . '/style.css';
1604
+        if (is_dir($xoops_theme_path.'/'.$theme)) {
1605
+            if (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/'.$str_css)) {
1606
+                return $xoops_theme_url.'/'.$theme.'/'.$str_css;
1607
+            } elseif (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/style.css')) {
1608
+                return $xoops_theme_url.'/'.$theme.'/style.css';
1609 1609
             }
1610 1610
         }
1611
-        if (is_dir($xoops_theme_path . '/' . $theme . '/css')) {
1612
-            if (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/css/' . $str_css)) {
1613
-                return $xoops_theme_url . '/' . $theme . '/css/' . $str_css;
1614
-            } elseif (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/css/style.css')) {
1615
-                return $xoops_theme_url . '/' . $theme . '/css/style.css';
1611
+        if (is_dir($xoops_theme_path.'/'.$theme.'/css')) {
1612
+            if (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/css/'.$str_css)) {
1613
+                return $xoops_theme_url.'/'.$theme.'/css/'.$str_css;
1614
+            } elseif (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/css/style.css')) {
1615
+                return $xoops_theme_url.'/'.$theme.'/css/style.css';
1616 1616
             }
1617 1617
         }
1618
-        if (is_dir($xoops_theme_path . '/' . $theme . '/assets/css')) {
1619
-            if (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/assets/css/' . $str_css)) {
1620
-                return $xoops_theme_url . '/' . $theme . '/assets/css/' . $str_css;
1621
-            } elseif (XoopsLoad::fileExists($xoops_theme_path . '/' . $theme . '/assets/css/style.css')) {
1622
-                return $xoops_theme_url . '/' . $theme . '/assets/css/style.css';
1618
+        if (is_dir($xoops_theme_path.'/'.$theme.'/assets/css')) {
1619
+            if (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/assets/css/'.$str_css)) {
1620
+                return $xoops_theme_url.'/'.$theme.'/assets/css/'.$str_css;
1621
+            } elseif (XoopsLoad::fileExists($xoops_theme_path.'/'.$theme.'/assets/css/style.css')) {
1622
+                return $xoops_theme_url.'/'.$theme.'/assets/css/style.css';
1623 1623
             }
1624 1624
         }
1625 1625
         return '';
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
             if (empty($dirname)) {
1734 1734
                 $dirname = $this->isModule() ? $this->module->getVar('dirname') : 'system';
1735 1735
             }
1736
-            $this->moduleConfigs[$dirname][$key] =& $value;
1736
+            $this->moduleConfigs[$dirname][$key] = & $value;
1737 1737
         }
1738 1738
     }
1739 1739
 
@@ -1817,18 +1817,18 @@  discard block
 block discarded – undo
1817 1817
             if (is_object($module)) {
1818 1818
                 $configs = $this->getHandlerConfig()->getConfigsByModule($module->getVar('mid'));
1819 1819
                 $this->cache()->write($key, $configs);
1820
-                $this->moduleConfigs[$dirname] =& $configs;
1820
+                $this->moduleConfigs[$dirname] = & $configs;
1821 1821
             }
1822 1822
         } else {
1823
-            $this->moduleConfigs[$dirname] =& $configs;
1823
+            $this->moduleConfigs[$dirname] = & $configs;
1824 1824
         }
1825 1825
 
1826 1826
         if ($this->isModule()) {
1827 1827
             //for legacy
1828
-            $this->moduleConfig =& $this->moduleConfigs[$this->module->getVar('dirname')];
1828
+            $this->moduleConfig = & $this->moduleConfigs[$this->module->getVar('dirname')];
1829 1829
         }
1830 1830
         if ($dirname === 'system') {
1831
-            $this->config =& $this->moduleConfigs['system'];
1831
+            $this->config = & $this->moduleConfigs['system'];
1832 1832
         }
1833 1833
         return $this->moduleConfigs[$dirname];
1834 1834
     }
@@ -1855,10 +1855,10 @@  discard block
 block discarded – undo
1855 1855
         }
1856 1856
         if ($appendWithKey) {
1857 1857
             foreach ($values as $key2 => $value) {
1858
-                $this->moduleConfigs[$dirname][$key][$key2] =& $value;
1858
+                $this->moduleConfigs[$dirname][$key][$key2] = & $value;
1859 1859
             }
1860 1860
         } else {
1861
-            $this->moduleConfigs[$dirname][$key][] =& $values;
1861
+            $this->moduleConfigs[$dirname][$key][] = & $values;
1862 1862
         }
1863 1863
     }
1864 1864
 
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
      */
1889 1889
     public function getBaseDomain($url, $includeSubdomain = false)
1890 1890
     {
1891
-        $url=mb_strtolower($url, 'UTF-8');
1891
+        $url = mb_strtolower($url, 'UTF-8');
1892 1892
 
1893 1893
         $host = parse_url($url, PHP_URL_HOST);
1894 1894
         if (empty($host)) {
@@ -1899,13 +1899,13 @@  discard block
 block discarded – undo
1899 1899
         }
1900 1900
 
1901 1901
         // check for exceptions, localhost and ip address (v4 & v6)
1902
-        if ($host==='localhost') {
1902
+        if ($host === 'localhost') {
1903 1903
             return $host;
1904 1904
         }
1905 1905
         // Check for IPV6 URL (see http://www.ietf.org/rfc/rfc2732.txt)
1906 1906
         // strip brackets before validating
1907
-        if (substr($host, 0, 1)==='[' && substr($host, -1)===']') {
1908
-            $host = substr($host, 1, (strlen($host)-2));
1907
+        if (substr($host, 0, 1) === '[' && substr($host, -1) === ']') {
1908
+            $host = substr($host, 1, (strlen($host) - 2));
1909 1909
         }
1910 1910
         if (filter_var($host, FILTER_VALIDATE_IP)) {
1911 1911
             return $host;
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
             $module = $tplfile->getVar('tpl_module', 'n');
1936 1936
             $type = $tplfile->getVar('tpl_type', 'n');
1937 1937
             $tpl = new XoopsTpl();
1938
-            return $tpl->touch($type . ':' . $module . '/' . $file);
1938
+            return $tpl->touch($type.':'.$module.'/'.$file);
1939 1939
         }
1940 1940
         return false;
1941 1941
     }
Please login to merge, or discard this patch.