Plugin Directory

Changeset 1032701


Ignore:
Timestamp:
11/25/2014 08:56:59 PM (11 years ago)
Author:
tjsantilo
Message:

revert

Location:
because/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • because/trunk/README.txt

    r1032678 r1032701  
    77Tested up to: 4.0
    88<<<<<<< .mine
    9 Stable tag: 1.5.0
     9Stable tag: 1.4.5
    1010=======
    11 Stable tag: 1.5.0
     11Stable tag: 1.4.5
    1212>>>>>>> .r969865
    1313License: GPLv2 or later
  • because/trunk/public/includes/class-sp_comments.php

    r1032690 r1032701  
    15671567function mytheme_comment($comment, $args, $depth) {
    15681568
    1569     $GLOBALS['comment'] = $comment;
    1570 
    1571     extract($args, EXTR_SKIP);
    1572 
    1573 
    1574 
    1575     if ( 'div' == $args['style'] ) {
    1576 
    1577         $tag = 'div';
    1578 
    1579         $add_below = 'comment';
    1580 
    1581     } else {
    1582 
    1583         $tag = 'li ';
    1584 
    1585         $add_below = 'div-comment';
     1569        $GLOBALS['comment'] = $comment;
     1570
     1571        extract($args, EXTR_SKIP);
     1572
     1573
     1574
     1575        if ( 'div' == $args['style'] ) {
     1576
     1577            $tag = 'div';
     1578
     1579            $add_below = 'comment';
     1580
     1581        } else {
     1582
     1583            $tag = 'li ';
     1584
     1585            $add_below = 'div-comment';
     1586
     1587        }
     1588
     1589?>
     1590
     1591<li <?php //echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
     1592
     1593    <?php if ( 'div' != $args['style'] ) : ?>
     1594
     1595        <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
     1596
     1597       
     1598
     1599       
     1600
     1601         <div class="comment-meta commentmetadata">
     1602
     1603    <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
     1604
     1605    <?php
     1606
     1607        /* translators: 1: date, 2: time */
     1608
     1609        printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?>
     1610
     1611    </a>
     1612
     1613    <?php edit_comment_link(__('(Edit)'),'  ','' );?>
     1614
     1615  </div><?php //.comment-meta.commentmetadata ?>
     1616
     1617       
     1618
     1619       
     1620
     1621    <?php endif; ?>
     1622
     1623    <div class="comment-author vcard">
     1624
     1625      <?php
     1626
     1627     
     1628
     1629      if ($args['avatar_size'] != 0):
     1630
     1631          echo get_avatar( $comment, $args['avatar_size'] );
     1632
     1633      endif;
     1634
     1635      ?>
     1636
     1637   
     1638
     1639   
     1640
     1641    <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
     1642
     1643     
     1644
     1645     
     1646
     1647   
     1648
     1649     
     1650
     1651     
     1652
     1653      <div style="clear:both"></div>
     1654
     1655    </div><?php //.comment-author vcard ?>
     1656
     1657   
     1658
     1659  <?php
     1660
     1661    if($comment->comment_approved == '0') : ?>
     1662
     1663        <em class="comment-awaiting-moderation">
     1664
     1665            <?php _e('Your comment is awaiting moderation.') ?>
     1666
     1667        </em>
     1668
     1669        <br />
     1670
     1671  <?php endif; ?>
     1672
     1673 
     1674
     1675 
     1676
     1677 
     1678
     1679<?php   //Upvote DownVote Actions
     1680
     1681 
     1682
     1683  $comment_karma = $comment->comment_karma;
     1684
     1685  $comment_nonce = wp_create_nonce("upvote_downvote_flag_nonce");
     1686
     1687  $flag_nonce = wp_create_nonce("flag_nonce");
     1688
     1689  ob_start();?>
     1690
     1691    <style type="text/css">
     1692
     1693        .comment_vote_action{ display:block; overflow:hidden; margin-right:5px;}
     1694
     1695         .comment_karma_count{ float:none; margin-right:5px; vertical-align:middle;}
     1696
     1697    </style>
     1698
     1699    <div class="comment_controls">
     1700
     1701       
     1702
     1703<a data-nonce="<?php echo $comment_nonce; ?>" class="upvote comment_vote_action" href="javascript:void(0)" data_action="upvote" data-comment_id="<?php echo $comment->comment_ID;?>">
     1704<?php
     1705echo '<img src="' . plugins_url( '../../assets/upvote.png' , __FILE__ ) . '" class="votingbutton"> ';
     1706?>
     1707</a>
     1708             <div class="comment_karma_count"><?php echo $comment_karma; ?></div>
     1709<a data-nonce="<?php echo $comment_nonce; ?>" class="downvote comment_vote_action" href="javascript:void(0)" data_action="downvote"  data-comment_id="<?php echo $comment->comment_ID;?>">
     1710<?php
     1711echo '<img src="' . plugins_url( '../../assets/downvote.png' , __FILE__ ) . '" class="votingbutton"> ';
     1712?>
     1713</a>
     1714 <?php /*?><a  data-nonce="<?php echo $comment_nonce; ?>" class="flag comment_vote_action" href="javascript:void(0)" data_action="flag"  data-comment_id="<?php echo $comment->comment_ID;?>"><strong>!</strong>Flag Comment</a><?php */?>
     1715
     1716        </div>
     1717
     1718<?php
     1719
     1720      $upvote_downvote = ob_get_contents();
     1721
     1722      ob_end_clean();
     1723
     1724      echo $upvote_downvote
     1725
     1726   //End Upvote Down Vote Controls. ?>
     1727
     1728 
     1729
     1730 
     1731
     1732  <?php comment_text() ?>
     1733
     1734 
     1735
     1736 
     1737
     1738 
     1739
     1740  <div class="reply">
     1741
     1742    <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
     1743
     1744  </div>
     1745
     1746  <?php if ( 'div' != $args['style'] ) : ?>
     1747
     1748        </div>
     1749
     1750<?php endif; ?>
     1751
     1752<?php
     1753
     1754}//mytheme_comment
     1755
     1756
     1757
     1758
     1759
     1760
     1761
     1762//----------------------------
     1763
     1764//Comment_walker
     1765
     1766//----------------------------
     1767
     1768/** COMMENTS WALKER */
     1769
     1770class zipGun_walker_comment extends Walker_Comment {/**
     1771
     1772     * What the class handles.
     1773
     1774     *
     1775
     1776     * @see Walker::$tree_type
     1777
     1778     *
     1779
     1780     * @since 2.7.0
     1781
     1782     * @var string
     1783
     1784     */
     1785
     1786    var $tree_type = 'comment';
     1787
     1788
     1789
     1790    /**
     1791
     1792     * DB fields to use.
     1793
     1794     *
     1795
     1796     * @see Walker::$db_fields
     1797
     1798     *
     1799
     1800     * @since 2.7.0
     1801
     1802     * @var array
     1803
     1804     */
     1805
     1806    var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
     1807
     1808
     1809
     1810    /**
     1811
     1812     * Start the list before the elements are added.
     1813
     1814     *
     1815
     1816     * @see Walker::start_lvl()
     1817
     1818     *
     1819
     1820     * @since 2.7.0
     1821
     1822     *
     1823
     1824     * @param string $output Passed by reference. Used to append additional content.
     1825
     1826     * @param int $depth Depth of comment.
     1827
     1828     * @param array $args Uses 'style' argument for type of HTML list.
     1829
     1830     */
     1831
     1832    function start_lvl( &$output, $depth = 0, $args = array() ) {
     1833
     1834        $GLOBALS['comment_depth'] = $depth + 1;
     1835
     1836
     1837
     1838        switch ( $args['style'] ) {
     1839
     1840            case 'div':
     1841
     1842                break;
     1843
     1844            case 'ol':
     1845
     1846                $output .= '<ol class="children">' . "\n";
     1847
     1848                break;
     1849
     1850            default:
     1851
     1852            case 'ul':
     1853
     1854                $output .= '<ul class="children">' . "\n";
     1855
     1856                break;
     1857
     1858        }
    15861859
    15871860    }
    15881861
     1862
     1863
     1864    /**
     1865
     1866     * End the list of items after the elements are added.
     1867
     1868     *
     1869
     1870     * @see Walker::end_lvl()
     1871
     1872     *
     1873
     1874     * @since 2.7.0
     1875
     1876     *
     1877
     1878     * @param string $output Passed by reference. Used to append additional content.
     1879
     1880     * @param int    $depth  Depth of comment.
     1881
     1882     * @param array  $args   Will only append content if style argument value is 'ol' or 'ul'.
     1883
     1884     */
     1885
     1886    function end_lvl( &$output, $depth = 0, $args = array() ) {
     1887
     1888        $GLOBALS['comment_depth'] = $depth + 1;
     1889
     1890
     1891
     1892        switch ( $args['style'] ) {
     1893
     1894            case 'div':
     1895
     1896                break;
     1897
     1898            case 'ol':
     1899
     1900                $output .= "</ol><!-- .children -->\n";
     1901
     1902                break;
     1903
     1904            default:
     1905
     1906            case 'ul':
     1907
     1908                $output .= "</ul><!-- .children -->\n";
     1909
     1910                break;
     1911
     1912        }
     1913
     1914    }
     1915
     1916
     1917
     1918    /**
     1919
     1920     * Traverse elements to create list from elements.
     1921
     1922     *
     1923
     1924     * This function is designed to enhance Walker::display_element() to
     1925
     1926     * display children of higher nesting levels than selected inline on
     1927
     1928     * the highest depth level displayed. This prevents them being orphaned
     1929
     1930     * at the end of the comment list.
     1931
     1932     *
     1933
     1934     * Example: max_depth = 2, with 5 levels of nested content.
     1935
     1936     * 1
     1937
     1938     *  1.1
     1939
     1940     *    1.1.1
     1941
     1942     *    1.1.1.1
     1943
     1944     *    1.1.1.1.1
     1945
     1946     *    1.1.2
     1947
     1948     *    1.1.2.1
     1949
     1950     * 2
     1951
     1952     *  2.2
     1953
     1954     *
     1955
     1956     * @see Walker::display_element()
     1957
     1958     *
     1959
     1960     * @since 2.7.0
     1961
     1962     *
     1963
     1964     * @param object $element           Data object.
     1965
     1966     * @param array  $children_elements List of elements to continue traversing.
     1967
     1968     * @param int    $max_depth         Max depth to traverse.
     1969
     1970     * @param int    $depth             Depth of current element.
     1971
     1972     * @param array  $args              An array of arguments. @see wp_list_comments()
     1973
     1974     * @param string $output            Passed by reference. Used to append additional content.
     1975
     1976     * @return null Null on failure with no changes to parameters.
     1977
     1978     */
     1979
     1980    function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
     1981
     1982
     1983
     1984        if ( !$element )
     1985
     1986            return;
     1987
     1988
     1989
     1990        $id_field = $this->db_fields['id'];
     1991
     1992        $id = $element->$id_field;
     1993
     1994
     1995
     1996        parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
     1997
     1998
     1999
     2000        // If we're at the max depth, and the current element still has children, loop over those and display them at this level
     2001
     2002        // This is to prevent them being orphaned to the end of the list.
     2003
     2004        if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) {
     2005
     2006            foreach ( $children_elements[ $id ] as $child )
     2007
     2008                $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
     2009
     2010
     2011
     2012            unset( $children_elements[ $id ] );
     2013
     2014        }
     2015
     2016
     2017
     2018    }
     2019
     2020
     2021
     2022    /**
     2023
     2024     * Start the element output.
     2025
     2026     *
     2027
     2028     * @see Walker::start_el()
     2029
     2030     *
     2031
     2032     * @since 2.7.0
     2033
     2034     *
     2035
     2036     * @param string $output  Passed by reference. Used to append additional content.
     2037
     2038     * @param object $comment Comment data object.
     2039
     2040     * @param int    $depth   Depth of comment in reference to parents.
     2041
     2042     * @param array  $args    An array of arguments. @see wp_list_comments()
     2043
     2044     */
     2045
     2046    function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
     2047
     2048        $depth++;
     2049
     2050        $GLOBALS['comment_depth'] = $depth;
     2051
     2052        $GLOBALS['comment'] = $comment;
     2053
     2054
     2055
     2056        if ( !empty( $args['callback'] ) ) {
     2057
     2058            ob_start();
     2059
     2060            call_user_func( $args['callback'], $comment, $args, $depth );
     2061
     2062            $output .= ob_get_clean();
     2063
     2064            return;
     2065
     2066        }
     2067
     2068
     2069
     2070        if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
     2071
     2072            ob_start();
     2073
     2074            $this->ping( $comment, $depth, $args );
     2075
     2076            $output .= ob_get_clean();
     2077
     2078        } elseif ( 'html5' === $args['format'] ) {
     2079
     2080            ob_start();
     2081
     2082            $this->html5_comment( $comment, $depth, $args );
     2083
     2084            $output .= ob_get_clean();
     2085
     2086        } else {
     2087
     2088            ob_start();
     2089
     2090            $this->comment( $comment, $depth, $args );
     2091
     2092            $output .= ob_get_clean();
     2093
     2094        }
     2095
     2096    }
     2097
     2098
     2099
     2100    /**
     2101
     2102     * Ends the element output, if needed.
     2103
     2104     *
     2105
     2106     * @see Walker::end_el()
     2107
     2108     *
     2109
     2110     * @since 2.7.0
     2111
     2112     *
     2113
     2114     * @param string $output  Passed by reference. Used to append additional content.
     2115
     2116     * @param object $comment The comment object. Default current comment.
     2117
     2118     * @param int    $depth   Depth of comment.
     2119
     2120     * @param array  $args    An array of arguments. @see wp_list_comments()
     2121
     2122     */
     2123
     2124    function end_el( &$output, $comment, $depth = 0, $args = array() ) {
     2125
     2126        if ( !empty( $args['end-callback'] ) ) {
     2127
     2128            ob_start();
     2129
     2130            call_user_func( $args['end-callback'], $comment, $args, $depth );
     2131
     2132            $output .= ob_get_clean();
     2133
     2134            return;
     2135
     2136        }
     2137
     2138        if ( 'div' == $args['style'] )
     2139
     2140            $output .= "</div><!-- #comment-## -->\n";
     2141
     2142        else
     2143
     2144            $output .= "</li><!-- #comment-## -->\n";
     2145
     2146    }
     2147
     2148
     2149
     2150    /**
     2151
     2152     * Output a pingback comment.
     2153
     2154     *
     2155
     2156     * @access protected
     2157
     2158     * @since 3.6.0
     2159
     2160     *
     2161
     2162     * @param object $comment The comment object.
     2163
     2164     * @param int    $depth   Depth of comment.
     2165
     2166     * @param array  $args    An array of arguments. @see wp_list_comments()
     2167
     2168     */
     2169
     2170    protected function ping( $comment, $depth, $args ) {
     2171
     2172        $tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
     2173
    15892174?>
    15902175
    1591 <li <?php //echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    1592 
    1593     <?php if ( 'div' != $args['style'] ) : ?>
    1594 
    1595         <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    1596 
    1597         <div class="comment-author-container">
    1598 
    1599             <div class="comment-author vcard">
    1600 
    1601                 <?php
    1602                     if ($args['avatar_size'] != 0):
    1603 
    1604                         echo get_avatar( $comment, $args['avatar_size'] );
    1605 
    1606                     endif;
    1607 
    1608                 ?>
    1609                 <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
    1610                 <span style="padding: 0 6px;">|</span>
    1611 
    1612                 <!-- <div style="clear:both"></div> -->
    1613 
    1614                  <!-- <div class="comment-meta commentmetadata"> -->
    1615 
    1616                     <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
    1617 
    1618                     <?php
    1619 
    1620                         /* translators: 1: date, 2: time */
    1621 
    1622                         printf( __('%1$s at %2$s'), get_comment_date("n/d/Y"),  get_comment_time()) ?>
    1623 
    1624                     </a>
    1625 
    1626                     <?php edit_comment_link(__('(Edit)'),'  ','' );?>
    1627                 <!-- </div><?php //.comment-meta.commentmetadata ?> -->
    1628             </div>
    1629 
    1630             <div class="comment-collapse-button"><a href="#">-</a></div>
    1631 
    1632 
    1633            
    1634             <div style="clear:both"></div>
    1635         </div>
    1636     <?php endif; ?>
    1637 
    1638            
    1639 
    1640    
    1641 
    1642   <?php
    1643 
    1644     if($comment->comment_approved == '0') : ?>
    1645 
    1646         <em class="comment-awaiting-moderation">
    1647 
    1648             <?php _e('Your comment is awaiting moderation.') ?>
    1649 
    1650         </em>
    1651 
    1652         <br />
    1653 
    1654   <?php endif; ?>
    1655 
    1656  
    1657 
    1658  
    1659 
    1660  
    1661   <div class="comment-collapse">
    1662 
    1663   <?php comment_text() ?>
    1664 
    1665  
    1666 
    1667  
    1668 <?php   //Upvote DownVote Actions
    1669 
    1670  
    1671 
    1672   $comment_karma = $comment->comment_karma;
    1673 
    1674   $comment_nonce = wp_create_nonce("upvote_downvote_flag_nonce");
    1675 
    1676   $flag_nonce = wp_create_nonce("flag_nonce");
    1677 
    1678   ob_start();?>
    1679 
    1680 
    1681     <div class="comment_controls">
    1682 
    1683        
    1684 
    1685             <a data-nonce="<?php echo $comment_nonce; ?>" class="upvote comment_vote_action" href="javascript:void(0)" data_action="upvote" data-comment_id="<?php echo $comment->comment_ID;?>">
     2176        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
     2177
     2178            <div class="comment-body">
     2179
     2180                <?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
     2181
     2182            </div>
     2183
     2184<?php
     2185
     2186    }
     2187
     2188
     2189
     2190    /**
     2191
     2192     * Output a single comment.
     2193
     2194     *
     2195
     2196     * @access protected
     2197
     2198     * @since 3.6.0
     2199
     2200     *
     2201
     2202     * @param object $comment Comment to display.
     2203
     2204     * @param int    $depth   Depth of comment.
     2205
     2206     * @param array  $args    An array of arguments. @see wp_list_comments()
     2207
     2208     */
     2209
     2210    protected function comment( $comment, $depth, $args ) {
     2211
     2212        if ( 'div' == $args['style'] ) {
     2213
     2214            $tag = 'div';
     2215
     2216            $add_below = 'comment';
     2217
     2218        } else {
     2219
     2220            $tag = 'li';
     2221
     2222            $add_below = 'div-comment';
     2223
     2224        }
     2225
     2226       
     2227
     2228?>
     2229
     2230        < <?php echo $tag; ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
     2231
     2232        <?php if ( 'div' != $args['style'] ) : ?>
     2233
     2234        <div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
     2235
     2236        <?php endif; ?>
     2237
     2238        <div class="comment-author vcard">
     2239
     2240            <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
     2241
     2242            <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
     2243
     2244        </div>
     2245
     2246        <?php if ( '0' == $comment->comment_approved ) : ?>
     2247
     2248        <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>
     2249
     2250        <br />
     2251
     2252        <?php endif; ?>
     2253
     2254
     2255
     2256        <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
     2257
    16862258            <?php
    1687             echo '<img src="' . plugins_url( '../../assets/upvote.png' , __FILE__ ) . '" class="votingbutton"> ';
     2259
     2260                /* translators: 1: date, 2: time */
     2261
     2262                printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     2263
    16882264            ?>
    1689             </a>
    1690                          <div class="comment_karma_count"><?php echo $comment_karma; ?></div>
    1691             <a data-nonce="<?php echo $comment_nonce; ?>" class="downvote comment_vote_action" href="javascript:void(0)" data_action="downvote"  data-comment_id="<?php echo $comment->comment_ID;?>">
    1692             <?php
    1693             echo '<img src="' . plugins_url( '../../assets/downvote.png' , __FILE__ ) . '" class="votingbutton"> ';
    1694             ?>
    1695             </a>
    1696              
    1697 
    1698     </div>
    1699 
    1700 <?php
    1701 
    1702       $upvote_downvote = ob_get_contents();
    1703 
    1704       ob_end_clean();
    1705 
    1706      
    1707 
    1708    //End Upvote Down Vote Controls. ?>
    1709 
    1710  
    1711 
    1712  
    1713 
    1714   <div class="reply-vote-share-container">
    1715 
    1716     <?php  echo $upvote_downvote; ?>
    1717 
    1718     <span class="comment-pipe">|</span>
    1719      
    1720 
    1721         <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    1722 
    1723      
    1724       <!-- <span class="comment-pipe">|</span>
    1725       <a href="#">Share</a>
    1726       <div class="comment-social-share">aaa</div> -->
    1727 
    1728   </div>
    1729 
    1730   </div>
    1731  
    1732 
    1733 
    1734   <?php if ( 'div' != $args['style'] ) : ?>
    17352265
    17362266        </div>
    17372267
    1738 <?php endif; ?>
     2268
     2269
     2270        <?php comment_text( get_comment_id(), array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
     2271
     2272
     2273
     2274        <div class="reply">
     2275
     2276            <?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
     2277
     2278        </div>
     2279
     2280        <?php if ( 'div' != $args['style'] ) : ?>
     2281
     2282        </div>
     2283
     2284        <?php endif; ?>
    17392285
    17402286<?php
    17412287
    1742 }//mytheme_comment
    1743 
    1744 
    1745 
    1746 
    1747 
    1748 
     2288    }
     2289
     2290
     2291
     2292    /**
     2293
     2294     * Output a comment in the HTML5 format.
     2295
     2296     *
     2297
     2298     * @access protected
     2299
     2300     * @since 3.6.0
     2301
     2302     *
     2303
     2304     * @param object $comment Comment to display.
     2305
     2306     * @param int    $depth   Depth of comment.
     2307
     2308     * @param array  $args    An array of arguments. @see wp_list_comments()
     2309
     2310     */
     2311
     2312    protected function html5_comment( $comment, $depth, $args ) {
     2313
     2314        $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
     2315
     2316?>
     2317
     2318        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
     2319
     2320            <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
     2321
     2322                <footer class="comment-meta">
     2323
     2324                    <div class="comment-author vcard">
     2325
     2326                        <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
     2327
     2328                        <?php printf( __( '%s <span class="says">says:</span>' ), sprintf( '<b class="fn">%s</b>', get_comment_author_link() ) ); ?>
     2329
     2330                    </div><!-- .comment-author -->
     2331
     2332
     2333
     2334                    <div class="comment-metadata">
     2335
     2336                        <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
     2337
     2338                            <time datetime="<?php comment_time( 'c' ); ?>">
     2339
     2340                                <?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
     2341
     2342                            </time>
     2343
     2344                        </a>
     2345
     2346                        <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
     2347
     2348                    </div><!-- .comment-metadata -->
     2349
     2350
     2351
     2352                    <?php if ( '0' == $comment->comment_approved ) : ?>
     2353
     2354                    <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
     2355
     2356                    <?php endif; ?>
     2357
     2358                </footer><!-- .comment-meta -->
     2359
     2360
     2361
     2362                <div class="comment-content">
     2363
     2364                    <?php comment_text(); ?>
     2365
     2366                </div><!-- .comment-content -->
     2367
     2368
     2369
     2370                <div class="reply">
     2371
     2372                    <?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
     2373
     2374                </div><!-- .reply -->
     2375
     2376            </article><!-- .comment-body -->
     2377
     2378<?php
     2379
     2380    }
     2381
     2382}
    17492383
    17502384//----------------------------
    17512385
    1752 //Comment_walker
     2386//END Comment_walker
    17532387
    17542388//----------------------------
    1755 
    1756 /** COMMENTS WALKER */
    1757 
    1758 class zipGun_walker_comment extends Walker_Comment {/**
    1759 
    1760      * What the class handles.
    1761 
    1762      *
    1763 
    1764      * @see Walker::$tree_type
    1765 
    1766      *
    1767 
    1768      * @since 2.7.0
    1769 
    1770      * @var string
    1771 
    1772      */
    1773 
    1774     var $tree_type = 'comment';
    1775 
    1776 
    1777 
    1778     /**
    1779 
    1780      * DB fields to use.
    1781 
    1782      *
    1783 
    1784      * @see Walker::$db_fields
    1785 
    1786      *
    1787 
    1788      * @since 2.7.0
    1789 
    1790      * @var array
    1791 
    1792      */
    1793 
    1794     var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
    1795 
    1796 
    1797 
    1798     /**
    1799 
    1800      * Start the list before the elements are added.
    1801 
    1802      *
    1803 
    1804      * @see Walker::start_lvl()
    1805 
    1806      *
    1807 
    1808      * @since 2.7.0
    1809 
    1810      *
    1811 
    1812      * @param string $output Passed by reference. Used to append additional content.
    1813 
    1814      * @param int $depth Depth of comment.
    1815 
    1816      * @param array $args Uses 'style' argument for type of HTML list.
    1817 
    1818      */
    1819 
    1820     function start_lvl( &$output, $depth = 0, $args = array() ) {
    1821 
    1822         $GLOBALS['comment_depth'] = $depth + 1;
    1823 
    1824 
    1825 
    1826         switch ( $args['style'] ) {
    1827 
    1828             case 'div':
    1829 
    1830                 break;
    1831 
    1832             case 'ol':
    1833 
    1834                 $output .= '<ol class="children">' . "\n";
    1835 
    1836                 break;
    1837 
    1838             default:
    1839 
    1840             case 'ul':
    1841 
    1842                 $output .= '<ul class="children">' . "\n";
    1843 
    1844                 break;
    1845 
    1846         }
    1847 
    1848     }
    1849 
    1850 
    1851 
    1852     /**
    1853 
    1854      * End the list of items after the elements are added.
    1855 
    1856      *
    1857 
    1858      * @see Walker::end_lvl()
    1859 
    1860      *
    1861 
    1862      * @since 2.7.0
    1863 
    1864      *
    1865 
    1866      * @param string $output Passed by reference. Used to append additional content.
    1867 
    1868      * @param int    $depth  Depth of comment.
    1869 
    1870      * @param array  $args   Will only append content if style argument value is 'ol' or 'ul'.
    1871 
    1872      */
    1873 
    1874     function end_lvl( &$output, $depth = 0, $args = array() ) {
    1875 
    1876         $GLOBALS['comment_depth'] = $depth + 1;
    1877 
    1878 
    1879 
    1880         switch ( $args['style'] ) {
    1881 
    1882             case 'div':
    1883 
    1884                 break;
    1885 
    1886             case 'ol':
    1887 
    1888                 $output .= "</ol><!-- .children -->\n";
    1889 
    1890                 break;
    1891 
    1892             default:
    1893 
    1894             case 'ul':
    1895 
    1896                 $output .= "</ul><!-- .children -->\n";
    1897 
    1898                 break;
    1899 
    1900         }
    1901 
    1902     }
    1903 
    1904 
    1905 
    1906     /**
    1907 
    1908      * Traverse elements to create list from elements.
    1909 
    1910      *
    1911 
    1912      * This function is designed to enhance Walker::display_element() to
    1913 
    1914      * display children of higher nesting levels than selected inline on
    1915 
    1916      * the highest depth level displayed. This prevents them being orphaned
    1917 
    1918      * at the end of the comment list.
    1919 
    1920      *
    1921 
    1922      * Example: max_depth = 2, with 5 levels of nested content.
    1923 
    1924      * 1
    1925 
    1926      *  1.1
    1927 
    1928      *    1.1.1
    1929 
    1930      *    1.1.1.1
    1931 
    1932      *    1.1.1.1.1
    1933 
    1934      *    1.1.2
    1935 
    1936      *    1.1.2.1
    1937 
    1938      * 2
    1939 
    1940      *  2.2
    1941 
    1942      *
    1943 
    1944      * @see Walker::display_element()
    1945 
    1946      *
    1947 
    1948      * @since 2.7.0
    1949 
    1950      *
    1951 
    1952      * @param object $element           Data object.
    1953 
    1954      * @param array  $children_elements List of elements to continue traversing.
    1955 
    1956      * @param int    $max_depth         Max depth to traverse.
    1957 
    1958      * @param int    $depth             Depth of current element.
    1959 
    1960      * @param array  $args              An array of arguments. @see wp_list_comments()
    1961 
    1962      * @param string $output            Passed by reference. Used to append additional content.
    1963 
    1964      * @return null Null on failure with no changes to parameters.
    1965 
    1966      */
    1967 
    1968     function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
    1969 
    1970 
    1971 
    1972         if ( !$element )
    1973 
    1974             return;
    1975 
    1976 
    1977 
    1978         $id_field = $this->db_fields['id'];
    1979 
    1980         $id = $element->$id_field;
    1981 
    1982 
    1983 
    1984         parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
    1985 
    1986 
    1987 
    1988         // If we're at the max depth, and the current element still has children, loop over those and display them at this level
    1989 
    1990         // This is to prevent them being orphaned to the end of the list.
    1991 
    1992         if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) {
    1993 
    1994             foreach ( $children_elements[ $id ] as $child )
    1995 
    1996                 $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
    1997 
    1998 
    1999 
    2000             unset( $children_elements[ $id ] );
    2001 
    2002         }
    2003 
    2004 
    2005 
    2006     }
    2007 
    2008 
    2009 
    2010     /**
    2011 
    2012      * Start the element output.
    2013 
    2014      *
    2015 
    2016      * @see Walker::start_el()
    2017 
    2018      *
    2019 
    2020      * @since 2.7.0
    2021 
    2022      *
    2023 
    2024      * @param string $output  Passed by reference. Used to append additional content.
    2025 
    2026      * @param object $comment Comment data object.
    2027 
    2028      * @param int    $depth   Depth of comment in reference to parents.
    2029 
    2030      * @param array  $args    An array of arguments. @see wp_list_comments()
    2031 
    2032      */
    2033 
    2034     function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
    2035 
    2036         $depth++;
    2037 
    2038         $GLOBALS['comment_depth'] = $depth;
    2039 
    2040         $GLOBALS['comment'] = $comment;
    2041 
    2042 
    2043 
    2044         if ( !empty( $args['callback'] ) ) {
    2045 
    2046             ob_start();
    2047 
    2048             call_user_func( $args['callback'], $comment, $args, $depth );
    2049 
    2050             $output .= ob_get_clean();
    2051 
    2052             return;
    2053 
    2054         }
    2055 
    2056 
    2057 
    2058         if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
    2059 
    2060             ob_start();
    2061 
    2062             $this->ping( $comment, $depth, $args );
    2063 
    2064             $output .= ob_get_clean();
    2065 
    2066         } elseif ( 'html5' === $args['format'] ) {
    2067 
    2068             ob_start();
    2069 
    2070             $this->html5_comment( $comment, $depth, $args );
    2071 
    2072             $output .= ob_get_clean();
    2073 
    2074         } else {
    2075 
    2076             ob_start();
    2077 
    2078             $this->comment( $comment, $depth, $args );
    2079 
    2080             $output .= ob_get_clean();
    2081 
    2082         }
    2083 
    2084     }
    2085 
    2086 
    2087 
    2088     /**
    2089 
    2090      * Ends the element output, if needed.
    2091 
    2092      *
    2093 
    2094      * @see Walker::end_el()
    2095 
    2096      *
    2097 
    2098      * @since 2.7.0
    2099 
    2100      *
    2101 
    2102      * @param string $output  Passed by reference. Used to append additional content.
    2103 
    2104      * @param object $comment The comment object. Default current comment.
    2105 
    2106      * @param int    $depth   Depth of comment.
    2107 
    2108      * @param array  $args    An array of arguments. @see wp_list_comments()
    2109 
    2110      */
    2111 
    2112     function end_el( &$output, $comment, $depth = 0, $args = array() ) {
    2113 
    2114         if ( !empty( $args['end-callback'] ) ) {
    2115 
    2116             ob_start();
    2117 
    2118             call_user_func( $args['end-callback'], $comment, $args, $depth );
    2119 
    2120             $output .= ob_get_clean();
    2121 
    2122             return;
    2123 
    2124         }
    2125 
    2126         if ( 'div' == $args['style'] )
    2127 
    2128             $output .= "</div><!-- #comment-## -->\n";
    2129 
    2130         else
    2131 
    2132             $output .= "</li><!-- #comment-## -->\n";
    2133 
    2134     }
    2135 
    2136 
    2137 
    2138     /**
    2139 
    2140      * Output a pingback comment.
    2141 
    2142      *
    2143 
    2144      * @access protected
    2145 
    2146      * @since 3.6.0
    2147 
    2148      *
    2149 
    2150      * @param object $comment The comment object.
    2151 
    2152      * @param int    $depth   Depth of comment.
    2153 
    2154      * @param array  $args    An array of arguments. @see wp_list_comments()
    2155 
    2156      */
    2157 
    2158     protected function ping( $comment, $depth, $args ) {
    2159 
    2160         $tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
    2161 
    2162 ?>
    2163 
    2164         <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
    2165 
    2166             <div class="comment-body">
    2167 
    2168                 <?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
    2169 
    2170             </div>
    2171 
    2172 <?php
    2173 
    2174     }
    2175 
    2176 
    2177 
    2178     /**
    2179 
    2180      * Output a single comment.
    2181 
    2182      *
    2183 
    2184      * @access protected
    2185 
    2186      * @since 3.6.0
    2187 
    2188      *
    2189 
    2190      * @param object $comment Comment to display.
    2191 
    2192      * @param int    $depth   Depth of comment.
    2193 
    2194      * @param array  $args    An array of arguments. @see wp_list_comments()
    2195 
    2196      */
    2197 
    2198     protected function comment( $comment, $depth, $args ) {
    2199 
    2200         if ( 'div' == $args['style'] ) {
    2201 
    2202             $tag = 'div';
    2203 
    2204             $add_below = 'comment';
    2205 
    2206         } else {
    2207 
    2208             $tag = 'li';
    2209 
    2210             $add_below = 'div-comment';
    2211 
    2212         }
    2213 
    2214        
    2215 
    2216 ?>
    2217 
    2218         < <?php echo $tag; ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
    2219 
    2220         <?php if ( 'div' != $args['style'] ) : ?>
    2221 
    2222         <div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    2223 
    2224         <?php endif; ?>
    2225 
    2226         <div class="comment-author vcard">
    2227 
    2228             <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    2229 
    2230             <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
    2231 
    2232         </div>
    2233 
    2234         <?php if ( '0' == $comment->comment_approved ) : ?>
    2235 
    2236         <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>
    2237 
    2238         <br />
    2239 
    2240         <?php endif; ?>
    2241 
    2242 
    2243 
    2244         <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
    2245 
    2246             <?php
    2247 
    2248                 /* translators: 1: date, 2: time */
    2249 
    2250                 printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
    2251 
    2252             ?>
    2253 
    2254         </div>
    2255 
    2256 
    2257 
    2258         <?php comment_text( get_comment_id(), array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    2259 
    2260 
    2261 
    2262         <div class="reply">
    2263 
    2264             <?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    2265 
    2266         </div>
    2267 
    2268         <?php if ( 'div' != $args['style'] ) : ?>
    2269 
    2270         </div>
    2271 
    2272         <?php endif; ?>
    2273 
    2274 <?php
    2275 
    2276     }
    2277 
    2278 
    2279 
    2280     /**
    2281 
    2282      * Output a comment in the HTML5 format.
    2283 
    2284      *
    2285 
    2286      * @access protected
    2287 
    2288      * @since 3.6.0
    2289 
    2290      *
    2291 
    2292      * @param object $comment Comment to display.
    2293 
    2294      * @param int    $depth   Depth of comment.
    2295 
    2296      * @param array  $args    An array of arguments. @see wp_list_comments()
    2297 
    2298      */
    2299 
    2300     protected function html5_comment( $comment, $depth, $args ) {
    2301 
    2302         $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
    2303 
    2304 ?>
    2305 
    2306         <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
    2307 
    2308             <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    2309 
    2310                 <footer class="comment-meta">
    2311 
    2312                     <div class="comment-author vcard">
    2313 
    2314                         <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    2315 
    2316                         <?php printf( __( '%s <span class="says">says:</span>' ), sprintf( '<b class="fn">%s</b>', get_comment_author_link() ) ); ?>
    2317 
    2318                     </div><!-- .comment-author -->
    2319 
    2320 
    2321 
    2322                     <div class="comment-metadata">
    2323 
    2324                         <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
    2325 
    2326                             <time datetime="<?php comment_time( 'c' ); ?>">
    2327 
    2328                                 <?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
    2329 
    2330                             </time>
    2331 
    2332                         </a>
    2333 
    2334                         <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
    2335 
    2336                     </div><!-- .comment-metadata -->
    2337 
    2338 
    2339 
    2340                     <?php if ( '0' == $comment->comment_approved ) : ?>
    2341 
    2342                     <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
    2343 
    2344                     <?php endif; ?>
    2345 
    2346                 </footer><!-- .comment-meta -->
    2347 
    2348 
    2349 
    2350                 <div class="comment-content">
    2351 
    2352                     <?php comment_text(); ?>
    2353 
    2354                 </div><!-- .comment-content -->
    2355 
    2356 
    2357 
    2358                 <div class="reply">
    2359 
    2360                     <?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    2361 
    2362                 </div><!-- .reply -->
    2363 
    2364             </article><!-- .comment-body -->
    2365 
    2366 <?php
    2367 
    2368     }
    2369 
    2370 }
    2371 
    2372 //----------------------------
    2373 
    2374 //END Comment_walker
    2375 
    2376 //----------------------------
  • because/trunk/social-polling.php

    r1032690 r1032701  
    3434
    3535<<<<<<< .mine
    36  * Version:           1.5.0
     36 * Version:           1.4.5
    3737=======
    38  * Version:           1.5.0
     38 * Version:           1.4.5
    3939>>>>>>> .r969865
    4040
Note: See TracChangeset for help on using the changeset viewer.