Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-02-03 20:32:11 +0300
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-02-03 20:32:11 +0300
commitde467a3aa36d41ef62c8fadea166f2f0f0bd7e41 (patch)
tree22444f64d37ea6cb16a0c80937359a55b13d7481
parentbdc07badcc7355e73a93b823a09d1917f5d12532 (diff)
- plugins now run install() when first enabled
- fixed bug in menu - deactivating also deactivates the LogStats plugins
-rwxr-xr-xconfig/global.ini.php13
-rw-r--r--libs/jquery/superfish.js11
-rwxr-xr-xmodules/Config.php21
-rw-r--r--modules/FrontController.php10
-rw-r--r--modules/LogStats.php9
-rw-r--r--modules/PluginsManager.php76
-rw-r--r--plugins/Home/Controller.php2
-rw-r--r--plugins/Provider/Provider.php2
8 files changed, 114 insertions, 30 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 4f6a776488..459b76b709 100755
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -25,9 +25,8 @@ default = en
[Plugins]
Plugins[] = PluginsAdmin
-
-;Plugins[] = API
-;Plugins[] = Widgetize
+Plugins[] = API
+Plugins[] = Widgetize
Plugins[] = Home
Plugins[] = Actions
Plugins[] = Dashboard
@@ -44,11 +43,13 @@ Plugins[] = ExamplePlugin
Plugins[] = Login
Plugins[] = UsersManager
Plugins[] = SitesManager
-
Plugins[] = Installation
-[Plugins_LogStats]
-Plugins[] = Provider
+[PluginsInstalled]
+PluginsInstalled[] = Login
+PluginsInstalled[] = UsersManager
+PluginsInstalled[] = SitesManager
+PluginsInstalled[] = Installation
[Debug]
; if set to true, the archiving process will always be triggered, even if the archive has already been computed
diff --git a/libs/jquery/superfish.js b/libs/jquery/superfish.js
index 1d568831fe..a9557b63fd 100644
--- a/libs/jquery/superfish.js
+++ b/libs/jquery/superfish.js
@@ -36,7 +36,16 @@
if($(this).find('ul li').size() == 0)
{
//console.log('clicked sub menu');
+
+ // case we clicked the submenu
$.superfish.currentActiveMenu = $(this).parents('li');
+
+ // case we clicked the main menu with NO submenu
+ if($.superfish.currentActiveMenu.size() == 0)
+ {
+ //console.log('clicked main menu with no submenu');
+ $.superfish.currentActiveMenu = $(this);
+ }
}
else
{
@@ -63,12 +72,12 @@
if (!$$.is('.'+bcClass) ) {
menu.sfTimer=setTimeout(function(){
+ // if there is an active menu (a clicked menu)
if($.superfish.currentActiveMenu != 'init')
{
//console.log('showing '); console.log($.superfish.currentActiveMenu.html());
$.superfish.currentActiveMenu.siblings('.sfHover').removeClass('sfHover');
$.superfish.currentActiveMenu.showSuperfishUl().siblings().hideSuperfishUl();
-
}
else
{
diff --git a/modules/Config.php b/modules/Config.php
index 137721de2a..9ca8aeec9a 100755
--- a/modules/Config.php
+++ b/modules/Config.php
@@ -80,18 +80,31 @@ class Piwik_Config
// print("<pre>saving $section => ".var_export($arraySection,true)." <br>");
$configFile .= "[$section]\n";
+ echo "array section"; var_dump($arraySection);
+
foreach($arraySection as $name => $value)
{
- // kind of hack
- // if the value is a simple array
if(is_numeric($name))
{
- $name = $section."[]";
+ $name = $section;
+ $value = array($value);
+ }
+
+ if(is_array($value))
+ {
+ foreach($value as $currentValue)
+ {
+ $configFile .= $name."[] = $currentValue\n";
+ }
+ }
+ else
+ {
+ $configFile .= $name." = $value\n";
}
- $configFile .= "$name = $value\n";
}
$configFile .= "\n";
}
+
chdir($this->correctCwd);
file_put_contents($this->getDefaultUserConfigPath(), $configFile );
diff --git a/modules/FrontController.php b/modules/FrontController.php
index d1b9eee6bf..8e1ae0af63 100644
--- a/modules/FrontController.php
+++ b/modules/FrontController.php
@@ -266,11 +266,9 @@ class Piwik_FrontController
Piwik::prefixTable('log_profiling'),
);
-// Piwik::dropTables($doNotDrop);
-
- Piwik::createTables();
-
- Piwik_PluginsManager::getInstance()->installPlugins();
+ //Piwik::dropTables($doNotDrop);
+ //Piwik::createTables();
+ //Piwik_PluginsManager::getInstance()->installPlugins();
// Setup the auth object
Piwik_PostEvent('FrontController.authSetCredentials');
@@ -279,7 +277,7 @@ class Piwik_FrontController
$authAdapter = Zend_Registry::get('auth');
}
catch(Exception $e){
- throw new Exception("Object 'auth' cannot be found in the Registry. Maybe the Login plugin is not available?");
+ throw new Exception("Object 'auth' cannot be found in the Registry. Maybe the Login plugin is not enabled?");
}
// Perform the authentication query, saving the result
diff --git a/modules/LogStats.php b/modules/LogStats.php
index d4e488b92d..bc167b37f6 100644
--- a/modules/LogStats.php
+++ b/modules/LogStats.php
@@ -84,9 +84,12 @@ class Piwik_LogStats
private function initProcess()
{
- Piwik_PluginsManager::getInstance()->setPluginsToLoad(
- Piwik_LogStats_Config::getInstance()->Plugins_LogStats['Plugins']
- );
+ $pluginsLogStats = Piwik_LogStats_Config::getInstance()->Plugins_LogStats;
+ if(is_array($pluginsLogStats)
+ && count($pluginsLogStats) != 0)
+ {
+ Piwik_PluginsManager::getInstance()->setPluginsToLoad( $pluginsLogStats['Plugins_LogStats'] );
+ }
$saveStats = Piwik_LogStats_Config::getInstance()->LogStats['record_statistics'];
diff --git a/modules/PluginsManager.php b/modules/PluginsManager.php
index 782ebadd0c..f6f038e945 100644
--- a/modules/PluginsManager.php
+++ b/modules/PluginsManager.php
@@ -88,28 +88,78 @@ class Piwik_PluginsManager
public function deactivatePlugin($pluginName)
{
$plugins = $this->pluginsToLoad;
-
+
$key = array_search($pluginName,$plugins);
if($key !== false)
{
unset($plugins[$key]);
Zend_Registry::get('config')->Plugins = $plugins;
}
+
+ $pluginsLogStats = Zend_Registry::get('config')->Plugins_LogStats->Plugins_LogStats;
+ if(!is_null($pluginsLogStats))
+ {
+ $pluginsLogStats = $pluginsLogStats->toArray();
+ $key = array_search($pluginName,$pluginsLogStats);
+ if($key !== false)
+ {
+ unset($pluginsLogStats[$key]);
+ Zend_Registry::get('config')->Plugins_LogStats = $pluginsLogStats;
+ }
+ }
}
public function activatePlugin($pluginName)
{
+ $plugins = Zend_Registry::get('config')->Plugins->Plugins->toArray();
+ if(in_array($pluginName,$plugins))
+ {
+ throw new Exception("Plugin '$pluginName' already activated.");
+ }
+
$existingPlugins = $this->readPluginsDirectory();
+ if( array_search($pluginName,$existingPlugins) === false)
+ {
+ throw new Exception("Unable to find the plugin '$pluginName'.");
+ }
- if( array_search($pluginName,$existingPlugins) !== false)
+ $plugin = $this->loadPlugin($pluginName);
+
+ // is the plugin already installed or is it the first time we activate it?
+ $pluginsInstalled = Zend_Registry::get('config')->PluginsInstalled->PluginsInstalled->toArray();
+ if(!in_array($pluginName,$pluginsInstalled))
{
- $plugins = Zend_Registry::get('config')->Plugins->Plugins->toArray();
-
- $plugins[] = $pluginName;
+ $this->installPlugin($plugin);
+ $pluginsInstalled[] = $pluginName;
+ Zend_Registry::get('config')->PluginsInstalled = $pluginsInstalled;
+ }
+
+ $information = $plugin->getInformation();
+
+ // if the plugin is to be loaded during the statistics logging
+ if(isset($information['LogStatsPlugin'])
+ && $information['LogStatsPlugin'] === true)
+ {
+ $pluginsLogStats = Zend_Registry::get('config')->Plugins_LogStats->Plugins_LogStats;
+ if(is_null($pluginsLogStats))
+ {
+ $pluginsLogStats = array();
+ }
+ else
+ {
+ $pluginsLogStats = $pluginsLogStats->toArray();
+ }
+ $pluginsLogStats[] = $pluginName;
+
+ // the config file will automatically be saved with the new plugin
+ Zend_Registry::get('config')->Plugins_LogStats = $pluginsLogStats;
- $plugins = array_unique($plugins);
-// var_dump($plugins);exit;
- Zend_Registry::get('config')->Plugins = $plugins;
}
+
+ // we add the plugin to the list of activated plugins
+ $plugins[] = $pluginName;
+
+ // the config file will automatically be saved with the new plugin
+ Zend_Registry::get('config')->Plugins = $plugins;
}
public function setPluginsToLoad( array $pluginsToLoad )
@@ -172,6 +222,7 @@ class Piwik_PluginsManager
*/
public function loadPlugins()
{
+ $this->pluginsToLoad = array_unique($this->pluginsToLoad);
foreach($this->pluginsToLoad as $pluginName)
{
$newPlugin = $this->loadPlugin($pluginName);
@@ -226,6 +277,15 @@ class Piwik_PluginsManager
}
return $newPlugin;
}
+
+ public function installPlugin( Piwik_Plugin $plugin )
+ {
+ try{
+ $plugin->install();
+ } catch(Exception $e) {
+ throw new Exception("There was a problem installing the plugin ". $plugin->getName() . " = " . $e->getMessage() );
+ }
+ }
public function installPlugins()
{
diff --git a/plugins/Home/Controller.php b/plugins/Home/Controller.php
index 235f71eab7..2e86d3a116 100644
--- a/plugins/Home/Controller.php
+++ b/plugins/Home/Controller.php
@@ -34,7 +34,7 @@ class Piwik_Home_Controller extends Piwik_Controller
// date
$view->date = $this->strDate;
$oDate = new Piwik_Date($this->strDate);
- $view->prettyDate = $oDate->get("l jS F Y");
+ $view->prettyDate = $oDate->get("l j\<\s\u\p\>S\<\/\s\u\p\> F Y");
// period
$currentPeriod = Piwik_Common::getRequestVar('period');
diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php
index 0a2301c041..809f44b2c8 100644
--- a/plugins/Provider/Provider.php
+++ b/plugins/Provider/Provider.php
@@ -23,6 +23,7 @@ class Piwik_Provider extends Piwik_Plugin
'author' => 'Piwik',
'homepage' => 'http://piwik.org/',
'version' => '0.1',
+ 'LogStatsPlugin' => true, // this plugin must be loaded during the stats logging
);
return $info;
@@ -151,7 +152,6 @@ class Piwik_Provider extends Piwik_Plugin
}
-
// when the plugin is loaded during LogStats these functions are not defined
if(function_exists('Piwik_AddWidget'))
{