function adminHead() { $plugins = Plugins::enabledPlugins(); $html = ''; foreach ($plugins as $plugin) { if (method_exists($plugin, 'adminHead')) { $html .= $plugin::adminHead(); } } echo $html; }
public static function pluginSettings() { $plugins = Plugins::enabledPlugins(); $html = ''; foreach ($plugins as $plugin) { if (method_exists($plugin, 'adminSettings')) { $html .= "<fieldset>"; $html .= $plugin::adminSettings(); $html .= "</fieldset>"; } } echo $html; }
function getField($field) { global $Candy; $page = isset($_GET['page']) ? $_GET['page'] : $Candy['options']->getOption('homepage'); $id = $Candy['pages']->getInfo('page_id', $page); $dbh = new CandyDB(); $sth = $dbh->prepare("SELECT field_value FROM " . DB_PREFIX . "fields WHERE field_name='{$field}' AND post_id={$id}"); $sth->execute(); $content = $sth->fetchColumn(); $plugins = Plugins::enabledPlugins(); foreach ($plugins as $plugin) { if (method_exists($plugin, 'addShorttag')) { $replace = $plugin::addShorttag(); foreach ($replace as $key => $value) { $content = str_replace($key, $value, $content); } } } return $content; }
* @package CandyCMS * @version 0.7.4 * @since 0.1 * @copyright Copyright 2012 (C) Cocoon Design Ltd. - All Rights Reserved * * Admin bootstrap */ #ini_set('display_errors', 1); error_reporting(E_ALL); define('CANDYVERSION', '0.7.4'); require_once '../core/config.php'; # Fire up the autoloader I'm going back to 1977! function __autoload($class_name) { if (file_exists("classes/{$class_name}.php")) { include 'classes/' . $class_name . '.php'; } else { include CMS_PATH . 'core/classes/' . $class_name . '.php'; } } $Candy = array(); $Candy['options'] = new Options(); # Include our admin functions file include_once 'functions.php'; # Load all of our enabled plugins and include the files $plugins = Plugins::enabledPlugins(); if (is_array($plugins)) { foreach ($plugins as $plugin) { include_once PLUGIN_PATH . $plugin . '/' . $plugin . '.php'; } }
<div id="container"> <?php if (isset($_POST['save'])) { ?> <p class="message success">Plugins Saved</p> <?php Plugins::savePlugins($_POST['enabled']); } ?> <form action="dashboard.php?page=plugins" method="post"> <?php $plugins = Plugins::listPlugins(); $enabled = Plugins::enabledPlugins(); if ($plugins != false) { echo '<ul class="list">'; foreach ($plugins as $plugin) { echo '<li>'; echo '<p class="plugin-ttl">', $plugin['plugin'], '</p>', $plugin['description'], '<br /><span>Author: <a href="' . $plugin['authorURI'] . '" target="_blank">', $plugin['author'], '</a></span>'; $check = in_array($plugin['dir'], $enabled) ? '<input type="checkbox" value="' . $plugin['dir'] . '" name="enabled[]" checked="checked" class="right" />' : '<input type="checkbox" value="' . $plugin['dir'] . '" name="enabled[]" class="right" />'; echo $check; echo '</li>'; } echo '</ul>'; echo '<input type="submit" class="button" value="Save" name="save" />'; } ?> </form> </div>