function __construct($config = null)
 {
     if (is_string($config)) {
         $f = WIKIRENDERER_PATH . 'rules/' . basename($config) . '.php';
         if (file_exists($f)) {
             require_once $f;
             $this->config = new $config();
         } else {
             $this->config = jApp::loadPlugin($config, 'wr_rules', '.rule.php', $config);
             if (is_null($this->config)) {
                 throw new Exception('Rules "' . $config . '" not found for jWiki');
             }
         }
         $this->config->charset = jApp::config()->charset;
     } elseif (is_object($config)) {
         $this->config = $config;
     } else {
         require_once WIKIRENDERER_PATH . 'rules/wr3_to_xhtml.php';
         $this->config = new wr3_to_xhtml();
         $this->config->charset = jApp::config()->charset;
     }
     $this->inlineParser = new WikiInlineParser($this->config);
     foreach ($this->config->bloctags as $name) {
         $this->_blocList[] = new $name($this);
     }
     if ($this->config->defaultBlock) {
         $name = $this->config->defaultBlock;
         $this->_defaultBlock = new $name($this);
     }
 }
示例#2
0
 function __construct($config = null)
 {
     if (is_string($config)) {
         if (class_exists($config)) {
             // this is a class name
             $this->config = new $config();
         } else {
             // this is a plugin name
             $this->config = jApp::loadPlugin($config, 'wr_rules', '.rule.php', $config);
             if (is_null($this->config)) {
                 throw new Exception('Rules "' . $config . '" not found for jWiki');
             }
         }
         $this->config->charset = jApp::config()->charset;
     } elseif (is_object($config)) {
         $this->config = $config;
     } else {
         $this->config = new wr3_to_xhtml();
         $this->config->charset = jApp::config()->charset;
     }
     $this->inlineParser = new WikiInlineParser($this->config);
     foreach ($this->config->bloctags as $name) {
         $this->_blocList[] = new $name($this);
     }
     if ($this->config->defaultBlock) {
         $name = $this->config->defaultBlock;
         $this->_defaultBlock = new $name($this);
     }
 }
示例#3
0
 public static function _createConnector($profile)
 {
     if (!isset($profile['driver'])) {
         throw new jException('jelix~kvstore.error.driver.notset', $profile['_name']);
     }
     $connector = jApp::loadPlugin($profile['driver'], 'kvdb', '.kvdriver.php', $profile['driver'] . 'KVDriver', $profile);
     return $connector;
 }
 protected function loadPlugin($name)
 {
     $plugin = jApp::loadPlugin($name, 'profiles', '.profiles.php', $name . 'ProfilesCompiler', $name);
     if (!$plugin) {
         $plugin = new jProfilesCompilerPlugin($name);
     }
     $this->plugins[$name] = $plugin;
 }
示例#5
0
 /**
  * callback method for jProfiles. internal use
  */
 public static function _createConnector($profile)
 {
     // If no driver is specified, let's throw an exception
     if (!isset($profile['driver'])) {
         throw new jException('jelix~kvstore.error.driver.notset', $profile['_name']);
     }
     $connector = jApp::loadPlugin($profile['driver'], 'kvdb', '.kvdriver.php', $profile['driver'] . 'KVDriver', $profile);
     //if (is_null($connector)) {
     //    throw new jException('jelix~errors.kvdb.driver.notfound',$profile['driver']);
     //}
     return $connector;
 }
示例#6
0
 /**
  * return the auth driver
  * @return jIAuthDriver
  */
 protected static function _getDriver()
 {
     static $driver = null;
     if ($driver == null) {
         $config = self::_getConfig();
         $db = strtolower($config['driver']);
         $driver = jApp::loadPlugin($db, 'auth', '.auth.php', $config['driver'] . 'AuthDriver', $config[$config['driver']]);
         if (is_null($driver)) {
             throw new jException('jelix~auth.error.driver.notfound', $db);
         }
     }
     return $driver;
 }
 /**
  * load the acl2 driver
  * @return jIAcl2Driver
  */
 protected static function _getDriver()
 {
     if (self::$driver == null) {
         $config = jApp::config();
         $db = strtolower($config->acl2['driver']);
         if ($db == '') {
             throw new jException('jacl2~errors.driver.notfound', $db);
         }
         self::$driver = jApp::loadPlugin($db, 'acl2', '.acl2.php', $config->acl2['driver'] . 'Acl2Driver', $config->acl2);
         if (is_null(self::$driver)) {
             throw new jException('jacl2~errors.driver.notfound', $db);
         }
     }
     return self::$driver;
 }
示例#8
0
 /**
  * load the acl driver
  * @return jIAclDriver
  */
 protected static function _getDriver()
 {
     static $driver = null;
     if ($driver == null) {
         $config = jApp::config();
         $db = strtolower($config->acl['driver']);
         if ($db == '') {
             throw new jException('jacl~errors.driver.notfound', $db);
         }
         $driver = jApp::loadPlugin($db, 'acl', '.acl.php', $config->acl['driver'] . 'AclDriver', $config->acl);
         if (is_null($driver)) {
             throw new jException('jacl~errors.driver.notfound', $db);
         }
     }
     return $driver;
 }
示例#9
0
 /**
  * load the acl2 driver
  * @return jIAcl2Driver
  */
 protected static function _getDriver()
 {
     static $driver = null;
     if ($driver == null) {
         global $gJConfig;
         $db = strtolower($gJConfig->acl2['driver']);
         if ($db == '') {
             throw new jException('jelix~errors.acl.driver.notfound', $db);
         }
         $driver = jApp::loadPlugin($db, 'acl2', '.acl2.php', $gJConfig->acl2['driver'] . 'Acl2Driver', $gJConfig->acl2);
         if (is_null($driver)) {
             throw new jException('jelix~errors.acl.driver.notfound', $db);
         }
     }
     return $driver;
 }
 function __construct()
 {
     $this->_charset = jApp::config()->charset;
     $this->_lang = jApp::config()->locale;
     $plugins = jApp::config()->jResponseHtml['plugins'];
     if ($plugins) {
         $plugins = preg_split('/ *, */', $plugins);
         foreach ($plugins as $name) {
             if (!$name) {
                 continue;
             }
             $plugin = jApp::loadPlugin($name, 'htmlresponse', '.htmlresponse.php', $name . 'HTMLResponsePlugin', $this);
             if ($plugin) {
                 $this->plugins[$name] = $plugin;
             }
         }
     }
     parent::__construct();
 }
示例#11
0
 /**
  * compile the given class id.
  * @param jSelectorDao $selector
  */
 public function compile($selector)
 {
     $daoPath = $selector->getPath();
     // load the XML file
     $doc = new DOMDocument();
     if (!$doc->load($daoPath)) {
         throw new jException('jelix~daoxml.file.unknown', $daoPath);
     }
     if ($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE . 'dao/1.0') {
         throw new jException('jelix~daoxml.namespace.wrong', array($daoPath, $doc->namespaceURI));
     }
     $tools = jApp::loadPlugin($selector->driver, 'db', '.dbtools.php', $selector->driver . 'DbTools');
     if (is_null($tools)) {
         throw new jException('jelix~db.error.driver.notfound', $selector->driver);
     }
     $parser = new jDaoParser($selector);
     $parser->parse(simplexml_import_dom($doc), $tools);
     $class = $selector->dbType . 'DaoBuilder';
     if (!jApp::includePlugin($selector->dbType, 'daobuilder', '.daobuilder.php', $class)) {
         throw new jException('jelix~dao.error.builder.notfound', $selector->dbType);
     }
     $generator = new $class($selector, $tools, $parser);
     // generation of PHP classes corresponding to the DAO definition
     $compiled = '<?php ';
     $compiled .= "\nif (jApp::config()->compilation['checkCacheFiletime']&&(\n";
     $compiled .= "\n filemtime('" . $daoPath . '\') > ' . filemtime($daoPath);
     $importedDao = $parser->getImportedDao();
     if ($importedDao) {
         foreach ($importedDao as $selimpdao) {
             $path = $selimpdao->getPath();
             $compiled .= "\n|| filemtime('" . $path . '\') > ' . filemtime($path);
         }
     }
     $compiled .= ")){ return false;\n}\nelse {\n";
     $compiled .= $generator->buildClasses() . "\n return true; }";
     jFile::write($selector->getCompiledFilePath(), $compiled);
     return true;
 }
 /**
  * @return jDbTools
  */
 public function tools()
 {
     if (!$this->_tools) {
         $dbms = $this->dbms === 'sqlite' ? 'sqlite3' : $this->dbms;
         $this->_tools = jApp::loadPlugin($dbms, 'db', '.dbtools.php', $dbms . 'DbTools', $this);
         if (is_null($this->_tools)) {
             throw new jException('jelix~db.error.driver.notfound', $dbms);
         }
     }
     return $this->_tools;
 }
