Changeset 2757940
- Timestamp:
- 07/18/2022 01:16:26 PM (4 years ago)
- Location:
- pagebar/trunk
- Files:
-
- 19 edited
-
activate.php (modified) (2 diffs)
-
class-basebar.php (modified) (1 diff)
-
class-commentbar.php (modified) (1 diff)
-
class-multipagebar.php (modified) (1 diff)
-
class-postbar.php (modified) (1 diff)
-
css/twentyeleven.css (modified) (1 diff)
-
css/twentyten.css (modified) (2 diffs)
-
css/twentythirteen.css (modified) (1 diff)
-
css/twentytwelve.css (modified) (1 diff)
-
jquery.tabs.css (modified) (2 diffs)
-
jquery.tabs.ie.css (modified) (1 diff)
-
pagebar.css (modified) (3 diffs)
-
pagebar2.php (modified) (5 diffs)
-
pagebar_options.php (modified) (1 diff)
-
pagebar_options_commentbar.php (modified) (5 diffs)
-
pagebar_options_multipagebar.php (modified) (1 diff)
-
pagebar_options_pagebar.php (modified) (1 diff)
-
pagebar_options_postbar.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pagebar/trunk/activate.php
r955890 r2757940 5 5 6 6 // default values 7 $left = 3;8 $center = 7;9 $right = 3;10 $pdisplay = "auto";11 $ndisplay = "auto";7 $left = 3; 8 $center = 7; 9 $right = 3; 10 $pdisplay = 'auto'; 11 $ndisplay = 'auto'; 12 12 13 13 // twentyten 14 $left = 2;15 $center = 5;16 $right = 2;17 $pdisplay = "never";18 $ndisplay = "never";14 $left = 2; 15 $center = 5; 16 $right = 2; 17 $pdisplay = 'never'; 18 $ndisplay = 'never'; 19 19 20 20 // twentyeleven … … 25 25 26 26 //twentythirteen 27 $left = 2;27 $left = 2; 28 28 $center = 5; 29 $right = 2;29 $right = 2; 30 30 31 31 /* --------------------------------------------------------------------------------------- */ 32 32 33 $all_opts = array ("left" => $left, "center" => $center, "right" => $right, 34 "pbText" => "Pages:", "remove" => "on", "standard" => "{page}", 35 "current" => "{page}", "first" => "{page}", "last" => "{page}", 36 "connect" => "...", "next" => "Next", "prev" => "Prev", 37 "tooltipText" => "Page {page}", 38 "tooltips" => "on", "pdisplay" => $pdisplay, "ndisplay" => $ndisplay, 39 "stylesheet" => "styleCss", "cssFilename" => "pagebar.css", 40 "inherit" => "on"); 33 $all_opts = array( 34 'left' => $left, 35 'center' => $center, 36 'right' => $right, 37 'pbText' => 'Pages:', 38 'remove' => 'on', 39 'standard' => '{page}', 40 'current' => '{page}', 41 'first' => '{page}', 42 'last' => '{page}', 43 'connect' => '...', 44 'next' => 'Next', 45 'prev' => 'Prev', 46 'tooltipText' => 'Page {page}', 47 'tooltips' => 'on', 48 'pdisplay' => $pdisplay, 49 'ndisplay' => $ndisplay, 50 'stylesheet' => 'styleCss', 51 'cssFilename' => 'pagebar.css', 52 'inherit' => 'on', 53 ); 41 54 42 $additionalPostbarOpts = array("auto" => "on", "bef_loop" => "", 43 "aft_loop" => "on", "footer" => ""); 44 $additionalCommentbarOpts = array("all" => "on", "where_all" => "front", 45 "label_all" => "All"); 46 $additionalMultipagebarOpts = array("all" => "on", "label_all" => "All"); 55 $additionalPostbarOpts = array( 56 'auto' => 'on', 57 'bef_loop' => '', 58 'aft_loop' => 'on', 59 'footer' => '', 60 ); 61 $additionalCommentbarOpts = array( 62 'all' => 'on', 63 'where_all' => 'front', 64 'label_all' => 'All', 65 ); 66 $additionalMultipagebarOpts = array( 67 'all' => 'on', 68 'label_all' => 'All', 69 ); 47 70 48 // if the user upgrades from earlier versions of pagebar copy the settings49 if ($pagebar_options = get_option('pagebar')) {50 foreach ($all_opts as $key=>$val ){51 if (! empty($pagebar_options[$key]))52 $all_opts[$key] = $pagebar_options[$key];71 // if the user upgrades from earlier versions of pagebar copy the settings 72 if ( $pagebar_options = get_option( 'pagebar' ) ) { 73 foreach ( $all_opts as $key => $val ) { 74 if ( ! empty( $pagebar_options[ $key ] ) ) { 75 $all_opts[ $key ] = $pagebar_options[ $key ]; 53 76 } 54 foreach ($additionalPostbarOpts as $key=>$val )55 $additionalPostbarOpts[$key] = $pagebar_options[$key];56 77 } 78 foreach ( $additionalPostbarOpts as $key => $val ) { 79 $additionalPostbarOpts[ $key ] = $pagebar_options[ $key ]; 80 } 81 } 57 82 58 if (! get_option ( 'postbar' )) 59 add_option ( 'postbar', array_merge($all_opts, $additionalPostbarOpts)); 60 if (! get_option ( 'multipagebar' )) 61 add_option ( 'multipagebar', array_merge($all_opts, $additionalMultipagebarOpts)); 62 if (! get_option ( 'commentbar' )) 63 add_option ( 'commentbar', array_merge($all_opts, $additionalCommentbarOpts)); 64 65 ?> 83 if ( ! get_option( 'postbar' ) ) { 84 add_option( 'postbar', array_merge( $all_opts, $additionalPostbarOpts ) ); 85 } 86 if ( ! get_option( 'multipagebar' ) ) { 87 add_option( 'multipagebar', array_merge( $all_opts, $additionalMultipagebarOpts ) ); 88 } 89 if ( ! get_option( 'commentbar' ) ) { 90 add_option( 'commentbar', array_merge( $all_opts, $additionalCommentbarOpts ) ); 91 } 92 93 -
pagebar/trunk/class-basebar.php
r795803 r2757940 9 9 var $pbOptions; 10 10 var $max_page; 11 // ------------------------------------------------------------------------- 12 function init($pbOptions) 13 { 14 15 } // function init 16 // ------------------------------------------------------------------------- 17 18 function add_stylesheet() { 19 global $pbOptions; 20 21 $url = "jquery.tabs.css"; 22 $handle = 'jquery-tabs'; 23 wp_register_style($handle, $url); 24 wp_enqueue_style($handle); 25 wp_print_styles(); 26 27 28 $url = "jquery.tabs.iecss"; 29 $handle = 'jquery-tabs.ie'; 30 wp_register_style($handle, $url); 31 wp_enqueue_style($handle); 32 wp_print_styles(); 33 34 35 if ($pbOptions["stylesheet"] == "styleCss") 36 return; 37 $url = get_bloginfo('stylesheet_directory') . '/' . $pbOptions["cssFilename"]; 38 $handle = 'pagebar-stylesheet'; 39 wp_register_style($handle, $url); 40 wp_enqueue_style($handle); 41 wp_print_styles(); 42 43 } 44 // ------------------------------------------------------------------------- 45 function __construct($page, $max_page) { 46 global $wp_query, $pbOptions; 47 48 $this->div_name = "pagebar"; 49 $this->paged = $page; 50 $this->max_page = $max_page; 51 $this->wp_query = $wp_query; 52 $this->pbOptions = $pbOptions; // load options 53 $this->init($this->pbOptions); // initialize 54 } //function __construct() 55 56 57 function Basebar($page, $max_page) { 58 $this->__construct($page, $max_page); 59 } 60 61 // ------------------------------------------------------------------------- 62 function create_link($page) { 63 return get_pagenum_link($page); 64 } 65 // ----------------------------------------------------------------------------- 66 function tagReplace($text,$page) { 67 68 $text = str_replace ( "{page}", $page, $text ); 69 $text = str_replace ( "{current}", $page, $text ); 70 $text = str_replace ( "{total}", $this->max_page, $text ); 71 72 //if (strpos($text, '{img:') !== false) 73 // $text = pb_insertImage($text, $page); 74 75 return $text; 76 } 77 // ------------------------------------------------------------------------- 78 function previousPage($paged) { 79 80 if ($this->pbOptions ["pdisplay"] == "never") 81 return; 82 83 if (($this->paged == 1) && ($this->pbOptions ["pdisplay"] == "auto")) 84 return; 85 86 $text = $this->tagReplace($this->pbOptions ["prev"], $this->paged); 87 echo ($this->paged == 1) ? '<span class="inactive">' . $text . "</span>\n" : '<a href="' . 88 $this->create_link ( $this->paged - 1 ) . '"' . $this->tooltip ($this->paged - 1 ) . '>' . 89 $text . "</a>\n"; 90 } 91 // ----------------------------------------------------------------------------- 92 function thisPage($page) { 93 94 echo '<span class="this-page">' . $this->tagReplace($this->replaceFirstLast ( $page ), 95 $page) . "</span>\n"; 96 } 97 // ----------------------------------------------------------------------------- 98 function nextPage($page,$max_page) { 99 if ($this->pbOptions ["pdisplay"] == "never") 100 return; 101 if (($this->paged == $max_page) && ($this->pbOptions ["ndisplay"] == "auto")) 102 return; 103 $text = $this->tagReplace($this->pbOptions ["next"], $page); 104 echo ($this->paged == $max_page) ? '<span class="inactive">' . $text . 105 "</span>\n" : '<a href="' . $this->create_link ( $this->paged + 1 ) . '"' . 106 $this->tooltip ( $this->paged + 1 ) . '>' . $text . "</a>\n"; 107 } 108 // ----------------------------------------------------------------------------- 109 function transit($place) { 110 if ($place > 0) echo '<span class="break">'; 111 echo $this->pbOptions["connect"] !== "" ? $this->pbOptions["connect"] : '...'; 112 echo "</span>\n"; 113 } 114 // ----------------------------------------------------------------------------- 115 116 function replaceFirstLast($page) { 117 switch ( $page) { 118 case 1 : 119 return $this->pbOptions ['first']; 120 case $this->max_page : 121 return $this->pbOptions ['last']; 122 case $this->paged: 123 return $this->pbOptions['current']; 124 default : 125 return $this->pbOptions['standard']; 11 12 // ------------------------------------------------------------------------- 13 function init( $pbOptions ) { 14 15 } // function init 16 17 // ------------------------------------------------------------------------- 18 19 function add_stylesheet() { 20 global $pbOptions; 21 22 $url = "jquery.tabs.css"; 23 $handle = 'jquery-tabs'; 24 wp_register_style( $handle, $url ); 25 wp_enqueue_style( $handle ); 26 wp_print_styles(); 27 28 29 $url = "jquery.tabs.iecss"; 30 $handle = 'jquery-tabs.ie'; 31 wp_register_style( $handle, $url ); 32 wp_enqueue_style( $handle ); 33 wp_print_styles(); 34 35 36 if ( $pbOptions["stylesheet"] == "styleCss" ) { 37 return; 38 } 39 $url = get_bloginfo( 'stylesheet_directory' ) . '/' . $pbOptions["cssFilename"]; 40 $handle = 'pagebar-stylesheet'; 41 wp_register_style( $handle, $url ); 42 wp_enqueue_style( $handle ); 43 wp_print_styles(); 44 45 } 46 47 // ------------------------------------------------------------------------- 48 function __construct( $page, $max_page ) { 49 global $wp_query, $pbOptions; 50 $this->div_name = "pagebar"; 51 $this->paged = $page; 52 $this->max_page = $max_page; 53 $this->wp_query = $wp_query; 54 $this->pbOptions = $pbOptions; // load options 55 $this->init( $this->pbOptions ); // initialize 56 } //function __construct() 57 58 59 // ------------------------------------------------------------------------- 60 function create_link( $page ) { 61 return get_pagenum_link( $page ); 62 } 63 64 // ----------------------------------------------------------------------------- 65 function tagReplace( $text, $page ) { 66 67 $text = str_replace( "{page}", $page, $text ); 68 $text = str_replace( "{current}", $page, $text ); 69 $text = str_replace( "{total}", $this->max_page, $text ); 70 71 //if (strpos($text, '{img:') !== false) 72 // $text = pb_insertImage($text, $page); 73 74 return $text; 75 } 76 77 // ------------------------------------------------------------------------- 78 function previousPage( $paged ) { 79 80 if ( $this->pbOptions ["pdisplay"] == "never" ) { 81 return; 82 } 83 84 if ( ( $this->paged == 1 ) && ( $this->pbOptions ["pdisplay"] == "auto" ) ) { 85 return; 86 } 87 88 $text = $this->tagReplace( $this->pbOptions ["prev"], $this->paged ); 89 if ( $this->paged == 1 ) { 90 ?><span class="inactive"><?php echo esc_html( $text ); ?></span> 91 <?php } else { ?> 92 <a href="<?php echo esc_html( $this->create_link( $this->paged - 1 ) ); ?>" 93 <?php echo esc_html( $this->tooltip( $this->paged - 1 ) ); ?>> 94 <?php echo esc_html( $text ); ?></a> 95 <?php } //else 96 } //function 97 98 // ----------------------------------------------------------------------------- 99 function thisPage( $page ) { 100 ?> 101 <span class="this-page"><?php echo esc_html( $this->tagReplace( $this->replaceFirstLast( $page ), $page ) ); ?></span> 102 <?php } 103 104 // ----------------------------------------------------------------------------- 105 function nextPage( $page, $max_page ) { 106 if ( $this->pbOptions ["pdisplay"] == "never" ) { 107 return; 108 } 109 if ( ( $this->paged == $max_page ) && ( $this->pbOptions ["ndisplay"] == "auto" ) ) { 110 return; 111 } 112 $text = $this->tagReplace( $this->pbOptions ["next"], $page ); 113 114 // echo ($this->paged == $max_page) ? '<span class="inactive">' . $text . 115 // "</span>\n" : '<a href="' . $this->create_link ( $this->paged + 1 ) . '"' . 116 // $this->tooltip ( $this->paged + 1 ) . '>' . $text . "</a>\n"; 117 118 if ( $this->paged == $max_page ) { 119 ?><span class="inactive"><?php echo esc_html( $text ); ?></span> 120 <?php } else { ?> 121 <a href="<?php echo esc_html( $this->create_link( $this->paged + 1 ) ); ?>"<?php 122 echo esc_html( $this->tooltip( $this->paged + 1 ) ); ?>><?php echo esc_html( $text ); ?></a> 123 <?php 124 } 125 } 126 127 // ----------------------------------------------------------------------------- 128 function transit( $place ) { 129 if ( $place > 0 ) { ?><span class="break"><?php ; 130 } 131 if ( $this->pbOptions["connect"] !== "" ) { 132 echo esc_html( $this->pbOptions["connect"] ); 133 } else { 134 echo esc_html( '...' ); 135 } 136 ?> </span> <?php 137 } 138 139 // ----------------------------------------------------------------------------- 140 141 function replaceFirstLast( $page ) { 142 switch ( $page ) { 143 case 1 : 144 return $this->pbOptions ['first']; 145 case $this->max_page : 146 return $this->pbOptions ['last']; 147 case $this->paged: 148 return $this->pbOptions['current']; 149 default : 150 return $this->pbOptions['standard']; 151 } 152 } 153 154 // ----------------------------------------------------------------------------- 155 function page( $page ) { 156 $link = $this->create_link( $page ); 157 158 // echo '<a href="' . $link . '"' . $this->tooltip($page) . '>' . 159 // $this->TagReplace($this->replaceFirstLast($page), $page) . "</a>\n"; 160 161 ?><a href="<?php echo esc_html( $link ); ?>"<?php echo esc_html( $this->tooltip( $page ) ); ?>> 162 <?php echo esc_html( $this->TagReplace( $this->replaceFirstLast( $page ), $page ) ); ?> </a> 163 <?php 164 } 165 166 // ----------------------------------------------------------------------------- 167 function tooltip( $page ) { 168 if ( $this->pbOptions ["tooltips"] ) { 169 return ' title="' . $this->tagReplace( $this->pbOptions ["tooltipText"], $page ) . '"'; 170 } 171 172 return ""; 173 } 174 175 // ----------------------------------------------------------------------------- 176 function leave() { 177 178 if ( is_singular() ) { 179 return 1; 180 } 181 182 if ( $this->max_page <= 1 ) // only one page -> don't display pagebar 183 { 184 return 1; 185 } 186 }//leave() 187 188 // ----------------------------------------------------------------------------- 189 190 function div_start() { 191 // echo '<div class="'.$this->div_name.'">'; 192 ?><div class="<?php echo esc_html( $this->div_name ); ?>"><?php 193 }//div_start() 194 195 // ----------------------------------------------------------------------------- 196 197 function div_end() { 198 ?></div><?php 199 }//div_end() 200 201 // ----------------------------------------------------------------------------- 202 203 function display() { 204 205 if ( $this->wp_query->is_feed ) // no need for pagebar in feed 206 { 207 return; 208 } 209 210 if ( is_admin() ) // since WP2.5 got it's own admin pagebar 211 { 212 return; 213 } 214 215 if ( $this->leave() ) { 216 return; 217 } 218 219 $left = $this->pbOptions ["left"]; 220 $center = $this->pbOptions ["center"]; 221 $right = $this->pbOptions ["right"]; 222 223 if ( empty ( $this->paged ) ) // If we're on the first page the var $this->paged is not set. 224 { 225 $this->paged = 1; 226 } 227 228 // insert HTML comment for support reasons 229 ?><!-- pb266 --><?php 230 do_action( 'pagebar_before' ); // do general action 231 $this->div_start(); 232 233 if ( isset( $this->action ) ) { 234 do_action( $this->action . '_before' ); 235 } 236 // echo '<span>' . $this->tagReplace ( $this->pbOptions ["pbText"], $this->paged ) . ' ' . '</span>'; 237 ?><span><?php echo esc_html( $this->tagReplace( $this->pbOptions ["pbText"], $this->paged ) ); ?> </span> 238 239 <?php 240 // it's easy to show all page numbers: 241 // simply loop and exit 242 if ( $this->max_page <= $left + $center + $right ) { 243 244 $this->previousPage( $this->paged ); 245 for ( $i = 1; $i <= $this->max_page; $i ++ ) { 246 if ( $i == $this->paged ) { 247 $this->thisPage( $i ); 248 } else { 249 $this->page( $i ); 250 } 126 251 } 127 } 128 // ----------------------------------------------------------------------------- 129 function page($page) { 130 $link = $this->create_link($page); 131 echo '<a href="' . $link . '"' . $this->tooltip($page) . '>' . 132 $this->TagReplace($this->replaceFirstLast($page), $page) . "</a>\n"; 133 } 134 // ----------------------------------------------------------------------------- 135 function tooltip($page) { 136 if ($this->pbOptions ["tooltips"]) 137 return ' title="' . $this->tagReplace ( $this->pbOptions ["tooltipText"], $page ) . '"'; 138 return ""; 139 } 140 141 // ----------------------------------------------------------------------------- 142 function leave() { 143 144 if (is_singular()) 145 return 1; 146 147 if ($this->max_page <= 1) // only one page -> don't display pagebar 148 return 1; 149 }//leave() 150 // ----------------------------------------------------------------------------- 151 152 function div_start() { 153 echo '<div class="'.$this->div_name.'">'; 154 }//div_start() 155 // ----------------------------------------------------------------------------- 156 157 function div_end() { 158 echo "</div>"; 159 }//div_end() 160 161 // ----------------------------------------------------------------------------- 162 163 function display() { 164 165 if ($this->wp_query->is_feed) // no need for pagebar in feed 166 return; 167 168 if (is_admin()) // since WP2.5 got it's own admin pagebar 169 return; 170 171 if ($this->leave()) 172 return; 173 174 $left = $this->pbOptions ["left"]; 175 $center = $this->pbOptions ["center"]; 176 $right = $this->pbOptions ["right"]; 177 178 if (empty ( $this->paged )) // If we're on the first page the var $this->paged is not set. 179 $this->paged = 1; 180 181 // insert HTML comment for support reasons 182 echo "<!-- pb265 -->"; 183 do_action('pagebar_before'); // do general action 184 $this->div_start(); 185 186 if (isset($this->action)) 187 do_action($this->action . '_before'); 188 189 echo '<span>' . $this->tagReplace ( $this->pbOptions ["pbText"], $this->paged ) . ' ' . '</span>'; 190 191 // it's easy to show all page numbers: 192 // simply loop and exit 193 if ($this->max_page <= $left + $center + $right) { 194 $this->previousPage ( $this->paged ); 195 for($i = 1; $i <= $this->max_page; $i ++) 196 if ($i == $this->paged) 197 $this->thisPage ( $i ); 198 else 199 $this->page ( $i ); 200 $this->nextPage ( $this->paged, $this->max_page ); 201 202 if (isset($this->action)) 203 do_action($this->action . '_after'); // do specific action 204 echo '</div>'; 205 do_action('pagebar_after'); // do general action 206 return; 207 } //if 252 $this->nextPage( $this->paged, $this->max_page ); 253 254 if ( isset( $this->action ) ) { 255 do_action( $this->action . '_after' ); 256 } // do specific action 257 do_action( 'pagebar_after' ); // do general action 258 259 return; 260 } //if 208 261 209 262 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 210 // left and right 211 if ($this->paged < $left + $center) { 212 //left 213 $this->previousPage($this->paged); 214 $lc = $left + $center; 215 for ($i = 1;$i <= ($lc);$i++) if ($i == $this->paged) $this->thisPage($i); 216 else $this->page($i); 217 // right 218 $this->transit($right); 219 for ($i = $this->max_page - $right + 1;$i <= $this->max_page;$i++) 220 $this->page($i); 221 $this->nextPage($this->paged, $this->max_page); 222 } 223 else 224 // left, right and center 225 if (($this->paged >= $left + $center) && ($this->paged < $this->max_page - $right - $center + 1)) { 226 //left 227 $this->previousPage($this->paged); 228 for ($i = 1;$i <= $left;$i++) 229 $this->page($i); 230 $this->transit($left); 231 //center 232 $c = floor($center / 2); 233 for ($i = $this->paged - $c;$i <= $this->paged + $c;$i++) 234 if ($i == $this->paged) 235 $this->thisPage($i); 236 else 237 $this->page($i); 238 // right 239 $this->transit($right); 240 for ($i = $this->max_page - $right + 1;$i <= $this->max_page;$i++) 241 $this->page($i); 242 $this->nextPage($this->paged, $this->max_page); 243 } 244 else 245 // only left and right 246 { 247 //left 248 $this->previousPage($this->paged); 249 for ($i = 1;$i <= $left;$i++) $this->page($i); 250 $this->transit($left); 251 // right 252 for ($i = $this->max_page - $right - $center;$i <= $this->max_page;$i++) 253 if ($i == $this->paged) 254 $this->thisPage($i); 255 else 256 $this->page($i); 257 $this->nextPage($this->paged, $this->max_page); 258 } 259 260 if (isset($this->action)) // do specific action 261 do_action($this->action . '_after'); // do general action 262 $this->div_end(); 263 do_action('pagebar_after'); 264 265 } // function display() 263 // left and right 264 if ( $this->paged < $left + $center ) { 265 //left 266 $this->previousPage( $this->paged ); 267 $lc = $left + $center; 268 for ( $i = 1; $i <= ( $lc ); $i ++ ) { 269 if ( $i == $this->paged ) { 270 $this->thisPage( $i ); 271 } else { 272 $this->page( $i ); 273 } 274 } 275 // right 276 $this->transit( $right ); 277 for ( $i = $this->max_page - $right + 1; $i <= $this->max_page; $i ++ ) { 278 $this->page( $i ); 279 } 280 $this->nextPage( $this->paged, $this->max_page ); 281 } else // left, right and center 282 if ( ( $this->paged >= $left + $center ) && ( $this->paged < $this->max_page - $right - $center + 1 ) ) { 283 //left 284 $this->previousPage( $this->paged ); 285 for ( $i = 1; $i <= $left; $i ++ ) { 286 $this->page( $i ); 287 } 288 $this->transit( $left ); 289 //center 290 $c = floor( $center / 2 ); 291 for ( $i = $this->paged - $c; $i <= $this->paged + $c; $i ++ ) { 292 if ( $i == $this->paged ) { 293 $this->thisPage( $i ); 294 } else { 295 $this->page( $i ); 296 } 297 } 298 // right 299 $this->transit( $right ); 300 for ( $i = $this->max_page - $right + 1; $i <= $this->max_page; $i ++ ) { 301 $this->page( $i ); 302 } 303 $this->nextPage( $this->paged, $this->max_page ); 304 } else // only left and right 305 { 306 //left 307 $this->previousPage( $this->paged ); 308 for ( $i = 1; $i <= $left; $i ++ ) { 309 $this->page( $i ); 310 } 311 $this->transit( $left ); 312 // right 313 for ( $i = $this->max_page - $right - $center; $i <= $this->max_page; $i ++ ) { 314 if ( $i == $this->paged ) { 315 $this->thisPage( $i ); 316 } else { 317 $this->page( $i ); 318 } 319 } 320 $this->nextPage( $this->paged, $this->max_page ); 321 } 322 323 if ( isset( $this->action ) ) // do specific action 324 { 325 do_action( $this->action . '_after' ); 326 } // do general action 327 $this->div_end(); 328 do_action( 'pagebar_after' ); 329 330 } // function display() 266 331 267 332 } //class 268 269 ?> -
pagebar/trunk/class-commentbar.php
r596959 r2757940 1 1 <?php 2 2 3 require_once ("class-basebar.php");3 require_once 'class-basebar.php'; 4 4 5 5 class Commentbar extends Basebar { 6 6 7 function __construct($paged, $max_page) { 8 parent::__construct($paged, $max_page); 9 if (! $this->pbOptions = get_option('commentbar') ) { 10 pagebar_activate(); 11 $this->pbOptions = get_option('commentbar'); 7 function __construct( $paged, $max_page ) { 8 parent::__construct( $paged, $max_page ); 9 if ( ! $this->pbOptions = get_option( 'commentbar' ) ) { 10 pagebar_activate(); 11 $this->pbOptions = get_option( 'commentbar' ); 12 } 13 $this->div_name = 'commentbar'; 14 if ( $this->pbOptions['inherit'] ) { 15 $tmp_pbOptions = get_option( 'postbar' ); 16 foreach ( $tmp_pbOptions as $key => $val ) { 17 if ( isset( $this->pbOptions[ $key ] ) ) { 18 $this->pbOptions[ $key ] = $tmp_pbOptions[ $key ]; 12 19 } 13 $this->div_name = "commentbar"; 14 if ($this->pbOptions['inherit']) { 15 $tmp_pbOptions = get_option('postbar'); 16 foreach ($tmp_pbOptions as $key=>$val ) 17 if (isset($this->pbOptions[$key])) 18 $this->pbOptions[$key] = $tmp_pbOptions[$key]; 19 $this->div_name = "pagebar"; 20 } 21 $this->action = 'commentbar'; 22 $this->display(); 23 } //__construct() 20 } 21 $this->div_name = 'pagebar'; 22 } 23 $this->action = 'commentbar'; 24 $this->display(); 25 } //__construct() 24 26 25 27 26 function Commentbar($paged, $max_page) {27 $this->__construct($paged, $max_page);28 function Commentbar( $paged, $max_page ) { 29 $this->__construct( $paged, $max_page ); 28 30 31 } 32 33 // ----------------------------------------------------------------------------- 34 function leave() { 35 // TODO: leave parameters 36 if ( get_query_var( 'all' ) ) { // all parts displayed 37 return 1; 29 38 } 30 // ----------------------------------------------------------------------------- 31 function leave() { 32 // TODO: leave parameters 33 if (get_query_var('all')) // all parts displayed 34 return 1; 35 if ($this->max_page <= 1) 36 return 1; 37 return 0; 38 } //leave() 39 if ( $this->max_page <= 1 ) { 40 return 1; 41 } 42 43 return 0; 44 } //leave() 39 45 40 46 41 // -----------------------------------------------------------------------------42 function create_link($page) {43 return esc_url( get_comments_pagenum_link( $page, $this->max_page ) );44 } //create_link()47 // ----------------------------------------------------------------------------- 48 function create_link( $page ) { 49 return esc_url( get_comments_pagenum_link( $page, $this->max_page ) ); 50 } //create_link() 45 51 46 // -----------------------------------------------------------------------------47 function display() {48 parent::display();49 } //display()52 // ----------------------------------------------------------------------------- 53 function display() { 54 parent::display(); 55 } //display() 50 56 51 // ----------------------------------------------------------------------------- 52 function div_end() { 53 /*if ($this->pbOptions['all']) 54 echo $this->allPagesLink(); 55 */echo "</div>"; 56 }//div_end() 57 // ----------------------------------------------------------------------------- 58 function allPagesLink() { 57 // ----------------------------------------------------------------------------- 58 function div_end() { 59 /*if ($this->pbOptions['all']) 60 echo esc_html($this->allPagesLink()); 61 */ 62 }//div_end() 63 64 // ----------------------------------------------------------------------------- 65 function allPagesLink() { 59 66 global $post; 60 if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) { 61 $page_link_type = '&page='; 62 $page_link_all = '&all=1'; 63 } //if 64 else { 65 $page_link_type = '/'; 66 $page_link_all = '/all/1'; 67 $url = get_permalink(); 68 if ( '/' == $url[strlen($url)-1]) 69 $slash_yes = '/'; 70 } //else 67 if ( '' == get_option( 'permalink_structure' ) || 'draft' == $post->post_status ) { 68 $page_link_type = '&page='; 69 $page_link_all = '&all=1'; 70 } //if 71 else { 72 $page_link_type = '/'; 73 $page_link_all = '/all/1'; 74 $url = get_permalink(); 75 if ( '/' == $url[ strlen( $url ) - 1 ] ) { 76 $slash_yes = '/'; 77 } 78 } //else 71 79 72 return '<a href="'. untrailingslashit(get_permalink()) .73 $page_link_all . '">' . $this->pbOptions['label_all'] . '</a></li>';80 return '<a href="' . untrailingslashit( get_permalink() ) . 81 $page_link_all . '">' . $this->pbOptions['label_all'] . '</a></li>'; 74 82 75 } //allPagesLink()83 } //allPagesLink() 76 84 77 85 78 86 } // class Commentbar 79 80 ?> -
pagebar/trunk/class-multipagebar.php
r596959 r2757940 1 1 <?php 2 require_once( "class-basebar.php");2 require_once( 'class-basebar.php' ); 3 3 4 4 class Multipagebar extends Basebar { 5 5 6 function __construct($paged, $max_page) { 7 parent::__construct($paged, $max_page); 8 $this->div_name = "multipagebar"; 9 if (! $this->pbOptions = get_option('multipagebar')) { 10 pagebar_activate(); 11 $this->pbOptions = get_option('multipagebar'); 12 } 13 if ($this->pbOptions['inherit']) { 14 $tmp_pbOptions = get_option('postbar'); 15 foreach ($tmp_pbOptions as $key=>$val ) 16 if (isset($this->pbOptions[$key])) 17 $this->pbOptions[$key] = $tmp_pbOptions[$key]; 18 $this->div_name = "pagebar"; 19 } 20 $this->action = "multipagebar"; 21 echo parent::display(); 6 function __construct( $paged, $max_page ) { 7 parent::__construct( $paged, $max_page ); 8 $this->div_name = 'multipagebar'; 9 if ( ! $this->pbOptions === get_option( 'multipagebar' ) ) { 10 pagebar_activate(); 11 $this->pbOptions = get_option( 'multipagebar' ); 12 } 13 if ( $this->pbOptions['inherit'] ) { 14 $tmp_pbOptions = get_option( 'postbar' ); 15 foreach ( $tmp_pbOptions as $key => $val ) { 16 if ( isset( $this->pbOptions[ $key ] ) ) { 17 $this->pbOptions[ $key ] = $tmp_pbOptions[ $key ]; 18 } 19 } 20 $this->div_name = 'pagebar'; 21 } 22 $this->action = 'multipagebar'; 23 echo esc_html( parent::display() ); 22 24 23 } // function __construct()25 } // function __construct() 24 26 25 27 26 function Multipagbar($paged, $max_page) {27 $this->__construct($paged, $max_page);28 function Multipagbar( $paged, $max_page ) { 29 $this->__construct( $paged, $max_page ); 28 30 31 } 32 33 // ------------------------------------------------------------------------- 34 35 function leave() { 36 if ( $this->max_page <= 1 ) { // only one page 37 return 1; 29 38 } 30 // ------------------------------------------------------------------------- 31 32 function leave() { 33 if ($this->max_page <= 1) // only one page 34 return 1; 35 if (get_query_var('all')) // all parts displayed 36 return 1; 37 return 0; 39 if ( get_query_var( 'all' ) ) { // all parts displayed 40 return 1; 38 41 } 39 42 40 // ------------------------------------------------------------------------- 41 function create_link($page) { 42 global $post; 43 if ($page == 1) { 44 $link = get_permalink(); 45 } 46 else { 47 if ('' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending'))) 48 $link = get_permalink() . '&page=' . $page; 49 else 50 $link = trailingslashit(get_permalink()) . user_trailingslashit($page, 'single_paged'); 51 } //else 43 return 0; 44 } 52 45 53 return $link; 54 } //create_link() 46 // ------------------------------------------------------------------------- 47 function create_link( $page ) { 48 global $post; 49 if ( $page == 1 ) { 50 $link = get_permalink(); 51 } else { 52 if ( '' == get_option( 'permalink_structure' ) || in_array( 53 $post->post_status, 54 array( 55 'draft', 56 'pending', 57 ) 58 ) ) { 59 $link = get_permalink() . '&page=' . $page; 60 } else { 61 $link = trailingslashit( get_permalink() ) . user_trailingslashit( $page, 'single_paged' ); 62 } 63 } //else 55 64 56 // ----------------------------------------------------------------------------- 57 function allPagesLink() { 58 global $post; 59 if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) { 60 $page_link_type = '&page='; 61 $page_link_all = '&all=1'; 62 } //if 63 else { 64 $page_link_type = '/'; 65 $page_link_all = '/all/1'; 66 $url = get_permalink(); 67 if ( '/' == $url[strlen($url)-1]) 68 $slash_yes = '/'; 69 } //else 65 return $link; 66 } //create_link() 70 67 71 return '<a href="'. untrailingslashit(get_permalink()) . 72 $page_link_all . '">' . $this->pbOptions['label_all'] . '</a></li>'; 68 // ----------------------------------------------------------------------------- 69 function allPagesLink() { 70 global $post; 71 if ( '' == get_option( 'permalink_structure' ) || 'draft' == $post->post_status ) { 72 $page_link_type = '&page='; 73 $page_link_all = '&all=1'; 74 } //if 75 else { 76 $page_link_type = '/'; 77 $page_link_all = '/all/1'; 78 $url = get_permalink(); 79 if ( '/' == $url[ strlen( $url ) - 1 ] ) { 80 $slash_yes = '/'; 81 } 82 } //else 73 83 74 } //allPagesLink() 75 // ----------------------------------------------------------------------------- 76 function div_end() { 77 if ($this->pbOptions['all']) 78 echo $this->allPagesLink(); 79 echo "</div>"; 80 }//div_end() 81 // ----------------------------------------------------------------------------- 84 return '<a href="' . untrailingslashit( get_permalink() ) . 85 $page_link_all . '">' . $this->pbOptions['label_all'] . '</a></li>'; 86 87 } //allPagesLink() 88 89 // ----------------------------------------------------------------------------- 90 function div_end() { 91 if ( $this->pbOptions['all'] ) { 92 echo esc_html( $this->allPagesLink() ); 93 } 94 echo '</div>'; 95 }//div_end() 96 // ----------------------------------------------------------------------------- 82 97 83 98 84 99 } // class Multipagebar 85 ?> -
pagebar/trunk/class-postbar.php
r596959 r2757940 1 1 <?php 2 2 3 require_once( 'class-basebar.php');3 require_once( 'class-basebar.php' ); 4 4 5 5 class Postbar extends Basebar { 6 6 7 function __construct($paged, $max_page) {8 parent::__construct($paged, $max_page);9 $this->div_name = 'pagebar';10 $this->action= 'postbar';11 $this->display();12 } // function __construct()13 14 15 function Postbar($paged, $max_page) {16 $this->__construct($paged, $max_page);7 function __construct( $paged, $max_page ) { 8 parent::__construct( $paged, $max_page ); 9 $this->div_name = 'pagebar'; 10 $this->action = 'postbar'; 11 $this->display(); 12 } // function __construct() 13 14 function leave() { 15 if ( $this->max_page <= 1 ) { // only one page -> don't display postbar 16 return 1; 17 17 } 18 // ------------------------------------------------------------------------- 19 20 function leave() { 21 if ($this->max_page <= 1) // only one page -> don't display postbar 22 return 1; 23 return 0; 24 } 25 26 // ------------------------------------------------------------------------- 18 19 return 0; 20 } 21 22 // ------------------------------------------------------------------------- 27 23 28 24 } //class Postbar 29 30 ?> -
pagebar/trunk/css/twentyeleven.css
r795803 r2757940 1 1 .pagebar { 2 clear: both;3 display: block;4 margin: 0 0 1.625em;5 text-align: center;2 clear: both; 3 display: block; 4 margin: 0 0 1.625em; 5 text-align: center; 6 6 } 7 7 .pagebar a, .break, .this-page, .inactive, .pagebar > span { 8 background: #eee;9 color: #373737;10 margin: 0;11 padding: 2px 3px;12 text-decoration: none;8 background: #eee; 9 color: #373737; 10 margin: 0; 11 padding: 2px 3px; 12 text-decoration: none; 13 13 } 14 14 15 15 .pagebar .this-page { 16 border: transparent;17 background: #fff;18 color: #000;16 border: transparent; 17 background: #fff; 18 color: #000; 19 19 } 20 20 21 21 .pagebar a:visited { 22 border: 1px solid #9AAFE5;23 text-decoration: none;24 background: #eee;25 color: #373737;26 margin: 0;22 border: 1px solid #9AAFE5; 23 text-decoration: none; 24 background: #eee; 25 color: #373737; 26 margin: 0; 27 27 } 28 28 29 29 .pagebar a:hover { 30 background: #888;31 color: #fff;32 /*font-weight: bold;*/30 background: #888; 31 color: #fff; 32 /*font-weight: bold;*/ 33 33 } 34 34 35 35 .pagebar .inactive 36 36 { 37 color: #ccc;37 color: #ccc; 38 38 } -
pagebar/trunk/css/twentyten.css
r795803 r2757940 1 1 .pagebar { 2 clear: both;3 color: #000;4 font-weight: bold;5 line-height: 48px;6 word-spacing: 0.5em;7 text-align: center;2 clear: both; 3 color: #000; 4 font-weight: bold; 5 line-height: 48px; 6 word-spacing: 0.5em; 7 text-align: center; 8 8 } 9 9 10 10 .pagebar a, .break, .this-page { 11 background: #fff;12 border: 1px solid #fff;13 padding: 5px 10px;14 text-decoration: none;11 background: #fff; 12 border: 1px solid #fff; 13 padding: 5px 10px; 14 text-decoration: none; 15 15 16 }16 } 17 17 18 18 .pagebar a, .break, .this-page, .inactive { 19 background: #f1f1f1;20 color: #333;21 font-weight: normal;22 padding: 0.5em 0.75em;23 text-decoration: none;19 background: #f1f1f1; 20 color: #333; 21 font-weight: normal; 22 padding: 0.5em 0.75em; 23 text-decoration: none; 24 24 } 25 25 26 26 .pagebar .this-page { 27 border: transparent;28 background: #fff;29 color: #000;30 font-weight: bold;27 border: transparent; 28 background: #fff; 29 color: #000; 30 font-weight: bold; 31 31 } 32 32 33 33 .pagebar a:visited { 34 background: #f1f1f1;35 color: #333;36 font-weight: normal;37 padding: 0.5em 0.75em;38 text-decoration: none;34 background: #f1f1f1; 35 color: #333; 36 font-weight: normal; 37 padding: 0.5em 0.75em; 38 text-decoration: none; 39 39 } 40 40 41 41 .pagebar a:hover { 42 color: #ff4b33;42 color: #ff4b33; 43 43 } 44 44 … … 46 46 .pagebar .inactive 47 47 { 48 color: #ccc;49 } 48 color: #ccc; 49 } -
pagebar/trunk/css/twentythirteen.css
r795803 r2757940 1 1 .pagebar { 2 clear: both;3 font-size: 16px;4 font-style: italic;5 font-weight: normal;6 line-height: 2.2;7 margin: 20px 0;8 text-transform: uppercase;9 text-align: center;2 clear: both; 3 font-size: 16px; 4 font-style: italic; 5 font-weight: normal; 6 line-height: 2.2; 7 margin: 20px 0; 8 text-transform: uppercase; 9 text-align: center; 10 10 } 11 11 12 12 .pagebar a, .break, .this-page { 13 background: #fff;14 border: 1px solid #fff;15 padding: 5px 10px;16 text-decoration: none;17 }13 background: #fff; 14 border: 1px solid #fff; 15 padding: 5px 10px; 16 text-decoration: none; 17 } 18 18 19 19 .pagebar a, .break, .this-page, .inactive { 20 clear: both;21 font-size: 16px;22 font-style: italic;23 font-weight: normal;24 line-height: 2.2;25 margin: 20px 0;26 text-transform: uppercase;27 background: #e63f2a;28 border: 1px solid #e63f2a;29 color: #fff;20 clear: both; 21 font-size: 16px; 22 font-style: italic; 23 font-weight: normal; 24 line-height: 2.2; 25 margin: 20px 0; 26 text-transform: uppercase; 27 background: #e63f2a; 28 border: 1px solid #e63f2a; 29 color: #fff; 30 30 } 31 31 32 32 .pagebar a:hover { 33 background: #fff;34 color: #e63f2a;33 background: #fff; 34 color: #e63f2a; 35 35 } 36 36 37 37 .pagebar .this-page { 38 border: transparent;39 background: #fff;40 color: #000;38 border: transparent; 39 background: #fff; 40 color: #000; 41 41 } 42 42 43 43 .pagebar a:visited { 44 border: 1px solid #9AAFE5;45 text-decoration: none;46 padding: 0.2em 0.5em;44 border: 1px solid #9AAFE5; 45 text-decoration: none; 46 padding: 0.2em 0.5em; 47 47 } 48 48 49 49 .pagebar .inactive 50 50 { 51 color: #ccc;52 } 51 color: #ccc; 52 } -
pagebar/trunk/css/twentytwelve.css
r795803 r2757940 1 1 .pagebar { 2 clear: both;3 display: block;4 margin: 0 0 1.625em;5 text-align: center;2 clear: both; 3 display: block; 4 margin: 0 0 1.625em; 5 text-align: center; 6 6 } 7 7 .pagebar a, .break, .this-page, .inactive { 8 background: #eee;9 color: #373737;10 margin: 0;11 padding: 4px 6px;12 text-decoration: none;8 background: #eee; 9 color: #373737; 10 margin: 0; 11 padding: 4px 6px; 12 text-decoration: none; 13 13 } 14 14 15 15 .pagebar .this-page { 16 border: transparent;17 background: #fff;18 color: #000;19 font-weight: bold;16 border: transparent; 17 background: #fff; 18 color: #000; 19 font-weight: bold; 20 20 } 21 21 22 22 .pagebar a:visited { 23 border: 1px solid #9AAFE5;24 text-decoration: none;25 background: #eee;26 color: #373737;27 margin: 0;23 border: 1px solid #9AAFE5; 24 text-decoration: none; 25 background: #eee; 26 color: #373737; 27 margin: 0; 28 28 } 29 29 30 30 .pagebar a:hover { 31 background: #888;32 color: #fff;33 /*font-weight: bold;*/31 background: #888; 32 color: #fff; 33 /*font-weight: bold;*/ 34 34 } 35 35 36 36 .pagebar .inactive 37 37 { 38 color: #ccc;38 color: #ccc; 39 39 } -
pagebar/trunk/jquery.tabs.css
r135002 r2757940 1 .ui-tabs {padding: .2em;}1 .ui-tabs {padding: .2em;} 2 2 .ui-tabs-nav { padding: .2em .2em 0 .2em; position: relative; clear: both;} 3 3 .ui-tabs-nav li { float: left; margin: 0 .2em -1px 0; padding: 0; border: 1px solid #000; background-color: #ccc;} … … 6 6 .ui-tabs-panel { padding: 1em 1.4em; display: block; border: 0; background: url(tab.png);} 7 7 .ui-tabs-hide { display: none !important; } 8 8 9 9 .tabs-nav {display: inline-block;} 10 10 .tabs-nav .tabs-disabled {position: relative; filter: alpha(opacity=40); } -
pagebar/trunk/jquery.tabs.ie.css
r135002 r2757940 9 9 */ 10 10 .tabs-nav { /* auto clear */ 11 display: inline-block;11 display: inline-block; 12 12 } 13 13 .tabs-nav .tabs-disabled { 14 position: relative; /* fixes opacity */15 filter: alpha(opacity=40);14 position: relative; /* fixes opacity */ 15 filter: alpha(opacity=40); 16 16 } 17 17 .tabs-nav .tabs-disabled a span { 18 _height: 19px; /* for some reason the height is 1px to less with opacity... */19 min-height: 19px; /* ...in both IE 6 and 7 */18 _height: 19px; /* for some reason the height is 1px to less with opacity... */ 19 min-height: 19px; /* ...in both IE 6 and 7 */ 20 20 } -
pagebar/trunk/pagebar.css
r596959 r2757940 4 4 margin-bottom: 1.0em; 5 5 border: 1px solid #fff; 6 background: #fff;6 background: rgba(255, 165, 0, 0); 7 7 text-decoration: none; 8 8 text-align: center; … … 10 10 11 11 .pagebar a, .break, .this-page, .inactive { 12 display:inline-block;13 background: #f7f7f7;14 background: -webkit-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%);15 background: -moz-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%);16 background: -o-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%);17 background: -ms-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%);18 background: linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%);19 padding: 5px 10px;20 text-decoration: none;21 color: #7e7e7e;22 border: 1px solid #c6c6c6;23 -webkit-box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2);24 -moz-box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2);25 box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2);26 font-weight: bold;27 border-radius:3px; 12 display:inline-block; 13 background: #f7f7f7; 14 background: -webkit-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%); 15 background: -moz-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%); 16 background: -o-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%); 17 background: -ms-linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%); 18 background: linear-gradient(top, #f7f7f7 0%,#f5f5f5 52%,#ebebeb 100%); 19 padding: 5px 10px; 20 text-decoration: none; 21 color: #7e7e7e; 22 border: 1px solid #c6c6c6; 23 -webkit-box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2); 24 -moz-box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2); 25 box-shadow: inset 0 4px 3px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,.2); 26 font-weight: bold; 27 border-radius:3px; 28 28 } 29 29 … … 37 37 .pagebar .this-page, .pagebar a:hover { 38 38 background: #9ad6fb; 39 background: -webkit-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%);40 background: -moz-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%);41 background: -o-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%);42 background: -ms-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%);43 background: linear-gradient(top, #9ad6fb 0%,#77c4fc 100%);44 border: 1px solid #72ade4;45 color: #4879a6;46 -webkit-box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5);47 -moz-box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5);48 box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5);49 -webkit-transition: all 0.25s ease 0s;50 -moz-transition: all 0.25s ease 0s;51 -o-transition: all 0.25s ease 0s;52 transition: all 0.25s ease 0s; }39 background: -webkit-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%); 40 background: -moz-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%); 41 background: -o-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%); 42 background: -ms-linear-gradient(top, #9ad6fb 0%,#77c4fc 100%); 43 background: linear-gradient(top, #9ad6fb 0%,#77c4fc 100%); 44 border: 1px solid #72ade4; 45 color: #4879a6; 46 -webkit-box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5); 47 -moz-box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5); 48 box-shadow: inset 0 1px 4px rgba(255,255,255,0.75), 0 1px 3px rgba(79,126,167,.5); 49 -webkit-transition: all 0.25s ease 0s; 50 -moz-transition: all 0.25s ease 0s; 51 -o-transition: all 0.25s ease 0s; 52 transition: all 0.25s ease 0s; } 53 53 54 54 .pagebar .inactive 55 55 { 56 56 color: #ccc; 57 } 58 57 } -
pagebar/trunk/pagebar2.php
r2752052 r2757940 4 4 Plugin URI: http://www.elektroelch.de/hacks/wp/pagebar 5 5 Description: Adds an advanced page navigation to Wordpress. 6 Version: 2.6 66 Version: 2.67 7 7 Requires at least: 3.3 8 8 Tested up to: 6.0 … … 29 29 */ 30 30 31 // namespace Pagebar; 32 31 33 /* ------------------------------------------------------------------------------- */ 32 34 // determine the path of the plugin 33 35 // stolen from Commentmix 34 if (!defined('PLUGIN_URL')) 35 define('PLUGIN_URL', get_option('siteurl').'/wp-content/plugins/'); 36 if (!defined('PLUGIN_PATH')) 37 define('PLUGIN_PATH', ABSPATH.'wp-content/plugins/'); 38 define('PAGEBAR_URL', PLUGIN_URL . dirname(plugin_basename(__FILE__)).'/'); 39 define('PAGEBAR_PATH', PLUGIN_PATH . dirname(plugin_basename(__FILE__)).'/'); 36 if ( ! defined( 'PLUGIN_URL' ) ) { 37 define( 'PLUGIN_URL', get_option( 'siteurl' ) . '/wp-content/plugins/' ); 38 } 39 if ( ! defined( 'PLUGIN_PATH' ) ) { 40 define( 'PLUGIN_PATH', ABSPATH . 'wp-content/plugins/' ); 41 } 42 define( 'PAGEBAR_URL', PLUGIN_URL . dirname( plugin_basename( __FILE__ ) ) . '/' ); 43 define( 'PAGEBAR_PATH', PLUGIN_PATH . dirname( plugin_basename( __FILE__ )) . '/' ); 44 40 45 /* -------------------------------------------------------------------------- */ 41 46 42 47 function is_main_loop() { 43 global $wp_query, $wp_the_query; 44 if ($wp_the_query === $wp_query) { 45 return true; 46 } 47 return false; 48 } 49 /* -------------------------------------------------------------------------- */ 50 function automagic_postbar($query) { 48 global $wp_query, $wp_the_query; 49 if ( $wp_the_query === $wp_query ) { 50 return true; 51 } 52 53 return false; 54 } 55 56 /* -------------------------------------------------------------------------- */ 57 function automagic_postbar( $query ) { 51 58 global $paged, $wp_query, $pbOptions; 52 59 53 60 // no automagic insertion if we're not in the main loop 54 if ( $pbOptions['auto'] && ! ( $wp_query->is_main_query()) )61 if ( $pbOptions['auto'] && ! ( $wp_query->is_main_query() ) ) { 55 62 return; 63 } 56 64 57 65 postbar(); 58 59 } 66 67 } 68 60 69 /* ------------------------------------------------------------------------------- */ 61 70 function postbar() { 62 71 global $paged, $wp_query, $pbOptions; 63 72 64 require_once('class-postbar.php'); 65 $pagebar = new Postbar($paged, intval($wp_query->max_num_pages)); 66 67 } 73 require_once( 'class-postbar.php' ); 74 $pagebar = new Postbar( $paged, intval( $wp_query->max_num_pages ) ); 75 76 } 77 68 78 /* ------------------------------------------------------------------------------- */ 69 79 function pagebar() { // for compatibility with pagebar v2.21 70 80 postbar(); 71 81 } 82 72 83 /* ------------------------------------------------------------------------------- */ 73 84 function wp_pagebar() { // for compatibility with pagebar v2.21 74 postbar(); 75 } 76 /* ------------------------------------------------------------------------------- */ 77 function multipagebar () { 78 global $page, $numpages; 79 require_once('class-multipagebar.php'); 80 $multipagebar = new Multipagebar($page, $numpages); 85 postbar(); 86 } 87 88 /* ------------------------------------------------------------------------------- */ 89 function multipagebar() { 90 global $page, $numpages; 91 require_once( 'class-multipagebar.php' ); 92 $multipagebar = new Multipagebar( $page, $numpages ); 81 93 } //multipagebar() 82 94 /* ------------------------------------------------------------------------------- */ 83 95 function commentbar() { 84 global $wp_query; 85 require_once('class-commentbar.php'); 86 $paged = intval(get_query_var('cpage')); 87 $max_page = intval($wp_query->max_num_comment_pages); 88 $commentbar = new Commentbar($paged, $max_page); 89 } 90 91 function pagebar_registerStylesheet($url, $handle, $pluginurl = "") { 92 wp_register_style($handle, $pluginurl . $url); 93 wp_enqueue_style($handle); 94 wp_print_styles(); 95 } 96 global $wp_query; 97 require_once( 'class-commentbar.php' ); 98 $paged = intval( get_query_var( 'cpage' ) ); 99 $max_page = intval( $wp_query->max_num_comment_pages ); 100 $commentbar = new Commentbar( $paged, $max_page ); 101 } 102 103 function pagebar_registerStylesheet( $url, $handle, $pluginurl = "" ) { 104 wp_register_style( $handle, $pluginurl . $url ); 105 wp_enqueue_style( $handle ); 106 // wp_print_styles(); 107 } 108 96 109 /* -------------------------------------------------------------------------- */ 97 110 function pagebar_addUserStylesheet() { 98 global $pbOptions; 99 100 // use default style for default themes 101 $stylesheet = get_stylesheet(); 102 if (in_array($stylesheet, array('twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen', 'twentyfourteen'))) 103 pagebar_registerStylesheet(plugin_dir_url(__FILE__) . 'css/' . $stylesheet . '.css', 'preset_css'); 104 105 if ($pbOptions["stylesheet"] != "styleCss") 106 pagebar_registerStylesheet(get_bloginfo('stylesheet_directory') 107 . '/' . $pbOptions["cssFilename"], 108 'pagebar-stylesheet'); 109 110 } 111 global $pbOptions; 112 // use default style for default themes 113 $stylesheet = get_stylesheet(); 114 115 if ( in_array( $stylesheet, array( 116 'twentyten', 117 'twentyeleven', 118 'twentytwelve', 119 'twentythirteen', 120 'twentyfourteen' 121 ) ) ) { 122 pagebar_registerStylesheet( plugin_dir_url( __FILE__ ) . 'css/' . $stylesheet . '.css', 'preset_css' ); 123 } 124 125 if ( $pbOptions["stylesheet"] !== "styleCss" ) { 126 pagebar_registerStylesheet( get_bloginfo( 'stylesheet_directory' ) 127 . '/' . $pbOptions["cssFilename"], 128 'pagebar-stylesheet' ); 129 } 130 131 } 132 111 133 /* -------------------------------------------------------------------------- */ 112 134 function pagebar_activate() { 113 require_once "activate.php";135 require_once "activate.php"; 114 136 } //pagebar_activate() 115 137 /* -------------------------------------------------------------------------- */ 116 138 /* add Settings link to plugin page */ 117 139 function pagebar_addConfigureLink( $links ) { // add Settings link to plugin page 118 $settings_link = '<a href="options-general.php?page=pagebar_options.php">'. __('Settings', 'pagebar').'</a>'; 119 array_unshift( $links, $settings_link ); 120 return $links; 140 $settings_link = '<a href="options-general.php?page=pagebar_options.php">' . __( 'Settings', 'pagebar' ) . '</a>'; 141 array_unshift( $links, $settings_link ); 142 143 return $links; 121 144 } //addConfigureLink() 122 145 /* -------------------------------------------------------------------------- */ 123 // pagebar >= v2.5 requires PHP>=5 and WP>=2.7, check and disable update if124 // necessary.125 126 function pagebar_plugin_prevent_upgrade($opt) {127 global $wp_version, $min_wp, $min_php;128 $min_php = '5.0.0';129 $min_wp = '2.7';130 if ( (version_compare(PHP_VERSION, $min_php, '<')) || (version_compare($wp_version, $min_wp, '<')) ) {131 $plugin = plugin_basename(__FILE__);132 if ( $opt && isset($opt->response[$plugin]) ) {133 //Theres an update. Remove automatic upgrade:134 $opt->response[$plugin]->package = '';135 136 //Now we've prevented the upgrade taking place, It might be worth to give users a note that theres an update available:137 add_action("after_plugin_row_$plugin", 'pagebar_plugin_update_disabled_notice');138 } //if139 } //if140 return $opt;141 } //plugin_prevent_update()142 /* -------------------------------------------------------------------------- */143 function pagebar_plugin_update_disabled_notice() {144 global $wp_version, $min_wp, $min_php;145 echo '<tr><td class="plugin-update" colspan="5">';146 echo 'There is an update available for this plugin. However the plugin requires';147 148 if (version_compare(PHP_VERSION, $min_php, '<'))149 echo ' PHP v'.$min_php.' or newer';150 151 if ( (version_compare(PHP_VERSION, $min_php, '<')) && (version_compare($wp_version, $min_wp, '<')) )152 echo ' and';153 154 if (version_compare($wp_version, $min_wp, '<'))155 echo ' WordPress v'.$min_wp.' or newer.';156 157 echo '</td></tr>';158 } //plugin_update_disabled_notice()159 160 /* -------------------------------------------------------------------------- */161 146 // add filter for displaying complete paged page 162 add_filter('the_content', 'pb_allpage_show', 0); 163 function pb_allpage_show($content) { 164 global $multipage, $page, $posts, $numpages, $page_comments, $wp_query; 165 166 if ($multipage && $all_page = get_query_var('all')) { 167 $content = $posts[0]->post_content; 168 } 169 return $content; 147 add_filter( 'the_content', 'pb_allpage_show', 0 ); 148 function pb_allpage_show( $content ) { 149 global $multipage, $page, $posts, $numpages, $page_comments, $wp_query; 150 151 if ( $multipage && $all_page = get_query_var( 'all' ) ) { 152 $content = $posts[0]->post_content; 153 } 154 155 return $content; 170 156 } 171 157 172 158 /* -------------------------------------------------------------------------- */ 173 159 // add filter to allow URL parameter "all" 174 add_action( 'init', 'pb_allpage_permalink', 99);160 add_action( 'init', 'pb_allpage_permalink', 99 ); 175 161 function pb_allpage_permalink() { 176 162 global $wp_rewrite; 177 $wp_rewrite->add_endpoint("all", EP_ALL); 178 $wp_rewrite->flush_rules(false); 179 } 163 $wp_rewrite->add_endpoint( "all", EP_ALL ); 164 $wp_rewrite->flush_rules( false ); 165 } 166 180 167 /* -------------------------------------------------------------------------- */ 181 168 function pb_remove_nav() { 182 if (! is_single ()) 183 echo "\n<style type=\"text/css\">.navigation{display: none;}</style>\n"; 184 echo "\n<style type=\"text/css\">#nav-below{display: none;}</style>\n"; 185 } 169 if ( ! is_single() ) ?> 170 <style type=\"text/css\">.navigation { 171 display: none; 172 }</style> 173 <style type=\"text/css\">#nav-below { 174 display: none; 175 }</style> 176 <?php 177 } 178 186 179 /* -------------------------------------------------------------------------- */ 187 180 // add filter to allow URL parameter "all" 188 add_filter( 'query_vars', 'pb_AllPageEndpointQueryVarsFilter');189 function pb_AllPageEndpointQueryVarsFilter( $vars){181 add_filter( 'query_vars', 'pb_AllPageEndpointQueryVarsFilter' ); 182 function pb_AllPageEndpointQueryVarsFilter( $vars ) { 190 183 $vars[] = 'all'; 184 191 185 return $vars; 192 186 } … … 194 188 /* -------------------------------------------------------------------------- */ 195 189 function register_pagebar_settings() { 196 register_setting('pagebar-options', 'postbar');197 register_setting('pagebar-options', 'multipagebar');198 register_setting('pagebar-options', 'commentbar');190 register_setting( 'pagebar-options', 'postbar' ); 191 register_setting( 'pagebar-options', 'multipagebar' ); 192 register_setting( 'pagebar-options', 'commentbar' ); 199 193 }/* -------------------------------------------------------------------------- */ 200 194 function detect_theme() { … … 217 211 add_action( 'plugins_loaded', 'pagebar_load_textdomain' ); 218 212 function pagebar_load_textdomain() { 219 load_plugin_textdomain( 'pagebar', false, plugin_basename( dirname( __FILE__ ) . '/language' ));220 } 221 222 if ( is_admin()) {213 load_plugin_textdomain( 'pagebar', false, plugin_basename( dirname( __FILE__ ) . '/language' ) ); 214 } 215 216 if ( is_admin() ) { 223 217 add_action( 'plugins_loaded', function () { 224 218 require( 'pagebar_options.php' ); … … 231 225 } 232 226 233 // add filter to prevent updates if PHP<5 and Wp<2.7234 if (in_array($pagenow, array("plugins.php")))235 add_filter('option_update_plugins', 'pagebar_plugin_prevent_upgrade');236 237 227 // we need to load the postbar option outside the classes since the actions 238 // need to be started. There may be a ndifferent solution but I did not find one.239 if ( ! $pbOptions = get_option ( 'postbar' )) {240 pagebar_activate();241 $pbOptions = get_option('postbar');228 // need to be started. There may be a different solution but I did not find one. 229 if ( ! $pbOptions = get_option( 'postbar' ) ) { 230 pagebar_activate(); 231 $pbOptions = get_option( 'postbar' ); 242 232 }; 243 233 // add_action ( 'activate_'.dirname(plugin_basename(__FILE__)).'/pagebar.php', 'pagebar_activate' ); 244 234 // register_activation_hook( __FILE__, 'pagebar_activate' ); 245 235 246 add_action ( 'wp_head', 'pagebar_addUserStylesheet');236 add_action( 'wp_head', 'pagebar_addUserStylesheet' ); 247 237 // add_action ( 'wp_print_styles', 'detect_theme'); 248 //add_action ( 'wp_print_styles', 'pagebar_addUserStylesheet'); 249 250 if ($pbOptions ['auto'] && in_array($pagenow, array("index.php"))) { 251 if ($pbOptions ["bef_loop"] == "on") 252 add_action ( 'loop_start', 'automagic_postbar' ); 253 if ($pbOptions ["aft_loop"] == "on") 254 add_action ( 'loop_end', 'automagic_postbar' ); 255 if ($pbOptions ["footer"] == "on") 256 add_action ( 'wp_footer', 'automagic_postbar' ); 257 if ($pbOptions ["remove"] == "on") 258 add_action ( 'wp_head', 'pb_remove_nav' ); 238 add_action( 'wp_print_styles', 'pagebar_addUserStylesheet' ); 239 240 if ( $pbOptions ['auto'] && in_array( $pagenow, array( "index.php" ) ) ) { 241 if ( $pbOptions ["bef_loop"] === "on" ) { 242 add_action( 'loop_start', 'automagic_postbar' ); 243 } 244 if ( $pbOptions ["aft_loop"] === 'on' ) { 245 add_action( 'loop_end', 'automagic_postbar' ); 246 } 247 if ( $pbOptions ["footer"] === 'on' ) { 248 add_action( 'wp_footer', 'automagic_postbar' ); 249 } 250 if ( $pbOptions ["remove"] === 'on' ) { 251 add_action( 'wp_head', 'pb_remove_nav' ); 252 } 259 253 } //if -
pagebar/trunk/pagebar_options.php
r2752052 r2757940 1 1 <?php 2 2 3 if (!class_exists('PagebarOptions')) { 4 class PagebarOptions 5 { 6 function __construct() 7 { 8 $page = add_action('admin_menu', [&$this, 'adminmenu']); 9 10 if (!empty($_POST['pagebar2update'])) { 11 12 13 if ( ! current_user_can( 'manage_options' ) ) { 14 wp_die( esc_html__( 'Cheatin’ uh?', 'pagebar' ) ); 15 } 16 check_admin_referer( '_pagebar_options' ); 17 18 19 20 $all_opts = [ 21 'left', 22 'center', 23 'right', 24 'pbText', 25 'remove', 26 'standard', 27 'current', 28 'first', 29 'last', 30 'connect', 31 'prev', 32 'next', 33 'tooltipText', 34 'tooltips', 35 'pdisplay', 36 'ndisplay', 37 'stylesheet', 38 'cssFilename', 39 'inherit', 40 ]; 41 42 $additionalPostbarOpts = ['auto', 'bef_loop', 'aft_loop', 'footer']; 43 $additionalCommentbarOpts = ['all', 'where_all', 'label_all']; 44 $additionalMultipagebarOpts = ['all', 'label_all']; 45 46 $postbaroptions = array_merge($all_opts, $additionalPostbarOpts); 47 $commentbaroptions = array_merge($all_opts, $additionalCommentbarOpts); 48 $multipagebaroptions = array_merge( 49 $all_opts, 50 $additionalMultipagebarOpts 51 ); 52 53 $pbOptionsPostbar = []; 54 foreach ($postbaroptions as $param) { 55 $pbOptionsPostbar[$param] = empty($_POST['post_' . $param]) 56 ? '' 57 : addslashes($_POST['post_' . $param]); 58 } 59 60 $pbOptionsCommentbar = []; 61 foreach ($commentbaroptions as $param) { 62 $pbOptionsCommentbar[$param] = empty($_POST['comment_' . $param]) 63 ? '' 64 : addslashes($_POST['comment_' . $param]); 65 } 66 67 $pbOptionsMultipagebar = []; 68 foreach ($multipagebaroptions as $param) { 69 $pbOptionsMultipagebar[$param] = empty($_POST['multipage_' . $param]) 70 ? '' 71 : addslashes($_POST['multipage_' . $param]); 72 } 73 74 $text1 = update_option('postbar', $pbOptionsPostbar); 75 $text2 = update_option('multipagebar', $pbOptionsMultipagebar); 76 $text3 = update_option('commentbar', $pbOptionsCommentbar); 77 78 $text = 79 $text1 || $text2 || $text3 80 ? __('Options', 'pagebar') 81 : __('No options', 'pagebar'); 82 echo '<div id="message" class="updated fade"><p>' . 83 $text . 84 ' ' . 85 __('updated', 'pagebar') . 86 '</p></div>'; 87 } //if 88 } //PagebarOptions() 89 90 /* -------------------------------------------------------------------------- */ 91 function textinput($text, $var, $pbOptions, $prefix) 92 { 93 echo '<tr><th scope="row" valign="top"><label for ="' . 94 $var . 95 '">' . 96 __($text, 'pagebar') . 97 '</label></th>'; 98 echo '<td><input type="text" name="' . 99 $prefix . 100 '_' . 101 $var . 102 '" value="' . 103 $pbOptions[$var] . 104 '"></td></tr>'; 105 } 106 /* -------------------------------------------------------------------------- */ 107 function checkbox($text, $var, $pbOptions, $prefix, $onClick = '') 108 { 109 return '<label id="lbl_' . 110 $var . 111 '"><input type="checkbox" id="cb_' . 112 $var . 113 '" name="' . 114 $prefix . 115 '_' . 116 $var . 117 '"' . 118 ($onClick != '' ? ' onClick="' . $onClick . '" ' : '') . 119 ($pbOptions[$var] ? 'checked' : '') . 120 '> ' . 121 __($text, 'pagebar') . 122 "</label><br/>\n"; 123 } 124 /* -------------------------------------------------------------------------- */ 125 function radiobutton( 126 $name, 127 $value, 128 $text, 129 $pbOptions, 130 $prefix, 131 $onClick = '' 132 ) { 133 return '<label><input type="radio" name="' . 134 $prefix . 135 '_' . 136 $name . 137 '" value="' . 138 $value . 139 '"' . 140 ($onClick != '' ? ' onClick="' . $onClick . '" ' : '') . 141 ($pbOptions[$name] == $value ? ' checked ' : '') . 142 '> ' . 143 __($text, 'pagebar') . 144 "</label>\n"; 145 } 146 /* -------------------------------------------------------------------------- */ 147 function pb_basicOptions($pbOptions, $prefix) 148 { 149 ?> 150 <tr> 151 <?php 152 $this->textinput('Left', 'left', $pbOptions, $prefix); 153 $this->textinput('Center', 'center', $pbOptions, $prefix); 154 $this->textinput('Right', 'right', $pbOptions, $prefix); 155 $this->textinput('Leading text', 'pbText', $pbOptions, $prefix); 156 $this->textinput('Standard page', 'standard', $pbOptions, $prefix); 157 $this->textinput('Current Page', 'current', $pbOptions, $prefix); 158 $this->textinput('First page', 'first', $pbOptions, $prefix); 159 $this->textinput('Last page', 'last', $pbOptions, $prefix); 160 $this->textinput('Connector', 'connect', $pbOptions, $prefix); 161 ?> 162 </tr> 163 164 <tr> 165 <th scope="row" valign="top"><?php echo __('Previous', 'pagebar'); ?></th> 166 <td> 167 <input type="text" id="previous" name="<?php echo $prefix; ?>_prev" value="<?php echo $pbOptions['prev']; ?>"> 168 <?php echo $this->radiobutton( 169 'pdisplay', 170 'auto', 171 'auto', 172 $pbOptions, 173 $prefix 174 ); ?> 175 <?php echo $this->radiobutton( 176 'pdisplay', 177 'always', 178 'always', 179 $pbOptions, 180 $prefix 181 ); ?> 182 <?php echo $this->radiobutton( 183 'pdisplay', 184 'never', 185 'never', 186 $pbOptions, 187 $prefix 188 ); ?> 189 </td> 190 </tr> 191 192 <tr> 193 <th scope="row" valign="top"> 194 <?php echo __('Next', 'pagebar'); ?>: 195 </th> 196 <td> 197 <input type="text" id="next" name="<?php echo $prefix; ?>_next" value="<?php echo $pbOptions['next']; ?>"> 198 <?php echo $this->radiobutton( 199 'ndisplay', 200 'auto', 201 'auto', 202 $pbOptions, 203 $prefix 204 ); ?> 205 <?php echo $this->radiobutton( 206 'ndisplay', 207 'always', 208 'always', 209 $pbOptions, 210 $prefix 211 ); ?> 212 <?php echo $this->radiobutton( 213 'ndisplay', 214 'never', 215 'never', 216 $pbOptions, 217 $prefix 218 ); ?> 219 </td> 220 </tr> 221 222 <tr> 223 <th scope="row"><?php echo __('Tooltip text', 'pagebar'); ?>:</th> 224 <td> 225 <input type="text" name="<?php echo $prefix; ?>_tooltipText" value="<?php echo $pbOptions['tooltipText']; ?>"> 226 <?php echo $this->checkbox('Display', 'tooltips', $pbOptions, $prefix); ?> 227 </td> 228 </tr> 229 <?php 230 } //pb_BasicOptions 231 /* -------------------------------------------------------------------------- */ 232 function pb_stylesheetOptions($pbOptions, $prefix) 233 { 234 ?> 235 <tr> 236 <th scope="row" valign="top"><?php echo __('Stylesheet', 'pagebar'); ?>:</th> 237 <td> 238 <label> 239 <input onClick="cssSwitch();" type="radio" id="rdo_style" 240 name="<?php echo $prefix . '_'; ?>stylesheet" value="styleCss" 241 <?php if ($pbOptions['stylesheet'] == 'styleCss') { 242 echo ' checked '; 243 } ?>> 244 <?php echo __('style.css', 'pagebar'); ?> 245 246 </label> 247 <br /> 248 249 <input onClick="cssSwitch();" type="radio" id="rdo_own" 250 name="<?php echo $prefix . '_'; ?>stylesheet" value="own" 251 <?php if ($pbOptions['stylesheet'] == 'own') { 252 echo ' checked '; 253 } ?>> 254 255 <input type="text" id="edt_cssFile" name="<?php echo $prefix . 256 '_'; ?>cssFilename" value="<?php echo $pbOptions['cssFilename']; ?>"> 257 </td> 258 </tr> 259 260 <?php 261 } //stylesheetOptions() 262 /* -------------------------------------------------------------------------- */ 263 function pb_submitButton($prefix) 264 { 265 ?> 266 <p class="submit"><input type="submit" name="pagebar2update" class="button-primary" 267 value="<?php echo __('Update Options', 'pagebar'); ?>" /> <input 268 type="button" name="cancel" value="<?php echo __('Cancel', 'pagebar'); ?>" 269 class="button" onclick="javascript:history.go(-1)" /></p> 270 <?php 271 } //pb_submitButton 272 /* -------------------------------------------------------------------------- */ 273 function adminmenu() 274 { 275 global $pbOptions; 276 if (function_exists('add_options_page')) { 277 $this->hook = add_options_page( 278 'Pagebar', 279 'Pagebar', 280 'manage_options', 281 basename(__FILE__), 282 [&$this, 'pboptions'] 283 ); 284 } 285 286 //add contextual help 287 if ($this->hook) { 288 add_action('load-' . $this->hook, [&$this, 'load_help']); 289 } 290 } //admin_menu() 291 /* -------------------------------------------------------------------------- */ 292 function load_help() 293 { 294 if (method_exists(get_current_screen(), 'add_help_tab')) { 295 // WP >= v3.3 296 get_current_screen()->add_help_tab([ 297 'id' => 'pagebar_info', 298 'title' => 'Manual', 299 'content' => 300 '<p>If you\'re having problems you can consult the <a href="http://www.elektroelch.de/hacks/wp/pagebar/" target="_blank">Manual</a></p>', 301 ]); 302 } else { 303 if (function_exists('add_contextual_help')) { 304 add_contextual_help( 305 $this->hook, 306 '<a href="http://www.elektroelch.de/hacks/wp/pagebar/" target="_blank">Manual</a>' 307 ); 308 } 309 } 310 } 311 /* -------------------------------------------------------------------------- */ 312 function pb_load_jquery() 313 { 314 global $wp_scripts; 315 316 // tell WordPress to load jQuery UI tabs 317 wp_enqueue_script('jquery-ui-tabs'); 318 319 // get registered script object for jquery-ui 320 $ui = $wp_scripts->query('jquery-ui-core'); 321 322 // tell WordPress to load the Smoothness theme from Google CDN 323 $protocol = is_ssl() ? 'https' : 'http'; 324 $url = "$protocol://ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/themes/smoothness/jquery-ui.css"; 325 wp_enqueue_style('jquery-ui-smoothness', $url, false, null); 326 } 327 /* -------------------------------------------------------------------------- */ 328 329 function pboptions() 330 { 331 global $pbOptions; ?> 332 333 <div class="wrap" id="top"> 334 <h2> 335 <?php echo __('Pagebar', 'pagebar'); ?> 336 </h2> 337 338 <script> 339 $j=jQuery.noConflict(); 340 $j(document).ready(function(){ 341 $j("#optiontabs").tabs(); 342 js_comment(); 343 js_multipage(); 344 }); 345 </script> 346 347 <form method="post" id="pagebar" action="<?php echo $_SERVER[ 348 'REQUEST_URI' 349 ]; ?>"> 350 <?php settings_fields('pagebar-options'); ?> 351 352 <div id="optiontabs"> 353 <ul> 354 <li><a href="#postbar"><span>Postbar</span></a></li> 355 <li><a href="#multipagebar"><span>Multipagebar</span></a></li> 356 <li><a href="#commentbar"><span>Commentbar</span></a></li> 357 </ul> 358 359 360 <div id="postbar"><br/> 361 <p> 362 <?php require 'pagebar_options_postbar.php'; ?> 363 </p> 3 if ( ! class_exists( 'PagebarOptions' ) ) { 4 class PagebarOptions { 5 function __construct() { 6 $page = add_action( 'admin_menu', array( &$this, 'adminmenu' ) ); 7 8 if ( ! empty( sanitize_text_field( wp_unslash( $_POST['pagebar2update'] ) ) ) ) { 9 10 if ( ! current_user_can( 'manage_options' ) ) { 11 wp_die( esc_html__( 'Cheatin’ uh?', 'pagebar' ) ); 12 } 13 check_admin_referer( '_pagebar_options' ); 14 15 $all_opts = array( 16 'left', 17 'center', 18 'right', 19 'pbText', 20 'remove', 21 'standard', 22 'current', 23 'first', 24 'last', 25 'connect', 26 'prev', 27 'next', 28 'tooltipText', 29 'tooltips', 30 'pdisplay', 31 'ndisplay', 32 'stylesheet', 33 'cssFilename', 34 'inherit', 35 ); 36 37 $additionalPostbarOpts = array( 'auto', 'bef_loop', 'aft_loop', 'footer' ); 38 $additionalCommentbarOpts = array( 'all', 'where_all', 'label_all' ); 39 $additionalMultipagebarOpts = array( 'all', 'label_all' ); 40 41 $postbaroptions = array_merge( $all_opts, $additionalPostbarOpts ); 42 $commentbaroptions = array_merge( $all_opts, $additionalCommentbarOpts ); 43 $multipagebaroptions = array_merge( 44 $all_opts, 45 $additionalMultipagebarOpts 46 ); 47 48 $pbOptionsPostbar = array(); 49 foreach ( $postbaroptions as $param ) { 50 51 $pbOptionsPostbar[ $param ] = empty( sanitize_text_field( wp_unslash( $_POST[ 'post_' . $param ] ) ) ) 52 ? '' 53 : sanitize_text_field( wp_unslash( $_POST[ 'post_' . $param ] ) ); 54 } 55 56 $pbOptionsCommentbar = array(); 57 foreach ( $commentbaroptions as $param ) { 58 $pbOptionsCommentbar[ $param ] = empty( wp_unslash( $_POST[ 'comment_' . $param ] ) ) 59 ? '' 60 : sanitize_text_field( wp_unslash( $_POST[ 'comment_' . $param ] ) ); 61 } 62 63 $pbOptionsMultipagebar = array(); 64 foreach ( $multipagebaroptions as $param ) { 65 $pbOptionsMultipagebar[ $param ] = empty( wp_unslash( $_POST[ 'multipage_' . $param ] ) ) 66 ? '' 67 : sanitize_text_field( wp_unslash( ( $_POST[ 'multipage_' . $param ] ) ) ); 68 } 69 70 $text1 = update_option( 'postbar', $pbOptionsPostbar ); 71 $text2 = update_option( 'multipagebar', $pbOptionsMultipagebar ); 72 $text3 = update_option( 'commentbar', $pbOptionsCommentbar ); 73 74 $text = 75 $text1 || $text2 || $text3 76 ? esc_html( 'Options', 'pagebar' ) 77 : esc_html( 'No options', 'pagebar' ); 78 ?> 79 <div id="message" class="updated fade"><p> 80 <?php 81 esc_html_e( $text . ' ' . 'updated', 'pagebar' ); 82 ?> 83 </p></div> 84 <?php 85 } //if 86 } //PagebarOptions() 87 88 /* -------------------------------------------------------------------------- */ 89 function textinput( $text, $type, $var, $pbOptions, $prefix ) { 90 ?> 91 <tr> 92 <th scope="row"><label for="<?php echo esc_html( $var ); ?>"> 93 <?php esc_html_e( $text, 'pagebar' ); ?> 94 </label></th> 95 96 <td><input type="<?php echo esc_html( $type ); ?>" 97 name="<?php echo esc_html( $prefix . '_' . $var ); ?>" 98 value="<?php echo esc_html( $pbOptions[ $var ] ); ?>"></td> 99 </tr> 100 <?php 101 } 102 103 /* -------------------------------------------------------------------------- */ 104 function checkbox( $text, $var, $pbOptions, $prefix, $onClick = '' ) { 105 ?> 106 <label id="lbl_<?php echo esc_html( $var ); ?>"> 107 <input type="checkbox" id="cb_<?php echo esc_html( $var ); ?>" 108 name="<?php echo esc_html( $prefix . '_' . $var ); ?>" 109 <?php echo esc_html( $pbOptions[ $var ] ? ' checked' : '' ); ?>/> 110 <?php esc_html_e( $text, 'pagebar' ); ?></label><br/> 111 <?php 112 } 113 114 /* -------------------------------------------------------------------------- */ 115 function radiobutton( $name, $value, $text, $pbOptions, $prefix, $onClick = '' ) { 116 ?> 117 <label><input type="radio" name="<?php echo esc_html( $prefix . '_' . $name ); ?>" 118 value=" <?php echo esc_html( $value ); ?>" 119 <?php 120 if ( $pbOptions[ $name ] == $value ) { 121 echo esc_html( ' checked' ); 122 } 123 ?> 124 > 125 <?php esc_html_e( $text, 'pagebar' ); ?></label> 126 <?php 127 } 128 129 /* -------------------------------------------------------------------------- */ 130 function pb_basicOptions( $pbOptions, $prefix ) { 131 ?> 132 <tr> 133 <?php 134 $this->textinput( 'Left', 'number', 'left', $pbOptions, $prefix ); 135 $this->textinput( 'Center', 'number', 'center', $pbOptions, $prefix ); 136 $this->textinput( 'Right', 'number', 'right', $pbOptions, $prefix ); 137 $this->textinput( 'Leading text', 'text', 'pbText', $pbOptions, $prefix ); 138 $this->textinput( 'Standard page', 'text', 'standard', $pbOptions, $prefix ); 139 $this->textinput( 'Current Page', 'text', 'current', $pbOptions, $prefix ); 140 $this->textinput( 'First page', 'text', 'first', $pbOptions, $prefix ); 141 $this->textinput( 'Last page', 'text', 'last', $pbOptions, $prefix ); 142 $this->textinput( 'Connector', 'text', 'connect', $pbOptions, $prefix ); 143 ?> 144 </tr> 145 146 <tr> 147 <th scope="row" valign="top"><?php esc_html_e( 'Previous', 'pagebar' ); ?></th> 148 <td> 149 <input type="text" id="previous" name="<?php echo esc_html( $prefix ); ?>_prev" 150 value="<?php echo esc_html( $pbOptions['prev'] ); ?>"> 151 <?php $this->radiobutton( 'pdisplay', 'auto', 'auto', $pbOptions, $prefix ); ?> 152 <?php $this->radiobutton( 'pdisplay', 'always', 'always', $pbOptions, $prefix ); ?> 153 <?php $this->radiobutton( 'pdisplay', 'never', 'never', $pbOptions, $prefix ); ?> 154 </td> 155 </tr> 156 157 <tr> 158 <th scope="row" valign="top"> 159 <?php esc_html_e( 'Next', 'pagebar' ); ?>: 160 </th> 161 <td> 162 <input type="text" id="next" name="<?php echo esc_html( $prefix ); ?>_next" 163 value="<?php echo esc_html( $pbOptions['next'] ); ?>"> 164 <?php $this->radiobutton( 'ndisplay', 'auto', 'auto', $pbOptions, $prefix ); ?> 165 <?php $this->radiobutton( 'ndisplay', 'always', 'always', $pbOptions, $prefix ); ?> 166 <?php $this->radiobutton( 'ndisplay', 'never', 'never', $pbOptions, $prefix ); ?> 167 </td> 168 </tr> 169 170 <tr> 171 <th scope="row"><?php esc_html_e( 'Tooltip text', 'pagebar' ); ?>:</th> 172 <td> 173 <input type="text" name="<?php echo esc_html( $prefix ); ?>_tooltipText" 174 value="<?php echo esc_html( $pbOptions['tooltipText'] ); ?>"> 175 <?php $this->checkbox( 'Display', 'tooltips', $pbOptions, $prefix ); ?> 176 </td> 177 </tr> 178 <?php 179 } //pb_BasicOptions 180 181 /* -------------------------------------------------------------------------- */ 182 function pb_stylesheetOptions( $pbOptions, $prefix ) { 183 ?> 184 <tr> 185 <th scope="row" valign="top"><?php esc_html_e( 'Stylesheet', 'pagebar' ); ?>:</th> 186 <td> 187 <label> 188 <input onClick="cssSwitch();" type="radio" id="rdo_style" 189 name="<?php echo esc_html( $prefix ) . '_'; ?>stylesheet" value="styleCss" 190 <?php 191 if ( $pbOptions['stylesheet'] == 'styleCss' ) { 192 echo esc_html( ' checked ' ); 193 } 194 ?> 195 > 196 <?php esc_html_e( 'style.css', 'pagebar' ); ?> 197 198 </label> 199 <br/> 200 201 <input onClick="cssSwitch();" type="radio" id="rdo_own" 202 name="<?php echo esc_html( $prefix . '_' ); ?>stylesheet" value="own" 203 <?php 204 if ( $pbOptions['stylesheet'] == 'own' ) { 205 echo esc_html( ' checked ' ); 206 } 207 ?> 208 > 209 210 <input type="text" id="edt_cssFile" name=" 211 <?php 212 echo esc_html( 213 $prefix . 214 '_' 215 ); 216 ?> 217 cssFilename" 218 value="<?php echo esc_html( $pbOptions['cssFilename'] ); ?>"> 219 </td> 220 </tr> 221 222 <?php 223 } //stylesheetOptions() 224 225 /* -------------------------------------------------------------------------- */ 226 function pb_submitButton( $prefix ) { 227 ?> 228 <p class="submit"><input type="submit" name="pagebar2update" class="button-primary" 229 value="<?php esc_html_e( 'Update Options', 'pagebar' ); ?>"/></p> 230 <?php 231 } //pb_submitButton 232 233 /* -------------------------------------------------------------------------- */ 234 function adminmenu() { 235 global $pbOptions; 236 if ( function_exists( 'add_options_page' ) ) { 237 $this->hook = add_options_page( 238 'Pagebar', 239 'Pagebar', 240 'manage_options', 241 'pagebar_options', 242 array( &$this, 'pboptions' ) 243 ); 244 } 245 246 //add contextual help 247 if ( $this->hook ) { 248 add_action( 'load-' . $this->hook, array( &$this, 'load_help' ) ); 249 } 250 } //admin_menu() 251 252 /* -------------------------------------------------------------------------- */ 253 function load_help() { 254 if ( method_exists( get_current_screen(), 'add_help_tab' ) ) { 255 // WP >= v3.3 256 get_current_screen()->add_help_tab( 257 array( 258 'id' => 'pagebar_info', 259 'title' => 'Manual', 260 'content' => 'Currently not available', 261 ) 262 ); 263 } else { 264 if ( function_exists( 'add_contextual_help' ) ) { 265 add_contextual_help( 266 $this->hook, 267 'Currently not available' 268 ); 269 } 270 } 271 } 272 273 /* -------------------------------------------------------------------------- */ 274 function pb_load_jquery() { 275 global $wp_scripts; 276 277 // tell WordPress to load jQuery UI tabs 278 wp_enqueue_script( 'jquery-ui-tabs' ); 279 280 // get registered script object for jquery-ui 281 $ui = $wp_scripts->query( 'jquery-ui-core' ); 282 283 // tell WordPress to load the Smoothness theme from Google CDN 284 $protocol = is_ssl() ? 'https' : 'http'; 285 $url = esc_url( "$protocol://ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/themes/smoothness/jquery-ui.css" ); 286 wp_enqueue_style( 'jquery-ui-smoothness', $url, false, null ); 287 } 288 289 /* -------------------------------------------------------------------------- */ 290 291 function pboptions() { 292 global $pbOptions; 293 ?> 294 295 <div class="wrap" id="top"> 296 <h2> 297 <?php esc_html_e( 'Pagebar', 'pagebar' ); ?> 298 </h2> 299 300 <script> 301 $j = jQuery.noConflict(); 302 $j(document).ready(function () { 303 $j("#optiontabs").tabs(); 304 js_comment(); 305 js_multipage(); 306 }); 307 </script> 308 309 <form method="post" id="pagebar" 310 action="<?php if (!empty (esc_url( sanitize_url( $_SERVER['REQUEST_URI'] ) ))) 311 echo esc_url( sanitize_url( $_SERVER['REQUEST_URI'] ) ); ?>"> 312 <?php settings_fields( 'pagebar-options' ); ?> 313 314 <div id="optiontabs"> 315 <ul> 316 <li><a href="#postbar"><span>Postbar</span></a></li> 317 <li><a href="#multipagebar"><span>Multipagebar</span></a></li> 318 <li><a href="#commentbar"><span>Commentbar</span></a></li> 319 </ul> 320 321 322 <div id="postbar"><br/> 323 <p><?php require 'pagebar_options_postbar.php'; ?></p> 324 </div> 325 <div id="multipagebar" class="ui-tabs-hide"><br/> 326 <p><?php require 'pagebar_options_multipagebar.php'; ?></p> 327 </div> 328 <div id="commentbar" class="ui-tabs-hide"><br/> 329 <p><?php require 'pagebar_options_commentbar.php'; ?></p> 330 </div> 331 </div> 332 <?php wp_nonce_field( '_pagebar_options' ); ?> 333 </form> 334 364 335 </div> 365 336 366 <div id="multipagebar" class="ui-tabs-hide"><br/> 367 <p> 368 <?php require 'pagebar_options_multipagebar.php'; ?> 369 </p> 370 </div> 371 372 <div id="commentbar" class="ui-tabs-hide"><br/> 373 <p> 374 <?php require 'pagebar_options_commentbar.php'; ?> 375 </p> 376 </div> 377 </div> 378 <?php wp_nonce_field('_pagebar_options'); ?> 379 </form> 380 381 </div> 382 383 384 385 <?php 386 } //pboptions() 387 } //if classexists 337 338 <?php 339 } //pboptions() 340 } //if classexists 388 341 } //class 389 $pagebaroptions = new PagebarOptions();342 $pagebaroptions = new PagebarOptions(); -
pagebar/trunk/pagebar_options_commentbar.php
r301753 r2757940 1 <?php if(!defined('ABSPATH')) { header("HTTP/1.1 403 Forbidden"); die("HTTP/1.1 403 Forbidden"); } ?> 1 <?php if ( ! defined( 'ABSPATH' ) ) { 2 header( 'HTTP/1.1 403 Forbidden' ); 3 die( 'HTTP/1.1 403 Forbidden' ); } ?> 2 4 <script language="javascript"> 3 5 … … 5 7 $j=jQuery.noConflict(); 6 8 if ($j("#cb_comment_inherit").attr("checked")) 7 $j("#comment_inherit").hide();9 $j("#comment_inherit").hide(); 8 10 else 9 $j("#comment_inherit").show();11 $j("#comment_inherit").show(); 10 12 } 11 13 … … 15 17 $j=jQuery.noConflict(); 16 18 if ($j("#cb_comment_all").attr("checked")) { 17 $j("#comment_label_all").attr("disabled", "");19 $j("#comment_label_all").attr("disabled", ""); 18 20 $j("#comment_label_all").css('color', '#000'); 19 21 } 20 22 21 23 else { 22 $j("#comment_label_all").attr("disabled", "disabled");24 $j("#comment_label_all").attr("disabled", "disabled"); 23 25 $j("#comment_label_all").css('color', '#ff0000'); 24 26 } … … 31 33 32 34 <?php 33 if (! $pbOptions = get_option('commentbar')) { 34 pagebar_activate(); 35 $pbOptions = get_option('commentbar'); 36 } 37 35 if ( ! $pbOptions = get_option( 'commentbar' ) ) { 36 pagebar_activate(); 37 $pbOptions = get_option( 'commentbar' ); 38 } 38 39 ?> 39 40 40 41 <tr> 41 <th scope="row" valign="top"><?php e cho __( 'Inherit settings', 'pagebar' )?></th>42 <td>42 <th scope="row" valign="top"><?php esc_html_e( 'Inherit settings', 'pagebar' ); ?></th> 43 <td> 43 44 <label id="lbl_comment_inherit"> 44 45 <input type="checkbox" id="cb_comment_inherit" name="comment_inherit" onClick="js_comment()" 45 <?php if (empty ($pbOptions ['inherit'])) echo ''; else echo ' checked'; ?>> 46 <?php 47 if ( empty( $pbOptions ['inherit'] ) ) { 48 echo esc_html( '' ); 49 } else { 50 echo esc_html( ' checked' ); 51 } 52 ?> 53 > 46 54 Inherit basic settings from postbar</label> 47 55 </td> … … 49 57 50 58 <tbody id="comment_inherit"> 51 <?php $this->pb_basicOptions( $pbOptions, 'comment'); ?>52 <?php $this->pb_stylesheetOptions( $pbOptions, 'comment'); ?>59 <?php $this->pb_basicOptions( $pbOptions, 'comment' ); ?> 60 <?php $this->pb_stylesheetOptions( $pbOptions, 'comment' ); ?> 53 61 </tbody> 54 62 55 63 </table> 56 <?php $this->pb_submitButton( 'commentbar'); ?>64 <?php $this->pb_submitButton( 'commentbar' ); ?> -
pagebar/trunk/pagebar_options_multipagebar.php
r301753 r2757940 1 <?php if(!defined('ABSPATH')) { header("HTTP/1.1 403 Forbidden"); die("HTTP/1.1 403 Forbidden"); } ?> 1 <?php if ( ! defined( 'ABSPATH' ) ) { 2 header( 'HTTP/1.1 403 Forbidden' ); 3 die( 'HTTP/1.1 403 Forbidden' ); 4 } ?> 2 5 <script language="javascript"> 3 6 4 function js_multipage() { 5 $j=jQuery.noConflict(); 6 if ($j("#cb_multipage_inherit").attr("checked")) 7 $j("#tb_multipage_inherit").hide(); 8 else 9 $j("#tb_multipage_inherit").show(); 10 } 7 function js_multipage() { 8 $j = jQuery.noConflict(); 9 if ($j("#cb_multipage_inherit").attr("checked")) { 10 } 11 $j("#tb_multipage_inherit").hide(); 12 } 13 14 else 15 { 16 $j("#tb_multipage_inherit").show(); 17 } 18 } 11 19 </script> 12 20 13 21 <table class="form-table"> 14 22 15 <?php16 if ( ! $pbOptions = get_option('multipagebar')) {23 <?php 24 if ( ! $pbOptions = get_option( 'multipagebar' ) ) { 17 25 pagebar_activate(); 18 $pbOptions = get_option( 'multipagebar');26 $pbOptions = get_option( 'multipagebar' ); 19 27 } 20 21 ?> 22 <tr> 23 <th scope="row" valign="top"><?php echo __( 'Inherit settings', 'pagebar' )?></th> 24 <td> 28 ?> 29 <tr> 30 <th scope="row" valign="top"><?php esc_html_e( 'Inherit settings', 'pagebar' ); ?></th> 31 <td> 25 32 <label id="lbl_multipage_inherit"> 26 33 <input type="checkbox" id="cb_multipage_inherit" name="multipage_inherit" onClick="js_multipage()" \ 27 <?php if (empty ($pbOptions ['inherit'])) echo ''; else echo ' checked'; ?>> 28 <?php echo __('Inherit basic settings from postbar', 'pagebar'); ?></label> 34 35 <?php 36 if ( empty( $pbOptions ['inherit'] ) ) { 37 echo esc_html( '' ); 38 } else { 39 echo esc_html( ' checked' ); 40 } 41 ?> 42 > 43 <?php esc_html_e( 'Inherit basic settings from postbar', 'pagebar' ); ?></label> 29 44 </td> 30 </tr>45 </tr> 31 46 32 <tbody id="tb_multipage_inherit">33 <?php34 $this->pb_basicOptions($pbOptions, 'multipage');35 $this->pb_stylesheetOptions($pbOptions, 'multipage');36 ?>37 </tbody>47 <tbody id="tb_multipage_inherit"> 48 <?php 49 $this->pb_basicOptions( $pbOptions, 'multipage' ); 50 $this->pb_stylesheetOptions( $pbOptions, 'multipage' ); 51 ?> 52 </tbody> 38 53 39 54 40 41 <tr> 42 <th scope="row" valign="top"><?php echo __( 'All pages link', 'pagebar' )?></th> 43 <td> 55 <tr> 56 <th scope="row" valign="top"><?php echo esc_html_e( 'All pages link', 'pagebar' ); ?></th> 57 <td> 44 58 <label id="lbl_multipage_all"> 45 59 <input type="checkbox" id="cb_multipage_all" name="multipage_all" 46 <?php if (empty ($pbOptions ['all'])) echo ''; else echo ' checked'; ?>> 47 <?php echo __("Display 'All Pages' link", 'pagebar'); ?></label> 48 <?php $this->textinput("All Pages Label", "label_all", $pbOptions, "multipage"); ?> 60 <?php 61 if ( empty( $pbOptions ['all'] ) ) { 62 echo esc_html( '' ); 63 } else { 64 echo esc_html( ' checked' ); 65 } 66 ?> 67 > 68 <?php echo esc_html_e( "Display 'All Pages' link", 'pagebar' ); ?></label> 69 <?php $this->textinput( 'All Pages Label', 'text', 'label_all', $pbOptions, 'multipage' ); ?> 49 70 </td> 50 </tr> 51 52 53 71 </tr> 54 72 55 73 56 74 </table> 57 <?php $this->pb_submitButton( 'postbar'); ?>75 <?php $this->pb_submitButton( 'postbar' ); ?> -
pagebar/trunk/pagebar_options_pagebar.php
r301753 r2757940 1 <?php if(!defined('ABSPATH')) { header("HTTP/1.1 403 Forbidden"); die("HTTP/1.1 403 Forbidden"); } ?> 1 <?php if ( ! defined( 'ABSPATH' ) ) { 2 header( 'HTTP/1.1 403 Forbidden' ); 3 die( 'HTTP/1.1 403 Forbidden' ); 4 } ?> 2 5 <script type="text/javascript"> 3 6 4 function autoSwitch(id) {5 var elements = ['footer', 'bef_loop', 'aft_loop', 'remove'];6 $j=jQuery.noConflict();7 if ($j('#cb_auto:checked').val() == null) {8 color = '#ccc';9 dis = "disabled";10 } else {11 color = '#000';12 dis = "";13 }14 for (i=0;i<=elements.length;i++) {15 $j('#lbl_' + elements[i]).css( { color: color});16 $j("#cb_"+elements[i]).attr("disabled",dis);17 }18 $j('#pos').css( {color: color});19 $j('#integrate').css( {color: color});20 }7 function autoSwitch(id) { 8 var elements = ['footer', 'bef_loop', 'aft_loop', 'remove']; 9 $j = jQuery.noConflict(); 10 if ($j('#cb_auto:checked').val() == null) { 11 color = '#ccc'; 12 dis = "disabled"; 13 } else { 14 color = '#000'; 15 dis = ""; 16 } 17 for (i = 0; i <= elements.length; i++) { 18 $j('#lbl_' + elements[i]).css({color: color}); 19 $j("#cb_" + elements[i]).attr("disabled", dis); 20 } 21 $j('#pos').css({color: color}); 22 $j('#integrate').css({color: color}); 23 } 21 24 22 function cssSwitch(id){23 $j=jQuery.noConflict();24 // double check for undefined and null for compatibilty with25 // WP 2.3 and 2.526 if (($j('#rdo_style:checked').val() !== undefined) &&27 ($j('#rdo_style:checked').val() !== null)) {25 function cssSwitch(id) { 26 $j = jQuery.noConflict(); 27 // double check for undefined and null for compatibilty with 28 // WP 2.3 and 2.5 29 if (($j('#rdo_style:checked').val() !== undefined) && 30 ($j('#rdo_style:checked').val() !== null)) { 28 31 29 32 30 $j("#edt_cssFile").attr("disabled","disabled");31 $j("#edt_cssFile").css({color: '#ccc'});32 } else {33 $j("#edt_cssFile").attr("disabled",'');34 $j("#edt_cssFile").css({color: '#000'});35 }36 }33 $j("#edt_cssFile").attr("disabled", "disabled"); 34 $j("#edt_cssFile").css({color: '#ccc'}); 35 } else { 36 $j("#edt_cssFile").attr("disabled", ''); 37 $j("#edt_cssFile").css({color: '#000'}); 38 } 39 } 37 40 </script> 38 41 39 42 <style type="text/css" media="screen"> 40 .blank table, caption, tbody, tfoot, thead, tr, th, td {41 margin: 0;42 padding: 0;43 border: 0;44 outline: 0;45 /* font-size: 100%;46 vertical-align: baseline; */47 background: transparent;43 .blank table, caption, tbody, tfoot, thead, tr, th, td { 44 margin: 0; 45 padding: 0; 46 border: 0; 47 outline: 0; 48 /* font-size: 100%; 49 vertical-align: baseline; */ 50 background: transparent; 48 51 49 }</style>52 }</style> 50 53 51 <form method="post" id="pagebar" action="<?php echo esc_attr($_SERVER ['REQUEST_URI']); ?>"> 52 <table class="form-table"> 54 <form method="post" id="pagebar" action=" 55 <?php 56 if ( sanitize_url( wp_unslash( $_SERVER ['REQUEST_URI'] ) ) !== null ) { 57 if ( ! empty ( esc_url( sanitize_url( $_SERVER['REQUEST_URI'] ) ) ) ) { 58 echo sanitize_url( wp_unslash( $_SERVER ['REQUEST_URI'] ) ); 59 } 60 } 61 ?> 62 "> 63 <table class="form-table"> 53 64 54 <?php $this->pb_basicOptions($pbOptions, 'page'); ?>65 <?php $this->pb_basicOptions( $pbOptions, 'page' ); ?> 55 66 56 67 57 <tr>58 <th scope="row" width="33%"><?php echo __( 'Automagic insertion', 'pagebar' )?>:</th>59 <td>60 <?php echo $this->checkbox ('Insert pagebar automagic into blog', 'auto', $pbOptions, "autoSwitch('position');"); ?>61 </td>62 </tr>68 <tr> 69 <th scope="row" width="33%"><?php echo esc_html_e( 'Automagic insertion', 'pagebar' ); ?>:</th> 70 <td> 71 <?php $this->checkbox( 'Insert pagebar automagic into blog', 'auto', $pbOptions, "autoSwitch('position');" ); ?> 72 </td> 73 </tr> 63 74 64 75 65 <tr>66 <th scope="row" valign="top"><?php echo __( 'Positioning', 'pagebar' ) . ':'?></th>67 <td>68 <?php echo 69 $this->checkbox ('Front of postings', 'bef_loop', $pbOptions, "page" ) .70 $this->checkbox ('Behind postings', 'aft_loop', $pbOptions, "page" ) .71 $this->checkbox ('Footer', 'footer', $pbOptions, "page");76 <tr> 77 <th scope="row" valign="top"><?php esc_html_e( 'Positioning', 'pagebar' ) . ':'; ?></th> 78 <td> 79 <?php 80 $this->checkbox( 'Front of postings', 'bef_loop', $pbOptions, 'page' ); 81 $this->checkbox( 'Behind postings', 'aft_loop', $pbOptions, 'page' ); 82 $this->checkbox( 'Footer', 'footer', $pbOptions, 'page' ); 72 83 ?> 73 </td>74 </tr>84 </td> 85 </tr> 75 86 76 <tr>77 <th scope="row" valign="top"><?php echo __( 'Integration', 'pagebar' )?>:</th>87 <tr> 88 <th scope="row" valign="top"><?php esc_html_e( 'Integration', 'pagebar' ); ?>:</th> 78 89 79 <td>80 <?php echo $this->checkbox ('Remove standard navigation', 'remove', $pbOptions, "page")?>81 </td>82 </tr>90 <td> 91 <?php $this->checkbox( 'Remove standard navigation', 'remove', $pbOptions, 'page' ); ?> 92 </td> 93 </tr> 83 94 84 95 85 <tr>86 <th scope="row" valign="top"><?php echo __ ( 'Stylesheet', 'pagebar')?>:</th>87 <td><label>96 <tr> 97 <th scope="row" valign="top"><?php echo esc_html_e( 'Stylesheet', 'pagebar' ); ?>:</th> 98 <td><label> 88 99 89 <input onClick="cssSwitch();" type="radio" id="rdo_style" 90 name="stylesheet" value="styleCss" 91 <?php 92 if ($pbOptions ["stylesheet"] == "styleCss") 93 echo " checked " ?>> 100 <input onClick="cssSwitch();" type="radio" id="rdo_style" 101 name="stylesheet" value="styleCss" 102 <?php 103 if ( $pbOptions ['stylesheet'] == 'styleCss' ) { 104 echo esc_html( ' checked ' ); 105 } 106 ?> 107 > 94 108 95 <?php echo __ ( 'style.css', 'pagebar')?>109 <?php esc_html_e( 'style.css', 'pagebar' ); ?> 96 110 97 </label><br/>111 </label><br/> 98 112 99 <input onClick="cssSwitch();" type="radio" id="rdo_own" 100 name="stylesheet" value="own" 101 <?php 102 if ($pbOptions ["stylesheet"] == "own") 103 echo " checked " ?>> 113 <input onClick="cssSwitch();" type="radio" id="rdo_own" 114 name="stylesheet" value="own" 115 <?php 116 if ( $pbOptions ['stylesheet'] == 'own' ) { 117 echo esc_html( ' checked ' ); 118 } 119 ?> 120 > 104 121 105 <input type="text" id="edt_cssFile" name="cssFilename" value="<?php echo $pbOptions ["cssFilename"]?>"></td> 106 </tr> 122 <input type="text" id="edt_cssFile" name="cssFilename" 123 value="<?php echo esc_html( $pbOptions ['cssFilename'] ); ?>"></td> 124 </tr> 107 125 108 </table>126 </table> 109 127 110 128 111 <?php $this->pb_submitButton('pagebar'); ?>129 <?php $this->pb_submitButton( 'pagebar' ); ?> 112 130 113 <script type="text/javascript"> 114 autoSwitch(); cssSwitch(); 115 </script></form> 131 <script type="text/javascript"> 132 autoSwitch(); 133 cssSwitch(); 134 </script> 135 </form> -
pagebar/trunk/pagebar_options_postbar.php
r494677 r2757940 1 <?php if(!defined('ABSPATH')) { header("HTTP/1.1 403 Forbidden"); die("HTTP/1.1 403 Forbidden"); } ?> 1 <?php if ( ! defined( 'ABSPATH' ) ) { 2 header( 'HTTP/1.1 403 Forbidden' ); 3 die( 'HTTP/1.1 403 Forbidden' ); 4 } ?> 2 5 <script type="text/javascript"> 3 6 4 function autoSwitch(id) {5 var elements = ['footer', 'bef_loop', 'aft_loop', 'remove'];6 $j=jQuery.noConflict();7 if ($j('#cb_auto:checked').val() == null) {8 color = '#ccc';9 dis = true;10 } else {11 color = '#000';12 dis = false;13 }14 for (i=0;i<=elements.length;i++) {15 $j('#lbl_' + elements[i]).css( { color: color}); // grey out label texts7 function autoSwitch(id) { 8 var elements = ['footer', 'bef_loop', 'aft_loop', 'remove']; 9 $j = jQuery.noConflict(); 10 if ($j('#cb_auto:checked').val() == null) { 11 color = '#ccc'; 12 dis = true; 13 } else { 14 color = '#000'; 15 dis = false; 16 } 17 for (i = 0; i <= elements.length; i++) { 18 $j('#lbl_' + elements[i]).css({color: color}); // grey out label texts 16 19 if (dis) //disable/enable checkboxes 17 $j("#cb_"+elements[i]).attr("disabled","disabled");20 $j("#cb_" + elements[i]).attr("disabled", "disabled"); 18 21 else 19 $j("#cb_"+elements[i]).removeAttr("disabled");20 }21 $j('#pos').css( {color: color});22 $j('#integrate').css( {color: color});23 }22 $j("#cb_" + elements[i]).removeAttr("disabled"); 23 } 24 $j('#pos').css({color: color}); 25 $j('#integrate').css({color: color}); 26 } 24 27 25 function cssSwitch(id){28 function cssSwitch(id) { 26 29 // $j=jQuery.noConflict(); 27 30 // // double check for undefined and null for compatibilty with … … 37 40 // $j("#edt_cssFile").css({color: '#000'}); 38 41 // } 39 }42 } 40 43 </script> 41 44 42 45 <table class="form-table"> 43 46 44 <?php $this->pb_basicOptions($pbOptions, 'post'); ?>47 <?php $this->pb_basicOptions( $pbOptions, 'post' ); ?> 45 48 46 49 47 50 <tr> 48 <th scope="row" width="33%"><?php e cho __( 'Automagic insertion', 'pagebar' )?>:</th>51 <th scope="row" width="33%"><?php esc_html_e( 'Automagic insertion', 'pagebar' ); ?>:</th> 49 52 <td> 50 <?php echo $this->checkbox ('Insert postbar automagic into blog', 'auto', $pbOptions, "post", "autoSwitch('position');"); ?>53 <?php $this->checkbox( 'Insert postbar automagic into blog', 'auto', $pbOptions, 'post', "autoSwitch('position');" ); ?> 51 54 </td> 52 55 </tr> … … 54 57 55 58 <tr> 56 <th scope="row" valign="top"><?php e cho __( 'Positioning', 'pagebar' ) . ':'?></th>57 <td>58 <?php echo 59 $this->checkbox ('Front of postings', 'bef_loop', $pbOptions, "post" ) ,60 $this->checkbox ('Behind postings', 'aft_loop', $pbOptions, "post" ) ,61 $this->checkbox ('Footer', 'footer', $pbOptions, "post");62 ?>63 </td>59 <th scope="row" valign="top"><?php esc_html_e( 'Positioning', 'pagebar' ) . ':'; ?></th> 60 <td> 61 <?php 62 $this->checkbox( 'Front of postings', 'bef_loop', $pbOptions, 'post' ); 63 $this->checkbox( 'Behind postings', 'aft_loop', $pbOptions, 'post' ); 64 $this->checkbox( 'Footer', 'footer', $pbOptions, 'post' ); 65 ?> 66 </td> 64 67 </tr> 65 68 66 69 <tr> 67 <th scope="row" valign="top"><?php e cho __( 'Integration', 'pagebar' )?>:</th>70 <th scope="row" valign="top"><?php esc_html_e( 'Integration', 'pagebar' ); ?>:</th> 68 71 69 72 <td> 70 <?php echo $this->checkbox ('Remove standard navigation', 'remove', $pbOptions, "post")?>73 <?php $this->checkbox( 'Remove standard navigation', 'remove', $pbOptions, 'post' ); ?> 71 74 </td> 72 75 </tr> 73 76 74 <?php $this->pb_stylesheetOptions($pbOptions, 'post')?>77 <?php $this->pb_stylesheetOptions( $pbOptions, 'post' ); ?> 75 78 76 79 </table> 77 80 78 81 79 <?php $this->pb_submitButton( 'pagebar'); ?>82 <?php $this->pb_submitButton( 'pagebar' ); ?> 80 83 81 84 <script type="text/javascript"> 82 autoSwitch(); cssSwitch(); 85 autoSwitch(); 86 cssSwitch(); 83 87 </script> -
pagebar/trunk/readme.txt
r2752056 r2757940 3 3 Donate link: http://elektroelch.de 4 4 Tags: navigation, navi, page, comments 5 Requires at least: 3.35 Requires at least: 5.5 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.0 8 Stable tag: trunk8 Stable tag: 2.67 9 9 10 10 Pagebar adds a nice page bar to your blog posts, multipaged posts and paged comments. … … 13 13 14 14 Pagebar adds a nice page bar to your blog posts, multipaged posts and paged comments: 15 <center><img src=" http://elektroelch.de/hacks/wp/pagebar/wp-content/uploads/2009/04/pagebar.jpg" ></center>15 <center><img src="./pagebar.jpg" ></center> 16 16 17 17 == Features == … … 215 215 216 216 == Changelog == 217 = 2.67 = 218 + Further required security stuff 219 + Support for removal of newer themes 220 217 221 = 2.66 = 218 + AddedNonces to prevent CSRF attacks222 + Nonces to prevent CSRF attacks 219 223 220 224 = 2.61 =
Note: See TracChangeset
for help on using the changeset viewer.