isValidPluginName() public method

public isValidPluginName ( $pluginName )
Beispiel #1
0
 private function getPluginNameIfNonceValid($nonceName)
 {
     $nonce = Common::getRequestVar('nonce', null, 'string');
     if (!Nonce::verifyNonce($nonceName, $nonce)) {
         throw new \Exception(Piwik::translate('General_ExceptionNonceMismatch'));
     }
     Nonce::discardNonce($nonceName);
     $pluginName = Common::getRequestVar('pluginName', null, 'string');
     if (!$this->pluginManager->isValidPluginName($pluginName)) {
         throw new Exception('Invalid plugin name');
     }
     return $pluginName;
 }
Beispiel #2
0
 protected function initPluginModification($nonceName)
 {
     Piwik::checkUserHasSuperUserAccess();
     $nonce = Common::getRequestVar('nonce', null, 'string');
     if (!Nonce::verifyNonce($nonceName, $nonce)) {
         throw new \Exception($this->translator->translate('General_ExceptionNonceMismatch'));
     }
     Nonce::discardNonce($nonceName);
     $pluginName = Common::getRequestVar('pluginName', null, 'string');
     if (!$this->pluginManager->isValidPluginName($pluginName)) {
         throw new Exception('Invalid plugin name');
     }
     return $pluginName;
 }
Beispiel #3
0
 /**
  * @dataProvider getPluginNameProvider
  */
 public function test_isValidPluginName($expectedIsValid, $pluginName)
 {
     $valid = $this->manager->isValidPluginName($pluginName);
     $this->assertSame($expectedIsValid, $valid);
 }