コード例 #1
0
ファイル: Number.php プロジェクト: rtsantos/mais
 /**
  * Retorna o conteúdo no formato ISO
  */
 public function getValueToDb()
 {
     $value = $this->_value;
     if ($value instanceof ZendT_Type) {
         $value = $value->getValueToDb();
     }
     if ($value != null) {
         if ($value instanceof ZendT_Type_Number) {
             $value = $value->get();
         }
         if (is_string($value)) {
             if ($this->_value instanceof ZendT_Type) {
                 $this->_value = $this->_value->get();
             }
             if (strpos($value, ',') !== false && strpos($value, '.') !== false) {
                 $value = str_replace('.', '', $value);
                 $value = str_replace(',', '.', $value);
                 $value *= 1;
             } elseif (strpos($this->_value, '.') !== false) {
                 $value = str_replace('.', '', $value);
                 $value *= 1;
             } elseif (strpos($this->_value, ',') !== false) {
                 $value = str_replace(',', '.', $value);
                 $value *= 1;
             }
         }
         if (isset($this->_part['numDecimal']) && $this->_part['numDecimal']) {
             $this->_part['numDecimal'] = $this->_part['numDecimal'] * 1;
             $value = round($value, $this->_part['numDecimal']);
         }
     }
     if (!$value && $value !== '0' && $this->_part['numDecimal'] === null) {
         $value = null;
     }
     return $value;
 }
コード例 #2
0
ファイル: flash.php プロジェクト: jordanmanning/ezpublish
 /**
  * Render text depending of font type and available font extensions
  * 
  * @param string $id 
  * @param string $text 
  * @param string $chars 
  * @param int $type 
  * @param string $path 
  * @param ezcGraphColor $color 
  * @param ezcGraphCoordinate $position 
  * @param float $size 
  * @param float $rotation 
  * @return void
  */
 protected function renderText($id, $text, $chars, $type, $path, ezcGraphColor $color, ezcGraphCoordinate $position, $size, $rotation = null)
 {
     $movie = $this->getDocument();
     $tb = new SWFTextField(SWFTEXTFIELD_NOEDIT);
     $tb->setFont(new SWFFont($path));
     $tb->setHeight($size);
     $tb->setColor($color->red, $color->green, $color->blue, 255 - $color->alpha);
     $tb->addString($text);
     $tb->addChars($chars);
     $object = $movie->add($tb);
     $object->rotate($rotation !== null ? -$rotation->getRotation() : 0);
     $object->moveTo($position->x + ($rotation === null ? 0 : $this->modifyCoordinate($rotation->get(0, 2))), $position->y - $size * (1 + $this->options->lineSpacing) + ($rotation === null ? 0 : $this->modifyCoordinate($rotation->get(1, 2))));
     $object->setName($id);
 }