activate() публичный Метод

Activates DoNotTrack header checking. This function will not be called by the Tracker.
public activate ( )
Пример #1
0
 static function update()
 {
     $errors = array();
     try {
         $checker = new DoNotTrackHeaderChecker();
         // enable DoNotTrack check in PrivacyManager if DoNotTrack plugin was enabled
         if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('DoNotTrack')) {
             $checker->activate();
         }
         // enable IP anonymization if AnonymizeIP plugin was enabled
         if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('AnonymizeIP')) {
             IPAnonymizer::activate();
         }
     } catch (\Exception $ex) {
         // pass
     }
     // disable & delete old plugins
     $oldPlugins = array('DoNotTrack', 'AnonymizeIP');
     foreach ($oldPlugins as $plugin) {
         try {
             \Piwik\Plugin\Manager::getInstance()->deactivatePlugin($plugin);
         } catch (\Exception $e) {
         }
         $dir = PIWIK_INCLUDE_PATH . "/plugins/{$plugin}";
         if (file_exists($dir)) {
             Filesystem::unlinkRecursive($dir, true);
         }
         if (file_exists($dir)) {
             $errors[] = "Please delete this directory manually (eg. using your FTP software): {$dir} \n";
         }
     }
     if (!empty($errors)) {
         throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
     }
 }
Пример #2
0
 /**
  * @internal
  */
 public function activateDoNotTrack()
 {
     Piwik::checkUserHasSuperUserAccess();
     $dntChecker = new DoNotTrackHeaderChecker();
     $dntChecker->activate();
     return true;
 }
Пример #3
0
 public function activateDoNotTrack()
 {
     Piwik::checkUserHasSuperUserAccess();
     Nonce::checkNonce(self::ACTIVATE_DNT_NONCE);
     DoNotTrackHeaderChecker::activate();
     $this->redirectToIndex('PrivacyManager', 'privacySettings');
 }
Пример #4
0
 /**
  * Process the submit on the Installation "default settings" form.
  *
  * @param FormDefaultSettings $form
  */
 public function installationFormSubmit(FormDefaultSettings $form)
 {
     $doNotTrack = (bool) $form->getSubmitValue('do_not_track');
     $dntChecker = new DoNotTrackHeaderChecker();
     if ($doNotTrack) {
         $dntChecker->activate();
     } else {
         $dntChecker->deactivate();
     }
     $anonymiseIp = (bool) $form->getSubmitValue('anonymise_ip');
     if ($anonymiseIp) {
         IPAnonymizer::activate();
     } else {
         IPAnonymizer::deactivate();
     }
 }