本文整理汇总了PHP中ExtensionManager::listInstalledHandles方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::listInstalledHandles方法的具体用法?PHP ExtensionManager::listInstalledHandles怎么用?PHP ExtensionManager::listInstalledHandles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::listInstalledHandles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listTypes
public function listTypes()
{
static $result;
if (is_array($result)) {
return $result;
}
$extensions = ExtensionManager::listInstalledHandles();
if (!is_array($extensions) || empty($extensions)) {
return array();
}
$result = array();
foreach ($extensions as $e) {
$path = EXTENSIONS . "/{$e}/template";
if (!is_dir($path)) {
continue;
}
$structure = General::listStructure($path, '/^formatter.[\\w-]+.tpl$/', false, 'ASC', $path);
if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
foreach ($structure['filelist'] as $t) {
$type = preg_replace(array('/^formatter./i', '/.tpl$/i'), '', $t);
$result[$type] = array('path' => $path);
}
}
}
return $result;
}
示例2: __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');
}
示例3: 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;
}
示例4: 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;
}
示例5: ExtensionManager
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;
}
示例6: __install
//.........这里部分代码省略.........
}
Symphony::Log()->pushToLog('WRITING: Creating ‘tmp’ folder (/manifest/tmp)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/manifest/tmp', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘tmp’ directory. Check permission on /manifest.', $start);
}
// Writing configuration file
Symphony::Log()->pushToLog('WRITING: Configuration File', E_NOTICE, true, true);
Symphony::Configuration()->setArray($conf);
if (!Symphony::Configuration()->write(CONFIG, $conf['file']['write_mode'])) {
self::__abort('Could not create config file ‘' . CONFIG . '’. Check permission on /manifest.', $start);
}
// Writing htaccess file
Symphony::Log()->pushToLog('CONFIGURING: Frontend', E_NOTICE, true, true);
$rewrite_base = ltrim(preg_replace('/\\/install$/i', NULL, dirname($_SERVER['PHP_SELF'])), '/');
$htaccess = str_replace('<!-- REWRITE_BASE -->', $rewrite_base, file_get_contents(INSTALL . '/includes/htaccess.txt'));
if (!General::writeFile(DOCROOT . "/.htaccess", $htaccess, $conf['file']['write_mode'], 'a')) {
self::__abort('Could not write ‘.htaccess’ file. Check permission on ' . DOCROOT, $start);
}
// Writing /workspace folder
if (!is_dir(DOCROOT . '/workspace')) {
// Create workspace folder structure
Symphony::Log()->pushToLog('WRITING: Creating ‘workspace’ folder (/workspace)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/workspace', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘workspace’ directory. Check permission on the root folder.', $start);
}
Symphony::Log()->pushToLog('WRITING: Creating ‘data-sources’ folder (/workspace/data-sources)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/workspace/data-sources', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘workspace/data-sources’ directory. Check permission on the root folder.', $start);
}
Symphony::Log()->pushToLog('WRITING: Creating ‘events’ folder (/workspace/events)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/workspace/events', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘workspace/events’ directory. Check permission on the root folder.', $start);
}
Symphony::Log()->pushToLog('WRITING: Creating ‘pages’ folder (/workspace/pages)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/workspace/pages', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘workspace/pages’ directory. Check permission on the root folder.', $start);
}
Symphony::Log()->pushToLog('WRITING: Creating ‘utilities’ folder (/workspace/utilities)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/workspace/utilities', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘workspace/utilities’ directory. Check permission on the root folder.', $start);
}
} else {
Symphony::Log()->pushToLog('An existing ‘workspace’ directory was found at this location. Symphony will use this workspace.', E_NOTICE, true, true);
// MySQL: Importing workspace data
Symphony::Log()->pushToLog('MYSQL: Importing Workspace Data...', E_NOTICE, true, true);
if (is_file(DOCROOT . '/workspace/install.sql')) {
try {
Symphony::Database()->import(file_get_contents(DOCROOT . '/workspace/install.sql'), $fields['database']['use-server-encoding'] != 'yes' ? true : false, true);
} catch (DatabaseException $e) {
self::__abort('There was an error while trying to import data to the database. MySQL returned: ' . $e->getDatabaseErrorCode() . ': ' . $e->getDatabaseErrorMessage(), $start);
}
}
}
// Write extensions folder
if (!is_dir(DOCROOT . '/extensions')) {
// Create extensions folder
Symphony::Log()->pushToLog('WRITING: Creating ‘extensions’ folder (/extensions)', E_NOTICE, true, true);
if (!General::realiseDirectory(DOCROOT . '/extensions', $conf['directory']['write_mode'])) {
self::__abort('Could not create ‘extension’ directory. Check permission on the root folder.', $start);
}
}
// Install existing extensions
Symphony::Log()->pushToLog('CONFIGURING: Installing existing extensions', E_NOTICE, true, true);
$disabled_extensions = array();
foreach (new DirectoryIterator(EXTENSIONS) as $e) {
if ($e->isDot() || $e->isFile() || !is_file($e->getRealPath() . '/extension.driver.php')) {
continue;
}
$handle = $e->getBasename();
try {
if (!ExtensionManager::enable($handle)) {
$disabled_extensions[] = $handle;
Symphony::Log()->pushToLog('Could not enable the extension ‘' . $handle . '’.', E_NOTICE, true, true);
}
} catch (Exception $ex) {
$disabled_extensions[] = $handle;
Symphony::Log()->pushToLog('Could not enable the extension ‘' . $handle . '’. ' . $ex->getMessage(), E_NOTICE, true, true);
}
}
// Loading default language
if (isset($_REQUEST['lang']) && $_REQUEST['lang'] != 'en') {
Symphony::Log()->pushToLog('CONFIGURING: Default language', E_NOTICE, true, true);
$language = Lang::Languages();
$language = $language[$_REQUEST['lang']];
// Is the language extension enabled?
if (in_array('lang_' . $language['handle'], ExtensionManager::listInstalledHandles())) {
Symphony::Configuration()->set('lang', $_REQUEST['lang'], 'symphony');
if (!Symphony::Configuration()->write(CONFIG, $conf['file']['write_mode'])) {
Symphony::Log()->pushToLog('Could not write default language ‘' . $language['name'] . '’ to config file.', E_NOTICE, true, true);
}
} else {
Symphony::Log()->pushToLog('Could not enable the desired language ‘' . $language['name'] . '’.', E_NOTICE, true, true);
}
}
// Installation completed. Woo-hoo!
Symphony::Log()->writeToLog('============================================', true);
Symphony::Log()->writeToLog(sprintf('INSTALLATION COMPLETED: Execution Time - %d sec (%s)', max(1, time() - $start), date('d.m.y H:i:s')), true);
Symphony::Log()->writeToLog('============================================' . PHP_EOL . PHP_EOL . PHP_EOL, true);
return $disabled_extensions;
}