当前位置: 首页>>代码示例>>PHP>>正文


PHP CustomVariables::getMaxLengthCustomVariables方法代码示例

本文整理汇总了PHP中Piwik\Plugins\CustomVariables\CustomVariables::getMaxLengthCustomVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomVariables::getMaxLengthCustomVariables方法的具体用法?PHP CustomVariables::getMaxLengthCustomVariables怎么用?PHP CustomVariables::getMaxLengthCustomVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Plugins\CustomVariables\CustomVariables的用法示例。


在下文中一共展示了CustomVariables::getMaxLengthCustomVariables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addCustomVariable

 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;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:8,代码来源:Model.php

示例2: truncateCustomVariable

 public static function truncateCustomVariable($input)
 {
     return substr(trim($input), 0, CustomVariables::getMaxLengthCustomVariables());
 }
开发者ID:normimuc,项目名称:piwik,代码行数:4,代码来源:Request.php

示例3: test_getCustomVariablesInPageScope_ShouldTruncateValuesIfTheyAreTooLong

 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);
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:7,代码来源:RequestTest.php

示例4: test_truncateCustomVariable_shouldActuallyTruncateTheValue

 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);
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:8,代码来源:RequestTest.php


注:本文中的Piwik\Plugins\CustomVariables\CustomVariables::getMaxLengthCustomVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。