<h3>Step #1 - Install Core Classes</h3>

<p>The core plugins are the plugins that are provided by default in the engine. The core functionality of the system depends on many of these plugins. This step will automatically install them.</p>';
// Loop through each class and install it
$configPaths = File_Scan::scanRecursive(SYS_PATH . "/core-classes", "*.config.php");
foreach ($configPaths as $configPath) {
    // Extract the name of this class
    $class = str_replace(".config.php", "", basename($configPath));
    // Load the Class's Config Class
    if (!($classConfig = Classes_Meta::getConfig($class, SYS_PATH . "/core-classes"))) {
        echo '<h4 style="color:red;">' . $class . '</h4>
		<p><span style="color:red;">The class\'s config class was inaccessible.</span></p>';
    }
    // Install the Class
    $installed = Classes_Meta::install($class);
    switch ($installed) {
        case Classes_Meta::DEPENDENCIES_MISSING:
            $details = '<span style="color:red; font-weight:700;">This installation requires dependencies that were not installed properly.</span>';
            break;
        case Classes_Meta::INSTALL_FAILED:
            $details = '<span style="color:red; font-weight:700;">Installation failed. Core functionality may be broken.</span>';
            break;
        case Classes_Meta::INSTALL_SUCCEEDED:
            $details = '<span style="color:green; font-weight:700;">Installation was completed successfully.</span>';
            break;
        case Classes_Meta::NO_INSTALL_NEEDED:
            $details = '<span style="color:blue;">No installation was necessary for this plugin.</span>';
            break;
    }
    // Display the Class
			<tr>
				<td style="max-width:100px; overflow:hidden;"><a href="/admin/Class/Class Details/' . $class . '">' . $class . '</a></td>
				<td>' . $classConfig->description . '</td>
			</tr>';
        }
    }
    echo '
	</table>';
    // Scan through the plugins directory
    $classs = Dir::getFolders(CORE_PLUGIN_PATH);
    echo '
	<h3 style="margin-top:22px;">Core Classes</h3>
	<table class="mod-table">';
    foreach ($classs as $class) {
        // Reject class names that aren't valid
        if (!ctype_alnum($class)) {
            continue;
        }
        if ($classConfig = Classes_Meta::getConfig($class)) {
            echo '
			<tr>
				<td style="max-width:100px; overflow:hidden;"><a href="/admin/Class/Class Details/' . $class . '">' . $class . '</a></td>
				<td>' . $classConfig->description . '</td>
			</tr>';
        }
    }
    echo '
	</table>';
}
// Display the Footer
require SYS_PATH . "/controller/includes/admin_footer.php";
Example #3
0
	// Run with: /action/Class/MyTest?param[0]=something
	public static function MyTest_TeslaAction
	(
		$arg			// <mixed> Allows a single argument to be passed.
	,	$clearance = 0	// <int> The level of clearance provided to this action.
	)					// RETURNS <void>
	{
		// The user activating this action must have a clearance of 3 or higher
		if($clearance >= 3)
		{
			Database::query("INSERT INTO someTable (column) VALUES (?)", array($arg));
		}
	}
	
-----------------------------------------------
------ Redirection after a Class Action ------
-----------------------------------------------
Once a plugin has been run, the "return" value will be used to determine which page to return back to. If none was provided, it will return to the home page of the site.
A typical action URL therefore looks like this:
	
	/action/ClassName/actionName?param[0]=dataToSend&return=/page/to/return?to=andArgsIfYouWantThem
*/
// Run the Class's Action
Classes_Meta::runAction($url[1], $url[2], isset($_GET['param']) ? $_GET['param'] : array());
// Run the URL Redirection
if (isset($_GET['return'])) {
    header("Location: " . $_GET['return']);
    exit;
}
header("Location: /");
exit;
Example #4
0
foreach ($classList as $class) {
    // Reject class names that aren't valid
    if (!ctype_alnum($class)) {
        continue;
    }
    if ($classConfig = Classes_Meta::getConfig($class)) {
        // If there is no "isInstalled" method, don't show the entry
        if (!method_exists($classConfig->pluginName . "_config", "isInstalled")) {
            continue;
        }
        // If the plugin isn't installed, don't show it
        if (!($installed = call_user_func(array($classConfig->pluginName . "_config", "isInstalled")))) {
            continue;
        }
        // Get list of controllers
        if ($controllerList = Classes_Meta::getAdminPages($classConfig->data['path'])) {
            foreach ($controllerList as $controller) {
                $linkList[$classConfig->pluginName][$controller] = $controller;
            }
        }
    }
}
// Run Header
require SYS_PATH . "/controller/includes/admin_header.php";
// Cycle through all of the available admin components
ksort($linkList);
echo '
<style>
	.admin-table tr:nth-child(2n-1) { background-color:#cceeff; }
	.admin-table td { padding:3px; border:solid black 1px; }
</style>
    public static function massDeletion($core = false, $addon = false, $app = false)
    {
        // Convert Core Classes
        if ($core) {
            echo '<h2>Core Class HHVM Deletions</h2>';
            $classList = Classes_Meta::getClassList(CORE_PLUGIN_PATH);
            foreach ($classList as $class) {
                echo '
				<span style="font-weight:bold;">' . $class . '</span>: HHVM Deletion Complete.<br />';
                self::delete($class, CORE_PLUGIN_PATH);
            }
        }
        // Convert Plugin Classes
        if ($addon) {
            echo '<h2>Addon Class HHVM Deletions</h2>';
            $classList = Classes_Meta::getClassList(ADDON_PLUGIN_PATH);
            foreach ($classList as $class) {
                echo '
				<span style="font-weight:bold;">' . $class . '</span>: HHVM Deletion Complete.<br />';
                self::delete($class, ADDON_PLUGIN_PATH);
            }
        }
        // Convert App Classes
        if ($app) {
            echo '<h2>App Class HHVM Deletions</h2>';
            $classList = Classes_Meta::getClassList(PLUGIN_PATH);
            foreach ($classList as $class) {
                echo '
				<span style="font-weight:bold;">' . $class . '</span>: HHVM Deletion Complete.<br />';
                self::delete($class, PLUGIN_PATH);
            }
        }
    }