Bearsampp 2026.7.11
Loading...
Searching...
No Matches
Homepage Class Reference

Public Member Functions

 __construct ()
 getPage ()
 getPageQuery ($query)
 getPageUrl ($query)
 refreshAliasContent ()
 refreshCommonsJsContent ()

Data Fields

const PAGE_INDEX = 'index'
const PAGE_PHPINFO = 'phpinfo'

Private Attributes

 $page
 $pageList

Detailed Description

Class Homepage

This class handles the homepage functionalities of the Bearsampp application. It manages the page navigation, resource paths, and content refresh operations.

Definition at line 17 of file class.homepage.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Homepage constructor. Initializes the homepage class and sets the current page based on the query parameter.

Definition at line 36 of file class.homepage.php.

37 {
38 Log::initClass($this);
39
41 $this->page = !empty($page) && in_array($page, $this->pageList) ? $page : self::PAGE_INDEX;
42
43 // Ensure JS files are always up to date with the current URL/protocol
45 }
refreshCommonsJsContent()
static initClass($classInstance)
static cleanGetVar($name, $type='text')

References $page, UtilInput\cleanGetVar(), Log\initClass(), and refreshCommonsJsContent().

Here is the call graph for this function:

Member Function Documentation

◆ getPage()

getPage ( )

Gets the current page.

Returns
string The current page.

Definition at line 52 of file class.homepage.php.

53 {
54 return $this->page;
55 }

References $page.

◆ getPageQuery()

getPageQuery ( $query)

Constructs the page query string based on the provided query.

Parameters
string$queryThe query string to construct.
Returns
string The constructed page query string.

Definition at line 63 of file class.homepage.php.

64 {
65 if (empty($query)) {
66 return '';
67 }
68
69 if (in_array($query, $this->pageList)) {
70 return $query !== self::PAGE_INDEX ? '?p=' . $query : 'index.php';
71 }
72
73 return '';
74 }

Referenced by getPageUrl().

Here is the caller graph for this function:

◆ getPageUrl()

getPageUrl ( $query)

Constructs the full URL for the given page query.

Parameters
string$queryThe query string to construct the URL for.
Returns
string The constructed page URL.

Definition at line 82 of file class.homepage.php.

83 {
84 global $bearsamppRoot;
85 return Path::getLocalUrl($this->getPageQuery($query));
86 }
global $bearsamppRoot
getPageQuery($query)
static getLocalUrl($request=null)

References $bearsamppRoot, Path\getLocalUrl(), and getPageQuery().

Here is the call graph for this function:

◆ refreshAliasContent()

refreshAliasContent ( )

Refreshes the alias content by updating the alias configuration file.

Returns
bool True if the alias content was successfully refreshed, false otherwise.

Definition at line 93 of file class.homepage.php.

94 {
95 global $bearsamppBins;
96
97 $result = $bearsamppBins->getApache()->getAliasContent(
100 );
101
102 return file_put_contents(Path::getHomepagePath() . '/alias.conf', $result) !== false;
103 }
$result
global $bearsamppBins
static getWebResourcesPath()
static getHomepagePath($aetrayPath=false)

References $bearsamppBins, $result, Path\getHomepagePath(), and Path\getWebResourcesPath().

Here is the call graph for this function:

◆ refreshCommonsJsContent()

refreshCommonsJsContent ( )

Refreshes the commons JavaScript content by updating the _commons.js and quickpick.js files.

Definition at line 108 of file class.homepage.php.

109 {
110 // Redundant with global AJAX_URL in homepage.php
111 }

Referenced by __construct().

Here is the caller graph for this function:

Field Documentation

◆ $page

$page
private

Definition at line 22 of file class.homepage.php.

Referenced by __construct(), and getPage().

◆ $pageList

$pageList
private
Initial value:
= array(
self::PAGE_INDEX,
self::PAGE_PHPINFO,
)

Definition at line 27 of file class.homepage.php.

◆ PAGE_INDEX

const PAGE_INDEX = 'index'

Definition at line 19 of file class.homepage.php.

◆ PAGE_PHPINFO

const PAGE_PHPINFO = 'phpinfo'

Definition at line 20 of file class.homepage.php.


The documentation for this class was generated from the following file: