Beispiel #1
0
function register_pages($number = 1, $args = array())
{
    global $registered_pages;
    $number = (int) $number;
    if (is_string($args)) {
        parse_str($args, $args);
    }
    $name = $args['name'] ? $args['name'] : __('page');
    $i = 1;
    while ($i <= $number) {
        if (isset($args['name']) && $number > 1) {
            if (!strstr($name, '%d')) {
                $name = "{$name} %d";
            }
            $args['name'] = sprintf($name, $i);
        }
        register_page($args);
        ++$i;
    }
}
<?php

register_page("Themes & Plugins", 'themes.sculpt');
register_page("Download", 'https://github.com/antijingoist/SculptCMS');
function register_plugin_page($pages)
{
    foreach ($pages as $page) {
        $post_id = register_page($page['title'], $page['slug'], $page['shortcode']);
        //$post_id = register_page($page['title'], $page['shortcode']);
        if (!empty($post_id)) {
            update_post_meta($post_id, $page['page'], $page['page']);
            if ($page['page'] != 'mlm_registration_page') {
                update_post_meta($post_id, '_mlm_is_members_only', 'true');
            }
        }
    }
}
Beispiel #4
0
<?php

register_page("albums", 'index.php?p=albums');
register_text_engine("albums", "albums/album_page.php");
register_stylesheet(sculpt_system("plugin_path") . "albums/album_styles.css");
register_script(sculpt_system("plugin_path") . "albums/album.js");
function album_categories_list($active_album)
{
    $directory = sculpt_system("content_path") . 'albums';
    $page_data = '';
    $page_data .= '<ul>';
    if (file_exists($directory)) {
        $categories = glob($directory . '/*', GLOB_ONLYDIR);
        foreach ($categories as $category) {
            $category_parts = pathinfo($category);
            $category_name = $category_parts['filename'];
            if (!$active_album) {
                $active_album = $category_name;
            }
            if ($category_name === $active_album) {
                $category_class = "active_tab";
            } else {
                $category_class = "inactive_tab";
            }
            $page_data .= '<li class="' . $category_class . '"><a href=index.php?p=albums&sac=' . $category_name . '>' . ucfirst($category_name) . '</a></li>';
        }
    }
    $page_data .= '</ul>';
    echo $page_data;
    return $active_album;
}
Beispiel #5
0
<?php

// Markdown blogging engine, as a plugin.
include_once "blog/blog_settings.php";
// How about instead of a special page, check current page in pagetext to see if it's registered. then get pagetext processes the page different.
register_page($blog_page_title, 'index.php?p=Blog');
register_text_engine($blog_page_title, "blog/blog_start.php");
function blog_front_page()
{
    global $blog_directory;
    if (file_exists($blog_directory)) {
        $article_list = array_diff(scandir($blog_directory, 1), array('..', '.'));
        if (count($article_list) > 2) {
            foreach ($article_list as $key => $article) {
                $file_part = pathinfo($article);
                if ($file_part['extension'] === 'md' || $file_part['extension'] === 'html') {
                    $article_date = $file_part['filename'];
                    if ($key === 0) {
                        echo '<div class=first_post>';
                        echo '<h2 class="blog_title"><a href=index.php?p=Blog&bp=' . $article_date . '>' . blog_get_title($article_date) . '</a></h2>';
                        blog_post($article_date, true);
                        echo '</div>';
                    } elseif ($key > 4) {
                        break;
                    } else {
                        echo '<h3 class="blog_title"><a href=index.php?p=Blog&bp=' . $article_date . '>' . blog_get_title($article_date) . '</a></h3>';
                    }
                }
            }
            echo '<p><a href="index.php?p=Blog&bp=archive">View Archives</a></p>';
        } else {