@@ -51,8 +51,8 @@ |
||
51 | 51 | if ($dirInfo->isDir()) { |
52 | 52 | // The directory exists so rename it |
53 | 53 | $date = date('Y-m-d'); |
54 | - if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) { |
|
55 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory)); |
|
54 | + if (!rename($uploadDirectory, $uploadDirectory."_bak_$date")) { |
|
55 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH'), $uploadDirectory)); |
|
56 | 56 | $success = false; |
57 | 57 | } |
58 | 58 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | $ret = false; |
69 | 69 | |
70 | - $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; |
|
70 | + $class = __NAMESPACE__.'\\'.\ucfirst($name).'Handler'; |
|
71 | 71 | if (!\class_exists($class)) { |
72 | 72 | throw new \RuntimeException("Class '$class' not found"); |
73 | 73 | } |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | //check for minimum XOOPS version |
41 | 41 | $currentVer = mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string |
42 | 42 | if (null === $requiredVer) { |
43 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
43 | + $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string |
|
44 | 44 | } |
45 | 45 | $success = true; |
46 | 46 | |
47 | 47 | if (\version_compare($currentVer, $requiredVer, '<')) { |
48 | 48 | $success = false; |
49 | - $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
49 | + $module->setErrors(\sprintf(\constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $success; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | if (false !== $reqVer && '' !== $reqVer) { |
79 | 79 | if (\version_compare($verNum, $reqVer, '<')) { |
80 | - $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
80 | + $module->setErrors(\sprintf(\constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
81 | 81 | $success = false; |
82 | 82 | } |
83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $moduleDirName = \basename(\dirname(__DIR__, 2)); |
97 | 97 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
98 | 98 | $update = ''; |
99 | - $repository = 'XoopsModules25x/' . $moduleDirName; |
|
99 | + $repository = 'XoopsModules25x/'.$moduleDirName; |
|
100 | 100 | // $repository = 'XoopsModules25x/publisher'; //for testing only |
101 | 101 | $ret = null; |
102 | 102 | $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | if (false === $curlReturn) { |
111 | 111 | \trigger_error(\curl_error($curlHandle)); |
112 | 112 | } elseif (false !== \mb_strpos($curlReturn, 'Not Found')) { |
113 | - \trigger_error('Repository Not Found: ' . $infoReleasesUrl); |
|
113 | + \trigger_error('Repository Not Found: '.$infoReleasesUrl); |
|
114 | 114 | } else { |
115 | 115 | $file = json_decode($curlReturn, false); |
116 | 116 | $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? \reset($file)->tag_name : $default); |
117 | 117 | $latestVersion = $file[0]->tag_name; |
118 | 118 | $prerelease = $file[0]->prerelease; |
119 | 119 | if ('master' !== $latestVersionLink) { |
120 | - $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; |
|
120 | + $update = \constant('CO_'.$moduleDirNameUpper.'_'.'NEW_VERSION').$latestVersion; |
|
121 | 121 | } |
122 | 122 | //"PHP-standardized" version |
123 | 123 | $latestVersion = \mb_strtolower($latestVersion); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion)); |
126 | 126 | $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion)); |
127 | 127 | } |
128 | - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); |
|
128 | + $moduleVersion = ($helper->getModule()->getInfo('version').'_'.$helper->getModule()->getInfo('module_status')); |
|
129 | 129 | //"PHP-standardized" version |
130 | 130 | $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); |
131 | 131 | // $moduleVersion = '1.0'; //for testing only |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | if (self::SHOW_BUTTONS == $displaySampleButton) { |
64 | 64 | \xoops_loadLanguage('admin/modulesadmin', 'system'); |
65 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); |
|
66 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); |
|
67 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); |
|
65 | + $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); |
|
66 | + $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); |
|
67 | + $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); |
|
68 | 68 | // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add'); |
69 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); |
|
69 | + $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); |
|
70 | 70 | } else { |
71 | - $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); |
|
71 | + $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); |
|
72 | 72 | // $displaySampleButton = $config['displaySampleButton']; |
73 | 73 | } |
74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function hideButtons(): void |
82 | 82 | { |
83 | - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; |
|
83 | + $yamlFile = \dirname(__DIR__, 2).'/config/admin.yml'; |
|
84 | 84 | $app = []; |
85 | 85 | $app['displaySampleButton'] = 0; |
86 | 86 | Yaml::save($app, $yamlFile); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public static function showButtons(): void |
96 | 96 | { |
97 | - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; |
|
97 | + $yamlFile = \dirname(__DIR__, 2).'/config/admin.yml'; |
|
98 | 98 | $app = []; |
99 | 99 | $app['displaySampleButton'] = 1; |
100 | 100 | Yaml::save($app, $yamlFile); |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
37 | 37 | // $query = $GLOBALS['xoopsDB']->query($sql); |
38 | 38 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
39 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
39 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".\constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n"; |
|
40 | 40 | $html .= "<div style='padding: 8px;'>\n"; |
41 | 41 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
42 | 42 | // $html .= "<br>\n"; |
43 | 43 | // $html .= "<br>\n"; |
44 | - $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
44 | + $html .= '<div>'.\constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n"; |
|
45 | 45 | $html .= "<ul>\n"; |
46 | 46 | |
47 | - $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
48 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
47 | + $gdlib = \function_exists('gd_info') ? '<span style="color: green;">'.\constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.\constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>'; |
|
48 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib; |
|
49 | 49 | if (\function_exists('gd_info')) { |
50 | 50 | if (true === ($gdlib = gd_info())) { |
51 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
51 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>'; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | // |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
59 | 59 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
60 | 60 | // |
61 | - $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
62 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
61 | + $downloads = \ini_get('file_uploads') ? '<span style="color: green;">'.\constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.\constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>'; |
|
62 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads; |
|
63 | 63 | |
64 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n"; |
|
65 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n"; |
|
66 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n"; |
|
64 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.\ini_get('upload_max_filesize')."</span></b>\n"; |
|
65 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.\ini_get('post_max_size')."</span></b>\n"; |
|
66 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.\ini_get('memory_limit')."</span></b>\n"; |
|
67 | 67 | $html .= "</ul>\n"; |
68 | 68 | $html .= "<ul>\n"; |
69 | - $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
69 | + $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n"; |
|
70 | 70 | $html .= "</ul>\n"; |
71 | 71 | $html .= "<br>\n"; |
72 | - $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
72 | + $html .= \constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n"; |
|
73 | 73 | $html .= '</div>'; |
74 | 74 | $html .= '</fieldset><br>'; |
75 | 75 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); |
33 | 33 | } |
34 | 34 | |
35 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
35 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
36 | 36 | } |
37 | 37 | } catch (\Throwable $e) { |
38 | 38 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | $dir = \opendir($src); |
58 | 58 | // @mkdir($dst); |
59 | 59 | if (!@\mkdir($dst) && !\is_dir($dst)) { |
60 | - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
|
60 | + throw new \RuntimeException('The directory '.$dst.' could not be created.'); |
|
61 | 61 | } |
62 | 62 | while (false !== ($file = \readdir($dir))) { |
63 | 63 | if (('.' !== $file) && ('..' !== $file)) { |
64 | - if (\is_dir($src . '/' . $file)) { |
|
65 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
64 | + if (\is_dir($src.'/'.$file)) { |
|
65 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
66 | 66 | } else { |
67 | - \copy($src . '/' . $file, $dst . '/' . $file); |
|
67 | + \copy($src.'/'.$file, $dst.'/'.$file); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | self::rrmdir($fObj->getPathname()); |
155 | 155 | } |
156 | 156 | } |
157 | - $iterator = null; // clear iterator Obj to close file/directory |
|
157 | + $iterator = null; // clear iterator Obj to close file/directory |
|
158 | 158 | |
159 | 159 | return \rmdir($src); // remove the directory & return results |
160 | 160 | } |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | $iterator = new \DirectoryIterator($src); |
189 | 189 | foreach ($iterator as $fObj) { |
190 | 190 | if ($fObj->isFile()) { |
191 | - \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
191 | + \rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
192 | 192 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
193 | 193 | // Try recursively on directory |
194 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
194 | + self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
195 | 195 | // rmdir($fObj->getPath()); // now delete the directory |
196 | 196 | } |
197 | 197 | } |
198 | - $iterator = null; // clear iterator Obj to close file/directory |
|
198 | + $iterator = null; // clear iterator Obj to close file/directory |
|
199 | 199 | |
200 | 200 | return \rmdir($src); // remove the directory & return results |
201 | 201 | } |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | $iterator = new \DirectoryIterator($src); |
233 | 233 | foreach ($iterator as $fObj) { |
234 | 234 | if ($fObj->isFile()) { |
235 | - \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
235 | + \copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
236 | 236 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
237 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
237 | + self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() |
45 | 45 | { |
46 | - $config = require \dirname(__DIR__, 2) . '/config/config.php'; |
|
46 | + $config = require \dirname(__DIR__, 2).'/config/config.php'; |
|
47 | 47 | |
48 | 48 | $this->name = $config->name; |
49 | 49 | $this->paths = $config->paths; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->moduleStats = $config->moduleStats; |
59 | 59 | $this->modCopyright = $config->modCopyright; |
60 | 60 | |
61 | - $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php'; |
|
62 | - $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; |
|
61 | + $this->icons = require \dirname(__DIR__, 2).'/config/icons.php'; |
|
62 | + $this->paths = require \dirname(__DIR__, 2).'/config/paths.php'; |
|
63 | 63 | } |
64 | 64 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | { |
60 | 60 | if ($considerHtml) { |
61 | 61 | // if the plain text is shorter than the maximum length, return the whole text |
62 | - if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { |
|
62 | + if (mb_strlen(\preg_replace('/<.*?'.'>/', '', $text)) <= $length) { |
|
63 | 63 | return $text; |
64 | 64 | } |
65 | 65 | // splits all html-tags to scanable lines |
66 | - \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); |
|
66 | + \preg_match_all('/(<.+?'.'>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); |
|
67 | 67 | $total_length = mb_strlen($ending); |
68 | 68 | $open_tags = []; |
69 | 69 | $truncate = ''; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | unset($open_tags[$pos]); |
82 | 82 | } |
83 | 83 | // if tag is an opening tag |
84 | - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { |
|
84 | + } elseif (\preg_match('/^<\s*([^\s>!]+).*?'.'>$/s', $line_matchings[1], $tag_matchings)) { |
|
85 | 85 | // add tag to the beginning of $open_tags list |
86 | 86 | \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); |
87 | 87 | } |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | } |
91 | 91 | // calculate the length of the plain text part of the line; handle entities as one character |
92 | 92 | $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); |
93 | - if ($total_length + $content_length > $length) { |
|
93 | + if ($total_length+$content_length > $length) { |
|
94 | 94 | // the number of characters which are left |
95 | - $left = $length - $total_length; |
|
95 | + $left = $length-$total_length; |
|
96 | 96 | $entities_length = 0; |
97 | 97 | // search for html entities |
98 | 98 | if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { |
99 | 99 | // calculate the real length of all entities in the legal range |
100 | 100 | foreach ($entities[0] as $entity) { |
101 | - if ($left >= $entity[1] + 1 - $entities_length) { |
|
101 | + if ($left >= $entity[1]+1-$entities_length) { |
|
102 | 102 | $left--; |
103 | 103 | $entities_length += mb_strlen($entity[0]); |
104 | 104 | } else { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); |
|
110 | + $truncate .= mb_substr($line_matchings[2], 0, $left+$entities_length); |
|
111 | 111 | // maximum lenght is reached, so get off the loop |
112 | 112 | break; |
113 | 113 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (mb_strlen($text) <= $length) { |
124 | 124 | return $text; |
125 | 125 | } |
126 | - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); |
|
126 | + $truncate = mb_substr($text, 0, $length-mb_strlen($ending)); |
|
127 | 127 | } |
128 | 128 | // if the words shouldn't be cut in the middle... |
129 | 129 | if (!$exact) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($considerHtml) { |
140 | 140 | // close all unclosed html-tags |
141 | 141 | foreach ($open_tags as $tag) { |
142 | - $truncate .= '</' . $tag . '>'; |
|
142 | + $truncate .= '</'.$tag.'>'; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $new_id = false; |
210 | 210 | $table = $GLOBALS['xoopsDB']->prefix($tableName); |
211 | 211 | // copy content of the record you wish to clone |
212 | - $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; |
|
212 | + $sql = "SELECT * FROM $table WHERE $idField='".$id."' "; |
|
213 | 213 | $result = $GLOBALS['xoopsDB']->query($sql); |
214 | 214 | if ($result instanceof \mysqli_result) { |
215 | 215 | $tempTable = $GLOBALS['xoopsDB']->fetchArray($result, \MYSQLI_ASSOC); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | // set the auto-incremented id's value to blank. |
221 | 221 | unset($tempTable[$id_field]); |
222 | 222 | // insert cloned copy of the original record |
223 | - $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')"; |
|
223 | + $sql = "INSERT INTO $table (".\implode(', ', \array_keys($tempTable)).") VALUES ('".\implode("', '", \array_values($tempTable))."')"; |
|
224 | 224 | $result = $GLOBALS['xoopsDB']->queryF($sql); |
225 | 225 | if (!$result) { |
226 | 226 | \trigger_error($GLOBALS['xoopsDB']->error()); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * Copyright (c) Hervé Thouzard of Instant Zero (https://www.instant-zero.com) |
9 | 9 | * **************************************************************************** |
10 | 10 | */ |
11 | -require_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
|
11 | +require_once XOOPS_ROOT_PATH.'/kernel/object.php'; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class MyiframeBaseHandler |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function get($id) |
37 | 37 | { |
38 | 38 | $ret = null; |
39 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
39 | + $sql = 'SELECT * FROM '.$this->db->prefix('myiframe').' WHERE frame_frameid='.(int) $id; |
|
40 | 40 | if (!$result = $this->db->query($sql)) { |
41 | 41 | return $ret; |
42 | 42 | } |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | { |
159 | 159 | $ret = []; |
160 | 160 | $limit = $start = 0; |
161 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe'); |
|
161 | + $sql = 'SELECT * FROM '.$this->db->prefix('myiframe'); |
|
162 | 162 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
163 | - $sql .= ' ' . $criteria->renderWhere(); |
|
163 | + $sql .= ' '.$criteria->renderWhere(); |
|
164 | 164 | if ('' !== $criteria->getSort()) { |
165 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
165 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
166 | 166 | } |
167 | 167 | $limit = $criteria->getLimit(); |
168 | 168 | $start = $criteria->getStart(); |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function getCount(\CriteriaCompo $criteria = null) |
189 | 189 | { |
190 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe'); |
|
190 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('myiframe'); |
|
191 | 191 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
192 | - $sql .= ' ' . $criteria->renderWhere(); |
|
192 | + $sql .= ' '.$criteria->renderWhere(); |
|
193 | 193 | } |
194 | 194 | $result = $this->db->query($sql); |
195 | 195 | if (!$result) { |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function deleteAll(\CriteriaCompo $criteria = null) |
208 | 208 | { |
209 | - $sql = 'DELETE FROM ' . $this->db->prefix('myiframe'); |
|
209 | + $sql = 'DELETE FROM '.$this->db->prefix('myiframe'); |
|
210 | 210 | if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { |
211 | - $sql .= ' ' . $criteria->renderWhere(); |
|
211 | + $sql .= ' '.$criteria->renderWhere(); |
|
212 | 212 | } |
213 | 213 | if (!$result = $this->db->query($sql)) { |
214 | 214 | return false; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function updatehits($frame_id): void |
224 | 224 | { |
225 | - $sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id); |
|
225 | + $sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int) $frame_id); |
|
226 | 226 | $this->db->queryF($sql); |
227 | 227 | } |
228 | 228 | } |