Ejemplo n.º 1
0
 public static function serve($preparedItem, $options = null)
 {
     if (!burntCheck($preparedItem, false)) {
         // empty discards '0' too unfortunately.
         return false;
     } elseif ($preparedItem instanceof PreparedItem) {
         return $preparedItem->serve($options);
     } elseif (is_scalar($preparedItem)) {
         $contentType = !empty($options['type']) ? $options['type'] : null;
         echo Glaze::value($preparedItem, $contentType);
     }
 }
Ejemplo n.º 2
0
 public static function serveAttribute($attributeName, $attributeValue = true, $valueType = null)
 {
     if (is_array($attributeValue) && isset($attributeValue['valueType'])) {
         $attributeOptions = $attributeValue;
         $attributeValue = $attributeOptions['value'];
         $valueType = $attributeOptions['valueType'];
     }
     if (!isset($valueType)) {
         $valueType = Glaze::defaultTypeForAttributeName($attributeName);
     }
     // Boolean false attribute (omitted)
     if ($attributeValue === false) {
         return;
     } else {
         if ($attributeValue === true) {
             // Looks like | $name|
             echo ' ' . $attributeName;
         } else {
             // Looks like | $name="$value"|
             echo ' ' . $attributeName . '="' . Glaze::value($attributeValue, $valueType) . '"';
         }
     }
 }