Ejemplo n.º 1
0
 /**
  * Get plugin list from the database, and attempt to load them in
  *
  * @version     1.1
  * @since       1.0.0
  * @author      Dan Aldridge
  *
  * @param       array $plugins
  *
  * @return      bool
  */
 public function load($plugins = array())
 {
     if ($this->dontExec == true) {
         return false;
     }
     $objSQL = Core_Classes_coreObj::getDBO();
     // make sure we didn't get an empty var...
     if (!is_array($plugins) || is_empty($plugins)) {
         // if we did try and get a fresh copy from the db
         $objCache = Core_Classes_coreObj::getCache();
         $plugins = $objCache->load('plugins');
         if (!is_array($plugins) || is_empty($plugins)) {
             $this->dontExec = true;
             return false;
             // no luck this time so just return quietly
         }
     }
     // loop though each plugin
     foreach ($plugins as $hook) {
         $hookStr = $hook['path'];
         // make sure its actually a file and is readable
         if (!is_file($hookStr) && !is_readable($hookStr)) {
             continue;
         }
         // also make sure its enabled..
         if ($hook['enabled'] === false) {
             continue;
         }
         // and then include it :D
         include_once str_replace('./', cmsROOT . '', $hookStr);
     }
     // everything worked as expected so just return true;
     return true;
 }
Ejemplo n.º 2
0
function recache()
{
    if (isset($_GET['_recache'])) {
        echo dump($_GET, 'RECACHE BOOM!');
        $objCache = Core_Classes_coreObj::getCache();
        $objCache->remove('stores');
        $objCache->remove('media');
        $objCache->remove('template');
    }
}
Ejemplo n.º 3
0
 /**
  * Retrieves all the included files in the current page
  *
  * @version     1.0
  * @since       1.0.0
  * @author      Dan Aldridge
  *
  * @param       bool        $output     If True, The function will output the HTML
  *
  * @return      array
  */
 public function getInitdCaches($output = false)
 {
     if ($output !== true) {
         return '';
     }
     $output = '';
     $objCache = Core_Classes_coreObj::getCache();
     $output = array('loaded' => $objCache->loadedCaches, 'failed' => $objCache->failedCaches);
     return array('count' => 0, 'content' => dump($output, 'Cache File\'s in use'));
 }
Ejemplo n.º 4
0
// AUTOLOADER, I Choose You!
// directories to use for the autoloading, these get glob'd over after
// $dirs = Core_Classes_coreObj::addClassDirs(array(
//     'classes'          => cmsROOT.'core/classes/*.php',
//     'libs'             => cmsROOT.'core/libs/*/class.*.php',
//     'drivers'          => cmsROOT.'core/drivers/driver.*.php',
//     'admin_panels'     => cmsROOT.'modules/*/admin.*.php',
//     'modules'          => cmsROOT.'modules/*/class.*.php',
//     'module_overrides' => cmsROOT.'themes/*/override/*/*.php',
// ));
spl_autoload_extensions('.php');
spl_autoload_register(array('Core_Classes_coreObj', 'loadClass'));
// echo dump($dirs, 'Loading Classes From', 'orange');exit;
$objCore = new Core_Classes_coreObj();
$objCore->addConfig($config);
// Instance plugins so we can add hooks as early as possible.
$objPlugin = Core_Classes_coreObj::getPlugins();
$objPlugin->hook('CMS_PRE_SETUP_COMPLETE');
$objCache = Core_Classes_coreObj::getCache();
$confCache = $objCache->load('config');
$objCore->addConfig($confCache);
$objSession = Core_Classes_coreObj::getSession();
$objSession->trackerInit();
$objDebug = Core_Classes_coreObj::getDebug();
$objRoute = Core_Classes_coreObj::getRoute();
$objRoute->modifyGET();
if (is_object($objDebug)) {
    set_error_handler(array($objDebug, 'errorHandler'));
}
cmsDEBUG ? memoryUsage('Core: Loaded..') : '';
$objPlugin->hook('CMS_SETUP_COMPLETE');
Ejemplo n.º 5
0
 /**
  * Toggles a route from being active or inactive
  *
  * @version     1.0
  * @since       1.0.0
  * @author      Daniel Noel-Davies
  *
  * @param       $id     int     ID of the Route
  * @param       $status int     New Status of the Route (0=Inactive, 1=Active)
  *
  * @return      array
  */
 public function toggleRoute($id, $status = null)
 {
     $update = array();
     $objSQL = Core_Classes_coreObj::getDBO();
     $objCache = Core_Classes_coreObj::getCache();
     $query = $objSQL->queryBuilder();
     if (is_bool($status) !== null) {
         $update['status'] = 'IF(status=1, 0, 1)';
     } else {
         $update['status'] = $status === true ? '1' : '0';
     }
     $query = $query->update('#__routes')->set($update)->where(sprintf('id = %d', $id))->build();
     $result = $objSQL->query($query);
     $objCache->doCache('route');
     return $result;
 }