Esempio n. 1
0
 static function display($path, $variables = array())
 {
     if (!isset($variables['value'])) {
         $variables['value'] = NULL;
     }
     if (!isset($variables['container'])) {
         $variables['container'] = true;
     }
     $return = NULL;
     if (Setting::get("wrap_views") == "yes") {
         $return = "<!-- {$path} -->";
     }
     $view_exists = false;
     $plugin_view = false;
     foreach ($variables as $name => $value) {
         new Vars($name, $value);
     }
     $plugins = Plugin::getEnabledPlugins(true);
     $static_vars = Cache::get("vars", "session");
     $return = runHook("view:before", array("view" => $path, "return" => $return));
     new Cache("vars", $static_vars, "session");
     $return .= ViewExtension::display($path, "before");
     if ($plugins) {
         foreach ($plugins as $plugin) {
             if (is_a($plugin, "SocialApparatus\\Plugin")) {
                 $name = $plugin->name;
                 if (!$plugin_view) {
                     if (file_exists(SITEPATH . "plugins/{$name}/views/{$path}.php")) {
                         $return .= self::getRenderedHTML(SITEPATH . "plugins/{$name}/views/{$path}.php");
                         $plugin_view = true;
                         $view_exists = true;
                     } elseif (file_exists(SITEPATH . "core_plugins/{$name}/views/{$path}.php")) {
                         $return .= self::getRenderedHTML(SITEPATH . "core_plugins/{$name}/views/{$path}.php");
                         $plugin_view = true;
                         $view_exists = true;
                     }
                 }
             }
         }
     }
     if (!$plugin_view) {
         $file_path = SITEPATH . "views/" . $path . ".php";
         if (file_exists($file_path)) {
             $view_exists = true;
             $return .= self::getRenderedHTML($file_path);
         }
     }
     new Cache("vars", $static_vars, "session");
     $return .= viewExtension::display($path, "after");
     return $return;
 }