本文整理汇总了PHP中Piwik\Translate::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::clean方法的具体用法?PHP Translate::clean怎么用?PHP Translate::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Translate
的用法示例。
在下文中一共展示了Translate::clean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureReportingMenu
public function configureReportingMenu(MenuReporting $menu)
{
$idSite = $this->getIdSite();
$goals = API::getInstance()->getGoals($idSite);
$mainGoalMenu = 'Goals_Goals';
if (count($goals) == 0) {
$linkToAddNewGoal = $this->urlForAction('addNewGoal', array('idGoal' => null));
$menu->addItem($mainGoalMenu, '', $linkToAddNewGoal, 25);
$menu->addItem($mainGoalMenu, 'Goals_AddNewGoal', $linkToAddNewGoal, 1);
return;
}
$order = 1;
$url = $this->urlForAction('index', array('idGoal' => null));
$menu->addItem($mainGoalMenu, '', $url, 25);
$menu->addItem($mainGoalMenu, 'General_Overview', $url, ++$order);
$group = new Group();
foreach ($goals as $goal) {
$subMenuName = str_replace('%', '%%', Translate::clean($goal['name']));
$params = $this->urlForAction('goalReport', array('idGoal' => $goal['idgoal']));
$tooltip = sprintf('%s (id = %d)', $subMenuName, $goal['idgoal']);
if (count($goals) > 3) {
$group->add($subMenuName, $params, $tooltip);
} else {
$menu->addItem($mainGoalMenu, $subMenuName, $params, ++$order, $tooltip);
}
}
if (count($goals) > 3) {
$menu->addGroup($mainGoalMenu, 'Goals_ChooseGoal', $group, ++$order, $tooltip = false);
}
$menu->addItem($mainGoalMenu, 'Goals_ManageGoals', $this->urlForAction('editGoals'), ++$order);
}
示例2: configureReportingMenu
public function configureReportingMenu(MenuReporting $menu)
{
$idSite = Common::getRequestVar('idSite', null, 'int');
$goals = API::getInstance()->getGoals($idSite);
$mainGoalMenu = $this->getGoalCategoryName($idSite);
$site = new Site($idSite);
if (count($goals) == 0) {
$menu->add($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'addNewGoal', 'idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
$menu->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1);
}
$menu->add($mainGoalMenu, 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal'));
} else {
$menu->add($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'index', 'idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
$menu->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1);
}
$menu->add($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), true, 2);
$group = new Group();
foreach ($goals as $goal) {
$subMenuName = str_replace('%', '%%', Translate::clean($goal['name']));
$params = array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal']);
$tooltip = sprintf('%s (id = %d)', $subMenuName, $goal['idgoal']);
if (count($goals) <= 3) {
$menu->add($mainGoalMenu, $subMenuName, $params, true, 50, $tooltip);
} else {
$group->add($subMenuName, $params, $tooltip);
}
}
if (count($goals) > 3) {
$menu->addGroup($mainGoalMenu, 'Goals_ChooseGoal', $group, $orderId = 50, $tooltip = false);
}
}
}
示例3: filter
/**
* Decodes all encoded entities in the given translations
*
* @param array $translations
*
* @return array filtered translations
*/
public function filter($translations)
{
foreach ($translations as $pluginName => $pluginTranslations) {
foreach ($pluginTranslations as $key => $translation) {
// remove encoded entities
$decoded = Translate::clean($translation);
if ($translation != $decoded) {
$this->filteredData[$pluginName][$key] = $translation;
$translations[$pluginName][$key] = $decoded;
continue;
}
}
}
return $translations;
}
示例4: configureReportingMenu
public function configureReportingMenu(MenuReporting $menu)
{
$idSite = Common::getRequestVar('idSite', null, 'int');
$goals = API::getInstance()->getGoals($idSite);
$mainGoalMenu = $this->getGoalCategoryName($idSite);
$site = new Site($idSite);
if (count($goals) == 0) {
$menu->add($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'addNewGoal', 'idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
$menu->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1);
}
$menu->add($mainGoalMenu, 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal'));
} else {
$menu->add($mainGoalMenu, '', array('module' => 'Goals', 'action' => $site->isEcommerceEnabled() ? 'ecommerceReport' : 'index', 'idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null), true, 25);
if ($site->isEcommerceEnabled()) {
$menu->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1);
}
$menu->add($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), true, 2);
foreach ($goals as $goal) {
$menu->add($mainGoalMenu, str_replace('%', '%%', Translate::clean($goal['name'])), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal']));
}
}
}
示例5: testClean
/**
* @group Core
* @dataProvider getCleanTestData
*/
public function testClean($data, $expected)
{
$this->assertEquals($expected, Translate::clean($data));
}