This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
SEO Panel is an open-source SEO control panel for managing search engine optimization of multiple websites. It's a PHP-based web application using MySQL for data storage and includes a plugin architecture for extensibility.
Version: 5.0.0
The application follows a custom MVC-like pattern:
- Entry Points: Root-level PHP files (e.g.,
websites.php,keywords.php,rank.php) serve as entry points for different sections - Controllers: Located in
controllers/*.ctrl.php, all extend the baseControllerclass fromlibs/controller.class.php - Views: Located in
themes/{theme_name}/views/, using.ctp.phpextension (CakePHP-style) - Models: Database interaction is handled directly in controllers using the
Databaseclass
- Entry point includes
includes/sp-load.php sp-load.phploads configuration fromconfig/sp-config.php- Defines path constants (SP_ABSPATH, SP_CTRLPATH, SP_LIBPATH, etc.)
- Establishes database connection
- Loads system settings from database into constants
- Sets timezone and theme paths
- Applies SQL injection prevention filters
- Creates
Seopanelsuperclass instance
- Controller (
libs/controller.class.php): Base class for all controllers- Provides database access via
$this->db - View rendering via
$this->render() - Session management via
$this->session - Validation via
$this->validate - Spider/crawler via
$this->spider
- Provides database access via
- Database (
libs/database.class.php): Database abstraction layer - View (
libs/view.class.php): Template rendering - Spider (
libs/spider.class.php): Web crawling and content fetching - Seopanel (
libs/seopanel.class.php): Core application logic
Plugins are self-contained modules in plugins/{PluginName}/:
- Main controller:
{PluginName}.ctrl.php - Configuration:
conf.php - Views:
themes/{theme_name}/views/ - Assets:
js/,css/
Active plugins:
- ArticleSubmitter: Article submission and spinning
- QuickWebProxy: Web proxy functionality
- SeoDiary: SEO diary/notes
- MetaTagGenerator: Meta tag generation tools
Controllers follow a strict naming pattern:
- File:
{name}.ctrl.php(e.g.,website.ctrl.php) - Class:
{Name}ControllerextendsController(e.g.,class WebsiteController extends Controller) - Methods starting with
__are internal/helper methods (e.g.,__getAllWebsites())
Start XAMPP/LAMP stack:
sudo /opt/lampp/lampp startAccess in browser: http://localhost/sp
Configuration in config/sp-config.php:
- Database:
seopanel - Default user:
root - Password: (empty)
- Host:
localhost
Execute cron job manually:
php /opt/lampp/htdocs/sp/cron.phpExecute for specific user:
php /opt/lampp/htdocs/sp/cron.php [user_id]Execute for specific user and SEO tool:
php /opt/lampp/htdocs/sp/cron.php [user_id] [seo_tool_id]Other cron scripts:
directorycheckercron.php- Directory submission checkersiteauditorcron.php- Site auditorproxycheckercron.php- Proxy checker
Main branch: develop
Current branch: google_search_fix_sp4_12_0
Defined in includes/sp-load.php:
SP_ABSPATH- Absolute filesystem pathSP_WEBPATH- Web URL path (from config)SP_CTRLPATH- Controllers directorySP_LIBPATH- Libraries directorySP_TMPPATH- Temporary filesSP_PLUGINPATH- Plugins directorySP_THEMEPATH- Themes directorySP_VIEWPATH- Active theme viewsSP_CSSPATH- Active theme CSSSP_JSPATH- JavaScript pathSP_IMGPATH- Images path
Set in config/sp-config.php:
DB_NAME- Database nameDB_USER- Database userDB_PASSWORD- Database passwordDB_HOST- Database hostDB_ENGINE- Database engine (mysql)SP_DEBUG- Debug mode (1 = on)SP_TIMEOUT- Session timeout in secondsSP_INSTALLED- Installed version
- SQL injection prevention enabled via
SP_PREVENT_SQL_INJECTION - Input sanitization in
sp-load.php(lines 125-151) - Session-based authentication with timeout
- Admin role checking via
isAdmin()andcheckAdminLoggedIn()
- Keyword Position Checker (
rank.php,controllers/rank.ctrl.php) - Backlinks Checker (
backlinks.php,controllers/backlink.ctrl.php) - Site Auditor (
siteauditor.php,controllers/siteauditor.ctrl.php) - Moz Rank Checker (
moz.php,controllers/moz.ctrl.php) - Search Engine Saturation (
saturationchecker.php,controllers/saturationchecker.ctrl.php) - Google Analytics Integration (
analytics.php,controllers/analytics.ctrl.php) - Webmaster Tools (
webmaster-tools.php,controllers/webmaster.ctrl.php) - Social Media (
social_media.php,controllers/social_media.ctrl.php) - Review Manager (
review.php,controllers/review_manager.ctrl.php)
Core entities:
- websites - Managed websites
- keywords - Keywords tracked per website
- users - User accounts
- searchengines - Search engines for rank checking
- settings - System configuration (loaded as constants)
- rankresults - Keyword ranking results
- backlinkresults - Backlink check results
- saturationresults - Saturation check results
Located in libs/:
- Google API Client (
google-api-php-client/) - For Analytics and Search Console - SendGrid (
sendgrid-php/) - Email sending - mPDF (
mpdf_lib/) - PDF generation - DataForSEO (
dataforseo/) - SEO data API - pChart (
pchart.class.php) - Chart generation
- Create
controllers/{name}.ctrl.php - Define class:
class {Name}Controller extends Controller {} - Create corresponding entry point:
{name}.php - Entry point should include
sp-load.phpand the controller - Add views in
themes/classic/views/{name}/
Use the database helper:
// Select
$list = $this->db->select($sql);
$single = $this->db->select($sql, true);
// Insert/Update/Delete
$this->db->query($sql);
// Helper methods
$this->dbHelper->getAllRows('table_name', 'where_condition');
$this->dbHelper->getRow('table_name', 'where_condition');
$this->dbHelper->insertRow('table_name', $dataArray);
$this->dbHelper->updateRow('table_name', $dataArray, 'where_condition');// Set variables for view
$this->set('variableName', $value);
// Render with default layout
$this->render('viewname');
// Render without layout
$this->render('viewname', '');
// Plugin render
$this->pluginRender('viewname');Text translations stored in texts table:
// Get language texts
$texts = $this->getLanguageTexts('category', 'lang_code');
// Access in view
$_SESSION['text']['common']['Label']
$_SESSION['text']['label']['Label']// Check if logged in
$userId = isLoggedIn();
// Check admin
if (isAdmin()) { }
// Require admin
checkAdminLoggedIn();Components are reusable controllers in controllers/components/:
$component = $this->createComponent('ComponentName');$spider = New Spider();
$result = $spider->getContent($url);
if (!empty($result['page'])) {
// Process $result['page']
}includes/sp-load.php- Bootstrap file, included by all entry pointsincludes/sp-common.php- Common helper functionsconfig/sp-config.php- Main configuration (database, paths, version)libs/controller.class.php- Base controller classlibs/database.class.php- Database abstractionlibs/validation.class.php- Form validationlibs/spider.class.php- Web crawling functionality
Standard installation:
- Upload files to web directory
- Set
config/sp-config.phppermissions to 666 - Set
tmp/directory to 777 - Run
install/index.phpin browser - After install, set
config/sp-config.phpto 644 - Remove
install/directory
Docker installation available via docker-compose.yml
API endpoints in api/ directory:
- REST-style API for external integrations
- Managed through
controllers/api.ctrl.php - User tokens in
user_tokentable
Based on git status, currently working on:
- Branch:
google_search_fix_sp4_12_0 - Modified:
config/sp-config.php - Recent commits focus on search engine configuration and DataForSEO integration