Completed
Push — master ( 88111b...b3fce7 )
by Michael
05:58
created
class/MemberHandler.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 use XoopsModules\Smartobject;
22 22
 
23 23
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
-require_once XOOPS_ROOT_PATH . '/kernel/user.php';
25
-require_once XOOPS_ROOT_PATH . '/kernel/group.php';
26
-require_once XOOPS_ROOT_PATH . '/kernel/member.php';
24
+require_once XOOPS_ROOT_PATH.'/kernel/user.php';
25
+require_once XOOPS_ROOT_PATH.'/kernel/group.php';
26
+require_once XOOPS_ROOT_PATH.'/kernel/member.php';
27 27
 
28 28
 /**
29 29
  * XOOPS member handler class.
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
             // send some notifications
145 145
             $xoopsMailer = xoops_getMailer();
146 146
             $xoopsMailer->useMail();
147
-            $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/mail_template');
147
+            $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/mail_template');
148 148
             $xoopsMailer->setTemplate('smartobject_notify_user_added_by_admin.tpl');
149 149
             $xoopsMailer->assign('XOOPS_USER_PASSWORD', $password);
150 150
             $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
151 151
             $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
152
-            $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
152
+            $xoopsMailer->assign('SITEURL', XOOPS_URL.'/');
153 153
             $xoopsMailer->assign('NAME', $userObj->getVar('name'));
154 154
             $xoopsMailer->assign('UNAME', $userObj->getVar('uname'));
155 155
             $xoopsMailer->setToUsers($userObj);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         if (strlen($name) > 0) {
196 196
             $name = explode(' ', trim($name));
197 197
             if (count($name) > 1) {
198
-                $basename = strtolower(substr($name[0], 0, 1) . $name[count($name) - 1]);
198
+                $basename = strtolower(substr($name[0], 0, 1).$name[count($name) - 1]);
199 199
             } else {
200 200
                 $basename = strtolower($name[0]);
201 201
             }
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         while ($i < $count) {
213 213
             $num = $this->genRandNumber();
214 214
             if ($onbasename < 0 && $hasbasename) {
215
-                $names[] = xoops_substr($basename, 0, 58, '') . $num;
215
+                $names[] = xoops_substr($basename, 0, 58, '').$num;
216 216
             } else {
217
-                $names[] = xoops_substr($emailname, 0, 58, '') . $num;
217
+                $names[] = xoops_substr($emailname, 0, 58, '').$num;
218 218
             }
219 219
             $i          = count($names);
220 220
             $onbasename = ~$onbasename;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         static $randCalled = false;
258 258
         if (!$randCalled) {
259
-            mt_srand((double)microtime() * 1000000);
259
+            mt_srand((double) microtime() * 1000000);
260 260
             $randCalled = true;
261 261
         }
262 262
     }
Please login to merge, or discard this patch.
class/Rating.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,14 +117,14 @@
 block discarded – undo
117 117
      */
118 118
     public function getItemValue()
119 119
     {
120
-        $moduleUrl      = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/';
120
+        $moduleUrl      = XOOPS_URL.'/modules/'.$this->getVar('dirname', 'n').'/';
121 121
         $plugin         = $this->getModulePlugin();
122 122
         $pluginItemInfo = $plugin->getItemInfo($this->getVar('item'));
123 123
         if (!$pluginItemInfo) {
124 124
             return '';
125 125
         }
126 126
         $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid'));
127
-        $ret      = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>';
127
+        $ret      = '<a href="'.$moduleUrl.$itemPath.'">'.$pluginItemInfo['caption'].'</a>';
128 128
 
129 129
         return $ret;
130 130
     }
Please login to merge, or discard this patch.
class/Utility.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function getCssLink($cssfile)
27 27
     {
28
-        $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">';
28
+        $ret = '<link rel="stylesheet" type="text/css" href="'.$cssfile.'">';
29 29
 
30 30
         return $ret;
31 31
     }
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
             $seoMode = static::getModuleModeSEO($moduleName);
117 117
             if ('rewrite' === $seoMode) {
118 118
                 $seoModuleName = static::getModuleNameForSEO($moduleName);
119
-                $ret           = XOOPS_URL . '/' . $seoModuleName . '/';
119
+                $ret           = XOOPS_URL.'/'.$seoModuleName.'/';
120 120
             } elseif ('pathinfo' === $seoMode) {
121
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/';
121
+                $ret = XOOPS_URL.'/modules/'.$moduleName.'/seo.php/'.$seoModuleName.'/';
122 122
             } else {
123
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/';
123
+                $ret = XOOPS_URL.'/modules/'.$moduleName.'/';
124 124
             }
125 125
 
126
-            return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>';
126
+            return '<a href="'.$ret.'">'.$smartModule->getVar('name').'</a>';
127 127
         }
128 128
     }
129 129
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         //Verifies that a MySQL table exists
226 226
         $xoopsDB  = \XoopsDatabaseFactory::getDatabaseConnection();
227 227
         $realname = $xoopsDB->prefix($table);
228
-        $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
228
+        $sql      = 'SHOW TABLES FROM '.XOOPS_DB_NAME;
229 229
         $ret      = $xoopsDB->queryF($sql);
230 230
         while (false !== (list($m_table) = $xoopsDB->fetchRow($ret))) {
231 231
             if ($m_table == $realname) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $moduleName = static::getCurrentModuleName();
255 255
         }
256 256
         $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
257
-        $sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key));
257
+        $sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key));
258 258
         $ret     = $xoopsDB->query($sql);
259 259
         if (!$ret) {
260 260
             $value = false;
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
         $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
298 298
         $ret     = static::getMeta($key, $moduleName);
299 299
         if ('0' === $ret || $ret > 0) {
300
-            $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
300
+            $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
301 301
         } else {
302
-            $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
302
+            $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
303 303
         }
304 304
         $ret = $xoopsDB->queryF($sql);
305 305
         if (!$ret) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
     {
480 480
         static $smartModules;
481 481
         if (isset($smartModules[$moduleName])) {
482
-            $ret =& $smartModules[$moduleName];
482
+            $ret = & $smartModules[$moduleName];
483 483
 
484 484
             return $ret;
485 485
         }
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     {
516 516
         static $smartConfigs;
517 517
         if (isset($smartConfigs[$moduleName])) {
518
-            $ret =& $smartConfigs[$moduleName];
518
+            $ret = & $smartConfigs[$moduleName];
519 519
 
520 520
             return $ret;
521 521
         }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                 return $ret;
544 544
             }
545 545
             $hModConfig                = xoops_getHandler('config');
546
-            $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
546
+            $smartConfigs[$moduleName] = & $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
547 547
         }
548 548
 
549 549
         return $smartConfigs[$moduleName];
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     {
570 570
         $ret = '';
571 571
         foreach ($errors as $key => $value) {
572
-            $ret .= '<br> - ' . $value;
572
+            $ret .= '<br> - '.$value;
573 573
         }
574 574
 
575 575
         return $ret;
@@ -589,17 +589,17 @@  discard block
 block discarded – undo
589 589
         if (!is_numeric($userid)) {
590 590
             return $userid;
591 591
         }
592
-        $userid = (int)$userid;
592
+        $userid = (int) $userid;
593 593
         if ($userid > 0) {
594 594
             if ($users == []) {
595 595
                 //fetching users
596 596
                 $memberHandler = xoops_getHandler('member');
597
-                $user          =& $memberHandler->getUser($userid);
597
+                $user          = & $memberHandler->getUser($userid);
598 598
             } else {
599 599
                 if (!isset($users[$userid])) {
600 600
                     return $GLOBALS['xoopsConfig']['anonymous'];
601 601
                 }
602
-                $user =& $users[$userid];
602
+                $user = & $users[$userid];
603 603
             }
604 604
             if (is_object($user)) {
605 605
                 $ts        = \MyTextSanitizer:: getInstance();
@@ -610,15 +610,15 @@  discard block
 block discarded – undo
610 610
                     $fullname = $user->getVar('name');
611 611
                 }
612 612
                 if (!empty($fullname)) {
613
-                    $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
613
+                    $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]';
614 614
                 } else {
615
-                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
615
+                    $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>';
616 616
                 }
617 617
                 // add contact info: email + PM
618 618
                 if ($withContact) {
619
-                    $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>';
620
-                    $js         = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);";
621
-                    $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>';
619
+                    $linkeduser .= ' <a href="mailto:'.$user->getVar('email').'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/email.gif'.'" alt="'._CO_SOBJECT_SEND_EMAIL.'" title="'._CO_SOBJECT_SEND_EMAIL.'"></a>';
620
+                    $js = "javascript:openWithSelfMain('".XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$userid."', 'pmlite',450,370);";
621
+                    $linkeduser .= ' <a href="'.$js.'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/pm.gif'.'" alt="'._CO_SOBJECT_SEND_PM.'" title="'._CO_SOBJECT_SEND_PM.'"></a>';
622 622
                 }
623 623
 
624 624
                 return $linkeduser;
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
     public static function getAdminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1)