示例#13
0
 public function getWidget($ctrl, \jelix\forms\HtmlWidget\ParentWidgetInterface $parentWidget = null)
 {
     if (isset($this->widgets[$ctrl->ref])) {
         return $this->widgets[$ctrl->ref];
     }
     $config = \jApp::config()->{$this->formConfig};
     if (isset($this->pluginsConf[$ctrl->ref])) {
         //first the builder conf
         $pluginName = $this->pluginsConf[$ctrl->ref];
     } elseif (isset($config[$ctrl->type])) {
         //then the ini conf
         $pluginName = $config[$ctrl->type];
     } else {
         //finaly the control type
         $pluginName = $ctrl->type . '_' . $this->formType;
     }
     $className = $pluginName . 'FormWidget';
     $plugin = \jApp::loadPlugin($pluginName, 'formwidget', '.formwidget.php', $className, array($ctrl, $this, $parentWidget));
     if (!$plugin) {
         throw new \Exception('Widget ' . $pluginName . ' not found');
     }
     $this->widgets[$ctrl->ref] = $plugin;
     return $plugin;
 }
示例#14
0
 public static function _createConnector($profile)
 {
     if ($profile['driver'] == 'pdo' || isset($profile['usepdo']) && $profile['usepdo']) {
         $dbh = new jDbPDOConnection($profile);
         return $dbh;
     } else {
         $dbh = jApp::loadPlugin($profile['driver'], 'db', '.dbconnection.php', $profile['driver'] . 'DbConnection', $profile);
         if (is_null($dbh)) {
             throw new jException('jelix~db.error.driver.notfound', $profile['driver']);
         }
         return $dbh;
     }
 }
示例#15
0
 public static function _loadDriver($profile)
 {
     $driver = jApp::loadPlugin($profile['driver'], 'cache', '.cache.php', $profile['driver'] . 'CacheDriver', $profile);
     if (is_null($driver)) {
         throw new jException('jelix~cache.error.driver.missing', array($profile['_name'], $profile['driver']));
     }
     if (!$driver instanceof jICacheDriver) {
         throw new jException('jelix~cache.driver.object.invalid', array($profile['_name'], $profile['driver']));
     }
     return $driver;
 }
