yf_home_page user module

Home page handling module.

Fileplugins/home_page/modules/yf_home_page.class.php
Usemodule('home_page'), URL ?object=home_page
Extendsyf_module

Public properties

A site sets them in its config with $PROJECT_CONF['home_page']['NAME'] = ...;

PropertyDefaultDescription
$NEWEST_BLOG_TEXT_LEN
int
300
$NEWEST_FORUM_TEXT_LEN
int
300
$NUM_NEWEST_ARTICLE_POST
int
4
$NUM_NEWEST_BLOG_POSTS
int
4
$NUM_NEWEST_COMMENTS
int
4
$NUM_NEWEST_FORUM_POSTS
int
4
$NUM_NEWEST_NEWS
int
4 Number of newest news to show
$NUM_NEWEST_USERS
int
5 Number of newest users to show

Inherited properties

from yf_module: $CAPTCHA, $FORCE_STRIPSLASHES, $USER_GROUP, $USER_ID, $USE_BB_CODES, $USE_CAPTCHA, $USE_PREVIEW, $_boxes, $_comments_params, $_poll_params, $_tags_params

Public methods 2

show

public function show()
    public function show()
    {
        $cache_name = 'home_page_default';
        $data = cache_get($cache_name);
        if ( ! $data) {
            $data = [
                'newest_users' => module_safe('users')->_for_home_page($this->NUM_NEWEST_USERS),
                'newest_news' => module_safe('news')->_for_home_page(['num_items' => $this->NUM_NEWEST_NEWS]),
                'newest_forum_posts' => module_safe('forum')->_for_home_page($this->NUM_NEWEST_FORUM_POSTS, $this->NEWEST_FORUM_TEXT_LEN),
                'newest_blog_posts' => module_safe('blog')->_for_home_page($this->NUM_NEWEST_BLOG_POSTS, $this->NEWEST_BLOG_TEXT_LEN),
                'newest_gallery_photo' => module_safe('gallery')->_for_home_page($this->NUM_NEWEST_GALLERY_PHOTO),
                'newest_article_post' => module_safe('articles')->_for_home_page($this->NUM_NEWEST_ARTICLE_POST),
                'newest_comments' => module_safe('comments')->_for_home_page($this->NUM_NEWEST_COMMENTS),
            ];
            cache_set($cache_name, $data);
        }
        $replace = &$data;
        return tpl()->parse(($_GET['object'] ?? null) . '/main', $replace);
    }

Methods starting with _ hooks and helpers; not routable as page actions

__call

public function __call($name, $arguments)

Catch missing method call.

    public function __call($name, $arguments)
    {
        trigger_error(__CLASS__ . ': No method ' . $name, E_USER_WARNING);
        return false;
    }

Inherited methods

from yf_module: _box(), _captcha_block(), _captcha_check(), _captcha_load_code(), _comment_delete_allowed(), _comment_edit_allowed(), _comment_is_allowed(), _display_submit_buttons(), _format_text(), _get_num_comments(), _poll(), _prefetch_rate_infos(), _prepare_preview(), _show_rate_box(), _show_tags(), _view_comments(), add_comment(), captcha_image(), create_poll(), delete_comment(), delete_poll(), display_preview(), edit_comment(), edit_tag(), tag(), view_poll_results()