@@ -31,6 +31,9 @@ |
||
| 31 | 31 | 'filtered' => [], |
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param string $cat |
|
| 36 | + */ |
|
| 34 | 37 | public function addLog($cat, $message) |
| 35 | 38 | { |
| 36 | 39 | $this->log[$cat][] = $message; |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | $type = $this->getCrawler($url)->getContentType(); |
| 146 | 146 | |
| 147 | 147 | if (strpos($type, 'text/html') === false) { |
| 148 | - $this->addLog('invalid_header', $url . ' invalid header ' . $type); |
|
| 148 | + $this->addLog('invalid_header', $url.' invalid header '.$type); |
|
| 149 | 149 | return false; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Goutte\Client; |
| 6 | 6 | use yii\base\InvalidConfigException; |
| 7 | 7 | use yii\base\yii\base; |
| 8 | -use luya\helpers\Url; |
|
| 9 | 8 | |
| 10 | 9 | class CrawlPage extends \yii\base\Object |
| 11 | 10 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $info = parse_url($this->baseUrl); |
| 34 | 34 | |
| 35 | - $this->baseHost = $info['scheme'] . '://' . $info['host']; |
|
| 35 | + $this->baseHost = $info['scheme'].'://'.$info['host']; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function flush() |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function getLinks() |
| 61 | 61 | { |
| 62 | - $links = $this->getCrawler()->filterXPath('//a')->each(function ($node, $i) { |
|
| 62 | + $links = $this->getCrawler()->filterXPath('//a')->each(function($node, $i) { |
|
| 63 | 63 | return $node->extract(array('_text', 'href'))[0]; |
| 64 | 64 | }); |
| 65 | 65 | foreach ($links as $key => $item) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if (!isset($url['host']) || !isset($url['scheme'])) { |
| 69 | 69 | $base = $this->baseHost; |
| 70 | 70 | } else { |
| 71 | - $base = $url['scheme'] . '//' . $url['host']; |
|
| 71 | + $base = $url['scheme'].'//'.$url['host']; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $path = null; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $path = $url['path']; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $url = rtrim($base, "/") . "/" . ltrim($path, "/"); |
|
| 80 | + $url = rtrim($base, "/")."/".ltrim($path, "/"); |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | $links[$key][1] = http_build_url($url, [ |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | foreach ($array as $k => $v) { |
| 31 | 31 | if (is_numeric($v)) { |
| 32 | - $return[$k] = (int)$v; |
|
| 32 | + $return[$k] = (int) $v; |
|
| 33 | 33 | } elseif (is_array($v)) { |
| 34 | 34 | $return[$k] = self::typeCast($v); |
| 35 | 35 | } else { |
@@ -30,38 +30,38 @@ discard block |
||
| 30 | 30 | public function getFunctions() |
| 31 | 31 | { |
| 32 | 32 | return [ |
| 33 | - 'menuFindAll' => function ($container, $parentNavId) { |
|
| 33 | + 'menuFindAll' => function($container, $parentNavId) { |
|
| 34 | 34 | return Yii::$app->menu->findAll(['container' => $container, 'parent_nav_id' => $parentNavId]); |
| 35 | 35 | }, |
| 36 | - 'menuFindOne' => function ($id) { |
|
| 36 | + 'menuFindOne' => function($id) { |
|
| 37 | 37 | return Yii::$app->menu->findOne(['id' => $id]); |
| 38 | 38 | }, |
| 39 | - 'menuCurrent' => function () { |
|
| 39 | + 'menuCurrent' => function() { |
|
| 40 | 40 | return Yii::$app->menu->current; |
| 41 | 41 | }, |
| 42 | - 'menuCurrentLevel' => function ($level) { |
|
| 42 | + 'menuCurrentLevel' => function($level) { |
|
| 43 | 43 | return Yii::$app->menu->getLevelCurrent($level); |
| 44 | 44 | }, |
| 45 | - 'menuLevelContainer' => function ($level) { |
|
| 45 | + 'menuLevelContainer' => function($level) { |
|
| 46 | 46 | return Yii::$app->menu->getLevelContainer($level); |
| 47 | 47 | }, |
| 48 | - 'asset' => function ($name) { |
|
| 48 | + 'asset' => function($name) { |
|
| 49 | 49 | return Yii::$app->getAssetManager()->getBundle($name); |
| 50 | 50 | }, |
| 51 | - 'filterApply' => function ($imageId, $filterIdentifier) { |
|
| 51 | + 'filterApply' => function($imageId, $filterIdentifier) { |
|
| 52 | 52 | return Yii::$app->storage->getImage($imageId)->applyFilter($filterIdentifier); |
| 53 | 53 | }, |
| 54 | - 'image' => function ($imageId) { |
|
| 54 | + 'image' => function($imageId) { |
|
| 55 | 55 | return Yii::$app->storage->getImage($imageId); |
| 56 | 56 | }, |
| 57 | - 'element' => function () { |
|
| 57 | + 'element' => function() { |
|
| 58 | 58 | $args = func_get_args(); |
| 59 | 59 | $method = $args[0]; |
| 60 | 60 | unset($args[0]); |
| 61 | 61 | |
| 62 | 62 | return Yii::$app->element->run($method, $args); |
| 63 | 63 | }, |
| 64 | - 't' => function () { |
|
| 64 | + 't' => function() { |
|
| 65 | 65 | $args = func_get_args(); |
| 66 | 66 | |
| 67 | 67 | return call_user_func_array(['Yii', 't'], $args); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $twig->addFunction(new Twig_SimpleFunction($name, $lambda)); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $twig->addFilter(new Twig_SimpleFilter('strftime', function ($timestamp, $format) { |
|
| 82 | + $twig->addFilter(new Twig_SimpleFilter('strftime', function($timestamp, $format) { |
|
| 83 | 83 | if (is_numeric($timestamp)) { |
| 84 | 84 | return strftime($format, $timestamp); |
| 85 | 85 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $name = substr($name, 0, -(strlen($suffix))); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - return $name . $suffix; |
|
| 78 | + return $name.$suffix; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -25,21 +25,21 @@ |
||
| 25 | 25 | |
| 26 | 26 | if (count($fileList) !== 0) { |
| 27 | 27 | $success = true; |
| 28 | - if ($this->confirm("Do you want to delete " . count($fileList) . " files which are not referenced in the database any more?")) { |
|
| 28 | + if ($this->confirm("Do you want to delete ".count($fileList)." files which are not referenced in the database any more?")) { |
|
| 29 | 29 | foreach ($fileList as $file) { |
| 30 | 30 | if (is_file($file) && @unlink($file)) { |
| 31 | - $this->outputSuccess($file . " successful deleted."); |
|
| 31 | + $this->outputSuccess($file." successful deleted."); |
|
| 32 | 32 | } elseif (is_file($file)) { |
| 33 | - $this->outputError($file . " could not be deleted!"); |
|
| 33 | + $this->outputError($file." could not be deleted!"); |
|
| 34 | 34 | $success = false; |
| 35 | 35 | } else { |
| 36 | - $this->outputError($file . " could not be found!"); |
|
| 36 | + $this->outputError($file." could not be found!"); |
|
| 37 | 37 | $success = false; |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | if ($success) { |
| 42 | - return $this->outputSuccess(count($fileList) . " files successful deleted."); |
|
| 42 | + return $this->outputSuccess(count($fileList)." files successful deleted."); |
|
| 43 | 43 | } |
| 44 | 44 | return $this->outputError("Cleanup could not be completed. Please look into error above."); |
| 45 | 45 | } |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | |
| 32 | 32 | $module = Yii::$app->getModule($moduleId); |
| 33 | 33 | |
| 34 | - $folder = $module->basePath . DIRECTORY_SEPARATOR . 'aws'; |
|
| 34 | + $folder = $module->basePath.DIRECTORY_SEPARATOR.'aws'; |
|
| 35 | 35 | |
| 36 | - $file = $folder . DIRECTORY_SEPARATOR . $className . '.php'; |
|
| 36 | + $file = $folder.DIRECTORY_SEPARATOR.$className.'.php'; |
|
| 37 | 37 | |
| 38 | 38 | $content = $this->view->render('@luya/console/commands/views/aw/create.php', [ |
| 39 | 39 | 'className' => $className, |
| 40 | - 'namespace' => $module->getNamespace() . '\\aws', |
|
| 40 | + 'namespace' => $module->getNamespace().'\\aws', |
|
| 41 | 41 | 'luya' => $this->getLuyaVersion(), |
| 42 | 42 | 'moduleId' => $moduleId, |
| 43 | 43 | 'alias' => Inflector::humanize(Inflector::camel2words($className)), |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @var $className |
|
| 4 | - * @var $namespace |
|
| 5 | - * @var $luya |
|
| 6 | - * @var $moduleId |
|
| 7 | - * @var $alias |
|
| 8 | - */ |
|
| 3 | + * @var $className |
|
| 4 | + * @var $namespace |
|
| 5 | + * @var $luya |
|
| 6 | + * @var $moduleId |
|
| 7 | + * @var $alias |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | echo "<?php\n"; |
| 11 | 11 | ?> |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | return true; |
| 169 | 169 | } else { |
| 170 | 170 | $data = [$this->host, $this->port, $this->smtpSecure, $this->username]; |
| 171 | - throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply() . PHP_EOL . print_r($smtp->getError(), true)); |
|
| 171 | + throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply().PHP_EOL.print_r($smtp->getError(), true)); |
|
| 172 | 172 | } |
| 173 | 173 | } else { |
| 174 | 174 | throw new Exception('HELO failed: '.$smtp->getLastReply()); |