Skip to content

Instantly share code, notes, and snippets.

/ma.diff Secret

Created September 6, 2012 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4ac649c0f09aa79958c1 to your computer and use it in GitHub Desktop.
Save anonymous/4ac649c0f09aa79958c1 to your computer and use it in GitHub Desktop.
mobile analytics piwik plugin 1.8 update
diff --git a/Controller.php b/Controller.php
index 5a795a7..991dd7b 100644
--- a/Controller.php
+++ b/Controller.php
@@ -51,7 +51,7 @@ class Piwik_MobileAnalytics_Controller extends Piwik_Controller {
Piwik::checkUserIsSuperUser();
$view = Piwik_View::factory('settings');
if(!Piwik_MobileAnalytics::settingsExist()) Piwik_MobileAnalytics::createSettings();
- $view->config = Zend_Registry::get('config')->MobileAnalytics->toArray();
+ $view->config = Piwik_Config::getInstance()->MobileAnalytics;
$this->setBasicVariablesView($view);
$view->topMenu = Piwik_GetTopMenu();
$view->menu = Piwik_GetAdminMenu();
diff --git a/MobileAnalytics.php b/MobileAnalytics.php
index 531145d..ea52567 100644
--- a/MobileAnalytics.php
+++ b/MobileAnalytics.php
@@ -141,7 +141,7 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
}
function archivePeriod( $notification ){
- $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard;
+ $maximumRowsInDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
$archiveProcessing = $notification->getNotificationObject();
$archiveProcessing->archiveDataTable(array( 'MobileAnalytics_mobileDevices' ), null, $maximumRowsInDataTable);
$archiveProcessing->archiveDataTable(array( 'MobileAnalytics_mobileBrands' ), null, $maximumRowsInDataTable);
@@ -179,7 +179,7 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
$interestByProvider = $archiveProcessing->getArrayInterestForLabel($labelSQL);
$tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider);
$columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS;
- $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard;
+ $maximumRowsInDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
$archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation));
destroy($tableProvider);
}
@@ -189,7 +189,7 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
$tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider);
//$tableProvider->filter('ColumnCallbackDeleteRow', array('label', 'strlen'));
$columnToSortByBeforeTruncation = $sort_column;
- $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard;
+ $maximumRowsInDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
$archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation));
destroy($tableProvider);
}
@@ -205,6 +205,7 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
$visitorInfo =& $notification->getNotificationObject();
try {
$this->initTeraWurfl();
+
if($this->wurflObj->getDeviceCapability('is_wireless_device')){
if($this->wurflObj->getDeviceCapability('full_flash_support')){
$flash = "Flash Player";
@@ -300,14 +301,14 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
$out .= '</div>';
}
public static function trackerGetSetting($name){
- return Piwik_Tracker_Config::getInstance()->MobileAnalytics[$name];
+ return Piwik_Config::getInstance()->MobileAnalytics[$name];
}
/**
* Check if the MobileAnalytics settings exist
* @return bool MobileAnalytics settings exist
*/
public static function settingsExist(){
- if(!@isset(Zend_Registry::get('config')->MobileAnalytics->TeraWurflMode)){
+ if(!@isset(Piwik_Config::getInstance()->MobileAnalytics['TeraWurflMode'])){
return false;
}
return true;
@@ -317,7 +318,7 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
* @return void
*/
public static function createSettings(){
- $config = Zend_Registry::get('config');
+ $config = Piwik_Config::getInstance();
$config->MobileAnalytics = array(
"TeraWurflURL"=>"http://yourserver/Tera-WURFL/webservice.php",
"TeraWurflPath"=>"/var/www/html/TeraWurfl/TeraWurfl.php",
@@ -329,11 +330,9 @@ class Piwik_MobileAnalytics extends Piwik_Plugin{
public static function saveSetting($name,$value){
if(!self::settingsExist()) self::createSettings();
- $config = Zend_Registry::get('config');
- $mobile = $config->MobileAnalytics->toArray();
- $mobile[$name] = $value;
- $config->MobileAnalytics = $mobile;
- $config->__destruct();
- Piwik::createConfigObject();
+ $mobileConfig = Piwik_Config::getInstance()->MobileAnalytics;
+ $mobileConfig[$name] = $value;
+ Piwik_Config::getInstance()->MobileAnalytics = $mobileConfig;
+ Piwik_Config::getInstance()->forceSave();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment