Plugin Directory

Changeset 908748


Ignore:
Timestamp:
05/06/2014 08:39:49 AM (12 years ago)
Author:
ashdurham
Message:

Addition of pagingtype and activeclass shortcode options to output numbers pages.

Location:
rsskingpro
Files:
38 added
4 edited

Legend:

Unmodified
Added
Removed
  • rsskingpro/trunk/includes/output.php

    r908480 r908748  
    11<?php
    2 // [rsskingpro feedaddress="no feed" display=5 order="desc" dateformat="j F Y, g:i a" target="_self" titlelength="all" descriptionlength="all" contentlength="all" format="<div class='rsskp_itemhead'><span class='rsskp_date'>##PUBDATE##</span><h1 class='entry_title'>##LINK##</h1></div><div class='rsskp_content'>##DESCRIPTION##</div>" class="" timezone="UTC" paging=true ajax=false nextpagetext="Next Page" prevpagetext="Previous Page" nextpageclass="rss_pagination_next" prevpageclass="rss_pagination_prev"]
     2// [rsskingpro feedaddress="no feed" display=5 order="desc" dateformat="j F Y, g:i a" target="_self" titlelength="all" descriptionlength="all" contentlength="all" format="<div class='rsskp_itemhead'><span class='rsskp_date'>##PUBDATE##</span><h1 class='entry_title'>##LINK##</h1></div><div class='rsskp_content'>##DESCRIPTION##</div>" class="" timezone="UTC" paging=true pagingtype='paging' ajax=false nextpagetext="Next Page" prevpagetext="Previous Page" nextpageclass="rss_pagination_next" prevpageclass="rss_pagination_prev" activeclass="rss_pagination_active"]
    33
    44function rsskingpro_func($atts) {
     
    1616    'timezone' => 'UTC',
    1717    'paging' => true,
     18    'pagingtype' => 'paging',
    1819    'ajax' => false,
    1920    'nextpagetext' => 'Next Page',
    2021    'prevpagetext' => 'Previous Page',
    2122    'nextpageclass' => 'rss_pagination_next',
    22     'prevpageclass' => 'rss_pagination_prev'
     23    'prevpageclass' => 'rss_pagination_prev',
     24    'activeclass' => 'rss_pagination_active'
    2325        ), $atts ) );
    2426   
     
    179181            $pagination = '';
    180182            if ($paging) {
     183                $pages = ceil($totalitems / $display);
    181184                if ($ajax) {
    182185                    // Button to load feed via ajax
     
    185188                } else {
    186189                    // Button for next page
    187                     if ($page > 1)
    188                         $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page-1)."' class='".$prevpageclass."'>".$prevpagetext."</a>";
    189                     if ($totalitems > ($page * $display))
    190                         $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page+1)."' class='".$nextpageclass."'>".$nextpagetext."</a>";
     190                    if ($pagingtype == 'numbers') {
     191                        for ($p = 1; $p <= $pages; $p++) {
     192                            $active = '';
     193                            if ($page == $p) $active = $activeclass;
     194                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($p)."' class='".$active."'>".$p."</a>";
     195                        }
     196                    } else if ($pagingtype == 'both') {
     197                        if ($page > 1)
     198                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page-1)."' class='".$prevpageclass."'>".$prevpagetext."</a>";
     199                        for ($p = 1; $p <= $pages; $p++) {
     200                            $active = '';
     201                            if ($page == $p) $active = $activeclass;
     202                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($p)."' class='".$active."'>".$p."</a>";
     203                        }
     204                        if ($totalitems > ($page * $display))
     205                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page+1)."' class='".$nextpageclass."'>".$nextpagetext."</a>";
     206                    } else {
     207                        if ($page > 1)
     208                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page-1)."' class='".$prevpageclass."'>".$prevpagetext."</a>";
     209                        if ($totalitems > ($page * $display))
     210                            $pagination .= "<a href='".(strstr($_SERVER['REQUEST_URI'], '?') ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI'].'?')."rsskppage=".($page+1)."' class='".$nextpageclass."'>".$nextpagetext."</a>";
     211                    }
    191212                }
    192213            }
  • rsskingpro/trunk/includes/widget.php

    r799657 r908748  
    2020                <?php
    2121                if (function_exists('rsskingpro_func')){
    22                     echo do_shortcode('[rsskingpro feedaddress="'.$feedaddress.'" display='.$display.' groupby='.$groupby.' order="'.$order.'" dateformat="'.$dateformat.'" target="'.$target.'" titlelength="'.$titlelength.'" descriptionlength="'.$descriptionlength.'" contentlength="'.$contentlength.'" format="'.$format.'" class="'.$class.'" timezone="'.$timezone.'" paging='.$paging.' ajax='.$ajax.' nextpagetext="'.$nextpagetext.'" prevpagetext="'.$prevpagetext.'" nextpageclass="'.$nextpageclass.'" prevpageclass="'.$prevpageclass.'"]');
     22                    echo do_shortcode('[rsskingpro feedaddress="'.$feedaddress.'" display='.$display.' groupby='.$groupby.' order="'.$order.'" dateformat="'.$dateformat.'" target="'.$target.'" titlelength="'.$titlelength.'" descriptionlength="'.$descriptionlength.'" contentlength="'.$contentlength.'" format="'.$format.'" class="'.$class.'" timezone="'.$timezone.'" paging='.$paging.' pagingtype="'.$pagingtype.'" ajax='.$ajax.' nextpagetext="'.$nextpagetext.'" prevpagetext="'.$prevpagetext.'" nextpageclass="'.$nextpageclass.'" prevpageclass="'.$prevpageclass.'" activeclass="'.$activeclass.'"]');
    2323                }
    2424                ?>
     
    6767            else $paging = true;
    6868           
     69            if ( isset( $instance[ 'pagingtype' ] ) ) $pagingtype = $instance[ 'pagingtype' ];
     70            else $pagingtype = 'paging';
     71           
    6972            if ( isset( $instance[ 'ajax' ] ) ) $ajax = $instance[ 'ajax' ];
    7073            else $ajax = false;
     
    8184            if ( isset( $instance[ 'prevpageclass' ] ) ) $prevpageclass = $instance[ 'prevpageclass' ];
    8285            else $prevpageclass = __( 'rss_pagination_prev', 'text_domain' );
     86           
     87            if ( isset( $instance[ 'activeclass' ] ) ) $activeclass = $instance[ 'activeclass' ];
     88            else $activeclass = __( 'rss_pagination_active', 'text_domain' );
    8389           
    8490            ?>
     
    153159            </p>
    154160            <p>
     161            <label for="<?php echo $this->get_field_name( 'pagingtype' ); ?>"><?php _e( 'Paging Type:' ); ?></label>
     162            <select class="widefat" id="<?php echo $this->get_field_id( 'pagingtype' ); ?>" name="<?php echo $this->get_field_name( 'pagingtype' ); ?>">
     163                <option value='paging'<?= (esc_attr( $pagingtype ) == 'pagingtype') ? ' selected' : '' ?>>Paging</option>
     164                <option value='numbers'<?= (esc_attr( $pagingtype ) == 'numbers') ? ' selected' : '' ?>>Numbers</option>
     165                <option value='both'<?= (esc_attr( $pagingtype ) == 'both') ? ' selected' : '' ?>>Both</option>
     166            </select>
     167            </p>
     168            <p>
    155169            <label for="<?php echo $this->get_field_name( 'ajax' ); ?>"><?php _e( 'Enable Ajax:' ); ?></label>
    156170            <input type="hidden" name="<?php echo $this->get_field_name( 'ajax' ); ?>" value="0" />
     
    172186            <label for="<?php echo $this->get_field_name( 'prevpageclass' ); ?>"><?php _e( '"Next Page" Link Class:' ); ?></label>
    173187            <input class="widefat" id="<?php echo $this->get_field_id( 'prevpageclass' ); ?>" name="<?php echo $this->get_field_name( 'prevpageclass' ); ?>" type="text" value="<?php echo esc_attr( $prevpageclass ); ?>" />
     188            </p>
     189            <p>
     190            <label for="<?php echo $this->get_field_name( 'activeclass' ); ?>"><?php _e( '"Active" Link Class:' ); ?></label>
     191            <input class="widefat" id="<?php echo $this->get_field_id( 'activeclass' ); ?>" name="<?php echo $this->get_field_name( 'activeclass' ); ?>" type="text" value="<?php echo esc_attr( $activeclass ); ?>" />
    174192            </p>
    175193            <?php
     
    191209            $instance['timezone'] = ( !empty( $new_instance['timezone'] ) ) ? strip_tags( $new_instance['timezone'] ) : 'UTC';
    192210            $instance['paging'] = ( !empty( $new_instance['paging'] ) || $new_instance['paging'] == '1' ) ? true : false;
     211            $instance['pagingtype'] = ( !empty( $new_instance['pagingtype'] ) ) ? strip_tags( $new_instance['pagingtype'] ) : 'paging';
    193212            $instance['ajax'] = ( !empty( $new_instance['ajax'] ) || $new_instance['ajax'] == '1' ) ? true : false;
    194213            $instance['nextpagetext'] = ( !empty( $new_instance['nextpagetext'] ) ) ? strip_tags( $new_instance['nextpagetext'] ) : 'Next Page';
     
    196215            $instance['nextpageclass'] = ( !empty( $new_instance['nextpageclass'] ) ) ? strip_tags( $new_instance['nextpageclass'] ) : 'rss_pagination_next';
    197216            $instance['prevpageclass'] = ( !empty( $new_instance['prevpageclass'] ) ) ? strip_tags( $new_instance['prevpageclass'] ) : 'rss_pagination_prev';
     217            $instance['activeclass'] = ( !empty( $new_instance['activeclass'] ) ) ? strip_tags( $new_instance['activeclass'] ) : 'rss_pagination_active';
    198218
    199219            return $instance;
  • rsskingpro/trunk/readme.txt

    r908480 r908748  
    55Requires at least: 3.0.1
    66Tested up to: 3.9
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8181* paging
    8282`Default = true` | Enable paging of the RSS. The 'display' option then becomes how many items per page. Options are true or false
     83* pagingtype
     84`Default = paging` | Choice of the type of paging output. Options are 'paging', 'numbers' or 'both'
    8385* ajax
    8486`Default - false` | Enable AJAX loading. Instead of previous and next links for paging, this will display a 'view more posts' link which will allow the following page to load in underneath the existing list, and will continue to do so until the list is complete.
    8587* nextpagetext
    86 `Default - 'Next Page'` | Text on the 'next page' link (only displays when paging is on and ajax is off).
     88`Default - 'Next Page'` | Text on the 'next page' link (only displays when paging is on, pagingtype is 'paging' or 'both' and ajax is off).
    8789* prevpagetext
    88 `Default - 'Previous Page'` | Text on the 'previous page' link (only displays when paging is on and ajax is off).
     90`Default - 'Previous Page'` | Text on the 'previous page' link (only displays when paging is on, pagingtype is 'paging' or 'both' and ajax is off).
    8991* nextpageclass
    90 `Default - 'rss_pagination_next'` | Class on the 'next page' link (only displays when paging is on and ajax is off).
     92`Default - 'rss_pagination_next'` | Class on the 'next page' link (only displays when paging is on, pagingtype is 'paging' or 'both' and ajax is off).
    9193* prevpageclass
    92 `Default - 'rss_pagination_prev'` | Class on the 'previous page' link (only displays when paging is on and ajax is off).
     94`Default - 'rss_pagination_prev'` | Class on the 'previous page' link (only displays when paging is on, pagingtype is 'paging' or 'both' and ajax is off).
     95* activeclass
     96`Default - 'rss_pagination_active'` | Class on the 'active page' link (only displays when paging is on, pagingtype is 'numbers' or 'both' and ajax is off).
    9397= Format Variables =
    9498<p>You can control the output by defining what information is output in the format by using variables. These variables are defined by an uppercase word surrounded by hashes (2 hashes on either side). The available variables are:
     
    138142== Changelog ==
    139143
     144= 1.0.6 =
     145* Addition of pagingtype and activeclass shortcode options to output numbers pages.
     146
    140147= 1.0.5 =
    141148* Fix to URL output on pagination to handle existing GET variables
     
    161168== Upgrade Notice ==
    162169
     170= 1.0.6 =
     171* Addition of pagingtype and activeclass shortcode options to output numbers pages.
     172
    163173= 1.0.5 =
    164174* Fix to URL output on pagination to handle existing GET variables
  • rsskingpro/trunk/rsskingpro.php

    r908480 r908748  
    44    Plugin URI: http://kingpro.me/plugins/rss-king-pro/
    55    Description: RSS King Pro allows you display and format a RSS feed on a page
    6     Version: 1.0.5
     6    Version: 1.0.6
    77    Author: Ash Durham
    88    Author URI: http://durham.net.au/
     
    2828
    2929    global $rsskp_db_version;
    30     $rsskp_db_version = "1.0.5";
     30    $rsskp_db_version = "1.0.6";
    3131
    3232    function rsskp_install() {
Note: See TracChangeset for help on using the changeset viewer.