Merge branch 'version/03'
This commit is contained in:
@@ -13,13 +13,14 @@
|
||||
BRIEF: Documentation for MokoCassiopeia template
|
||||
-->
|
||||
|
||||
# README - MokoCassiopeia (VERSION: 03.09.03)
|
||||
# MokoCassiopeia
|
||||
|
||||
**A Modern, Lightweight Joomla Template Based on Cassiopeia**
|
||||
|
||||
[](https://github.com/mokoconsulting-tech/MokoCassiopeia/releases/tag/v03)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
[](https://www.joomla.org)
|
||||
[](https://www.php.net)
|
||||
[](https://www.joomla.org)
|
||||
[](https://www.php.net)
|
||||
|
||||
MokoCassiopeia is a modern, lightweight enhancement layer built on top of Joomla's Cassiopeia template. It adds **Font Awesome 7**, **Bootstrap 5** helpers, an automatic **Table of Contents (TOC)** utility, advanced **Dark Mode** theming, and optional integrations for **Google Tag Manager** and **Google Analytics (GA4)**—all while maintaining minimal core template overrides for maximum upgrade compatibility.
|
||||
|
||||
|
||||
73
scripts/download-google-fonts.php
Normal file
73
scripts/download-google-fonts.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
*
|
||||
* This file is part of a Moko Consulting project.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* # FILE INFORMATION
|
||||
* DEFGROUP: Joomla.Template.Site
|
||||
* INGROUP: MokoCassiopeia
|
||||
* PATH: scripts/download-google-fonts.php
|
||||
* VERSION: 03.09.05
|
||||
* BRIEF: Download Google Fonts (woff2) for local self-hosting
|
||||
*/
|
||||
|
||||
$fontsDir = __DIR__ . '/../src/media/fonts';
|
||||
|
||||
if (!is_dir($fontsDir)) {
|
||||
fwrite(STDERR, "Error: Fonts directory not found: {$fontsDir}\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$fonts = [
|
||||
'Roboto' => 'https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;700&display=swap',
|
||||
'Noto Sans' => 'https://fonts.googleapis.com/css2?family=Noto+Sans:wght@100;300;400;700&display=swap',
|
||||
'Fira Sans' => 'https://fonts.googleapis.com/css2?family=Fira+Sans:wght@100;300;400;700&display=swap',
|
||||
];
|
||||
|
||||
$userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
||||
|
||||
echo "Google Fonts Downloader for MokoCassiopeia\n";
|
||||
echo str_repeat('=', 48) . "\n";
|
||||
echo "Target: {$fontsDir}\n\n";
|
||||
|
||||
foreach ($fonts as $name => $url) {
|
||||
echo "Downloading {$name}...\n";
|
||||
|
||||
$ctx = stream_context_create(['http' => ['header' => "User-Agent: {$userAgent}\r\n"]]);
|
||||
$css = @file_get_contents($url, false, $ctx);
|
||||
|
||||
if ($css === false) {
|
||||
fwrite(STDERR, " FAIL: could not fetch CSS for {$name}\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match_all('#https://fonts\.gstatic\.com[^)]*\.woff2#', $css, $matches);
|
||||
|
||||
if (empty($matches[0])) {
|
||||
fwrite(STDERR, " FAIL: no woff2 URLs found for {$name}\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($matches[0] as $fontUrl) {
|
||||
$filename = basename($fontUrl);
|
||||
$dest = $fontsDir . '/' . $filename;
|
||||
|
||||
$data = @file_get_contents($fontUrl, false, $ctx);
|
||||
if ($data === false) {
|
||||
fwrite(STDERR, " FAIL: {$filename}\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
file_put_contents($dest, $data);
|
||||
$size = round(strlen($data) / 1024, 1);
|
||||
echo " OK: {$filename} ({$size} KB)\n";
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo " {$count} file(s) downloaded\n\n";
|
||||
}
|
||||
|
||||
echo "Done.\n";
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Download Google Fonts for self-hosting
|
||||
# This script downloads Roboto, Noto Sans, and Fira Sans fonts
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Target directory
|
||||
FONTS_DIR="../src/media/fonts"
|
||||
|
||||
echo -e "${BLUE}╔════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║ Google Fonts Downloader for MokoCassiopeia ║${NC}"
|
||||
echo -e "${BLUE}╚════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
# Check if fonts directory exists
|
||||
if [ ! -d "$FONTS_DIR" ]; then
|
||||
echo -e "${RED}✗ Error: Fonts directory not found: $FONTS_DIR${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$FONTS_DIR"
|
||||
|
||||
echo -e "${YELLOW}Target directory: $(pwd)${NC}"
|
||||
echo ""
|
||||
|
||||
# Function to download font CSS and extract font files
|
||||
download_font() {
|
||||
local font_name="$1"
|
||||
local font_url="$2"
|
||||
local display_name="$3"
|
||||
|
||||
echo -e "${GREEN}Downloading $display_name...${NC}"
|
||||
|
||||
# Download CSS with user agent for woff2 format
|
||||
css=$(curl -s -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" "$font_url")
|
||||
|
||||
if [ -z "$css" ]; then
|
||||
echo -e "${RED} ✗ Failed to download CSS${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Extract woff2 URLs
|
||||
urls=$(echo "$css" | grep -oP 'https://fonts\.gstatic\.com[^\)]*\.woff2' || true)
|
||||
|
||||
if [ -z "$urls" ]; then
|
||||
echo -e "${RED} ✗ No font URLs found in CSS${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
count=0
|
||||
while IFS= read -r url; do
|
||||
if [ -z "$url" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
filename=$(basename "$url")
|
||||
echo -e " → Downloading ${filename}..."
|
||||
|
||||
if curl -s "$url" -o "$filename"; then
|
||||
size=$(du -h "$filename" | cut -f1)
|
||||
echo -e "${GREEN} ✓ Downloaded ($size)${NC}"
|
||||
((count++))
|
||||
else
|
||||
echo -e "${RED} ✗ Failed${NC}"
|
||||
fi
|
||||
done <<< "$urls"
|
||||
|
||||
echo -e "${GREEN} ✓ Downloaded $count font files${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Download fonts
|
||||
download_font "roboto" "https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;700&display=swap" "Roboto"
|
||||
download_font "noto-sans" "https://fonts.googleapis.com/css2?family=Noto+Sans:wght@100;300;400;700&display=swap" "Noto Sans"
|
||||
download_font "fira-sans" "https://fonts.googleapis.com/css2?family=Fira+Sans:wght@100;300;400;700&display=swap" "Fira Sans"
|
||||
|
||||
echo -e "${GREEN}╔════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ ✓ All fonts downloaded successfully! ║${NC}"
|
||||
echo -e "${GREEN}╚════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
echo -e "Font files saved to: ${BLUE}$(pwd)${NC}"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Verify font files are present"
|
||||
echo "2. Update templateDetails.xml font options (if needed)"
|
||||
echo "3. Remove Google Fonts CDN preconnect links from PHP templates"
|
||||
@@ -448,7 +448,10 @@ $wa->useScript('user.js'); // js/user.js
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->countModules('search', true)) : ?>
|
||||
<div class="container-search">
|
||||
<button class="search-toggler d-lg-none" type="button" data-bs-toggle="collapse" data-bs-target="#headerSearchCollapse" aria-controls="headerSearchCollapse" aria-expanded="false" aria-label="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>">
|
||||
<span class="fa-solid fa-magnifying-glass" aria-hidden="true"></span>
|
||||
</button>
|
||||
<div class="container-search collapse d-lg-block" id="headerSearchCollapse">
|
||||
<jdoc:include type="modules" name="search" style="none" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -14477,13 +14477,20 @@ li.current a {
|
||||
min-width: 12rem;
|
||||
}
|
||||
|
||||
.container-header .navbar-toggler {
|
||||
.container-header .navbar-toggler,
|
||||
.container-header .search-toggler {
|
||||
color: var(--mainmenu-nav-link-color, #fff);
|
||||
border-color: var(--mainmenu-nav-link-color, #fff);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.container-header .search-toggler {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
|
||||
.container-header .container-search {
|
||||
margin-top: 0.75em;
|
||||
}
|
||||
@@ -18665,6 +18672,10 @@ nav[data-toggle=toc] .nav-link.active+ul{
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.container-header .container-search.collapse:not(.show) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mod-finder__search.input-group {
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -18683,8 +18694,8 @@ nav[data-toggle=toc] .nav-link.active+ul{
|
||||
}
|
||||
|
||||
.container-header .container-search {
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
flex: 0 0 15%;
|
||||
max-width: 15%;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</server>
|
||||
</updateservers>
|
||||
<name>MokoCassiopeia</name>
|
||||
<version>03.09.04</version>
|
||||
<version>03.09.07</version>
|
||||
<scriptfile>script.php</scriptfile>
|
||||
<creationDate>2026-03-26</creationDate>
|
||||
<author>Jonathan Miller || Moko Consulting</author>
|
||||
|
||||
Reference in New Issue
Block a user