本文整理汇总了PHP中ExtensionManager::loadExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::loadExtension方法的具体用法?PHP ExtensionManager::loadExtension怎么用?PHP ExtensionManager::loadExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::loadExtension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluateExtension
/**
* Evaluate Extension by getting the name and the params
* ###mailform(param=value, param=value)###
*
* @param String $string The content to parse
*/
function evaluateExtension($string)
{
$regex = "/###Ext:(.*)###/";
$regex2 = "/^(.*)\\((.*)\\)\$/";
preg_match($regex, $string, $matches);
if (!empty($matches[1])) {
preg_match($regex2, $matches[1], $params);
if (!empty($params[1])) {
$extName = $params[1];
$tmpParams = $params[2];
//Explode Params
$tmpParams = explode(",", $tmpParams);
foreach ($tmpParams as $val) {
$para = explode("=", $val);
$extParams[trim($para[0])] = trim($para[1]);
}
//now we got the name and the params so lets include and pass
require_once $this->config->miplexDir . "ExtensionManager.class.php";
$extManager = new ExtensionManager($this->config);
$ext = $extManager->loadExtension($extName);
if ($ext != false) {
$ret = $ext->main($extParams);
$this->ext = 1;
} else {
$ret = "Plugin not Found";
}
$string = preg_replace($regex, $ret, $string);
}
}
return $string;
}
示例2: smarty_function_loadExtension
function smarty_function_loadExtension($params, &$smarty)
{
//fetch plugin name
$extName = $params['name'];
$config =& $params['config'];
if (empty($extName)) {
return "No Extension selected";
}
$extParams = array();
if (isset($params['params'])) {
//Explode Params
$tmpParams = explode(",", $params['params']);
foreach ($tmpParams as $val) {
$para = explode("=", $val);
$extParams[trim($para[0])] = trim($para[1]);
}
}
// now we got the name and the params so lets include and pass
require_once $config->miplexDir . "ExtensionManager.class.php";
$extManager = new ExtensionManager($config);
$ext = $extManager->loadExtension($extName);
if ($ext != false) {
return $ext->main($extParams);
} else {
return "Plugin not Found";
}
}
示例3: smarty_function_loadExtension
function smarty_function_loadExtension($params, &$smarty)
{
//fetch plugin name
$extName = $params['name'];
$config =& $params['config'];
if (empty($extName)) {
return "No Extension selected";
}
// now we got the name and the params so lets include and pass
require_once $config->miplexDir . "ExtensionManager.class.php";
$extManager = new ExtensionManager($config);
$ext = $extManager->loadExtension($extName);
if ($ext != false) {
return $ext->main($extParams);
} else {
return "Plugin not Found";
}
}
示例4: ExtensionManager
<?php
//Include Extension Manager
require_once $session->config->miplexDir . "ExtensionManager.class.php";
$extManager = new ExtensionManager($session->config);
//get all Extension
$exts = $extManager->getAllAvailableExtensions();
$menu = "<ul class='extension'>";
foreach ($exts as $ext) {
$menu .= "<li><a href='?module=ext&id=" . $ext['basename'] . "' title='" . $ext['basename'] . "' class='extLink'>" . $ext['extName'] . "</a></li>";
}
$menu .= "</ul>";
//Handling Backendmenu of extension
if (!empty($_GET['id'])) {
$obj =& $extManager->loadExtension($_GET['id']);
$obj->baseSmarty =& $session->smarty;
$session->smarty->assign("content", $obj->getBackend());
} else {
$session->smarty->assign("content", "Please Select");
}
//
$session->smarty->assign("menu", $menu);
$session->smarty->assign("i18n", $session->i18n);
$session->smarty->assign("content_tpl", "admin/extensions/main.tpl");
示例5: RunToFile
/**
* ejecuta un reporte que se haya cargado como una extension
*
* @param string $extensionName nombre de la extension que va a generar el reporte
* @param string $type tipo de reporte a generar (pdf, odt, html)
* @return string
* nombre de la exension o false si no se genera el reporte
* */
public function RunToFile($extensionName, $type)
{
$extension = null;
if (!$this->extensionFolder) {
$this->extensionFolder = realpath('.') . '/';
}
if (!$this->reportOutDir) {
$this->reportOutDir = $this->extensionFolder;
}
if (!$this->inExtension($extensionName)) {
$extension = ExtensionManager::loadExtension($extensionName, $this->extensionFolder, $this->typeExtension);
if ($extension) {
$this->addExtension($extension);
} else {
return false;
}
}
//instancia el reporte
$report = new PJRU();
$conn = $extension->getConexion();
if (!$conn) {
$conn = PJRUConexion::get();
}
$reportName = uniqid() . '.' . $type;
$sqlSentence = $extension->getSqlSentence();
$outfilename = $this->reportOutDir . $reportName;
if ($extension->beforeRun() === false) {
return false;
}
$parameters = $extension->getParam();
if ($sqlSentence) {
$methodName = 'run' . ucfirst($type) . 'FromSql';
$reportFileName = $extension->reportFileName . '.jrxml';
} else {
$methodName = 'runReportTo' . ucfirst($type) . 'File';
$reportFileName = $extension->reportFileName . '.jasper';
}
if (get_class($conn) == 'JdbcConnection') {
$conn = $conn->getConnection();
}
$result = $report->{$methodName}(realpath($this->extensionFolder) . '/' . $reportFileName, $outfilename, $parameters, $sqlSentence, $conn);
$extension->afterRun($outfilename);
if ($result) {
return $outfilename;
} else {
return false;
}
}