update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
9abe039dc8
commit
47263617c5
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -8,35 +8,17 @@
|
|||
*/
|
||||
namespace Piwik\Plugins\SegmentEditor;
|
||||
|
||||
use Exception;
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Db;
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Version;
|
||||
|
||||
/**
|
||||
*/
|
||||
class SegmentEditor extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getInformation
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function getInformation()
|
||||
{
|
||||
return array(
|
||||
'description' => 'Create and reuse custom visitor Segments with the Segment Editor.',
|
||||
'authors' => array(array('name' => 'Piwik', 'homepage' => 'http://piwik.org/')),
|
||||
'version' => Version::VERSION,
|
||||
'license' => 'GPL v3+',
|
||||
'license_homepage' => 'http://www.gnu.org/licenses/gpl.html'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
public function registerEvents()
|
||||
{
|
||||
return array(
|
||||
'Segments.getKnownSegmentsToArchiveForSite' => 'getKnownSegmentsToArchiveForSite',
|
||||
|
|
@ -44,13 +26,14 @@ class SegmentEditor extends \Piwik\Plugin
|
|||
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
'Template.nextToCalendar' => 'getSegmentEditorHtml',
|
||||
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
|
||||
);
|
||||
}
|
||||
|
||||
function getSegmentEditorHtml(&$out)
|
||||
{
|
||||
$controller = new Controller();
|
||||
$out .= $controller->getSelector();
|
||||
$selector = new SegmentSelectorControl();
|
||||
$out .= $selector->render();
|
||||
}
|
||||
|
||||
public function getKnownSegmentsToArchiveAllSites(&$segments)
|
||||
|
|
@ -69,27 +52,17 @@ class SegmentEditor extends \Piwik\Plugin
|
|||
{
|
||||
$model = new Model();
|
||||
$segmentToAutoArchive = $model->getSegmentsToAutoArchive($idSite);
|
||||
|
||||
foreach ($segmentToAutoArchive as $segmentInfo) {
|
||||
$segments[] = $segmentInfo['definition'];
|
||||
}
|
||||
|
||||
$segments = array_unique($segments);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$segmentTable = "`idsegment` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`definition` TEXT NOT NULL,
|
||||
`login` VARCHAR(100) NOT NULL,
|
||||
`enable_all_users` tinyint(4) NOT NULL default 0,
|
||||
`enable_only_idsite` INTEGER(11) NULL,
|
||||
`auto_archive` tinyint(4) NOT NULL default 0,
|
||||
`ts_created` TIMESTAMP NULL,
|
||||
`ts_last_edit` TIMESTAMP NULL,
|
||||
`deleted` tinyint(4) NOT NULL default 0,
|
||||
PRIMARY KEY (`idsegment`)";
|
||||
|
||||
DbHelper::createTable('segment', $segmentTable);
|
||||
Model::install();
|
||||
}
|
||||
|
||||
public function getJsFiles(&$jsFiles)
|
||||
|
|
@ -101,4 +74,21 @@ class SegmentEditor extends \Piwik\Plugin
|
|||
{
|
||||
$stylesheets[] = "plugins/SegmentEditor/stylesheets/segmentation.less";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether adding segments for all websites is enabled or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAddingSegmentsForAllWebsitesEnabled()
|
||||
{
|
||||
return Config::getInstance()->General['allow_adding_segments_for_all_websites'] == 1;
|
||||
}
|
||||
|
||||
public function getClientSideTranslationKeys(&$translationKeys)
|
||||
{
|
||||
$translationKeys[] = 'SegmentEditor_CustomSegment';
|
||||
$translationKeys[] = 'SegmentEditor_VisibleToSuperUser';
|
||||
$translationKeys[] = 'SegmentEditor_SharedWithYou';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue