Skip to content

Commit

Permalink
Refs #4208 Move Plugin classes to core/Plugin for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Oct 10, 2013
1 parent 13b35fa commit b6a4d25
Show file tree
Hide file tree
Showing 65 changed files with 84 additions and 102 deletions.
1 change: 1 addition & 0 deletions core/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Exception;
use Piwik\API\Request;
use Piwik\API\ResponseBuilder;
use Piwik\Plugin\Controller;
use Piwik\Session;

/**
Expand Down
5 changes: 0 additions & 5 deletions core/Menu/MenuAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ abstract class MenuAbstract
protected $renames = array();
protected $orderingApplied = false;

/*
* Can't enforce static function in 5.2.
*/
//abstract static public function getInstance();

/**
* Builds the menu, applies edits, renames
* and orders the entries.
Expand Down
5 changes: 3 additions & 2 deletions core/PluginsArchiver.php → core/Plugin/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
* @package Piwik_PluginArchiver
*/

namespace Piwik;
namespace Piwik\Plugin;

use Piwik\ArchiveProcessor;
use Piwik\Config;

/**
* Plugins that archive metrics for websites can implement an Archiver that extends this class
*/
abstract class PluginsArchiver
abstract class Archiver
{
protected $processor;

Expand Down
13 changes: 12 additions & 1 deletion core/Controller.php → core/Plugin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,30 @@
* @category Piwik
* @package Piwik
*/
namespace Piwik;
namespace Piwik\Plugin;

use Exception;
use Piwik\Access;
use Piwik\API\Request;
use Piwik\Common;
use Piwik\Config;
use Piwik\DataTable\Filter\CalculateEvolutionFilter;
use Piwik\Date;
use Piwik\FrontController;
use Piwik\Menu\MenuTop;
use Piwik\NoAccessException;
use Piwik\Period\Month;
use Piwik\Period;
use Piwik\Period\Range;
use Piwik\Piwik;
use Piwik\Plugins\API\API;
use Piwik\Plugins\LanguagesManager\LanguagesManager;
use Piwik\Plugins\SitesManager\API as APISitesManager;
use Piwik\Plugins\UsersManager\API as APIUsersManager;
use Piwik\Registry;
use Piwik\SettingsPiwik;
use Piwik\Site;
use Piwik\Url;
use Piwik\View;
use Piwik\ViewDataTable;

Expand Down
5 changes: 2 additions & 3 deletions core/Controller/Admin.php → core/Plugin/ControllerAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
* @category Piwik
* @package Piwik
*/
namespace Piwik\Controller;
namespace Piwik\Plugin;

use Piwik\Config;
use Piwik\Controller;
use Piwik\Menu\MenuAdmin;
use Piwik\Menu\MenuTop;
use Piwik\Piwik;
Expand All @@ -27,7 +26,7 @@
*
* @api
*/
abstract class Admin extends Controller
abstract class ControllerAdmin extends Controller
{
/**
* Set the minimal variables in the view object
Expand Down
13 changes: 6 additions & 7 deletions core/PluginsManager.php → core/Plugin/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
* @package Piwik
*/

namespace Piwik;
namespace Piwik\Plugin;

use Piwik\Plugin\MetadataLoader;
use Piwik\Translate;

require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php';
Expand All @@ -20,9 +19,9 @@
* Plugin manager
*
* @package Piwik
* @subpackage PluginsManager
* @subpackage Manager
*/
class PluginsManager
class Manager
{
protected $pluginsToLoad = array();

Expand Down Expand Up @@ -67,9 +66,9 @@ class PluginsManager
static private $instance = null;

/**
* Returns the singleton PluginsManager
* Returns the singleton Manager
*
* @return PluginsManager
* @return Manager
*/
static public function getInstance()
{
Expand Down Expand Up @@ -873,7 +872,7 @@ private function removePluginFromTrackerConfig($pluginName)

/**
* @package Piwik
* @subpackage PluginsManager
* @subpackage Manager
*/
class PluginsManager_PluginException extends \Exception
{
Expand Down
2 changes: 1 addition & 1 deletion piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@ignore_user_abort(true);

require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/PluginsManager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Manager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php';
require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php';
Expand Down
2 changes: 1 addition & 1 deletion plugins/API/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @package Piwik_API
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
function index()
{
Expand Down
3 changes: 1 addition & 2 deletions plugins/Actions/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Piwik\DataTable\Row\DataTableSummaryRow;
use Piwik\DataTable;
use Piwik\Metrics;
use Piwik\PluginsArchiver;
use Piwik\RankingQuery;
use Piwik\Tracker\Action;

Expand All @@ -24,7 +23,7 @@
*
* @package Actions
*/
class Archiver extends PluginsArchiver
class Archiver extends \Piwik\Plugin\Archiver
{
const DOWNLOADS_RECORD_NAME = 'Actions_downloads';
const OUTLINKS_RECORD_NAME = 'Actions_outlink';
Expand Down
2 changes: 1 addition & 1 deletion plugins/Actions/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @package Actions
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
//
// Actions that render whole pages
Expand Down
2 changes: 1 addition & 1 deletion plugins/Annotations/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @package Annotations
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
/**
* Controller action that returns HTML displaying annotations for a site and
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreAdminHome/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @package CoreAdminHome
*/
class Controller extends \Piwik\Controller\Admin
class Controller extends \Piwik\Plugin\ControllerAdmin
{
const LOGO_HEIGHT = 300;
const LOGO_SMALL_HEIGHT = 100;
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreConsole/templates/controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @package PLUGINNAME
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{

public function index()
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @package CoreHome
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
function getDefaultAction()
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/CorePluginsAdmin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @package CorePluginsAdmin
*/
class Controller extends \Piwik\Controller\Admin
class Controller extends Plugin\ControllerAdmin
{
const UPDATE_NONCE = 'CorePluginsAdmin.updatePlugin';
const INSTALL_NONCE = 'CorePluginsAdmin.installPlugin';
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreUpdater/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
* @package CoreUpdater
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
const CONFIG_FILE_BACKUP = '/config/global.ini.auto-backup-before-update.php';
const PATH_TO_EXTRACT_LATEST_VERSION = '/tmp/latest/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph;

use Piwik\Common;
use Piwik\Controller;
use Piwik\Period\Range;
use Piwik\Plugin\Controller;
use Piwik\Plugins\CoreVisualizations\JqplotDataGenerator;
use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph;
use Piwik\Site;
Expand Down
5 changes: 2 additions & 3 deletions plugins/CustomVariables/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@

use Piwik\Common;
use Piwik\Config;
use Piwik\DataAccess\LogAggregator;

use Piwik\DataAccess\LogAggregator;
use Piwik\DataArray;
use Piwik\Metrics;
use Piwik\PluginsArchiver;
use Piwik\Tracker;
use Piwik\Tracker\GoalManager;

class Archiver extends PluginsArchiver
class Archiver extends \Piwik\Plugin\Archiver
{
const LABEL_CUSTOM_VALUE_NOT_DEFINED = "Value not defined";
const CUSTOM_VARIABLE_RECORD_NAME = 'CustomVariables_valueByName';
Expand Down
2 changes: 1 addition & 1 deletion plugins/CustomVariables/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @package CustomVariables
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
public function index($fetch = false)
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/DBStats/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @package DBStats
*/
class Controller extends \Piwik\Controller\Admin
class Controller extends \Piwik\Plugin\ControllerAdmin
{
/**
* Returns the index for this plugin. Shows every other report defined by this plugin,
Expand Down
2 changes: 1 addition & 1 deletion plugins/Dashboard/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @package Dashboard
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
/**
* @var Dashboard
Expand Down
3 changes: 1 addition & 2 deletions plugins/DevicesDetection/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
namespace Piwik\Plugins\DevicesDetection;

use Piwik\Metrics;
use Piwik\PluginsArchiver;

class Archiver extends PluginsArchiver
class Archiver extends \Piwik\Plugin\Archiver
{
const DEVICE_TYPE_RECORD_NAME = 'DevicesDetection_types';
const DEVICE_BRAND_RECORD_NAME = 'DevicesDetection_brands';
Expand Down
2 changes: 1 addition & 1 deletion plugins/DevicesDetection/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Piwik\ViewDataTable;
use UserAgentParserEnhanced;

class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
public function index($fetch = false)
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/ExamplePlugin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @package ExamplePlugin
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
/**
* Go to /piwik/?module=ExamplePlugin&action=helloWorld to execute this method
Expand Down
2 changes: 1 addition & 1 deletion plugins/ExampleRssWidget/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @package ExampleRssWidget
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
public function rssPiwik()
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/ExampleUI/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @package ExampleUI
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
public function dataTables()
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/Feedback/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @package Feedback
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
function index()
{
Expand Down
4 changes: 1 addition & 3 deletions plugins/Goals/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
use Piwik\DataArray;
use Piwik\DataTable;
use Piwik\Metrics;
use Piwik\PluginsArchiver;
use Piwik\PluginsManager;
use Piwik\Tracker\GoalManager;

class Archiver extends PluginsArchiver
class Archiver extends \Piwik\Plugin\Archiver
{
const VISITS_UNTIL_RECORD_NAME = 'visits_until_conv';
const DAYS_UNTIL_CONV_RECORD_NAME = 'days_until_conv';
Expand Down
2 changes: 1 addition & 1 deletion plugins/Goals/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @package Goals
*/
class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
const CONVERSION_RATE_PRECISION = 1;

Expand Down
2 changes: 1 addition & 1 deletion plugins/ImageGraph/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Piwik\SettingsPiwik;
use Piwik\View;

class Controller extends \Piwik\Controller
class Controller extends \Piwik\Plugin\Controller
{
// Call metadata reports, and draw the default graph for each report.
public function index()
Expand Down
2 changes: 1 addition & 1 deletion plugins/ImageGraph/ImageGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getReportMetadata(&$reports, $info)
$dateForMultiplePeriodGraph = $dateForSinglePeriodGraph;
} else {
$periodForMultiplePeriodGraph = $periodForSinglePeriodGraph;
$dateForMultiplePeriodGraph = \Piwik\Controller::getDateRangeRelativeToEndDate(
$dateForMultiplePeriodGraph = \Piwik\Plugin\Controller::getDateRangeRelativeToEndDate(
$periodForSinglePeriodGraph,
'last' . self::GRAPH_EVOLUTION_LAST_PERIODS,
$dateForSinglePeriodGraph,
Expand Down
2 changes: 1 addition & 1 deletion plugins/Installation/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
* @package Installation
*/
class Controller extends \Piwik\Controller\Admin
class Controller extends \Piwik\Plugin\ControllerAdmin
{
// public so plugins can add/delete installation steps
public $steps = array(
Expand Down
Loading

0 comments on commit b6a4d25

Please sign in to comment.