Yioop_V9.5_Source_Code_Documentation

yioop

Namespaces

configs
controllers
examples
executables
library
locale
models
views
tests

Table of Contents

webError()  : mixed
Used to handle request errors in non-cli, non-webserver redirect case
bootstrap()  : mixed
Main entry point to the Yioop web app.
checkCookieConsent()  : bool
Checks if a cookie consent form was obtained. This This function returns true if a session cookie was received from the browser, or a form variable saying cookies are okay was received, or the cookie Yioop profile says the consent mechanism is disabled
configureRewrites()  : mixed
Used to setup and handles url rewriting for the Yioop Web app
routeAppFile()  : bool
Used to handle routes that will eventually just serve files from either the APP_DIR These include files like css, scripts, suggest tries, images, and videos.
routeBaseFile()  : bool
Used to handle routes that will eventually just serve files from either the BASE_DIR These include files like css, scripts, images, and robots.txt.
routeDirect()  : bool
Used to route page requests to pages that are fixed Public Group wiki that should always be present. For example, 404 page.
directUrl()  : string
Given the name of a fixed public group static page creates the url where it can be accessed in this instance of Yioop, making use of the defined variable REDIRECTS_ON.
routeBlog()  : bool
Used to route page requests to for the website's public blog
routeFeeds()  : bool
Used to route page requests for pages corresponding to a group, user, or thread feed. If redirects on then urls ending with /feed_type/id map to a page for the id'th item of that feed_type
feedsUrl()  : string
Given the type of feed, the identifier of the feed instance, and which controller is being used creates the url where that feed item can be accessed from the instance of Yioop. It makes use of the defined variable REDIRECTS_ON.
routeUserMessages()  : bool
routeController()  : bool
Used to route page requests to end-user controllers such as register, admin. urls ending with /controller_name will be routed to that controller.
controllerUrl()  : string
Given the name of a controller for which an easy end-user link is useful creates the url where it can be accessed on this instance of Yioop, making use of the defined variable REDIRECTS_ON. Examples of end-user controllers would be the admin, and register controllers.
routeSubsearch()  : bool
Used to route page requests for subsearches such as news, video, and images (site owner can define other). Urls of the form /s/subsearch will go the page handling the subsearch.
subsearchUrl()  : string
Given the name of a subsearch creates the url where it can be accessed on this instance of Yioop, making use of the defined variable REDIRECTS_ON.
routeSerpIcon()  : bool
Used to route requests for favicons for pages in search results
serpIconUrl()  : string
Return the url to repquest the favicon for a page in the search resutls, making use of the defined variable REDIRECTS_ON.
routeSuggest()  : bool
Used to route requests for the suggest-a-url link on the tools page.
suggestUrl()  : string
Return the url for the suggest-a-url link on the more tools page, making use of the defined variable REDIRECTS_ON.
routeWiki()  : bool
Used to route page requests for pages corresponding to a wiki page of group. If it is a wiki page for the public group viewed without being logged in, the route might come in as yioop_instance/p/page_name if redirects are on. If it is for a non-public wiki or page accessed with logged in the url will look like either: yioop_instance/group/group_id?a=wiki&page_name=some_name or yioop_instance/admin/group_id?a=wiki&page_name=some_name&csrf_token_string
wikiUrl()  : string
Given the name of a wiki page, the group it belongs to, and which controller is being used creates the url where that wiki item can be accessed from the instance of Yioop. It makes use of the defined variable REDIRECTS_ON.

Functions

webError()

Used to handle request errors in non-cli, non-webserver redirect case

webError() : mixed
Return values
mixed

bootstrap()

Main entry point to the Yioop web app.

bootstrap([object $web_site = null ][, bool $start_new_session = true ]) : mixed

Initialization is done in a function to avoid polluting the global namespace with variables.

Parameters
$web_site : object = null
$start_new_session : bool = true

whether to start a session or not

Return values
mixed

checkCookieConsent()

Checks if a cookie consent form was obtained. This This function returns true if a session cookie was received from the browser, or a form variable saying cookies are okay was received, or the cookie Yioop profile says the consent mechanism is disabled

checkCookieConsent() : bool
Return values
bool

cookie consent (true) else false

configureRewrites()

Used to setup and handles url rewriting for the Yioop Web app

configureRewrites(object $web_site) : mixed

Developers can add new routes by creating a Routes class in the app_dir with a static method getRoutes which should return an associating array of incoming_path => handler function

Parameters
$web_site : object

used to send error pages if configuration fails

Return values
mixed

routeAppFile()

Used to handle routes that will eventually just serve files from either the APP_DIR These include files like css, scripts, suggest tries, images, and videos.

routeAppFile(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash)

Return values
bool

whether was able to compute a route or not

routeBaseFile()

Used to handle routes that will eventually just serve files from either the BASE_DIR These include files like css, scripts, images, and robots.txt.