638 638
     {
639 639
         global $xoopsModule, $xoopsConfig;
640
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
640
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
641 641
 
642 642
 
643 643
         /** @var Smartobject\Helper $helper */
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
         $helper->loadLanguage('modinfo');
647 647
         $headermenu  = [];
648 648
         $adminObject = [];
649
-        include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php';
649
+        include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/admin/menu.php';
650 650
         $tpl = new \XoopsTpl();
651 651
         $tpl->assign([
652 652
                          'headermenu'      => $headermenu,
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
     public static function getCollapsableBar($id = '', $title = '', $dsc = '')
670 670
     {
671 671
         global $xoopsModule;
672
-        echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>";
673
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
674
-        echo "<div id='" . $id . "'>";
672
+        echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('".$id."'); toggleIcon('".$id."_icon')\";>";
673
+        echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a>&nbsp;".$title.'</h3>';
674
+        echo "<div id='".$id."'>";
675 675
         if ('' !== $dsc) {
676
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
676
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$dsc.'</span>';
677 677
         }
678 678
     }
679 679
 
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
         global $xoopsModule;
688 688
         $onClick = "ajaxtogglecollapse('$id')";
689 689
         //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')";
690
-        echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">';
691
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
692
-        echo "<div id='" . $id . "'>";
690
+        echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="'.$onClick.'">';
691
+        echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a>&nbsp;".$title.'</h3>';
692
+        echo "<div id='".$id."'>";
693 693
         if ('' !== $dsc) {
694
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
694
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$dsc.'</span>';
695 695
         }
696 696
     }
697 697
 
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
     {
722 722
         $urls        = static::getCurrentUrls();
723 723
         $path        = $urls['phpself'];
724
-        $cookie_name = $path . '_smart_collaps_' . $name;
724
+        $cookie_name = $path.'_smart_collaps_'.$name;
725 725
         $cookie_name = str_replace('.', '_', $cookie_name);
726 726
         $cookie      = static::getCookieVar($cookie_name, '');
727 727
         if ('none' === $cookie) {
728 728
             echo '
729 729
                 <script type="text/javascript"><!--
730
-                togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon");
730
+                togglecollapse("' . $name.'"); toggleIcon("'.$name.'_icon");
731 731
                     //-->
732 732
                 </script>
733 733
                 ';
@@ -793,17 +793,17 @@  discard block
 block discarded – undo
793 793
         $httphost    = $_SERVER['HTTP_HOST'];
794 794
         $querystring = $_SERVER['QUERY_STRING'];
795 795
         if ('' !== $querystring) {
796
-            $querystring = '?' . $querystring;
796
+            $querystring = '?'.$querystring;
797 797
         }
798
-        $currenturl           = $http . $httphost . $phpself . $querystring;
798
+        $currenturl           = $http.$httphost.$phpself.$querystring;
799 799
         $urls                 = [];
800 800
         $urls['http']         = $http;
801 801
         $urls['httphost']     = $httphost;
802 802
         $urls['phpself']      = $phpself;
803 803
         $urls['querystring']  = $querystring;
804
-        $urls['full_phpself'] = $http . $httphost . $phpself;
804
+        $urls['full_phpself'] = $http.$httphost.$phpself;
805 805
         $urls['full']         = $currenturl;
806
-        $urls['isHomePage']   = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself);
806
+        $urls['isHomePage']   = (XOOPS_URL.'/index.php') == ($http.$httphost.$phpself);
807 807
 
808 808
         return $urls;
809 809
     }
@@ -880,13 +880,13 @@  discard block
 block discarded – undo
880 880
     {
881 881
         global $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
882 882
 
883
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
883
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
884 884
         $tpl = new \XoopsTpl();
885 885
 
886 886
         $hModule      = xoops_getHandler('module');
887
-        $versioninfo  =& $hModule->get($xoopsModule->getVar('mid'));
888
-        $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . '';
889
-        $modfooter    = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>";
887
+        $versioninfo  = & $hModule->get($xoopsModule->getVar('mid'));
888
+        $modfootertxt = 'Module '.$versioninfo->getInfo('name').' - Version '.$versioninfo->getInfo('version').'';
889
+        $modfooter    = "<a href='".$versioninfo->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/assets/images/cssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'></a>";
890 890
         $tpl->assign('modfooter', $modfooter);
891 891
 
892 892
         if (!defined('_AM_SOBJECT_XOOPS_PRO')) {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
         }
895 895
         $smartobjectConfig = static::getModuleConfig('smartobject');
896 896
         $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']);
897
-        $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl');
897
+        $tpl->display(SMARTOBJECT_ROOT_PATH.'templates/smartobject_admin_footer.tpl');
898 898
     }
899 899
 
900 900
     public static function getXoopsCpFooter()
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
      */
922 922
     public static function addScript($src)
923 923
     {
924
-        echo '<script src="' . $src . '" type="text/javascript"></script>';
924
+        echo '<script src="'.$src.'" type="text/javascript"></script>';
925 925
     }
926 926
 
927 927
     /**
@@ -930,16 +930,16 @@  discard block
 block discarded – undo
930 930
     public static function addStyle($src)
931 931
     {
932 932
         if ('smartobject' === $src) {
933
-            $src = SMARTOBJECT_URL . 'assets/css/module.css';
933
+            $src = SMARTOBJECT_URL.'assets/css/module.css';
934 934
         }
935 935
         echo static::getCssLink($src);
936 936
     }
937 937
 
938 938
     public static function addAdminAjaxSupport()
939 939
     {
940
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js');
941
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js');
942
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js');
940
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/lib/prototype.js');
941
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/src/scriptaculous.js');
942
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/src/smart.js');
943 943
     }
944 944
 
945 945
     /**
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
     public static function getHtmlnumericentities($str)
1000 1000
     {
1001 1001
         //    return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str);
1002
-        return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) {
1003
-            return '&#' . ord($m[0]) . chr(59);
1002
+        return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function($m) {
1003
+            return '&#'.ord($m[0]).chr(59);
1004 1004
         }, $str);
1005 1005
     }
1006 1006
 
@@ -1014,16 +1014,16 @@  discard block
 block discarded – undo
1014 1014
         static $handlers;
1015 1015
         $name = strtolower(trim($name));
1016 1016
         if (!isset($handlers[$name])) {
1017
-            if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) {
1017
+            if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/kernel/'.$name.'.php')) {
1018 1018
                 require_once $hnd_file;
1019 1019
             }
1020
-            $class = 'Xoops' . ucfirst($name) . 'Handler';
1020
+            $class = 'Xoops'.ucfirst($name).'Handler';
1021 1021
             if (class_exists($class)) {
1022 1022
                 $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops');
1023 1023
             }
1024 1024
         }
1025 1025
         if (!isset($handlers[$name]) && !$optional) {
1026
-            trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
1026
+            trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR);
1027 1027
         }
1028 1028
         if (isset($handlers[$name])) {
1029 1029
             return $handlers[$name];
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
     {
1104 1104
         global $xoopsConfig;
1105 1105
 
1106
-        $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php';
1106
+        $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/'.$xoopsConfig['language'].'/'.$file.'.php';
1107 1107
         if (!file_exists($filename)) {
1108
-            $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php';
1108
+            $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/english/'.$file.'.php';
1109 1109
         }
1110 1110
         if (file_exists($filename)) {
1111 1111
             require_once $filename;
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
         $text = preg_replace($search, $replace, $document);
1203 1203
 
1204
-        preg_replace_callback('/&#(\d+);/', function ($matches) {
1204
+        preg_replace_callback('/&#(\d+);/', function($matches) {
1205 1205
             return chr($matches[1]);
1206 1206
         }, $document);
1207 1207
 
@@ -1224,21 +1224,21 @@  discard block
 block discarded – undo
1224 1224
             $str = $match[0];
1225 1225
             if (false !== strpos($str, ',')) {
1226 1226
                 // A comma exists, that makes it easy, cos we assume it separates the decimal part.
1227
-                $str = str_replace('.', '', $str);    // Erase thousand seps
1228
-                $str = str_replace(',', '.', $str);    // Convert , to . for floatval command
1227
+                $str = str_replace('.', '', $str); // Erase thousand seps
1228
+                $str = str_replace(',', '.', $str); // Convert , to . for floatval command
1229 1229
 
1230
-                return (float)$str;
1230
+                return (float) $str;
1231 1231
             } else {
1232 1232
                 // No comma exists, so we have to decide, how a single dot shall be treated
1233 1233
                 if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) {
1234 1234
                     // Treat single dot as decimal separator
1235
-                    return (float)$str;
1235
+                    return (float) $str;
1236 1236
                 } else {
1237 1237
                     //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> ";
1238 1238
                     // Else, treat all dots as thousand seps
1239
-                    $str = str_replace('.', '', $str);    // Erase thousand seps
1239
+                    $str = str_replace('.', '', $str); // Erase thousand seps
1240 1240
 
1241
-                    return (float)$str;
1241
+                    return (float) $str;
1242 1242
                 }
1243 1243
             }
1244 1244
         } else {
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
             $ret .= '.00';
1271 1271
         }
1272 1272
         if ($currencyObj) {
1273
-            $ret = $ret . ' ' . $currencyObj->getCode();
1273
+            $ret = $ret.' '.$currencyObj->getCode();
1274 1274
         }
1275 1275
 
1276 1276
         return $ret;
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
         }
1298 1298
         $ret = '';
1299 1299
         if ($moduleName) {
1300
-            $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>';
1300
+            $ret = "<a href='".XOOPS_URL."/modules/$moduleName/admin/index.php'>"._CO_SOBJECT_ADMIN_PAGE.'</a>';
1301 1301
         }
1302 1302
 
1303 1303
         return $ret;
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
      */
1309 1309
     public static function getEditors()
1310 1310
     {
1311
-        $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php';
1311
+        $filename = XOOPS_ROOT_PATH.'/class/xoopseditor/xoopseditor.php';
1312 1312
         if (!file_exists($filename)) {
1313 1313
             return false;
1314 1314
         }
@@ -1332,9 +1332,9 @@  discard block
 block discarded – undo
1332 1332
     {
1333 1333
         $ret = [];
1334 1334
         foreach ($items as $item) {
1335
-            $ret[] = $moduleName . '_' . $item;
1335
+            $ret[] = $moduleName.'_'.$item;
1336 1336
         }
1337
-        $ret[] = $moduleName . '_meta';
1337
+        $ret[] = $moduleName.'_meta';
1338 1338
 
1339 1339
         return $ret;
1340 1340
     }
Please login to merge, or discard this patch.
class/ExportRenderer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             }
237 237
         } while (false);
238 238
         if ($needQuote) {
239
-            $val = '"' . $val . '"';
239
+            $val = '"'.$val.'"';
240 240
         }
241 241
 
242 242
         return $val;
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
             case 'csv':
251 251
                 $separator      = isset($this->options['separator']) ? $this->options['separator'] : ';';
252 252
                 $firstRow       = implode($separator, $this->data['columnsHeaders']);
253
-                $exportFileData .= $firstRow . "\r\n";
253
+                $exportFileData .= $firstRow."\r\n";
254 254
 
255 255
                 foreach ($this->data['rows'] as $cols) {
256
-                    $exportFileData .= $this->arrayToCsvString($cols, $separator) . "\r\n";
256
+                    $exportFileData .= $this->arrayToCsvString($cols, $separator)."\r\n";
257 257
                 }
258 258
                 break;
259 259
         }
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
     public function saveCsv($content)
