Plugin Directory

Changeset 514862


Ignore:
Timestamp:
03/05/2012 07:03:23 PM (14 years ago)
Author:
spectraweb
Message:
  • use of wp-auto-columns plugin
Location:
wp-auto-columns/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-auto-columns/trunk/include/HTMLSplitter.php

    r514831 r514862  
    3030        );
    3131        $this->headers = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6');
    32         $this->splittable = array('div', 'p', 'ul');
     32        $this->splittable = array('div', 'p', 'ul', 'ol');
    3333        $this->break = array('br');
    3434    }
     
    7171                $current_tag = $node->name;
    7272
     73                $item = 1;
     74                $start = 1;
    7375                $children = array();
    7476                foreach ($node->children as $childNode)
     
    8688                    {
    8789                        // construct node
    88                         $nodeText = $this->constructStartTag($node) . implode('', $children) . '</' . $current_tag . '>';
     90                        $nodeText = $this->constructStartTag($node, $start) . implode('', $children) . '</' . $current_tag . '>';
     91                        $start = $item + 1;
    8992                        $cols[$column][] = $nodeText;
    9093                        $children = array();
     
    98101                        }
    99102                    }
     103
     104                    if ($childNode->name == 'li')
     105                    {
     106                        $item++;
     107                    }
    100108                }
    101109
     
    104112                {
    105113                    // construct node
    106                     $nodeText = $this->constructStartTag($node) . implode('', $children) . '</' . $current_tag . '>';
     114                    $nodeText = $this->constructStartTag($node, $start) . implode('', $children) . '</' . $current_tag . '>';
    107115                    $cols[$column][] = $nodeText;
    108116
     
    147155     * @return string
    148156     */
    149     protected function constructStartTag($node)
     157    protected function constructStartTag($node, $start = '')
    150158    {
    151159        $ret = '<';
    152160        $ret .= $node->name;
    153161
    154         if ($node->node->hasAttributes())
     162        if ($node->node->hasAttributes() || $node->name == 'ol')
    155163        {
    156164            $attributes = array();
     165
     166            if ($node->name == 'ol')
     167            {
     168                $attributes[] = 'start="' . $start . '"';
     169            }
    157170
    158171            $length = $node->node->attributes->length;
  • wp-auto-columns/trunk/readme.txt

    r514833 r514862  
    55Requires at least: 3.1.0
    66Tested up to: 3.3.1
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88
    99Wrap block of text with shortcode. It will be split into columns. Automagically.
     
    1919*   splits long paragraphs and unordered lists;
    2020*   keeps text with headers;
    21 *   does not split ordered lists to keep right order.
    2221
    2322Wrap block of text with `[auto_columns]...[/auto_columns]` shortcode. It will produce markup like
     
    5352== Changelog ==
    5453
    55 = 1.0 =
     54= 1.0.1 =
     55* Fixed `<ol>` behavior
     56
     57= 1.0.0 =
    5658* First public release
    5759
Note: See TracChangeset for help on using the changeset viewer.