getMaxLengthCustomVariables() 공개 정적인 메소드

There are also some hardcoded places in JavaScript
public static getMaxLengthCustomVariables ( ) : integer
리턴 integer
예제 #1
0
파일: Model.php 프로젝트: a4tunado/piwik
 public function addCustomVariable()
 {
     $dbTable = $this->getDbTableName();
     $index = $this->getHighestCustomVarIndex() + 1;
     $maxLen = CustomVariables::getMaxLengthCustomVariables();
     Db::exec(sprintf('ALTER TABLE %s ', $dbTable) . sprintf('ADD COLUMN custom_var_k%d VARCHAR(%d) DEFAULT NULL,', $index, $maxLen) . sprintf('ADD COLUMN custom_var_v%d VARCHAR(%d) DEFAULT NULL;', $index, $maxLen));
     return $index;
 }
예제 #2
0
파일: Request.php 프로젝트: normimuc/piwik
 public static function truncateCustomVariable($input)
 {
     return substr(trim($input), 0, CustomVariables::getMaxLengthCustomVariables());
 }
예제 #3
0
 public function test_getCustomVariablesInPageScope_ShouldTruncateValuesIfTheyAreTooLong()
 {
     $maxLen = CustomVariables::getMaxLengthCustomVariables();
     $customVars = $this->buildCustomVars(array('mykey' => 'myval', 'test' => str_pad('test', $maxLen + 5, 't')));
     $expected = $this->buildExpectedCustomVars(array('mykey' => 'myval', 'test' => str_pad('test', $maxLen, 't')));
     $this->assertCustomVariablesInPageScope($expected, $customVars);
 }
예제 #4
0
 public function test_truncateCustomVariable_shouldActuallyTruncateTheValue()
 {
     $len = CustomVariables::getMaxLengthCustomVariables();
     $input = str_pad('test', $len + 2, 't');
     $this->assertGreaterThan(100, $len);
     $truncated = Request::truncateCustomVariable($input);
     $this->assertEquals(str_pad('test', $len, 't'), $truncated);
 }