279 279
     {
280 280
         if (!$this->filepath) {
281
-            $this->filepath = XOOPS_UPLOAD_PATH . '/';
281
+            $this->filepath = XOOPS_UPLOAD_PATH.'/';
282 282
         }
283 283
         if (!$this->filename) {
284 284
             $this->filename .= time();
285 285
             $this->filename .= '.csv';
286 286
         }
287 287
 
288
-        $fullFileName = $this->filepath . $this->filename;
288
+        $fullFileName = $this->filepath.$this->filename;
289 289
 
290 290
         if (!$handle = fopen($fullFileName, 'a+')) {
291
-            trigger_error('Unable to open ' . $fullFileName, E_USER_WARNING);
291
+            trigger_error('Unable to open '.$fullFileName, E_USER_WARNING);
292 292
         } elseif (false === fwrite($handle, $content)) {
293
-            trigger_error('Unable to write in ' . $fullFileName, E_USER_WARNING);
293
+            trigger_error('Unable to write in '.$fullFileName, E_USER_WARNING);
294 294
         } else {
295 295
             $mimeType  = 'text/csv';
296 296
             $file      = strrev($this->filename);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             } else {
301 301
                 $file_name = $temp_name;
302 302
             }
303
-            $fullFileName = $this->filepath . stripslashes(trim($this->filename));
303
+            $fullFileName = $this->filepath.stripslashes(trim($this->filename));
304 304
 
305 305
             if (ini_get('zlib.output_compression')) {
306 306
                 ini_set('zlib.output_compression', 'Off');
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
             header('Cache-Control: private', false);
312 312
             header('Content-Transfer-Encoding: binary');
313 313
             if (isset($mimeType)) {
314
-                header('Content-Type: ' . $mimeType);
314
+                header('Content-Type: '.$mimeType);
315 315
             }
316 316
 
317
-            header('Content-Disposition: attachment; filename=' . $file_name);
317
+            header('Content-Disposition: attachment; filename='.$file_name);
318 318
 
319 319
             if (isset($mimeType) && false !== strpos($mimeType, 'text/')) {
320 320
                 $fp = fopen($fullFileName, 'r');
Please login to merge, or discard this patch.
class/Dbupdater.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
  */
39 39
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
40 40
 if (!defined('SMARTOBJECT_ROOT_PATH')) {
41
-    require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
41
+    require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php';
42 42
 }
43 43
 /**
44 44
  * Include the language constants for the SmartObjectDBUpdater
45 45
  */
46 46
 global $xoopsConfig;
47
-$common_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/smartdbupdater.php';
47
+$common_file = SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/smartdbupdater.php';
48 48
 if (!file_exists($common_file)) {
49
-    $common_file = SMARTOBJECT_ROOT_PATH . 'language/english/smartdbupdater.php';
49
+    $common_file = SMARTOBJECT_ROOT_PATH.'language/english/smartdbupdater.php';
50 50
 }
51 51
 include $common_file;
52 52
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
         $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to);
131 131
         $ret   = $xoopsDB->query($query);
132 132
         if (!$ret) {
133
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>';
133
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>';
134 134
 
135 135
             return false;
136 136
         } else {
137
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>';
137
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>';
138 138
 
139 139
             return true;
140 140
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             return false;
255 255
         }
256 256
 
257
-        $table      = new DbTable($module . '_' . $item);
257
+        $table      = new DbTable($module.'_'.$item);
258 258
         $object     = $moduleHandler->create();
259 259
         $objectVars = $object->getVars();
260 260
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 ";
276 276
                 }
277 277
             }
278
-            $structure .= 'PRIMARY KEY  (`' . $moduleHandler->keyName . '`)
278
+            $structure .= 'PRIMARY KEY  (`'.$moduleHandler->keyName.'`)
279 279
 ';
280 280
             $table->setStructure($structure);
281 281
             if (!$this->updateTable($table)) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
         ob_start();
337 337
 
338
-        $table = new DbTable($dirname . '_meta');
338
+        $table = new DbTable($dirname.'_meta');
339 339
         if (!$table->exists()) {
340 340
             $table->setStructure("
341 341
               `metakey` varchar(50) NOT NULL default '',
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
         if (!$dbVersion) {
354 354
             $dbVersion = 0;
355 355
         }
356
-        $newDbVersion = constant(strtoupper($dirname . '_db_version')) ?: 0;
357
-        echo 'Database version: ' . $dbVersion . '<br>';
358
-        echo 'New database version: ' . $newDbVersion . '<br>';
356
+        $newDbVersion = constant(strtoupper($dirname.'_db_version')) ?: 0;
357
+        echo 'Database version: '.$dbVersion.'<br>';
358
+        echo 'New database version: '.$newDbVersion.'<br>';
359 359
 
360 360
         if ($newDbVersion > $dbVersion) {
361 361
             for ($i = $dbVersion + 1; $i <= $newDbVersion; ++$i) {
362
-                $upgrade_function = $dirname . '_db_upgrade_' . $i;
362
+                $upgrade_function = $dirname.'_db_upgrade_'.$i;
363 363
                 if (function_exists($upgrade_function)) {
364 364
                     $upgrade_function();
365 365
                 }
366 366
             }
367 367
         }
368 368
 
369
-        echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>';
369
+        echo '<code>'._SDU_UPDATE_UPDATING_DATABASE.'<br>';
370 370
 
371 371
         // if there is a function to execute for this DB version, let's do it
372 372
         //$function_
Please login to merge, or discard this patch.
class/Customtag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getXoopsCode()
117 117
     {
118
-        $ret = '[customtag]' . $this->getVar('tag', 'n') . '[/customtag]';
118
+        $ret = '[customtag]'.$this->getVar('tag', 'n').'[/customtag]';
119 119
 
120 120
         return $ret;
121 121
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getCloneLink()
127 127
     {
128
-        $ret = '<a href="' . SMARTOBJECT_URL . 'admin/customtag.php?op=clone&customtagid=' . $this->id() . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'editcopy.png" style="vertical-align: middle;" alt="' . _CO_SOBJECT_CUSTOMTAG_CLONE . '" title="' . _CO_SOBJECT_CUSTOMTAG_CLONE . '"></a>';
128
+        $ret = '<a href="'.SMARTOBJECT_URL.'admin/customtag.php?op=clone&customtagid='.$this->id().'"><img src="'.SMARTOBJECT_IMAGES_ACTIONS_URL.'editcopy.png" style="vertical-align: middle;" alt="'._CO_SOBJECT_CUSTOMTAG_CLONE.'" title="'._CO_SOBJECT_CUSTOMTAG_CLONE.'"></a>';
129 129
 
130 130
         return $ret;
131 131
     }
Please login to merge, or discard this patch.
class/Highlighter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
         if ($this->singlewords) {
79 79
             $keywords = explode(' ', $this->preg_keywords);
80 80
             foreach ($keywords as $keyword) {
81
-                $patterns[] = '/(?' . '>' . $keyword . '+)/si';
81
+                $patterns[] = '/(?'.'>'.$keyword.'+)/si';
82 82
             }
83 83
         } else {
84
-            $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
84
+            $patterns[] = '/(?'.'>'.$this->preg_keywords.'+)/si';
85 85
         }
86 86
 
87 87
         $result = $replace_matches[0];
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function highlight($buffer)
106 106
     {
107
-        $buffer              = '>' . $buffer . '<';
107
+        $buffer              = '>'.$buffer.'<';
108 108
         $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
109
-        $buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
109
+        $buffer              = preg_replace_callback("/(\>(((?".">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
110 110
         $buffer              = substr($buffer, 1, -1);
111 111
 
112 112
         return $buffer;
Please login to merge, or discard this patch.
class/BaseSmartObject.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
17 17
 
18
-require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
18
+require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php';
19 19
 
20 20
 if (!defined('XOBJ_DTYPE_SIMPLE_ARRAY')) {
21 21
     define('XOBJ_DTYPE_SIMPLE_ARRAY', 101);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function closeSection($section_name)
116 116
     {
117
-        $this->initVar('close_section_' . $section_name, XOBJ_DTYPE_FORM_SECTION_CLOSE, '', false, null, '', false, '', '', false, false, true);
117
+        $this->initVar('close_section_'.$section_name, XOBJ_DTYPE_FORM_SECTION_CLOSE, '', false, null, '', false, '', '', false, false, true);
118 118
     }
119 119
 
120 120
     /**
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
         }
153 153
         parent::initVar($key, $data_type, $value, $required, $maxlength, $options);
154 154
         if ($this->handler && (!$form_caption || '' === $form_caption)) {
155
-            $dyn_form_caption = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key);
155
+            $dyn_form_caption = strtoupper('_CO_'.$this->handler->_moduleName.'_'.$this->handler->_itemname.'_'.$key);
156 156
             if (defined($dyn_form_caption)) {
157 157
                 $form_caption = constant($dyn_form_caption);
158 158
             }
159 159
         }
160 160
         if ($this->handler && (!$form_dsc || '' === $form_dsc)) {
161
-            $dyn_form_dsc = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key . '_DSC');
161
+            $dyn_form_dsc = strtoupper('_CO_'.$this->handler->_moduleName.'_'.$this->handler->_itemname.'_'.$key.'_DSC');
162 162
             if (defined($dyn_form_dsc)) {
163 163
                 $form_dsc = constant($dyn_form_dsc);
164 164
             }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     public function toArray()
455 455
     {
456 456
         $ret  = [];
457
-        $vars =& $this->getVars();
457
+        $vars = & $this->getVars();
458 458
         foreach ($vars as $key => $var) {
459 459
             $value     = $this->getVar($key);
460 460
             $ret[$key] = $value;
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             }
504 504
         } else {
505 505
             if ($prefix) {
506
-                $err_str = '[' . $prefix . '] ' . $err_str;
506
+                $err_str = '['.$prefix.'] '.$err_str;
507 507
             }
508 508
             parent::setErrors($err_str);
509 509
         }
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
                             $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k));
832 832
                             continue 2;
833 833
                         }
834
-                        if (isset($v['maxlength']) && strlen($cleanv) > (int)$v['maxlength']) {
835
-                            $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int)$v['maxlength']));
834
+                        if (isset($v['maxlength']) && strlen($cleanv) > (int) $v['maxlength']) {
835
+                            $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int) $v['maxlength']));
836 836
                             continue 2;
837 837
                         }
838 838
                         if (!$v['not_gpc']) {
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                         break;
862 862
                     case XOBJ_DTYPE_INT:
863 863
                     case XOBJ_DTYPE_TIME_ONLY:
864
-                        $cleanv = (int)$cleanv;
864
+                        $cleanv = (int) $cleanv;
865 865
                         break;
866 866
 
867 867
                     case XOBJ_DTYPE_CURRENCY:
@@ -892,10 +892,10 @@  discard block
 block discarded – undo
892 892
                             continue 2;
893 893
                         }
894 894
                         if ('' !== $cleanv && !preg_match("/^http[s]*:\/\//i", $cleanv)) {
895
-                            $cleanv = 'http://' . $cleanv;
895
+                            $cleanv = 'http://'.$cleanv;
896 896
                         }
897 897
                         if (!$v['not_gpc']) {
898
-                            $cleanv =& $ts->stripSlashesGPC($cleanv);
898
+                            $cleanv = & $ts->stripSlashesGPC($cleanv);
899 899
                         }
900 900
                         break;
901 901
                     case XOBJ_DTYPE_SIMPLE_ARRAY:
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                     case XOBJ_DTYPE_STIME:
908 908
                     case XOBJ_DTYPE_MTIME:
909 909
                     case XOBJ_DTYPE_LTIME:
910
-                        $cleanv = !is_string($cleanv) ? (int)$cleanv : strtotime($cleanv);
910
+                        $cleanv = !is_string($cleanv) ? (int) $cleanv : strtotime($cleanv);
911 911
                         if (!($cleanv > 0)) {
912 912
                             $cleanv = strtotime($cleanv);
913 913
                         }
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
                         break;
917 917
                 }
918 918
             }
919
-            $this->cleanVars[$k] =& $cleanv;
919
+            $this->cleanVars[$k] = & $cleanv;
920 920
             unset($cleanv);
921 921
         }
922 922
         if (count($this->_errors) > 0) {
@@ -1141,10 +1141,10 @@  discard block
 block discarded – undo
1141 1141
                 }
1142 1142
                 break;
1143 1143
             case XOBJ_DTYPE_SIMPLE_ARRAY:
1144
-                $ret =& explode('|', $ret);
1144
+                $ret = & explode('|', $ret);
1145 1145
                 break;
1146 1146
             case XOBJ_DTYPE_ARRAY:
1147
-                $ret =& unserialize($ret);
1147
+                $ret = & unserialize($ret);
1148 1148
                 break;
1149 1149
             case XOBJ_DTYPE_SOURCE:
1150 1150
                 switch (strtolower($format)) {
Please login to merge, or discard this patch.
class/PersistableObjectHandler.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 
151 151
         $this->_itemname      = $itemname;
152 152
         $this->_moduleName    = $modulename;
153
-        $this->table          = $db->prefix($modulename . '_' . $itemname);
153
+        $this->table          = $db->prefix($modulename.'_'.$itemname);
154 154
         $this->keyName        = $keyname;
155 155
 //        $this->className      = ucfirst($modulename) . ucfirst($itemname);
156 156
         $this->className      = $itemname;
157 157
 
158 158
         $this->identifierName = $idenfierName;
159 159
         $this->summaryName    = $summaryName;
160
-        $this->_page          = $itemname . '.php';
161
-        $this->_modulePath    = XOOPS_ROOT_PATH . '/modules/' . $this->_moduleName . '/';
162
-        $this->_moduleUrl     = XOOPS_URL . '/modules/' . $this->_moduleName . '/';
163
-        $this->_uploadPath    = XOOPS_UPLOAD_PATH . '/' . $this->_moduleName . '/';
164
-        $this->_uploadUrl     = XOOPS_UPLOAD_URL . '/' . $this->_moduleName . '/';
160
+        $this->_page          = $itemname.'.php';
161
+        $this->_modulePath    = XOOPS_ROOT_PATH.'/modules/'.$this->_moduleName.'/';
162
+        $this->_moduleUrl     = XOOPS_URL.'/modules/'.$this->_moduleName.'/';
163
+        $this->_uploadPath    = XOOPS_UPLOAD_PATH.'/'.$this->_moduleName.'/';
164
+        $this->_uploadUrl     = XOOPS_UPLOAD_URL.'/'.$this->_moduleName.'/';
165 165
     }
166 166
 
167 167
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $smartPermissionsHandler = new PermissionHandler($this);
204 204
         $grantedItems            = $smartPermissionsHandler->getGrantedItems($perm_name);
205 205
         if (count($grantedItems) > 0) {
206
-            $criteria->add(new \Criteria($this->keyName, '(' . implode(', ', $grantedItems) . ')', 'IN'));
206
+            $criteria->add(new \Criteria($this->keyName, '('.implode(', ', $grantedItems).')', 'IN'));
207 207
 
208 208
             return true;
209 209
         } else {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     {
244 244
 //        $obj0 = new $this->className($this);
245 245
 
246
-        $obj =  new $this->className;
246
+        $obj = new $this->className;
247 247
 
248 248
         $obj->setImageDir($this->getImageUrl(), $this->getImagePath());
249 249
         if (!$obj->handler) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     public function getImageUrl()
264 264
     {
265
-        return $this->_uploadUrl . $this->_itemname . '/';
265
+        return $this->_uploadUrl.$this->_itemname.'/';
266 266
     }
267 267
 
268 268
     /**
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function getImagePath()
272 272
     {
273
-        $dir = $this->_uploadPath . $this->_itemname;
273
+        $dir = $this->_uploadPath.$this->_itemname;
274 274
         if (!file_exists($dir)) {
275 275
             Smartobject\Utility::mkdirAsAdmin($dir);
276 276
         }
277 277
 
278
-        return $dir . '/';
278
+        return $dir.'/';
279 279
     }
280 280
 
281 281
     /**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         if ($debug) {
315 315
             $obj_array = $this->getObjectsD($criteria, false, $as_object);
316 316
         } else {
317
-            $obj_array =& $this->getObjects($criteria, false, $as_object);
317
+            $obj_array = & $this->getObjects($criteria, false, $as_object);
318 318
             //patch: weird bug of indexing by id even if id_as_key = false;
319 319
             if (!isset($obj_array[0]) && is_object($obj_array[$id])) {
320 320
                 $obj_array[0] = $obj_array[$id];
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
         if ($this->generalSQL) {
369 369
             $sql = $this->generalSQL;
370 370
         } elseif (!$sql) {
371
-            $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname;
371
+            $sql = 'SELECT * FROM '.$this->table.' AS '.$this->_itemname;
372 372
         }
373 373
 
374 374
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
375
-            $sql .= ' ' . $criteria->renderWhere();
375
+            $sql .= ' '.$criteria->renderWhere();
376 376
             if ('' !== $criteria->getSort()) {
377
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
377
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
378 378
             }
379 379
             $limit = $criteria->getLimit();
380 380
             $start = $criteria->getStart();
@@ -403,12 +403,12 @@  discard block
 block discarded – undo
403 403
         $ret = [];
404 404
 
405 405
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
406
-            $sql .= ' ' . $criteria->renderWhere();
406
+            $sql .= ' '.$criteria->renderWhere();
407 407
             if ($criteria->groupby) {
408 408
                 $sql .= $criteria->getGroupby();
409 409
             }
410 410
             if ('' !== $criteria->getSort()) {
411
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
411
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
412 412
             }
413 413
         }
414 414
         if ($debug) {
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
             $obj->assignVars($myrow);
482 482
             if (!$id_as_key) {
483 483
                 if ($as_object) {
484
-                    $ret[] =& $obj;
484
+                    $ret[] = & $obj;
485 485
                 } else {
486 486
                     $ret[] = $obj->toArray();
487 487
                 }
488 488
             } else {
489 489
                 if ($as_object) {
490
-                    $value =& $obj;
490
+                    $value = & $obj;
491 491
                 } else {
492 492
                     $value = $obj->toArray();
493 493
                 }
494 494
                 if ('parentid' === $id_as_key) {
495
-                    $ret[$obj->getVar('parentid', 'e')][$obj->getVar($this->keyName)] =& $value;
495
+                    $ret[$obj->getVar('parentid', 'e')][$obj->getVar($this->keyName)] = & $value;
496 496
                 } else {
497 497
                     $ret[$obj->getVar($this->keyName)] = $value;
498 498
                 }
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
             $criteria->setSort($this->getIdentifierName());
536 536
         }
537 537
 
538
-        $sql = 'SELECT ' . (is_array($this->keyName) ? implode(', ', $this->keyName) : $this->keyName);
538
+        $sql = 'SELECT '.(is_array($this->keyName) ? implode(', ', $this->keyName) : $this->keyName);
539 539
         if (!empty($this->identifierName)) {
540
-            $sql .= ', ' . $this->getIdentifierName();
540
+            $sql .= ', '.$this->getIdentifierName();
541 541
         }
542
-        $sql .= ' FROM ' . $this->table . ' AS ' . $this->_itemname;
542
+        $sql .= ' FROM '.$this->table.' AS '.$this->_itemname;
543 543
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
544
-            $sql .= ' ' . $criteria->renderWhere();
544
+            $sql .= ' '.$criteria->renderWhere();
545 545
             if ('' !== $criteria->getSort()) {
546
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
546
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
547 547
             }
548 548
             $limit = $criteria->getLimit();
549 549
             $start = $criteria->getStart();
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
581 581
             if ('' !== $criteria->groupby) {
582 582
                 $groupby = true;
583
-                $field   = $criteria->groupby . ', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used
583
+                $field   = $criteria->groupby.', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used
584 584
             }
585 585
         }
586 586
         /**
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
             $sql = $this->generalSQL;
592 592
             $sql = str_replace('SELECT *', 'SELECT COUNT(*)', $sql);
593 593
         } else {
594
-            $sql = 'SELECT ' . $field . 'COUNT(*) FROM ' . $this->table . ' AS ' . $this->_itemname;
594
+            $sql = 'SELECT '.$field.'COUNT(*) FROM '.$this->table.' AS '.$this->_itemname;
595 595
         }
596 596
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
597
-            $sql .= ' ' . $criteria->renderWhere();
597
+            $sql .= ' '.$criteria->renderWhere();
598 598
             if ('' !== $criteria->groupby) {
599 599
                 $sql .= $criteria->getGroupby();
600 600
             }
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
         if (is_array($this->keyName)) {
638 638
             $clause = [];
639 639
             for ($i = 0, $iMax = count($this->keyName); $i < $iMax; ++$i) {
640
-                $clause[] = $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]);
640
+                $clause[] = $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]);
641 641
             }
642 642
             $whereclause = implode(' AND ', $clause);
643 643
         } else {
644
-            $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName);
644
+            $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName);
645 645
         }
646
-        $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . $whereclause;
646
+        $sql = 'DELETE FROM '.$this->table.' WHERE '.$whereclause;
647 647
         if (false !== $force) {
648 648
             $result = $this->db->queryF($sql);
649 649
         } else {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
              * @TODO: Change to if (!(class_exists($this->className) && $obj instanceof $this->className)) when going fully PHP5
705 705
              */
706 706
             if (!is_a($obj, $this->className)) {
707
-                $obj->setError(get_class($obj) . ' Differs from ' . $this->className);
707
+                $obj->setError(get_class($obj).' Differs from '.$this->className);
708 708
 
709 709
                 return false;
710 710
             }
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         $fieldsToStoreInDB = [];
766 766
         foreach ($obj->cleanVars as $k => $v) {
767 767
             if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) {
768
-                $cleanvars[$k] = (int)$v;
768
+                $cleanvars[$k] = (int) $v;
769 769
             } elseif (is_array($v)) {
770 770
                 $cleanvars[$k] = $this->db->quoteString(implode(',', $v));
771 771
             } else {
@@ -778,13 +778,13 @@  discard block
 block discarded – undo
778 778
         if ($obj->isNew()) {
779 779
             if (!is_array($this->keyName)) {
780 780
                 if ($cleanvars[$this->keyName] < 1) {
781
-                    $cleanvars[$this->keyName] = $this->db->genId($this->table . '_' . $this->keyName . '_seq');
781
+                    $cleanvars[$this->keyName] = $this->db->genId($this->table.'_'.$this->keyName.'_seq');
782 782
                 }
783 783
             }
784 784
 
785
-            $sql = 'INSERT INTO ' . $this->table . ' (' . implode(',', array_keys($fieldsToStoreInDB)) . ') VALUES (' . implode(',', array_values($fieldsToStoreInDB)) . ')';
785
+            $sql = 'INSERT INTO '.$this->table.' ('.implode(',', array_keys($fieldsToStoreInDB)).') VALUES ('.implode(',', array_values($fieldsToStoreInDB)).')';
786 786
         } else {
787
-            $sql = 'UPDATE ' . $this->table . ' SET';
787
+            $sql = 'UPDATE '.$this->table.' SET';
788 788
             foreach ($fieldsToStoreInDB as $key => $value) {
789 789
                 if ((!is_array($this->keyName) && $key == $this->keyName)
790 790
                     || (is_array($this->keyName)
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
                 if (isset($notfirst)) {
795 795
                     $sql .= ',';
796 796
                 }
797
-                $sql      .= ' ' . $key . ' = ' . $value;
797
+                $sql .= ' '.$key.' = '.$value;
798 798
                 $notfirst = true;
799 799
             }
800 800
             if (is_array($this->keyName)) {
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
                     if ($i > 0) {
804 804
                         $whereclause .= ' AND ';
805 805
                     }
806
-                    $whereclause .= $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]);
806
+                    $whereclause .= $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]);
807 807
                 }
808 808
             } else {
809
-                $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName);
809
+                $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName);
810 810
             }
811
-            $sql .= ' WHERE ' . $whereclause;
811
+            $sql .= ' WHERE '.$whereclause;
812 812
         }
813 813
 
814 814
         if ($debug) {
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
      */
882 882
     public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false)
883 883
     {
884
-        $set_clause = $fieldname . ' = ';
884
+        $set_clause = $fieldname.' = ';
885 885
         if (is_numeric($fieldvalue)) {
886 886
             $set_clause .= $fieldvalue;
887 887
         } elseif (is_array($fieldvalue)) {
@@ -889,9 +889,9 @@  discard block
 block discarded – undo
889 889
         } else {
890 890
             $set_clause .= $this->db->quoteString($fieldvalue);
891 891
         }
892
-        $sql = 'UPDATE ' . $this->table . ' SET ' . $set_clause;
892
+        $sql = 'UPDATE '.$this->table.' SET '.$set_clause;
893 893
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
894
-            $sql .= ' ' . $criteria->renderWhere();
894
+            $sql .= ' '.$criteria->renderWhere();
895 895
         }
896 896
         if (false !== $force) {
897 897
             $result = $this->db->queryF($sql);
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
     public function deleteAll(CriteriaElement $criteria = null)
916 916
     {
917 917
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
918
-            $sql = 'DELETE FROM ' . $this->table;
919
-            $sql .= ' ' . $criteria->renderWhere();
918
+            $sql = 'DELETE FROM '.$this->table;
919
+            $sql .= ' '.$criteria->renderWhere();
920 920
             if (!$this->db->query($sql)) {
921 921
                 return false;
922 922
             }
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
      */
950 950
     public function getModuleItemString()
951 951
     {
952
-        $ret = $this->_moduleName . '_' . $this->_itemname;
952
+        $ret = $this->_moduleName.'_'.$this->_itemname;
953 953
 
954 954
         return $ret;
955 955
     }
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
     {
962 962
         if (isset($object->vars['counter'])) {
963 963
             $new_counter = $object->getVar('counter') + 1;
964
-            $sql         = 'UPDATE ' . $this->table . ' SET counter=' . $new_counter . ' WHERE ' . $this->keyName . '=' . $object->id();
964
+            $sql         = 'UPDATE '.$this->table.' SET counter='.$new_counter.' WHERE '.$this->keyName.'='.$object->id();
965 965
             $this->query($sql, null, true);
966 966
         }
967 967
     }
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
     public function getIdentifierName($withprefix = true)
1006 1006
     {
1007 1007
         if ($withprefix) {
1008
-            return $this->_itemname . '.' . $this->identifierName;
1008
+            return $this->_itemname.'.'.$this->identifierName;
1009 1009
         } else {
1010 1010
             return $this->identifierName;
1011 1011
         }
Please login to merge, or discard this patch.