Example #1
0
 public function runResolve(framework\Request $request)
 {
     $theme = isset($request['theme_name']) ? $request['theme_name'] : framework\Settings::getThemeName();
     if ($request->hasParameter('css')) {
         $this->getResponse()->setContentType('text/css');
         if (!$request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'css';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'css' . DS . $request->getParameter('css');
         } else {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'css' . DS . $request->getParameter('css');
         }
     } elseif ($request->hasParameter('js')) {
         $this->getResponse()->setContentType('text/javascript');
         if ($request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'js' . DS . $request->getParameter('js');
         } elseif ($request->hasParameter('module_name') && framework\Context::isModuleLoaded($request['module_name'])) {
             $module_path = framework\Context::isInternalModule($request['module_name']) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'js';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'js' . DS . $request->getParameter('js');
         } else {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'js';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'js' . DS . $request->getParameter('js');
         }
     } else {
         throw new \Exception('The expected theme Asset type is not supported.');
     }
     $fileAsset = new AssetCollection(array(new FileAsset($asset, array(), $basepath)));
     $fileAsset->load();
     // Do not decorate the asset with the theme's header/footer
     $this->getResponse()->setDecoration(framework\Response::DECORATE_NONE);
     return $this->renderText($fileAsset->dump());
 }
Example #2
0
 protected function _uninstallModule($module_name)
 {
     $this->cliEcho("Uninstall module\n", 'green', 'bold');
     try {
         if (!$module_name || !file_exists(THEBUGGENIE_MODULES_PATH . $module_name . DS . ucfirst($module_name) . '.php')) {
             throw new \Exception("Please provide a valid module name");
         } elseif (!\thebuggenie\core\framework\Context::isModuleLoaded($module_name)) {
             throw new \Exception("This module is not installed");
         } else {
             $this->cliEcho("Removing {$module_name} ...");
             \thebuggenie\core\framework\Context::getModule($module_name)->uninstall();
             $this->cliEcho(' ok!', 'green', 'bold');
             $this->cliEcho("\n");
         }
     } catch (\Exception $e) {
         $this->cliEcho($e->getMessage() . "\n", 'red');
     }
 }
Example #3
0
 public function componentOnlineModules()
 {
     try {
         $client = new \Net_Http_Client();
         $client->get('http://www.thebuggenie.com/addons.json');
         $json_modules = json_decode($client->getBody());
     } catch (\Exception $e) {
     }
     $modules = array();
     if (isset($json_modules) && isset($json_modules->featured)) {
         foreach ($json_modules->featured as $key => $module) {
             if (!framework\Context::isModuleLoaded($module->key)) {
                 $modules[] = $module;
             }
         }
     }
     $this->modules = $modules;
 }
<li class="plugin module <?php 
if (\thebuggenie\core\framework\Context::isModuleLoaded($onlinemodule->key)) {
    echo ' installed';
}
?>
" id="online-module-<?php 
echo $onlinemodule->key;
?>
">
    <?php 
echo __('%module_name version %version by %author', array('%module_name' => '<h1>' . $onlinemodule->name . '</h1>', '%version' => '<span class="version">' . $onlinemodule->version . '</span>', '%author' => '<a href="' . $onlinemodule->author->profile . '" class="author-link">' . $onlinemodule->author->name . '</a>'));
?>
    <div class="rating">
        <div class="score" style="width: <?php 
echo $onlinemodule->rating * 16;
?>
px;"></div>
    </div>
    <div class="module-actions plugin-actions">
        <button class="install-button button button-silver" data-key="<?php 
echo htmlentities($onlinemodule->key);
?>
"><?php 
echo image_tag('spinning_16.gif');
?>
<span><?php 
echo __('Add');
?>
</span></button>
        <div class="status_badge module_status plugin_status enabled">
            <?php 
Example #5
0
 public function runResolve(framework\Request $request)
 {
     $theme = isset($request['theme_name']) ? $request['theme_name'] : framework\Settings::getThemeName();
     $module_path = framework\Context::isInternalModule($request['module_name']) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
     if ($request->hasParameter('css')) {
         $this->getResponse()->setContentType('text/css');
         if ($request->hasParameter('module_name') && framework\Context::isModuleLoaded($request['module_name'])) {
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'css';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'css' . DS . $request->getParameter('css');
         } elseif (!$request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'css';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'css' . DS . $request->getParameter('css');
         } else {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'css' . DS . $request->getParameter('css');
         }
     } elseif ($request->hasParameter('js')) {
         $this->getResponse()->setContentType('text/javascript');
         if ($request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'js' . DS . $request->getParameter('js');
         } elseif ($request->hasParameter('module_name') && framework\Context::isModuleLoaded($request['module_name'])) {
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'js';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'js' . DS . $request->getParameter('js');
         } else {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'js';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'js' . DS . $request->getParameter('js');
         }
     } elseif ($request->hasParameter('image')) {
         $basepath = THEBUGGENIE_PATH . 'themes';
         $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'images';
         if (isset($request['module_name'])) {
             $asset .= DS . "modules" . DS . $request['module_name'];
         }
         if (isset($request['folder'])) {
             $asset .= DS . $request['folder'];
         }
         $asset .= DS . $request->getParameter('image');
         if (!file_exists($asset) && isset($request['module_name']) && framework\Context::isModuleLoaded($request['module_name'])) {
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'images';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'images';
             if (isset($request['folder'])) {
                 $asset .= DS . $request['folder'];
             }
             $asset .= DS . $request->getParameter('image');
         }
         $fileinfo = finfo_open(FILEINFO_MIME_TYPE);
         $mimetype = finfo_file($fileinfo, $asset);
         finfo_close($fileinfo);
         $this->getResponse()->setContentType($mimetype);
     } else {
         throw new \Exception('The expected theme Asset type is not supported.');
     }
     $last_modified = filemtime($asset);
     $this->getResponse()->addHeader('Cache-Control: max-age=3600, must-revalidate');
     $this->getResponse()->addHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $last_modified) . 'GMT');
     $this->getResponse()->addHeader('ETag: ' . md5($last_modified));
     if (!$this->getResponse()->isModified($last_modified)) {
         return $this->return304();
     }
     $fileAsset = new AssetCollection(array(new FileAsset($asset, array(), $basepath)));
     $fileAsset->load();
     // Do not decorate the asset with the theme's header/footer
     $this->getResponse()->setDecoration(framework\Response::DECORATE_NONE);
     return $this->renderText($fileAsset->dump());
 }