| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: WP-Paginate |
| 4 |
Plugin URI: https://wordpress.org/plugins/wp-paginate/ |
| 5 |
Description: A simple and flexible pagination plugin for WordPress posts and comments. |
| 6 |
Version: 2.2.0 |
| 7 |
Author: Max Foundry |
| 8 |
Author URI: http://maxfoundry.com |
| 9 |
Text Domain: 'wp-paginate' |
| 10 |
*/ |
| 11 |
|
| 12 |
/* Copyright 2016 Max Foundry (http://www.maxfoundry.com) |
| 13 |
|
| 14 |
Plugin originally created by Eric Martin (http://www.ericmmartin.com) and |
| 15 |
and improved upon by Studio Fuels. |
| 16 |
|
| 17 |
This program is free software; you can redistribute it and/or modify |
| 18 |
it under the terms of the GNU General Public License as published by |
| 19 |
the Free Software Foundation; either version 2 of the License, or |
| 20 |
(at your option) any later version. |
| 21 |
|
| 22 |
This program is distributed in the hope that it will be useful, |
| 23 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
GNU General Public License for more details. |
| 26 |
|
| 27 |
You should have received a copy of the GNU General Public License |
| 28 |
along with this program; if not, write to the Free Software |
| 29 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 |
*/ |
| 31 |
|
| 32 |
// plugin links |
| 33 |
if(!defined('WPP_MAXBUTTONS_LINK')) |
| 34 |
define('WPP_MAXBUTTONS_LINK', 'https://maxbuttons.com/?utm_source=wpp-descv2&utm_medium=wpp-plugin&utm_content=wpp-footer&utm_campaign=wpp-descv2'); |
| 35 |
if(!defined('WPP_MAXGALLERIA_LINK')) |
| 36 |
define('WPP_MAXGALLERIA_LINK', 'https://maxgalleria.com/?utm_source=wpp-descv2&utm_medium=wpp-plugin&utm_content=wpp-footer&utm_campaign=wpp-descv2'); |
| 37 |
if(!defined('WPP_MEDIA_LIBRARY_PLUS_PRO_LINK')) |
| 38 |
define('WPP_MEDIA_LIBRARY_PLUS_PRO_LINK', 'https://maxgalleria.com/downloads/media-library-plus-pro/?utm_source=wpp-descv2&utm_medium=wpp-plugin&utm_content=wpp-footer&utm_campaign=wpp-descv2'); |
| 39 |
if(!defined('WPP_WP_PAGINATE_PRO_LINK')) |
| 40 |
define("WPP_WP_PAGINATE_PRO_LINK", "https://maxgalleria.com/downloads/wp-paginate-pro/"); |
| 41 |
|
| 42 |
define("WPP_REVIEW_NOTICE", "wpp_review_notice"); |
| 43 |
if(!defined("WP_PAGINATE_NONCE")) |
| 44 |
define("WP_PAGINATE_NONCE", "wpp_js_nonce"); |
| 45 |
|
| 46 |
/** |
| 47 |
* Set the wp-content and plugin urls/paths |
| 48 |
*/ |
| 49 |
if (!defined('WP_CONTENT_URL')) |
| 50 |
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); |
| 51 |
if (!defined('WP_CONTENT_DIR')) |
| 52 |
define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); |
| 53 |
if (!defined('WP_PLUGIN_URL') ) |
| 54 |
define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins'); |
| 55 |
if (!defined('WP_PLUGIN_DIR') ) |
| 56 |
define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins'); |
| 57 |
|
| 58 |
if (!class_exists('WPPaginate')) { |
| 59 |
class WPPaginate { |
| 60 |
/** |
| 61 |
* @var string The plugin version |
| 62 |
*/ |
| 63 |
public $version = '2.2.0'; |
| 64 |
|
| 65 |
/** |
| 66 |
* @var string The options string name for this plugin |
| 67 |
*/ |
| 68 |
public $optionsName = 'wp_paginate_options'; |
| 69 |
|
| 70 |
/** |
| 71 |
* @var string $localizationDomain Domain used for localization |
| 72 |
*/ |
| 73 |
public $localizationDomain = 'wp-paginate'; |
| 74 |
|
| 75 |
/** |
| 76 |
* @var string $pluginurl The url to this plugin |
| 77 |
*/ |
| 78 |
public $pluginurl = ''; |
| 79 |
/** |
| 80 |
* @var string $pluginpath The path to this plugin |
| 81 |
*/ |
| 82 |
public $pluginpath = ''; |
| 83 |
|
| 84 |
/** |
| 85 |
* @var array $options Stores the options for this plugin |
| 86 |
*/ |
| 87 |
public $options = array(); |
| 88 |
|
| 89 |
public $type = 'posts'; |
| 90 |
|
| 91 |
public $positions = array(); |
| 92 |
|
| 93 |
public $fonts = array(); |
| 94 |
|
| 95 |
public $presets = array(); |
| 96 |
|
| 97 |
/** |
| 98 |
* Constructor |
| 99 |
*/ |
| 100 |
function __construct() { |
| 101 |
$name = dirname(plugin_basename(__FILE__)); |
| 102 |
$this->set_activation_hooks(); |
| 103 |
|
| 104 |
//Language Setup |
| 105 |
load_plugin_textdomain('wp-paginate', false, "$name/I18n/"); |
| 106 |
|
| 107 |
//"Constants" setup |
| 108 |
$this->pluginurl = plugins_url($name) . "/"; |
| 109 |
$this->pluginpath = WP_PLUGIN_DIR . "/$name/"; |
| 110 |
|
| 111 |
//Initialize the options |
| 112 |
$this->get_options(); |
| 113 |
|
| 114 |
//Actions |
| 115 |
add_action( 'init', array(&$this, 'init_pagination')); |
| 116 |
add_action('admin_menu', array(&$this, 'admin_menu_link')); |
| 117 |
add_action('admin_enqueue_scripts', array($this, 'wpp_admin_head')); |
| 118 |
add_action('wp_enqueue_scripts', array($this, 'wpp_enqueue_custom_css'), 20); |
| 119 |
|
| 120 |
|
| 121 |
add_action('admin_notices', array($this, 'show_wpp_admin_notice')); |
| 122 |
|
| 123 |
add_action('wp_ajax_nopriv_wpp_dismiss_notice', array($this, 'wpp_dismiss_notice')); |
| 124 |
add_action('wp_ajax_wpp_dismiss_notice', array($this, 'wpp_dismiss_notice')); |
| 125 |
|
| 126 |
add_action('wp_ajax_nopriv_wpp_set_review_later', array($this, 'wpp_set_review_later')); |
| 127 |
add_action('wp_ajax_wpp_set_review_later', array($this, 'wpp_set_review_later')); |
| 128 |
|
| 129 |
$this->positions = array( |
| 130 |
'none' => esc_html__('Function only', 'wp-paginate'), |
| 131 |
'below' => esc_html__('Below the Content', 'wp-paginate'), |
| 132 |
'above' => esc_html__('Above the Content', 'wp-paginate'), |
| 133 |
'both' => esc_html__('Above and Below the Content', 'wp-paginate') |
| 134 |
); |
| 135 |
|
| 136 |
$this->fonts = array( |
| 137 |
'font-inherit' => esc_html__('inherit', 'wp-paginate'), |
| 138 |
'font-initial' => esc_html__('initial', 'wp-paginate'), |
| 139 |
'font-arial' => esc_html__('Arial', 'wp-paginate'), |
| 140 |
'font-georgia' => esc_html__('Georgia', 'wp-paginate'), |
| 141 |
'font-tahoma' => esc_html__('Tahoma', 'wp-paginate'), |
| 142 |
'font-times' => esc_html__('Times New Roman', 'wp-paginate'), |
| 143 |
'font-trebuchet' => esc_html__('Trebuchet MS', 'wp-paginate'), |
| 144 |
'font-verdana' => esc_html__('Verdana', 'wp-paginate') |
| 145 |
); |
| 146 |
|
| 147 |
$this->presets = array( |
| 148 |
array('default', esc_html__('Grey Buttons', 'wp-paginate'), 'default.jpg'), |
| 149 |
array('wpp-blue-cta', esc_html__('Blue Buttons', 'wp-paginate'), 'blue-cta-buttons.jpg'), |
| 150 |
array('wpp-modern-grey', esc_html__('Modern Grey Buttons', 'wp-paginate'), 'modern-grey-buttons.jpg'), |
| 151 |
array('wpp-neon-pink', esc_html__('Neon Pink Buttons', 'wp-paginate'), 'neon-pink-buttons.png'), |
| 152 |
); |
| 153 |
|
| 154 |
if ($this->options['css']) |
| 155 |
add_action('wp_print_styles', array(&$this, 'wp_paginate_css')); |
| 156 |
} |
| 157 |
|
| 158 |
public function set_activation_hooks() { |
| 159 |
register_activation_hook(__FILE__, array($this, 'do_activation')); |
| 160 |
register_deactivation_hook(__FILE__, array($this, 'do_deactivation')); |
| 161 |
} |
| 162 |
|
| 163 |
public function do_activation() { |
| 164 |
$this->activate(); |
| 165 |
} |
| 166 |
|
| 167 |
public function do_deactivation() { |
| 168 |
$this->deactivate(); |
| 169 |
} |
| 170 |
|
| 171 |
public function activate() { |
| 172 |
$current_user_id = get_current_user_id(); |
| 173 |
|
| 174 |
if(get_user_meta( $current_user_id, WPP_REVIEW_NOTICE, true ) !== "off" ) { |
| 175 |
$review_date = date('Y-m-d', strtotime("+2 days")); |
| 176 |
update_user_meta( $current_user_id, WPP_REVIEW_NOTICE, $review_date ); |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
public function deactivate() { |
| 181 |
} |
| 182 |
|
| 183 |
public function init_pagination() { |
| 184 |
|
| 185 |
if(isset($this->options['everywhere']) && isset($this->options['position'])) { |
| 186 |
|
| 187 |
if ($this->options['position'] === 'above' || $this->options['position'] === 'both') |
| 188 |
add_filter( 'loop_start', array($this, 'add_pagination_to_page_top')); |
| 189 |
|
| 190 |
if ($this->options['position'] === 'below' || $this->options['position'] === 'both') |
| 191 |
add_filter( 'loop_end', array($this, 'add_pagination_to_page_bottom')); |
| 192 |
|
| 193 |
if ($this->options['everywhere'] && ($this->options['position'] === 'below' || $this->options['position'] === 'both')) |
| 194 |
add_filter( 'wp_link_pages', array($this, 'add_pagination_to_page_bottom'), 10, 2 ); |
| 195 |
|
| 196 |
if ($this->options['everywhere'] && ($this->options['position'] === 'above' || $this->options['position'] === 'both')) |
| 197 |
add_filter( 'wp_link_pages', array($this, 'add_pagination_to_page_top'), 10, 2 ); |
| 198 |
|
| 199 |
} |
| 200 |
|
| 201 |
} |
| 202 |
|
| 203 |
function add_pagination_to_page_bottom($content) { |
| 204 |
|
| 205 |
$this->get_options(); |
| 206 |
if(defined('WPP-DEBUG')) { |
| 207 |
$output = print_r($this->options, true); |
| 208 |
error_log($output); |
| 209 |
} |
| 210 |
if( ($this->options['home-page'] && is_front_page()) || |
| 211 |
($this->options['blog-page'] && is_home()) || |
| 212 |
($this->options['search-page'] && is_search()) || |
| 213 |
($this->options['category-page'] && is_category()) || |
| 214 |
($this->options['archive-page'] && is_archive()) || |
| 215 |
($this->options['everywhere']) |
| 216 |
) { |
| 217 |
|
| 218 |
if ( is_feed() ) |
| 219 |
return $content; |
| 220 |
global $wp_query, $wp_paginate_display_bottom; |
| 221 |
if ( is_main_query() && $content === $wp_query && ! $wp_paginate_display_bottom ) { |
| 222 |
$wp_paginate_display_bottom = true; |
| 223 |
wp_paginate(); |
| 224 |
} |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
function add_pagination_to_page_top($content) { |
| 229 |
|
| 230 |
$this->get_options(); |
| 231 |
if(defined('WPP-DEBUG')) { |
| 232 |
$output = print_r($this->options, true); |
| 233 |
error_log($output); |
| 234 |
} |
| 235 |
if( ($this->options['home-page'] && is_front_page()) || |
| 236 |
($this->options['blog-page'] && is_home()) || |
| 237 |
($this->options['search-page'] && is_search()) || |
| 238 |
($this->options['category-page'] && is_category()) || |
| 239 |
($this->options['archive-page'] && is_archive()) || |
| 240 |
($this->options['everywhere']) |
| 241 |
) { |
| 242 |
|
| 243 |
if ( is_feed() ) |
| 244 |
return $content; |
| 245 |
global $wp_query, $wp_paginate_display_top; |
| 246 |
if ( is_main_query() && $content === $wp_query && ! $wp_paginate_display_top ) { |
| 247 |
$wp_paginate_display_top = true; |
| 248 |
wp_paginate(); |
| 249 |
} |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
function wpp_admin_head($hook) { |
| 254 |
if ( isset( $_REQUEST['page'] ) && 'wp-paginate.php' == $_REQUEST['page'] ) { |
| 255 |
//wp_enqueue_style( 'bootstrap', plugins_url( '/css/bootstrap/bootstrap.min.css', __FILE__ )); |
| 256 |
if ( isset( $_GET['action'] ) && 'custom_css' == $_GET['action'] ) |
| 257 |
$this->wpp_include_codemirror(); |
| 258 |
} |
| 259 |
wp_enqueue_style( 'wp-paginate-admin', plugins_url( '/css/wp-paginate-admin.css', __FILE__ )); |
| 260 |
|
| 261 |
wp_enqueue_script('jquery'); |
| 262 |
wp_enqueue_script('jquery-migrate', ABSPATH . WPINC . '/js/jquery/jquery-migrate.min.js', array('jquery')); |
| 263 |
wp_register_script( 'wpp-script', $this->pluginurl .'js/wp-paginate.js', array( 'jquery' ), '', true ); |
| 264 |
|
| 265 |
wp_localize_script( 'wpp-script', 'wpp_ajax', |
| 266 |
array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 267 |
'nonce'=> wp_create_nonce(WP_PAGINATE_NONCE)) |
| 268 |
); |
| 269 |
|
| 270 |
wp_enqueue_script('wpp-script'); |
| 271 |
|
| 272 |
} |
| 273 |
|
| 274 |
function wpp_enqueue_custom_css() { |
| 275 |
$wpp_custom_css_active = get_option('wpp_custom_css_active', 'off'); |
| 276 |
if($wpp_custom_css_active === 'on') { |
| 277 |
$upload_dir = wp_upload_dir(); |
| 278 |
$wpp_css_file = $upload_dir['baseurl'] . '/wpp-custom-code/wpp-custom-code.css'; |
| 279 |
wp_enqueue_style( 'wpp-custom-style', $wpp_css_file, array('wp-paginate') ); |
| 280 |
} |
| 281 |
} |
| 282 |
|
| 283 |
/** |
| 284 |
* Pagination based on options/args |
| 285 |
*/ |
| 286 |
function paginate($args = false) { |
| 287 |
|
| 288 |
|
| 289 |
if ($this->type === 'comments' && !get_option('page_comments')) |
| 290 |
return; |
| 291 |
|
| 292 |
$r = wp_parse_args($args, $this->options); |
| 293 |
extract($r, EXTR_SKIP); |
| 294 |
//error_log("r " . print_r($r, true)); |
| 295 |
|
| 296 |
if(isset($this->options['preset'])) |
| 297 |
$preset = $this->options['preset']; |
| 298 |
else |
| 299 |
$preset = 'default'; |
| 300 |
|
| 301 |
if(isset($this->options['font'])) |
| 302 |
$font = $this->options['font']; |
| 303 |
else |
| 304 |
$font = 'font-inherit'; |
| 305 |
|
| 306 |
if(isset($before)) |
| 307 |
$before_option = $before; |
| 308 |
else if(isset($this->options['before'])) |
| 309 |
$before_option = $this->options['before']; |
| 310 |
else |
| 311 |
$before_option = '<div class="navigation">'; |
| 312 |
|
| 313 |
if(isset($after)) |
| 314 |
$after_option = $after; |
| 315 |
else if(isset($this->options['after'])) |
| 316 |
$after_option = $this->options['after']; |
| 317 |
else |
| 318 |
$after_option = '</div>'; |
| 319 |
|
| 320 |
if(isset($this->options['slash'])) |
| 321 |
$slash_option = $this->options['slash']; |
| 322 |
else |
| 323 |
$slash_option = false; |
| 324 |
|
| 325 |
$before = stripslashes(html_entity_decode($before_option)); |
| 326 |
$after = stripslashes(html_entity_decode($after_option)); |
| 327 |
|
| 328 |
if (!isset($page) && !isset($pages)) { |
| 329 |
global $wp_query; |
| 330 |
|
| 331 |
if ($this->type === 'posts') { |
| 332 |
$page = get_query_var('paged'); |
| 333 |
$posts_per_page = intval(get_query_var('posts_per_page')); |
| 334 |
$pages = intval(ceil($wp_query->found_posts / $posts_per_page)); |
| 335 |
} |
| 336 |
else { |
| 337 |
$page = get_query_var('cpage'); |
| 338 |
$comments_per_page = get_option('comments_per_page'); |
| 339 |
$pages = get_comment_pages_count(); |
| 340 |
} |
| 341 |
$page = !empty($page) ? intval($page) : 1; |
| 342 |
} |
| 343 |
|
| 344 |
$prevlink = ($this->type === 'posts') |
| 345 |
? rtrim(esc_url(get_pagenum_link($page - 1)), '/') |
| 346 |
: get_comments_pagenum_link($page - 1); |
| 347 |
$nextlink = ($this->type === 'posts') |
| 348 |
? rtrim(esc_url(get_pagenum_link($page + 1)), '/') |
| 349 |
: get_comments_pagenum_link($page + 1); |
| 350 |
|
| 351 |
//if($slash_option == true) { |
| 352 |
// $prevlink . '/'; |
| 353 |
// $nextlink . '/'; |
| 354 |
//} |
| 355 |
|
| 356 |
$output = stripslashes(wp_kses_decode_entities($before)); |
| 357 |
if ($pages > 1) { |
| 358 |
|
| 359 |
if($preset === 'default') |
| 360 |
$output .= sprintf('<ol class="wp-paginate ' . $font . '%s">', ($this->type === 'posts') ? '' : ' wp-paginate-comments'); |
| 361 |
else |
| 362 |
$output .= sprintf('<ol class="wp-paginate ' . $preset . ' ' . $font . '%s">', ($this->type === 'posts') ? '' : ' wp-paginate-comments'); |
| 363 |
|
| 364 |
if (strlen(stripslashes($title)) > 0) { |
| 365 |
$output .= sprintf('<li><span class="title">%s</span></li>', stripslashes($title)); |
| 366 |
} |
| 367 |
|
| 368 |
if(isset($this->options['hide-ellipses']) && $this->options['hide-ellipses'] == true ) |
| 369 |
$ellipsis = "<li class='ellipse-gap'></li>"; |
| 370 |
else |
| 371 |
$ellipsis = "<li><span class='gap'>...</span></li>"; |
| 372 |
|
| 373 |
if ($page > 1 && !empty($previouspage)) { |
| 374 |
$prevlink = rtrim($prevlink, '/'); |
| 375 |
$contains_param = (strpos($prevlink, '?') !== false) ? true : false; |
| 376 |
if($slash_option && !$contains_param) |
| 377 |
$output .= sprintf('<li><a href="%s/" class="prev" aria-label="' . esc_html__('Go to previous page', 'wp-paginate') . '">%s</a></li>', $prevlink, stripslashes($previouspage)); |
| 378 |
else |
| 379 |
$output .= sprintf('<li><a href="%s" class="prev" aria-label="' . esc_html__('Go to previous page', 'wp-paginate') . '">%s</a></li>', $prevlink, stripslashes($previouspage)); |
| 380 |
} |
| 381 |
|
| 382 |
$min_links = $range * 2 + 1; |
| 383 |
$block_min = min($page - $range, $pages - $min_links); |
| 384 |
$block_high = max($page + $range, $min_links); |
| 385 |
$left_gap = (($block_min - $anchor - $gap) > 0) ? true : false; |
| 386 |
$right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false; |
| 387 |
|
| 388 |
if ($left_gap && !$right_gap) { |
| 389 |
$output .= sprintf('%s%s%s', |
| 390 |
$this->paginate_loop(1, $anchor, 0, 0, $slash_option), |
| 391 |
$ellipsis, |
| 392 |
$this->paginate_loop($block_min, $pages, $page, $page, $slash_option) |
| 393 |
); |
| 394 |
} |
| 395 |
else if ($left_gap && $right_gap) { |
| 396 |
$output .= sprintf('%s%s%s%s%s', |
| 397 |
$this->paginate_loop(1, $anchor, 0, 0, $slash_option), |
| 398 |
$ellipsis, |
| 399 |
$this->paginate_loop($block_min, $block_high, $page, $page, $slash_option), |
| 400 |
$ellipsis, |
| 401 |
$this->paginate_loop(($pages - $anchor + 1), $pages, 0, 0, $slash_option) |
| 402 |
); |
| 403 |
} |
| 404 |
else if ($right_gap && !$left_gap) { |
| 405 |
$output .= sprintf('%s%s%s', |
| 406 |
$this->paginate_loop(1, $block_high, $page, $page, $slash_option), |
| 407 |
$ellipsis, |
| 408 |
$this->paginate_loop(($pages - $anchor + 1), $pages, 0, 0, $slash_option) |
| 409 |
); |
| 410 |
} |
| 411 |
else { |
| 412 |
$output .= $this->paginate_loop(1, $pages, $page, $page, $slash_option); |
| 413 |
} |
| 414 |
|
| 415 |
if ($page < $pages && !empty($nextpage)) { |
| 416 |
$nextlink = rtrim($nextlink, '/'); |
| 417 |
$contains_param = (strpos($nextlink, '?') !== false) ? true : false; |
| 418 |
if($slash_option && !$contains_param) |
| 419 |
$output .= sprintf('<li><a href="%s/" class="next" aria-label="' . esc_html__('Go to next page', 'wp-paginate') . '">%s</a></li>', $nextlink, stripslashes($nextpage)); |
| 420 |
else |
| 421 |
$output .= sprintf('<li><a href="%s" class="next" aria-label="' . esc_html__('Go to next page', 'wp-paginate') . '">%s</a></li>', $nextlink, stripslashes($nextpage)); |
| 422 |
} |
| 423 |
$output .= "</ol>"; |
| 424 |
} |
| 425 |
|
| 426 |
$output .= stripslashes(wp_kses_decode_entities($after)); |
| 427 |
|
| 428 |
if ($pages > 1 || $empty) { |
| 429 |
echo $output; |
| 430 |
} |
| 431 |
} |
| 432 |
|
| 433 |
/** |
| 434 |
* Helper function for pagination which builds the page links. |
| 435 |
*/ |
| 436 |
function paginate_loop($start, $max, $page = 0, $slash = false) { |
| 437 |
$output = ""; |
| 438 |
for ($i = $start; $i <= $max; $i++) { |
| 439 |
if($slash) |
| 440 |
$p = ($this->type === 'posts') ? esc_url(get_pagenum_link($i)) : get_comments_pagenum_link($i); |
| 441 |
else |
| 442 |
$p = ($this->type === 'posts') ? rtrim(esc_url(get_pagenum_link($i)), '/') : get_comments_pagenum_link($i); |
| 443 |
$output .= ($page == intval($i)) |
| 444 |
? "<li><span class='page current'>$i</span></li>" |
| 445 |
: "<li><a href='$p' title='$i' aria-label='" . esc_html__('Go to page', 'wp-paginate') . " $i' class='page'>$i</a></li>"; |
| 446 |
//: "<li><a href='$p' title='$i' aria-label='Go to page $i' class='page'>$i</a></li>"; |
| 447 |
} |
| 448 |
return $output; |
| 449 |
} |
| 450 |
|
| 451 |
function wp_paginate_css() { |
| 452 |
$name = "css/wp-paginate.css"; |
| 453 |
|
| 454 |
if (false !== @file_exists(STYLESHEETPATH . "/$name")) { |
| 455 |
$css = get_stylesheet_directory_uri() . "/$name"; |
| 456 |
} |
| 457 |
else { |
| 458 |
$css = $this->pluginurl . $name; |
| 459 |
} |
| 460 |
wp_enqueue_style('wp-paginate', $css, false, $this->version, 'screen'); |
| 461 |
|
| 462 |
if (function_exists('is_rtl') && is_rtl()) { |
| 463 |
$name = "css/wp-paginate-rtl.css"; |
| 464 |
if (false !== @file_exists(STYLESHEETPATH . "/$name")) { |
| 465 |
$css = get_stylesheet_directory_uri() . "/$name"; |
| 466 |
} |
| 467 |
else { |
| 468 |
$css = $this->pluginurl . $name; |
| 469 |
} |
| 470 |
wp_enqueue_style('wp-paginate-rtl', $css, false, $this->version, 'screen'); |
| 471 |
} |
| 472 |
|
| 473 |
wp_enqueue_style( 'wpp-advanced-styles', $this->wpp_print_style() ); |
| 474 |
|
| 475 |
} |
| 476 |
|
| 477 |
/** |
| 478 |
* Retrieves the plugin options from the database. |
| 479 |
* @return array |
| 480 |
*/ |
| 481 |
function get_options() { |
| 482 |
if (!$options = get_option($this->optionsName)) { |
| 483 |
$options = array( |
| 484 |
'title' => 'Pages:', |
| 485 |
'nextpage' => '»', |
| 486 |
'previouspage' => '«', |
| 487 |
'css' => true, |
| 488 |
'slash' => false, |
| 489 |
'before' => '<div class="navigation">', |
| 490 |
'after' => '</div>', |
| 491 |
'empty' => true, |
| 492 |
'range' => 3, |
| 493 |
'anchor' => 1, |
| 494 |
'gap' => 3, |
| 495 |
'everywhere' => false, |
| 496 |
'home-page' => false, |
| 497 |
'blog-page' => false, |
| 498 |
'search-page' => false, |
| 499 |
'category-page' => false, |
| 500 |
'archive-page' => false, |
| 501 |
'position' => 'none', |
| 502 |
'hide-standard-pagination' => false, |
| 503 |
'hide-ellipses' => false, |
| 504 |
'font' => 'font-inherit', |
| 505 |
'preset' => 'default' |
| 506 |
); |
| 507 |
update_option($this->optionsName, $options); |
| 508 |
} |
| 509 |
$this->options = $options; |
| 510 |
} |
| 511 |
/** |
| 512 |
* Saves the admin options to the database. |
| 513 |
*/ |
| 514 |
function save_admin_options(){ |
| 515 |
|
| 516 |
if(defined('WPP-DEBUG')) { |
| 517 |
$output = print_r($this->options, true); |
| 518 |
error_log($output); |
| 519 |
} |
| 520 |
|
| 521 |
return update_option($this->optionsName, $this->options); |
| 522 |
} |
| 523 |
|
| 524 |
/** |
| 525 |
* @desc Adds the options subpanel |
| 526 |
*/ |
| 527 |
function admin_menu_link() { |
| 528 |
add_options_page('WP-Paginate', 'WP-Paginate', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page')); |
| 529 |
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 ); |
| 530 |
} |
| 531 |
|
| 532 |
/** |
| 533 |
* @desc Adds the Settings link to the plugin activate/deactivate page |
| 534 |
*/ |
| 535 |
function filter_plugin_actions($links, $file) { |
| 536 |
$settings_link = '<a href="options-general.php?page=' . basename(__FILE__) . '">' . esc_html__('Settings', 'wp-paginate') . '</a>'; |
| 537 |
array_unshift($links, $settings_link); // before other links |
| 538 |
|
| 539 |
return $links; |
| 540 |
} |
| 541 |
|
| 542 |
/** |
| 543 |
* Adds settings/options page |
| 544 |
*/ |
| 545 |
function admin_options_page() { |
| 546 |
|
| 547 |
$allowed_html = array( |
| 548 |
'div' => array( |
| 549 |
'class' => array(), |
| 550 |
'id' => array() |
| 551 |
), |
| 552 |
'nav' => array( |
| 553 |
'class' => array(), |
| 554 |
'id' => array() |
| 555 |
), |
| 556 |
'em' => array(), |
| 557 |
'strong' => array() |
| 558 |
); |
| 559 |
|
| 560 |
$allowed_presets = array('default', 'wpp-blue-cta', 'wpp-modern-grey', 'wpp-neon-pink'); |
| 561 |
|
| 562 |
if (isset($_POST['wp_paginate_save'])) { |
| 563 |
if (wp_verify_nonce($_POST['_wpnonce'], 'wp-paginate-update-options')) { |
| 564 |
|
| 565 |
if(defined('WPP-DEBUG')) { |
| 566 |
error_log("wp_paginate_save"); |
| 567 |
} |
| 568 |
|
| 569 |
$this->options['title'] = trim(sanitize_text_field($_POST['title'])); |
| 570 |
$this->options['previouspage'] = trim(sanitize_text_field($_POST['previouspage'])); |
| 571 |
$this->options['nextpage'] = trim(sanitize_text_field($_POST['nextpage'])); |
| 572 |
$this->options['before'] = wp_kses($_POST['before'], $allowed_html); |
| 573 |
$this->options['after'] = wp_kses($_POST['after'], $allowed_html); |
| 574 |
$this->options['empty'] = (isset($_POST['empty']) && $_POST['empty'] === 'on') ? true : false; |
| 575 |
$this->options['css'] = (isset($_POST['css']) && $_POST['css'] === 'on') ? true : false; |
| 576 |
$this->options['slash'] = (isset($_POST['slash']) && $_POST['slash'] === 'on') ? true : false; |
| 577 |
$this->options['range'] = intval($_POST['range']); |
| 578 |
$this->options['anchor'] = intval($_POST['anchor']); |
| 579 |
$this->options['gap'] = intval($_POST['gap']); |
| 580 |
$this->options['everywhere'] = (isset($_POST['everywhere']) && $_POST['everywhere'] === 'on') ? true : false; |
| 581 |
$this->options['home-page'] = (isset($_POST['home-page']) && $_POST['home-page'] === 'on') ? true : false; |
| 582 |
$this->options['blog-page'] = (isset($_POST['blog-page']) && $_POST['blog-page'] === 'on') ? true : false; |
| 583 |
$this->options['search-page'] = (isset($_POST['search-page']) && $_POST['search-page'] === 'on') ? true : false; |
| 584 |
$this->options['category-page'] = (isset($_POST['category-page']) && $_POST['category-page'] === 'on') ? true : false; |
| 585 |
$this->options['archive-page'] = (isset($_POST['archive-page']) && $_POST['archive-page'] === 'on') ? true : false; |
| 586 |
if(isset($_POST['position'])) |
| 587 |
$this->options['position'] = sanitize_text_field($_POST['position']); |
| 588 |
$this->options['hide-standard-pagination'] = (isset($_POST['hide-standard-pagination']) && $_POST['hide-standard-pagination'] === 'on') ? true : false; |
| 589 |
$this->options['hide-ellipses'] = (isset($_POST['hide-ellipses']) && $_POST['hide-ellipses'] === 'on') ? true : false; |
| 590 |
if(isset($_POST['font'])) |
| 591 |
$this->options['font'] = sanitize_text_field($_POST['font']); |
| 592 |
if(isset($_POST['preset'])) { |
| 593 |
$preset_value = trim(sanitize_text_field($_POST['preset'])); |
| 594 |
// only allow predefined values |
| 595 |
if(in_array($preset_value, $allowed_presets)) |
| 596 |
$this->options['preset'] = $preset_value; |
| 597 |
else |
| 598 |
$this->options['preset'] = 'default'; |
| 599 |
} |
| 600 |
|
| 601 |
$this->save_admin_options(); |
| 602 |
|
| 603 |
echo '<div class="updated"><p>' . esc_html__('Success! Your changes were successfully saved!', 'wp-paginate') . '</p></div>'; |
| 604 |
} |
| 605 |
else { |
| 606 |
echo '<div class="error"><p>' . esc_html__('Whoops! There was a problem with the data you posted. Please try again.', 'wp-paginate') . '</p></div>'; |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
?> |
| 611 |
|
| 612 |
<div class="wrap"> |
| 613 |
<div class="icon32" id="icon-options-general"><br/></div> |
| 614 |
<h1>WP-Paginate</h1> |
| 615 |
<h2 class="nav-tab-wrapper"> |
| 616 |
<a class="nav-tab<?php if ( ! isset( $_GET['action'] ) ) echo ' nav-tab-active'; ?>" href="options-general.php?page=wp-paginate.php"><?php esc_html_e( 'Settings', 'wp-paginate' ); ?></a> |
| 617 |
<a class="nav-tab <?php if ( isset( $_GET['action'] ) && 'custom_css' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="options-general.php?page=wp-paginate.php&action=custom_css"><?php esc_html_e( 'Custom CSS', 'wp-paginate' ); ?></a> |
| 618 |
<a class="nav-tab <?php if ( isset( $_GET['action'] ) && 'upgrade_to_pro' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="options-general.php?page=wp-paginate.php&action=upgrade_to_pro"><?php esc_html_e( 'Upgrade to Pro', 'wp-paginate' ); ?></a> |
| 619 |
</h2> |
| 620 |
|
| 621 |
<?php if ( ! isset( $_GET['action'] ) || $_GET['action'] == 'appearance' ) { ?> |
| 622 |
|
| 623 |
<form method="post" id="wp_paginate_options"> |
| 624 |
<?php wp_nonce_field('wp-paginate-update-options'); ?> |
| 625 |
|
| 626 |
<h3><?php esc_html_e('General', 'wp-paginate'); ?></h3> |
| 627 |
<table class="form-table"> |
| 628 |
<tr valign="top"> |
| 629 |
<th scope="row"><?php esc_html_e('Pagination Label:', 'wp-paginate'); ?></th> |
| 630 |
<td><input name="title" type="text" id="title" size="40" value="<?php echo esc_attr(stripslashes(htmlspecialchars($this->options['title']))) ?>"/> |
| 631 |
<span class="description"><?php esc_html_e('The optional text/HTML to display before the list of pages.', 'wp-paginate'); ?></span></td> |
| 632 |
</tr> |
| 633 |
<tr valign="top"> |
| 634 |
<th scope="row"><?php esc_html_e('Previous Page:', 'wp-paginate'); ?></th> |
| 635 |
<td><input name="previouspage" type="text" id="previouspage" size="40" value="<?php echo esc_attr(stripslashes(htmlspecialchars($this->options['previouspage']))) ?>"/> |
| 636 |
<span class="description"><?php esc_html_e('The text/HTML to display for the previous page link.', 'wp-paginate'); ?></span></td> |
| 637 |
</tr> |
| 638 |
<tr valign="top"> |
| 639 |
<th scope="row"><?php esc_html_e('Next Page:', 'wp-paginate'); ?></th> |
| 640 |
<td><input name="nextpage" type="text" id="nextpage" size="40" value="<?php echo esc_attr(stripslashes(htmlspecialchars($this->options['nextpage']))) ?>"/> |
| 641 |
<span class="description"><?php esc_html_e('The text/HTML to display for the next page link.', 'wp-paginate'); ?></span></td> |
| 642 |
</tr> |
| 643 |
</table> |
| 644 |
<p> </p> |
| 645 |
<h3><?php esc_html_e('Location & Position', 'wp-paginate'); ?></h3> |
| 646 |
<table class="form-table"> |
| 647 |
<tr valign="top"> |
| 648 |
<th scope="row"><?php esc_html_e('Everywhere:', 'wp-paginate'); ?></th> |
| 649 |
<td><label for="everywhere"> |
| 650 |
<?php |
| 651 |
if(isset($this->options['everywhere'])) |
| 652 |
$everywhere = $this->options['everywhere']; |
| 653 |
else |
| 654 |
$everywhere = false; |
| 655 |
?> |
| 656 |
<input class="everywhere-cb" type="checkbox" id="everywhere" name="everywhere" <?php echo esc_attr(($everywhere === true) ? "checked='checked'" : ""); ?>/> <?php esc_html_e('Display pagination everywhere. (Comments pagination not included.)', 'wp-paginate') ?></label></td> |
| 657 |
</tr> |
| 658 |
<tr valign="top"> |
| 659 |
<th scope="row"><?php esc_html_e('Home Page:', 'wp-paginate'); ?></th> |
| 660 |
<td><label for="home-page"> |
| 661 |
<?php |
| 662 |
if(isset($this->options['home-page'])) |
| 663 |
$home_page = $this->options['home-page']; |
| 664 |
else |
| 665 |
$home_page = false; |
| 666 |
?> |
| 667 |
<input class="not-everywhere-cb" type="checkbox" id="home-page" name="home-page" <?php echo esc_attr(($home_page === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Display pagination on the home page.', 'wp-paginate') ?></label></td> |
| 668 |
</tr> |
| 669 |
<tr valign="top"> |
| 670 |
<th scope="row"><?php esc_html_e('Blog Page:', 'wp-paginate'); ?></th> |
| 671 |
<td><label for="blog-page"> |
| 672 |
<?php |
| 673 |
if(isset($this->options['blog-page'])) |
| 674 |
$blog_page = $this->options['blog-page']; |
| 675 |
else |
| 676 |
$blog_page = false; |
| 677 |
?> |
| 678 |
<input class="not-everywhere-cb" type="checkbox" id="blog-page" name="blog-page" <?php echo esc_attr(($blog_page === true)) ? "checked='checked'" : ""; ?>/> <?php esc_html_e('Display pagination on the blog page.', 'wp-paginate') ?></label></td> |
| 679 |
</tr> |
| 680 |
<tr valign="top"> |
| 681 |
<th scope="row"><?php esc_html_e('Search Page:', 'wp-paginate'); ?></th> |
| 682 |
<td><label for="search-page"> |
| 683 |
<?php |
| 684 |
if(isset($this->options['search-page'])) |
| 685 |
$search_page = $this->options['search-page']; |
| 686 |
else |
| 687 |
$search_page = false; |
| 688 |
?> |
| 689 |
<input class="not-everywhere-cb" type="checkbox" id="search-page" name="search-page" <?php echo esc_attr(($search_page === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Display pagination on the search page.', 'wp-paginate') ?></label></td> |
| 690 |
</tr> |
| 691 |
<tr valign="top"> |
| 692 |
<th scope="row"><?php esc_html_e('Category Pages:', 'wp-paginate'); ?></th> |
| 693 |
<td><label for="category-page"> |
| 694 |
<?php |
| 695 |
if(isset($this->options['category-page'])) |
| 696 |
$category_page = $this->options['category-page']; |
| 697 |
else |
| 698 |
$category_page = false; |
| 699 |
?> |
| 700 |
<input class="not-everywhere-cb" type="checkbox" id="search-page" name="category-page" <?php echo esc_attr(($category_page === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Display pagination on category pages.', 'wp-paginate') ?></label></td> |
| 701 |
</tr> |
| 702 |
<tr valign="top"> |
| 703 |
<th scope="row"><?php esc_html_e('Archive Pages:', 'wp-paginate'); ?></th> |
| 704 |
<td><label for="archive-page"> |
| 705 |
<?php |
| 706 |
if(isset($this->options['archive-page'])) |
| 707 |
$archive_page = $this->options['archive-page']; |
| 708 |
else |
| 709 |
$archive_page = false; |
| 710 |
?> |
| 711 |
<input class="not-everywhere-cb" type="checkbox" id="archive-page" name="archive-page" <?php echo esc_attr(($archive_page === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Display pagination on archive pages.', 'wp-paginate') ?></label></td> |
| 712 |
</tr> |
| 713 |
|
| 714 |
<script> |
| 715 |
jQuery(document).ready(function(){ |
| 716 |
|
| 717 |
jQuery(".everywhere-cb").change(function() { |
| 718 |
if(jQuery(".everywhere-cb").is(':checked')) { |
| 719 |
jQuery(".not-everywhere-cb").prop('disabled', true); |
| 720 |
jQuery(".not-everywhere-cb").prop("checked", false); |
| 721 |
} else { |
| 722 |
jQuery(".not-everywhere-cb").prop('disabled', false); |
| 723 |
} |
| 724 |
}); |
| 725 |
|
| 726 |
if(jQuery(".everywhere-cb").is(':checked')) { |
| 727 |
jQuery(".not-everywhere-cb").prop('disabled', true); |
| 728 |
} else { |
| 729 |
jQuery(".not-everywhere-cb").prop('disabled', false); |
| 730 |
} |
| 731 |
|
| 732 |
}); |
| 733 |
</script> |
| 734 |
|
| 735 |
<tr valign="top"> |
| 736 |
<th scope="row"><?php esc_html_e('Position:', 'wp-paginate'); ?></th> |
| 737 |
<td> |
| 738 |
<?php |
| 739 |
if(isset($this->options['position'])) |
| 740 |
$position = $this->options['position']; |
| 741 |
else |
| 742 |
$position = 'none'; |
| 743 |
?> |
| 744 |
<select name="position" id="range"> |
| 745 |
<?php foreach ($this->positions as $key => $name) { ?> |
| 746 |
<?php $selected = ($position == $key) ? 'selected="selected"' : ''; ?> |
| 747 |
<option value="<?php echo esc_attr($key) ?>" <?php echo esc_attr($selected) ?>><?php echo esc_html($name) ?></option> |
| 748 |
<?php } ?> |
| 749 |
</select> |
| 750 |
<span class="description"><?php esc_html_e('Where to display the pagination on the page.', 'wp-paginate'); ?></span></td> |
| 751 |
</tr> |
| 752 |
<tr valign="top"> |
| 753 |
<th scope="row"><?php esc_html_e('Hide Standard Pagination:', 'wp-paginate'); ?></th> |
| 754 |
<td><label for="hide-standard-pagination"> |
| 755 |
<?php |
| 756 |
if(isset($this->options['hide-standard-pagination'])) |
| 757 |
$hide_standard_pagination = $this->options['hide-standard-pagination']; |
| 758 |
else |
| 759 |
$hide_standard_pagination = 'none'; |
| 760 |
?> |
| 761 |
<input type="checkbox" id="hide-standard-pagination" name="hide-standard-pagination" <?php echo esc_attr(($hide_standard_pagination === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Hide the standard theme default pagination.', 'wp-paginate'); ?></label></td> |
| 762 |
</tr> |
| 763 |
</table> |
| 764 |
<p> </p> |
| 765 |
<h3><?php esc_html_e('Appearance', 'wp-paginate'); ?></h3> |
| 766 |
<table class="form-table"> |
| 767 |
<tr valign="top"> |
| 768 |
<th scope="row"><?php esc_html_e('Pagination Font:', 'wp-paginate'); ?></th> |
| 769 |
<td> |
| 770 |
<?php |
| 771 |
if(isset($this->options['font'])) |
| 772 |
$font = $this->options['font']; |
| 773 |
else |
| 774 |
$font = 'font-inherit'; |
| 775 |
?> |
| 776 |
<select name="font" id="font"> |
| 777 |
<?php foreach ($this->fonts as $key => $name) { ?> |
| 778 |
<?php $selected = ($font == $key) ? 'selected="selected"' : ''; ?> |
| 779 |
<option value="<?php echo esc_attr($key) ?>" <?php echo esc_attr($selected) ?>><?php echo esc_html($name) ?></option> |
| 780 |
<?php } ?> |
| 781 |
</select> |
| 782 |
<span class="description"><?php esc_html_e('Select the font to use with the pagination.', 'wp-paginate'); ?></span></td> |
| 783 |
</tr> |
| 784 |
<tr valign="top"> |
| 785 |
<th scope="row"><?php esc_html_e('Hide Ellipses:', 'wp-paginate'); ?></th> |
| 786 |
<td><label for="hide-ellipses"> |
| 787 |
<?php |
| 788 |
if(isset($this->options['hide-ellipses'])) |
| 789 |
$hide_ellipses = $this->options['hide-ellipses']; |
| 790 |
else |
| 791 |
$hide_ellipses = 'none'; |
| 792 |
?> |
| 793 |
<input type="checkbox" id="hide-ellipses" name="hide-ellipses" <?php echo esc_attr(($hide_ellipses === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Remove ellipses from the pagination links.', 'wp-paginate'); ?></label></td> |
| 794 |
</tr> |
| 795 |
<tr valign="top"> |
| 796 |
<th scope="row"><?php esc_html_e('Button Style:', 'wp-paginate'); ?></th> |
| 797 |
<?php |
| 798 |
if(isset($this->options['preset'])) { |
| 799 |
$preset_option = $this->options['preset']; |
| 800 |
} else { |
| 801 |
$preset_option = 'default'; |
| 802 |
} |
| 803 |
?> |
| 804 |
<input type='hidden' value='<?php echo esc_attr($preset_option) ?>' name='preset' id='preset'> |
| 805 |
<td> |
| 806 |
<p><?php esc_html_e('Choose a preset style from the list below.', 'wp-paginate'); ?></p> |
| 807 |
<table class="button-styles"> |
| 808 |
<?php foreach($this->presets as $preset ) { ?> |
| 809 |
<tr> |
| 810 |
<td> |
| 811 |
<?php echo esc_html($preset[1]) ?> |
| 812 |
</td> |
| 813 |
<td> |
| 814 |
<input type="radio" name="preset" id="preset" value="<?php echo esc_attr($preset[0]) ?>" <?php echo esc_attr(($preset_option === $preset[0]) ? 'checked' : '') ?>> |
| 815 |
</td> |
| 816 |
<td> |
| 817 |
<img alt="<?php echo esc_attr($preset[1]) ?> image" src="<?php echo esc_url($this->pluginurl . "images/" . $preset[2]) ?>" width="326" height="70"> |
| 818 |
</td> |
| 819 |
</tr> |
| 820 |
<?php } ?> |
| 821 |
</table> |
| 822 |
</td> |
| 823 |
</tr> |
| 824 |
</table> |
| 825 |
<p> </p> |
| 826 |
<h3><?php esc_html_e('Advanced Settings', 'wp-paginate'); ?></h3> |
| 827 |
<table class="form-table"> |
| 828 |
<tr valign="top"> |
| 829 |
<th scope="row"><?php esc_html_e('Before Markup:', 'wp-paginate'); ?></th> |
| 830 |
<td><input name="before" type="text" id="before" size="40" value="<?php echo esc_attr(stripslashes(wp_kses_decode_entities($this->options['before']))); ?>"/> |
| 831 |
<span class="description"><?php esc_html_e('The HTML markup to display before the pagination code.', 'wp-paginate'); ?></span></td> |
| 832 |
</tr> |
| 833 |
<tr valign="top"> |
| 834 |
<th scope="row"><?php esc_html_e('After Markup:', 'wp-paginate'); ?></th> |
| 835 |
<td><input name="after" type="text" id="after" size="40" value="<?php echo esc_attr(stripslashes(wp_kses_decode_entities($this->options['after']))); ?>"/> |
| 836 |
<span class="description"><?php esc_html_e('The HTML markup to display after the pagination code.', 'wp-paginate'); ?></span></td> |
| 837 |
</tr> |
| 838 |
<tr valign="top"> |
| 839 |
<th scope="row"><?php esc_html_e('Markup Display:', 'wp-paginate'); ?></th> |
| 840 |
<td><label for="empty"> |
| 841 |
<input type="checkbox" id="empty" name="empty" <?php echo esc_attr(($this->options['empty'] === true) ? "checked='checked'" : "") ?>/> <?php esc_html_e('Show Before Markup and After Markup, even if the page list is empty?', 'wp-paginate'); ?></label></td> |
| 842 |
</tr> |
| 843 |
<tr valign="top"> |
| 844 |
<th scope="row"><?php esc_html_e('WP-Paginate CSS File:', 'wp-paginate'); ?></th> |
| 845 |
<td><label for="css"> |
| 846 |
<input type="checkbox" id="css" name="css" <?php echo esc_attr(($this->options['css'] === true) ? "checked='checked'" : "") ?>/> <?php printf(esc_html__('Include the default stylesheet wp-paginate.css? WP-Paginate will first look for <code>wp-paginate.css</code> in your theme directory (<code>themes/%s</code>).', 'wp-paginate'), get_template()); ?></label></td> |
| 847 |
</tr> |
| 848 |
<?php |
| 849 |
if(!isset($this->options['slash'])) |
| 850 |
$this->options['slash'] = false; |
| 851 |
?> |
| 852 |
<tr valign="top"> |
| 853 |
<th scope="row"><?php esc_html_e('Add trailing slash:', 'wp-paginate'); ?></th> |
| 854 |
<td><label for="slash"> |
| 855 |
<input type="checkbox" id="css" name="slash" <?php echo esc_attr(($this->options['slash'] === true) ? "checked='checked'" : "") ?>/> <?php printf(esc_html__('Adds a trailing slash to the end of pagination links.', 'wp-paginate'), get_template()); ?></label></td> |
| 856 |
</tr> |
| 857 |
|
| 858 |
<tr valign="top"> |
| 859 |
<th scope="row"><?php esc_html_e('Page Range:', 'wp-paginate'); ?></th> |
| 860 |
<td> |
| 861 |
<select name="range" id="range"> |
| 862 |
<?php for ($i=1; $i<=10; $i++) : ?> |
| 863 |
<option value="<?php echo esc_attr($i) ?>" <?php echo esc_attr(($i == $this->options['range']) ? "selected='selected'" : "") ?>><?php echo esc_html($i) ?></option> |
| 864 |
<?php endfor; ?> |
| 865 |
</select> |
| 866 |
<span class="description"><?php esc_html_e('The number of page links to show before and after the current page. Recommended value: 3', 'wp-paginate'); ?></span></td> |
| 867 |
</tr> |
| 868 |
<tr valign="top"> |
| 869 |
<th scope="row"><?php esc_html_e('Page Anchors:', 'wp-paginate'); ?></th> |
| 870 |
<td> |
| 871 |
<select name="anchor" id="anchor"> |
| 872 |
<?php for ($i=0; $i<=10; $i++) : ?> |
| 873 |
<option value="<?php echo esc_attr($i) ?>" <?php echo esc_attr(($i == $this->options['anchor']) ? "selected='selected'" : "") ?>><?php echo esc_html($i) ?></option> |
| 874 |
<?php endfor; ?> |
| 875 |
</select> |
| 876 |
<span class="description"><?php esc_html_e('The number of links to always show at beginning and end of pagination. Recommended value: 1', 'wp-paginate'); ?></span></td> |
| 877 |
</tr> |
| 878 |
<tr valign="top"> |
| 879 |
<th scope="row"><?php esc_html_e('Page Gap:', 'wp-paginate'); ?></th> |
| 880 |
<td> |
| 881 |
<select name="gap" id="gap"> |
| 882 |
<?php for ($i=1; $i<=10; $i++) : ?> |
| 883 |
<option value="<?php echo esc_attr($i) ?>" <?php echo esc_attr(($i == $this->options['gap']) ? "selected='selected'" : "") ?>><?php echo esc_html($i) ?></option> |
| 884 |
<?php endfor; ?> |
| 885 |
</select> |
| 886 |
<span class="description"><?php esc_html_e('The minimum number of pages in a gap before an ellipsis (...) is added. Recommended value: 3', 'wp-paginate'); ?></span></td> |
| 887 |
</tr> |
| 888 |
</table> |
| 889 |
<p class="submit"> |
| 890 |
<input type="submit" id="wpp-save-changes" value="<?php esc_html_e('Save Changes', 'wp-paginate'); ?>" name="wp_paginate_save" class="button-primary" /> |
| 891 |
</p> |
| 892 |
</form> |
| 893 |
<p> </p> |
| 894 |
<hr> |
| 895 |
<script> |
| 896 |
jQuery(document).ready(function(){ |
| 897 |
|
| 898 |
jQuery("#wpp-save-changes").click(function(){ |
| 899 |
unsaved = false; |
| 900 |
}); |
| 901 |
|
| 902 |
var unsaved = false; |
| 903 |
|
| 904 |
jQuery(":input").change(function(){ //trigers change in all input fields including text type |
| 905 |
unsaved = true; |
| 906 |
}); |
| 907 |
|
| 908 |
function unloadPage(){ |
| 909 |
if(unsaved){ |
| 910 |
return "Do you want to leave this page and discard your changes or stay on this page?"; |
| 911 |
} |
| 912 |
} |
| 913 |
|
| 914 |
window.onbeforeunload = unloadPage; |
| 915 |
|
| 916 |
}); |
| 917 |
|
| 918 |
|
| 919 |
</script> |
| 920 |
<?php } elseif ( 'upgrade_to_pro' == $_GET['action'] ) { ?> |
| 921 |
<?php $this->wpp_upgrade_to_pro_tab(); ?> |
| 922 |
<p> </p> |
| 923 |
<hr> |
| 924 |
<?php } elseif ( 'custom_css' == $_GET['action'] ) { ?> |
| 925 |
<h2>Custom CSS</h2> |
| 926 |
<?php $this->wpp_custom_code_tab(); ?> |
| 927 |
<p> </p> |
| 928 |
<hr> |
| 929 |
<?php } ?> |
| 930 |
|
| 931 |
<h2><?php esc_html_e('Need Support?', 'wp-paginate'); ?></h2> |
| 932 |
<p><?php printf(esc_html__('For questions, issues or feature requests, please post them in the %s and make sure to tag the post with wp-paginate.', 'wp-paginate'), '<a href="https://wordpress.org/support/plugin/wp-paginate">WordPress Forum</a>'); ?></p> |
| 933 |
<p> </p> |
| 934 |
<div id="wpp-plugins"> |
| 935 |
|
| 936 |
<div class="paginate-info"><?php esc_html_e( 'WP Paginate is Maintained and Upgraded by Max Foundry', 'wp-paginate' ); ?></div> |
| 937 |
<div class="paginate-info"><?php esc_html_e( 'Developed Originally by Eric Martin', 'wp-paginate' ); ?></div> |
| 938 |
<div class="mf-plugins"><?php esc_html_e( 'Max Foundry Produces These Other Fine Plugins', 'wp-paginate' ); ?></div> |
| 939 |
|
| 940 |
<div class="column-left"> |
| 941 |
<a href="<?php echo esc_url_raw(WPP_MAXBUTTONS_LINK) ?>" target="_blank"> |
| 942 |
<img alt="maxbuttons logo" src="<?php echo $this->pluginurl ?>images/MBP.png" width="283" height="142"> |
| 943 |
</a> |
| 944 |
<a href="<?php echo esc_url_raw(WPP_MAXBUTTONS_LINK) ?>" target="_blank"> |
| 945 |
<div class="wpp-plugin-title"><?php esc_html_e( 'WordPress Button Plugin', 'wp-paginate' ); ?></div> |
| 946 |
</a> |
| 947 |
</div> |
| 948 |
<div class="column-center"> |
| 949 |
<a href="<?php echo esc_url_raw(WPP_MAXGALLERIA_LINK) ?>" target="_blank"> |
| 950 |
<img alt="maxgalleria logo" src="<?php echo esc_url($this->pluginurl . "images/MG_logo.png") ?>" width="283" height="142"> |
| 951 |
</a> |
| 952 |
<a href="<?php echo esc_url_raw(WPP_MAXGALLERIA_LINK) ?>" target="_blank"> |
| 953 |
<div class="wpp-plugin-title"><?php esc_html_e( 'WordPress Gallery Plugin', 'wp-paginate' ); ?></div> |
| 954 |
</a> |
| 955 |
</div> |
| 956 |
<div class="column-right"> |
| 957 |
<a href="<?php echo esc_url_raw(WPP_MEDIA_LIBRARY_PLUS_PRO_LINK) ?>" target="_blank"> |
| 958 |
<img alt="media library plus pro logo" src="<?php echo esc_url($this->pluginurl . "images/MLPP-card-red.png") ?>" width="283" height="142"> |
| 959 |
</a> |
| 960 |
<a href="<?php echo esc_url_raw(WPP_MEDIA_LIBRARY_PLUS_PRO_LINK) ?>" target="_blank"> |
| 961 |
<div class="wpp-plugin-title"><?php esc_html_e( 'WordPress Media Library Folders', 'wp-paginate' ); ?></div> |
| 962 |
</a> |
| 963 |
</div> |
| 964 |
</div> |
| 965 |
|
| 966 |
</div> |
| 967 |
|
| 968 |
<?php |
| 969 |
} |
| 970 |
|
| 971 |
function wpp_include_codemirror() { |
| 972 |
wp_enqueue_style( 'codemirror.css', plugins_url( 'lib/codemirror.css', __FILE__ ) ); |
| 973 |
wp_enqueue_script( 'codemirror.js', plugins_url( 'lib/codemirror.js', __FILE__ ), array( 'jquery' ) ); |
| 974 |
} |
| 975 |
|
| 976 |
function wpp_custom_code_tab() { |
| 977 |
if ( ! current_user_can( 'edit_plugins' ) ) |
| 978 |
wp_die( esc_html__( 'You do not have sufficient permissions to edit plugins for this site.', 'wp-paginate' ) ); |
| 979 |
|
| 980 |
$message = $content = ''; |
| 981 |
$extension = 'css'; |
| 982 |
$wpp_custom_css_active = get_option('wpp_custom_css_active', 'off'); |
| 983 |
|
| 984 |
$upload_dir = wp_upload_dir(); |
| 985 |
$folder = $upload_dir['basedir'] . '/wpp-custom-code'; |
| 986 |
if ( ! $upload_dir["error"] ) { |
| 987 |
if ( ! is_dir( $folder ) ) |
| 988 |
wp_mkdir_p( $folder, 0755 ); |
| 989 |
|
| 990 |
$index_file = $upload_dir['basedir'] . '/wpp-custom-code/index.php'; |
| 991 |
if ( ! file_exists( $index_file ) ) { |
| 992 |
if ( $f = fopen( $index_file, 'w+' ) ) |
| 993 |
fclose( $f ); |
| 994 |
} |
| 995 |
} |
| 996 |
|
| 997 |
$css_file = 'wpp-custom-code.css'; |
| 998 |
$real_css_file = $folder . '/' . $css_file; |
| 999 |
|
| 1000 |
if ( isset( $_REQUEST['wpp_update_custom_code'] ) && check_admin_referer( 'wpp_update_nonce' . $css_file ) ) { |
| 1001 |
|
| 1002 |
/* CSS */ |
| 1003 |
$newcontent_css = wp_kses_post(wp_unslash( $_POST['wpp_newcontent_css'] )); |
| 1004 |
if ( $f = fopen( $real_css_file, 'w+' ) ) { |
| 1005 |
fwrite( $f, $newcontent_css ); |
| 1006 |
fclose( $f ); |
| 1007 |
$message .= sprintf( esc_html__( 'File %s edited successfully.', 'wp-paginate' ), '<i>' . $css_file . '</i>' ) . ' '; |
| 1008 |
} else { |
| 1009 |
$error .= esc_html__( 'Not enough permissions to create or update the file', 'wp-paginate' ) . ' ' . $real_css_file . '. '; |
| 1010 |
} |
| 1011 |
|
| 1012 |
if(isset($_REQUEST['wpp_custom_css_active'])) |
| 1013 |
$wpp_custom_css_active = 'on'; |
| 1014 |
else |
| 1015 |
$wpp_custom_css_active = 'off'; |
| 1016 |
|
| 1017 |
update_option('wpp_custom_css_active', $wpp_custom_css_active, true ); |
| 1018 |
|
| 1019 |
if ( ! empty( $error ) ) |
| 1020 |
$error .= ' <a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">' . esc_html__( 'Learn more', 'wp-paginate' ) . '</a>'; |
| 1021 |
} |
| 1022 |
|
| 1023 |
if ( file_exists( $real_css_file ) ) { |
| 1024 |
update_recently_edited( $real_css_file ); |
| 1025 |
$content_css = esc_textarea( file_get_contents( $real_css_file ) ); |
| 1026 |
//$is_css_active = true; |
| 1027 |
} |
| 1028 |
else |
| 1029 |
$content_css = ""; |
| 1030 |
|
| 1031 |
if ( ! empty( $message ) ) { ?> |
| 1032 |
<div id="message" class="below-h2 updated notice is-dismissible"><p><?php echo esc_html($message) ?></p></div> |
| 1033 |
<?php } ?> |
| 1034 |
<form action="" method="post"> |
| 1035 |
<p> |
| 1036 |
<?php esc_html_e( 'These styles will be added to the header on all pages of your site.', 'wp-paginate' ); ?> |
| 1037 |
</p> |
| 1038 |
<p><big> |
| 1039 |
<?php if ( ! file_exists( $real_css_file ) || ( is_writeable( $real_css_file ) ) ) { |
| 1040 |
echo esc_html__( 'Editing', 'wp-paginate' ) . ' <strong>' . $css_file . '</strong>'; |
| 1041 |
} else { |
| 1042 |
echo esc_html__( 'Browsing', 'wp-paginate' ) . ' <strong>' . $css_file . '</strong>'; |
| 1043 |
} ?> |
| 1044 |
</big></p> |
| 1045 |
<p><label><input type="checkbox" name="wpp_custom_css_active" value="1" <?php checked( $wpp_custom_css_active, 'on'); ?> /> <?php _e( 'Activate', 'wp-paginate' ); ?></label></p> |
| 1046 |
<textarea cols="70" rows="25" name="wpp_newcontent_css" id="wpp_newcontent_css"><?php if ( isset( $content_css ) ) echo $content_css; ?></textarea> |
| 1047 |
<?php if ( ! file_exists( $real_css_file ) || is_writeable( $real_css_file )) { ?> |
| 1048 |
<p class="submit"> |
| 1049 |
<input type="hidden" name="wpp_update_custom_code" value="submit" /> |
| 1050 |
<?php submit_button( esc_html__( 'Save Changes', 'wp-paginate' ), 'primary', 'submit', false ); |
| 1051 |
wp_nonce_field( 'wpp_update_nonce' . $css_file ); ?> |
| 1052 |
</p> |
| 1053 |
<?php } else { ?> |
| 1054 |
<p><em><?php printf( esc_html__( 'You need to make this files writable before you can save your changes. See %s the Codex %s for more information.', 'wp-paginate' ), |
| 1055 |
'<a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">', |
| 1056 |
'</a>' ); ?></em></p> |
| 1057 |
<?php } ?> |
| 1058 |
</form> |
| 1059 |
<script> |
| 1060 |
jQuery(document).ready(function(){ |
| 1061 |
|
| 1062 |
if ( typeof CodeMirror == 'function' ) { |
| 1063 |
if ( jQuery( '#wpp_newcontent_css' ).length > 0 ) { |
| 1064 |
var editor = CodeMirror.fromTextArea( document.getElementById( 'wpp_newcontent_css' ), { |
| 1065 |
mode: "css", |
| 1066 |
theme: "default", |
| 1067 |
styleActiveLine: true, |
| 1068 |
matchBrackets: true, |
| 1069 |
lineNumbers: true, |
| 1070 |
}); |
| 1071 |
} |
| 1072 |
} |
| 1073 |
|
| 1074 |
jQuery("#submit").click(function(){ |
| 1075 |
unsaved = false; |
| 1076 |
}); |
| 1077 |
|
| 1078 |
var unsaved = false; |
| 1079 |
|
| 1080 |
jQuery(":input").change(function(){ //trigers change in all input fields including text type |
| 1081 |
unsaved = true; |
| 1082 |
}); |
| 1083 |
|
| 1084 |
function unloadPage(){ |
| 1085 |
if(unsaved){ |
| 1086 |
return "Do you want to leave this page and discard your changes or stay on this page?"; |
| 1087 |
} |
| 1088 |
} |
| 1089 |
|
| 1090 |
window.onbeforeunload = unloadPage; |
| 1091 |
|
| 1092 |
}); |
| 1093 |
|
| 1094 |
|
| 1095 |
</script> |
| 1096 |
<?php } |
| 1097 |
|
| 1098 |
function wpp_print_style() { |
| 1099 |
$this->get_options(); |
| 1100 |
$classes = ''; |
| 1101 |
if(isset($this->options['hide-standard-pagination']) && $this->options['hide-standard-pagination']) { |
| 1102 |
//$hide_comments |
| 1103 |
$classes .= |
| 1104 |
'.archive #nav-above, |
| 1105 |
.archive #nav-below, |
| 1106 |
.search #nav-above, |
| 1107 |
.search #nav-below, |
| 1108 |
.blog #nav-below, |
| 1109 |
.blog #nav-above, |
| 1110 |
.navigation.paging-navigation, |
| 1111 |
.navigation.pagination, |
| 1112 |
.pagination.paging-pagination, |
| 1113 |
.pagination.pagination, |
| 1114 |
.pagination.loop-pagination, |
| 1115 |
.bicubic-nav-link, |
| 1116 |
#page-nav, |
| 1117 |
.camp-paging, |
| 1118 |
#reposter_nav-pages, |
| 1119 |
.unity-post-pagination, |
| 1120 |
.wordpost_content .nav_post_link'; |
| 1121 |
} |
| 1122 |
if ( ( ! empty( $pgntn_options['additional_pagination_style'] ) ) && '1' == $pgntn_options['display_custom_pagination'] ) { |
| 1123 |
$classes .= ! empty( $classes ) ? ',' : ''; |
| 1124 |
$classes .= $pgntn_options['additional_pagination_style']; |
| 1125 |
} |
| 1126 |
if ( ! empty( $classes ) ) { |
| 1127 |
echo '<style type="text/css">' . PHP_EOL; |
| 1128 |
echo $classes . ' { |
| 1129 |
display: none !important; |
| 1130 |
} |
| 1131 |
.single-gallery .pagination.gllrpr_pagination { |
| 1132 |
display: block !important; |
| 1133 |
}'; |
| 1134 |
echo '</style>' . PHP_EOL; |
| 1135 |
} ?> |
| 1136 |
<?php } |
| 1137 |
|
| 1138 |
public function show_wpp_admin_notice() { |
| 1139 |
$current_user_id = get_current_user_id(); |
| 1140 |
|
| 1141 |
$review = get_user_meta( $current_user_id, WPP_REVIEW_NOTICE, true ); |
| 1142 |
if( $review !== 'off') { |
| 1143 |
if($review === false) { |
| 1144 |
$this->wpp_show_review_notice(); |
| 1145 |
} else { |
| 1146 |
$now = date("Y-m-d"); |
| 1147 |
$review_time = strtotime($review); |
| 1148 |
$now_time = strtotime($now); |
| 1149 |
if($now_time > $review_time) { |
| 1150 |
$this->wpp_show_review_notice(); |
| 1151 |
} |
| 1152 |
} |
| 1153 |
} |
| 1154 |
} |
| 1155 |
|
| 1156 |
public function wpp_show_review_notice() { |
| 1157 |
if( current_user_can( 'manage_options' ) ) { ?> |
| 1158 |
<div class="updated notice wpp-notice"> |
| 1159 |
<div id='wp-paginate-logo'></div> |
| 1160 |
<div id='wpp-notice-1'><p id='wpp-notice-title'><?php esc_html_e( 'Love WP-Paginate?', 'wp-paginate' ); ?></p> |
| 1161 |
<p><?php esc_html_e( 'Your rating is a big help! We really appreciate it!', 'wp-paginate' ); ?></p> |
| 1162 |
|
| 1163 |
<ul id="wpp-review-notice-links"> |
| 1164 |
<li> <span class="dashicons dashicons-smiley"></span><a id="wpp-review-already"><?php esc_html_e( "I've already left a review", 'wp-paginate' ); ?></a></li> |
| 1165 |
<li><span class="dashicons dashicons-calendar-alt"></span><a id="wpp-review-later"><?php esc_html_e( "Maybe Later", 'wp-paginate' ); ?></a></li> |
| 1166 |
<li><span class="dashicons dashicons-external"></span><a id="wpp-write-review" target="_blank" href="https://wordpress.org/support/plugin/wp-paginate/reviews/?filter=5"><?php esc_html_e( "Sure! I'd love to!", 'wp-paginate' ); ?></a></li> |
| 1167 |
</ul> |
| 1168 |
</div> |
| 1169 |
<a class="dashicons dashicons-dismiss close-wpp-notice" id="wpp-dismiss"></a> |
| 1170 |
</div> |
| 1171 |
<?php |
| 1172 |
} |
| 1173 |
} |
| 1174 |
|
| 1175 |
public function wpp_dismiss_notice() { |
| 1176 |
|
| 1177 |
if ( !wp_verify_nonce( $_POST['nonce'], WP_PAGINATE_NONCE)) { |
| 1178 |
exit(esc_html__('missing nonce! Please refresh the page.', 'wp-paginate')); |
| 1179 |
} |
| 1180 |
|
| 1181 |
$current_user_id = get_current_user_id(); |
| 1182 |
|
| 1183 |
update_user_meta( $current_user_id, WPP_REVIEW_NOTICE, "off" ); |
| 1184 |
|
| 1185 |
exit(); |
| 1186 |
|
| 1187 |
} |
| 1188 |
|
| 1189 |
public function wpp_set_review_later() { |
| 1190 |
|
| 1191 |
if ( !wp_verify_nonce( $_POST['nonce'], WP_PAGINATE_NONCE)) { |
| 1192 |
exit(esc_html__('missing nonce! Please refresh the page.', 'wp-paginate')); |
| 1193 |
} |
| 1194 |
|
| 1195 |
$current_user_id = get_current_user_id(); |
| 1196 |
|
| 1197 |
$review_date = date('Y-m-d', strtotime("+7 days")); |
| 1198 |
|
| 1199 |
|
| 1200 |
update_user_meta( $current_user_id, WPP_REVIEW_NOTICE, $review_date ); |
| 1201 |
|
| 1202 |
exit(); |
| 1203 |
|
| 1204 |
} |
| 1205 |
|
| 1206 |
function wpp_upgrade_to_pro_tab() { |
| 1207 |
?> |
| 1208 |
<div id="utp-content"> |
| 1209 |
<div id="mf-logo"> |
| 1210 |
<img alt="<?php esc_html_e('maxfoundry logo', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . '/images/max-foundry.png') ?>" width="172" height="32"> |
| 1211 |
</div> |
| 1212 |
<div style="clear:both"></div> |
| 1213 |
<div id="utp-banner"> |
| 1214 |
<div id="utp-title-wrap"> |
| 1215 |
<div id="utp-title"><?php esc_html_e('WP PAGINATE PRO', 'wp-paginate'); ?></div> |
| 1216 |
</div> |
| 1217 |
<a href="<?php echo esc_url_raw(WPP_WP_PAGINATE_PRO_LINK) ?>" target="_blank"> |
| 1218 |
<img class="buy-now-button" alt="<?php esc_html_e('buy now button', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . "/images/buy-now-btn.png") ?>" width="205" height="68"> |
| 1219 |
</a> |
| 1220 |
</div> |
| 1221 |
<img id='wppp-logo' alt="<?php esc_html_e('wp-pagination pro logo', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . '/images/wpp-pro-logo-2.png') ?>" width="169" height="61"> |
| 1222 |
|
| 1223 |
<div class="utp-text"> |
| 1224 |
<?php esc_html_e('WP-Paginate Pro come with 11 Beautiful<br>Preset Layouts and Multi Site support!', 'wp-paginate'); ?> |
| 1225 |
</div> |
| 1226 |
|
| 1227 |
<div id="wppp-buttons"> |
| 1228 |
<img alt="<?php esc_html_e('WP Pagination Pro buttons styles', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . '/images/wppp-buttons.png') ?>" width="646" height="713"> |
| 1229 |
</div> |
| 1230 |
|
| 1231 |
<div class="utp-text"> |
| 1232 |
<?php esc_html_e('Use These Customizer Settings to Get the<br>Exact Look and Feel You Want', 'wp-paginate'); ?> |
| 1233 |
</div> |
| 1234 |
|
| 1235 |
<div id="wppp-customizer"> |
| 1236 |
<img alt="<?php esc_html_e('WP Pagination Por button Style customizer', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . '/images/wppp-customizer.png') ?>" width="650" height="380"> |
| 1237 |
</div> |
| 1238 |
|
| 1239 |
<a href="<?php echo esc_url_raw(WPP_WP_PAGINATE_PRO_LINK) ?>" target="_blank"> |
| 1240 |
<img class="buy-now-button" alt="<?php esc_html_e('buy now button', 'wp-paginate'); ?>" src="<?php echo esc_url($this->pluginurl . "/images/buy-now-btn.png") ?>" width="205" height="68"> |
| 1241 |
</a> |
| 1242 |
|
| 1243 |
</div> |
| 1244 |
|
| 1245 |
|
| 1246 |
<div> |
| 1247 |
|
| 1248 |
</div> |
| 1249 |
|
| 1250 |
|
| 1251 |
<?php |
| 1252 |
} |
| 1253 |
|
| 1254 |
|
| 1255 |
} |
| 1256 |
} |
| 1257 |
|
| 1258 |
//instantiate the class |
| 1259 |
if (class_exists('WPPaginate')) { |
| 1260 |
$wp_paginate = new WPPaginate(); |
| 1261 |
} |
| 1262 |
|
| 1263 |
/** |
| 1264 |
* Pagination function to use for posts |
| 1265 |
*/ |
| 1266 |
function wp_paginate($args = false) { |
| 1267 |
|
| 1268 |
if(!is_active_widget()) { |
| 1269 |
global $wp_paginate; |
| 1270 |
$wp_paginate->type = 'posts'; |
| 1271 |
return $wp_paginate->paginate($args); |
| 1272 |
} |
| 1273 |
} |
| 1274 |
|
| 1275 |
/** |
| 1276 |
* Pagination function to use for post comments |
| 1277 |
*/ |
| 1278 |
function wp_paginate_comments($args = false) { |
| 1279 |
global $wp_paginate; |
| 1280 |
$wp_paginate->type = 'comments'; |
| 1281 |
return $wp_paginate->paginate($args); |
| 1282 |
} |
| 1283 |
|
| 1284 |
|
| 1285 |
/* |
| 1286 |
* The format of this plugin is based on the following plugin template: |
| 1287 |
* http://pressography.com/plugins/wordpress-plugin-template/ |
| 1288 |
*/ |
| 1289 |
|