示例#16
0
    /**
     * called just before the final output. This is the opportunity
     * to make changes before the head and body output. At this step
     * the main content (if any) is already generated.
     */
    public function beforeOutput()
    {
        global $gJConfig;
        $plugins = $gJConfig->debugbar['plugins'];
        $css = "\n#expand ul.jxdb-list li h5 a {background-image: url('data:image/png;base64,__LOGOBULLETPLUS__');}\n#expand ul.jxdb-list li.jxdb-opened  h5 a {background-image: url('data:image/png;base64,__LOGOBULLETMINUS__');}\n";
        $js = '';
        if ($plugins) {
            $plugins = preg_split('/ *, */', $plugins);
            foreach ($plugins as $name) {
                $plugin = jApp::loadPlugin($name, 'debugbar', '.debugbar.php', $name . 'DebugbarPlugin', $this);
                if ($plugin) {
                    $this->plugins[$name] = $plugin;
                }
                /*else
                  throw new jException('');*/
            }
        }
        foreach ($this->plugins as $name => $plugin) {
            $css .= $plugin->getCSS();
            $js .= $plugin->getJavascript();
        }
        $this->response->addHeadContent('
<style type="text/css">
#includeraw debugbar.css
' . $css . '
</style>
<script type="text/javascript">//<![CDATA[
#includeraw debugbar.js|jspacker|escquote
' . $js . ' //]]>
</script>
');
    }
示例#17
0
 /**
  * return the current url engine
  * @return jIUrlEngine
  * @internal call with true parameter, to force to re-instancy the engine. useful for test suite
  */
 static function getEngine($reset = false)
 {
     static $engine = null;
     if ($engine === null || $reset) {
         global $gJConfig;
         $name = $gJConfig->urlengine['engine'];
         $engine = jApp::loadPlugin($name, 'urls', '.urls.php', $name . 'UrlEngine');
         if (is_null($engine)) {
             throw new jException('jelix~errors.urls.engine.notfound', $name);
         }
     }
     return $engine;
 }
 /**
  * @param string $buildertype  the type name of a form builder.
  *          if the name begins by 'legacy.', it load a legacy builder plugin (jelix <=1.4)
  * @return \jelix\forms\Builder\BuilderBase | jFormsBuilderBase
  */
 public function getBuilder($buildertype)
 {
     $legacy = false;
     if ($buildertype == '') {
         $buildertype = $plugintype = 'html';
     } else {
         if (preg_match('/^legacy\\.(.*)$/', $buildertype, $m)) {
             $legacy = true;
             $plugintype = $m[1];
         } else {
             $plugintype = $buildertype;
         }
     }
     if (isset($this->builders[$buildertype])) {
         return $this->builders[$buildertype];
     }
     if (!$legacy) {
         $o = jApp::loadPlugin($plugintype, 'formbuilder', '.formbuilder.php', $plugintype . 'FormBuilder', $this);
     } else {
         include_once JELIX_LIB_PATH . 'forms/legacy/jFormsBuilderBase.class.php';
         $o = jApp::loadPlugin($plugintype, 'jforms', '.jformsbuilder.php', $plugintype . 'JformsBuilder', $this);
     }
     if ($o) {
         $this->builders[$buildertype] = $o;
         return $o;
     } else {
         throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->sel));
     }
 }
    /**
     * called just before the final output. This is the opportunity
     * to make changes before the head and body output. At this step
     * the main content (if any) is already generated.
     */
    public function beforeOutput()
    {
        $plugins = jApp::config()->debugbar['plugins'];
        $css = "\nul.jxdb-list li h5 a {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABjSURBVCjPY/jPgB8y0FHBkb37/+/6v+X/+v8r/y/ei0XB3v+H4HDWfywKtgAl1v7/D8SH/k/ApmANUAICDv1vx6ZgMZIJ9dgUzEJyQxk2BRPWdf1vAeqt/F/yP3/dwIQk2QoAfUogHsamBmcAAAAASUVORK5CYII=');}\nul.jxdb-list li.jxdb-opened  h5 a {background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABhSURBVCjPY/jPgB8y0FHBkb37/+/6v+X/+v8r/y/ei0XB3v+H4HDWfywKtgAl1oLhof8TsClYA5SAgEP/27EpWIxkQj02BbOQ3FCGTcGEdV3/W4B6K/+X/M9fNzAhSbYCAMiTH3pTNa+FAAAAAElFTkSuQmCC');}\n";
        $js = '';
        if ($plugins) {
            $plugins = preg_split('/ *, */', $plugins);
            foreach ($plugins as $name) {
                $plugin = jApp::loadPlugin($name, 'debugbar', '.debugbar.php', $name . 'DebugbarPlugin', $this);
                if ($plugin) {
                    $this->plugins[$name] = $plugin;
                }
                /*else
                  throw new jException('');*/
            }
        }
        foreach ($this->plugins as $name => $plugin) {
            $css .= $plugin->getCSS();
            $js .= $plugin->getJavascript();
        }
        $this->response->addHeadContent('
<style type="text/css">
#jxdb {position:absolute;right:10px;top:0px;left:auto;margin:0;padding:0px;z-index:1000;font-size:10pt;font-family:arial;font-weight:normal;color:black;}
#jxdb-pjlx-a-right { display:none;}
#jxdb-pjlx-a-left { display:inline;}
#jxdb.jxdb-position-l {left:10px; right: auto;}
#jxdb.jxdb-position-l #jxdb-pjlx-a-right { display:inline;}
#jxdb.jxdb-position-l #jxdb-pjlx-a-left { display:none;}
#jxdb-header {
    padding:3px;background:-moz-linear-gradient(top, #EFF4F6, #87CDEF);background-color: #EFF4F6;font-size:10pt;color:#797979;float:right;z-index:1200;position:relative;
    border-radius:0px 0px  5px 5px ;-webkit-border-bottom-right-radius: 5px;-webkit-border-bottom-left-radius: 5px;-o-border-radius:0px 0px  5px 5px ;-moz-border-radius:0px 0px  5px 5px;
    box-shadow: #6B6F80 3px 3px 6px 0px;-moz-box-shadow: #969CB4 3px 3px 6px 0px;-webkit-box-shadow: #6B6F80 3px 3px 6px;-o-box-shadow: #6B6F80 3px 3px 6px 0px;
}
#jxdb.jxdb-position-l #jxdb-header { float:left;}
#jxdb-header img {vertical-align: middle;}
#jxdb-header a img {border:0px;}
#jxdb-header span {display:inline-block;border-right: 1px solid #93B6B8;padding: 0 0.5em;color:black;}
#jxdb-header a {text-decoration:none;color:black;}
#jxdb-header span a:hover {text-decoration:underline;}
#jxdb-tabpanels {
    clear:both;color:black;background-color: #CCE4ED;z-index:1100;margin:0;padding:0;position:relative;max-height:700px;overflow: auto;resize:both;
    border-radius:0px 0px  5px 5px ;-moz-border-radius: 0 0 5px 5px;-o-border-radius:0px 0px  5px 5px ;-webkit-border-bottom-left-radius: 5px;-webkit-border-bottom-right-radius: 5px;
    box-shadow: #6B6F80 3px 3px 3px 0px;-moz-box-shadow: #969CB4 3px 3px 3px 0px;-webkit-box-shadow: #6B6F80 3px 3px 3px;-o-box-shadow: #6B6F80 3px 3px 3px 0px;
}
#jxdb-tabpanels div.jxdb-tabpanel { padding:4px; }
.jxdb-list {margin:10px; padding:8px 8px 8px 8px; list-style-type:none;}
.jxdb-list li {margin:3px 0; padding:0 0 0 0px; background-color: #D0E6F4;}
.jxdb-list h5 a {color:black;text-decoration:none;display:inline-block;padding:0 0 0 18px;background-position:left center; background-repeat: no-repeat;}
.jxdb-list h5 span {display:inline-block;padding:0 0 0 18px;background-position: left center;background-repeat:no-repeat;}
.jxdb-list h5 {display:block;margin:0;padding:0;font-size:12pt;font-weight:normal; background-color:#FFF9C2;}
.jxdb-list p {margin:0 0 0 18px;font-size:10pt;}
.jxdb-list table {margin:0 0 0 18px;font-size:9pt;font-family:courier new, monospace;color:#3F3F3F; width:100%;}
#jxdb-errors li {background-color: inherit;}
#jxdb-errors li.jxdb-msg-error h5 {background-color:#FFD3D3;}
#jxdb-errors li.jxdb-msg-notice h5 {background-color:#DDFFE6;}
#jxdb-errors li.jxdb-msg-warning h5 { background-color:#FFB94E;}
.jxdb-list li >div {display:none;}
.jxdb-list li.jxdb-opened >div {display:block;}
p.jxdb-msg-error { background-color:#FFD3D3;}
p.jxdb-msg-warning { background-color:#FFB94E;}

' . $css . '
</style>
<script type="text/javascript">//<![CDATA[
var jxdb={plugins:{},init:function(event){for(var i in jxdb.plugins)jxdb.plugins[i].init()},me:function(){return document.getElementById(\'jxdb\')},close:function(){document.getElementById(\'jxdb\').style.display="none"},selectTab:function(tabPanelId){var close=(document.getElementById(tabPanelId).style.display==\'block\');this.hideTab();if(!close){document.getElementById(\'jxdb-tabpanels\').style.display=\'block\';document.getElementById(tabPanelId).style.display=\'block\'}},hideTab:function(){var panels=document.getElementById(\'jxdb-tabpanels\').childNodes;for(var i=0;i<panels.length;i++){var elt=panels[i];if(elt.nodeType==elt.ELEMENT_NODE){elt.style.display=\'none\'}}document.getElementById(\'jxdb-tabpanels\').style.display=\'none\'},moveTo:function(side){document.getElementById(\'jxdb\').setAttribute(\'class\',\'jxdb-position-\'+side);this.createCookie(\'jxdebugbarpos\',side)},createCookie:function(name,value){var date=new Date();date.setTime(date.getTime()+(7*24*60*60*1000));document.cookie=name+"="+value+"; expires="+date.toGMTString()+"; path=/"},toggleDetails:function(anchor){var item=anchor.parentNode.parentNode;var cssclass=item.getAttribute(\'class\');if(cssclass==null)cssclass=\'\';if(cssclass.indexOf(\'jxdb-opened\')==-1){item.setAttribute(\'class\',cssclass+" jxdb-opened");item.childNodes[3].style.display=\'block\'}else{item.setAttribute(\'class\',cssclass.replace("jxdb-opened",\'\'));item.childNodes[3].style.display=\'none\'}}};if(window.addEventListener)window.addEventListener("load",jxdb.init,false);
' . $js . ' //]]>
</script>
');
    }
示例#20
0
 /**
  * called just before the final output. This is the opportunity
  * to make changes before the head and body output. At this step
  * the main content (if any) is already generated.
  */
 public function beforeOutput()
 {
     // load plugins
     $plugins = jApp::config()->debugbar['plugins'];
     if ($plugins) {
         $plugins = preg_split('/ *, */', $plugins);
         foreach ($plugins as $name) {
             $plugin = jApp::loadPlugin($name, 'debugbar', '.debugbar.php', $name . 'DebugbarPlugin', $this);
             if ($plugin) {
                 $this->plugins[$name] = $plugin;
             }
         }
     }
 }
示例#21
0
 /**
  * create a connector. internal use (callback method for jProfiles)
  * @param array  $profile  profile properties
  * @return jDbConnection|jDbPDOConnection  database connector
  */
 public static function _createConnector($profile)
 {
     if ($profile['driver'] == 'pdo' || $profile['usepdo']) {
         #ifnot ENABLE_OPTIMIZED_SOURCE
         /*
         #else
         $dbh = new jDbPDOConnection($profile);
         #endif
         #ifnot ENABLE_OPTIMIZED_SOURCE
         */
         $dbh = new jDbPDOConnectionDebug($profile);
         #endif
         return $dbh;
     } else {
         $dbh = jApp::loadPlugin($profile['driver'], 'db', '.dbconnection.php', $profile['driver'] . 'DbConnection', $profile);
         if (is_null($dbh)) {
             throw new jException('jelix~db.error.driver.notfound', $profile['driver']);
         }
         return $dbh;
     }
 }
示例#22
0
 /**
  * @param string $buildertype  the type name of a form builder
  * @return jFormsBuilderBase
  */
 public function getBuilder($buildertype)
 {
     if ($buildertype == '') {
         $buildertype = 'html';
     }
     if (isset($this->builders[$buildertype])) {
         return $this->builders[$buildertype];
     }
     include_once JELIX_LIB_PATH . 'forms/jFormsBuilderBase.class.php';
     $o = jApp::loadPlugin($buildertype, 'jforms', '.jformsbuilder.php', $buildertype . 'JformsBuilder', $this);
     if ($o) {
         $this->builders[$buildertype] = $o;
         return $o;
     } else {
         throw new jExceptionForms('jelix~formserr.invalid.form.builder', array($buildertype, $this->sel));
     }
 }
示例#23
0
 protected static function _log($message, $loggers)
 {
     // let's inject the message in all loggers
     foreach ($loggers as $loggername) {
         if ($loggername == '') {
             continue;
         }
         if ($loggername == 'memory') {
             $confLog =& jApp::config()->memorylogger;
             $cat = $message->getCategory();
             if (isset($confLog[$cat])) {
                 $max = intval($confLog[$cat]);
             } else {
                 $max = intval($confLog['default']);
             }
             if (!isset(self::$messagesCount[$cat])) {
                 self::$messagesCount[$cat] = 0;
             }
             if (++self::$messagesCount[$cat] > $max) {
                 continue;
             }
             self::$allMessages[] = $message;
             continue;
         }
         if (!isset(self::$loggers[$loggername])) {
             if ($loggername == 'file') {
                 self::$loggers[$loggername] = new jFileLogger();
             } elseif ($loggername == 'syslog') {
                 require JELIX_LIB_CORE_PATH . 'log/jSyslogLogger.class.php';
                 self::$loggers[$loggername] = new jSyslogLogger();
             } elseif ($loggername == 'mail') {
                 require JELIX_LIB_CORE_PATH . 'log/jMailLogger.class.php';
                 self::$loggers[$loggername] = new jMailLogger();
             } else {
                 $l = jApp::loadPlugin($loggername, 'logger', '.logger.php', $loggername . 'Logger');
                 if (is_null($l)) {
                     continue;
                 }
                 // yes, silent, because we could be inside an error handler
                 self::$loggers[$loggername] = $l;
             }
         }
         self::$loggers[$loggername]->logMessage($message);
     }
 }
示例#24
0
 public function compile($selector)
 {
     $daoPath = $selector->getPath();
     $doc = new DOMDocument();
     if (!$doc->load($daoPath)) {
         throw new jException('jelix~daoxml.file.unknown', $daoPath);
     }
     if ($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE . 'dao/1.0') {
         throw new jException('jelix~daoxml.namespace.wrong', array($daoPath, $doc->namespaceURI));
     }
     $tools = jApp::loadPlugin($selector->driver, 'db', '.dbtools.php', $selector->driver . 'DbTools');
     if (is_null($tools)) {
         throw new jException('jelix~db.error.driver.notfound', $selector->driver);
     }
     $parser = new jDaoParser($selector);
     $parser->parse(simplexml_import_dom($doc), $tools);
     require_once jApp::config()->_pluginsPathList_db[$selector->driver] . $selector->driver . '.daobuilder.php';
     $class = $selector->driver . 'DaoBuilder';
     $generator = new $class($selector, $tools, $parser);
     $compiled = '<?php ' . $generator->buildClasses() . "\n?>";
     jFile::write($selector->getCompiledFilePath(), $compiled);
     return true;
 }
示例#25
0
 /**
  * @return jDbSchema
  * @since 1.2
  */
 public function schema()
 {
     if (!$this->_schema) {
         $this->_schema = jApp::loadPlugin($this->driverName, 'db', '.dbschema.php', $this->driverName . 'DbSchema', $this);
         if (is_null($this->_schema)) {
             throw new jException('jelix~db.error.driver.notfound', $this->driverName);
         }
     }
     return $this->_schema;
 }
示例#26
0
 /**
  * constructor;
  * setup the charset, the lang
  */
 function __construct()
 {
     $this->_charset = jApp::config()->charset;
     $this->_lang = jApp::config()->locale;
     // load plugins
     $plugins = jApp::config()->jResponseHtml['plugins'];
     if ($plugins) {
         $plugins = preg_split('/ *, */', $plugins);
         foreach ($plugins as $name) {
             if (!$name) {
                 continue;
             }
             $plugin = jApp::loadPlugin($name, 'htmlresponse', '.htmlresponse.php', $name . 'HTMLResponsePlugin', $this);
             if ($plugin) {
                 $this->plugins[$name] = $plugin;
             }
             // do nothing if the plugin does not exist, we could be already into the error handle
         }
     }
     parent::__construct();
 }
示例#27
0
 /**
  * return the auth driver
  * @return jIAuthDriver
  * @since 1.2.10
  */
 public static function getDriver()
 {
     if (self::$driver === null) {
         $config = self::loadConfig();
         $db = strtolower($config['driver']);
         $driver = jApp::loadPlugin($db, 'auth', '.auth.php', $config['driver'] . 'AuthDriver', $config[$config['driver']]);
         if (is_null($driver)) {
             throw new jException('jelix~auth.error.driver.notfound', $db);
         }
         self::$driver = $driver;
     }
     return self::$driver;
 }