本文整理汇总了PHP中jApp::loadPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::loadPlugin方法的具体用法?PHP jApp::loadPlugin怎么用?PHP jApp::loadPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::loadPlugin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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: __construct
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: _createConnector
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;
}
示例4: loadPlugin
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: _createConnector
/**
* 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: _getDriver
/**
* 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;
}
示例7: _getDriver
/**
* 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: _getDriver
/**
* 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: _getDriver
/**
* 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;
}
示例10: __construct
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: compile
/**
* 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;
}
示例12: tools
/**
* @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: getWidget
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: _createConnector
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: _loadDriver
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;
}