Changeset 323

Show
Ignore:
Timestamp:
02/26/08 23:36:12 (9 months ago)
Author:
nperriault
Message:

Clever Svg: Typos + some methods visibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cleversvg/trunk/base/csBaseElement.class.php

    r318 r323  
    11<?php 
    22/** 
    3  * SVG Base Element abstract class. Shapes and Groups all herit from this class.  
    4  *  
     3 * SVG Base Element abstract class. Shapes and Groups all herit from this class. 
     4 * 
    55 * @author     Nicolas Perriault <nperriault@gmail.com> 
    66 * @package    cleversvg 
     
    1010{ 
    1111 
    12   protected  
     12  protected 
    1313    $dom_document  = null, 
    1414    $attributes    = array(), 
     
    1919  /** 
    2020   * Manage object cloning 
    21    *  
     21   * 
    2222   */ 
    2323  public function __clone() 
     
    2828  /** 
    2929   * Adds a transformation to current shape 
    30    *  
     30   * 
    3131   * @param  string  $type    Transform type (matrix, translate, etc...) 
    3232   * @param  array   $params  Parameters of transformation 
     
    4343    if (!in_array($type, $types)) 
    4444    { 
    45       throw new csException(sprintf('"%s" is not a valid transform type',  
     45      throw new csException(sprintf('"%s" is not a valid transform type', 
    4646                                       $type)); 
    4747    } 
    4848    $this->transforms[$type] = $params; 
    4949  } 
    50    
     50 
    5151  /** 
    5252   * Computes DOMXML Node 
    53    *  
     53   * 
    5454   * @param  boolean  $embedded  Is SVG element embedded ? 
    5555   * @return DOMElement 
     
    8484      } 
    8585    } 
    86      
     86 
    8787    // Transformations, if any 
    8888    if (count($this->transforms) > 0) 
     
    9191      foreach ($this->transforms as $transform_name => $transform_params) 
    9292      { 
    93         $transforms[] = sprintf('%s(%s)',  
    94                                 $transform_name,  
     93        $transforms[] = sprintf('%s(%s)', 
     94                                $transform_name, 
    9595                                implode(',', $transform_params)); 
    96          
     96 
    9797      } 
    9898      $element_node->setAttribute('transform', implode(' ', $transforms)); 
    9999    } 
    100      
     100 
    101101    return $element_node; 
    102102  } 
    103    
     103 
    104104  /** 
    105105   * Gets the current depth 
    106    *  
     106   * 
    107107   * @return mixed (int depth or NULL) 
    108108   */ 
     
    118118    } 
    119119  } 
    120    
     120 
    121121  /** 
    122122   * Returns a DOM DOcument 
    123    *  
    124    * @return DOMDocument  
     123   * 
     124   * @return DOMDocument 
    125125   */ 
    126126  public function getDomDocument() 
     
    132132    return $this->dom_document; 
    133133  } 
    134    
     134 
    135135  /** 
    136136   * Gets the node name of current SVG element 
    137    *  
    138    * @param  boolean  $embedded   
     137   * 
     138   * @param  boolean  $embedded 
    139139   * @return string 
    140140   */ 
    141   public function getElementName($embedded=false) 
     141  protected function getElementName($embedded=false) 
    142142  { 
    143143    if ($embedded === true) 
     
    151151    return $node_name; 
    152152  } 
    153    
    154   /** 
    155    * Specifies a transformation in the form of a transformation matrix of  
     153 
     154  /** 
     155   * Specifies a transformation in the form of a transformation matrix of 
    156156   * six values 
    157    *  
     157   * 
    158158   * @param  int  $a 
    159159   * @param  int  $b 
     
    167167    $this->addTransform('matrix', array($a, $b, $c, $d, $e, $f)); 
    168168  } 
    169    
     169 
    170170  /** 
    171171   * Rotates shape 
    172    *  
     172   * 
    173173   * @param  int  $angle 
    174174   * @param  int  $cx 
     
    179179    $this->addTransform('rotate', array($angle, $cx, $cy)); 
    180180  } 
    181    
     181 
    182182  /** 
    183183   * Scales shape 
    184    *  
     184   * 
    185185   * @param  int  $xscale 
    186    * @param  int  $yscale  
     186   * @param  int  $yscale 
    187187   */ 
    188188  public function scale($xscale, $yscale=null) 
     
    195195    $this->addTransform('scale', $params); 
    196196  } 
    197    
     197 
    198198  /** 
    199199   * Specifies a skew transformation along the x-axis 
    200    *  
     200   * 
    201201   * @param  int  $angle 
    202202   */ 
     
    205205    $this->addTransform('skewX', array($angle)); 
    206206  } 
    207    
     207 
    208208  /** 
    209209   * Specifies a skew transformation along the y-axis 
    210    *  
     210   * 
    211211   * @param  int  $angle 
    212212   */ 
     
    215215    $this->addTransform('skewY', array($angle)); 
    216216  } 
    217    
     217 
    218218  /** 
    219219   * Translates shape 
    220    *  
     220   * 
    221221   * @param  int  $tx 
    222222   * @param  int  $ty 
     
    231231    $this->addTransform('translate', $params); 
    232232  } 
    233    
    234   /** 
    235    * Deletes an attribute  
    236    *  
     233 
     234  /** 
     235   * Deletes an attribute 
     236   * 
    237237   */ 
    238238  protected function deteleAttribute($name) 
     
    243243    } 
    244244  } 
    245    
     245 
    246246  /** 
    247247   * Sets an attribute for current element 
    248    *  
     248   * 
    249249   * @param  string  $name 
    250250   * @param  mixed   $value 
     
    262262    } 
    263263  } 
    264     
     264 
    265265  /** 
    266266   * Sets the depth of object 
    267    *  
     267   * 
    268268   * @param  int  $depth 
    269269   */ 
     
    275275    } 
    276276  } 
    277    
     277 
    278278  /** 
    279279   * Gets the DOM id of current element tag 
    280    *  
     280   * 
    281281   * @return mixed (string id or NULL) 
    282282   */ 
     
    292292    } 
    293293  } 
    294    
     294 
    295295  /** 
    296296   * Sets the DOM id of current element tag 
    297    *  
     297   * 
    298298   * @param  string  $id 
    299299   */ 
     
    308308  /** 
    309309   * Sets a SVG style via an associative array 
    310    *  
     310   * 
    311311   * @param  array  $style 
    312312   */ 
    313313  public function setStyle($style) 
    314314  { 
    315     // Styles properties bellow should be treated as attributes and not  
    316     // in a style attribute (FF 1.5 compat)  
     315    // Styles properties bellow should be treated as attributes and not 
     316    // in a style attribute (FF 1.5 compat) 
    317317    $convert_styles = array('stroke', 'stroke-width', 'fill'); 
    318318    foreach ($style as $style_name => $style_value) 
  • cleversvg/trunk/base/csBaseGradient.class.php

    r318 r323  
    22/** 
    33 * SVG base gradient abstract class 
    4  *  
     4 * 
    55 * @author     Nicolas Perriault <nperriault@gmail.com> 
    66 * @package    cleversvg 
     
    1010{ 
    1111 
    12   protected  
     12  protected 
    1313    $stops         = array(), 
    1414    $xml_node_name = 'unknown'; 
    15    
     15 
    1616  /** 
    17    * Adds a &lt;stop/&gt; elementto specify gradient marker points  
    18    *  
     17   * Adds a &lt;stop/&gt; elementto specify gradient marker points 
     18   * 
    1919   * @param  mixed   $offset       Stop offset (can be percentage) 
    2020   * @param  string  $stop_color   (optional, default=black) 
     
    2323  public function addStop($offset, $stop_color='black', $stop_opacity=1) 
    2424  { 
    25     $this->stops[] = array('offset'       => $offset,  
    26                            'stop-color'   => $stop_color,  
     25    $this->stops[] = array('offset'       => $offset, 
     26                           'stop-color'   => $stop_color, 
    2727                           'stop-opacity' => $stop_opacity); 
    2828  } 
    29    
     29 
    3030  /** 
    3131   * Computes DOMXML Node 
    32    *  
     32   * 
    3333   * @param  boolean  $embedded  Is SVG element embedded ? 
    3434   * @return DOMElement 
     
    3838    $dom = $this->getDomDocument(); 
    3939    $element_node = parent::compile($embedded); 
    40      
     40 
    4141    // Add stops 
    4242    if (count($this->stops) > 0) 
     
    5252      } 
    5353    } 
    54      
     54 
    5555    return $element_node; 
    5656  } 
    57    
     57 
    5858  /** 
    5959   * Gets the node name of current SVG element 
    60    *  
    61    * @param  boolean  $embedded   
     60   * 
     61   * @param  boolean  $embedded 
    6262   * @return string 
    6363   */ 
    64   public function getStopNodeName($embedded) 
     64  protected function getStopNodeName($embedded) 
    6565  { 
    6666    return $embedded === true ? 'svg:stop' : 'stop'; 
    6767  } 
    68    
     68 
    6969} 
  • cleversvg/trunk/quick_examples.php

    r309 r323  
    5050 
    5151//When you're done, render the document as a standalone one 
    52 echo $doc->toXML(); 
     52echo $doc->toXML(true); 
    5353 
    5454//Or an embedded one : 
  • cleversvg/trunk/tests/csDocumentTest.php

    r322 r323  
    33require_once dirname(__FILE__).'/../cleversvg.php'; 
    44 
     5/** 
     6 * csDocument PHPUnit tests 
     7 * 
     8 */ 
    59class csDocumentTest extends PHPUnit_Framework_TestCase 
    610{