示例#1
0
 /**
  * Loads all required data from Intl plugin
  */
 public function __construct()
 {
     $this->patternNumber = Piwik::translate('Intl_NumberFormatNumber');
     $this->patternCurrency = Piwik::translate('Intl_NumberFormatCurrency');
     $this->patternPercent = Piwik::translate('Intl_NumberFormatPercent');
     $this->symbolPlus = Piwik::translate('Intl_NumberSymbolPlus');
     $this->symbolMinus = Piwik::translate('Intl_NumberSymbolMinus');
     $this->symbolPercent = Piwik::translate('Intl_NumberSymbolPercent');
     $this->symbolGroup = Piwik::translate('Intl_NumberSymbolGroup');
     $this->symbolDecimal = Piwik::translate('Intl_NumberSymbolDecimal');
 }
示例#2
0
 /**
  * Get file integrity information (in PIWIK_INCLUDE_PATH).
  *
  * @return array(bool, string, ...) Return code (true/false), followed by zero or more error messages
  */
 public static function getFileIntegrityInformation()
 {
     $messages = array();
     $messages[] = true;
     $manifest = PIWIK_INCLUDE_PATH . '/config/manifest.inc.php';
     if (file_exists($manifest)) {
         require_once $manifest;
     }
     if (!class_exists('Piwik\\Manifest')) {
         $messages[] = Piwik::translate('General_WarningFileIntegrityNoManifest') . ' ' . Piwik::translate('General_WarningFileIntegrityNoManifestDeployingFromGit');
         return $messages;
     }
     $files = \Piwik\Manifest::$files;
     $hasMd5file = function_exists('md5_file');
     $hasMd5 = function_exists('md5');
     foreach ($files as $path => $props) {
         $file = PIWIK_INCLUDE_PATH . '/' . $path;
         if (!file_exists($file) || !is_readable($file)) {
             $messages[] = Piwik::translate('General_ExceptionMissingFile', $file);
         } else {
             if (filesize($file) != $props[0]) {
                 if (!$hasMd5 || in_array(substr($path, -4), array('.gif', '.ico', '.jpg', '.png', '.swf'))) {
                     // files that contain binary data (e.g., images) must match the file size
                     $messages[] = Piwik::translate('General_ExceptionFilesizeMismatch', array($file, $props[0], filesize($file)));
                 } else {
                     // convert end-of-line characters and re-test text files
                     $content = @file_get_contents($file);
                     $content = str_replace("\r\n", "\n", $content);
                     if (strlen($content) != $props[0] || @md5($content) !== $props[1]) {
                         $messages[] = Piwik::translate('General_ExceptionFilesizeMismatch', array($file, $props[0], filesize($file)));
                     }
                 }
             } else {
                 if ($hasMd5file && @md5_file($file) !== $props[1]) {
                     $messages[] = Piwik::translate('General_ExceptionFileIntegrity', $file);
                 }
             }
         }
     }
     if (count($messages) > 1) {
         $messages[0] = false;
     }
     if (!$hasMd5file) {
         $messages[] = Piwik::translate('General_WarningFileIntegrityNoMd5file');
     }
     return $messages;
 }
示例#3
0
 /**
  * Removes one or more widgets from the widget list.
  * 
  * @param string $widgetCategory The widget category. Can be a translation token.
  * @param string|false $widgetName The name of the widget to remove. Cannot be a 
  *                                 translation token. If not supplied, the entire category
  *                                 will be removed.
  */
 public static function remove($widgetCategory, $widgetName = false)
 {
     if (!isset(self::$widgets[$widgetCategory])) {
         return;
     }
     if (empty($widgetName)) {
         unset(self::$widgets[$widgetCategory]);
         return;
     }
     foreach (self::$widgets[$widgetCategory] as $id => $widget) {
         if ($widget['name'] == $widgetName || $widget['name'] == Piwik::translate($widgetName)) {
             unset(self::$widgets[$widgetCategory][$id]);
             return;
         }
     }
 }
示例#4
0
 public static function getPercentVisitColumn()
 {
     $percentVisitsLabel = str_replace(' ', ' ', Piwik::translate('General_ColumnPercentageVisits'));
     return $percentVisitsLabel;
 }