Beispiel #1
0
 function load()
 {
     if (!file_exists($this->path)) {
         return false;
     }
     $required = array('username', 'password');
     $optional = array('debug', 'debug_display', 'debug_log', 'fs_chmod_dir', 'fs_chmod_file', 'leeflets_api_url');
     $both = array_merge($required, $optional);
     $vars = Inc::variables($this->path, $both);
     foreach ($required as $var) {
         if (!isset($vars[$var])) {
             die('Missing ' . $var . ' from config.php.');
         }
     }
     foreach ($both as $var) {
         if (!isset($vars[$var])) {
             continue;
         }
         $this->{$var} = $vars[$var];
     }
     $this->is_loaded = true;
     return true;
 }
Beispiel #2
0
 function load_active()
 {
     $active_addons = $this->settings->get('active_addons');
     if (!$active_addons) {
         return false;
     }
     $deactivate = array();
     foreach ($active_addons as $addon) {
         $path = $this->config->addons_path . '/' . $addon . '/' . $addon . '.php';
         if (!file_exists($path)) {
             $deactivate[] = $addon;
         } else {
             Inc::class_file($path);
             $class_name = \Leeflets\String::camelize($addon);
             $class_name = '\\Leeflets\\User\\Addon\\' . $class_name;
             $this->instances[$addon] = $obj = new $class_name();
             $obj->load_objects($this->config, $this->settings, $this->hook, $this->admin_script, $this->admin_style, $this->template_script, $this->template_style, $this->filesystem, $this->router);
             $obj->init();
         }
     }
     if ($deactivate) {
         $this->deactivate($deactivate);
     }
 }
Beispiel #3
0
<!DOCTYPE html>
<html ng-app="ls">
<head>
    <title>
        @yield('title')
    </title>
    <?php 
echo Inc::css();
?>
    <base href="/">
</head>
<body>
<div class="container">



    <div class="content" ng-view>
        @yield('content')
    </div>
</div>
    <?php 
echo Inc::javascript();
?>
    <?php 
echo Inc::angularScripts();
?>
</body>
</html>
Beispiel #4
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Inc the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Inc::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #5
0
 function get_content_fields()
 {
     $content_file = $this->template_file_path('meta-content');
     if (!$content_file) {
         die("Active template's meta-content.php not found.");
     }
     $vars = Inc::variables($content_file, array('content'));
     if (!isset($vars['content'])) {
         die("Can't load {$content} variable in the active template's meta-content.php.");
     }
     return $this->hook->apply('template_get_content_fields', $vars['content']);
 }