@@ -88,7 +88,7 @@ |
||
| 88 | 88 | $this->synchronizeTable($tableName); |
| 89 | 89 | $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); |
| 90 | 90 | $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); |
| 91 | - $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; |
|
| 91 | + $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n"."SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n".' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; |
|
| 92 | 92 | $this->tableHandler->addToQueue($sql); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | // require \dirname(\dirname(__DIR__)) . '/config/config.php'; |
| 52 | 52 | // $config = getConfig(); |
| 53 | 53 | |
| 54 | - $config = include dirname(__DIR__, 2) . '/config/config.php'; |
|
| 54 | + $config = include dirname(__DIR__, 2).'/config/config.php'; |
|
| 55 | 55 | |
| 56 | 56 | $this->name = $config->name; |
| 57 | 57 | $this->paths = $config->paths; |
@@ -67,29 +67,29 @@ discard block |
||
| 67 | 67 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
| 68 | 68 | // Get Theme Form |
| 69 | 69 | \xoops_load('XoopsFormLoader'); |
| 70 | - $form = new \XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); |
|
| 70 | + $form = new \XoopsThemeForm(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true); |
|
| 71 | 71 | $form->setExtra('enctype="multipart/form-data"'); |
| 72 | 72 | |
| 73 | - $recipient = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail')); |
|
| 73 | + $recipient = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail')); |
|
| 74 | 74 | $recipient->setExtra('disabled="disabled"'); |
| 75 | 75 | $form->addElement($recipient); |
| 76 | - $your_name = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name); |
|
| 77 | - $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"'); |
|
| 76 | + $your_name = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME'), 'your_name', 50, 255, $this->name); |
|
| 77 | + $your_name->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME_PLACEHOLER').'"'); |
|
| 78 | 78 | $form->addElement($your_name); |
| 79 | - $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); |
|
| 80 | - $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); |
|
| 79 | + $your_site = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE'), 'your_site', 50, 255, $this->site); |
|
| 80 | + $your_site->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE_PLACEHOLER').'"'); |
|
| 81 | 81 | $form->addElement($your_site); |
| 82 | - $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); |
|
| 83 | - $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); |
|
| 82 | + $your_mail = new \XoopsFormText(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL'), 'your_mail', 50, 255, $this->email); |
|
| 83 | + $your_mail->setExtra('placeholder="'.\constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL_PLACEHOLER').'"'); |
|
| 84 | 84 | $form->addElement($your_mail); |
| 85 | 85 | |
| 86 | - $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); |
|
| 86 | + $fbtypeSelect = new \XoopsFormSelect(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE'), 'fb_type', $this->type); |
|
| 87 | 87 | $fbtypeSelect->addOption('', ''); |
| 88 | - $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION')); |
|
| 89 | - $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS')); |
|
| 90 | - $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL')); |
|
| 91 | - $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES')); |
|
| 92 | - $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS')); |
|
| 88 | + $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_SUGGESTION'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_SUGGESTION')); |
|
| 89 | + $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_BUGS'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_BUGS')); |
|
| 90 | + $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_TESTIMONIAL'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_TESTIMONIAL')); |
|
| 91 | + $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_FEATURES'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_FEATURES')); |
|
| 92 | + $fbtypeSelect->addOption(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_OTHERS'), \constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_OTHERS')); |
|
| 93 | 93 | $form->addElement($fbtypeSelect, true); |
| 94 | 94 | |
| 95 | 95 | $editorConfigs = []; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $configHandler = \xoops_getHandler('config'); |
| 105 | 105 | $config = &$configHandler->getConfigsByCat(0, $module->getVar('mid')); |
| 106 | 106 | $editorConfigs['editor'] = $config['general_editor']; |
| 107 | - $editor = new \XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); |
|
| 107 | + $editor = new \XoopsFormEditor(\constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs); |
|
| 108 | 108 | $form->addElement($editor, true); |
| 109 | 109 | |
| 110 | 110 | $form->addElement(new \XoopsFormHidden('op', 'send')); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
| 38 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
| 39 | 39 | } |
| 40 | 40 | } catch (\Exception $e) { |
| 41 | 41 | echo 'Caught exception: ', $e->getMessage(), '<br>'; |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | $dir = \opendir($src); |
| 62 | 62 | // @\mkdir($dst); |
| 63 | 63 | if (!@\mkdir($dst) && !\is_dir($dst)) { |
| 64 | - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
|
| 64 | + throw new \RuntimeException('The directory '.$dst.' could not be created.'); |
|
| 65 | 65 | } |
| 66 | 66 | while (false !== ($file = \readdir($dir))) { |
| 67 | 67 | if (('.' !== $file) && ('..' !== $file)) { |
| 68 | - if (\is_dir($src . '/' . $file)) { |
|
| 69 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
| 68 | + if (\is_dir($src.'/'.$file)) { |
|
| 69 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
| 70 | 70 | } else { |
| 71 | - \copy($src . '/' . $file, $dst . '/' . $file); |
|
| 71 | + \copy($src.'/'.$file, $dst.'/'.$file); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | self::rrmdir($fObj->getPathname()); |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | - $iterator = null; // clear iterator Obj to close file/directory |
|
| 210 | + $iterator = null; // clear iterator Obj to close file/directory |
|
| 211 | 211 | return \rmdir($src); // remove the directory & return results |
| 212 | 212 | } |
| 213 | 213 | |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | $iterator = new \DirectoryIterator($src); |
| 241 | 241 | foreach ($iterator as $fObj) { |
| 242 | 242 | if ($fObj->isFile()) { |
| 243 | - \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 243 | + \rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 244 | 244 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
| 245 | 245 | // Try recursively on directory |
| 246 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 246 | + self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 247 | 247 | // \rmdir($fObj->getPath()); // now delete the directory |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - $iterator = null; // clear iterator Obj to close file/directory |
|
| 250 | + $iterator = null; // clear iterator Obj to close file/directory |
|
| 251 | 251 | return \rmdir($src); // remove the directory & return results |
| 252 | 252 | } |
| 253 | 253 | |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | $iterator = new \DirectoryIterator($src); |
| 284 | 284 | foreach ($iterator as $fObj) { |
| 285 | 285 | if ($fObj->isFile()) { |
| 286 | - \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 286 | + \copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 287 | 287 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
| 288 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 288 | + self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -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; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | if (false !== $reqVer && '' !== $reqVer) { |
| 77 | 77 | if (\version_compare($verNum, $reqVer, '<')) { |
| 78 | - $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
| 78 | + $module->setErrors(\sprintf(\constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
| 79 | 79 | $success = false; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $moduleDirName = \basename(dirname(__DIR__, 2)); |
| 98 | 98 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
| 99 | 99 | $update = ''; |
| 100 | - $repository = 'XoopsModules25x/' . $moduleDirName; |
|
| 100 | + $repository = 'XoopsModules25x/'.$moduleDirName; |
|
| 101 | 101 | // $repository = 'XoopsModules25x/publisher'; //for testing only |
| 102 | 102 | $ret = ''; |
| 103 | 103 | $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | if (false === $curlReturn) { |
| 112 | 112 | \trigger_error(\curl_error($curlHandle)); |
| 113 | 113 | } elseif (mb_strpos($curlReturn, 'Not Found')) { |
| 114 | - \trigger_error('Repository Not Found: ' . $infoReleasesUrl); |
|
| 114 | + \trigger_error('Repository Not Found: '.$infoReleasesUrl); |
|
| 115 | 115 | } else { |
| 116 | 116 | $file = \json_decode($curlReturn, false); |
| 117 | 117 | $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); |
| 118 | 118 | $latestVersion = $file[0]->tag_name; |
| 119 | 119 | $prerelease = $file[0]->prerelease; |
| 120 | 120 | if ('master' !== $latestVersionLink) { |
| 121 | - $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; |
|
| 121 | + $update = \constant('CO_'.$moduleDirNameUpper.'_'.'NEW_VERSION').$latestVersion; |
|
| 122 | 122 | } |
| 123 | 123 | //"PHP-standardized" version |
| 124 | 124 | $latestVersion = \mb_strtolower($latestVersion); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion)); |
| 127 | 127 | $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion)); |
| 128 | 128 | } |
| 129 | - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); |
|
| 129 | + $moduleVersion = ($helper->getModule()->getInfo('version').'_'.$helper->getModule()->getInfo('module_status')); |
|
| 130 | 130 | //"PHP-standardized" version |
| 131 | 131 | $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); |
| 132 | 132 | // $moduleVersion = '1.0'; //for testing only |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public function getHandler($name) |
| 72 | 72 | { |
| 73 | - $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; |
|
| 73 | + $class = __NAMESPACE__.'\\'.\ucfirst($name).'Handler'; |
|
| 74 | 74 | if (!\class_exists($class)) { |
| 75 | 75 | throw new \RuntimeException("Class '$class' not found"); |
| 76 | 76 | } |
@@ -1991,8 +1991,8 @@ |
||
| 1991 | 1991 | 'q', 'rt', 'ins', 'font', 'strong', |
| 1992 | 1992 | 's', 'tt', 'kbd', 'mark', |
| 1993 | 1993 | 'u', 'xm', 'sub', 'nobr', |
| 1994 | - 'sup', 'ruby', |
|
| 1995 | - 'var', 'span', |
|
| 1996 | - 'wbr', 'time', |
|
| 1994 | + 'sup', 'ruby', |
|
| 1995 | + 'var', 'span', |
|
| 1996 | + 'wbr', 'time', |
|
| 1997 | 1997 | ); |
| 1998 | 1998 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | if (isset($CurrentBlock['continuable'])) |
| 211 | 211 | { |
| 212 | - $methodName = 'block' . $CurrentBlock['type'] . 'Continue'; |
|
| 212 | + $methodName = 'block'.$CurrentBlock['type'].'Continue'; |
|
| 213 | 213 | $Block = $this->$methodName($Line, $CurrentBlock); |
| 214 | 214 | |
| 215 | 215 | if (isset($Block)) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } else { |
| 221 | 221 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
| 222 | 222 | { |
| 223 | - $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; |
|
| 223 | + $methodName = 'block'.$CurrentBlock['type'].'Complete'; |
|
| 224 | 224 | $CurrentBlock = $this->$methodName($CurrentBlock); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | foreach ($this->BlockTypes[$marker] as $blockType) |
| 240 | 240 | { |
| 241 | - $blockTypes []= $blockType; |
|
| 241 | + $blockTypes [] = $blockType; |
|
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | $Block['type'] = $blockType; |
| 255 | 255 | |
| 256 | - if ( ! isset($Block['identified'])) |
|
| 256 | + if (!isset($Block['identified'])) |
|
| 257 | 257 | { |
| 258 | 258 | if (isset($CurrentBlock)) |
| 259 | 259 | { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) |
| 302 | 302 | { |
| 303 | - $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; |
|
| 303 | + $methodName = 'block'.$CurrentBlock['type'].'Complete'; |
|
| 304 | 304 | $CurrentBlock = $this->$methodName($CurrentBlock); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | protected function extractElement(array $Component) |
| 320 | 320 | { |
| 321 | - if ( ! isset($Component['element'])) |
|
| 321 | + if (!isset($Component['element'])) |
|
| 322 | 322 | { |
| 323 | 323 | if (isset($Component['markup'])) |
| 324 | 324 | { |
@@ -333,12 +333,12 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | protected function isBlockContinuable($Type) |
| 335 | 335 | { |
| 336 | - return method_exists($this, 'block' . $Type . 'Continue'); |
|
| 336 | + return method_exists($this, 'block'.$Type.'Continue'); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | protected function isBlockCompletable($Type) |
| 340 | 340 | { |
| 341 | - return method_exists($this, 'block' . $Type . 'Complete'); |
|
| 341 | + return method_exists($this, 'block'.$Type.'Complete'); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | # |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | protected function blockCode($Line, $Block = null) |
| 348 | 348 | { |
| 349 | - if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted'])) |
|
| 349 | + if (isset($Block) and $Block['type'] === 'Paragraph' and !isset($Block['interrupted'])) |
|
| 350 | 350 | { |
| 351 | 351 | return; |
| 352 | 352 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | return; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $Block['element']['rawHtml'] .= "\n" . $Line['body']; |
|
| 433 | + $Block['element']['rawHtml'] .= "\n".$Line['body']; |
|
| 434 | 434 | |
| 435 | 435 | if (strpos($Line['text'], '-->') !== false) |
| 436 | 436 | { |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | return $Block; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - $Block['element']['element']['text'] .= "\n" . $Line['body']; |
|
| 524 | + $Block['element']['element']['text'] .= "\n".$Line['body']; |
|
| 525 | 525 | |
| 526 | 526 | return $Block; |
| 527 | 527 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | $Block = array( |
| 556 | 556 | 'element' => array( |
| 557 | - 'name' => 'h' . $level, |
|
| 557 | + 'name' => 'h'.$level, |
|
| 558 | 558 | 'handler' => array( |
| 559 | 559 | 'function' => 'lineElements', |
| 560 | 560 | 'argument' => $text, |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | { |
| 582 | 582 | $contentIndent -= 1; |
| 583 | 583 | $matches[1] = substr($matches[1], 0, -$contentIndent); |
| 584 | - $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; |
|
| 584 | + $matches[3] = str_repeat(' ', $contentIndent).$matches[3]; |
|
| 585 | 585 | } elseif ($contentIndent === 0) { |
| 586 | 586 | $matches[1] .= ' '; |
| 587 | 587 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | if ( |
| 613 | 613 | isset($CurrentBlock) |
| 614 | 614 | and $CurrentBlock['type'] === 'Paragraph' |
| 615 | - and ! isset($CurrentBlock['interrupted']) |
|
| 615 | + and !isset($CurrentBlock['interrupted']) |
|
| 616 | 616 | ) { |
| 617 | 617 | return; |
| 618 | 618 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | ) |
| 631 | 631 | ); |
| 632 | 632 | |
| 633 | - $Block['element']['elements'] []= & $Block['li']; |
|
| 633 | + $Block['element']['elements'] [] = & $Block['li']; |
|
| 634 | 634 | |
| 635 | 635 | return $Block; |
| 636 | 636 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | ) |
| 658 | 658 | ) { |
| 659 | 659 | if (isset($Block['interrupted'])) { |
| 660 | - $Block['li']['handler']['argument'] []= ''; |
|
| 660 | + $Block['li']['handler']['argument'] [] = ''; |
|
| 661 | 661 | |
| 662 | 662 | $Block['loose'] = true; |
| 663 | 663 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | ) |
| 680 | 680 | ); |
| 681 | 681 | |
| 682 | - $Block['element']['elements'] []= & $Block['li']; |
|
| 682 | + $Block['element']['elements'] [] = & $Block['li']; |
|
| 683 | 683 | |
| 684 | 684 | return $Block; |
| 685 | 685 | } elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) { |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | if ($Line['indent'] >= $requiredIndent) { |
| 694 | 694 | if (isset($Block['interrupted'])) |
| 695 | 695 | { |
| 696 | - $Block['li']['handler']['argument'] []= ''; |
|
| 696 | + $Block['li']['handler']['argument'] [] = ''; |
|
| 697 | 697 | |
| 698 | 698 | $Block['loose'] = true; |
| 699 | 699 | |
@@ -702,15 +702,15 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $text = substr($Line['body'], $requiredIndent); |
| 704 | 704 | |
| 705 | - $Block['li']['handler']['argument'] []= $text; |
|
| 705 | + $Block['li']['handler']['argument'] [] = $text; |
|
| 706 | 706 | |
| 707 | 707 | return $Block; |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - if ( ! isset($Block['interrupted'])) { |
|
| 710 | + if (!isset($Block['interrupted'])) { |
|
| 711 | 711 | $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']); |
| 712 | 712 | |
| 713 | - $Block['li']['handler']['argument'] []= $text; |
|
| 713 | + $Block['li']['handler']['argument'] [] = $text; |
|
| 714 | 714 | |
| 715 | 715 | return $Block; |
| 716 | 716 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | if (end($li['handler']['argument']) !== '') |
| 725 | 725 | { |
| 726 | - $li['handler']['argument'] []= ''; |
|
| 726 | + $li['handler']['argument'] [] = ''; |
|
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | 729 | } |
@@ -759,13 +759,13 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches)) { |
| 762 | - $Block['element']['handler']['argument'] []= $matches[1]; |
|
| 762 | + $Block['element']['handler']['argument'] [] = $matches[1]; |
|
| 763 | 763 | |
| 764 | 764 | return $Block; |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | - if ( ! isset($Block['interrupted'])) { |
|
| 768 | - $Block['element']['handler']['argument'] []= $Line['text']; |
|
| 767 | + if (!isset($Block['interrupted'])) { |
|
| 768 | + $Block['element']['handler']['argument'] [] = $Line['text']; |
|
| 769 | 769 | |
| 770 | 770 | return $Block; |
| 771 | 771 | } |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | protected function blockSetextHeader($Line, array $Block = null) |
| 796 | 796 | { |
| 797 | - if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { |
|
| 797 | + if (!isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { |
|
| 798 | 798 | return; |
| 799 | 799 | } |
| 800 | 800 | |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | return; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | - $Block['element']['rawHtml'] .= "\n" . $Line['body']; |
|
| 842 | + $Block['element']['rawHtml'] .= "\n".$Line['body']; |
|
| 843 | 843 | |
| 844 | 844 | return $Block; |
| 845 | 845 | } |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | protected function blockTable($Line, array $Block = null) |
| 876 | 876 | { |
| 877 | - if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { |
|
| 877 | + if (!isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted'])) { |
|
| 878 | 878 | return; |
| 879 | 879 | } |
| 880 | 880 | |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $alignment = $alignment === 'left' ? 'center' : 'right'; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - $alignments []= $alignment; |
|
| 920 | + $alignments [] = $alignment; |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | # ~ |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | ); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | - $HeaderElements []= $HeaderElement; |
|
| 958 | + $HeaderElements [] = $HeaderElement; |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | # ~ |
@@ -969,16 +969,16 @@ discard block |
||
| 969 | 969 | ), |
| 970 | 970 | ); |
| 971 | 971 | |
| 972 | - $Block['element']['elements'] []= array( |
|
| 972 | + $Block['element']['elements'] [] = array( |
|
| 973 | 973 | 'name' => 'thead', |
| 974 | 974 | ); |
| 975 | 975 | |
| 976 | - $Block['element']['elements'] []= array( |
|
| 976 | + $Block['element']['elements'] [] = array( |
|
| 977 | 977 | 'name' => 'tbody', |
| 978 | 978 | 'elements' => array(), |
| 979 | 979 | ); |
| 980 | 980 | |
| 981 | - $Block['element']['elements'][0]['elements'] []= array( |
|
| 981 | + $Block['element']['elements'][0]['elements'] [] = array( |
|
| 982 | 982 | 'name' => 'tr', |
| 983 | 983 | 'elements' => $HeaderElements, |
| 984 | 984 | ); |
@@ -1021,11 +1021,11 @@ discard block |
||
| 1021 | 1021 | if (isset($Block['alignments'][$index])) |
| 1022 | 1022 | { |
| 1023 | 1023 | $Element['attributes'] = array( |
| 1024 | - 'style' => 'text-align: ' . $Block['alignments'][$index] . ';', |
|
| 1024 | + 'style' => 'text-align: '.$Block['alignments'][$index].';', |
|
| 1025 | 1025 | ); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | - $Elements []= $Element; |
|
| 1028 | + $Elements [] = $Element; |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | $Element = array( |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | 'elements' => $Elements, |
| 1034 | 1034 | ); |
| 1035 | 1035 | |
| 1036 | - $Block['element']['elements'][1]['elements'] []= $Element; |
|
| 1036 | + $Block['element']['elements'][1]['elements'] [] = $Element; |
|
| 1037 | 1037 | |
| 1038 | 1038 | return $Block; |
| 1039 | 1039 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | |
| 1134 | 1134 | $Inline = $this->{"inline$inlineType"}($Excerpt); |
| 1135 | 1135 | |
| 1136 | - if ( ! isset($Inline)) |
|
| 1136 | + if (!isset($Inline)) |
|
| 1137 | 1137 | { |
| 1138 | 1138 | continue; |
| 1139 | 1139 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | # sets a default inline position |
| 1149 | 1149 | |
| 1150 | - if ( ! isset($Inline['position'])) |
|
| 1150 | + if (!isset($Inline['position'])) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | $Inline['position'] = $markerPosition; |
| 1153 | 1153 | } |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | |
| 1192 | 1192 | foreach ($Elements as &$Element) |
| 1193 | 1193 | { |
| 1194 | - if ( ! isset($Element['autobreak'])) |
|
| 1194 | + if (!isset($Element['autobreak'])) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | $Element['autobreak'] = false; |
| 1197 | 1197 | } |
@@ -1247,14 +1247,14 @@ discard block |
||
| 1247 | 1247 | $hostnameLabel = '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?'; |
| 1248 | 1248 | |
| 1249 | 1249 | $commonMarkEmail = '[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]++@' |
| 1250 | - . $hostnameLabel . '(?:\.' . $hostnameLabel . ')*'; |
|
| 1250 | + . $hostnameLabel.'(?:\.'.$hostnameLabel.')*'; |
|
| 1251 | 1251 | |
| 1252 | 1252 | if (strpos($Excerpt['text'], '>') !== false |
| 1253 | 1253 | and preg_match("/^<((mailto:)?$commonMarkEmail)>/i", $Excerpt['text'], $matches) |
| 1254 | - ){ |
|
| 1254 | + ) { |
|
| 1255 | 1255 | $url = $matches[1]; |
| 1256 | 1256 | |
| 1257 | - if ( ! isset($matches[2])) |
|
| 1257 | + if (!isset($matches[2])) |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $url = "mailto:$url"; |
| 1260 | 1260 | } |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | |
| 1275 | 1275 | protected function inlineEmphasis($Excerpt) |
| 1276 | 1276 | { |
| 1277 | - if ( ! isset($Excerpt['text'][1])) |
|
| 1277 | + if (!isset($Excerpt['text'][1])) |
|
| 1278 | 1278 | { |
| 1279 | 1279 | return; |
| 1280 | 1280 | } |
@@ -1320,12 +1320,12 @@ discard block |
||
| 1320 | 1320 | |
| 1321 | 1321 | protected function inlineImage($Excerpt) |
| 1322 | 1322 | { |
| 1323 | - if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
| 1323 | + if (!isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') |
|
| 1324 | 1324 | { |
| 1325 | 1325 | return; |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | - $Excerpt['text']= substr($Excerpt['text'], 1); |
|
| 1328 | + $Excerpt['text'] = substr($Excerpt['text'], 1); |
|
| 1329 | 1329 | |
| 1330 | 1330 | $Link = $this->inlineLink($Excerpt); |
| 1331 | 1331 | |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | $definition = strtolower($Element['handler']['argument']); |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | - if ( ! isset($this->DefinitionData['Reference'][$definition])) |
|
| 1414 | + if (!isset($this->DefinitionData['Reference'][$definition])) |
|
| 1415 | 1415 | { |
| 1416 | 1416 | return; |
| 1417 | 1417 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | and preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches) |
| 1467 | 1467 | ) { |
| 1468 | 1468 | return array( |
| 1469 | - 'element' => array('rawHtml' => '&' . $matches[1] . ';'), |
|
| 1469 | + 'element' => array('rawHtml' => '&'.$matches[1].';'), |
|
| 1470 | 1470 | 'extent' => strlen($matches[0]), |
| 1471 | 1471 | ); |
| 1472 | 1472 | } |
@@ -1476,7 +1476,7 @@ discard block |
||
| 1476 | 1476 | |
| 1477 | 1477 | protected function inlineStrikethrough($Excerpt) |
| 1478 | 1478 | { |
| 1479 | - if ( ! isset($Excerpt['text'][1])) |
|
| 1479 | + if (!isset($Excerpt['text'][1])) |
|
| 1480 | 1480 | { |
| 1481 | 1481 | return; |
| 1482 | 1482 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | |
| 1500 | 1500 | protected function inlineUrl($Excerpt) |
| 1501 | 1501 | { |
| 1502 | - if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
| 1502 | + if ($this->urlsLinked !== true or !isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') |
|
| 1503 | 1503 | { |
| 1504 | 1504 | return; |
| 1505 | 1505 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
| 1670 | 1670 | |
| 1671 | 1671 | if ($hasName) |
| 1672 | 1672 | { |
| 1673 | - $markup .= '<' . $Element['name']; |
|
| 1673 | + $markup .= '<'.$Element['name']; |
|
| 1674 | 1674 | |
| 1675 | 1675 | if (isset($Element['attributes'])) |
| 1676 | 1676 | { |
@@ -1728,7 +1728,7 @@ discard block |
||
| 1728 | 1728 | } |
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | - $markup .= $hasName ? '</' . $Element['name'] . '>' : ''; |
|
| 1731 | + $markup .= $hasName ? '</'.$Element['name'].'>' : ''; |
|
| 1732 | 1732 | } |
| 1733 | 1733 | elseif ($hasName) |
| 1734 | 1734 | { |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | // (autobreak === false) covers both sides of an element |
| 1758 | 1758 | $autoBreak = !$autoBreak ? $autoBreak : $autoBreakNext; |
| 1759 | 1759 | |
| 1760 | - $markup .= ($autoBreak ? "\n" : '') . $this->element($Element); |
|
| 1760 | + $markup .= ($autoBreak ? "\n" : '').$this->element($Element); |
|
| 1761 | 1761 | $autoBreak = $autoBreakNext; |
| 1762 | 1762 | } |
| 1763 | 1763 | |
@@ -1772,7 +1772,7 @@ discard block |
||
| 1772 | 1772 | { |
| 1773 | 1773 | $Elements = $this->linesElements($lines); |
| 1774 | 1774 | |
| 1775 | - if ( ! in_array('', $lines) |
|
| 1775 | + if (!in_array('', $lines) |
|
| 1776 | 1776 | and isset($Elements[0]) and isset($Elements[0]['name']) |
| 1777 | 1777 | and $Elements[0]['name'] === 'p' |
| 1778 | 1778 | ) { |
@@ -1829,12 +1829,12 @@ discard block |
||
| 1829 | 1829 | protected function sanitiseElement(array $Element) |
| 1830 | 1830 | { |
| 1831 | 1831 | static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; |
| 1832 | - static $safeUrlNameToAtt = array( |
|
| 1832 | + static $safeUrlNameToAtt = array( |
|
| 1833 | 1833 | 'a' => 'href', |
| 1834 | 1834 | 'img' => 'src', |
| 1835 | 1835 | ); |
| 1836 | 1836 | |
| 1837 | - if ( ! isset($Element['name'])) |
|
| 1837 | + if (!isset($Element['name'])) |
|
| 1838 | 1838 | { |
| 1839 | 1839 | unset($Element['attributes']); |
| 1840 | 1840 | return $Element; |
@@ -1845,12 +1845,12 @@ discard block |
||
| 1845 | 1845 | $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); |
| 1846 | 1846 | } |
| 1847 | 1847 | |
| 1848 | - if ( ! empty($Element['attributes'])) |
|
| 1848 | + if (!empty($Element['attributes'])) |
|
| 1849 | 1849 | { |
| 1850 | 1850 | foreach ($Element['attributes'] as $att => $val) |
| 1851 | 1851 | { |
| 1852 | 1852 | # filter out badly parsed attribute |
| 1853 | - if ( ! preg_match($goodAttribute, $att)) |
|
| 1853 | + if (!preg_match($goodAttribute, $att)) |
|
| 1854 | 1854 | { |
| 1855 | 1855 | unset($Element['attributes'][$att]); |
| 1856 | 1856 | } |
@@ -1951,8 +1951,8 @@ discard block |
||
| 1951 | 1951 | protected $textLevelElements = array( |
| 1952 | 1952 | 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', |
| 1953 | 1953 | 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', |
| 1954 | - 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
| 1955 | - 'q', 'rt', 'ins', 'font', 'strong', |
|
| 1954 | + 'i', 'rp', 'del', 'code', 'strike', 'marquee', |
|
| 1955 | + 'q', 'rt', 'ins', 'font', 'strong', |
|
| 1956 | 1956 | 's', 'tt', 'kbd', 'mark', |
| 1957 | 1957 | 'u', 'xm', 'sub', 'nobr', |
| 1958 | 1958 | 'sup', 'ruby', |
@@ -1284,12 +1284,10 @@ discard block |
||
| 1284 | 1284 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
| 1285 | 1285 | { |
| 1286 | 1286 | $emphasis = 'strong'; |
| 1287 | - } |
|
| 1288 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1287 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1289 | 1288 | { |
| 1290 | 1289 | $emphasis = 'em'; |
| 1291 | - } |
|
| 1292 | - else |
|
| 1290 | + } else |
|
| 1293 | 1291 | { |
| 1294 | 1292 | return; |
| 1295 | 1293 | } |
@@ -1380,8 +1378,7 @@ discard block |
||
| 1380 | 1378 | $extent += strlen($matches[0]); |
| 1381 | 1379 | |
| 1382 | 1380 | $remainder = substr($remainder, $extent); |
| 1383 | - } |
|
| 1384 | - else |
|
| 1381 | + } else |
|
| 1385 | 1382 | { |
| 1386 | 1383 | return; |
| 1387 | 1384 | } |
@@ -1396,8 +1393,7 @@ discard block |
||
| 1396 | 1393 | } |
| 1397 | 1394 | |
| 1398 | 1395 | $extent += strlen($matches[0]); |
| 1399 | - } |
|
| 1400 | - else |
|
| 1396 | + } else |
|
| 1401 | 1397 | { |
| 1402 | 1398 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
| 1403 | 1399 | { |
@@ -1405,8 +1401,7 @@ discard block |
||
| 1405 | 1401 | $definition = strtolower($definition); |
| 1406 | 1402 | |
| 1407 | 1403 | $extent += strlen($matches[0]); |
| 1408 | - } |
|
| 1409 | - else |
|
| 1404 | + } else |
|
| 1410 | 1405 | { |
| 1411 | 1406 | $definition = strtolower($Element['handler']['argument']); |
| 1412 | 1407 | } |
@@ -1571,8 +1566,7 @@ discard block |
||
| 1571 | 1566 | $argument = $Element['text']; |
| 1572 | 1567 | unset($Element['text']); |
| 1573 | 1568 | $destination = 'rawHtml'; |
| 1574 | - } |
|
| 1575 | - else |
|
| 1569 | + } else |
|
| 1576 | 1570 | { |
| 1577 | 1571 | $function = $Element['handler']['function']; |
| 1578 | 1572 | $argument = $Element['handler']['argument']; |
@@ -1609,8 +1603,7 @@ discard block |
||
| 1609 | 1603 | if (isset($Element['elements'])) |
| 1610 | 1604 | { |
| 1611 | 1605 | $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']); |
| 1612 | - } |
|
| 1613 | - elseif (isset($Element['element'])) |
|
| 1606 | + } elseif (isset($Element['element'])) |
|
| 1614 | 1607 | { |
| 1615 | 1608 | $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']); |
| 1616 | 1609 | } |
@@ -1623,8 +1616,7 @@ discard block |
||
| 1623 | 1616 | if (isset($Element['elements'])) |
| 1624 | 1617 | { |
| 1625 | 1618 | $Element['elements'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['elements']); |
| 1626 | - } |
|
| 1627 | - elseif (isset($Element['element'])) |
|
| 1619 | + } elseif (isset($Element['element'])) |
|
| 1628 | 1620 | { |
| 1629 | 1621 | $Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']); |
| 1630 | 1622 | } |
@@ -1711,26 +1703,22 @@ discard block |
||
| 1711 | 1703 | if (isset($Element['elements'])) |
| 1712 | 1704 | { |
| 1713 | 1705 | $markup .= $this->elements($Element['elements']); |
| 1714 | - } |
|
| 1715 | - elseif (isset($Element['element'])) |
|
| 1706 | + } elseif (isset($Element['element'])) |
|
| 1716 | 1707 | { |
| 1717 | 1708 | $markup .= $this->element($Element['element']); |
| 1718 | - } |
|
| 1719 | - else |
|
| 1709 | + } else |
|
| 1720 | 1710 | { |
| 1721 | 1711 | if (!$permitRawHtml) |
| 1722 | 1712 | { |
| 1723 | 1713 | $markup .= self::escape($text, true); |
| 1724 | - } |
|
| 1725 | - else |
|
| 1714 | + } else |
|
| 1726 | 1715 | { |
| 1727 | 1716 | $markup .= $text; |
| 1728 | 1717 | } |
| 1729 | 1718 | } |
| 1730 | 1719 | |
| 1731 | 1720 | $markup .= $hasName ? '</' . $Element['name'] . '>' : ''; |
| 1732 | - } |
|
| 1733 | - elseif ($hasName) |
|
| 1721 | + } elseif ($hasName) |
|
| 1734 | 1722 | { |
| 1735 | 1723 | $markup .= ' />'; |
| 1736 | 1724 | } |
@@ -1896,8 +1884,7 @@ discard block |
||
| 1896 | 1884 | if ($len > strlen($string)) |
| 1897 | 1885 | { |
| 1898 | 1886 | return false; |
| 1899 | - } |
|
| 1900 | - else |
|
| 1887 | + } else |
|
| 1901 | 1888 | { |
| 1902 | 1889 | return strtolower(substr($string, 0, $len)) === strtolower($needle); |
| 1903 | 1890 | } |
@@ -31,96 +31,96 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class ReleasesHandler extends \XoopsPersistableObjectHandler |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * Constructor |
|
| 36 | - * |
|
| 37 | - * @param \XoopsDatabase $db |
|
| 38 | - */ |
|
| 39 | - public function __construct(\XoopsDatabase $db) |
|
| 40 | - { |
|
| 41 | - parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param \XoopsDatabase $db |
|
| 38 | + */ |
|
| 39 | + public function __construct(\XoopsDatabase $db) |
|
| 40 | + { |
|
| 41 | + parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param bool $isNew |
|
| 46 | - * |
|
| 47 | - * @return object |
|
| 48 | - */ |
|
| 49 | - public function create($isNew = true) |
|
| 50 | - { |
|
| 51 | - return parent::create($isNew); |
|
| 52 | - } |
|
| 44 | + /** |
|
| 45 | + * @param bool $isNew |
|
| 46 | + * |
|
| 47 | + * @return object |
|
| 48 | + */ |
|
| 49 | + public function create($isNew = true) |
|
| 50 | + { |
|
| 51 | + return parent::create($isNew); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * retrieve a field |
|
| 56 | - * |
|
| 57 | - * @param int $i field id |
|
| 58 | - * @param null fields |
|
| 59 | - * @return mixed reference to the {@link Get} object |
|
| 60 | - */ |
|
| 61 | - public function get($i = null, $fields = null) |
|
| 62 | - { |
|
| 63 | - return parent::get($i, $fields); |
|
| 64 | - } |
|
| 54 | + /** |
|
| 55 | + * retrieve a field |
|
| 56 | + * |
|
| 57 | + * @param int $i field id |
|
| 58 | + * @param null fields |
|
| 59 | + * @return mixed reference to the {@link Get} object |
|
| 60 | + */ |
|
| 61 | + public function get($i = null, $fields = null) |
|
| 62 | + { |
|
| 63 | + return parent::get($i, $fields); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * get inserted id |
|
| 68 | - * |
|
| 69 | - * @param null |
|
| 70 | - * @return int reference to the {@link Get} object |
|
| 71 | - */ |
|
| 72 | - public function getInsertId() |
|
| 73 | - { |
|
| 74 | - return $this->db->getInsertId(); |
|
| 75 | - } |
|
| 66 | + /** |
|
| 67 | + * get inserted id |
|
| 68 | + * |
|
| 69 | + * @param null |
|
| 70 | + * @return int reference to the {@link Get} object |
|
| 71 | + */ |
|
| 72 | + public function getInsertId() |
|
| 73 | + { |
|
| 74 | + return $this->db->getInsertId(); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Get Count Releases in the database |
|
| 79 | - * @param int $start |
|
| 80 | - * @param int $limit |
|
| 81 | - * @param string $sort |
|
| 82 | - * @param string $order |
|
| 83 | - * @return int |
|
| 84 | - */ |
|
| 85 | - public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
| 86 | - { |
|
| 87 | - $crCountReleases = new \CriteriaCompo(); |
|
| 88 | - $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
| 89 | - return $this->getCount($crCountReleases); |
|
| 90 | - } |
|
| 77 | + /** |
|
| 78 | + * Get Count Releases in the database |
|
| 79 | + * @param int $start |
|
| 80 | + * @param int $limit |
|
| 81 | + * @param string $sort |
|
| 82 | + * @param string $order |
|
| 83 | + * @return int |
|
| 84 | + */ |
|
| 85 | + public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
| 86 | + { |
|
| 87 | + $crCountReleases = new \CriteriaCompo(); |
|
| 88 | + $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
| 89 | + return $this->getCount($crCountReleases); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Get All Releases in the database |
|
| 94 | - * @param int $start |
|
| 95 | - * @param int $limit |
|
| 96 | - * @param string $sort |
|
| 97 | - * @param string $order |
|
| 98 | - * @return array |
|
| 99 | - */ |
|
| 100 | - public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
| 101 | - { |
|
| 102 | - $crAllReleases = new \CriteriaCompo(); |
|
| 103 | - $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
| 104 | - return $this->getAll($crAllReleases); |
|
| 105 | - } |
|
| 92 | + /** |
|
| 93 | + * Get All Releases in the database |
|
| 94 | + * @param int $start |
|
| 95 | + * @param int $limit |
|
| 96 | + * @param string $sort |
|
| 97 | + * @param string $order |
|
| 98 | + * @return array |
|
| 99 | + */ |
|
| 100 | + public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
| 101 | + { |
|
| 102 | + $crAllReleases = new \CriteriaCompo(); |
|
| 103 | + $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
| 104 | + return $this->getAll($crAllReleases); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get Criteria Releases |
|
| 109 | - * @param $crReleases |
|
| 110 | - * @param int $start |
|
| 111 | - * @param int $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param string $order |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
| 117 | - { |
|
| 118 | - $crReleases->setStart($start); |
|
| 119 | - $crReleases->setLimit($limit); |
|
| 120 | - $crReleases->setSort($sort); |
|
| 121 | - $crReleases->setOrder($order); |
|
| 122 | - return $crReleases; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Get Criteria Releases |
|
| 109 | + * @param $crReleases |
|
| 110 | + * @param int $start |
|
| 111 | + * @param int $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param string $order |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
| 117 | + { |
|
| 118 | + $crReleases->setStart($start); |
|
| 119 | + $crReleases->setLimit($limit); |
|
| 120 | + $crReleases->setSort($sort); |
|
| 121 | + $crReleases->setOrder($order); |
|
| 122 | + return $crReleases; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * Update table requests |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (Constants::STATUS_NEW === $repoStatus || Constants::STATUS_UPDATED === $repoStatus || 0 == $releasesCount) { |
| 150 | 150 | $ghReleases = $libReleases->getReleases($repositoriesAll[$i]->getVar('repo_user'), $repositoriesAll[$i]->getVar('repo_name')); |
| 151 | 151 | if ($releasesCount > 0) { |
| 152 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
| 152 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
| 153 | 153 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
| 154 | 154 | return false; |
| 155 | 155 | } |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | $first = true; |
| 160 | 160 | $final = false; |
| 161 | 161 | foreach ($ghReleases as $ghRelease) { |
| 162 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
| 162 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
| 163 | 163 | // save first in any case and save first final version |
| 164 | 164 | $releasesObj = $releasesHandler->create(); |
| 165 | 165 | $releasesObj->setVar('rel_repoid', $repoId); |
| 166 | 166 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
| 167 | 167 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
| 168 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
| 168 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
| 169 | 169 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
| 170 | 170 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
| 171 | 171 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | $first = false; |
| 180 | - if (false === (bool)$ghRelease['prerelease']) { |
|
| 180 | + if (false === (bool) $ghRelease['prerelease']) { |
|
| 181 | 181 | $final = true; |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // must return true otherwise releases will not be loaded |
| 216 | 216 | return true; |
| 217 | 217 | } |
| 218 | - $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '` WHERE `rel_repoid` = ' . $repoId; |
|
| 218 | + $sql = 'DELETE FROM `'.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'` WHERE `rel_repoid` = '.$repoId; |
|
| 219 | 219 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
| 220 | 220 | return false; |
| 221 | 221 | } |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | $first = true; |
| 225 | 225 | $final = false; |
| 226 | 226 | foreach ($ghReleases as $ghRelease) { |
| 227 | - if ($first || (!$final && !(bool)$ghRelease['prerelease'])) { |
|
| 227 | + if ($first || (!$final && !(bool) $ghRelease['prerelease'])) { |
|
| 228 | 228 | // save first in any case and save first final version |
| 229 | 229 | $releasesObj = $releasesHandler->create(); |
| 230 | 230 | $releasesObj->setVar('rel_repoid', $repoId); |
| 231 | 231 | $releasesObj->setVar('rel_type', $ghRelease['type']); |
| 232 | 232 | $releasesObj->setVar('rel_name', $ghRelease['name']); |
| 233 | - $releasesObj->setVar('rel_prerelease', (true == (bool)$ghRelease['prerelease'])); |
|
| 233 | + $releasesObj->setVar('rel_prerelease', (true == (bool) $ghRelease['prerelease'])); |
|
| 234 | 234 | $releasesObj->setVar('rel_publishedat', \strtotime($ghRelease['published_at'])); |
| 235 | 235 | $releasesObj->setVar('rel_tarballurl', $ghRelease['tarball_url']); |
| 236 | 236 | $releasesObj->setVar('rel_zipballurl', $ghRelease['zipball_url']); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | $first = false; |
| 245 | - if (false === (bool)$ghRelease['prerelease']) { |
|
| 245 | + if (false === (bool) $ghRelease['prerelease']) { |
|
| 246 | 246 | $final = true; |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -259,17 +259,17 @@ discard block |
||
| 259 | 259 | public function updateRepoReleases() |
| 260 | 260 | { |
| 261 | 261 | // update repo_prerelease |
| 262 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 263 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
| 264 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_prerelease = 1 '; |
|
| 265 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=1));'; |
|
| 262 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 263 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
| 264 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_prerelease = 1 '; |
|
| 265 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=1));'; |
|
| 266 | 266 | $GLOBALS['xoopsDB']->queryF($sql); |
| 267 | 267 | |
| 268 | 268 | // update repo_release |
| 269 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . ' INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 270 | - $sql .= ' ON ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_id = ' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_repoid '; |
|
| 271 | - $sql .= 'SET ' . $GLOBALS['xoopsDB']->prefix('wggithub_repositories') . '.repo_release = 1 '; |
|
| 272 | - $sql .= 'WHERE (((' . $GLOBALS['xoopsDB']->prefix('wggithub_releases') . '.rel_prerelease)=0));'; |
|
| 269 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').' INNER JOIN '.$GLOBALS['xoopsDB']->prefix('wggithub_releases'); |
|
| 270 | + $sql .= ' ON '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_id = '.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_repoid '; |
|
| 271 | + $sql .= 'SET '.$GLOBALS['xoopsDB']->prefix('wggithub_repositories').'.repo_release = 1 '; |
|
| 272 | + $sql .= 'WHERE ((('.$GLOBALS['xoopsDB']->prefix('wggithub_releases').'.rel_prerelease)=0));'; |
|
| 273 | 273 | $GLOBALS['xoopsDB']->queryF($sql); |
| 274 | 274 | |
| 275 | 275 | return true; |
@@ -32,135 +32,135 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class Releases extends \XoopsObject |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Constructor |
|
| 37 | - * |
|
| 38 | - * @param null |
|
| 39 | - */ |
|
| 40 | - public function __construct() |
|
| 41 | - { |
|
| 42 | - $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
| 35 | + /** |
|
| 36 | + * Constructor |
|
| 37 | + * |
|
| 38 | + * @param null |
|
| 39 | + */ |
|
| 40 | + public function __construct() |
|
| 41 | + { |
|
| 42 | + $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
| 43 | 43 | $this->initVar('rel_repoid', XOBJ_DTYPE_INT); |
| 44 | - $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
| 45 | - $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
| 46 | - $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
| 44 | + $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
| 45 | + $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
| 46 | + $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
| 47 | 47 | $this->initVar('rel_publishedat', XOBJ_DTYPE_INT); |
| 48 | - $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
| 49 | - $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
| 50 | - $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
| 51 | - $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
| 52 | - } |
|
| 48 | + $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
| 49 | + $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
| 50 | + $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
| 51 | + $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @static function &getInstance |
|
| 56 | - * |
|
| 57 | - * @param null |
|
| 58 | - */ |
|
| 59 | - public static function getInstance() |
|
| 60 | - { |
|
| 61 | - static $instance = false; |
|
| 62 | - if (!$instance) { |
|
| 63 | - $instance = new self(); |
|
| 64 | - } |
|
| 65 | - } |
|
| 54 | + /** |
|
| 55 | + * @static function &getInstance |
|
| 56 | + * |
|
| 57 | + * @param null |
|
| 58 | + */ |
|
| 59 | + public static function getInstance() |
|
| 60 | + { |
|
| 61 | + static $instance = false; |
|
| 62 | + if (!$instance) { |
|
| 63 | + $instance = new self(); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * The new inserted $Id |
|
| 69 | - * @return inserted id |
|
| 70 | - */ |
|
| 71 | - public function getNewInsertedIdReleases() |
|
| 72 | - { |
|
| 73 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
| 74 | - return $newInsertedId; |
|
| 75 | - } |
|
| 67 | + /** |
|
| 68 | + * The new inserted $Id |
|
| 69 | + * @return inserted id |
|
| 70 | + */ |
|
| 71 | + public function getNewInsertedIdReleases() |
|
| 72 | + { |
|
| 73 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
| 74 | + return $newInsertedId; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @public function getForm |
|
| 79 | - * @param bool $action |
|
| 80 | - * @return \XoopsThemeForm |
|
| 81 | - */ |
|
| 82 | - public function getFormReleases($action = false) |
|
| 83 | - { |
|
| 84 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
| 85 | - if (!$action) { |
|
| 86 | - $action = $_SERVER['REQUEST_URI']; |
|
| 87 | - } |
|
| 88 | - // Title |
|
| 89 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
| 90 | - // Get Theme Form |
|
| 91 | - \xoops_load('XoopsFormLoader'); |
|
| 92 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
| 93 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 77 | + /** |
|
| 78 | + * @public function getForm |
|
| 79 | + * @param bool $action |
|
| 80 | + * @return \XoopsThemeForm |
|
| 81 | + */ |
|
| 82 | + public function getFormReleases($action = false) |
|
| 83 | + { |
|
| 84 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
| 85 | + if (!$action) { |
|
| 86 | + $action = $_SERVER['REQUEST_URI']; |
|
| 87 | + } |
|
| 88 | + // Title |
|
| 89 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
| 90 | + // Get Theme Form |
|
| 91 | + \xoops_load('XoopsFormLoader'); |
|
| 92 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
| 93 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 94 | 94 | // Form Table repositories |
| 95 | 95 | $repositoriesHandler = $helper->getHandler('Repositories'); |
| 96 | 96 | $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rel_repoid', $this->getVar('rel_repoid')); |
| 97 | 97 | $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
| 98 | 98 | $form->addElement($rmRepoidSelect); |
| 99 | - // Form Select relType |
|
| 100 | - $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
| 101 | - $relTypeSelect->addOption('file'); |
|
| 102 | - $form->addElement($relTypeSelect); |
|
| 103 | - // Form Text relName |
|
| 104 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
| 99 | + // Form Select relType |
|
| 100 | + $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
| 101 | + $relTypeSelect->addOption('file'); |
|
| 102 | + $form->addElement($relTypeSelect); |
|
| 103 | + // Form Text relName |
|
| 104 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
| 105 | 105 | // Form Radio Yes/No relPrerelease |
| 106 | 106 | $relPrerelease = $this->isNew() ?: $this->getVar('rel_prerelease'); |
| 107 | 107 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_RELEASE_PRERELEASE, 'rel_prerelease', $relPrerelease)); |
| 108 | - // Form Text Date Select relPublishedat |
|
| 109 | - $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
| 110 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
| 111 | - // Form Text relTarballurl |
|
| 112 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
| 113 | - // Form Text relZipballurl |
|
| 114 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
| 115 | - // Form Text Date Select relDatecreated |
|
| 116 | - $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
| 117 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
| 118 | - // Form Select User relSubmitter |
|
| 119 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
| 120 | - // To Save |
|
| 121 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 122 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
| 123 | - return $form; |
|
| 124 | - } |
|
| 108 | + // Form Text Date Select relPublishedat |
|
| 109 | + $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
| 110 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
| 111 | + // Form Text relTarballurl |
|
| 112 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
| 113 | + // Form Text relZipballurl |
|
| 114 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
| 115 | + // Form Text Date Select relDatecreated |
|
| 116 | + $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
| 117 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
| 118 | + // Form Select User relSubmitter |
|
| 119 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
| 120 | + // To Save |
|
| 121 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 122 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
| 123 | + return $form; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Get Values |
|
| 128 | - * @param null $keys |
|
| 129 | - * @param null $format |
|
| 130 | - * @param null $maxDepth |
|
| 131 | - * @return array |
|
| 132 | - */ |
|
| 133 | - public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
| 134 | - { |
|
| 126 | + /** |
|
| 127 | + * Get Values |
|
| 128 | + * @param null $keys |
|
| 129 | + * @param null $format |
|
| 130 | + * @param null $maxDepth |
|
| 131 | + * @return array |
|
| 132 | + */ |
|
| 133 | + public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
| 134 | + { |
|
| 135 | 135 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
| 136 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
| 137 | - $ret['id'] = $this->getVar('rel_id'); |
|
| 136 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
| 137 | + $ret['id'] = $this->getVar('rel_id'); |
|
| 138 | 138 | $repositoriesHandler = $helper->getHandler('Repositories'); |
| 139 | 139 | $repositoriesObj = $repositoriesHandler->get($this->getVar('rel_repoid')); |
| 140 | 140 | $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
| 141 | - $ret['type'] = $this->getVar('rel_type'); |
|
| 142 | - $ret['name'] = $this->getVar('rel_name'); |
|
| 141 | + $ret['type'] = $this->getVar('rel_type'); |
|
| 142 | + $ret['name'] = $this->getVar('rel_name'); |
|
| 143 | 143 | $ret['prerelease'] = (int)$this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
| 144 | - $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
| 145 | - $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
| 146 | - $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
| 147 | - $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
| 148 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
| 149 | - return $ret; |
|
| 150 | - } |
|
| 144 | + $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
| 145 | + $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
| 146 | + $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
| 147 | + $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
| 148 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
| 149 | + return $ret; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Returns an array representation of the object |
|
| 154 | - * |
|
| 155 | - * @return array |
|
| 156 | - */ |
|
| 157 | - public function toArrayReleases() |
|
| 158 | - { |
|
| 159 | - $ret = []; |
|
| 160 | - $vars = $this->getVars(); |
|
| 161 | - foreach (\array_keys($vars) as $var) { |
|
| 162 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
| 163 | - } |
|
| 164 | - return $ret; |
|
| 165 | - } |
|
| 152 | + /** |
|
| 153 | + * Returns an array representation of the object |
|
| 154 | + * |
|
| 155 | + * @return array |
|
| 156 | + */ |
|
| 157 | + public function toArrayReleases() |
|
| 158 | + { |
|
| 159 | + $ret = []; |
|
| 160 | + $vars = $this->getVars(); |
|
| 161 | + foreach (\array_keys($vars) as $var) { |
|
| 162 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
| 163 | + } |
|
| 164 | + return $ret; |
|
| 165 | + } |
|
| 166 | 166 | } |
@@ -132,15 +132,15 @@ |
||
| 132 | 132 | */ |
| 133 | 133 | public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
| 134 | 134 | { |
| 135 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
| 135 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
| 136 | 136 | $ret = $this->getValues($keys, $format, $maxDepth); |
| 137 | - $ret['id'] = $this->getVar('rel_id'); |
|
| 137 | + $ret['id'] = $this->getVar('rel_id'); |
|
| 138 | 138 | $repositoriesHandler = $helper->getHandler('Repositories'); |
| 139 | 139 | $repositoriesObj = $repositoriesHandler->get($this->getVar('rel_repoid')); |
| 140 | - $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
| 140 | + $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
|
| 141 | 141 | $ret['type'] = $this->getVar('rel_type'); |
| 142 | 142 | $ret['name'] = $this->getVar('rel_name'); |
| 143 | - $ret['prerelease'] = (int)$this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
|
| 143 | + $ret['prerelease'] = (int) $this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
|
| 144 | 144 | $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
| 145 | 145 | $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
| 146 | 146 | $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |