Compare commits

..

2 Commits

Author SHA1 Message Date
gitea-actions[bot] 3a1a201eb2 chore: promote changelog [Unreleased] → [01.08.00] 2026-06-23 23:41:10 +00:00
gitea-actions[bot] 452d4795ed chore(release): build 01.08.00 [skip ci] 2026-06-23 23:41:08 +00:00
159 changed files with 426 additions and 5198 deletions
-41
View File
@@ -1,41 +0,0 @@
# EditorConfig helps maintain consistent coding styles across different editors and IDEs
# https://editorconfig.org/
root = true
# Default settings — Tabs preferred, width = 2 spaces
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
tab_width = 2
# PowerShell scripts — tabs, 2-space visual width
[*.ps1]
indent_style = tab
tab_width = 2
end_of_line = crlf
# Markdown files — keep trailing whitespace for line breaks
[*.md]
trim_trailing_whitespace = false
# JSON / YAML files — tabs, 2-space visual width
[*.{json,yml,yaml}]
indent_style = tab
tab_width = 2
# Makefiles — always tabs, default width
[Makefile]
indent_style = tab
tab_width = 2
# Windows batch scripts — keep CRLF endings
[*.{bat,cmd}]
end_of_line = crlf
# Shell scripts — ensure LF endings
[*.sh]
end_of_line = lf
-110
View File
@@ -1,110 +0,0 @@
---
name: Architecture Decision Record (ADR)
about: Propose or document an architectural decision
title: '[ADR] '
labels: 'architecture, decision'
assignees: ''
---
## ADR Number
ADR-XXXX
## Status
- [ ] Proposed
- [ ] Accepted
- [ ] Deprecated
- [ ] Superseded by ADR-XXXX
## Context
Describe the issue or problem that motivates this decision.
## Decision
State the architecture decision and provide rationale.
## Consequences
### Positive
- List positive consequences
### Negative
- List negative consequences or trade-offs
### Neutral
- List neutral aspects
## Alternatives Considered
### Alternative 1
- Description
- Pros
- Cons
- Why not chosen
### Alternative 2
- Description
- Pros
- Cons
- Why not chosen
## Implementation Plan
1. Step 1
2. Step 2
3. Step 3
## Stakeholders
- **Decision Makers**: @user1, @user2
- **Consulted**: @user3, @user4
- **Informed**: team-name
## Technical Details
### Architecture Diagram
```
[Add diagram or link]
```
### Dependencies
- Dependency 1
- Dependency 2
### Impact Analysis
- **Performance**: [Impact description]
- **Security**: [Impact description]
- **Scalability**: [Impact description]
- **Maintainability**: [Impact description]
## Testing Strategy
- [ ] Unit tests
- [ ] Integration tests
- [ ] Performance tests
- [ ] Security tests
## Documentation
- [ ] Architecture documentation updated
- [ ] API documentation updated
- [ ] Developer guide updated
- [ ] Runbook created
## Migration Path
Describe how to migrate from current state to new architecture.
## Rollback Plan
Describe how to rollback if issues occur.
## Timeline
- **Proposal Date**:
- **Decision Date**:
- **Implementation Start**:
- **Expected Completion**:
## References
- Related ADRs:
- External resources:
- RFCs:
## Review Checklist
- [ ] Aligns with enterprise architecture principles
- [ ] Security implications reviewed
- [ ] Performance implications reviewed
- [ ] Cost implications reviewed
- [ ] Compliance requirements met
- [ ] Team consensus achieved
-48
View File
@@ -1,48 +0,0 @@
---
name: Bug Report
about: Report a bug or issue with the project
title: '[BUG] '
labels: 'bug'
assignees: ''
---
## Bug Description
A clear and concise description of what the bug is.
## Steps to Reproduce
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
## Expected Behavior
A clear and concise description of what you expected to happen.
## Actual Behavior
A clear and concise description of what actually happened.
## Screenshots
If applicable, add screenshots to help explain your problem.
## Environment
- **Project**: [e.g., MokoDoliTools, moko-cassiopeia]
- **Version**: [e.g., 1.2.3]
- **Platform**: [e.g., Dolibarr 18.0, Joomla 5.0]
- **PHP Version**: [e.g., 8.1]
- **Database**: [e.g., MySQL 8.0, PostgreSQL 14]
- **Browser** (if applicable): [e.g., Chrome 120, Firefox 121]
- **OS**: [e.g., Ubuntu 22.04, Windows 11]
## Additional Context
Add any other context about the problem here.
## Possible Solution
If you have suggestions on how to fix the issue, please describe them here.
## Checklist
- [ ] I have searched for similar issues before creating this one
- [ ] I have provided all the requested information
- [ ] I have tested this on the latest stable version
- [ ] I have checked the documentation and couldn't find a solution
-18
View File
@@ -1,18 +0,0 @@
---
blank_issues_enabled: true
contact_links:
- name: 💼 Enterprise Support
url: https://mokoconsulting.tech/enterprise
about: Enterprise-level support and consultation services
- name: 💬 Ask a Question
url: https://mokoconsulting.tech/
about: Get help or ask questions through our website
- name: 📚 MokoStandards Documentation
url: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
about: View our coding standards and best practices
- name: 🔒 Report a Security Vulnerability
url: https://git.mokoconsulting.tech/mokoconsulting-tech/.github-private/security/advisories/new
about: Report security vulnerabilities privately (for critical issues)
- name: 💡 Community Discussions
url: https://github.com/orgs/mokoconsulting-tech/discussions
about: Join community discussions and Q&A
@@ -1,52 +0,0 @@
---
name: Documentation Issue
about: Report an issue with documentation
title: '[DOCS] '
labels: 'documentation'
assignees: ''
---
## Documentation Issue
**Location**:
<!-- Specify the file, page, or section with the issue -->
## Issue Type
<!-- Mark the relevant option with an "x" -->
- [ ] Typo or grammar error
- [ ] Outdated information
- [ ] Missing documentation
- [ ] Unclear explanation
- [ ] Broken links
- [ ] Missing examples
- [ ] Other (specify below)
## Description
<!-- Clearly describe the documentation issue -->
## Current Content
<!-- Quote or describe the current documentation (if applicable) -->
```
Current text here
```
## Suggested Improvement
<!-- Provide your suggestion for how to improve the documentation -->
```
Suggested text here
```
## Additional Context
<!-- Add any other context, screenshots, or references -->
## Standards Alignment
- [ ] Follows MokoStandards documentation guidelines
- [ ] Uses en_US/en_GB localization
- [ ] Includes proper SPDX headers where applicable
## Checklist
- [ ] I have searched for similar documentation issues
- [ ] I have provided a clear description
- [ ] I have suggested an improvement (if applicable)
@@ -1,51 +0,0 @@
---
name: Feature Request
about: Suggest a new feature or enhancement
title: '[FEATURE] '
labels: 'enhancement'
assignees: ''
---
## Feature Description
A clear and concise description of the feature you'd like to see.
## Problem or Use Case
Describe the problem this feature would solve or the use case it addresses.
Ex. I'm always frustrated when [...]
## Proposed Solution
A clear and concise description of what you want to happen.
## Alternative Solutions
A clear and concise description of any alternative solutions or features you've considered.
## Benefits
Describe how this feature would benefit users:
- Who would use this feature?
- What problems does it solve?
- What value does it add?
## Implementation Details (Optional)
If you have ideas about how this could be implemented, share them here:
- Technical approach
- Files/components that might need changes
- Any concerns or challenges you foresee
## Additional Context
Add any other context, mockups, or screenshots about the feature request here.
## Relevant Standards
Does this relate to any standards in [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)?
- [ ] Accessibility (WCAG 2.1 AA)
- [ ] Localization (en_US/en_GB)
- [ ] Security best practices
- [ ] Code quality standards
- [ ] Other: [specify]
## Checklist
- [ ] I have searched for similar feature requests before creating this one
- [ ] I have clearly described the use case and benefits
- [ ] I have considered alternative solutions
- [ ] This feature aligns with the project's goals and scope
-87
View File
@@ -1,87 +0,0 @@
---
name: Joomla Extension Issue
about: Report an issue with a Joomla extension
title: '[JOOMLA] '
labels: 'joomla'
assignees: ''
---
## Issue Type
- [ ] Component Issue
- [ ] Module Issue
- [ ] Plugin Issue
- [ ] Template Issue
## Extension Details
- **Extension Name**: [e.g., moko-cassiopeia]
- **Extension Version**: [e.g., 1.2.3]
- **Extension Type**: [Component / Module / Plugin / Template]
## Joomla Environment
- **Joomla Version**: [e.g., 4.4.0, 5.0.0]
- **PHP Version**: [e.g., 8.1.0]
- **Database**: [MySQL / PostgreSQL / MariaDB]
- **Database Version**: [e.g., 8.0]
- **Server**: [Apache / Nginx / IIS]
- **Hosting**: [Shared / VPS / Dedicated / Cloud]
## Issue Description
Provide a clear and detailed description of the issue.
## Steps to Reproduce
1. Go to '...'
2. Click on '...'
3. Configure '...'
4. See error
## Expected Behavior
What you expected to happen.
## Actual Behavior
What actually happened.
## Error Messages
```
# Paste any error messages from Joomla error logs
# Location: administrator/logs/error.php
```
## Browser Console Errors
```javascript
// Paste any JavaScript console errors (F12 in browser)
```
## Screenshots
Add screenshots to help explain the issue.
## Configuration
```ini
# Paste extension configuration (sanitize sensitive data)
```
## Installed Extensions
List other installed extensions that might conflict:
- Extension 1 (version)
- Extension 2 (version)
## Template Overrides
- [ ] Using template overrides
- [ ] Custom CSS
- [ ] Custom JavaScript
## Additional Context
- **Multilingual Site**: [Yes / No]
- **Cache Enabled**: [Yes / No]
- **Debug Mode**: [Yes / No]
- **SEF URLs**: [Yes / No]
## Checklist
- [ ] I have cleared Joomla cache
- [ ] I have disabled other extensions to test for conflicts
- [ ] I have checked Joomla error logs
- [ ] I have tested with a default Joomla template
- [ ] I have checked browser console for JavaScript errors
- [ ] I have searched for similar issues
- [ ] I am using a supported Joomla version
-82
View File
@@ -1,82 +0,0 @@
---
name: Question
about: Ask a question about usage, features, or best practices
title: '[QUESTION] '
labels: ['question']
assignees: ['jmiller']
---
## Question
**Your question:**
## Context
**What are you trying to accomplish?**
**What have you already tried?**
**Category**:
- [ ] Script usage
- [ ] Configuration
- [ ] Workflow setup
- [ ] Documentation interpretation
- [ ] Best practices
- [ ] Integration
- [ ] Other: __________
## Environment (if relevant)
**Your setup**:
- Operating System:
- Version:
## What You've Researched
**Documentation reviewed**:
- [ ] README.md
- [ ] Project documentation
- [ ] Other (specify): __________
**Similar issues/questions found**:
- #
- #
## Expected Outcome
**What result are you hoping for?**
## Code/Configuration Samples
**Relevant code or configuration** (if applicable):
```bash
# Your code here
```
## Additional Context
**Any other relevant information:**
**Screenshots** (if helpful):
## Urgency
- [ ] Urgent (blocking work)
- [ ] Normal (can work on other things meanwhile)
- [ ] Low priority (just curious)
## Checklist
- [ ] I have searched existing issues and discussions
- [ ] I have reviewed relevant documentation
- [ ] I have provided sufficient context
- [ ] I have included code/configuration samples if relevant
- [ ] This is a genuine question (not a bug report or feature request)
-126
View File
@@ -1,126 +0,0 @@
---
name: Request for Comments (RFC)
about: Propose a significant change for community discussion
title: '[RFC] '
labels: 'rfc, discussion'
assignees: ''
---
## RFC Summary
One-paragraph summary of the proposal.
## Motivation
Why are we doing this? What use cases does it support? What is the expected outcome?
## Detailed Design
### Overview
Provide a detailed explanation of the proposed change.
### API Changes (if applicable)
```php
// Before
function oldApi($param1) { }
// After
function newApi($param1, $param2) { }
```
### User Experience Changes
Describe how users will interact with this change.
### Implementation Approach
High-level implementation strategy.
## Drawbacks
Why should we *not* do this?
## Alternatives
What other designs have been considered? What is the impact of not doing this?
### Alternative 1
- Description
- Trade-offs
### Alternative 2
- Description
- Trade-offs
## Adoption Strategy
How will existing users adopt this? Is this a breaking change?
### Migration Guide
```bash
# Steps to migrate
```
### Deprecation Timeline
- **Announcement**:
- **Deprecation**:
- **Removal**:
## Unresolved Questions
- Question 1
- Question 2
## Future Possibilities
What future work does this enable?
## Impact Assessment
### Performance
Expected performance impact.
### Security
Security considerations and implications.
### Compatibility
- **Backward Compatible**: [Yes / No]
- **Breaking Changes**: [List]
### Maintenance
Long-term maintenance considerations.
## Community Input
### Stakeholders
- [ ] Core team
- [ ] Module developers
- [ ] End users
- [ ] Enterprise customers
### Feedback Period
**Duration**: [e.g., 2 weeks]
**Deadline**: [date]
## Implementation Timeline
### Phase 1: Design
- [ ] RFC discussion
- [ ] Design finalization
- [ ] Approval
### Phase 2: Implementation
- [ ] Core implementation
- [ ] Tests
- [ ] Documentation
### Phase 3: Release
- [ ] Beta release
- [ ] Feedback collection
- [ ] Stable release
## Success Metrics
How will we measure success?
- Metric 1
- Metric 2
## References
- Related RFCs:
- External documentation:
- Prior art:
## Open Questions for Community
1. Question 1?
2. Question 2?
---
**Note**: This RFC is open for community discussion. Please provide feedback in the comments below.
-51
View File
@@ -1,51 +0,0 @@
---
name: Security Vulnerability Report
about: Report a security vulnerability (use only for non-critical issues)
title: '[SECURITY] '
labels: 'security'
assignees: ''
---
## ⚠️ IMPORTANT: Private Disclosure Required
**For critical security vulnerabilities, DO NOT use this template.**
Follow the process in [SECURITY.md](../SECURITY.md) for responsible disclosure.
Use this template only for:
- Security improvements
- Non-critical security suggestions
- Security documentation updates
---
## Security Issue
**Severity**:
<!-- Low, Medium, or informational only -->
## Description
<!-- Describe the security concern or improvement suggestion -->
## Affected Components
<!-- List the affected files, features, or components -->
## Suggested Mitigation
<!-- Describe how this could be addressed -->
## Standards Reference
Does this relate to security standards in [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)?
- [ ] SPDX license identifiers
- [ ] Secret management
- [ ] Dependency security
- [ ] Access control
- [ ] Other: [specify]
## Additional Context
<!-- Add any other context about the security concern -->
## Checklist
- [ ] This is NOT a critical vulnerability requiring private disclosure
- [ ] I have reviewed the SECURITY.md policy
- [ ] I have provided sufficient detail for evaluation
-24
View File
@@ -1,24 +0,0 @@
---
name: Version Bump
about: Request or track a version change
title: '[VERSION] '
labels: 'version, type: version'
assignees: 'jmiller'
---
## Version Change
**Current version**: <!-- e.g., 01.02.03 -->
**Requested version**: <!-- e.g., 01.03.00 -->
**Change type**: <!-- patch / minor / major -->
## Reason
<!-- Why is this version bump needed? -->
## Checklist
- [ ] README.md `VERSION:` field updated
- [ ] CHANGELOG.md entry added
- [ ] Module descriptor version updated (Dolibarr: `$this->version`, Joomla: `<version>`)
- [ ] All file headers will be auto-propagated by `sync-version-on-merge` workflow
@@ -1,72 +0,0 @@
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# FILE INFORMATION
# DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Universal
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
# PATH: /.mokogitea/workflows/ci-issue-reporter.yml
# VERSION: 01.00.00
# BRIEF: Reusable workflow — creates/updates a Gitea issue when a CI gate fails.
# Clones MokoCLI and runs cli/ci_issue_reporter.sh.
name: "Universal: CI Issue Reporter"
on:
workflow_call:
inputs:
gate:
description: "CI gate name (e.g. PR Validation, Repository Health)"
required: true
type: string
details:
description: "Human-readable failure description"
required: true
type: string
severity:
description: "error or warning"
required: false
type: string
default: "error"
workflow:
description: "Workflow name for the issue title"
required: false
type: string
default: ""
secrets:
MOKOGITEA_TOKEN:
required: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
report:
name: "Report: ${{ inputs.gate }}"
runs-on: ubuntu-latest
steps:
- name: Clone MokoCLI
env:
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
run: |
git clone --depth 1 --filter=blob:none --sparse "${MOKOGITEA_URL}/MokoConsulting/MokoCLI.git" /tmp/mokocli
cd /tmp/mokocli && git sparse-checkout set cli/ci_issue_reporter.sh
- name: Report CI failure
env:
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
INPUT_GATE: ${{ inputs.gate }}
INPUT_DETAILS: ${{ inputs.details }}
INPUT_SEVERITY: ${{ inputs.severity }}
INPUT_WORKFLOW: ${{ inputs.workflow }}
run: |
chmod +x /tmp/mokocli/cli/ci_issue_reporter.sh
/tmp/mokocli/cli/ci_issue_reporter.sh \
--gate "$INPUT_GATE" \
--details "$INPUT_DETAILS" \
--severity "$INPUT_SEVERITY" \
--workflow "$INPUT_WORKFLOW"
+126
View File
@@ -0,0 +1,126 @@
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# FILE INFORMATION
# DEFGROUP: Gitea.Workflow
# INGROUP: MokoStandards.Deploy
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
# PATH: /templates/workflows/joomla/deploy-manual.yml.template
# VERSION: 04.07.00
# BRIEF: Manual SFTP deploy to dev server for Joomla repos
name: "Universal: Deploy to Dev (Manual)"
on:
workflow_dispatch:
inputs:
clear_remote:
description: 'Delete all remote files before uploading'
required: false
default: 'false'
type: boolean
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
jobs:
deploy:
name: SFTP Deploy to Dev
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup PHP
run: |
php -v && composer --version
- name: Setup MokoStandards tools
env:
GA_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
MOKO_CLONE_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
MOKO_CLONE_HOST: ${{ secrets.GA_TOKEN && 'git.mokoconsulting.tech/MokoConsulting' || 'github.com/mokoconsulting-tech' }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GA_TOKEN || github.token }}"}}'
run: |
git clone --depth 1 --branch main --quiet \
"https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoStandards-API.git" \
/tmp/mokostandards-api 2>/dev/null || true
if [ -d "/tmp/mokostandards-api" ] && [ -f "/tmp/mokostandards-api/composer.json" ]; then
cd /tmp/mokostandards-api && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
fi
- name: Check FTP configuration
id: check
env:
HOST: ${{ vars.DEV_FTP_HOST }}
PATH_VAR: ${{ vars.DEV_FTP_PATH }}
PORT: ${{ vars.DEV_FTP_PORT }}
run: |
if [ -z "$HOST" ] || [ -z "$PATH_VAR" ]; then
echo "DEV_FTP_HOST or DEV_FTP_PATH not configured -- cannot deploy"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "host=$HOST" >> "$GITHUB_OUTPUT"
REMOTE="${PATH_VAR%/}"
echo "remote=$REMOTE" >> "$GITHUB_OUTPUT"
[ -z "$PORT" ] && PORT="22"
echo "port=$PORT" >> "$GITHUB_OUTPUT"
- name: Deploy via SFTP
if: steps.check.outputs.skip != 'true'
env:
SFTP_KEY: ${{ secrets.DEV_FTP_KEY }}
SFTP_PASS: ${{ secrets.DEV_FTP_PASSWORD }}
SFTP_USER: ${{ vars.DEV_FTP_USERNAME }}
run: |
SOURCE_DIR="src"
[ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs"
[ ! -d "$SOURCE_DIR" ] && { echo "No src/ or htdocs/ -- nothing to deploy"; exit 0; }
printf '{"host":"%s","port":%s,"username":"%s","remotePath":"%s"' \
"${{ steps.check.outputs.host }}" "${{ steps.check.outputs.port }}" "$SFTP_USER" "${{ steps.check.outputs.remote }}" \
> /tmp/sftp-config.json
if [ -n "$SFTP_KEY" ]; then
echo "$SFTP_KEY" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
printf ',"privateKeyPath":"/tmp/deploy_key"}' >> /tmp/sftp-config.json
else
printf ',"password":"%s"}' "$SFTP_PASS" >> /tmp/sftp-config.json
fi
DEPLOY_ARGS=(--path . --src-dir "$SOURCE_DIR" --config /tmp/sftp-config.json)
[ "${{ inputs.clear_remote }}" = "true" ] && DEPLOY_ARGS+=(--clear-remote)
PLATFORM=$(php /tmp/mokostandards-api/cli/platform_detect.php --path . 2>/dev/null || true)
if [ "$PLATFORM" = "waas-component" ] && [ -f "/tmp/mokostandards-api/deploy/deploy-joomla.php" ]; then
php /tmp/mokostandards-api/deploy/deploy-joomla.php "${DEPLOY_ARGS[@]}"
else
php /tmp/mokostandards-api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
fi
rm -f /tmp/deploy_key /tmp/sftp-config.json
- name: Summary
if: always()
run: |
if [ "${{ steps.check.outputs.skip }}" = "true" ]; then
echo "### Deploy Skipped -- FTP not configured" >> $GITHUB_STEP_SUMMARY
else
echo "### Manual Dev Deploy Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Host | \`${{ steps.check.outputs.host }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| Remote | \`${{ steps.check.outputs.remote }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| Clear | ${{ inputs.clear_remote }} |" >> $GITHUB_STEP_SUMMARY
fi
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION
# DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Automation
# VERSION: 01.08.56
# VERSION: 01.08.00
# BRIEF: Auto-create feature branch when an issue is opened
name: "Universal: Issue Branch"
+2 -59
View File
@@ -1,44 +1,9 @@
# Changelog
## [Unreleased]
### Added
- **Visual post calendar**: Monthly calendar grid view showing scheduled, queued, and posted cross-posts with status badges (#160)
- **Calendar navigation**: Month-by-month navigation with today highlighting (#160)
- **Posting analytics**: Best time to post heatmap with day-of-week and hour-of-day breakdown (#165)
- **Analytics service filter**: Filter heatmap and stats by service type with configurable date range
- **Analytics service breakdown**: Per-service success rate, failure count, and average posts per day
- **Analytics AJAX endpoint**: JSON heatmap data for dynamic filtering without page reload
- **Social image generator**: Generate Open Graph images with article title overlay using PHP GD library (#157)
- **Social image config**: Background color, text color, overlay style, and site name override in component options (#157)
- **AI caption generation**: Generate platform-optimized cross-post captions from article content using Claude or OpenAI (#161)
- **AI provider config**: New "AI Caption Generation" fieldset in component options with provider, API key, model, and tone settings
- **AI Generate button**: One-click AI generation button in the Share Content panel that fills all caption fields
- **X/Twitter threads**: Auto-split messages exceeding 280 chars into reply chains at sentence boundaries
- **X/Twitter cost-optimized posting**: Optional mode to post text-only tweet first ($0.015) with URL as separate reply ($0.20)
- **X/Twitter cost warning**: Language string documenting X API pricing for text vs URL posts
- **Instagram carousel**: Multi-image/video posts via Meta carousel container flow (up to 10 items)
- **Instagram Reels**: Short-form video publishing via REELS media type
- **Instagram Stories**: Image and video story publishing via STORIES media type
- **Instagram alt text**: Alt text support for image containers
- **Nostr plugin**: Full NIP-01 WebSocket relay publishing with BIP-340 Schnorr signatures (pure PHP, requires ext-gmp)
- **Nostr**: Publishes kind-1 text note events to multiple relays with automatic failover
- **Nostr**: Raw WebSocket client using stream_socket_client (no external dependencies)
- **Nostr**: Public key derivation and event signing via secp256k1 elliptic curve math
- **Threads carousel**: Support up to 20-item carousel posts via Threads API multi-container flow
- **Threads polls**: Poll creation support via poll_options parameter (2-4 options)
- **Threads spoiler tags**: Content warning / spoiler flag support for Threads posts
- **Threads text-only optimization**: Simplified single-step flow for text-only posts without media
- **Facebook Reels**: Publish video Reels via Graph API video_reels endpoint (#162)
- **Facebook Stories**: Publish image and video Stories via photo_stories/video_stories endpoints (#162)
- **Facebook scheduled posts**: Schedule feed posts with scheduled_publish_time parameter (#162)
- **Facebook draft posts**: Save feed posts as unpublished drafts (#162)
- **TikTok video upload**: PULL_FROM_URL video publishing via video/init endpoint with status polling (#164)
- **TikTok photo carousel**: Up to 35 image carousel posts via content/init endpoint (#164)
- **TikTok posting mode**: Configurable DIRECT_POST or MEDIA_UPLOAD (sends to TikTok inbox for in-app editing) (#164)
- **TikTok audit warning**: Language string explaining that unverified apps can only create private posts (#164)
## [01.08.00] --- 2026-06-23
### Fixed
- Webservices plugin Joomla 6 compatibility — `onBeforeApiRoute` receives `BeforeApiRouteEvent` object, extract router via `$event->getRouter()`
## [01.08.00] --- 2026-06-23
## [01.07.00] --- 2026-06-23
@@ -51,7 +16,6 @@
### Fixed
- **License warning**: Removed duplicate from system plugin (install script already shows it)
- **Content plugin**: Fixed func_get_arg crash when non-article content is saved (e.g. update sites, installer)
## [01.05.00] --- 2026-06-23
@@ -88,24 +52,3 @@
- **Bluesky**: Replaced md5() with hash('sha256', ...) for cache key
- **ServiceController**: Exception details no longer exposed to client
- **License warning**: Removed duplicate from system plugin -- install script already shows it with direct edit link
## [01.04.01] --- 2026-06-21
## [01.04.01] --- 2026-06-21
## [01.04.00] --- 2026-06-21
### Fixed
- **Package manifest**: Added missing `plg_system_mokosuitecross_events` and `plg_system_mokosuitecross_gallery` to `pkg_mokosuitecross.xml` — these system plugins were not installed with the package
- **Cleanup**: Removed old `src/` directory (pre-rename cruft with `mokojoomcross` files)
## [01.03.00] --- 2026-06-21
<!-- VERSION: 01.08.56 -->
All notable changes to MokoSuiteCross will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
-46
View File
@@ -1,46 +0,0 @@
<!-- 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
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License (./LICENSE).
# FILE INFORMATION
DEFGROUP: Template-Joomla
INGROUP: Template-Joomla.Documentation
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
VERSION: 01.08.56
PATH: ./CODE_OF_CONDUCT.md
BRIEF: Community expectations and enforcement guidelines
NOTE: Adapted with attribution from the Contributor Covenant v2.1
-->
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone.
## Our Standards
- Be empathetic and kind
- Be respectful of differing opinions
- Accept constructive feedback
- Own mistakes and learn from them
Unacceptable behavior includes sexualized language/imagery, trolling, harassment, doxing, and other inappropriate conduct.
## Enforcement
Report incidents to **hello@mokoconsulting.tech** or through GitHub Discussions if you prefer a community-visible approach. Private complaints will be reviewed promptly and fairly.
## Enforcement Guidelines
1. **Correction** — Private warning
2. **Warning** — Formal warning and limited interaction
3. **Temporary Ban** — Time-boxed exclusion
4. **Permanent Ban** — Removal from the community
## Attribution
Adapted from the Contributor Covenant v2.1.
-1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
# MokoSuiteCross
<!-- VERSION: 01.08.56 -->
<!-- VERSION: 01.08.00 -->
Cross-posting Joomla content to social media, email marketing, and chat platforms for Joomla 5/6.
-241
View File
@@ -1,241 +0,0 @@
<!--
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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
# FILE INFORMATION
DEFGROUP: Template-Joomla
INGROUP: Template-Joomla.Documentation
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
PATH: /SECURITY.md
VERSION: 01.08.56
BRIEF: Security vulnerability reporting and handling policy
-->
# Security Policy
## Purpose and Scope
This document defines the security vulnerability reporting, response, and disclosure policy for this Joomla Plugin template repository. It establishes the authoritative process for responsible disclosure, assessment, remediation, and communication of security issues.
## Supported Versions
Security updates are provided for the following versions:
| Version | Supported |
| ------- | ------------------ |
| 01.x.x | :white_check_mark: |
| < 01.0 | :x: |
Only the current major version receives security updates. Users should upgrade to the latest supported version to receive security patches.
## Reporting a Vulnerability
### Where to Report
**DO NOT** create public GitHub issues for security vulnerabilities.
Report security vulnerabilities privately to:
**Email**: `security@mokoconsulting.tech`
**Subject Line**: `[SECURITY] Template-Joomla - Brief Description`
### What to Include
A complete vulnerability report should include:
1. **Description**: Clear explanation of the vulnerability
2. **Impact**: Potential security impact and severity assessment
3. **Affected Versions**: Which versions are vulnerable
4. **Reproduction Steps**: Detailed steps to reproduce the issue
5. **Proof of Concept**: Code, configuration, or demonstration (if applicable)
6. **Suggested Fix**: Proposed remediation (if known)
7. **Disclosure Timeline**: Your expectations for public disclosure
### Response Timeline
* **Initial Response**: Within 3 business days
* **Assessment Complete**: Within 7 business days
* **Fix Timeline**: Depends on severity (see below)
* **Disclosure**: Coordinated with reporter
## Severity Classification
Vulnerabilities are classified using the following severity levels:
### Critical
* Remote code execution
* Authentication bypass
* Data breach or exposure of sensitive information
* **Fix Timeline**: 7 days
### High
* Privilege escalation
* SQL injection or command injection
* Cross-site scripting (XSS) with significant impact
* **Fix Timeline**: 14 days
### Medium
* Information disclosure (limited scope)
* Denial of service
* Security misconfigurations with moderate impact
* **Fix Timeline**: 30 days
### Low
* Security best practice violations
* Minor information leaks
* Issues requiring user interaction or complex preconditions
* **Fix Timeline**: 60 days or next release
## Remediation Process
1. **Acknowledgment**: Security team confirms receipt and begins investigation
2. **Assessment**: Vulnerability is validated, severity assigned, and impact analyzed
3. **Development**: Security patch is developed and tested
4. **Review**: Patch undergoes security review and validation
5. **Release**: Fixed version is released with security advisory
6. **Disclosure**: Public disclosure follows coordinated timeline
## Security Advisories
Security advisories are published via:
* GitHub Security Advisories
* Release notes and CHANGELOG.md
* Email notification to project users (if mailing list is established)
Advisories include:
* CVE identifier (if applicable)
* Severity rating
* Affected versions
* Fixed versions
* Mitigation steps
* Attribution (with reporter consent)
## Security Best Practices
For projects using this template:
### Required Controls
* Enable GitHub security features (Dependabot, code scanning)
* Implement branch protection on `main`
* Require code review for all changes
* Enforce signed commits (recommended)
* Use secrets management (never commit credentials)
* Maintain security documentation
* Follow secure coding standards defined in MokoStandards
### Joomla Plugin Security
* Follow Joomla security best practices
* Validate and sanitize all user input
* Use Joomla's database API to prevent SQL injection
* Properly escape output to prevent XSS
* Implement proper access control checks
* Use Joomla's session and authentication APIs
* Keep Joomla and dependencies up to date
### CI/CD Security
* Validate all inputs
* Sanitize outputs
* Use least privilege access
* Pin dependencies with hash verification
* Scan for vulnerabilities in dependencies
* Audit third-party actions and tools
#### Automated Security Scanning
All repositories SHOULD implement:
**CodeQL Analysis**:
* Enabled for PHP and other supported languages
* Runs on: push to main, pull requests, weekly schedule
* Query sets: `security-extended` and `security-and-quality`
* Configuration: `.github/workflows/codeql-analysis.yml`
**Dependabot Security Updates**:
* Weekly scans for vulnerable dependencies
* Automated pull requests for security patches
* Configuration: `.github/dependabot.yml`
**Secret Scanning**:
* Enabled by default with push protection
* Prevents accidental credential commits
### Dependency Management
* Keep dependencies up to date
* Monitor security advisories for dependencies
* Remove unused dependencies
* Audit new dependencies before adoption
* Document security-critical dependencies
## Compliance and Governance
This security policy is aligned with MokoStandards. Deviations require documented justification.
Security policies are reviewed and updated at least annually or following significant security incidents.
## Attribution and Recognition
We acknowledge and appreciate responsible disclosure. With your permission, we will:
* Credit you in security advisories
* List you in CHANGELOG.md for the fix release
* Recognize your contribution publicly (if desired)
## Contact and Escalation
* **Security Team**: security@mokoconsulting.tech
* **Primary Contact**: hello@mokoconsulting.tech
* **Escalation**: For urgent matters requiring immediate attention, contact the maintainer directly via GitHub
## Out of Scope
The following are explicitly out of scope:
* Issues in third-party dependencies (report directly to maintainers)
* Social engineering attacks
* Physical security issues
* Denial of service via resource exhaustion without amplification
* Issues requiring physical access to systems
* Theoretical vulnerabilities without proof of exploitability
---
## Metadata
| Field | Value |
| ------------ | ------------------------------------------------------------------------------------------------------------ |
| Document | Security Policy |
| Path | /SECURITY.md |
| Repository | [https://github.com/mokoconsulting-tech/Template-Joomla](https://github.com/mokoconsulting-tech/Template-Joomla) |
| Owner | Moko Consulting |
| Scope | Security vulnerability handling |
| Status | Active |
| Effective | 2026-01-16 |
## Revision History
| Date | Change Description | Author |
| ---------- | ------------------------------------------------- | --------------- |
| 2026-01-16 | Initial creation for template repository | Moko Consulting |
+1 -15
View File
@@ -15,23 +15,9 @@
"php": ">=8.1"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"squizlabs/php_codesniffer": "^3.7",
"phpstan/phpstan": "^1.10",
"joomla/coding-standards": "dev-3.x-dev"
},
"autoload": {
"psr-4": {
"Joomla\\Component\\MokoSuiteCross\\Administrator\\": "source/packages/com_mokosuitecross/src/",
"Joomla\\Component\\MokoSuiteCross\\Site\\": "source/packages/com_mokosuitecross/site/src/",
"Joomla\\Plugin\\Content\\MokoSuiteCross\\": "source/packages/plg_content_mokosuitecross/src/",
"Joomla\\Plugin\\System\\MokoSuiteCross\\": "source/packages/plg_system_mokosuitecross/src/"
}
},
"autoload-dev": {
"psr-4": {
"MokoSuiteCross\\Tests\\": "tests/"
}
"joomla/coding-standards": "^4.0"
},
"config": {
"sort-packages": true
-32
View File
@@ -1,32 +0,0 @@
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# PHPStan configuration for Joomla extension repositories.
# Extends the base MokoStandards config and adds Joomla framework class stubs
# so PHPStan can resolve Factory, CMSApplication, User, Table, etc.
# without requiring a full Joomla installation.
parameters:
level: 5
paths:
- src
excludePaths:
- vendor
- node_modules
# Joomla framework stubs — resolved via the enterprise package from vendor/
stubFiles:
- vendor/mokoconsulting-tech/enterprise/templates/stubs/joomla.php
# Suppress errors that are structural in Joomla's service-container architecture
ignoreErrors:
# Joomla's service-based dependency injection returns mixed from getApplication()
- '#Cannot call method .+ on Joomla\\CMS\\Application\\CMSApplication\|null#'
# Factory::getX() patterns are safe at runtime even when nullable in stubs
- '#Call to static method [a-zA-Z]+\(\) on an interface#'
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>source/packages/com_mokosuitecross/src</directory>
<directory>source/packages/plg_content_mokosuitecross/src</directory>
<directory>source/packages/plg_system_mokosuitecross/src</directory>
</include>
</source>
</phpunit>
@@ -3,6 +3,6 @@
; License: GPL-3.0-or-later
PKG_MOKOSUITECROSS="MokoSuiteCross"
PKG_MOKOSUITECROSS_DESCRIPTION="Cross-post Joomla articles to 38 platforms including Facebook, Instagram, X/Twitter, LinkedIn, Threads, Mastodon, Bluesky, Nostr, TikTok, YouTube, Pinterest, Reddit, Medium, Telegram, Discord, Slack, Teams, Mailchimp, SendGrid, Brevo, and more. Features scheduled posting, template placeholders, UTM tagging, link shortening, caption rotation, and per-article service selection."
PKG_MOKOSUITECROSS_DESCRIPTION="Cross-posting Joomla content to social media, email marketing, and chat platforms. Automatically publish articles to Facebook, X/Twitter, LinkedIn, Mastodon, Bluesky, Mailchimp, Telegram, Discord, and Slack."
PKG_MOKOSUITECROSS_PHP_VERSION_ERROR="MokoSuiteCross requires PHP %s or later."
PKG_MOKOSUITECROSS_MIGRATION_DETECTED="Perfect Publisher Pro detected! Navigate to Components → MokoSuiteCross → Dashboard to migrate your settings."
@@ -120,42 +120,6 @@
/>
</fieldset>
<fieldset name="link_shortening" label="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENING">
<field
name="link_shortener"
type="list"
label="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER"
description="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_DESC"
default="none">
<option value="none">COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_NONE</option>
<option value="bitly">COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_BITLY</option>
<option value="rebrandly">COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_REBRANDLY</option>
<option value="yourls">COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS</option>
</field>
<field
name="link_shortener_api_key"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_API_KEY"
description="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_API_KEY_DESC"
showon="link_shortener:bitly,rebrandly"
/>
<field
name="link_shortener_yourls_url"
type="url"
label="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_URL"
description="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_URL_DESC"
hint="https://short.example.com/yourls-api.php"
showon="link_shortener:yourls"
/>
<field
name="link_shortener_yourls_token"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_TOKEN"
description="COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_TOKEN_DESC"
showon="link_shortener:yourls"
/>
</fieldset>
<fieldset name="evergreen" label="COM_MOKOSUITECROSS_CONFIG_EVERGREEN">
<field
name="evergreen_enabled"
@@ -227,95 +191,6 @@
/>
</fieldset>
<fieldset name="ai" label="COM_MOKOSUITECROSS_CONFIG_AI">
<field
name="ai_provider"
type="list"
label="COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER"
description="COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_DESC"
default="none">
<option value="none">COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_NONE</option>
<option value="claude">COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_CLAUDE</option>
<option value="openai">COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_OPENAI</option>
</field>
<field
name="ai_api_key"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_AI_API_KEY"
description="COM_MOKOSUITECROSS_CONFIG_AI_API_KEY_DESC"
showon="ai_provider:claude,openai"
/>
<field
name="ai_model"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_AI_MODEL"
description="COM_MOKOSUITECROSS_CONFIG_AI_MODEL_DESC"
hint="claude-haiku-4-5 / gpt-4o-mini"
showon="ai_provider:claude,openai"
/>
<field
name="ai_tone"
type="list"
label="COM_MOKOSUITECROSS_CONFIG_AI_TONE"
description="COM_MOKOSUITECROSS_CONFIG_AI_TONE_DESC"
default="professional"
showon="ai_provider:claude,openai">
<option value="professional">COM_MOKOSUITECROSS_CONFIG_AI_TONE_PROFESSIONAL</option>
<option value="friendly">COM_MOKOSUITECROSS_CONFIG_AI_TONE_FRIENDLY</option>
<option value="casual">COM_MOKOSUITECROSS_CONFIG_AI_TONE_CASUAL</option>
</field>
</fieldset>
<fieldset name="social_image" label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE">
<field
name="social_image_enabled"
type="radio"
label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_ENABLED"
description="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_ENABLED_DESC"
default="0"
class="btn-group">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="social_image_bg_color"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_BG_COLOR"
description="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_BG_COLOR_DESC"
default="#1a1a2e"
showon="social_image_enabled:1"
/>
<field
name="social_image_text_color"
type="text"
label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_TEXT_COLOR"
description="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_TEXT_COLOR_DESC"
default="#ffffff"
showon="social_image_enabled:1"
/>
<field
name="social_image_font_size"
type="number"
label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_FONT_SIZE"
description="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_FONT_SIZE_DESC"
default="48"
min="24"
max="96"
showon="social_image_enabled:1"
/>
<field
name="social_image_show_site_name"
type="radio"
label="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_SHOW_SITE_NAME"
description="COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_SHOW_SITE_NAME_DESC"
default="1"
class="btn-group"
showon="social_image_enabled:1">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="category_rules" label="COM_MOKOSUITECROSS_CONFIG_CATEGORY_RULES">
<field
name="category_rules_note"
@@ -534,101 +534,7 @@ COM_MOKOSUITECROSS_DISPATCH_INVALID_SERVICES="service_ids must be a non-empty ar
COM_MOKOSUITECROSS_DISPATCH_ARTICLE_NOT_FOUND="Article not found."
COM_MOKOSUITECROSS_DISPATCH_NO_SERVICES="No enabled services found matching the request."
; Link Shortening
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENING="Link Shortening"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER="Link Shortener"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_DESC="Select a link shortening service. Shortened URLs are available via the {url_short} placeholder in templates."
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_NONE="None (disabled)"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_BITLY="Bitly"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_REBRANDLY="Rebrandly"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS="YOURLS (self-hosted)"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_API_KEY="API Key"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_API_KEY_DESC="API key for Bitly or Rebrandly."
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_URL="YOURLS API URL"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_URL_DESC="Full URL to your YOURLS API endpoint (e.g. https://short.example.com/yourls-api.php)."
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_TOKEN="YOURLS Signature Token"
COM_MOKOSUITECROSS_CONFIG_LINK_SHORTENER_YOURLS_TOKEN_DESC="Secret signature token from your YOURLS installation."
; AI Caption Generation
COM_MOKOSUITECROSS_CONFIG_AI="AI Caption Generation"
COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER="AI Provider"
COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_DESC="Select an AI provider to generate cross-post captions from article content. The API key is stored in Joomla component params (encrypted at rest)."
COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_NONE="None (disabled)"
COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_CLAUDE="Anthropic Claude"
COM_MOKOSUITECROSS_CONFIG_AI_PROVIDER_OPENAI="OpenAI"
COM_MOKOSUITECROSS_CONFIG_AI_API_KEY="API Key"
COM_MOKOSUITECROSS_CONFIG_AI_API_KEY_DESC="API key for the selected AI provider."
COM_MOKOSUITECROSS_CONFIG_AI_MODEL="Model"
COM_MOKOSUITECROSS_CONFIG_AI_MODEL_DESC="AI model to use. Leave blank for the default (Claude Haiku 4.5 or GPT-4o Mini)."
COM_MOKOSUITECROSS_CONFIG_AI_TONE="Tone"
COM_MOKOSUITECROSS_CONFIG_AI_TONE_DESC="The writing tone for generated captions."
COM_MOKOSUITECROSS_CONFIG_AI_TONE_PROFESSIONAL="Professional"
COM_MOKOSUITECROSS_CONFIG_AI_TONE_FRIENDLY="Friendly"
COM_MOKOSUITECROSS_CONFIG_AI_TONE_CASUAL="Casual"
COM_MOKOSUITECROSS_AI_GENERATE="Generate with AI"
COM_MOKOSUITECROSS_AI_GENERATE_DESC="Generate platform-optimized captions from the article content using AI."
COM_MOKOSUITECROSS_AI_GENERATING="Generating captions..."
COM_MOKOSUITECROSS_AI_GENERATED="AI captions generated successfully."
COM_MOKOSUITECROSS_AI_ERROR="AI generation failed: %s"
; Social Image Generator
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE="Social Image Generator"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_BG_COLOR="Background Color"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_BG_COLOR_DESC="Default background color for generated OG images when no article image is available."
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_TEXT_COLOR="Text Color"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_TEXT_COLOR_DESC="Color for the title and site name text overlay on generated images."
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_OVERLAY="Image Overlay"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_OVERLAY_DESC="Darken or lighten the background image to improve text readability."
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_OVERLAY_NONE="None"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_OVERLAY_LIGHT="Light"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_OVERLAY_DARK="Dark"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_SITE_NAME="Site Name Override"
COM_MOKOSUITECROSS_CONFIG_SOCIAL_IMAGE_SITE_NAME_DESC="Custom site name shown at the bottom of generated images. Leave blank to use the Joomla site name."
COM_MOKOSUITECROSS_AI_NOT_CONFIGURED="AI is not configured. Go to Options to set up a provider and API key."
; Analytics
COM_MOKOSUITECROSS_SUBMENU_ANALYTICS="Analytics"
COM_MOKOSUITECROSS_ANALYTICS_PERIOD="Time Period"
COM_MOKOSUITECROSS_ANALYTICS_SERVICE_FILTER="Service"
COM_MOKOSUITECROSS_ANALYTICS_ALL_SERVICES="All Services"
COM_MOKOSUITECROSS_ANALYTICS_BEST_TIMES="Best Times to Post"
COM_MOKOSUITECROSS_ANALYTICS_HEATMAP="Engagement Heatmap"
COM_MOKOSUITECROSS_ANALYTICS_HOURLY="Hourly Distribution"
COM_MOKOSUITECROSS_ANALYTICS_DAILY="Day of Week Distribution"
COM_MOKOSUITECROSS_ANALYTICS_NO_DATA="Not enough posting data to generate recommendations. Post at least 3 times per time slot over the selected period."
COM_MOKOSUITECROSS_ANALYTICS_POSTS_SUCCESS="%d of %d successful"
COM_MOKOSUITECROSS_ANALYTICS_DAY_SUN="Sun"
COM_MOKOSUITECROSS_ANALYTICS_DAY_MON="Mon"
COM_MOKOSUITECROSS_ANALYTICS_DAY_TUE="Tue"
COM_MOKOSUITECROSS_ANALYTICS_DAY_WED="Wed"
COM_MOKOSUITECROSS_ANALYTICS_DAY_THU="Thu"
COM_MOKOSUITECROSS_ANALYTICS_DAY_FRI="Fri"
COM_MOKOSUITECROSS_ANALYTICS_DAY_SAT="Sat"
COM_MOKOSUITECROSS_ANALYTICS_LEGEND_HIGH="High success rate"
COM_MOKOSUITECROSS_ANALYTICS_LEGEND_MEDIUM="Medium success rate"
COM_MOKOSUITECROSS_ANALYTICS_LEGEND_LOW="Low success rate"
COM_MOKOSUITECROSS_ANALYTICS_LEGEND_NONE="No data"
COM_MOKOSUITECROSS_PERIOD_180_DAYS="Last 180 days"
COM_MOKOSUITECROSS_PERIOD_365_DAYS="Last 365 days"
; Category Rules
COM_MOKOSUITECROSS_CONFIG_CATEGORY_RULES="Category Rules"
COM_MOKOSUITECROSS_CONFIG_CATEGORY_RULES_NOTE="Category Routing"
COM_MOKOSUITECROSS_CONFIG_CATEGORY_RULES_NOTE_DESC="Category routing rules let you map Joomla categories to specific cross-post services. When rules exist for a category, only those services receive posts. When no rules exist, all services are used (default behaviour). Rules are managed in the database table #__mokosuitecross_category_rules. A full admin UI will be added in a future release."
; Posting Analytics
COM_MOKOSUITECROSS_ANALYTICS_FILTER_SERVICE="Service"
COM_MOKOSUITECROSS_ANALYTICS_ALL_SERVICES="All Services"
COM_MOKOSUITECROSS_ANALYTICS_PERIOD="Period"
COM_MOKOSUITECROSS_ANALYTICS_BEST_TIMES="Best Times to Post"
COM_MOKOSUITECROSS_ANALYTICS_POSTS_COUNT="%d posts"
COM_MOKOSUITECROSS_ANALYTICS_HEATMAP="Posting Heatmap"
COM_MOKOSUITECROSS_ANALYTICS_NO_DATA="No posting data available for the selected period."
COM_MOKOSUITECROSS_ANALYTICS_LESS="Less"
COM_MOKOSUITECROSS_ANALYTICS_MORE="More"
COM_MOKOSUITECROSS_ANALYTICS_SERVICE_BREAKDOWN="Service Breakdown"
COM_MOKOSUITECROSS_ANALYTICS_SERVICE="Service"
COM_MOKOSUITECROSS_ANALYTICS_TOTAL="Total"
COM_MOKOSUITECROSS_ANALYTICS_SUCCESS="Success"
COM_MOKOSUITECROSS_ANALYTICS_FAILED="Failed"
COM_MOKOSUITECROSS_ANALYTICS_SUCCESS_RATE="Success Rate"
COM_MOKOSUITECROSS_ANALYTICS_AVG_PER_DAY="Avg/Day"
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" method="upgrade">
<name>com_mokosuitecross</name>
<version>01.08.56</version>
<version>01.08.00</version>
<creationDate>2026-05-28</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>
@@ -1,14 +1,5 @@
; MokoSuiteCross -- Site Frontend Language File
; MokoSuiteCross Site Frontend Language File
; Copyright (C) 2026 Moko Consulting. All rights reserved.
; License: GPL-3.0-or-later
COM_MOKOSUITECROSS="MokoSuiteCross"
COM_MOKOSUITECROSS_POSTS_LIST_TITLE="Cross-Posted Content"
COM_MOKOSUITECROSS_POST_DETAIL_TITLE="Cross-Post History"
COM_MOKOSUITECROSS_COLUMN_ARTICLE="Article"
COM_MOKOSUITECROSS_COLUMN_PLATFORMS="Platforms"
COM_MOKOSUITECROSS_COLUMN_LAST_POSTED="Last Posted"
COM_MOKOSUITECROSS_COLUMN_STATUS="Status"
COM_MOKOSUITECROSS_COLUMN_POSTED_DATE="Posted Date"
COM_MOKOSUITECROSS_COLUMN_LINK="Platform Link"
COM_MOKOSUITECROSS_NO_POSTS="No cross-posted content found."
@@ -17,5 +17,5 @@ use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController
{
protected $default_view = 'posts';
protected $default_view = 'post';
}
@@ -1,64 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
class PostModel extends BaseDatabaseModel
{
public function getArticle(int $articleId): ?object
{
$db = $this->getDatabase();
$user = Factory::getApplication()->getIdentity();
$query = $db->getQuery(true)
->select('a.id, a.title, a.alias, a.catid, a.access')
->from($db->quoteName('#__content', 'a'))
->where('a.id = ' . (int) $articleId)
->where('a.state = 1');
$groups = $user->getAuthorisedViewLevels();
$query->where('a.access IN (' . implode(',', array_map('intval', $groups)) . ')');
$db->setQuery($query);
return $db->loadObject() ?: null;
}
public function getPosts(int $articleId): array
{
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select([
'p.id',
'p.status',
'p.platform_post_id',
'p.posted_at',
'p.error_message',
'p.created',
's.title AS service_title',
's.service_type',
])
->from($db->quoteName('#__mokosuitecross_posts', 'p'))
->join('INNER', $db->quoteName('#__mokosuitecross_services', 's') . ' ON s.id = p.service_id')
->where('p.article_id = ' . (int) $articleId)
->order('p.created DESC');
$db->setQuery($query, 0, 50);
return $db->loadObjectList() ?: [];
}
}
@@ -1,51 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel;
class PostsModel extends ListModel
{
protected function getListQuery()
{
$db = $this->getDatabase();
$user = Factory::getApplication()->getIdentity();
$query = $db->getQuery(true);
$query->select([
'a.id AS article_id',
'a.title AS article_title',
'a.alias AS article_alias',
'a.catid',
'MAX(p.posted_at) AS last_posted',
'COUNT(p.id) AS post_count',
'GROUP_CONCAT(DISTINCT s.service_type ORDER BY s.service_type SEPARATOR \',\') AS service_types',
])
->from($db->quoteName('#__mokosuitecross_posts', 'p'))
->join('INNER', $db->quoteName('#__content', 'a') . ' ON a.id = p.article_id')
->join('INNER', $db->quoteName('#__mokosuitecross_services', 's') . ' ON s.id = p.service_id')
->where('p.status = ' . $db->quote('posted'))
->where('a.state = 1');
// Access filtering
$groups = $user->getAuthorisedViewLevels();
$query->where('a.access IN (' . implode(',', array_map('intval', $groups)) . ')');
$query->group('a.id, a.title, a.alias, a.catid')
->order('last_posted DESC');
return $query;
}
}
@@ -1,33 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Site\View\Post;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
protected $article;
protected $posts;
public function display($tpl = null): void
{
$articleId = Factory::getApplication()->getInput()->getInt('id', 0);
$model = $this->getModel();
$this->article = $model->getArticle($articleId);
$this->posts = $model->getPosts($articleId);
parent::display($tpl);
}
}
@@ -1,30 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Site\View\Posts;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
protected $items;
protected $pagination;
public function display($tpl = null): void
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
parent::display($tpl);
}
}
@@ -1,84 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
$statusClasses = [
'posted' => 'bg-success',
'failed' => 'bg-danger',
'permanently_failed' => 'bg-danger',
'queued' => 'bg-warning text-dark',
'posting' => 'bg-info',
'scheduled' => 'bg-primary',
'deleted' => 'bg-secondary',
'cancelled' => 'bg-secondary',
];
?>
<div class="com-mokosuitecross-post">
<?php if (!$this->article) : ?>
<div class="alert alert-warning">
<?php echo Text::_('COM_MOKOSUITECROSS_NO_POSTS'); ?>
</div>
<?php else : ?>
<h2><?php echo Text::_('COM_MOKOSUITECROSS_POST_DETAIL_TITLE'); ?></h2>
<p>
<strong><?php echo $this->escape($this->article->title); ?></strong>
</p>
<?php if (empty($this->posts)) : ?>
<div class="alert alert-info">
<?php echo Text::_('COM_MOKOSUITECROSS_NO_POSTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th><?php echo Text::_('COM_MOKOSUITECROSS_HEADING_SERVICE'); ?></th>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_STATUS'); ?></th>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_POSTED_DATE'); ?></th>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_LINK'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->posts as $post) : ?>
<tr>
<td>
<span class="badge bg-secondary"><?php echo $this->escape($post->service_type); ?></span>
<?php echo $this->escape($post->service_title); ?>
</td>
<td>
<span class="badge <?php echo $statusClasses[$post->status] ?? 'bg-secondary'; ?>">
<?php echo $this->escape(ucfirst($post->status)); ?>
</span>
</td>
<td><?php echo $post->posted_at ? $this->escape($post->posted_at) : $this->escape($post->created); ?></td>
<td>
<?php if (!empty($post->platform_post_id)) : ?>
<span class="text-muted small"><?php echo $this->escape($post->platform_post_id); ?></span>
<?php else : ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<a href="<?php echo Route::_('index.php?option=com_mokosuitecross&view=posts'); ?>" class="btn btn-secondary">
&larr; <?php echo Text::_('COM_MOKOSUITECROSS_POSTS_LIST_TITLE'); ?>
</a>
<?php endif; ?>
</div>
@@ -1,66 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
?>
<div class="com-mokosuitecross-posts">
<h2><?php echo Text::_('COM_MOKOSUITECROSS_POSTS_LIST_TITLE'); ?></h2>
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<?php echo Text::_('COM_MOKOSUITECROSS_NO_POSTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_ARTICLE'); ?></th>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_PLATFORMS'); ?></th>
<th><?php echo Text::_('COM_MOKOSUITECROSS_COLUMN_LAST_POSTED'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $item) : ?>
<tr>
<td>
<a href="<?php echo Route::_('index.php?option=com_mokosuitecross&view=post&id=' . (int) $item->article_id); ?>">
<?php echo $this->escape($item->article_title); ?>
</a>
</td>
<td>
<?php
$types = explode(',', $item->service_types ?? '');
foreach ($types as $type) :
$type = trim($type);
if (empty($type)) continue;
?>
<span class="badge bg-secondary"><?php echo $this->escape($type); ?></span>
<?php endforeach; ?>
</td>
<td>
<?php echo $item->last_posted ? $this->escape($item->last_posted) : '—'; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ($this->pagination->pagesTotal > 1) : ?>
<div class="com-mokosuitecross-posts__pagination">
<?php echo $this->pagination->getListFooter(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
@@ -1 +0,0 @@
/* 01.08.05 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.07 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.08 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.09 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.10 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.11 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.12 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.13 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.14 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.15 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.16 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.17 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.19 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.20 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.21 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.22 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.23 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.24 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.25 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.26 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.27 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.28 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.29 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.30 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.31 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.32 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.33 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.34 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.35 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.36 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.37 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.38 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.39 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.40 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.41 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.43 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.44 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.45 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.46 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.47 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.49 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.50 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.51 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.52 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.53 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.54 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.55 — no schema changes */
@@ -1 +0,0 @@
/* 01.08.56 — no schema changes */
@@ -1,100 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\AiGeneratorHelper;
class AiController extends BaseController
{
public function generate(): void
{
if (!Session::checkToken('get')) {
echo json_encode(['success' => false, 'error' => 'Invalid token']);
$this->app->close();
return;
}
$user = $this->app->getIdentity();
if (!$user->authorise('core.edit', 'com_mokosuitecross')) {
echo json_encode(['success' => false, 'error' => 'Permission denied']);
$this->app->close();
return;
}
$articleId = $this->input->getInt('article_id', 0);
if ($articleId < 1) {
echo json_encode(['success' => false, 'error' => 'Missing article ID']);
$this->app->close();
return;
}
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(['id', 'title', 'introtext', 'catid']))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . $articleId);
$db->setQuery($query);
$article = $db->loadObject();
if (!$article) {
echo json_encode(['success' => false, 'error' => 'Article not found']);
$this->app->close();
return;
}
$category = '';
$catQuery = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__categories'))
->where($db->quoteName('id') . ' = ' . (int) $article->catid);
$db->setQuery($catQuery);
$category = $db->loadResult() ?: '';
$tagQuery = $db->getQuery(true)
->select($db->quoteName('t.title'))
->from($db->quoteName('#__tags', 't'))
->join('INNER', $db->quoteName('#__contentitem_tag_map', 'm') . ' ON ' . $db->quoteName('m.tag_id') . ' = ' . $db->quoteName('t.id'))
->where($db->quoteName('m.content_item_id') . ' = ' . $articleId)
->where($db->quoteName('m.type_alias') . ' = ' . $db->quote('com_content.article'));
$db->setQuery($tagQuery);
$tags = $db->loadColumn() ?: [];
$introtext = strip_tags($article->introtext ?? '');
$introtext = mb_substr($introtext, 0, 500);
$params = \Joomla\CMS\Component\ComponentHelper::getParams('com_mokosuitecross');
$config = [
'ai_provider' => $params->get('ai_provider', 'none'),
'ai_api_key' => $params->get('ai_api_key', ''),
'ai_model' => $params->get('ai_model', ''),
'ai_tone' => $params->get('ai_tone', 'professional'),
];
$result = AiGeneratorHelper::generate($article->title, $introtext, $category, $tags, $config);
$this->app->setHeader('Content-Type', 'application/json; charset=utf-8');
echo json_encode($result);
$this->app->close();
}
}
@@ -1,52 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\AnalyticsHelper;
class AnalyticsController extends BaseController
{
public function getHeatmapData(): void
{
if (!Session::checkToken('get')) {
echo json_encode(['success' => false, 'error' => 'Invalid token']);
$this->app->close();
return;
}
if (!$this->app->getIdentity()->authorise('core.manage', 'com_mokosuitecross')) {
echo json_encode(['success' => false, 'error' => 'Permission denied']);
$this->app->close();
return;
}
$serviceType = $this->input->getCmd('service_type', '');
$days = $this->input->getInt('days', 90);
$heatmap = AnalyticsHelper::getPostingHeatmap($serviceType, $days);
$bestTimes = AnalyticsHelper::getBestTimes($serviceType, $days);
$this->app->setHeader('Content-Type', 'application/json; charset=utf-8');
echo json_encode([
'success' => true,
'heatmap' => $heatmap,
'best_times' => $bestTimes,
]);
$this->app->close();
}
}
@@ -1,24 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
class CalendarController extends BaseController
{
public function display($cachable = false, $urlparams = []): static
{
return parent::display($cachable, $urlparams);
}
}
@@ -1,86 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\CrossPostDispatcher;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\PreviewHelper;
class PreviewController extends BaseController
{
public function render(): void
{
if (!Session::checkToken('get')) {
echo json_encode(['error' => 'Invalid token']);
$this->app->close();
return;
}
$articleId = $this->input->getInt('article_id', 0);
$platform = $this->input->getCmd('platform', 'twitter');
if ($articleId < 1) {
echo json_encode(['error' => 'Missing article ID']);
$this->app->close();
return;
}
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . $articleId);
$db->setQuery($query);
$article = $db->loadObject();
if (!$article) {
echo json_encode(['error' => 'Article not found']);
$this->app->close();
return;
}
$meta = CrossPostDispatcher::buildArticleMeta($article);
$title = $meta['{title}'] ?? '';
$text = $meta['{introtext}'] ?? '';
$url = $meta['{url}'] ?? '';
$imageUrl = $meta['{image}'] ?? '';
$authorName = $meta['{author}'] ?? '';
$supportedPlatforms = PreviewHelper::getSupportedPlatforms();
$html = '';
if ($platform === 'all') {
foreach ($supportedPlatforms as $p) {
$html .= '<div style="margin-bottom:20px;">'
. '<div style="font-weight:600;font-size:13px;color:#666;margin-bottom:6px;text-transform:uppercase;">' . htmlspecialchars(ucfirst($p)) . '</div>'
. PreviewHelper::render($p, $title, $text, $url, $imageUrl, $authorName)
. '</div>';
}
} else {
$html = PreviewHelper::render($platform, $title, $text, $url, $imageUrl, $authorName);
}
$this->app->setHeader('Content-Type', 'text/html; charset=utf-8');
echo $html;
$this->app->close();
}
}
@@ -1,98 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\SocialImageHelper;
class SocialImageController extends BaseController
{
public function generate(): void
{
if (!Session::checkToken('get')) {
echo json_encode(['success' => false, 'error' => 'Invalid token']);
$this->app->close();
return;
}
$user = $this->app->getIdentity();
if (!$user->authorise('core.manage', 'com_mokosuitecross')) {
echo json_encode(['success' => false, 'error' => 'Permission denied']);
$this->app->close();
return;
}
$articleId = $this->input->getInt('article_id', 0);
if ($articleId < 1) {
echo json_encode(['success' => false, 'error' => 'Missing article ID']);
$this->app->close();
return;
}
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(['id', 'title', 'images']))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . $articleId);
$db->setQuery($query);
$article = $db->loadObject();
if (!$article) {
echo json_encode(['success' => false, 'error' => 'Article not found']);
$this->app->close();
return;
}
$params = ComponentHelper::getParams('com_mokosuitecross');
$siteName = $params->get('social_image_site_name', '') ?: Factory::getApplication()->get('sitename', '');
$options = [
'bg_color' => $params->get('social_image_bg_color', '#1a1a2e'),
'text_color' => $params->get('social_image_text_color', '#ffffff'),
'overlay' => $params->get('social_image_overlay', 'dark'),
];
$backgroundPath = null;
$images = json_decode($article->images ?? '{}', true);
if (!empty($images['image_intro'])) {
$backgroundPath = JPATH_ROOT . '/' . ltrim($images['image_intro'], '/');
} elseif (!empty($images['image_fulltext'])) {
$backgroundPath = JPATH_ROOT . '/' . ltrim($images['image_fulltext'], '/');
}
try {
$imagePath = SocialImageHelper::generate($article->title, $siteName, $backgroundPath, $options);
$imageUrl = str_replace(JPATH_ROOT, Uri::root(true), str_replace('\\', '/', $imagePath));
$result = ['success' => true, 'image_url' => $imageUrl, 'image_path' => $imagePath];
} catch (\Throwable $e) {
$result = ['success' => false, 'error' => $e->getMessage()];
}
$this->app->setHeader('Content-Type', 'application/json; charset=utf-8');
echo json_encode($result);
$this->app->close();
}
}
@@ -1,196 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Helper;
defined('_JEXEC') or die;
class AiGeneratorHelper
{
public static function generate(string $title, string $introtext, string $category, array $tags, array $config): array
{
$provider = $config['ai_provider'] ?? 'none';
$apiKey = $config['ai_api_key'] ?? '';
$model = $config['ai_model'] ?? '';
$tone = $config['ai_tone'] ?? 'professional';
if ($provider === 'none' || $apiKey === '') {
return ['success' => false, 'error' => 'AI provider not configured or API key missing.'];
}
$prompt = self::buildPrompt($title, $introtext, $category, $tags, $tone);
$response = match ($provider) {
'claude' => self::callClaude($prompt, $apiKey, $model ?: 'claude-haiku-4-5'),
'openai' => self::callOpenAI($prompt, $apiKey, $model ?: 'gpt-4o-mini'),
default => '',
};
if ($response === '') {
return ['success' => false, 'error' => 'AI provider returned an empty response.'];
}
$parsed = self::parseResponse($response);
if ($parsed === null) {
return ['success' => false, 'error' => 'Could not parse AI response as JSON.'];
}
return ['success' => true, 'data' => $parsed];
}
private static function callClaude(string $prompt, string $apiKey, string $model): string
{
$payload = json_encode([
'model' => $model,
'max_tokens' => 500,
'messages' => [
['role' => 'user', 'content' => $prompt],
],
]);
$ch = curl_init('https://api.anthropic.com/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'x-api-key: ' . $apiKey,
'anthropic-version: 2023-06-01',
],
]);
$response = curl_exec($ch);
if ($response === false) {
curl_close($ch);
return '';
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode < 200 || $httpCode >= 300) {
return '';
}
$data = json_decode($response, true);
return $data['content'][0]['text'] ?? '';
}
private static function callOpenAI(string $prompt, string $apiKey, string $model): string
{
$payload = json_encode([
'model' => $model,
'max_tokens' => 500,
'messages' => [
['role' => 'user', 'content' => $prompt],
],
]);
$ch = curl_init('https://api.openai.com/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
],
]);
$response = curl_exec($ch);
if ($response === false) {
curl_close($ch);
return '';
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode < 200 || $httpCode >= 300) {
return '';
}
$data = json_decode($response, true);
return $data['choices'][0]['message']['content'] ?? '';
}
private static function buildPrompt(string $title, string $introtext, string $category, array $tags, string $tone): string
{
$tagList = !empty($tags) ? implode(', ', $tags) : 'none';
$toneGuide = match ($tone) {
'casual' => 'Use a relaxed, conversational tone.',
'friendly' => 'Use a warm, approachable tone with enthusiasm.',
default => 'Use a professional, polished tone.',
};
return <<<PROMPT
Generate cross-post captions for this article. {$toneGuide}
Article title: {$title}
Content summary: {$introtext}
Category: {$category}
Tags: {$tagList}
Return ONLY a JSON object with these keys (no markdown, no explanation):
{
"social": "Facebook/LinkedIn post (max 200 chars, include a call to action)",
"short": "Twitter/Bluesky post (max 270 chars, punchy, include 1-2 relevant hashtags)",
"chat": "Telegram/Discord message (max 300 chars, conversational)",
"email_subject": "Email subject line (max 60 chars, compelling, no clickbait)"
}
Rules:
- Do not include the article URL (it is added automatically)
- Do not wrap the JSON in markdown code fences
- Respect the character limits strictly
- Each caption should be unique, not just a reformatted version of the others
PROMPT;
}
private static function parseResponse(string $response): ?array
{
$response = trim($response);
if (preg_match('/\{[\s\S]*\}/', $response, $matches)) {
$response = $matches[0];
}
$data = json_decode($response, true);
if (!\is_array($data)) {
return null;
}
$required = ['social', 'short', 'chat', 'email_subject'];
foreach ($required as $key) {
if (!isset($data[$key]) || !\is_string($data[$key])) {
return null;
}
}
return [
'social' => mb_substr($data['social'], 0, 500),
'short' => mb_substr($data['short'], 0, 280),
'chat' => mb_substr($data['chat'], 0, 500),
'email_subject' => mb_substr($data['email_subject'], 0, 120),
];
}
}
@@ -1,160 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
class AnalyticsHelper
{
private static array $dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
public static function getPostingHeatmap(string $serviceType = '', int $days = 90): array
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('DAYOFWEEK(' . $db->quoteName('p.posted_at') . ') - 1 AS dow')
->select('HOUR(' . $db->quoteName('p.posted_at') . ') AS hr')
->select('COUNT(*) AS cnt')
->from($db->quoteName('#__mokosuitecross_posts', 'p'))
->where($db->quoteName('p.status') . ' = ' . $db->quote('posted'))
->where($db->quoteName('p.posted_at') . ' IS NOT NULL');
if ($days > 0) {
$since = Factory::getDate('now - ' . $days . ' days')->toSql();
$query->where($db->quoteName('p.posted_at') . ' >= ' . $db->quote($since));
}
if ($serviceType !== '') {
$query->join('INNER', $db->quoteName('#__mokosuitecross_services', 's') . ' ON ' . $db->quoteName('s.id') . ' = ' . $db->quoteName('p.service_id'))
->where($db->quoteName('s.service_type') . ' = ' . $db->quote($serviceType));
}
$query->group('dow, hr')
->order('dow ASC, hr ASC');
$db->setQuery($query);
$rows = $db->loadObjectList();
$grid = [];
for ($d = 0; $d < 7; $d++) {
$grid[$d] = array_fill(0, 24, 0);
}
foreach ($rows as $row) {
$grid[(int) $row->dow][(int) $row->hr] = (int) $row->cnt;
}
return $grid;
}
public static function getBestTimes(string $serviceType = '', int $days = 90, int $limit = 5): array
{
$grid = self::getPostingHeatmap($serviceType, $days);
$slots = [];
foreach ($grid as $dow => $hours) {
foreach ($hours as $hour => $count) {
if ($count > 0) {
$slots[] = [
'day' => self::$dayNames[$dow],
'hour' => $hour,
'count' => $count,
'label' => self::$dayNames[$dow] . ' ' . self::formatHour($hour),
];
}
}
}
usort($slots, static fn($a, $b) => $b['count'] <=> $a['count']);
return \array_slice($slots, 0, $limit);
}
public static function getServiceBreakdown(int $days = 30): array
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('s.service_type'))
->select($db->quoteName('s.title', 'service_title'))
->select('COUNT(*) AS total')
->select('SUM(CASE WHEN ' . $db->quoteName('p.status') . ' = ' . $db->quote('posted') . ' THEN 1 ELSE 0 END) AS success')
->select('SUM(CASE WHEN ' . $db->quoteName('p.status') . ' = ' . $db->quote('failed') . ' THEN 1 ELSE 0 END) AS failed')
->from($db->quoteName('#__mokosuitecross_posts', 'p'))
->join('INNER', $db->quoteName('#__mokosuitecross_services', 's') . ' ON ' . $db->quoteName('s.id') . ' = ' . $db->quoteName('p.service_id'));
if ($days > 0) {
$since = Factory::getDate('now - ' . $days . ' days')->toSql();
$query->where($db->quoteName('p.created') . ' >= ' . $db->quote($since));
}
$query->group($db->quoteName(['s.service_type', 's.title']))
->order('total DESC');
$db->setQuery($query);
$rows = $db->loadObjectList();
$result = [];
foreach ($rows as $row) {
$total = (int) $row->total;
$success = (int) $row->success;
$result[] = [
'service_type' => $row->service_type,
'service_title' => $row->service_title,
'total' => $total,
'success' => $success,
'failed' => (int) $row->failed,
'success_rate' => $total > 0 ? round(($success / $total) * 100, 1) : 0.0,
'avg_per_day' => $days > 0 ? round($total / $days, 1) : 0.0,
];
}
return $result;
}
public static function getServiceTypes(): array
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT ' . $db->quoteName('service_type'))
->from($db->quoteName('#__mokosuitecross_services'))
->where($db->quoteName('published') . ' = 1')
->order($db->quoteName('service_type') . ' ASC');
$db->setQuery($query);
return $db->loadColumn() ?: [];
}
private static function formatHour(int $hour): string
{
if ($hour === 0) {
return '12:00 AM';
}
if ($hour < 12) {
return $hour . ':00 AM';
}
if ($hour === 12) {
return '12:00 PM';
}
return ($hour - 12) . ':00 PM';
}
}
@@ -477,16 +477,12 @@ class CrossPostDispatcher
$url = $url . $separator . http_build_query($utmParams);
}
// Link shortening (#159) — shorten the final URL (with UTM if enabled)
$urlShort = LinkShortenerHelper::shorten($url);
return [
'{title}' => $titleText,
'{introtext}' => $introStripped,
'{fulltext}' => strip_tags(mb_substr($article->fulltext ?? '', 0, 500)),
'{url}' => $url,
'{url_raw}' => $urlRaw,
'{url_short}' => $urlShort,
'{image}' => $introImage,
'{category}' => $categoryName,
'{author}' => $authorName,
@@ -1,172 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
/**
* Shortens URLs via Bitly, Rebrandly, or YOURLS.
*
* Returns the original URL on any failure so cross-posts are never broken.
*/
class LinkShortenerHelper
{
/**
* Shorten a URL using the configured provider.
*
* @param string $url The URL to shorten
*
* @return string Shortened URL, or the original on failure/disabled
*/
public static function shorten(string $url): string
{
$params = ComponentHelper::getParams('com_mokosuitecross');
$provider = $params->get('link_shortener', 'none');
if ($provider === 'none' || empty($url)) {
return $url;
}
$apiKey = $params->get('link_shortener_api_key', '');
switch ($provider) {
case 'bitly':
return self::shortenWithBitly($url, $apiKey);
case 'rebrandly':
return self::shortenWithRebrandly($url, $apiKey);
case 'yourls':
$apiUrl = $params->get('link_shortener_yourls_url', '');
$token = $params->get('link_shortener_yourls_token', '');
return self::shortenWithYourls($url, $apiUrl, $token);
default:
return $url;
}
}
/**
* Shorten via Bitly API v4.
*/
public static function shortenWithBitly(string $url, string $apiKey): string
{
if (empty($apiKey)) {
return $url;
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api-ssl.bitly.com/v4/shorten',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['long_url' => $url]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response === false || $httpCode < 200 || $httpCode >= 300) {
return $url;
}
$data = json_decode($response, true);
return $data['link'] ?? $url;
}
/**
* Shorten via Rebrandly API.
*/
public static function shortenWithRebrandly(string $url, string $apiKey, string $workspace = ''): string
{
if (empty($apiKey)) {
return $url;
}
$headers = [
'apikey: ' . $apiKey,
'Content-Type: application/json',
];
if (!empty($workspace)) {
$headers[] = 'workspace: ' . $workspace;
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.rebrandly.com/v1/links',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['destination' => $url]),
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response === false || $httpCode < 200 || $httpCode >= 300) {
return $url;
}
$data = json_decode($response, true);
$short = $data['shortUrl'] ?? '';
return !empty($short) ? 'https://' . ltrim($short, 'https://') : $url;
}
/**
* Shorten via YOURLS API (self-hosted).
*/
public static function shortenWithYourls(string $url, string $apiUrl, string $signatureToken): string
{
if (empty($apiUrl) || empty($signatureToken)) {
return $url;
}
$endpoint = rtrim($apiUrl, '/') . '?' . http_build_query([
'action' => 'shorturl',
'format' => 'json',
'signature' => $signatureToken,
'url' => $url,
]);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $endpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response === false || $httpCode < 200 || $httpCode >= 300) {
return $url;
}
$data = json_decode($response, true);
return $data['shorturl'] ?? $url;
}
}
@@ -1,207 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Helper;
defined('_JEXEC') or die;
class PreviewHelper
{
public static function render(string $platform, string $title, string $text, string $url, string $imageUrl = '', string $authorName = ''): string
{
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
$url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8');
$authorName = htmlspecialchars($authorName, ENT_QUOTES, 'UTF-8');
$imageHtml = '';
if (!empty($imageUrl)) {
$imageUrl = htmlspecialchars($imageUrl, ENT_QUOTES, 'UTF-8');
$imageHtml = '<img src="' . $imageUrl . '" alt="" style="width:100%;max-height:260px;object-fit:cover;border-radius:8px;margin:8px 0;">';
}
return match ($platform) {
'twitter' => self::renderTwitter($title, $text, $url, $imageHtml, $authorName),
'facebook' => self::renderFacebook($title, $text, $url, $imageHtml, $authorName),
'mastodon' => self::renderMastodon($title, $text, $url, $imageHtml, $authorName),
'linkedin' => self::renderLinkedIn($title, $text, $url, $imageHtml, $authorName),
'bluesky' => self::renderBluesky($title, $text, $url, $imageHtml, $authorName),
'telegram' => self::renderTelegram($title, $text, $url, $imageHtml),
default => self::renderGeneric($platform, $title, $text, $url, $imageHtml),
};
}
public static function getSupportedPlatforms(): array
{
return ['twitter', 'facebook', 'mastodon', 'linkedin', 'bluesky', 'telegram'];
}
private static function renderTwitter(string $title, string $text, string $url, string $imageHtml, string $author): string
{
$displayText = !empty($text) ? $text : $title;
$charCount = mb_strlen(strip_tags($displayText));
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #cfd9de;border-radius:16px;padding:12px 16px;background:#fff;">
<div style="display:flex;align-items:center;margin-bottom:8px;">
<div style="width:40px;height:40px;border-radius:50%;background:#1da1f2;margin-right:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:bold;font-size:16px;">X</div>
<div>
<div style="font-weight:700;font-size:15px;color:#0f1419;">{$author}</div>
<div style="color:#536471;font-size:13px;">@username</div>
</div>
</div>
<div style="font-size:15px;line-height:1.4;color:#0f1419;margin-bottom:8px;">{$displayText}</div>
{$imageHtml}
<div style="margin-top:8px;padding:10px 12px;border:1px solid #cfd9de;border-radius:12px;background:#f7f9f9;">
<div style="font-size:13px;color:#536471;margin-bottom:2px;">yoursite.com</div>
<div style="font-size:15px;font-weight:600;color:#0f1419;">{$title}</div>
</div>
<div style="color:#536471;font-size:13px;margin-top:8px;text-align:right;">{$charCount}/280</div>
</div>
HTML;
}
private static function renderFacebook(string $title, string $text, string $url, string $imageHtml, string $author): string
{
$displayText = !empty($text) ? $text : $title;
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #dddfe2;border-radius:8px;background:#fff;overflow:hidden;">
<div style="padding:12px 16px;">
<div style="display:flex;align-items:center;margin-bottom:8px;">
<div style="width:40px;height:40px;border-radius:50%;background:#1877f2;margin-right:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:bold;font-size:18px;">f</div>
<div>
<div style="font-weight:600;font-size:15px;color:#050505;">{$author}</div>
<div style="color:#65676b;font-size:13px;">Just now</div>
</div>
</div>
<div style="font-size:15px;line-height:1.4;color:#050505;">{$displayText}</div>
</div>
{$imageHtml}
<div style="padding:10px 16px;border-top:1px solid #dddfe2;background:#f0f2f5;">
<div style="font-size:12px;color:#65676b;text-transform:uppercase;">yoursite.com</div>
<div style="font-size:16px;font-weight:600;color:#050505;margin-top:2px;">{$title}</div>
</div>
</div>
HTML;
}
private static function renderMastodon(string $title, string $text, string $url, string $imageHtml, string $author): string
{
$displayText = !empty($text) ? $text : $title;
$charCount = mb_strlen(strip_tags($displayText));
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #c0cdd9;border-radius:8px;padding:14px 16px;background:#fff;">
<div style="display:flex;align-items:center;margin-bottom:10px;">
<div style="width:46px;height:46px;border-radius:8px;background:#6364ff;margin-right:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:bold;font-size:20px;">M</div>
<div>
<div style="font-weight:700;font-size:15px;color:#1a1a2e;">{$author}</div>
<div style="color:#606984;font-size:13px;">@user@mastodon.social</div>
</div>
</div>
<div style="font-size:15px;line-height:1.5;color:#1a1a2e;">{$displayText}</div>
{$imageHtml}
<div style="margin-top:8px;padding:10px 12px;border:1px solid #c0cdd9;border-radius:8px;background:#f2f5f7;">
<div style="font-size:14px;font-weight:600;color:#1a1a2e;">{$title}</div>
<div style="font-size:12px;color:#606984;margin-top:2px;">yoursite.com</div>
</div>
<div style="color:#606984;font-size:13px;margin-top:8px;text-align:right;">{$charCount}/500</div>
</div>
HTML;
}
private static function renderLinkedIn(string $title, string $text, string $url, string $imageHtml, string $author): string
{
$displayText = !empty($text) ? $text : $title;
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #e0dfdc;border-radius:8px;background:#fff;overflow:hidden;">
<div style="padding:12px 16px;">
<div style="display:flex;align-items:center;margin-bottom:8px;">
<div style="width:48px;height:48px;border-radius:50%;background:#0a66c2;margin-right:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:bold;font-size:18px;">in</div>
<div>
<div style="font-weight:600;font-size:14px;color:#191919;">{$author}</div>
<div style="color:#666;font-size:12px;">Just now</div>
</div>
</div>
<div style="font-size:14px;line-height:1.4;color:#191919;">{$displayText}</div>
</div>
{$imageHtml}
<div style="padding:8px 16px 12px;border-top:1px solid #e0dfdc;background:#f9fafb;">
<div style="font-size:14px;font-weight:600;color:#191919;">{$title}</div>
<div style="font-size:12px;color:#666;margin-top:2px;">yoursite.com</div>
</div>
</div>
HTML;
}
private static function renderBluesky(string $title, string $text, string $url, string $imageHtml, string $author): string
{
$displayText = !empty($text) ? $text : $title;
$charCount = mb_strlen(strip_tags($displayText));
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #d1d5db;border-radius:12px;padding:12px 16px;background:#fff;">
<div style="display:flex;align-items:center;margin-bottom:8px;">
<div style="width:42px;height:42px;border-radius:50%;background:#0085ff;margin-right:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:bold;font-size:16px;">B</div>
<div>
<div style="font-weight:600;font-size:15px;color:#1e2937;">{$author}</div>
<div style="color:#6b7280;font-size:13px;">@user.bsky.social</div>
</div>
</div>
<div style="font-size:15px;line-height:1.4;color:#1e2937;">{$displayText}</div>
{$imageHtml}
<div style="margin-top:8px;padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;background:#f9fafb;">
<div style="font-size:14px;font-weight:600;color:#1e2937;">{$title}</div>
<div style="font-size:12px;color:#6b7280;margin-top:2px;">yoursite.com</div>
</div>
<div style="color:#6b7280;font-size:13px;margin-top:8px;text-align:right;">{$charCount}/300</div>
</div>
HTML;
}
private static function renderTelegram(string $title, string $text, string $url, string $imageHtml): string
{
$displayText = !empty($text) ? $text : $title;
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;background:#effdde;border-radius:12px;padding:10px 14px;margin-left:60px;">
{$imageHtml}
<div style="font-size:15px;line-height:1.4;color:#000;">{$displayText}</div>
<div style="margin-top:8px;padding:8px 12px;border-left:3px solid #4fae4e;background:#fff;border-radius:0 8px 8px 0;">
<div style="font-size:14px;font-weight:600;color:#000;">{$title}</div>
<div style="font-size:12px;color:#888;margin-top:2px;">yoursite.com</div>
</div>
<div style="color:#5fb452;font-size:11px;text-align:right;margin-top:4px;">Just now</div>
</div>
HTML;
}
private static function renderGeneric(string $platform, string $title, string $text, string $url, string $imageHtml): string
{
$platformLabel = htmlspecialchars(ucfirst($platform), ENT_QUOTES, 'UTF-8');
$displayText = !empty($text) ? $text : $title;
return <<<HTML
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;max-width:500px;border:1px solid #ddd;border-radius:8px;padding:12px 16px;background:#fff;">
<div style="font-weight:600;font-size:13px;color:#666;margin-bottom:8px;text-transform:uppercase;">{$platformLabel}</div>
<div style="font-size:15px;line-height:1.4;color:#333;">{$displayText}</div>
{$imageHtml}
<div style="margin-top:8px;padding:8px 12px;border:1px solid #ddd;border-radius:6px;background:#f9f9f9;">
<div style="font-size:14px;font-weight:600;color:#333;">{$title}</div>
<div style="font-size:12px;color:#999;">yoursite.com</div>
</div>
</div>
HTML;
}
}
@@ -1,207 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Helper;
defined('_JEXEC') or die;
class SocialImageHelper
{
private const WIDTH = 1200;
private const HEIGHT = 630;
/**
* Generate a branded social/OG image with text overlay.
*
* @param string $title Article title to render on the image
* @param string $siteName Site name for branding watermark
* @param array $config Rendering config: bg_color, text_color, font_size, show_site_name
*
* @return array ['success' => bool, 'image_url' => string, 'error' => string]
*/
public static function generate(string $title, string $siteName, array $config): array
{
if (!\function_exists('imagecreatetruecolor')) {
return ['success' => false, 'error' => 'PHP GD extension is not available'];
}
$bgColor = $config['bg_color'] ?? '#1a1a2e';
$textColor = $config['text_color'] ?? '#ffffff';
$fontSize = (int) ($config['font_size'] ?? 48);
$showSiteName = (bool) ($config['show_site_name'] ?? true);
$fontSize = max(24, min(96, $fontSize));
$image = imagecreatetruecolor(self::WIDTH, self::HEIGHT);
if ($image === false) {
return ['success' => false, 'error' => 'Failed to create image canvas'];
}
$bgRgb = self::hexToRgb($bgColor);
$textRgb = self::hexToRgb($textColor);
$bg = imagecolorallocate($image, $bgRgb[0], $bgRgb[1], $bgRgb[2]);
$text = imagecolorallocate($image, $textRgb[0], $textRgb[1], $textRgb[2]);
imagefilledrectangle($image, 0, 0, self::WIDTH - 1, self::HEIGHT - 1, $bg);
$fontFile = self::findFont();
if ($fontFile !== null) {
self::renderTtfText($image, $title, $text, $fontSize, $fontFile);
if ($showSiteName && $siteName !== '') {
$siteSize = (int) round($fontSize * 0.45);
$siteBox = imagettfbbox($siteSize, 0, $fontFile, $siteName);
$siteX = self::WIDTH - ($siteBox[2] - $siteBox[0]) - 40;
$siteY = self::HEIGHT - 30;
imagettftext($image, $siteSize, 0, $siteX, $siteY, $text, $fontFile, $siteName);
}
} else {
self::renderFallbackText($image, $title, $text);
if ($showSiteName && $siteName !== '') {
$siteX = self::WIDTH - (\strlen($siteName) * imagefontwidth(3)) - 40;
$siteY = self::HEIGHT - 30;
imagestring($image, 3, $siteX, $siteY, $siteName, $text);
}
}
$outputDir = JPATH_ROOT . '/media/com_mokosuitecross/social';
if (!is_dir($outputDir)) {
mkdir($outputDir, 0755, true);
}
$hash = hash('sha256', $title . $bgColor . $textColor . $fontSize);
$filename = $hash . '.png';
$filePath = $outputDir . '/' . $filename;
if (!imagepng($image, $filePath, 6)) {
imagedestroy($image);
return ['success' => false, 'error' => 'Failed to save image file'];
}
imagedestroy($image);
$imageUrl = 'media/com_mokosuitecross/social/' . $filename;
return ['success' => true, 'image_url' => $imageUrl];
}
private static function renderTtfText(\GdImage $image, string $title, int $color, int $fontSize, string $fontFile): void
{
$maxWidth = self::WIDTH - 120;
$lines = self::wordWrapTtf($title, $fontFile, $fontSize, $maxWidth);
$lineHeight = (int) round($fontSize * 1.4);
$totalHeight = \count($lines) * $lineHeight;
$startY = (int) round((self::HEIGHT - $totalHeight) / 2) + $fontSize;
foreach ($lines as $i => $line) {
$y = $startY + ($i * $lineHeight);
imagettftext($image, $fontSize, 0, 60, $y, $color, $fontFile, $line);
}
}
private static function renderFallbackText(\GdImage $image, string $title, int $color): void
{
$font = 5;
$charWidth = imagefontwidth($font);
$charHeight = imagefontheight($font);
$maxChars = (int) floor((self::WIDTH - 120) / $charWidth);
$lines = wordwrap($title, $maxChars, "\n", true);
$lineArray = explode("\n", $lines);
$lineHeight = $charHeight + 8;
$totalHeight = \count($lineArray) * $lineHeight;
$startY = (int) round((self::HEIGHT - $totalHeight) / 2);
foreach ($lineArray as $i => $line) {
$y = $startY + ($i * $lineHeight);
imagestring($image, $font, 60, $y, $line, $color);
}
}
/**
* Word-wrap text for TTF rendering at a given pixel width.
*
* @return string[]
*/
private static function wordWrapTtf(string $text, string $fontFile, int $fontSize, int $maxWidth): array
{
$words = explode(' ', $text);
$lines = [];
$currentLine = '';
foreach ($words as $word) {
$testLine = $currentLine === '' ? $word : $currentLine . ' ' . $word;
$box = imagettfbbox($fontSize, 0, $fontFile, $testLine);
$width = abs($box[2] - $box[0]);
if ($width > $maxWidth && $currentLine !== '') {
$lines[] = $currentLine;
$currentLine = $word;
} else {
$currentLine = $testLine;
}
}
if ($currentLine !== '') {
$lines[] = $currentLine;
}
return $lines ?: [$text];
}
/**
* Locate a usable TTF font file -- check common system locations.
*/
private static function findFont(): ?string
{
$candidates = [
JPATH_ROOT . '/media/com_mokosuitecross/fonts/OpenSans-Bold.ttf',
JPATH_ROOT . '/media/com_mokosuitecross/fonts/Roboto-Bold.ttf',
'/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf',
'/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf',
'/usr/share/fonts/TTF/DejaVuSans-Bold.ttf',
'C:/Windows/Fonts/arial.ttf',
'C:/Windows/Fonts/segoeui.ttf',
];
foreach ($candidates as $path) {
if (is_file($path)) {
return $path;
}
}
return null;
}
/**
* @return int[] [r, g, b]
*/
private static function hexToRgb(string $hex): array
{
$hex = ltrim($hex, '#');
if (\strlen($hex) === 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
return [
(int) hexdec(substr($hex, 0, 2)),
(int) hexdec(substr($hex, 2, 2)),
(int) hexdec(substr($hex, 4, 2)),
];
}
}
@@ -1,67 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\Model;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
class CalendarModel extends BaseDatabaseModel
{
/**
* Get cross-post events for a given month, grouped by date.
*
* @param int $year Four-digit year
* @param int $month Month number (1-12)
*
* @return array Associative array keyed by Y-m-d, each value an array of event objects
*/
public function getEvents(int $year, int $month): array
{
$db = $this->getDatabase();
$firstDay = sprintf('%04d-%02d-01', $year, $month);
$lastDay = date('Y-m-t', strtotime($firstDay));
$dateExpr = 'COALESCE('
. $db->quoteName('p.scheduled_at') . ', '
. $db->quoteName('p.posted_at') . ', '
. $db->quoteName('p.created') . ')';
$query = $db->getQuery(true)
->select([
'DATE(' . $dateExpr . ') AS event_date',
$db->quoteName('p.status'),
$db->quoteName('s.service_type'),
$db->quoteName('c.title', 'article_title'),
])
->from($db->quoteName('#__mokosuitecross_posts', 'p'))
->join('LEFT', $db->quoteName('#__mokosuitecross_services', 's')
. ' ON ' . $db->quoteName('s.id') . ' = ' . $db->quoteName('p.service_id'))
->join('LEFT', $db->quoteName('#__content', 'c')
. ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('p.article_id'))
->where('DATE(' . $dateExpr . ') >= ' . $db->quote($firstDay))
->where('DATE(' . $dateExpr . ') <= ' . $db->quote($lastDay))
->order('DATE(' . $dateExpr . ') ASC, ' . $db->quoteName('p.created') . ' ASC');
$db->setQuery($query);
$rows = $db->loadObjectList() ?: [];
$grouped = [];
foreach ($rows as $row) {
$grouped[$row->event_date][] = $row;
}
return $grouped;
}
}
@@ -1,63 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\View\Analytics;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\AnalyticsHelper;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\MokoSuiteCrossHelper;
class HtmlView extends BaseHtmlView
{
public array $heatmap = [];
public array $bestTimes = [];
public array $serviceBreakdown = [];
public array $serviceTypes = [];
public string $serviceFilter = '';
public int $days = 90;
public function display($tpl = null): void
{
$input = Factory::getApplication()->input;
$this->serviceFilter = $input->getCmd('service_type', '');
$this->days = $input->getInt('days', 90);
$this->heatmap = AnalyticsHelper::getPostingHeatmap($this->serviceFilter, $this->days);
$this->bestTimes = AnalyticsHelper::getBestTimes($this->serviceFilter, $this->days);
$this->serviceBreakdown = AnalyticsHelper::getServiceBreakdown($this->days);
$this->serviceTypes = AnalyticsHelper::getServiceTypes();
$this->addToolbar();
MokoSuiteCrossHelper::addSubmenu('analytics');
parent::display($tpl);
}
protected function addToolbar(): void
{
ToolbarHelper::title('MokoSuiteCross -- Posting Analytics', 'chart');
$toolbar = Toolbar::getInstance('toolbar');
$toolbar->appendButton(
'Link',
'home',
'COM_MOKOSUITECROSS_SUBMENU_DASHBOARD',
Route::_('index.php?option=com_mokosuitecross&view=dashboard', false)
);
}
}
@@ -1,65 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\View\Calendar;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\MokoSuiteCrossHelper;
class HtmlView extends BaseHtmlView
{
public int $year;
public int $month;
public array $events;
public $sidebar;
public function display($tpl = null): void
{
$input = Factory::getApplication()->input;
$this->year = $input->getInt('year', (int) date('Y'));
$this->month = $input->getInt('month', (int) date('n'));
if ($this->month < 1 || $this->month > 12) {
$this->month = (int) date('n');
}
if ($this->year < 2000 || $this->year > 2100) {
$this->year = (int) date('Y');
}
$model = $this->getModel();
$this->events = $model->getEvents($this->year, $this->month);
$this->addToolbar();
MokoSuiteCrossHelper::addSubmenu('calendar');
$this->sidebar = \Joomla\CMS\HTML\Sidebar::render();
parent::display($tpl);
}
protected function addToolbar(): void
{
$canDo = MokoSuiteCrossHelper::getActions();
ToolbarHelper::title('MokoSuiteCross -- Post Calendar', 'calendar');
ToolbarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_mokosuitecross&view=dashboard');
if ($canDo->get('core.admin')) {
ToolbarHelper::preferences('com_mokosuitecross');
}
}
}
@@ -1,231 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\MokoSuiteCross\Administrator\View\Analytics\HtmlView $this */
$dayNames = [
1 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_SUN'),
2 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_MON'),
3 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_TUE'),
4 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_WED'),
5 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_THU'),
6 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_FRI'),
7 => Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAY_SAT'),
];
?>
<form method="get" class="mb-3">
<input type="hidden" name="option" value="com_mokosuitecross" />
<input type="hidden" name="view" value="analytics" />
<div class="row g-2 align-items-end">
<div class="col-auto">
<label class="form-label" for="analytics-period"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_PERIOD'); ?></label>
<select name="period" id="analytics-period" class="form-select" onchange="this.form.submit();">
<option value="7" <?php echo $this->period == 7 ? 'selected' : ''; ?>><?php echo Text::_('COM_MOKOSUITECROSS_PERIOD_7_DAYS'); ?></option>
<option value="30" <?php echo $this->period == 30 ? 'selected' : ''; ?>><?php echo Text::_('COM_MOKOSUITECROSS_PERIOD_30_DAYS'); ?></option>
<option value="90" <?php echo $this->period == 90 ? 'selected' : ''; ?>><?php echo Text::_('COM_MOKOSUITECROSS_PERIOD_90_DAYS'); ?></option>
<option value="180" <?php echo $this->period == 180 ? 'selected' : ''; ?>><?php echo Text::_('COM_MOKOSUITECROSS_PERIOD_180_DAYS'); ?></option>
<option value="365" <?php echo $this->period == 365 ? 'selected' : ''; ?>><?php echo Text::_('COM_MOKOSUITECROSS_PERIOD_365_DAYS'); ?></option>
</select>
</div>
<div class="col-auto">
<label class="form-label" for="analytics-service"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_SERVICE_FILTER'); ?></label>
<select name="service_id" id="analytics-service" class="form-select" onchange="this.form.submit();">
<option value="0"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_ALL_SERVICES'); ?></option>
<?php foreach ($this->services as $svc) : ?>
<option value="<?php echo (int) $svc['id']; ?>" <?php echo $this->serviceId == $svc['id'] ? 'selected' : ''; ?>>
<?php echo htmlspecialchars($svc['title'] . ' (' . ucfirst($svc['service_type']) . ')'); ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
</form>
<?php if (!empty($this->bestTimes)) : ?>
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title mb-0"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_BEST_TIMES'); ?></h5>
</div>
<div class="card-body">
<div class="row">
<?php foreach ($this->bestTimes as $bt) :
$rate = (int) $bt['total'] > 0 ? round(((int) $bt['success'] / (int) $bt['total']) * 100) : 0;
?>
<div class="col-sm-6 col-md-4 col-lg mb-2">
<div class="border rounded p-3 text-center h-100">
<div class="fw-bold text-primary"><?php echo $dayNames[(int) $bt['dow']]; ?></div>
<div class="display-6"><?php echo sprintf('%02d:00', (int) $bt['hour_of_day']); ?></div>
<div class="text-muted small">
<?php echo Text::sprintf('COM_MOKOSUITECROSS_ANALYTICS_POSTS_SUCCESS', (int) $bt['success'], (int) $bt['total']); ?>
</div>
<span class="badge bg-success"><?php echo $rate; ?>%</span>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php else : ?>
<div class="alert alert-info mb-3">
<?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_NO_DATA'); ?>
</div>
<?php endif; ?>
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title mb-0"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_HEATMAP'); ?></h5>
</div>
<div class="card-body" style="overflow-x: auto;">
<table class="table table-sm table-bordered text-center mb-0" style="min-width: 700px;">
<thead>
<tr>
<th></th>
<?php for ($h = 0; $h < 24; $h++) : ?>
<th class="small" style="width: 3.8%;"><?php echo sprintf('%02d', $h); ?></th>
<?php endfor; ?>
</tr>
</thead>
<tbody>
<?php
$maxTotal = 1;
foreach ($this->heatmap as $dayData) {
foreach ($dayData as $cell) {
if ($cell['total'] > $maxTotal) {
$maxTotal = $cell['total'];
}
}
}
foreach ($this->heatmap as $dow => $hours) : ?>
<tr>
<th class="text-nowrap small"><?php echo $dayNames[$dow]; ?></th>
<?php foreach ($hours as $hour => $cell) :
$intensity = $maxTotal > 0 ? $cell['total'] / $maxTotal : 0;
$r = $g = $b = 255;
if ($cell['total'] > 0) {
$rate = $cell['rate'];
if ($rate >= 80) {
$r = (int) (255 - (155 * $intensity));
$g = (int) (255 - (100 * $intensity));
$b = (int) (255 - (155 * $intensity));
} elseif ($rate >= 50) {
$r = (int) (255 - (50 * $intensity));
$g = (int) (255 - (50 * $intensity));
$b = (int) (255 - (200 * $intensity));
} else {
$r = (int) (255 - (35 * $intensity));
$g = (int) (255 - (200 * $intensity));
$b = (int) (255 - (200 * $intensity));
}
}
?>
<td style="background: rgb(<?php echo "$r,$g,$b"; ?>); cursor: default;"
title="<?php echo $dayNames[$dow] . ' ' . sprintf('%02d:00', $hour) . ': ' . $cell['total'] . ' posts, ' . $cell['success'] . ' success (' . $cell['rate'] . '%)'; ?>">
<?php if ($cell['total'] > 0) : ?>
<small><?php echo $cell['total']; ?></small>
<?php endif; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="d-flex justify-content-center gap-3 mt-2 small text-muted">
<span><span style="display: inline-block; width: 12px; height: 12px; background: rgb(100,155,100); border: 1px solid #ccc;"></span> <?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_LEGEND_HIGH'); ?></span>
<span><span style="display: inline-block; width: 12px; height: 12px; background: rgb(205,205,55); border: 1px solid #ccc;"></span> <?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_LEGEND_MEDIUM'); ?></span>
<span><span style="display: inline-block; width: 12px; height: 12px; background: rgb(220,55,55); border: 1px solid #ccc;"></span> <?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_LEGEND_LOW'); ?></span>
<span><span style="display: inline-block; width: 12px; height: 12px; background: rgb(255,255,255); border: 1px solid #ccc;"></span> <?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_LEGEND_NONE'); ?></span>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title mb-0"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_HOURLY'); ?></h5>
</div>
<div class="card-body">
<canvas id="hourlyChart" height="200"></canvas>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title mb-0"><?php echo Text::_('COM_MOKOSUITECROSS_ANALYTICS_DAILY'); ?></h5>
</div>
<div class="card-body">
<canvas id="dayChart" height="200"></canvas>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js" integrity="sha384-UPIssOjNMqMfON6mDKHvO4sOY4hhxN1ymYcfl2MrDz69idMU/L3MNFlyJGlIRjQH" crossorigin="anonymous"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var hourlyData = <?php echo json_encode(array_values($this->hourlyDistribution)); ?>;
var hourLabels = [], hourSuccess = [], hourFailed = [];
for (var h = 0; h < 24; h++) {
hourLabels.push(('0' + h).slice(-2) + ':00');
var found = hourlyData.find(function(d) { return parseInt(d.hour_of_day, 10) === h; });
hourSuccess.push(found ? parseInt(found.success, 10) : 0);
hourFailed.push(found ? parseInt(found.failed, 10) : 0);
}
new Chart(document.getElementById('hourlyChart'), {
type: 'bar',
data: {
labels: hourLabels,
datasets: [
{ label: '<?php echo Text::_("COM_MOKOSUITECROSS_DASHBOARD_POSTED", true); ?>', data: hourSuccess, backgroundColor: 'rgba(25,135,84,0.7)' },
{ label: '<?php echo Text::_("COM_MOKOSUITECROSS_DASHBOARD_FAILED", true); ?>', data: hourFailed, backgroundColor: 'rgba(220,53,69,0.7)' }
]
},
options: {
responsive: true,
scales: { x: { stacked: true }, y: { stacked: true, beginAtZero: true, ticks: { stepSize: 1 } } },
plugins: { legend: { position: 'bottom' } }
}
});
var dayData = <?php echo json_encode(array_values($this->dayDistribution)); ?>;
var dayLabels = <?php echo json_encode(array_values($dayNames)); ?>;
var daySuccess = [], dayFailed = [];
for (var d = 1; d <= 7; d++) {
var found = dayData.find(function(r) { return parseInt(r.dow, 10) === d; });
daySuccess.push(found ? parseInt(found.success, 10) : 0);
dayFailed.push(found ? parseInt(found.failed, 10) : 0);
}
new Chart(document.getElementById('dayChart'), {
type: 'bar',
data: {
labels: dayLabels,
datasets: [
{ label: '<?php echo Text::_("COM_MOKOSUITECROSS_DASHBOARD_POSTED", true); ?>', data: daySuccess, backgroundColor: 'rgba(25,135,84,0.7)' },
{ label: '<?php echo Text::_("COM_MOKOSUITECROSS_DASHBOARD_FAILED", true); ?>', data: dayFailed, backgroundColor: 'rgba(220,53,69,0.7)' }
]
},
options: {
responsive: true,
scales: { x: { stacked: true }, y: { stacked: true, beginAtZero: true, ticks: { stepSize: 1 } } },
plugins: { legend: { position: 'bottom' } }
}
});
});
</script>
@@ -1,129 +0,0 @@
<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \Joomla\Component\MokoSuiteCross\Administrator\View\Calendar\HtmlView $this */
$year = $this->year;
$month = $this->month;
$events = $this->events;
$today = date('Y-m-d');
$prevMonth = $month - 1;
$prevYear = $year;
if ($prevMonth < 1) {
$prevMonth = 12;
$prevYear--;
}
$nextMonth = $month + 1;
$nextYear = $year;
if ($nextMonth > 12) {
$nextMonth = 1;
$nextYear++;
}
$monthName = date('F', mktime(0, 0, 0, $month, 1, $year));
$daysInMonth = (int) date('t', mktime(0, 0, 0, $month, 1, $year));
$firstWeekday = ((int) date('N', mktime(0, 0, 0, $month, 1, $year))) - 1;
$statusClass = static function (string $status): string {
return match ($status) {
'posted' => 'bg-success',
'failed' => 'bg-danger',
default => 'bg-warning text-dark',
};
};
?>
<div class="d-flex justify-content-between align-items-center mb-3">
<a href="<?php echo Route::_('index.php?option=com_mokosuitecross&view=calendar&year=' . $prevYear . '&month=' . $prevMonth); ?>"
class="btn btn-outline-secondary btn-sm">
<span class="icon-chevron-left" aria-hidden="true"></span>
<?php echo Text::_('COM_MOKOSUITECROSS_CALENDAR_PREV_MONTH'); ?>
</a>
<h3 class="mb-0"><?php echo htmlspecialchars($monthName . ' ' . $year); ?></h3>
<a href="<?php echo Route::_('index.php?option=com_mokosuitecross&view=calendar&year=' . $nextYear . '&month=' . $nextMonth); ?>"
class="btn btn-outline-secondary btn-sm">
<?php echo Text::_('COM_MOKOSUITECROSS_CALENDAR_NEXT_MONTH'); ?>
<span class="icon-chevron-right" aria-hidden="true"></span>
</a>
</div>
<div class="table-responsive">
<table class="table table-bordered">
<thead class="table-light">
<tr>
<th style="width:14.28%"><?php echo Text::_('MON'); ?></th>
<th style="width:14.28%"><?php echo Text::_('TUE'); ?></th>
<th style="width:14.28%"><?php echo Text::_('WED'); ?></th>
<th style="width:14.28%"><?php echo Text::_('THU'); ?></th>
<th style="width:14.28%"><?php echo Text::_('FRI'); ?></th>
<th style="width:14.28%"><?php echo Text::_('SAT'); ?></th>
<th style="width:14.28%"><?php echo Text::_('SUN'); ?></th>
</tr>
</thead>
<tbody>
<?php
$day = 1;
$started = false;
while ($day <= $daysInMonth) : ?>
<tr>
<?php for ($col = 0; $col < 7; $col++) :
if (!$started && $col < $firstWeekday) : ?>
<td class="text-muted bg-light">&nbsp;</td>
<?php
continue;
endif;
$started = true;
if ($day > $daysInMonth) : ?>
<td class="text-muted bg-light">&nbsp;</td>
<?php
continue;
endif;
$dateKey = sprintf('%04d-%02d-%02d', $year, $month, $day);
$isToday = ($dateKey === $today);
$cellClass = $isToday ? 'border border-primary border-2 bg-primary bg-opacity-10' : '';
$dayEvents = $events[$dateKey] ?? [];
?>
<td class="<?php echo $cellClass; ?>" style="vertical-align: top; min-height: 80px;">
<div class="fw-bold mb-1<?php echo $isToday ? ' text-primary' : ''; ?>">
<?php echo $day; ?>
<?php if ($isToday) : ?>
<small class="text-primary"><?php echo Text::_('COM_MOKOSUITECROSS_CALENDAR_TODAY'); ?></small>
<?php endif; ?>
</div>
<?php foreach ($dayEvents as $event) : ?>
<span class="badge <?php echo $statusClass($event->status); ?> mb-1 d-block text-truncate" style="max-width: 100%;"
title="<?php echo htmlspecialchars(ucfirst($event->service_type) . ': ' . $event->article_title . ' (' . $event->status . ')'); ?>">
<?php echo htmlspecialchars(ucfirst($event->service_type)); ?>:
<?php echo htmlspecialchars(mb_substr($event->article_title, 0, 20)); ?>
</span>
<?php endforeach; ?>
</td>
<?php
$day++;
endfor; ?>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
@@ -31,6 +31,3 @@ PLG_CONTENT_MOKOSUITECROSS_SHARE_IMAGE_CUSTOM="Custom Image"
PLG_CONTENT_MOKOSUITECROSS_SHARE_IMAGE_NONE="No Image"
PLG_CONTENT_MOKOSUITECROSS_CUSTOM_IMAGE="Custom Share Image"
PLG_CONTENT_MOKOSUITECROSS_CUSTOM_IMAGE_DESC="Select an image from the media manager to use for cross-posting."
PLG_CONTENT_MOKOSUITECROSS_FIELDSET_PREVIEW="Social Preview"
PLG_CONTENT_MOKOSUITECROSS_PREVIEW="Preview Post"
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="content" method="upgrade">
<name>Content - MokoSuiteCross</name>
<version>01.08.56</version>
<version>01.08.00</version>
<creationDate>2026-05-28</creationDate>
<author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail>

Some files were not shown because too many files have changed in this diff Show More