示例#1
0
function home()
{
    $out = "there is actually no content. enable content module to manage this page";
    if (module_manager::is_enabled("content")) {
        $out = "";
        $nodes = content_database::node_load_all();
        $b = false;
        if (count($nodes) > 0) {
            page::title("Home");
            foreach ($nodes as $node) {
                if (content::node_access_read($node->nid)) {
                    $b = true;
                    $out .= "<div class='post'>";
                    if ($node->title != null) {
                        $out .= "<div class='title'>";
                        $out .= page::link("node/" . $node->nid, $node->title);
                        $out .= "</div>";
                    }
                    if ($node->description != null) {
                        $out .= "<div class='content'>";
                        $node->description = utf8_decode($node->description);
                        if (strlen($node->description) > 200) {
                            $out .= substr($node->description, 0, 200) . "... " . page::link("node/" . $node->nid, t("+ read more"));
                        } else {
                            $out .= $node->description;
                        }
                        $out .= "</div>";
                    }
                    $out .= "<div class='author'>";
                    $out .= "<hr/>";
                    $out .= content_page::post_author_date($node->uid, $node->author, $node->date);
                    $out .= "<hr/>";
                    $out .= "</div>";
                    $out .= "</div>";
                }
            }
        } else {
            $out .= "there is no content, please add a content first.";
        }
    }
    return $b ? $out : "there is no content.";
}
示例#2
0
 public static function theme_blocks($position)
 {
     if (module_manager::is_enabled("blocks")) {
         $path = page::clean_path();
         $blocks = blocks::get_blocks_by_path($path, $position);
         $out = "";
         foreach ($blocks as $b) {
             $out .= blocks::invoke_block($b);
         }
         return $out;
     } else {
         return " ";
     }
 }
示例#3
0
 public static function disable_module($module_name)
 {
     if (module_manager::is_enabled($module_name) && module_manager::is_installed($module_name)) {
         database::update("module_manager", array("module_enabled" => 0), "module_name = '%module'", array("%module" => $module_name));
         $result = method_invoke($module_name, "disable");
         self::update_action($module_name);
     }
 }