Esempio n. 1
0
 function importClassCsp($class, $path = '')
 {
     if (!class_exists($class)) {
         if (!$path) {
             $classFile = $class;
             if (strpos(strtolower($classFile), CSP_CODE) !== false) {
                 $classFile = preg_replace('/' . CSP_CODE . '/i', '', $classFile);
             }
             $path = CSP_CLASSES_DIR . $classFile . '.php';
         }
         return importCsp($path);
     } else {
         //If such class already exist - let's check does this is our plugin class or someone else
         /*if(class_exists('ReflectionClass')) {   //ReflectionClass supported begining from php5
               $reflection = new ReflectionClass($class);
               $classFile = $reflection->getFileName();
               if(strpos($classFile, CSP_DIR) === false) {   //Class is not in our plugin directory
                   $conflictWith = substr($classFile, strpos($classFile, 'plugins') + strlen('plugins'. DS));
                   $conflictWith = substr($conflictWith, 0, strpos($conflictWith, DS));
                   $plugins = get_option('active_plugins');
                   if(!empty($plugins)) {
                       for($i = 0; $i < count($plugins); $i++) {
                           if(strpos($plugins[$i], CSP_PLUG_NAME) !== false) {   //Let's remove our plugin from list of active plugins
                               unset($plugins[$i]);
                           }
                       }
                       update_option( 'active_plugins', $plugins );
                   }
                   exit('Sorry, but we have conflict with class name <b style="color: red;">'. $class. '</b> in one of your already installed plugins <b style="color: red;">'. $conflictWith. '</b> located at '. $classFile. '. This means that you can not have both two plugins at one time.');
               }
           }*/
     }
     return false;
 }
Esempio n. 2
0
 public function __construct()
 {
     if (!function_exists('recaptcha_get_html')) {
         // In case if this lib was already included by another plugin
         importCsp(CSP_HELPERS_DIR . 'recaptchalib.php');
     }
 }
Esempio n. 3
0
 protected function _createView($name = '')
 {
     if (empty($name)) {
         $name = $this->getCode();
     }
     $parentModule = frameCsp::_()->getModule($this->getCode());
     $className = '';
     if (importCsp($parentModule->getModDir() . 'views' . DS . $name . '.php')) {
         $className = toeGetClassNameCsp($name . 'View');
     }
     if ($className) {
         $view = new $className();
         $view->setCode($this->getCode());
         return $view;
     }
     return NULL;
 }
Esempio n. 4
0
 protected function _createController()
 {
     if (!file_exists($this->getModDir() . 'controller.php')) {
         return false;
         // EXCEPTION!!!
     }
     if ($this->_controller) {
         return true;
     }
     if (file_exists($this->getModDir() . 'controller.php')) {
         $className = '';
         if (importCsp($this->getModDir() . 'controller.php')) {
             $className = toeGetClassNameCsp($this->getCode() . 'Controller');
         }
         if (!empty($className)) {
             $this->_controller = new $className($this->getCode());
             $this->_controller->init();
             return true;
         }
     }
     return false;
 }