diff --git a/.gitignore b/.gitignore index 0ef9858..3fce731 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,8 @@ nbproject/private *.bak GeoLite2-City.mmdb public/files/* -!public/files/.htaccess \ No newline at end of file +!public/files/.htaccess +public/themes/* +!public/themes/bootstrap/* +!public/themes/identity/* +!public/themes/verti/* \ No newline at end of file diff --git a/lib/themefunctions.php b/lib/themefunctions.php index 35d172c..c02acf8 100644 --- a/lib/themefunctions.php +++ b/lib/themefunctions.php @@ -8,6 +8,11 @@ require_once __DIR__ . "/requiredpublic.php"; +/** + * Get the name of the website. + * @param boolean $echo default true + * @return string + */ function get_site_name($echo = true) { $db = getdatabase(); $title = $db->get('sites', "sitename", ["siteid" => getsiteid()]); @@ -18,6 +23,11 @@ function get_site_name($echo = true) { } } +/** + * Get the URL of the website. + * @param boolean $echo default true + * @return string + */ function get_site_url($echo = true) { $db = getdatabase(); $url = formatsiteurl($db->get('sites', "url", ["siteid" => getsiteid()])); @@ -28,6 +38,11 @@ function get_site_url($echo = true) { } } +/** + * Get the page title. + * @param boolean $echo default true + * @return string + */ function get_page_title($echo = true) { $db = getdatabase(); $title = $db->get("pages", "title", ["AND" => ["slug" => getpageslug(), "siteid" => getsiteid()]]); @@ -38,6 +53,11 @@ function get_page_title($echo = true) { } } +/** + * Get the page title stripped of any HTML. + * @param boolean $echo default true + * @return string + */ function get_page_clean_title($echo = true) { $title = strip_tags(get_page_title(false)); if ($echo) { @@ -47,6 +67,11 @@ function get_page_clean_title($echo = true) { } } +/** + * Get the page slug for the current page. + * @param boolean $echo default true + * @return string + */ function get_page_slug($echo = true) { if ($echo) { echo getpageslug(); @@ -55,6 +80,12 @@ function get_page_slug($echo = true) { } } +/** + * Get a valid minimal URL for a page. + * @param boolean $echo default true + * @param string $slug page slug, or null for current + * @return string + */ function get_page_clean_url($echo = true, $slug = null) { if ($slug == null) { $slug = get_page_slug(false); @@ -71,6 +102,12 @@ function get_page_clean_url($echo = true, $slug = null) { } } +/** + * Get a valid URL for a page. + * @param boolean $echo default true + * @param string $slug page slug, or null for current + * @return string + */ function get_page_url($echo = true, $slug = null) { if ($slug == null) { $slug = get_page_slug(false); @@ -111,6 +148,13 @@ function get_page_url($echo = true, $slug = null) { } } +/** + * Echoes or returns the content of a component. + * @param string $name component name + * @param string $context page slug, or null for current + * @param boolean $echo default true + * @return string + */ function get_component($name, $context = null, $echo = true) { $db = getdatabase(); if ($context == null) { @@ -131,6 +175,12 @@ function get_component($name, $context = null, $echo = true) { } } +/** + * Check if a component is empty of content. + * @param string $name component name + * @param string $context page slug, or null for current + * @return boolean + */ function is_component_empty($name, $context = null) { $comp = get_component($name, $context, false); $comp = strip_tags($comp, "