<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -15,159 +15,158 @@ require_once(DOKU_PLUGIN.'syntax.php');
  * need to inherit from this class
  */
 class syntax_plugin_poll extends DokuWiki_Syntax_Plugin {
-  
-  /**
-   * return some info
-   */
-  function getInfo(){
-    return confToHash(dirname(__FILE__).'/INFO');
-  }
-
-  function getType(){ return 'substition';}
-  function getPType(){ return 'block';}
-  function getSort(){ return 167; }
-  
-  /**
-   * Connect pattern to lexer
-   */
-  function connectTo($mode){
-    $this-&gt;Lexer-&gt;addSpecialPattern('&lt;poll.*?&gt;.+?&lt;/poll&gt;', $mode, 'plugin_poll');
-  }
-
-  /**
-   * Handle the match
-   */
-  function handle($match, $state, $pos, &amp;$handler){
-    $match = substr($match, 6, -7);  // strip markup
-    list($title, $options) = preg_split('/&gt;/u', $match, 2);
-    if (!$options){
-      $options = $title;
-      $title   = NULL;
+
+    /**
+     * return some info
+     */
+    function getInfo() {
+        return confToHash(dirname(__FILE__).'/INFO');
     }
-    $options = explode('*', $options);
-    
-    $c = count($options);
-    for ($i = 0; $i &lt; $c; $i++){
-      $options[$i] = trim($options[$i]);
+
+    function getType() { return 'substition';}
+    function getPType() { return 'block';}
+    function getSort() { return 167; }
+
+    /**
+     * Connect pattern to lexer
+     */
+    function connectTo($mode) {
+        $this-&gt;Lexer-&gt;addSpecialPattern('&lt;poll.*?&gt;.+?&lt;/poll&gt;', $mode, 'plugin_poll');
     }
-        
-    return array(trim($title), $options);
-  }
-
-  /**
-   * Create output
-   */
-  function render($mode, &amp;$renderer, $data) {
-  
-    if ($mode == 'xhtml'){
-      global $ID;
-      
-      $options = $data[1];
-      $title   = $renderer-&gt;_xmlEntities($data[0]);
-      
-      // prevent caching to ensure the poll results are fresh
-      $renderer-&gt;info['cache'] = false;
-            
-      // get poll file contents
-      $pfile = metaFN(md5($title), '.poll');
-      $poll  = unserialize(@file_get_contents($pfile));
-      
-      // output the poll
-      $renderer-&gt;doc .= '&lt;fieldset class=&quot;poll&quot;&gt;'.
-        '&lt;legend&gt;'.$title.'&lt;/legend&gt;';
-      $more = trim(array_shift($options));
-      if ($more){
-        $renderer-&gt;doc .= '&lt;div&gt;'.$renderer-&gt;_xmlEntities($more).'&lt;/div&gt;';
-      }
-        
-      // check if user has voted already
-      $ip = clientIP(true);
-      if (isset($poll['ips']) &amp;&amp; in_array($ip, $poll['ips'])){
-      
-        // display results
-        $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
-
-      } elseif ($vote = $_REQUEST['vote']){
-      
-        // user has just voted -&gt; update results
+
+    /**
+     * Handle the match
+     */
+    function handle($match, $state, $pos, &amp;$handler) {
+        $match = substr($match, 6, -7);  // strip markup
+        list($title, $options) = preg_split('/&gt;/u', $match, 2);
+        if (!$options) {
+            $options = $title;
+            $title   = NULL;
+        }
+        $options = explode('*', $options);
+
         $c = count($options);
-        for ($i = 0; $i &lt; $c; $i++){
-          $opt = $renderer-&gt;_xmlEntities($options[$i]);
-          if ($vote == $opt){
-            $poll['results'][$opt] += 1;
-            $poll['votes'] += 1;
-            $poll['ips'][] = $ip;
-          } elseif (!isset($poll['results'][$opt])){
-            $poll['results'][$opt] = 0;
-          }
+        for ($i = 0; $i &lt; $c; $i++) {
+            $options[$i] = trim($options[$i]);
         }
-        $fh = fopen($pfile, 'w');
-        fwrite($fh, serialize($poll));
-        fclose($fh);
-        
-        // display results
-        $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
-
-      } elseif (count($options) &gt; 0){
-      
-        // display poll form
-        $renderer-&gt;doc .= $this-&gt;_pollForm($options, $renderer);
-
-      } else {
-        
-        // display results
-        $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
-
-      }
-      $renderer-&gt;doc .= '&lt;/fieldset&gt;';
-          
-      return true;
+
+        return array(trim($title), $options);
     }
-    return false;
-  }
-  
-  function _pollResults($poll){
-    $total = $poll['votes'];
-    if ($total == 0) return '';
-  
-    $ret = '&lt;table class=&quot;blind&quot;&gt;';
-    $c = count($poll['results']);
-    $options = array_keys($poll['results']);
-    $votes   = array_values($poll['results']);
-    for ($i = 0; $i &lt; $c; $i++){
-      $absolute = $votes[$i];
-      $percent  = round(($absolute*100)/$total);
-      $ret .= '&lt;tr&gt;&lt;td&gt;'.$options[$i].'&lt;/td&gt;&lt;td&gt;&lt;div class=&quot;poll_bar&quot;&gt;';
-      if ($percent) $ret .= '&lt;div class=&quot;poll_full&quot; style=&quot;width:'.($percent*2).'px&quot;&gt;&amp;nbsp;&lt;/div&gt;';
-      $ret .= '&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;rightalign&quot;&gt;'.$percent.'%&lt;/td&gt;'.
-        '&lt;td class=&quot;rightalign&quot;&gt;('.$absolute.')&lt;/td&gt;&lt;/tr&gt;';
+
+    /**
+     * Create output
+     */
+    function render($mode, &amp;$renderer, $data) {
+
+        if ($mode == 'xhtml') {
+            global $ID;
+
+            $options = $data[1];
+            $title   = $renderer-&gt;_xmlEntities($data[0]);
+
+            // prevent caching to ensure the poll results are fresh
+            $renderer-&gt;info['cache'] = false;
+
+            // get poll file contents
+            $pfile = metaFN(md5($title), '.poll');
+            $poll  = unserialize(@file_get_contents($pfile));
+
+            // output the poll
+            $renderer-&gt;doc .= '&lt;fieldset class=&quot;poll&quot;&gt;'.
+                '&lt;legend&gt;'.$title.'&lt;/legend&gt;';
+            $more = trim(array_shift($options));
+            if ($more) {
+                $renderer-&gt;doc .= '&lt;div&gt;'.$renderer-&gt;_xmlEntities($more).'&lt;/div&gt;';
+            }
+
+            // check if user has voted already
+            $ip = clientIP(true);
+            if (isset($poll['ips']) &amp;&amp; in_array($ip, $poll['ips'])) {
+
+                // display results
+                $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
+
+            } elseif ($vote = $_REQUEST['vote']) {
+
+                // user has just voted -&gt; update results
+                $c = count($options);
+                for ($i = 0; $i &lt; $c; $i++) {
+                    $opt = $renderer-&gt;_xmlEntities($options[$i]);
+                    if ($vote == $opt) {
+                        $poll['results'][$opt] += 1;
+                        $poll['votes'] += 1;
+                        $poll['ips'][] = $ip;
+                    } elseif (!isset($poll['results'][$opt])) {
+                        $poll['results'][$opt] = 0;
+                    }
+                }
+                $fh = fopen($pfile, 'w');
+                fwrite($fh, serialize($poll));
+                fclose($fh);
+
+                // display results
+                $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
+
+            } elseif (count($options) &gt; 0) {
+
+                // display poll form
+                $renderer-&gt;doc .= $this-&gt;_pollForm($options, $renderer);
+
+            } else {
+
+                // display results
+                $renderer-&gt;doc .= $this-&gt;_pollResults($poll);
+
+            }
+            $renderer-&gt;doc .= '&lt;/fieldset&gt;';
+
+            return true;
+        }
+        return false;
     }
-    $ret .= '&lt;/table&gt;';
-    
-    return $ret;
-  }
-  
-  function _pollForm($options, &amp;$renderer){
-    global $lang;
-    global $ID;
-    
-    $i = 0;
-    $ret = '&lt;form id=&quot;poll__form&quot; method=&quot;post&quot; action=&quot;'.script().'&quot; accept-charset=&quot;'.$lang['encoding'].'&quot;&gt;&lt;div class=&quot;no&quot;&gt;'.
-      '&lt;input type=&quot;hidden&quot; name=&quot;do&quot; value=&quot;show&quot; /&gt;'.
-      '&lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;'.$ID.'&quot; /&gt;';
-    foreach ($options as $option){
-      $i++;
-      $option = $renderer-&gt;_xmlEntities($option);
-      $ret.= '&lt;label class=&quot;simple&quot; for=&quot;poll__option'.$i.'&quot;&gt;'.
-        '&lt;input type=&quot;radio&quot; name=&quot;vote&quot; id=&quot;poll__option'.$i.'&quot; '.
-        'value=&quot;'.$option.'&quot; /&gt; &lt;span&gt;'.$option.'&lt;/span&gt;&lt;/label&gt;';
+
+    function _pollResults($poll) {
+        $total = $poll['votes'];
+        if ($total == 0) return '';
+
+        $ret = '&lt;table class=&quot;blind&quot;&gt;';
+        $c = count($poll['results']);
+        $options = array_keys($poll['results']);
+        $votes   = array_values($poll['results']);
+        for ($i = 0; $i &lt; $c; $i++) {
+            $absolute = $votes[$i];
+            $percent  = round(($absolute*100)/$total);
+            $ret .= '&lt;tr&gt;&lt;td&gt;'.$options[$i].'&lt;/td&gt;&lt;td&gt;&lt;div class=&quot;poll_bar&quot;&gt;';
+            if ($percent) $ret .= '&lt;div class=&quot;poll_full&quot; style=&quot;width:'.($percent*2).'px&quot;&gt;&amp;nbsp;&lt;/div&gt;';
+            $ret .= '&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;rightalign&quot;&gt;'.$percent.'%&lt;/td&gt;'.
+                '&lt;td class=&quot;rightalign&quot;&gt;('.$absolute.')&lt;/td&gt;&lt;/tr&gt;';
+        }
+        $ret .= '&lt;/table&gt;';
+
+        return $ret;
+    }
+
+    function _pollForm($options, &amp;$renderer) {
+        global $lang;
+        global $ID;
+
+        $i = 0;
+        $ret = '&lt;form id=&quot;poll__form&quot; method=&quot;post&quot; action=&quot;'.script().'&quot; accept-charset=&quot;'.$lang['encoding'].'&quot;&gt;&lt;div class=&quot;no&quot;&gt;'.
+            '&lt;input type=&quot;hidden&quot; name=&quot;do&quot; value=&quot;show&quot; /&gt;'.
+            '&lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;'.$ID.'&quot; /&gt;';
+        foreach ($options as $option) {
+            $i++;
+            $option = $renderer-&gt;_xmlEntities($option);
+            $ret.= '&lt;label class=&quot;simple&quot; for=&quot;poll__option'.$i.'&quot;&gt;'.
+                '&lt;input type=&quot;radio&quot; name=&quot;vote&quot; id=&quot;poll__option'.$i.'&quot; '.
+                'value=&quot;'.$option.'&quot; /&gt; &lt;span&gt;'.$option.'&lt;/span&gt;&lt;/label&gt;';
+        }
+        $ret .= '&lt;input class=&quot;button&quot; type=&quot;submit&quot; '.
+            'value=&quot;'.$this-&gt;getLang('btn_vote').'&quot; /&gt;'.
+            '&lt;/div&gt;&lt;/form&gt;';
+
+        return $ret;
     }
-    $ret .= '&lt;input class=&quot;button&quot; type=&quot;submit&quot; '.
-      'value=&quot;'.$this-&gt;getLang('btn_vote').'&quot; /&gt;'.
-      '&lt;/div&gt;&lt;/form&gt;';
-    
-    return $ret;
-  }
 }
- 
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//vim:ts=4:sw=4:et:enc=utf-8:</diff>
      <filename>syntax.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>adefb27eb2b73ffa2a1639077ffc5700b6bac8bd</id>
    </parent>
  </parents>
  <author>
    <name>Michael Klier</name>
    <email>chi@chimeric.de</email>
  </author>
  <url>http://github.com/dokufreaks/plugin-poll/commit/e8f3e398349dff58d99f00e7623c47831d322a58</url>
  <id>e8f3e398349dff58d99f00e7623c47831d322a58</id>
  <committed-date>2008-06-07T14:08:48-07:00</committed-date>
  <authored-date>2008-06-07T14:08:48-07:00</authored-date>
  <message>fixed code style

darcs-hash:20080607210848-23886-ea739a4fb980e0d968af01038314a4eef469bc6e.gz</message>
  <tree>cf25fcfcbab436ca9d1d94f4f97351fdac56f259</tree>
  <committer>
    <name>Michael Klier</name>
    <email>chi@chimeric.de</email>
  </committer>
</commit>
