Пример #1
0
 /**
  * Derive the action ID from the request action name and type.
  */
 private function deriveIdAction($actionName, $actionType)
 {
     $actionsPlugin = new Piwik_Actions();
     switch ($actionType) {
         case 'url':
             $originalActionName = $actionName;
             $actionName = Piwik_Common::unsanitizeInputValue($actionName);
             $id = $actionsPlugin->getIdActionFromSegment($actionName, 'idaction_url');
             if ($id < 0) {
                 // an example where this is needed is urls containing < or >
                 $actionName = $originalActionName;
                 $id = $actionsPlugin->getIdActionFromSegment($actionName, 'idaction_url');
             }
             return $id;
         case 'title':
             $id = $actionsPlugin->getIdActionFromSegment($actionName, 'idaction_name');
             if ($id < 0) {
                 $unkown = Piwik_Actions_ArchivingHelper::getUnknownActionName(Piwik_Tracker_Action::TYPE_ACTION_NAME);
                 if (trim($actionName) == trim($unkown)) {
                     $id = $actionsPlugin->getIdActionFromSegment('', 'idaction_name');
                 }
             }
             return $id;
         default:
             throw new Exception('Unknown action type');
     }
 }
Пример #2
0
 private function getPageLabel(&$pageRecord, $isTitle)
 {
     if ($isTitle) {
         $label = $pageRecord['name'];
         if (empty($label)) {
             $label = Piwik_Actions_ArchivingHelper::getUnknownActionName(Piwik_Tracker_Action::TYPE_ACTION_NAME);
         }
         return $label;
     } else {
         if ($this->returnNormalizedUrls) {
             return $pageRecord['name'];
         } else {
             return Piwik_Tracker_Action::reconstructNormalizedUrl($pageRecord['name'], $pageRecord['url_prefix']);
         }
     }
 }