本文整理汇总了PHP中ExtensionManager类的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager类的具体用法?PHP ExtensionManager怎么用?PHP ExtensionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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";
}
}
示例2: 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;
}
示例3: update
/**
* Update function
*/
public function update()
{
// Support for the multilanguage extension by Giel Berkers:
// http://github.com/kanduvisla/multilanguage
//
// See if the multilingual extension is installed:
require_once TOOLKIT . '/class.extensionmanager.php';
$extensionManager = new ExtensionManager($this);
$status = $extensionManager->fetchStatus('multilanguage');
if ($status == EXTENSION_ENABLED) {
// Append some extra rows to the search-index table:
$languages = explode(',', file_get_contents(MANIFEST . '/multilanguage-languages'));
// Check which fields exist:
$columns = Symphony::Database()->fetch("SHOW COLUMNS FROM `tbl_search_index`");
$fields = array();
foreach ($columns as $column) {
$fields[] = $column['Field'];
}
foreach ($languages as $language) {
$field = 'data_' . $language;
if (!in_array($field, $fields)) {
Administration::instance()->Database->query("ALTER TABLE `tbl_search_index` ADD `" . $field . "` TEXT, ADD FULLTEXT (`" . $field . "`)");
}
}
}
// End Support
}
示例4: listAll
function listAll()
{
$result = array();
$people = array();
$structure = General::listStructure(TEXTFORMATTERS, '/formatter.[\\w-]+.php/', false, 'ASC', TEXTFORMATTERS);
if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
foreach ($structure['filelist'] as $f) {
$f = str_replace(array('formatter.', '.php'), '', $f);
$result[$f] = $this->about($f);
}
}
$extensionManager = new ExtensionManager($this->_Parent);
$extensions = $extensionManager->listInstalledHandles();
if (is_array($extensions) && !empty($extensions)) {
foreach ($extensions as $e) {
if (!is_dir(EXTENSIONS . "/{$e}/text-formatters")) {
continue;
}
$tmp = General::listStructure(EXTENSIONS . "/{$e}/text-formatters", '/formatter.[\\w-]+.php/', false, 'ASC', EXTENSIONS . "/{$e}/text-formatters");
if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
foreach ($tmp['filelist'] as $f) {
$f = preg_replace(array('/^formatter./i', '/.php$/i'), '', $f);
$result[$f] = $this->about($f);
}
}
}
}
ksort($result);
return $result;
}
示例5: __construct
function __construct(&$parent)
{
parent::__construct($parent);
$this->setTitle('Symphony – Member Roles');
$ExtensionManager = new ExtensionManager($parent);
$this->_driver = $ExtensionManager->create('members');
}
示例6: testGetException
/**
* @dataProvider getExceptionProvider
*/
function testGetException($extensions, $type, $name, $exxceptionName)
{
$this->setExpectedException($exxceptionName);
$manager = new ExtensionManager();
foreach ($extensions as $extension) {
$manager->addExtension($extension['instance'], $extension['type']);
}
$manager->getExtension($type, $name);
}
示例7: __construct
function __construct(&$parent)
{
parent::__construct($parent);
$this->_name = 'Member: Role';
// Set default
$this->set('show_column', 'no');
$ExtensionManager = new ExtensionManager($this->_engine);
$this->_driver = $ExtensionManager->create('members');
}
示例8: build
/**
* Mediathek and Subsection Manager cannot be used simultaneously:
* This page deactivates one of these two extensions based on the context and returns to the extension overview.
*/
public function build($context)
{
$ExtensionManager = new ExtensionManager(Administration::instance());
// Deactivate extension
if ($context[0] == 'mediathek' || $context[0] == 'subsectionmanager') {
$ExtensionManager->disable($context[0]);
}
// Return to extension overview
redirect(URL . '/symphony/system/extensions/');
}
示例9: listAll
function listAll()
{
$result = array();
$people = array();
$structure = General::listStructure(EVENTS, '/event.[\\w-]+.php/', false, 'ASC', EVENTS);
if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
foreach ($structure['filelist'] as $f) {
$f = self::__getHandleFromFilename($f);
//preg_replace(array('/^event./i', '/.php$/i'), '', $f);
if ($about = $this->about($f)) {
$classname = $this->__getClassName($f);
$path = $this->__getDriverPath($f);
$can_parse = false;
$type = NULL;
if (is_callable(array($classname, 'allowEditorToParse'))) {
$can_parse = @call_user_func(array(&$classname, 'allowEditorToParse'));
}
if (is_callable(array($classname, 'getType'))) {
$type = @call_user_func(array(&$classname, 'getType'));
}
$about['can_parse'] = $can_parse;
$about['type'] = $type;
$result[$f] = $about;
}
}
}
//$structure = General::listStructure(EXTENSIONS, array(), false, 'ASC', EXTENSIONS);
//$extensions = $structure['dirlist'];
$extensionManager = new ExtensionManager($this->_Parent);
$extensions = $extensionManager->listInstalledHandles();
if (is_array($extensions) && !empty($extensions)) {
foreach ($extensions as $e) {
if (!is_dir(EXTENSIONS . "/{$e}/events")) {
continue;
}
$tmp = General::listStructure(EXTENSIONS . "/{$e}/events", '/event.[\\w-]+.php/', false, 'ASC', EXTENSIONS . "/{$e}/events");
if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
foreach ($tmp['filelist'] as $f) {
$f = $f = self::__getHandleFromFilename($f);
if ($about = $this->about($f)) {
$classname = $this->__getClassName($f);
$can_parse = false;
$type = NULL;
$about['can_parse'] = $can_parse;
$about['type'] = $type;
$result[$f] = $about;
}
}
}
}
}
ksort($result);
return $result;
}
示例10: __construct
public function __construct(\ExtensionManager $extensionManager, UserAccountModel $user)
{
foreach ($extensionManager->getExtensionsIncludingCore() as $extension) {
$extID = $extension->getId();
foreach ($extension->getUserNotificationPreferenceTypes() as $type) {
$key = str_replace(".", "_", $extID . '.' . $type);
$this->preferences[$key] = $extension->getUserNotificationPreference($type);
}
}
$this->user = $user;
}
示例11: __trigger
protected function __trigger()
{
$ExtensionManager = new ExtensionManager($this->_Parent);
$driver = $ExtensionManager->create('members');
$email = $_POST['member-email-address'];
if ($members = $driver->findMemberIDFromEmail($email)) {
foreach ($members as $member_id) {
$driver->sendForgotPasswordEmail($member_id);
}
}
return new XMLElement('forgot-password', 'Email sent', array('sent' => 'true'));
}
示例12: build
/**
* Download language file
*/
function build($context)
{
// Get context
$name = $context[2];
$lang = $context[1];
$context = $context[0];
// Get localisation strings
$data = $this->LocalisationManager->buildDictionary($context, $lang, $name);
// Load template
$path = EXTENSIONS . '/localisationmanager/lib';
if ($context == 'symphony') {
$template = file_get_contents($path . '/lang.core.tpl');
} else {
$template = file_get_contents($path . '/lang.extension.tpl');
}
// Add data
$template = str_replace('<!-- $name -->', $data['about']['name'], $template);
$template = str_replace('<!-- $author -->', $data['about']['author']['name'], $template);
$template = str_replace('<!-- $email -->', $data['about']['author']['email'], $template);
$template = str_replace('<!-- $website -->', $data['about']['author']['website'], $template);
$template = str_replace('<!-- $date -->', $data['about']['release-date'], $template);
if ($context != 'symphony') {
$ExtensionManager = new ExtensionManager($this->parent);
$extensions = $ExtensionManager->listAll();
$template = str_replace('<!-- $extension -->', $extensions[$context]['name'], $template);
}
$template = str_replace('<!-- $strings -->', $this->__layout($data['dictionary']['strings']), $template);
$template = str_replace('<!-- $obsolete -->', $this->__layout($data['dictionary']['obsolete'], 'Obsolete'), $template);
$template = str_replace('<!-- $missing -->', $this->__layout($data['dictionary']['missing'], 'Missing'), $template);
$template = str_replace('<!-- $namespaces -->', $this->__layoutNamespace($data['dictionary']['namespaces']), $template);
if ($context == 'symphony') {
$template = str_replace('<!-- $uppercase -->', $this->__transliterations($data['transliterations']['straight']['uppercase'], 5), $template);
$template = str_replace('<!-- $lowercase -->', $this->__transliterations($data['transliterations']['straight']['lowercase'], 5), $template);
$template = str_replace('<!-- $symbolic -->', $this->__transliterations($data['transliterations']['straight']['symbolic'], 3), $template);
$template = str_replace('<!-- $special -->', $this->__transliterations($data['transliterations']['straight']['special']), $template);
$template = str_replace('<!-- $otherstraight -->', $this->__transliterations($data['transliterations']['straight']['other']), $template);
$template = str_replace('<!-- $ampersands -->', $this->__transliterations($data['transliterations']['regexp']['ampersands']), $template);
$template = str_replace('<!-- $otherregexp -->', $this->__transliterations($data['transliterations']['regexp']['other']), $template);
}
// Send file
header('Content-Type: application/x-php; charset=utf-8');
header('Content-Disposition: attachment; filename="lang.' . ($lang ? $lang : 'new') . '.php"');
header("Content-Description: File Transfer");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
echo $template;
exit;
}
示例13: __indexPage
private function __indexPage()
{
// Create the XML for the page:
$xml = new XMLElement('data');
$sectionsNode = new XMLElement('sections');
$sm = new SectionManager($this);
$sections = $sm->fetch();
foreach ($sections as $section) {
$sectionsNode->appendChild(new XMLElement('section', $section->get('name'), array('id' => $section->get('id'))));
}
$xml->appendChild($sectionsNode);
// Check if the multilingual-field extension is installed:
if (in_array('multilingual_field', ExtensionManager::listInstalledHandles())) {
$xml->setAttribute('multilanguage', 'yes');
// Get all the multilanguage fields:
$fm = new FieldManager($this);
$fields = $fm->fetch(null, null, 'ASC', 'sortorder', 'multilingual');
$multilanguage = new XMLElement('multilanguage');
foreach ($fields as $field) {
$sectionID = $field->get('parent_section');
$section = $sm->fetch($sectionID);
$id = $field->get('id');
$label = $section->get('name') . ' : ' . $field->get('label');
$multilanguage->appendChild(new XMLElement('field', $label, array('id' => $id)));
}
$xml->appendChild($multilanguage);
}
// Generate the HTML:
$xslt = new XSLTPage();
$xslt->setXML($xml->generate());
$xslt->setXSL(EXTENSIONS . '/importcsv/content/index.xsl', true);
$this->Form->setValue($xslt->generate());
$this->Form->setAttribute('enctype', 'multipart/form-data');
}
示例14: sort
public function sort(&$sort, &$order, $params)
{
if (is_null($sort)) {
$sort = 'name';
}
return ExtensionManager::fetch(array(), array(), $sort . ' ' . $order);
}
示例15: __find
function __find($type)
{
if (@is_file(TOOLKIT . "/fields/field.{$type}.php")) {
return TOOLKIT . '/fields';
} else {
$extensionManager = new ExtensionManager($this->_Parent);
$extensions = $extensionManager->listInstalledHandles();
if (is_array($extensions) && !empty($extensions)) {
foreach ($extensions as $e) {
if (@is_file(EXTENSIONS . "/{$e}/fields/field.{$type}.php")) {
return EXTENSIONS . "/{$e}/fields";
}
}
}
}
return false;
}