original_string: public static function getIdActionFromSegment($valueToMatch, $sqlField, $matchType, $segmentName)
      {
          if ($segmentName === 'actionType') {
              $actionType   = (int) $valueToMatch;
              $valueToMatch = array();
              $sql = 'SELECT idaction FROM ' . Common::prefixTable('log_action') . ' WHERE type = ' . $actionType . ' )';
          } else {
              $actionType = self::guessActionTypeFromSegment($segmentName);
              if ($actionType == Action::TYPE_PAGE_URL || $segmentName == 'eventUrl') {
                  // for urls trim protocol and www because it is not recorded in the db
                  $valueToMatch = preg_replace('@^http[s]?://(www\.)?@i', '', $valueToMatch);
              }
  
              $valueToMatch = self::normaliseActionString($actionType, $valueToMatch);
              if ($matchType == SegmentExpression::MATCH_EQUAL
                  || $matchType == SegmentExpression::MATCH_NOT_EQUAL
              ) {
                  $idAction = self::getModel()->getIdActionMatchingNameAndType($valueToMatch, $actionType);
                  // Action is not found (eg. &segment=pageTitle==Větrnásssssss)
                  if (empty($idAction)) {
                      $idAction = null;
                  }
                  return $idAction;
              }
  
              // "name contains $string" match can match several idaction so we cannot return yet an idaction
              // special case
              $sql = self::getSelectQueryWhereNameContains($matchType, $actionType);
          }
  
  
          $cache = StaticContainer::get('Piwik\Tracker\TableLogAction\Cache');
          return $cache->getIdActionFromSegment($valueToMatch, $sql);
      }
code: public static function getIdActionFromSegment($valueToMatch, $sqlField, $matchType, $segmentName)
      {
          if ($segmentName === 'actionType') {
              $actionType   = (int) $valueToMatch;
              $valueToMatch = array();
              $sql = 'SELECT idaction FROM ' . Common::prefixTable('log_action') . ' WHERE type = ' . $actionType . ' )';
          } else {
              $actionType = self::guessActionTypeFromSegment($segmentName);
              if ($actionType == Action::TYPE_PAGE_URL || $segmentName == 'eventUrl') {
                  // for urls trim protocol and www because it is not recorded in the db
                  $valueToMatch = preg_replace('@^http[s]?://(www\.)?@i', '', $valueToMatch);
              }
  
              $valueToMatch = self::normaliseActionString($actionType, $valueToMatch);
              if ($matchType == SegmentExpression::MATCH_EQUAL
                  || $matchType == SegmentExpression::MATCH_NOT_EQUAL
              ) {
                  $idAction = self::getModel()->getIdActionMatchingNameAndType($valueToMatch, $actionType);
                  // Action is not found (eg. &segment=pageTitle==Větrnásssssss)
                  if (empty($idAction)) {
                      $idAction = null;
                  }
                  return $idAction;
              }
  
              // "name contains $string" match can match several idaction so we cannot return yet an idaction
              // special case
              $sql = self::getSelectQueryWhereNameContains($matchType, $actionType);
          }
  
  
          $cache = StaticContainer::get('Piwik\Tracker\TableLogAction\Cache');
          return $cache->getIdActionFromSegment($valueToMatch, $sql);
      }
code_tokens: public static function getIdActionFromSegment ( $ valueToMatch , $ sqlField , $ matchType , $ segmentName ) { if ( $ segmentName === 'actionType' ) { $ actionType = ( int ) $ valueToMatch ; $ valueToMatch = array ( ) ; $ sql = 'SELECT idaction FROM ' . Common :: prefixTable ( 'log_action' ) . ' WHERE type = ' . $ actionType . ' )' ; } else { $ actionType = self :: guessActionTypeFromSegment ( $ segmentName ) ; if ( $ actionType == Action :: TYPE_PAGE_URL || $ segmentName == 'eventUrl' ) { // for urls trim protocol and www because it is not recorded in the db $ valueToMatch = preg_replace ( '@^http[s]?://(www\.)?@i' , '' , $ valueToMatch ) ; } $ valueToMatch = self :: normaliseActionString ( $ actionType , $ valueToMatch ) ; if ( $ matchType == SegmentExpression :: MATCH_EQUAL || $ matchType == SegmentExpression :: MATCH_NOT_EQUAL ) { $ idAction = self :: getModel ( ) -> getIdActionMatchingNameAndType ( $ valueToMatch , $ actionType ) ; // Action is not found (eg. &segment=pageTitle==Větrnásssssss) if ( empty ( $ idAction ) ) { $ idAction = null ; } return $ idAction ; } // "name contains $string" match can match several idaction so we cannot return yet an idaction // special case $ sql = self :: getSelectQueryWhereNameContains ( $ matchType , $ actionType ) ; } $ cache = StaticContainer :: get ( 'Piwik\Tracker\TableLogAction\Cache' ) ; return $ cache -> getIdActionFromSegment ( $ valueToMatch , $ sql ) ; }
docstring: Convert segment expression to an action ID or an SQL expression.
  
  This method is used as a sqlFilter-callback for the segments of this plugin.
  Usually, these callbacks only return a value that should be compared to the
  column in the database. In this case, that doesn't work since multiple IDs
  can match an expression (e.g. "pageUrl=@foo").
  @param string $valueToMatch
  @param string $sqlField
  @param string $matchType
  @param string $segmentName
  @throws \Exception
  @return array|int|string
docstring_tokens: Convert segment expression to an action ID or an SQL expression .