diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/View | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/View')
-rw-r--r-- | core/View/Interface.php | 16 | ||||
-rw-r--r-- | core/View/OneClickDone.php | 74 | ||||
-rw-r--r-- | core/View/ReportsByDimension.php | 175 |
3 files changed, 131 insertions, 134 deletions
diff --git a/core/View/Interface.php b/core/View/Interface.php index c1861a1216..1998ead861 100644 --- a/core/View/Interface.php +++ b/core/View/Interface.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package Piwik */ @@ -16,10 +16,10 @@ */ interface Piwik_View_Interface { - /** - * Outputs the data. - * - * @return mixed (image, array, html...) - */ - function render(); + /** + * Outputs the data. + * + * @return mixed (image, array, html...) + */ + function render(); } diff --git a/core/View/OneClickDone.php b/core/View/OneClickDone.php index 5ed1111718..bafebb7085 100644 --- a/core/View/OneClickDone.php +++ b/core/View/OneClickDone.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package Piwik */ @@ -23,46 +23,46 @@ */ class Piwik_View_OneClickDone { - /** - * @var string - */ - private $tokenAuth; + /** + * @var string + */ + private $tokenAuth; - /** - * @var string - */ - public $coreError; + /** + * @var string + */ + public $coreError; - /** - * @var array - */ - public $feedbackMessages; + /** + * @var array + */ + public $feedbackMessages; - public function __construct($tokenAuth) - { - $this->tokenAuth = $tokenAuth; - } + public function __construct($tokenAuth) + { + $this->tokenAuth = $tokenAuth; + } - /** - * Outputs the data. - * - * @return string html - */ - public function render() - { - // set response headers - @header('Content-Type: text/html; charset=UTF-8'); - @header('Pragma: '); - @header('Expires: '); - @header('Cache-Control: must-revalidate'); - @header('X-Frame-Options: deny'); + /** + * Outputs the data. + * + * @return string html + */ + public function render() + { + // set response headers + @header('Content-Type: text/html; charset=UTF-8'); + @header('Pragma: '); + @header('Expires: '); + @header('Cache-Control: must-revalidate'); + @header('X-Frame-Options: deny'); - $error = htmlspecialchars($this->coreError, ENT_QUOTES, 'UTF-8'); - $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8'); - $tokenAuth = $this->tokenAuth; + $error = htmlspecialchars($this->coreError, ENT_QUOTES, 'UTF-8'); + $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8'); + $tokenAuth = $this->tokenAuth; - // use a heredoc instead of an external file - echo <<<END_OF_TEMPLATE + // use a heredoc instead of an external file + echo <<<END_OF_TEMPLATE <!DOCTYPE html> <html> <head> @@ -85,5 +85,5 @@ class Piwik_View_OneClickDone </body> </html> END_OF_TEMPLATE; - } + } } diff --git a/core/View/ReportsByDimension.php b/core/View/ReportsByDimension.php index 3c6919fbb5..e02d428af6 100644 --- a/core/View/ReportsByDimension.php +++ b/core/View/ReportsByDimension.php @@ -1,107 +1,104 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ /** * A facade that makes it easier to use the 'reports_by_dimension.tpl' template. - * + * * This view will output HTML that displays a list of report names by category and * loads them by AJAX when clicked. The loaded report is displayed to the right * of the report listing. */ class Piwik_View_ReportsByDimension extends Piwik_View { - /** - * Constructor. - */ - public function __construct() - { - parent::__construct(PIWIK_INCLUDE_PATH.'/plugins/CoreHome/templates/reports_by_dimension.tpl'); - $this->dimensionCategories = array(); - } - - /** - * Adds a report to the list of reports to display. - * - * @param string $category The report's category. Can be a i18n token. - * @param string $title The report's title. Can be a i18n token. - * @param string $action The controller action used to load the report, ie, Referrers.getAll - * @param array $params The list of query parameters to use when loading the report. - * This list overrides query parameters currently in use. For example, - * array('idSite' => 2, 'viewDataTable' => 'goalsTable') - * would mean the goals report for site w/ ID=2 will always be loaded. - */ - public function addReport( $category, $title, $action, $params = array() ) - { - list($module, $action) = explode('.', $action); - $params = array('module' => $module, 'action' => $action) + $params; - - $categories = $this->dimensionCategories; - $categories[$category][] = array( - 'title' => $title, - 'params' => $params, - 'url' => Piwik_Url::getCurrentQueryStringWithParametersModified($params) - ); - $this->dimensionCategories = $categories; - } - - /** - * Adds a set of reports to the list of reports to display. - * - * @param array $reports An array containing report information. The array requires - * the 'category', 'title', 'action' and 'params' elements. - * For information on what they should contain, @see addReport. - */ - public function addReports( $reports ) - { - foreach ($reports as $report) - { - $this->addReport($report['category'], $report['title'], $report['action'], $report['params']); - } - } - - /** - * Renders this view. - * - * @return string The rendered view. - */ - public function render() - { - $this->firstReport = ""; - - // if there are reports & report categories added, render the first one so we can - // display it initially - $categories = $this->dimensionCategories; - if (!empty($categories)) - { - $firstCategory = reset($categories); - $firstReportInfo = reset($firstCategory); - - $oldGet = $_GET; - $oldPost = $_POST; - - foreach ($firstReportInfo['params'] as $key => $value) - { - $_GET[$key] = $value; - } - - $_POST = array(); - - $module = $firstReportInfo['params']['module']; - $action = $firstReportInfo['params']['action']; - $this->firstReport = Piwik_FrontController::getInstance()->fetchDispatch($module, $action); - - $_GET = $oldGet; - $_POST = $oldPost; - } - - return parent::render(); - } + /** + * Constructor. + */ + public function __construct() + { + parent::__construct(PIWIK_INCLUDE_PATH . '/plugins/CoreHome/templates/reports_by_dimension.tpl'); + $this->dimensionCategories = array(); + } + + /** + * Adds a report to the list of reports to display. + * + * @param string $category The report's category. Can be a i18n token. + * @param string $title The report's title. Can be a i18n token. + * @param string $action The controller action used to load the report, ie, Referrers.getAll + * @param array $params The list of query parameters to use when loading the report. + * This list overrides query parameters currently in use. For example, + * array('idSite' => 2, 'viewDataTable' => 'goalsTable') + * would mean the goals report for site w/ ID=2 will always be loaded. + */ + public function addReport($category, $title, $action, $params = array()) + { + list($module, $action) = explode('.', $action); + $params = array('module' => $module, 'action' => $action) + $params; + + $categories = $this->dimensionCategories; + $categories[$category][] = array( + 'title' => $title, + 'params' => $params, + 'url' => Piwik_Url::getCurrentQueryStringWithParametersModified($params) + ); + $this->dimensionCategories = $categories; + } + + /** + * Adds a set of reports to the list of reports to display. + * + * @param array $reports An array containing report information. The array requires + * the 'category', 'title', 'action' and 'params' elements. + * For information on what they should contain, @see addReport. + */ + public function addReports($reports) + { + foreach ($reports as $report) { + $this->addReport($report['category'], $report['title'], $report['action'], $report['params']); + } + } + + /** + * Renders this view. + * + * @return string The rendered view. + */ + public function render() + { + $this->firstReport = ""; + + // if there are reports & report categories added, render the first one so we can + // display it initially + $categories = $this->dimensionCategories; + if (!empty($categories)) { + $firstCategory = reset($categories); + $firstReportInfo = reset($firstCategory); + + $oldGet = $_GET; + $oldPost = $_POST; + + foreach ($firstReportInfo['params'] as $key => $value) { + $_GET[$key] = $value; + } + + $_POST = array(); + + $module = $firstReportInfo['params']['module']; + $action = $firstReportInfo['params']['action']; + $this->firstReport = Piwik_FrontController::getInstance()->fetchDispatch($module, $action); + + $_GET = $oldGet; + $_POST = $oldPost; + } + + return parent::render(); + } } |