コード例 #1
0
ファイル: chooser.php プロジェクト: nemein/openpsa
 private function _check_renderer()
 {
     if (!isset($this->renderer['class'])) {
         return false;
     }
     $this->_renderer_callback_class = $this->renderer['class'];
     $this->_renderer_callback_args = array();
     if (isset($this->renderer['args']) && !empty($this->renderer['args'])) {
         $this->_renderer_callback_args = $this->renderer['args'];
     }
     if (!class_exists($this->_renderer_callback_class)) {
         // Try auto-load.
         $path = MIDCOM_ROOT . '/' . str_replace('_', '/', $this->_renderer_callback_class) . '.php';
         if (!file_exists($path)) {
             debug_add("Auto-loading of the renderer callback class {$this->_renderer_callback_class} from {$path} failed: File does not exist.", MIDCOM_LOG_ERROR);
             return false;
         }
         require_once $path;
     }
     if (!class_exists($this->_renderer_callback_class)) {
         debug_add("The renderer callback class {$this->_renderer_callback_class} was defined as option for the field {$this->name} but did not exist.", MIDCOM_LOG_ERROR);
         return false;
     }
     $this->_renderer_callback = new $this->_renderer_callback_class($this->_renderer_callback_args);
     return $this->_renderer_callback->initialize();
 }