PDF rausgenommen
This commit is contained in:
29
msd2/tracking/piwik/plugins/Marketplace/Input/Mode.php
Normal file
29
msd2/tracking/piwik/plugins/Marketplace/Input/Mode.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Marketplace\Input;
|
||||
use Piwik\Common;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Mode
|
||||
{
|
||||
|
||||
public function getMode()
|
||||
{
|
||||
$mode = Common::getRequestVar('mode', 'admin', 'string');
|
||||
|
||||
if (!in_array($mode, array('user', 'admin'))) {
|
||||
$mode = 'admin';
|
||||
}
|
||||
|
||||
return $mode;
|
||||
}
|
||||
|
||||
}
|
42
msd2/tracking/piwik/plugins/Marketplace/Input/PluginName.php
Normal file
42
msd2/tracking/piwik/plugins/Marketplace/Input/PluginName.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Marketplace\Input;
|
||||
use Piwik\Common;
|
||||
use Piwik\Plugin;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
*/
|
||||
class PluginName
|
||||
{
|
||||
private $requestParam = '';
|
||||
|
||||
public function __construct($requestParam = 'pluginName')
|
||||
{
|
||||
$this->requestParam = $requestParam;
|
||||
}
|
||||
|
||||
public function getPluginName()
|
||||
{
|
||||
$pluginName = Common::getRequestVar($this->requestParam, null, 'string');
|
||||
|
||||
$this->dieIfPluginNameIsInvalid($pluginName);
|
||||
|
||||
return $pluginName;
|
||||
}
|
||||
|
||||
private function dieIfPluginNameIsInvalid($pluginName)
|
||||
{
|
||||
if (!Plugin\Manager::getInstance()->isValidPluginName($pluginName)){
|
||||
throw new Exception('Invalid plugin name given');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Marketplace\Input;
|
||||
|
||||
/**
|
||||
*/
|
||||
class PurchaseType
|
||||
{
|
||||
const TYPE_FREE = 'free';
|
||||
const TYPE_PAID = 'paid';
|
||||
const TYPE_ALL = '';
|
||||
|
||||
}
|
41
msd2/tracking/piwik/plugins/Marketplace/Input/Sort.php
Normal file
41
msd2/tracking/piwik/plugins/Marketplace/Input/Sort.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Marketplace\Input;
|
||||
use Piwik\Common;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Sort
|
||||
{
|
||||
const METHOD_POPULAR = 'popular';
|
||||
const METHOD_ALPHA = 'alpha';
|
||||
const METHOD_LAST_UPDATED = 'lastupdated';
|
||||
const METHOD_NEWEST = 'newest';
|
||||
const DEFAULT_SORT = self::METHOD_LAST_UPDATED;
|
||||
|
||||
public function getSort()
|
||||
{
|
||||
$sort = Common::getRequestVar('sort', self::DEFAULT_SORT, 'string');
|
||||
|
||||
if (!$this->isValidSortMethod($sort)) {
|
||||
$sort = self::DEFAULT_SORT;
|
||||
}
|
||||
|
||||
return $sort;
|
||||
}
|
||||
|
||||
private function isValidSortMethod($sortMethod)
|
||||
{
|
||||
$valid = array(self::METHOD_POPULAR, self::METHOD_NEWEST, self::METHOD_ALPHA);
|
||||
|
||||
return in_array($sortMethod, $valid, $strict = true);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user