Author: Jonathan.Wage
Date: 2010-02-17 02:19:50 +0100 (Wed, 17 Feb 2010)
New Revision: 28068
Added:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListFilterVariablesListener.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListUnknownFormatListener.class.php
plugins/sfSympalPlugin/trunk/lib/sfSympalListener.class.php
Removed:
plugins/sfSympalPlugin/trunk/lib/events/
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/events/
Modified:
plugins/sfSympalPlugin/trunk/config/sfSympalPluginConfiguration.class.php
plugins/sfSympalPlugin/trunk/data/bin/installer.php
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/config/sfSympalContentListPluginConfiguration.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/sfSympalInstall.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/task/sfSympalInstallTask.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/sfSympalPluginInfo.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/task/sfSympalPluginListTask.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/toolkits/sfSympalPluginToolkit.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/modules/sympal_plugin_manager/lib/Basesympal_plugin_managerActions.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalSearchPlugin/modules/sympal_search/templates/_title.php
plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
plugins/sfSympalPlugin/trunk/lib/sfSympalPluginEnabler.class.php
plugins/sfSympalPlugin/trunk/lib/task/sfSympalReportStatisticsTask.class.php
plugins/sfSympalPlugin/trunk/test/fixtures/project/apps/sympal/config/app.yml
plugins/sfSympalPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php
plugins/sfSympalPlugin/trunk/test/functional/AdminGenTest.php
plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
Log:
[1.4][sfSympalPlugin][1.0] Reverting changes
Modified:
plugins/sfSympalPlugin/trunk/config/sfSympalPluginConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/config/sfSympalPluginConfiguration.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/config/sfSympalPluginConfiguration.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -49,7 +49,7 @@
*/
public function initialize()
{
- $this->sympalConfiguration = new
sfSympalConfiguration($this->configuration);
+ $this->sympalConfiguration = new sfSympalConfiguration($this->dispatcher,
$this->configuration);
}
/**
Modified: plugins/sfSympalPlugin/trunk/data/bin/installer.php
===================================================================
--- plugins/sfSympalPlugin/trunk/data/bin/installer.php 2010-02-17 01:00:26 UTC
(rev 28067)
+++ plugins/sfSympalPlugin/trunk/data/bin/installer.php 2010-02-17 01:19:50 UTC
(rev 28068)
@@ -86,6 +86,7 @@
$manipulator =
sfClassManipulator::fromFile(sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php');
$manipulator->wrapMethod('setup', '',
'require_once(dirname(__FILE__).\'/../plugins/sfSympalPlugin/config/sfSympalPluginConfiguration.class.php\');');
$manipulator->wrapMethod('setup', '',
'sfSympalPluginConfiguration::enableSympalPlugins($this);');
+$manipulator->wrapMethod('setup', '',
'$this->enableAllPluginsExcept(\'sfPropelPlugin\');');
$manipulator->save();
$this->logSection('sympal', '...downloading sfSympalPlugin');
Modified:
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -14,7 +14,6 @@
parent::setup();
$plugins =
sfSympalContext::getInstance()->getSympalConfiguration()->getContentTypePlugins();
- $plugins = array_combine($plugins, $plugins);
$plugins = array_merge(array('' => ''), $plugins);
$this->widgetSchema['plugin_name'] = new
sfWidgetFormChoice(array('choices' => $plugins));
Modified: plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -35,6 +35,63 @@
return $fields;
}
+ public function sympalConfigure()
+ {
+ $form = $this->getSubject();
+ if ($form instanceof sfFormDoctrine)
+ {
+ sfSympalFormToolkit::embedI18n($form->getObject(), $form);
+
+ if (sfSympalConfig::get('remove_timestampable_from_forms', null, true))
+ {
+ unset($form['created_at'], $form['updated_at']);
+ }
+ }
+ $widgetSchema = $form->getWidgetSchema();
+ $requiredFields = $form->getRequiredFields();
+ $widgetSchema->addOption('required_fields', $requiredFields);
+ $widgetSchema->addFormFormatter('table', new
sfSympalWidgetFormSchemaFormatterTable($widgetSchema));
+
+ if ($form->hasRecaptcha())
+ {
+ sfSympalFormToolkit::embedRecaptcha($form);
+ }
+
+ if (isset($form['template']))
+ {
+ sfSympalFormToolkit::changeTemplateWidget($form);
+ }
+
+ if (isset($form['theme']))
+ {
+ sfSympalFormToolkit::changeThemeWidget($form);
+ }
+
+ if (isset($form['module']))
+ {
+ sfSympalFormToolkit::changeModuleWidget($form);
+ }
+
+ if (isset($form['content_id']) || isset($form['content_list']))
+ {
+ sfSympalFormToolkit::changeContentWidget($form);
+ }
+
+ $richDateForms = sfSympalConfig::get('rich_date_forms');
+ $formClass = get_class($form);
+ if (isset($richDateForms[$formClass]))
+ {
+ foreach ($form as $name => $field)
+ {
+ $widget = $field->getWidget();
+ if (in_array($name, $richDateForms[$formClass]) && ($widget instanceof
sfWidgetFormDateTime || $widget instanceof sfWidgetFormDate))
+ {
+ sfSympalFormToolkit::changeDateWidget($name, $form);
+ }
+ }
+ }
+ }
+
public function hasRecaptcha()
{
// No recaptcha in test environment
@@ -47,4 +104,25 @@
return (in_array($class, $forms) || array_key_exists($class, $forms)) ?
true : false;
}
+
+ public static function listenToFormPostConfigure(sfEvent $event)
+ {
+ $event->getSubject()->sympalConfigure();
+ }
+
+ public static function listenToFormFilterValues(sfEvent $event, $values)
+ {
+ $form = $event->getSubject();
+ if ($form->hasRecaptcha())
+ {
+ $request = sfContext::getInstance()->getRequest();
+ $captcha = array(
+ 'recaptcha_challenge_field' =>
$request->getParameter('recaptcha_challenge_field'),
+ 'recaptcha_response_field' =>
$request->getParameter('recaptcha_response_field'),
+ );
+ $values = array_merge($values, array('captcha' => $captcha));
+ }
+
+ return $values;
+ }
}
\ No newline at end of file
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -19,8 +19,7 @@
return $context->getUser()->hasCredential('ViewAdminBar')
&& $format == 'html'
- && $request->getParameter('module') !== 'sympal_dashboard'
- && sfSympalConfig::get('installed');
+ && $request->getParameter('module') !== 'sympal_dashboard';
}
public function addAdminMenu()
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/config/sfSympalContentListPluginConfiguration.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/config/sfSympalContentListPluginConfiguration.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/config/sfSympalContentListPluginConfiguration.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -17,12 +17,8 @@
*/
public function initialize()
{
- $this->dispatcher->connect('sympal.load', array($this,
'listenToSympalLoad'));
+ new sfSympalContentListFilterVariablesListener( $this->dispatcher );
+ new sfSympalContentListUnknownFormatListener( $this->dispatcher );
}
- public function listenToSympalLoad()
- {
- new sfSympalContentListFilterVariablesListener($this->dispatcher, $this);
- new sfSympalContentListUnknownFormatListener($this->dispatcher, $this);
- }
}
Copied:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListFilterVariablesListener.class.php
(from rev 28028,
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListFilterVariablesListener.class.php)
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListFilterVariablesListener.class.php
(rev 0)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListFilterVariablesListener.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -0,0 +1,26 @@
+<?php
+class sfSympalContentListFilterVariablesListener extends sfSympalListener
+{
+ public function getEventName()
+ {
+ return 'sympal.content_renderer.filter_variables';
+ }
+
+ public static function run(sfEvent $event, $variables)
+ {
+ $content = $variables['content'];
+ if ($content->getType()->getName() == 'sfSympalContentList')
+ {
+ $contentList = $content->getRecord();
+
+ $request = sfContext::getInstance()->getRequest();
+ $dataGrid = $contentList->buildDataGrid($request);
+ $pager = $dataGrid->getPager();
+
+ $variables['pager'] = $pager;
+ $variables['dataGrid'] = $dataGrid;
+ }
+
+ return $variables;
+ }
+}
\ No newline at end of file
Copied:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListUnknownFormatListener.class.php
(from rev 28028,
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListUnknownFormatListener.class.php)
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListUnknownFormatListener.class.php
(rev 0)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalContentListPlugin/lib/sfSympalContentListUnknownFormatListener.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -0,0 +1,42 @@
+<?php
+class sfSympalContentListUnknownFormatListener extends sfSympalListener
+{
+ public function getEventName()
+ {
+ return 'sympal.content_renderer.unknown_format';
+ }
+
+ public static function run(sfEvent $event)
+ {
+ if (isset($event['pager']))
+ {
+ $pager = $event['pager'];
+ $context = sfContext::getInstance();
+ $response = $context->getResponse();
+ $request = $context->getRequest();
+
+ $className = 'sf'.ucfirst($event['format']).'Feed';
+ if (!class_exists($className))
+ {
+ return false;
+ }
+
+ $feed = sfFeedPeer::newInstance($event['format']);
+
+ $feed->initialize(array(
+ 'title' => $response->getTitle(),
+ 'link' => $request->getUri()
+ ));
+
+ $items = sfFeedPeer::convertObjectsToItems($pager->getResults());
+ $feed->addItems($items);
+
+ $event->setProcessed(true);
+ $event->setReturnValue($feed->asXml());
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/sfSympalInstall.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/sfSympalInstall.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/sfSympalInstall.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -280,7 +280,7 @@
{
$this->logSection('sympal', '...installing addon plugins', null,
'COMMENT');
- $plugins =
$this->_configuration->getPluginConfiguration('sfSympalPlugin')->getSympalConfiguration()->getDownloadedPlugins();
+ $plugins =
$this->_configuration->getPluginConfiguration('sfSympalPlugin')->getSympalConfiguration()->getOtherPlugins();
foreach ($plugins as $plugin)
{
$manager = sfSympalPluginManager::getActionInstance($plugin, 'install',
$this->_configuration, $this->_formatter);
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/task/sfSympalInstallTask.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/task/sfSympalInstallTask.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalInstallPlugin/lib/task/sfSympalInstallTask.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -49,10 +49,6 @@
*/
protected function execute($arguments = array(), $options = array())
{
- // Make sure the application is enabled and prepared for sympal before we
try and install
- $task = new sfSympalEnableForAppTask($this->dispatcher, $this->formatter);
- $task->run(array($arguments['application']), array());
-
$this->createContext($this->configuration);
$install = new sfSympalInstall($this->configuration, $this->dispatcher,
$this->formatter);
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/sfSympalPluginInfo.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/sfSympalPluginInfo.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/sfSympalPluginInfo.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -14,7 +14,7 @@
public static function synchronizeDatabase()
{
- $plugins = sfSympalPluginToolkit::getDownloadablePlugins();
+ $plugins = sfSympalPluginToolkit::getAvailablePlugins();
foreach ($plugins as $plugin)
{
$plugin = new sfSympalPluginInfo($plugin);
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/task/sfSympalPluginListTask.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/task/sfSympalPluginListTask.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/task/sfSympalPluginListTask.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -22,7 +22,7 @@
protected function execute($arguments = array(), $options = array())
{
- $plugins = sfSympalPluginToolkit::getDownloadablePlugins();
+ $plugins = sfSympalPluginToolkit::getAvailablePlugins();
if (isset($options['search']) && $options['search'])
{
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/toolkits/sfSympalPluginToolkit.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/toolkits/sfSympalPluginToolkit.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/lib/toolkits/sfSympalPluginToolkit.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -54,14 +54,6 @@
return is_dir(self::getPluginPath($pluginName)) ? true:false;
}
- public static function isPluginDownloadable($name)
- {
- $pluginName = self::getLongPluginName($name);
- $availablePlugins = self::getDownloadablePlugins();
-
- return in_array($availablePlugins, $pluginName);
- }
-
public static function getLongPluginName($name)
{
if (strstr($name, 'sfSympal'))
@@ -88,7 +80,7 @@
}
}
- public static function getDownloadablePluginPaths()
+ public static function getAvailablePluginPaths()
{
$cachePath = sfConfig::get('sf_cache_dir').'/sympal/plugins.cache';
if (!file_exists($cachePath))
@@ -142,9 +134,9 @@
return $available;
}
- public static function getDownloadablePlugins()
+ public static function getAvailablePlugins()
{
- return array_keys(self::getDownloadablePluginPaths());
+ return array_keys(self::getAvailablePluginPaths());
}
public static function getPluginDownloadPath($name)
@@ -155,7 +147,7 @@
$e = explode('.', SYMFONY_VERSION);
$version = $e[0].'.'.$e[1];
- $paths = self::getDownloadablePluginPaths();
+ $paths = self::getAvailablePluginPaths();
$path = '';
foreach ($paths as $pathPluginName => $path)
{
@@ -183,4 +175,12 @@
throw new sfException('Could not find download path for '.$pluginName);
}
}
+
+ public static function isPluginAvailable($name)
+ {
+ $pluginName = self::getLongPluginName($name);
+ $availablePlugins = self::getAvailablePlugins();
+
+ return in_array($availablePlugins, $pluginName);
+ }
}
\ No newline at end of file
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/modules/sympal_plugin_manager/lib/Basesympal_plugin_managerActions.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/modules/sympal_plugin_manager/lib/Basesympal_plugin_managerActions.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPluginManagerPlugin/modules/sympal_plugin_manager/lib/Basesympal_plugin_managerActions.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -18,6 +18,7 @@
$this->addonPlugins = $sympalConfiguration->getAllManageablePlugins();
$this->corePlugins = $sympalConfiguration->getCorePlugins();
+ $this->installedPlugins = $sympalConfiguration->getInstalledPlugins();
$this->checkFilePermissions();
}
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalSearchPlugin/modules/sympal_search/templates/_title.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalSearchPlugin/modules/sympal_search/templates/_title.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalSearchPlugin/modules/sympal_search/templates/_title.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -1,4 +1,4 @@
<?php $url = $record->getUrl(array('absolute' => true)) ?>
<strong><?php echo $record->getType()->getLabel() ?>: <?php echo
link_to($record->getTitle(), $url) ?></strong>
<p><?php echo $record->getTeaser() ?></p>
-<small><?php echo link_to($url, $url) ?></small>
\ No newline at end of file
+<small><?php echo link_to($url, $url) ?>
\ No newline at end of file
Modified: plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -9,88 +9,31 @@
$_symfonyContext,
$_doctrineManager,
$_bootstrap,
- $_plugins,
- $_pluginPaths,
- $_allManageablePlugins,
- $_contentTypePlugins,
- $_requiredPlugins,
- $_modules,
- $_themes,
- $_availableThemes,
+ $_plugins = array(),
+ $_modules = array(),
+ $_themes = null,
+ $_availableThemes = null,
$_cache;
- public function __construct(ProjectConfiguration $projectConfiguration)
+ public function __construct(sfEventDispatcher $dispatcher,
ProjectConfiguration $projectConfiguration)
{
// We disable Symfony autoload again feature because it is too slow in dev
mode
// If you introduce a new class when using sympal you just must clear your
// cache manually
sfAutoloadAgain::getInstance()->unregister();
+ $this->_dispatcher = $dispatcher;
$this->_projectConfiguration = $projectConfiguration;
- $this->_dispatcher = $projectConfiguration->getEventDispatcher();
$this->_doctrineManager = Doctrine_Manager::getInstance();
$this->_initializeSymfonyConfig();
$this->_markClassesAsSafe();
+ $this->_connectEvents();
$this->_configureSuperCache();
$this->_configureDoctrine();
-
- new sfSympalContextLoadFactoriesListener($this->_dispatcher, $this);
}
/**
- * Set the project configuration instance for sympal
- *
- * @param ProjectConfiguration $projectConfiguration
- * @return void
- */
- public function setProjectConfiguration(ProjectConfiguration
$projectConfiguration)
- {
- $this->_projectConfiguration = $projectConfiguration;
- }
-
- /**
- * Initialize some sfConfig values for Sympal
- *
- * @return void
- */
- private function _initializeSymfonyConfig()
- {
- sfConfig::set('sf_cache', sfSympalConfig::get('page_cache', 'enabled',
false));
- sfConfig::set('sf_default_culture', sfSympalConfig::get('default_culture',
null, 'en'));
- sfConfig::set('sf_admin_module_web_dir',
sfSympalConfig::get('admin_module_web_dir', null, '/sfSympalAdminPlugin'));
-
- sfConfig::set('app_sf_guard_plugin_success_signin_url',
sfSympalConfig::get('success_signin_url'));
-
- if (sfConfig::get('sf_login_module') == 'default')
- {
- sfConfig::set('sf_login_module', 'sympal_auth');
- sfConfig::set('sf_login_action', 'signin');
- }
-
- if (sfConfig::get('sf_secure_module') == 'default')
- {
- sfConfig::set('sf_secure_module', 'sympal_auth');
- sfConfig::set('sf_secure_action', 'secure');
- }
-
- if (sfConfig::get('sf_error_404_module') == 'default')
- {
- sfConfig::set('sf_error_404_module', 'sympal_default');
- sfConfig::set('sf_error_404_action', 'error404');
- }
-
- if (sfConfig::get('sf_module_disabled_module') == 'default')
- {
- sfConfig::set('sf_module_disabled_module', 'sympal_default');
- sfConfig::set('sf_module_disabled_action', 'disabled');
- }
-
- sfConfig::set('sf_jquery_path', sfSympalConfig::get('jquery_reloaded',
'path'));
- sfConfig::set('sf_jquery_plugin_paths',
sfSympalConfig::get('jquery_reloaded', 'plugin_paths'));
- }
-
- /**
* Mark necessary Sympal classes as safe
*
* @return void
@@ -115,6 +58,23 @@
}
/**
+ * Connect to various events required by Sympal
+ *
+ * @return void
+ */
+ private function _connectEvents()
+ {
+ $this->_dispatcher->connect('context.load_factories', array($this,
'bootstrap'));
+ $this->_dispatcher->connect('component.method_not_found', array(new
sfSympalActions(), 'extend'));
+ $this->_dispatcher->connect('controller.change_action', array($this,
'listenToControllerChangeAction'));
+ $this->_dispatcher->connect('template.filter_parameters', array($this,
'filterTemplateParameters'));
+ $this->_dispatcher->connect('form.method_not_found', array(new
sfSympalForm(), 'extend'));
+ $this->_dispatcher->connect('form.post_configure', array('sfSympalForm',
'listenToFormPostConfigure'));
+ $this->_dispatcher->connect('form.filter_values', array('sfSympalForm',
'listenToFormFilterValues'));
+ $this->_dispatcher->connect('task.cache.clear', array($this,
'listenToTaskCacheClear'));
+ }
+
+ /**
* Configure super cache if enabled
*
* @return void
@@ -163,22 +123,87 @@
}
}
- public function setCache(sfSympalCache $cache)
+ public function listenToControllerChangeAction(sfEvent $event)
{
- $this->_cache = $cache;
+ $this->initializeTheme();
+ $this->_checkOnline();
}
- public function setSymfonyContext(sfContext $symfonyContext)
+ /**
+ * Listen to clear cache task event so we can clear the web cache folder
+ *
+ * @param sfEvent $event
+ * @return void
+ */
+ public function listenToTaskCacheClear(sfEvent $event)
{
- $this->_symfonyContext = $symfonyContext;
+ $event->getSubject()->logSection('sympal', 'Clearing web cache folder');
+
+ $cacheDir = sfConfig::get('sf_web_dir').'/cache';
+ if (is_dir($cacheDir))
+ {
+
$event->getSubject()->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($cacheDir));
+ }
}
- public function setSympalContext(sfSympalContext $sympalContext)
+ /**
+ * Callable attached to Symfony event context.load_factories. When this event
+ * is triggered we also create the Sympal context.
+ */
+ public function bootstrap(sfEvent $event)
{
- $this->_sympalContext = $sympalContext;
+ $this->_projectConfiguration = $event->getSubject()->getConfiguration();
+
+ $record =
Doctrine_Core::getTable(sfSympalConfig::get('user_model'))->getRecordInstance();
+ $this->_dispatcher->notify(new sfEvent($record,
'sympal.user.set_table_definition', array('object' => $record)));
+
+ $this->_cache = new sfSympalCache($this);
+
+ $this->_symfonyContext = $event->getSubject();
+ $this->_sympalContext =
sfSympalContext::createInstance($this->_symfonyContext, $this);
+
+ $this->_enableModules();
+ $this->_checkInstalled();
+
+ $this->initializeTheme();
+
+ $this->_projectConfiguration->loadHelpers(array(
+ 'Sympal', 'SympalContentSlot', 'SympalMenu', 'SympalPager', 'I18N',
'Asset', 'Url', 'Partial'
+ ));
+
+ if ($this->isAdminModule())
+ {
+ sfConfig::set('sf_login_module', 'sympal_admin');
+ $this->_projectConfiguration->loadHelpers(array('Admin'));
+ }
}
/**
+ * Filter Symfony template parameters and add some references to some
variables
+ *
+ * @param sfEvent $event
+ * @param array $parameters
+ * @return array $parameters
+ */
+ public function filterTemplateParameters(sfEvent $event, $parameters)
+ {
+ if (!$this->_sympalContext)
+ {
+ return $parameters;
+ }
+ $parameters['sf_sympal_context'] = $this->_sympalContext;
+ if ($content = $this->_sympalContext->getCurrentContent())
+ {
+ $parameters['sf_sympal_content'] = $content;
+ }
+ if ($menuItem = $this->_sympalContext->getCurrentMenuItem())
+ {
+ $parameters['sf_sympal_menu_item'] = $menuItem;
+ }
+ return $parameters;
+ }
+
+ /**
* Get the Doctrine_Manager instance
*
* @return Doctrine_Manager $manager
@@ -209,16 +234,6 @@
}
/**
- * Get the current sfContext instance
- *
- * @return sfContext $symfonyContext
- */
- public function getSymfonyContext()
- {
- return $this->_symfonyContext;
- }
-
- /**
* Get the current ProjectConfiguration instance
*
* @return ProjectConfiguration $projectConfiguration
@@ -235,21 +250,17 @@
*/
public function getRequiredPlugins()
{
- if ($this->_requiredPlugins === null)
+ $requiredPlugins = array();
+ foreach ($this->_projectConfiguration->getPlugins() as $pluginName)
{
- $this->_requiredPlugins = array();
- foreach ($this->_projectConfiguration->getPlugins() as $pluginName)
+ if (strpos($pluginName, 'sfSympal') !== false)
{
- if (strpos($pluginName, 'sfSympal') !== false)
- {
- $dependencies =
sfSympalPluginToolkit::getPluginDependencies($pluginName);
- $this->_requiredPlugins = array_merge($this->_requiredPlugins,
$dependencies);
- }
+ $dependencies =
sfSympalPluginToolkit::getPluginDependencies($pluginName);
+ $requiredPlugins = array_merge($requiredPlugins, $dependencies);
}
+ }
- $this->_requiredPlugins =
array_values(array_unique($this->_requiredPlugins));
- }
- return $this->_requiredPlugins;
+ return array_values(array_unique($requiredPlugins));
}
/**
@@ -269,31 +280,28 @@
*/
public function getContentTypePlugins()
{
- if ($this->_contentTypePlugins === null)
+ $contentTypePlugins = array();
+ $plugins = $this->getPluginPaths();
+
+ foreach ($plugins as $plugin => $path)
{
- $contentTypePlugins = array();
- $plugins = $this->getPluginPaths();
- $formatter = new sfFormatter();
- foreach ($plugins as $plugin => $path)
+ $manager = new sfSympalPluginManager($plugin,
$this->_projectConfiguration, new sfFormatter());
+ if ($contentType = $manager->getContentTypeForPlugin())
{
- $manager = new sfSympalPluginManager($plugin,
$this->_projectConfiguration, $formatter);
- if ($contentType = $manager->getContentTypeForPlugin())
- {
- $this->_contentTypePlugins[] = $plugin;
- }
+ $contentTypePlugins[$plugin] = $plugin;
}
}
- return $this->_contentTypePlugins;
+ return $contentTypePlugins;
}
/**
- * Get array of plugins that are downloaded and available in your project
+ * Get array of plugins that are downloaded and installed to your project
*
* @return array $installedPlugins
*/
- public function getDownloadedPlugins()
+ public function getInstalledPlugins()
{
- return array_diff($this->getPlugins(), $this->getRequiredPlugins());
+ return $this->getOtherPlugins();
}
/**
@@ -301,24 +309,32 @@
*
* @return array $addonPlugins
*/
- public function getDownloadablePlugins()
+ public function getAddonPlugins()
{
- return sfSympalPluginToolkit::getDownloadablePlugins();
+ return sfSympalPluginToolkit::getAvailablePlugins();
}
/**
+ * Get array of other plugins that are not required
+ *
+ * @return array $otherPlugins
+ */
+ public function getOtherPlugins()
+ {
+ return array_diff($this->getPlugins(), $this->getRequiredPlugins());
+ }
+
+ /**
* Get array of all manageable plugins that can be downloaded, installed,
uninstalled, etc.
*
* @return array $allManageablePlugins
*/
public function getAllManageablePlugins()
{
- if ($this->_allManageablePlugins === null)
- {
- $this->_allManageablePlugins =
array_merge($this->getDownloadablePlugins(), $this->getDownloadedPlugins());
- $this->_allManageablePlugins =
array_unique($this->_allManageablePlugins);
- }
- return $this->_allManageablePlugins;
+ $plugins = array_merge($this->getAddonPlugins(),
$this->getInstalledPlugins());
+ $plugins = array_unique($plugins);
+
+ return $plugins;
}
/**
@@ -328,11 +344,7 @@
*/
public function getPlugins()
{
- if ($this->_plugins === null)
- {
- $this->_plugins = array_keys($this->getPluginPaths());
- }
- return $this->_plugins;
+ return array_keys($this->getPluginPaths());
}
/**
@@ -342,21 +354,21 @@
*/
public function getPluginPaths()
{
- if ($this->_pluginPaths === null)
+ if (!$this->_plugins)
{
$configuration = ProjectConfiguration::getActive();
$pluginPaths = $configuration->getAllPluginPaths();
- $this->_pluginPaths = array();
+ $this->_plugins = array();
foreach ($pluginPaths as $pluginName => $path)
{
if (strpos($pluginName, 'sfSympal') !== false)
{
- $this->_pluginPaths[$pluginName] = $path;
+ $this->_plugins[$pluginName] = $path;
}
}
}
- return $this->_pluginPaths;
+ return $this->_plugins;
}
/**
@@ -508,6 +520,136 @@
}
/**
+ * Handle the enabling of modules. Either enables all modules or only the
configured modules.
+ *
+ * @return void
+ */
+ private function _enableModules()
+ {
+ if (sfSympalConfig::get('enable_all_modules', null, true))
+ {
+ $modules = sfConfig::get('sf_enabled_modules', array());
+ if (sfSympalConfig::get('enable_all_modules'))
+ {
+ $modules = array_merge($modules, $this->getModules());
+ } else {
+ $modules = array_merge($modules,
sfSympalConfig::get('enabled_modules', null, array()));
+ }
+
+ if ($disabledModules = sfSympalConfig::get('disabled_modules', null,
array()))
+ {
+ $modules = array_diff($modules, $disabledModules);
+ }
+
+ sfConfig::set('sf_enabled_modules', $modules);
+ }
+ }
+
+ /**
+ * Check if Sympal is installed and redirect to installer if not.
+ * Do some other install checks as well.
+ *
+ * @return void
+ */
+ private function _checkInstalled()
+ {
+ // Don't run this if we are under the cli
+ if (PHP_SAPI == 'cli')
+ {
+ return;
+ }
+ $sfContext = sfContext::getInstance();
+ $request = $sfContext->getRequest();
+
+ // Prepare the symfony application is it has not been prepared yet
+ if (!$sfContext->getUser() instanceof sfSympalUser)
+ {
+ chdir(sfConfig::get('sf_root_dir'));
+ $task = new sfSympalEnableForAppTask($this->_dispatcher, new
sfFormatter());
+ $task->run(array($this->_projectConfiguration->getApplication()),
array());
+
+ $sfContext->getController()->redirect('@homepage');
+ }
+
+ // Redirect to install module if...
+ // not in test environment
+ // sympal has not been installed
+ // module is not already sympal_install
+ if (sfConfig::get('sf_environment') != 'test' &&
!sfSympalConfig::get('installed') && $request->getParameter('module') !=
'sympal_install')
+ {
+ $sfContext->getController()->redirect('@sympal_install');
+ }
+
+ // Redirect to homepage if no site record exists so we can prompt the user
to create
+ // a site record for this application
+ // This check is only ran in dev mode
+ if (sfConfig::get('sf_environment') == 'dev' &&
!$this->_sympalContext->getSite() && $sfContext->getRequest()->getPathInfo() !=
'/')
+ {
+ $sfContext->getController()->redirect('@homepage');
+ }
+ }
+
+ /**
+ * Check if Sympal is not online and act accordingly
+ *
+ * @return void
+ */
+ private function _checkOnline()
+ {
+ static $onlineChecked;
+ if (sfSympalConfig::get('offline', 'enabled', false) && !$onlineChecked)
+ {
+ $onlineChecked = true;
+ $this->_symfonyContext->getController()->forward(
+ sfSympalConfig::get('offline', 'module'),
+ sfSympalConfig::get('offline', 'action')
+ );
+ throw new sfStopException();
+ }
+ }
+
+ /**
+ * Initialize some sfConfig values for Sympal
+ *
+ * @return void
+ */
+ private function _initializeSymfonyConfig()
+ {
+ sfConfig::set('sf_cache', sfSympalConfig::get('page_cache', 'enabled',
false));
+ sfConfig::set('sf_default_culture', sfSympalConfig::get('default_culture',
null, 'en'));
+ sfConfig::set('sf_admin_module_web_dir',
sfSympalConfig::get('admin_module_web_dir', null, '/sfSympalAdminPlugin'));
+
+ sfConfig::set('app_sf_guard_plugin_success_signin_url',
sfSympalConfig::get('success_signin_url'));
+
+ if (sfConfig::get('sf_login_module') == 'default')
+ {
+ sfConfig::set('sf_login_module', 'sympal_auth');
+ sfConfig::set('sf_login_action', 'signin');
+ }
+
+ if (sfConfig::get('sf_secure_module') == 'default')
+ {
+ sfConfig::set('sf_secure_module', 'sympal_auth');
+ sfConfig::set('sf_secure_action', 'secure');
+ }
+
+ if (sfConfig::get('sf_error_404_module') == 'default')
+ {
+ sfConfig::set('sf_error_404_module', 'sympal_default');
+ sfConfig::set('sf_error_404_action', 'error404');
+ }
+
+ if (sfConfig::get('sf_module_disabled_module') == 'default')
+ {
+ sfConfig::set('sf_module_disabled_module', 'sympal_default');
+ sfConfig::set('sf_module_disabled_action', 'disabled');
+ }
+
+ sfConfig::set('sf_jquery_path', sfSympalConfig::get('jquery_reloaded',
'path'));
+ sfConfig::set('sf_jquery_plugin_paths',
sfSympalConfig::get('jquery_reloaded', 'plugin_paths'));
+ }
+
+ /**
* Get the active sfSympalConfiguration instance
*
* @return sfSympalConfiguration $sympalConfiguration
Copied: plugins/sfSympalPlugin/trunk/lib/sfSympalListener.class.php (from rev
28028, plugins/sfSympalPlugin/trunk/lib/sfSympalListener.class.php)
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalListener.class.php
(rev 0)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalListener.class.php 2010-02-17
01:19:50 UTC (rev 28068)
@@ -0,0 +1,56 @@
+<?php
+/**
+ * A listener is an object that will react on an event which fired
+ * by the dispatcher at predefined conditions.
+ *
+ * Whenever an instance of sfSympalListener is created it will be registered
+ * in the dispatcher for an event, returned by getEventName() method.
+ *
+ * In trivial case to register a listener you need create a class that extends
+ * sfSympalListener, define methods getEventName() and run() then create an
instance
+ * to register it.
+ *
+ * @author Maxim Tsepkov <[email protected]>
+ */
+
+abstract class sfSympalListener
+{
+ /**
+ * Must return event name to connect to.
+ * It can be a string for one event or an array of strings for multiple
events.
+ *
+ * @return string|array
+ */
+ abstract public function getEventName();
+
+ /**
+ *
+ * @param sfSympalListener $listener
+ * @return null
+ */
+ public function __construct(sfEventDispatcher $dispatcher)
+ {
+ if (is_array($this->getEventName()))
+ {
+ foreach($this->getEventName() as $name)
+ {
+ $dispatcher->connect($name, array($this, $this->getEntryMethod()));
+ }
+ }
+ else
+ {
+ $dispatcher->connect($this->getEventName(), array($this,
$this->getEntryMethod()));
+ }
+ }
+
+ /**
+ * This method can be overloaded if entry point into the class should be
changed.
+ * Note that call_user_func() that Symfony dispatcher uses call this method
as static.
+ *
+ * @return string
+ */
+ protected function getEntryMethod()
+ {
+ return 'run';
+ }
+}
\ No newline at end of file
Modified: plugins/sfSympalPlugin/trunk/lib/sfSympalPluginEnabler.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalPluginEnabler.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalPluginEnabler.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -58,17 +58,6 @@
$this->_configuration->setPluginPath('sfSympalPlugin',
$this->_sympalPluginPath);
$this->enableSympalCorePlugins(sfSympalPluginConfiguration::$dependencies);
-
- // Enable all plugins
- $allPlugins = array_keys($this->_configuration->getAllPluginPaths());
- $allPlugins = array_merge(
- $this->_configuration->getPlugins(),
- sfSympalPluginConfiguration::$dependencies,
- $allPlugins
- );
- $allPlugins = array_unique($allPlugins);
- $this->_configuration->setPlugins($allPlugins);
- $this->_configuration->disablePlugins('sfPropelPlugin');
}
/**
Modified:
plugins/sfSympalPlugin/trunk/lib/task/sfSympalReportStatisticsTask.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/task/sfSympalReportStatisticsTask.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/lib/task/sfSympalReportStatisticsTask.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -27,7 +27,7 @@
*/
protected function execute($arguments = array(), $options = array())
{
- $plugins = sfSympalPluginToolkit::getDownloadablePlugins();
+ $plugins = sfSympalPluginToolkit::getAvailablePlugins();
$api = new sfSympalPluginApi();
if ($api->getUsername() && $api->getPassword())
Modified:
plugins/sfSympalPlugin/trunk/test/fixtures/project/apps/sympal/config/app.yml
===================================================================
---
plugins/sfSympalPlugin/trunk/test/fixtures/project/apps/sympal/config/app.yml
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/test/fixtures/project/apps/sympal/config/app.yml
2010-02-17 01:19:50 UTC (rev 28068)
@@ -1,7 +1,11 @@
all:
sympal_config:
- language_codes: [en, fr, es]
+ language_codes:
+ - en
+ - fr
+ - es
breadcrumbs_separator: ' / '
plugin_api:
username: test
password: test
+ default_culture: en
Modified:
plugins/sfSympalPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php
2010-02-17 01:00:26 UTC (rev 28067)
+++
plugins/sfSympalPlugin/trunk/test/fixtures/project/config/ProjectConfiguration.class.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -19,6 +19,8 @@
{
require_once(dirname(__FILE__).'/../../../../config/sfSympalPluginConfiguration.class.php');
sfSympalPluginConfiguration::enableSympalPlugins($this);
+
+ $this->enableAllPluginsExcept('sfPropelPlugin');
}
public function setupPlugins()
Modified: plugins/sfSympalPlugin/trunk/test/functional/AdminGenTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/functional/AdminGenTest.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/test/functional/AdminGenTest.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -10,7 +10,7 @@
'sympal_users' => '/admin/security/user',
'sympal_groups' => '/admin/security/group',
'sympal_permissions' => '/admin/security/permission',
- 'sympal_content' => '/admin/content/manage/type/page',
+ 'sympal_content' => '/admin/content',
'sympal_content_types' => '/admin/content/types',
'sympal_sites' => '/admin/sites'
);
@@ -24,6 +24,7 @@
end()->
with('request')->begin()->
isParameter('module', $adminGenModule)->
+ isParameter('action', 'index')->
end()->
click('Edit')->
with('request')->begin()->
Modified: plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
2010-02-17 01:00:26 UTC (rev 28067)
+++ plugins/sfSympalPlugin/trunk/test/unit/ConfigurationTest.php
2010-02-17 01:19:50 UTC (rev 28068)
@@ -13,36 +13,11 @@
$app = 'sympal';
require_once(dirname(__FILE__).'/../bootstrap/unit.php');
-$t = new lime_test(21, new lime_output_color());
+$t = new lime_test(9, new lime_output_color());
$sympalPluginConfiguration =
sfContext::getInstance()->getConfiguration()->getPluginConfiguration('sfSympalPlugin');
$sympalConfiguration = $sympalPluginConfiguration->getSympalConfiguration();
-$themes = $sympalConfiguration->getThemes();
-$t->is(isset($themes['default']), true, '->getThemes() includes default
theme');
-
-$availableThemes = $sympalConfiguration->getAvailableThemes();
-$t->is(isset($themes['admin']), 'admin', '->getAvailableThemes() does not
include admin theme');
-
-$contentTemplates = $sympalConfiguration->getContentTemplates('page');
-$t->is(isset($contentTemplates['default_view']), true,
'->getContentTemplates() returns default_view for page');
-$t->is(isset($contentTemplates['register']), true, '->getContentTemplates()
returns register for page');
-
-sfContext::getInstance()->getRequest()->setParameter('module',
'sympal_dashboard');
-$t->is($sympalConfiguration->isAdminModule(), true, '->isAdminModule() returns
true for admin module');
-
-sfContext::getInstance()->getRequest()->setParameter('module',
'sympal_content_renderer');
-$t->is($sympalConfiguration->isAdminModule(), false, '->isAdminModule()
returns false for non-admin module');
-
-$plugins = $sympalConfiguration->getPlugins();
-$t->is(is_array($plugins), true, '->getPlugins() returns array');
-$t->is(in_array('sfSympalBlogPlugin', $plugins), true, '->getPlugins()
includes sfSympalBlogPlugin');
-
-$pluginPaths = $sympalConfiguration->getPluginPaths();
-$t->is(is_array($pluginPaths), true, '->getPluginPaths() returns array');
-$t->is(isset($pluginPaths['sfSympalBlogPlugin']), true, '->getPluginPaths()
includes sfSympalBlogPlugin');
-$t->is($pluginPaths['sfSympalBlogPlugin'],
sfConfig::get('sf_plugins_dir').'/sfSympalBlogPlugin', '->getPluginPaths()
returns correct path as value of array');
-
$requiredPlugins = array(
'sfSympalPlugin',
'sfSympalUserPlugin',
@@ -66,7 +41,6 @@
'sfSympalEditorPlugin',
'sfSympalAssetsPlugin',
'sfSympalContentSyntaxPlugin',
- 'sfSympalSearchPlugin'
);
$t->is($sympalConfiguration->getRequiredPlugins(), $requiredPlugins,
'->getRequiredPlugins() returns the correct array');
@@ -93,36 +67,34 @@
'sfSympalEditorPlugin',
'sfSympalAssetsPlugin',
'sfSympalContentSyntaxPlugin',
- 'sfSympalSearchPlugin'
);
$t->is($sympalConfiguration->getCorePlugins(), $corePlugins,
'->getCorePlugins() returns the correct array');
-$downloadedPlugins =
array_values($sympalConfiguration->getDownloadedPlugins());
-sort($downloadedPlugins); // sort the plugins - don't depend on file system to
return with consistent order
-$t->is($downloadedPlugins, array(
+$installedPlugins = array_values($sympalConfiguration->getInstalledPlugins());
+sort($installedPlugins); // sort the plugins - don't depend on file system to
return with consistent order
+$t->is($installedPlugins, array(
'sfSympalBlogPlugin',
'sfSympalCommentsPlugin',
'sfSympalThemeTestPlugin'
-), '->getDownloadedPlugins() returns the correct array of downloaded, non-core
plugins');
+), '->getInstalledPlugins() returns the correct array of installed, non-core
plugins');
-$downloadablePlugins = $sympalConfiguration->getDownloadablePlugins();
-$t->is(in_array('sfSympalBlogPlugin', $downloadablePlugins), true,
'->getDownloadablePlugins() returns an array which includes
sfSympalBlogPlugin');
-$t->is(in_array('sfSympalJwageThemePlugin', $downloadablePlugins), true,
'->getDownloadablePlugins() returns an array which includes
sfSympalJwageThemePlugin');
+$addonPlugins = $sympalConfiguration->getAddonPlugins();
+$t->is(in_array('sfSympalBlogPlugin', $addonPlugins), true,
'->getAddonPlugins() returns an array which includes sfSympalBlogPlugin');
+$t->is(in_array('sfSympalJwageThemePlugin', $addonPlugins), true,
'->getAddonPlugins() returns an array which includes sfSympalJwageThemePlugin');
-$pluginPaths = $sympalConfiguration->getPluginPaths();
-$t->is($pluginPaths['sfSympalPlugin'],
$sympalPluginConfiguration->getRootDir(), '->getRootDir() returns the root path
to sfSympalPlugin');
-
-$contentTypePlugins = $sympalConfiguration->getContentTypePlugins();
-$t->is($contentTypePlugins, array(
+$otherPlugins = array_values($sympalConfiguration->getOtherPlugins());
+sort($otherPlugins); // sort the plugins - don't depend on file system to
return with consistent order
+$t->is($otherPlugins, array(
'sfSympalBlogPlugin',
- 'sfSympalPagesPlugin',
- 'sfSympalContentListPlugin'
-), '->getContentTypePlugins() returns the correct array of plugins with
content typed defined');
+ 'sfSympalCommentsPlugin',
+ 'sfSympalThemeTestPlugin'
+), '->getOtherPlugins() returns the correct array of installed, non-core
plugins (equivalent to getInstalledPlugins())');
-$allManageablePlugins = $sympalConfiguration->getAllManageablePlugins();
-$t->is(in_array('sfSympalBlogPlugin', $allManageablePlugins), true,
'->getAllManageablePlugins() returns the correct array of plugins');
+$pluginPaths = $sympalConfiguration->getPluginPaths();
+$t->is($pluginPaths['sfSympalPlugin'],
$sympalPluginConfiguration->getRootDir(), '->getRootDir() returns the root path
to sfSympalPlugin');
+
$modules = $sympalConfiguration->getModules();
$t->is(in_array('sympal_content_renderer', $modules), true, '->getModules()
returns an array with sympal_content_renderer as an entry');
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.