Advertisement
Guest User

match-smdata

a guest
Mar 30th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. function getMatchValue($matchdata, $key, $key2=null, $retain=false) {
  2.  $matchproperties = $matchdata->getProperties();
  3.  $returnstring = "";
  4.  if (array_key_exists($key, $matchproperties)) {
  5.   if ($retain === false) {
  6.    $propertyvalues = $matchdata->getPropertyValues($matchproperties[$key]);
  7.    foreach ($propertyvalues as $tempkey=>$propertyvalue) {         
  8.     if ($propertyvalue->getDIType() === 1) $propertyvalues[$tempkey] = $propertyvalue->getNumber();
  9.     if ($propertyvalue->getDIType() === 2) $propertyvalues[$tempkey] = $propertyvalue->getString();
  10.     if ($propertyvalue->getDIType() === 9) $propertyvalues[$tempkey] = $propertyvalue->getTitle()->__toString();
  11.     if ($propertyvalue->getDIType() === 4) $propertyvalues[$tempkey] = $propertyvalue->getBoolean();
  12.   }
  13. }
  14. if ($key2 !== null) $returnstring = $propertyvalues[$key2];
  15. else $returnstring = $propertyvalues;
  16. }
  17. return $returnstring;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement