function __construct()
 {
     /* Constants */
     define('PI_SYS_VERSION', $this->version);
     define('PI_SYS_AUTHOR', 'Ronald A. Richardson');
     define('PI_SYS_WEBSITE', 'www.ronaldarichardson.com');
     /* Set PluginIgniter defaults */
     if (PIINFO) {
         $this->wp_pi_menu();
     }
     /* Load system helpers */
     foreach (glob(BASEPATH . 'helpers/*.php') as $helper) {
         include $helper;
     }
     /* Load core classes */
     foreach (glob(BASEPATH . 'core/*.php') as $core) {
         include $core;
     }
     $this->pi = new PI_Controller();
     /* Load System libraries */
     foreach (glob(BASEPATH . 'libraries/*.php') as $lib) {
         include $lib;
     }
     /* Load helpers */
     foreach (glob(PLUGINPATH . 'helpers/*.php') as $helper) {
         include $helper;
     }
     /* Load Controllers */
     foreach (glob(PLUGINPATH . 'controllers/*.php') as $controller_file) {
         include $controller_file;
         $controller_name = get_class_name_from_file($controller_file);
         $this->controllers[] = new $controller_name();
     }
 }
Example #2
0
 public static function _wp_init()
 {
     if (isset($_GET['controller'])) {
         // $pi = self::_get_instance();
         foreach (glob(PLUGINPATH . 'controllers/*.php') as $controller) {
             $class = get_class_name_from_file($controller);
             if (strtolower($class) == strtolower($_GET['controller'])) {
                 $controller = new $class();
                 if (isset($_GET['method'])) {
                     $controller->{$_GET}['method']();
                 }
                 break;
             }
         }
         die;
     }
 }
Example #3
0
 public function model($model, $alias = false)
 {
     $file = PLUGINPATH . 'models/' . $model . EXT;
     if ($model == NULL) {
         log_message('error', 'Attempted to load non existing model');
         return false;
     }
     if (!file_exists($file)) {
         log_message('error', 'Attempted to load non existing model');
         return false;
     }
     if (preg_match('/[^a-zA-Z]+/', $alias, $matches)) {
         log_message('error', 'Model alias contains special characters');
         return false;
     }
     $model_class = get_class_name_from_file($file);
     $model_name = $alias ? $alias : $model_class;
     include $file;
     $model = new $model_class();
     parent::__set($model_name, $model);
 }