當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Row::getMetadata方法代碼示例

本文整理匯總了PHP中Piwik\DataTable\Row::getMetadata方法的典型用法代碼示例。如果您正苦於以下問題:PHP Row::getMetadata方法的具體用法?PHP Row::getMetadata怎麽用?PHP Row::getMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\DataTable\Row的用法示例。


在下文中一共展示了Row::getMetadata方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: flattenRow

 /**
  * @param Row $row
  * @param DataTable $dataTable
  * @param string $labelPrefix
  * @param bool $parentLogo
  */
 private function flattenRow(Row $row, DataTable $dataTable, $labelPrefix = '', $parentLogo = false)
 {
     $label = $row->getColumn('label');
     if ($label !== false) {
         $label = trim($label);
         if (substr($label, 0, 1) == '/' && $this->recursiveLabelSeparator == '/') {
             $label = substr($label, 1);
         }
         $label = $labelPrefix . $label;
         $row->setColumn('label', $label);
     }
     $logo = $row->getMetadata('logo');
     if ($logo === false && $parentLogo !== false) {
         $logo = $parentLogo;
         $row->setMetadata('logo', $logo);
     }
     $subTable = $this->loadSubtable($dataTable, $row);
     $row->removeSubtable();
     if ($subTable === null) {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 0);
         }
         $dataTable->addRow($row);
     } else {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 1);
             $dataTable->addRow($row);
         }
         $prefix = $label . $this->recursiveLabelSeparator;
         foreach ($subTable->getRows() as $row) {
             $this->flattenRow($row, $dataTable, $prefix, $logo);
         }
     }
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:40,代碼來源:Flattener.php

示例2: getRowUrlForEvolutionLabel

 /**
  * @param Row $row
  * @param string $apiModule
  * @param string $apiAction
  * @param bool $labelUseAbsoluteUrl
  * @return bool|string
  */
 private function getRowUrlForEvolutionLabel($row, $apiModule, $apiAction, $labelUseAbsoluteUrl)
 {
     $url = $row->getMetadata('url');
     if ($url && ($apiModule == 'Actions' || $apiModule == 'Referrers' && $apiAction == 'getWebsites') && $labelUseAbsoluteUrl) {
         $actualLabel = preg_replace(';^http(s)?://(www.)?;i', '', $url);
         return $actualLabel;
     }
     return false;
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:16,代碼來源:RowEvolution.php

示例3: isEqual

 /**
  * Helper function that tests if two rows are equal.
  *
  * Two rows are equal if:
  *
  * - they have exactly the same columns / metadata
  * - they have a subDataTable associated, then we check that both of them are the same.
  *
  * Column order is not important.
  *
  * @param \Piwik\DataTable\Row $row1 first to compare
  * @param \Piwik\DataTable\Row $row2 second to compare
  * @return bool
  */
 public static function isEqual(Row $row1, Row $row2)
 {
     //same columns
     $cols1 = $row1->getColumns();
     $cols2 = $row2->getColumns();
     $diff1 = array_udiff($cols1, $cols2, array(__CLASS__, 'compareElements'));
     $diff2 = array_udiff($cols2, $cols1, array(__CLASS__, 'compareElements'));
     if ($diff1 != $diff2) {
         return false;
     }
     $dets1 = $row1->getMetadata();
     $dets2 = $row2->getMetadata();
     ksort($dets1);
     ksort($dets2);
     if ($dets1 != $dets2) {
         return false;
     }
     // either both are null
     // or both have a value
     if (!(is_null($row1->getIdSubDataTable()) && is_null($row2->getIdSubDataTable()))) {
         $subtable1 = $row1->getSubtable();
         $subtable2 = $row2->getSubtable();
         if (!DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:42,代碼來源:Row.php

示例4: testRow

 /**
  * Simple test of the DataTable_Row
  */
 public function testRow()
 {
     $columns = array('test_column' => 145, 92582495 => new Timer(), 'super' => array('this column has an array value, amazing'));
     $metadata = array('logo' => 'piwik.png', 'super' => array('this column has an array value, amazing'));
     $arrayRow = array(Row::COLUMNS => $columns, Row::METADATA => $metadata, 'fake useless key' => 38959, 43905724897 => 'value');
     $row = new Row($arrayRow);
     $this->assertEquals($columns, $row->getColumns());
     $this->assertEquals($metadata, $row->getMetadata());
     $this->assertNull($row->getIdSubDataTable());
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:13,代碼來源:DataTableTest.php

示例5: assertSegment

 private function assertSegment($expected, Row $row)
 {
     $segment = $row->getMetadata('segment');
     $this->assertSame($expected, $segment);
 }
開發者ID:mgou-net,項目名稱:piwik,代碼行數:5,代碼來源:AddSegmentFilterBySegmentValueTest.php

示例6: getElementToReplace

 /**
  * @param Row $row
  * @param string $metadataToFilter
  * @return array|bool|mixed
  */
 protected function getElementToReplace($row, $metadataToFilter)
 {
     return $row->getMetadata($metadataToFilter);
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:9,代碼來源:MetadataCallbackReplace.php

示例7: assertRowEquals

 private function assertRowEquals($expectedColumns, $expectedSiteIdInMetadata, Row $row)
 {
     $this->assertEquals($expectedColumns, $row->getColumns());
     $this->assertEquals(array('idsite' => $expectedSiteIdInMetadata), $row->getMetadata());
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:5,代碼來源:DataTableFactoryTest.php

示例8: flattenRow

 /**
  * @param Row $row
  * @param DataTable $dataTable
  * @param string $labelPrefix
  * @param bool $parentLogo
  */
 private function flattenRow(Row $row, $rowId, DataTable $dataTable, $labelPrefix = '', $parentLogo = false)
 {
     $label = $row->getColumn('label');
     if ($label !== false) {
         $label = trim($label);
         if ($this->recursiveLabelSeparator == '/') {
             if (substr($label, 0, 1) == '/') {
                 $label = substr($label, 1);
             } elseif ($rowId === DataTable::ID_SUMMARY_ROW && $labelPrefix && $label != DataTable::LABEL_SUMMARY_ROW) {
                 $label = ' - ' . $label;
             }
         }
         $label = $labelPrefix . $label;
         $row->setColumn('label', $label);
     }
     $logo = $row->getMetadata('logo');
     if ($logo === false && $parentLogo !== false) {
         $logo = $parentLogo;
         $row->setMetadata('logo', $logo);
     }
     /** @var DataTable $subTable */
     $subTable = $row->getSubtable();
     if ($subTable) {
         $subTable->applyQueuedFilters();
         $row->deleteMetadata('idsubdatatable_in_db');
     } else {
         $subTable = $this->loadSubtable($dataTable, $row);
     }
     $row->removeSubtable();
     if ($subTable === null) {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 0);
         }
         $dataTable->addRow($row);
     } else {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 1);
             $dataTable->addRow($row);
         }
         $prefix = $label . $this->recursiveLabelSeparator;
         $this->flattenDataTableInto($subTable, $dataTable, $prefix, $logo);
     }
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:49,代碼來源:Flattener.php

示例9: assertMetadataSavesValue

 private function assertMetadataSavesValue($expectedValue, $metadataName, $valueToSet)
 {
     $this->row->setMetadata($metadataName, $valueToSet);
     $this->assertSame($expectedValue, $this->row->getMetadata($metadataName));
 }
開發者ID:cemo,項目名稱:piwik,代碼行數:5,代碼來源:RowTest.php


注:本文中的Piwik\DataTable\Row::getMetadata方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。