Plugin Directory

Changeset 586897


Ignore:
Timestamp:
08/17/2012 03:58:02 PM (14 years ago)
Author:
jasie
Message:

added options for the styling of the pagination bar

Location:
widget-pagination/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • widget-pagination/trunk/inc/wgpag-options.php

    r558066 r586897  
    418418                    </tr>
    419419                </table>
     420
     421                <h4><?php _e("Pagination Bar", 'wgpag') ?></h4>
     422
     423                <table class="form-table">
     424                    <tr>
     425                        <th>
     426                            <label for="wgpag-pagination_style_background_color"><?php _e("Background colour", 'wgpag') ?>:</label>
     427                        </th>
     428                        <td>
     429                            <input type="text" size="7" maxlength="7"
     430                                name="wgpag-pagination_style_background_color"
     431                                id="wgpag-pagination_style_background_color"
     432                                class="color-picker"
     433                                value="<? echo $options['pagination_style_background_color'] ?>" />
     434                            <span class="hint"><? echo $default ?>: <?php _e("transparent", 'wgpag') ?></span>
     435                        </td>
     436                    </tr>
     437                    <tr>
     438                        <th>
     439                            <label for="wgpag-pagination_style_border_color_top"><?php _e("Border colour top", 'wgpag') ?>:</label>
     440                        </th>
     441                        <td>
     442                            <input type="text" size="7" maxlength="7"
     443                                name="wgpag-pagination_style_border_color_top"
     444                                id="wgpag-pagination_style_border_color_top"
     445                                class="color-picker"
     446                                value="<? echo $options['pagination_style_border_color_top'] ?>" />
     447                            <span class="hint"><? echo $default ?>: <?php _e("transparent", 'wgpag') ?></span>
     448                        </td>
     449                    </tr>
     450                    <tr>
     451                        <th>
     452                            <label for="wgpag-pagination_style_border_color_bottom"><?php _e("Border colour bottom", 'wgpag') ?>:</label>
     453                        </th>
     454                        <td>
     455                            <input type="text" size="7" maxlength="7"
     456                                name="wgpag-pagination_style_border_color_bottom"
     457                                id="wgpag-pagination_style_border_color_bottom"
     458                                class="color-picker"
     459                                value="<? echo $options['pagination_style_border_color_bottom'] ?>" />
     460                            <span class="hint"><? echo $default ?>: <?php _e("transparent", 'wgpag') ?></span>
     461                        </td>
     462                    </tr>
     463                    <tr>
     464                        <th>
     465                            <label for="wgpag-pagination_style_border_color_left"><?php _e("Border colour left", 'wgpag') ?>:</label>
     466                        </th>
     467                        <td>
     468                            <input type="text" size="7" maxlength="7"
     469                                name="wgpag-pagination_style_border_color_left"
     470                                id="wgpag-pagination_style_border_color_left"
     471                                class="color-picker"
     472                                value="<? echo $options['pagination_style_border_color_left'] ?>" />
     473                            <span class="hint"><? echo $default ?>: <?php _e("transparent", 'wgpag') ?></span>
     474                        </td>
     475                    </tr>
     476                    <tr>
     477                        <th>
     478                            <label for="wgpag-pagination_style_border_color_right"><?php _e("Border colour right", 'wgpag') ?>:</label>
     479                        </th>
     480                        <td>
     481                            <input type="text" size="7" maxlength="7"
     482                                name="wgpag-pagination_style_border_color_right"
     483                                id="wgpag-pagination_style_border_color_right"
     484                                class="color-picker"
     485                                value="<? echo $options['pagination_style_border_color_right'] ?>" />
     486                            <span class="hint"><? echo $default ?>: <?php _e("transparent", 'wgpag') ?></span>
     487                        </td>
     488                    </tr>
     489                </table>
    420490            </div><!-- /postbox -->
    421491        </div><!-- /metabox-holder -->
  • widget-pagination/trunk/widget_pagination.php

    r558073 r586897  
    7474                                $options[$matches[1]] = $value;
    7575                        else if (preg_match('/^wgpag-(hover_item_style_.*)/', $name, $matches))
     76                                $options[$matches[1]] = $value;
     77                        else if (preg_match('/^wgpag-(pagination_style_.*)/', $name, $matches))
    7678                                $options[$matches[1]] = $value;
    7779                    }
     
    310312        private function item_css () {
    311313            $selectors = array(
    312                 'item_style' => 'a',
     314                'item_style'       => 'a',
    313315                'hover_item_style' => 'a:hover',
    314                 'cur_item_style' => '.br-current'
     316                'cur_item_style'   => '.br-current'
    315317            );
    316             $str = '';
     318            $css = '';
    317319            $options = get_option('wgpag_options');
    318320            foreach($selectors as $name => $selector) {
    319                 $str .= ".br-pagination $selector { ";
     321                $css .= ".br-pagination $selector { ";
    320322                foreach ($this->styles as $s => $title) {
    321323                    $optval = $options["${name}_$s"];
    322324                    if (!empty($optval))
    323                         $str .= "$s: $optval; ";
     325                        $css .= "$s: $optval; ";
    324326                }
    325                 $str .= "}";
    326             }
    327 
    328             $liststyle =  $options['list_item_style'];
    329             $str .= ".widget-container li { list-style-type: $liststyle; }";
    330 
    331             $horalign =  $options['pag_option_hor_align'];
    332             $str .= ".br-pagination { text-align: $horalign; }";
    333 
    334             $margintop =  $options['pag_option_margin_top'];
    335             $str .= ".br-pagination { margin-top: $margintop; }";
    336 
    337             $marginbottom =  $options['pag_option_margin_bottom'];
    338             $str .= ".br-pagination { margin-bottom: $marginbottom; }";
    339 
    340             return $str;
     327                $css .= "}";
     328            }
     329
     330            $pagcss = '';
     331
     332            $borders = array ('top', 'bottom', 'left', 'right');
     333            foreach ($borders as $border) {
     334                $borderstyle = $options['pagination_style_border_color_' . $border];
     335                if ($borderstyle)
     336                    $pagcss .= "border-$border: 1px solid $borderstyle;";
     337            }
     338
     339            $pagbg = $options['pagination_style_background_color'];
     340            if ($pagbg)
     341                $pagcss .= "background-color: $pagbg;";
     342
     343            $horalign = $options['pag_option_hor_align'];
     344            $pagcss .= "text-align: $horalign;";
     345
     346            $margintop = $options['pag_option_margin_top'];
     347            $pagcss .= "margin-top: $margintop;";
     348
     349            $marginbottom = $options['pag_option_margin_bottom'];
     350            $pagcss .= "margin-bottom: $marginbottom;";
     351
     352            $css .= ".br-pagination { $pagcss; }";
     353
     354            $liststyle = $options['list_item_style'];
     355            $css .= ".widget-container li { list-style-type: $liststyle; }";
     356
     357            return $css;
    341358        }
    342359
Note: See TracChangeset for help on using the changeset viewer.