menu('Nginx Let\'s Encrypt'); //$main // ->addLineBreak('-') // ->open(); /*** $itemCallable = function(CliMenu $menu) { // getting sites-available $sitesAvailable = scandir('/etc/nginx/sites-available'); // getting sites-endabled $sitesEnabled = scandir('/etc/nginx/sites-enabled'); foreach($sitesAvailable as $site) { if ($site !== '.' && $site !== '..') { // getting title $title = str_replace('.conf', '', $site); $checkbox = new CheckboxItem('enabled', function(CliMenu $menu) use ($site, $title) { // check status if ($menu->getSelectedItem()->getChecked()) { symlink('/etc/nginx/sites-available/'.$site, '/etc/nginx/sites-enabled/'.$site); $status = 'enabled'; } else { unlink('/etc/nginx/sites-enabled/'.$site); $status = 'disabled'; } // starting exec('service nginx restart'); exec('service nginx status', $output); if (strpos(implode(' ', $output), 'active') !== false) { $menu->confirm($title.' is '.$status.'!')->display('OK!'); } else { $menu->confirm('Error! Something not working!')->display('OK!'); } }); // adding checkbox if (in_array($site, $sitesEnabled)) { $checkbox->setChecked(true); } $menuMain ->addSubmenu($title, function(CliMenuBuilder $builder) use ($site, $title, $checkbox) { $builder->setTitle("Nginx > $title") ->addItem('edit', function(CliMenu $menu) use ($site, $title) { system('nano /etc/nginx/sites-available/'.$site.' > `tty`'); }) ->addItem('delete', function(CliMenu $menu) use ($site) { if (file_exists('/etc/nginx/sites-enabled/'.$site)) { $menu->confirm('Error! Please disable '.$title.' first!')->display('OK!'); } else { unlink('/etc/nginx/sites-available/'.$site); $menu->confirm("$site is deleted!")->display('OK!'); } }) ->addLineBreak('-') ->addMenuItem($checkbox) ->addLineBreak('-'); }); } } };*/ } }