forked from matomo-org/matomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:piwik/piwik
- Loading branch information
Showing
44 changed files
with
673 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugin; | ||
|
||
use Piwik\WidgetsList; | ||
|
||
/** | ||
* Base class of all plugin widget providers. Plugins that define their own widgets can extend this class to easily | ||
* add new widgets, to remove or to rename existing items. | ||
* | ||
* For an example, see the {@link https://github.com/piwik/piwik/blob/master/plugins/ExampleRssWidget/Widget.php} plugin. | ||
* | ||
* @api | ||
*/ | ||
class Widgets | ||
{ | ||
/** | ||
* Configures the widgets. Here you can for instance add or remove widgets. | ||
*/ | ||
public function configure(WidgetsList $widgetsList) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\Actions; | ||
|
||
use Piwik\WidgetsList; | ||
|
||
class Widgets extends \Piwik\Plugin\Widgets | ||
{ | ||
|
||
public function configure(WidgetsList $widgetsList) | ||
{ | ||
$category = 'General_Actions'; | ||
$controller = 'Actions'; | ||
|
||
$widgetsList->add($category, 'General_Pages', $controller, 'getPageUrls'); | ||
$widgetsList->add($category, 'Actions_WidgetPageTitles', $controller, 'getPageTitles'); | ||
$widgetsList->add($category, 'General_Outlinks', $controller, 'getOutlinks'); | ||
$widgetsList->add($category, 'General_Downloads', $controller, 'getDownloads'); | ||
$widgetsList->add($category, 'Actions_WidgetPagesEntry', $controller, 'getEntryPageUrls'); | ||
$widgetsList->add($category, 'Actions_WidgetPagesExit', $controller, 'getExitPageUrls'); | ||
$widgetsList->add($category, 'Actions_WidgetEntryPageTitles', $controller, 'getEntryPageTitles'); | ||
$widgetsList->add($category, 'Actions_WidgetExitPageTitles', $controller, 'getExitPageTitles'); | ||
|
||
$actions = new Actions(); | ||
if ($actions->isSiteSearchEnabled()) { | ||
$this->addSearchWidgets($widgetsList, $controller); | ||
} | ||
} | ||
|
||
private function addSearchWidgets(WidgetsList $widgetsList, $controller) | ||
{ | ||
$category = 'Actions_SubmenuSitesearch'; | ||
|
||
$widgetsList->add($category, 'Actions_WidgetSearchKeywords', $controller, 'getSiteSearchKeywords'); | ||
|
||
if (Actions::isCustomVariablesPluginsEnabled()) { | ||
$widgetsList->add($category, 'Actions_WidgetSearchCategories', $controller, 'getSiteSearchCategories'); | ||
} | ||
|
||
$widgetsList->add($category, 'Actions_WidgetSearchNoResultKeywords', $controller, 'getSiteSearchNoResultKeywords'); | ||
$widgetsList->add($category, 'Actions_WidgetPageUrlsFollowingSearch', $controller, 'getPageUrlsFollowingSiteSearch'); | ||
$widgetsList->add($category, 'Actions_WidgetPageTitlesFollowingSearch', $controller, 'getPageTitlesFollowingSiteSearch'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
|
||
namespace Piwik\Plugins\CoreConsole\Commands; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
*/ | ||
class GenerateWidget extends GeneratePluginBase | ||
{ | ||
protected function configure() | ||
{ | ||
$this->setName('generate:widget') | ||
->setDescription('Adds a plugin widget class to an existing plugin') | ||
->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have any widgets defined yet'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$pluginName = $this->getPluginName($input, $output); | ||
|
||
$exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExamplePlugin'; | ||
$replace = array('ExampleRssWidget' => $pluginName); | ||
$whitelistFiles = array('/Widgets.php'); | ||
|
||
$this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles); | ||
|
||
$this->writeSuccessMessage($output, array( | ||
sprintf('Widgets.php for %s generated.', $pluginName), | ||
'You can now start defining your plugin widgets', | ||
'Enjoy!' | ||
)); | ||
} | ||
|
||
/** | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* @return array | ||
* @throws \RunTimeException | ||
*/ | ||
protected function getPluginName(InputInterface $input, OutputInterface $output) | ||
{ | ||
$pluginNames = $this->getPluginNamesHavingNotSpecificFile('Widgets.php'); | ||
$invalidName = 'You have to enter the name of an existing plugin which does not already have any widgets defined'; | ||
|
||
return $this->askPluginNameAndValidate($input, $output, $pluginNames, $invalidName); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
*/ | ||
namespace Piwik\Plugins\CoreHome; | ||
|
||
use Piwik\WidgetsList; | ||
|
||
class Widgets extends \Piwik\Plugin\Widgets | ||
{ | ||
public function configure(WidgetsList $widgetsList) | ||
{ | ||
$category = 'Example Widgets'; | ||
$controller = 'CoreHome'; | ||
|
||
$widgetsList->add($category, 'CoreHome_SupportPiwik', $controller, 'getDonateForm'); | ||
$widgetsList->add($category, 'Installation_Welcome', $controller, 'getPromoVideo'); | ||
} | ||
|
||
} |
Oops, something went wrong.