Skip to content

Commit cad2069

Browse files
committed
type cast
1 parent 260c534 commit cad2069

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

class/Building.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ public function clearDir($dir, $pattern = '*'): void
100100
\unlink($file);
101101
}
102102
}
103+
$file = $dir . '/.gitignore';
104+
if (is_file($file)) {
105+
\unlink($file);
106+
}
107+
$file = $dir . '/.gitattributes';
108+
if (is_file($file)) {
109+
\unlink($file);
110+
}
111+
$file = $dir . '/.scrutinizer.yml';
112+
if (is_file($file)) {
113+
\unlink($file);
114+
}
103115
if (\is_dir($dir)) {
104116
\rmdir($dir);
105117
}

class/Files/CreateFile.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,14 @@ public function getLeftString($string)
340340
*/
341341
public function getRightString($string = null)
342342
{
343-
if (\mb_strpos($string, '_')) {
344-
$str = \mb_strpos($string, '_');
345-
if (false !== $str) {
346-
$ret = \mb_substr($string, $str + 1, \mb_strlen($string));
343+
if ('' != \trim($string)) {
344+
if (\mb_strpos($string, '_')) {
345+
$str = \mb_strpos($string, '_');
346+
if (false !== $str) {
347+
$ret = \mb_substr($string, $str + 1, \mb_strlen($string));
347348

348-
return $ret;
349+
return $ret;
350+
}
349351
}
350352
}
351353

class/Form/FormRadio.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function render()
3131
{
3232
$ret = '';
3333
$ele_name = $this->getName();
34-
$ele_title = $this->getTitle();
35-
$ele_value = $this->getValue();
34+
$ele_title = (string)$this->getTitle();
35+
$ele_value = (string)$this->getValue();
3636
$ele_options = $this->getOptions();
3737
$ele_extra = $this->getExtra();
3838
$ele_delimeter = empty($this->columns) ? $this->getDelimeter() : '';
@@ -41,6 +41,12 @@ public function render()
4141
}
4242
$i = 0;
4343
$id_ele = 0;
44+
if ('' != $ele_title) {
45+
$ele_title = htmlspecialchars($ele_title, ENT_QUOTES);
46+
}
47+
if ('' != $ele_value) {
48+
$ele_value = htmlspecialchars($ele_value, ENT_QUOTES);
49+
}
4450
foreach ($ele_options as $value => $name) {
4551
++$id_ele;
4652
if (!empty($this->columns)) {
@@ -49,7 +55,7 @@ public function render()
4955
}
5056
$ret .= '<td class="radio">';
5157
}
52-
$ret .= '<input type="radio" name="' . $ele_name . '" id="' . $ele_name . '[' . $value . ']' . $id_ele . '" title = "' . htmlspecialchars((string)$ele_title, ENT_QUOTES) . '" value="' . htmlspecialchars($value, ENT_QUOTES) . '"';
58+
$ret .= '<input type="radio" name="' . $ele_name . '" id="' . $ele_name . '[' . $value . ']' . $id_ele . '" title = "' . $ele_title . '" value="' . $ele_value . '"';
5359
if (isset($ele_value) && $value == $ele_value) {
5460
$ret .= ' checked';
5561
}

0 commit comments

Comments
 (0)