Пример #1
0
 function _update_check()
 {
     $product_info = new \Leeflets\Product_Info($this->config, $this->hook, $this->router, $this->filesystem);
     $msg = '';
     $problem = 'There was a problem (#%s) checking for a core update. You might want to check <a href="http://leeflets.com">leeflets.com</a> to see if there\'s a new version.';
     $result = $product_info->refresh();
     if (\Leeflets\Error::is_a($result)) {
         $msg = sprintf($problem, '1');
     } elseif (!($core = $product_info->get('core'))) {
         $msg = sprintf($problem, '2');
     } elseif (empty($core['version'])) {
         $msg = sprintf($problem, '3');
     } elseif (version_compare($this->config->version, $core['version'], '<')) {
         $msg = 'There is a new version of Leeflets available. You are currently on version ' . htmlspecialchars($this->config->version) . '. Visit <a href="http://leeflets.com">leeflets.com</a> to download version ' . htmlspecialchars($core['version']) . '.';
     }
     if ($msg) {
         $this->view->partial('core-update-msg', compact('msg'));
     }
 }
Пример #2
0
 function addon($slug, $switch)
 {
     $addons_path = $this->config->addons_path . '/' . $slug;
     if (!is_dir($addons_path)) {
         echo "The addon '{$slug}' could not be found.";
         exit;
     }
     $result = $this->addon->toggle($slug, 'on' == $switch);
     if (\Leeflets\Error::is_a($result)) {
         echo $result->get_error_message();
         exit;
     }
     exit;
 }