/** * This action will list all the plugins which are available on the system. */ function action_admin_modules() { $moduleManager =& YDSimpleCMS::getModuleManager(); $this->tpl->assign('modules', $moduleManager->getModuleList()); $this->display(); }
<?php // Include the CMS App module include_once dirname(__FILE__) . '/includes/YDSimpleCMSApp.php'; // Run the CMS request YDSimpleCMS::runAdminRequest();
/** * This function will run the specified module and action in the indicated scope. * * @attention * This function should only be called after the loadAllModules function has been executed. If not, this * function will fail as the include files are not loaded yet. * * @param $module The name of the module to run. * @param $action The name of the action to run. */ function runModule($module, $action) { // Convert everything to lowercase $scope = YDSimpleCMS::getScope(); $module = strtolower($module); $action = strtolower($action); // Get the classname for the module $moduleClassName = YD_SIMPLECMS_MODULE_PREFIX . $module; // Check if the class exists if (!class_exists($moduleClassName)) { YDSimpleCMS::showError('Module class not found: %s', $moduleClassName); } // Create the class instance $moduleInstance = new $moduleClassName(); // Set the correct template scope $moduleInstance->tpl->scope = $scope; // Sort the admin menu items if ($scope == YD_SIMPLECMS_SCOPE_ADMIN) { $adminMenu =& YDSimpleCMS::getAdminMenu(); $moduleInstance->tpl->assign('adminMenu', $adminMenu); } // Create a link to ourselves $moduleInstance->manager =& $this; // Run the action $moduleInstance->runAction($action); }
<?php // Include the CMS App module include_once dirname(__FILE__) . '/includes/YDSimpleCMSApp.php'; // Run the CMS request YDSimpleCMS::runPublicRequest();
<?php // Class definition class module_newsletter extends YDSimpleCMSModule { // Class variables var $name = 'SimpleCMS Newsletter Module'; var $description = 'SimpleCMS module to manage newsletters.'; var $version = '1.0'; var $authorName = 'Pieter Claerhout'; var $authorEmail = '*****@*****.**'; var $authorUrl = 'http://www.yellowduck.be'; // Main function function action_public_show() { } } // Add menu items YDSimpleCMS::addAdminMenu('Newsletters', 'Create Newsletter', 'newsletter', 'create'); YDSimpleCMS::addAdminMenu('Newsletters', 'Archived Newsletters', 'newsletter', 'show');
<?php // Class definition class module_contactus extends YDSimpleCMSModule { // Class variables var $name = 'SimpleCMS Contact Us Module'; var $description = 'SimpleCMS module to manage a contact form.'; var $version = '1.0'; var $authorName = 'Pieter Claerhout'; var $authorEmail = '*****@*****.**'; var $authorUrl = 'http://www.yellowduck.be'; // Main function function action_public_show() { } } // Add menu items YDSimpleCMS::addAdminMenu('Content', 'Contact Us', 'contactus', 'show');