routeBaseFile(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

routeDirect()

Used to route page requests to pages that are fixed Public Group wiki that should always be present. For example, 404 page.

routeDirect(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

directUrl()

Given the name of a fixed public group static page creates the url where it can be accessed in this instance of Yioop, making use of the defined variable REDIRECTS_ON.

directUrl(string $name[, bool $with_delim = false ][, bool $with_base_url = false ]) : string
Parameters
$name : string

of static page

$with_delim : bool = false

whether it should be terminated with nothing or ? or &

$with_base_url : bool = false

whether to use SHORT_BASE_URL or BASE_URL (true).

Return values
string

url for the page in question

routeBlog()

Used to route page requests to for the website's public blog

routeBlog(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

routeFeeds()

Used to route page requests for pages corresponding to a group, user, or thread feed. If redirects on then urls ending with /feed_type/id map to a page for the id'th item of that feed_type

routeFeeds(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

feedsUrl()

Given the type of feed, the identifier of the feed instance, and which controller is being used creates the url where that feed item can be accessed from the instance of Yioop. It makes use of the defined variable REDIRECTS_ON.

feedsUrl(string $type, int $id[, bool $with_delim = false ][, string $controller = "group" ][, bool $use_short_base_url = true ]) : string
Parameters
$type : string

of feed: group, user, user messages, thread

$id : int

the identifier for that feed.

$with_delim : bool = false

whether it should be terminated with nothing or ? or &

$controller : string = "group"

which controller is being used to access the feed: usually admin or group

$use_short_base_url : bool = true

whether to create the url as a relative url using C\SHORT_BASE_URL or as a full url using C\BASE_URL (the latter is useful for mail notifications)

Return values
string

url for the page in question

routeUserMessages()

routeUserMessages(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

routeController()

Used to route page requests to end-user controllers such as register, admin. urls ending with /controller_name will be routed to that controller.

routeController(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

controllerUrl()

Given the name of a controller for which an easy end-user link is useful creates the url where it can be accessed on this instance of Yioop, making use of the defined variable REDIRECTS_ON. Examples of end-user controllers would be the admin, and register controllers.

controllerUrl(string $name[, bool $with_delim = false ]) : string
Parameters
$name : string

of controller

$with_delim : bool = false

whether it should be terminated with nothing or ? or &

Return values
string

url for the page in question

routeSubsearch()

Used to route page requests for subsearches such as news, video, and images (site owner can define other). Urls of the form /s/subsearch will go the page handling the subsearch.

routeSubsearch(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

subsearchUrl()

Given the name of a subsearch creates the url where it can be accessed on this instance of Yioop, making use of the defined variable REDIRECTS_ON.

subsearchUrl(string $name[, bool $with_delim = false ]) : string

Examples of subsearches include news, video, and images. A site owner can add to these and delete from these.

Parameters
$name : string

of subsearch

$with_delim : bool = false

whether it should be terminated with nothing or ? or &

Return values
string

url for the page in question

routeSerpIcon()

Used to route requests for favicons for pages in search results

routeSerpIcon(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

serpIconUrl()

Return the url to repquest the favicon for a page in the search resutls, making use of the defined variable REDIRECTS_ON.

serpIconUrl(mixed $url, mixed $crawl_time[, bool $with_delim = false ]) : string
Parameters
$url : mixed
$crawl_time : mixed
$with_delim : bool = false

whether it should be terminated with nothing or ? or &

Return values
string

url for the page in question

routeSuggest()

Used to route requests for the suggest-a-url link on the tools page.

routeSuggest(array<string|int, mixed> $route_args) : bool

If redirects on, then /suggest routes to this suggest-a-url page.

Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

suggestUrl()

Return the url for the suggest-a-url link on the more tools page, making use of the defined variable REDIRECTS_ON.

suggestUrl([bool $with_delim = false ]) : string
Parameters
$with_delim : bool = false

whether it should be terminated with nothing or ? or &

Return values
string

url for the page in question

routeWiki()

Used to route page requests for pages corresponding to a wiki page of group. If it is a wiki page for the public group viewed without being logged in, the route might come in as yioop_instance/p/page_name if redirects are on. If it is for a non-public wiki or page accessed with logged in the url will look like either: yioop_instance/group/group_id?a=wiki&page_name=some_name or yioop_instance/admin/group_id?a=wiki&page_name=some_name&csrf_token_string

routeWiki(array<string|int, mixed> $route_args) : bool
Parameters
$route_args : array<string|int, mixed>

of url parts (split on slash).

Return values
bool

whether was able to compute a route or not

wikiUrl()

Given the name of a wiki page, the group it belongs to, and which controller is being used creates the url where that wiki item can be accessed from the instance of Yioop. It makes use of the defined variable REDIRECTS_ON.

wikiUrl(string $name[, bool $with_delim = false ][, string $controller = "static" ][, int $id = CPUBLIC_GROUP_ID ]) : string
Parameters
$name : string

of wiki page

$with_delim : bool = false

whether it should be terminated with nothing or ? or &

$controller : string = "static"

which controller is being used to access the feed: usually static (for the public group), admin, or group

$id : int = CPUBLIC_GROUP_ID

the group the wiki page belongs to

Return values
string

url for the page in question

Search results