' . __( 'Upgrade to Pro', 'pagination' ) . '',
'manage_options',
'https://bestwebsoft.com/products/wordpress/plugins/pagination/?k=5f3235c93ef4bd001abe4efd16530be0&pn=212&v=' . $pgntn_plugin_info["Version"] . '&wp_v=' . $wp_version );
add_action( 'load-' . $settings, 'pgntn_add_tabs' );
}
}
/**
* Internationalization
*/
if ( ! function_exists( 'pgntn_plugins_loaded' ) ) {
function pgntn_plugins_loaded() {
load_plugin_textdomain( 'pagination', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
}
/**
* Plugin initialization and language localization on backend and front end
* @return void
*/
if ( ! function_exists ( 'pgntn_init' ) ) {
function pgntn_init() {
global $bws_plugin_info, $pgntn_plugin_info;
require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' );
bws_include_init( plugin_basename( __FILE__ ) );
/* Add variable for bws_menu */
if ( empty( $pgntn_plugin_info ) ) {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$pgntn_plugin_info = get_plugin_data( __FILE__ );
}
/* Function check if plugin is compatible with current WP version */
bws_wp_min_version_check( plugin_basename( __FILE__ ), $pgntn_plugin_info, '4.5' );
pgntn_settings();
pgntn_display();
}
}
/**
* Plugin initialization on backend
* @return void
*/
if ( ! function_exists ( 'pgntn_admin_init' ) ) {
function pgntn_admin_init() {
global $bws_plugin_info, $pgntn_plugin_info, $pagenow, $pgntn_options;
if ( empty( $bws_plugin_info ) )
$bws_plugin_info = array( 'id' => '212', 'version' => $pgntn_plugin_info["Version"] );
if ( 'plugins.php' == $pagenow ) {
/* show banner go settings pls*/
if ( function_exists( 'bws_plugin_banner_go_pro' ) ) {
pgntn_settings();
bws_plugin_banner_go_pro( $pgntn_options, $pgntn_plugin_info, 'pgntn', 'pagination', 'de97a6f81981229376108a33685eb703', '212', '//ps.w.org/pagination/assets/icon-128x128.png' );
}
}
}
}
/* Add settings page in admin area */
if ( ! function_exists( 'pgntn_settings_page' ) ) {
function pgntn_settings_page() {
if ( ! class_exists( 'Bws_Settings_Tabs' ) )
require_once( dirname( __FILE__ ) . '/bws_menu/class-bws-settings.php' );
require_once( dirname( __FILE__ ) . '/includes/class-pgntn-settings.php' );
$page = new Pgntn_Settings_Tabs( plugin_basename( __FILE__ ) ); ?>
$pgntn_plugin_info["Version"],
'display_settings_notice' => 1,
'suggest_feature_banner' => 1,
'first_install' => strtotime( "now" ),
'where_display' => array( 'everywhere' ),
'loop_position' => 'bottom',
'display_info' => 1,
'display_next_prev' => 1,
'prev_text' => __( '« Previous', 'pagination' ),
'next_text' => __( 'Next »', 'pagination' ),
'show_all' => 0,
'display_count_page' => 2,
'display_standard_pagination' => array( 'posts', 'multipage' , 'comments' ),
'additional_pagination_style' => '',
'display_custom_pagination' => 1,
'add_appearance' => 1,
'width' => '60',
'align' => 'left',
'background_color' => '#ffffff',
'current_background_color' => '#efefef',
'text_color' => '#1e14ca',
'current_text_color' => '#000',
'hover_color' => '#000',
'border_color' => '#cccccc',
'border_width' => 1,
'border_radius' => 0,
'padding_left' => 0,
'padding_right' => 0,
'nofollow_link' => 0
);
return $pgntn_option_defaults;
}
}
/**
* Write plugin settings in to database
* @return void
*/
if ( ! function_exists( 'pgntn_settings' ) ) {
function pgntn_settings() {
global $pgntn_options, $pgntn_plugin_info, $pgntn_option_defaults;
if ( ! $pgntn_plugin_info )
$pgntn_plugin_info = get_plugin_data( __FILE__ );
$pgntn_option_defaults = pgntn_get_options_default();
if ( ! get_option( 'pgntn_options' ) )
add_option( 'pgntn_options', $pgntn_option_defaults );
$pgntn_options = get_option( 'pgntn_options' );
if ( ! isset( $pgntn_options['plugin_option_version'] ) || $pgntn_options['plugin_option_version'] != $pgntn_plugin_info["Version"] ) {
pgntn_plugin_activate();
$pgntn_option_defaults['display_settings_notice'] = 0;
$pgntn_options = array_merge( $pgntn_option_defaults, $pgntn_options );
/* show pro features */
$pgntn_options['hide_premium_options'] = array();
$pgntn_options['plugin_option_version'] = $pgntn_plugin_info["Version"];
update_option( 'pgntn_options', $pgntn_options );
}
}
}
/**
* Function for activation
*/
if ( ! function_exists( 'pgntn_plugin_activate' ) ) {
function pgntn_plugin_activate() {
/* registering uninstall hook */
if ( is_multisite() ) {
switch_to_blog( 1 );
register_uninstall_hook( __FILE__, 'pgntn_delete_options' );
restore_current_blog();
} else {
register_uninstall_hook( __FILE__, 'pgntn_delete_options' );
}
}
}
/**
* Include necessary css- and js-files in admin panel
* @return void
*/
if ( ! function_exists( 'pgntn_admin_head' ) ) {
function pgntn_admin_head() {
wp_enqueue_style( 'pgntn_icon', plugins_url( 'css/icon.css', __FILE__ ), array( 'wp-color-picker' ) );
if ( isset( $_REQUEST['page'] ) && 'pagination.php' == $_REQUEST['page'] ) {
wp_enqueue_style( 'pgntn_stylesheet', plugins_url( 'css/style.css', __FILE__ ), array( 'wp-color-picker' ) );
wp_enqueue_script( 'pgntn_script', plugins_url( 'js/script.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), false, true );
bws_enqueue_settings_scripts();
bws_plugins_include_codemirror();
}
}
}
/**
* Include necessary css- and js-files in front-end
* @return void
*/
if ( ! function_exists( 'pgntn_wp_footer' ) ) {
function pgntn_wp_footer() {
wp_enqueue_style( 'pgntn_stylesheet', plugins_url( 'css/nav-style.css', __FILE__ ) );
wp_enqueue_style( 'pgntn_styles', pgntn_print_style() );
}
}
/**
* Include styles for displaying block of page pagination
* @return void
*/
if ( ! function_exists ( 'pgntn_print_style' ) ) {
function pgntn_print_style() {
global $pgntn_options; ?>
'1' == $pgntn_options['show_all'] ? true : false,
'mid_size' => $pgntn_options['display_count_page'],
'prev_next' => '1' == $pgntn_options['display_next_prev'] ? true : false,
'prev_text' => $pgntn_options['prev_text'],
'next_text' => $pgntn_options['next_text'],
);
$show_block = false;
switch ( $what ) {
case 'posts':
global $wp_query;
if (
( in_array( 'everywhere', $pgntn_options['where_display'] ) ||
( in_array( 'home', $pgntn_options['where_display'] ) && is_front_page() ) ||
( in_array( 'blog', $pgntn_options['where_display'] ) && pgntn_is_blog() ) ||
( in_array( 'archives', $pgntn_options['where_display'] ) && is_archive() ) ||
( in_array( 'search', $pgntn_options['where_display'] ) && is_search() )
) &&
! empty( $wp_query->max_num_pages )
)
$show_block = true;
if ( $show_block ) {
$nav_settings['base'] = str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) );
$nav_settings['format'] = '?paged=%#%';
$nav_settings['current'] = max( 1, get_query_var( 'paged' ) );
$nav_settings['total'] = $wp_query->max_num_pages;
if ( 1 < intval( $nav_settings['total'] ) ) { ?>
max_num_pages ) ) {
$nav_settings['base'] = str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) );
$nav_settings['format'] = '?paged=%#%';
$nav_settings['current'] = max( 1, get_query_var( 'paged' ) );
$nav_settings['total'] = $custom_query->max_num_pages;
if ( 1 < intval( $nav_settings['total'] ) ) { ?>
max_num_pages ) && isset( $custom_query->case ) && 'bws-gallery' == $custom_query->case ) {
$numpages = $custom_query->max_num_pages;
}
if ( $numpages > 1 )
$show_block = true;
if ( $show_block ) {
$current_page = isset( $custom_query->current_page ) ? $custom_query->current_page : intval( $page );
if ( empty( $current_page ) || $current_page == 0 )
$current_page = 1;
$nav_settings['current'] = $current_page;
$nav_settings['total'] = $numpages;
if ( 1 < intval( $nav_settings['total'] ) ) { ?>
using_permalinks() ? user_trailingslashit( trailingslashit( get_permalink() ) . 'comment-page-%#%', 'commentpaged' ) : add_query_arg( 'cpage', '%#%' );
$nav_settings['format'] = '';
$nav_settings['current'] = $current_page;
$nav_settings['total'] = $page_comments;
$nav_settings['add_fragment'] = '#comments';
if ( 1 < intval( $nav_settings['total'] ) ) { ?>
' . __( 'Settings', 'pagination' ) . '';
$links[] = '' . __( 'FAQ', 'pagination' ) . '';
$links[] = '' . __( 'Support', 'pagination' ) . '';
}
return $links;
}
}
/* add help tab */
if ( ! function_exists( 'pgntn_add_tabs' ) ) {
function pgntn_add_tabs() {
$screen = get_current_screen();
$args = array(
'id' => 'pgntn',
'section' => '200995139'
);
bws_help_tab( $screen, $args );
}
}
/* add admin notices */
if ( ! function_exists ( 'pgntn_admin_notices' ) ) {
function pgntn_admin_notices() {
global $hook_suffix, $pgntn_plugin_info;
if ( 'plugins.php' == $hook_suffix && ! is_network_admin() ) {
bws_plugin_banner_to_settings( $pgntn_plugin_info, 'pgntn_options', 'pagination', 'admin.php?page=pagination.php' );
}
if ( isset( $_REQUEST['page'] ) && 'pagination.php' == $_REQUEST['page'] ) {
bws_plugin_suggest_feature_banner( $pgntn_plugin_info, 'pgntn_options', 'pagination' );
}
}
}
/**
* Function for delete plugin options
* @return void
*/
if ( ! function_exists ( 'pgntn_delete_options' ) ) {
function pgntn_delete_options() {
global $wpdb;
/* Delete options */
$all_plugins = get_plugins();
if ( ! array_key_exists( 'pagination-pro/pagination-pro.php', $all_plugins ) ) {
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
$old_blog = $wpdb->blogid;
/* Get all blog ids */
$blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" );
foreach ( $blogids as $blog_id ) {
switch_to_blog( $blog_id );
delete_option( 'pgntn_options' );
}
switch_to_blog( $old_blog );
} else {
delete_option( 'pgntn_options' );
}
}
require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' );
bws_include_init( plugin_basename( __FILE__ ) );
bws_delete_plugin( plugin_basename( __FILE__ ) );
}
}
if ( ! function_exists ( 'pgntn_nofollow_link' ) ) {
function pgntn_nofollow_link( $link ) {
global $pgntn_options;
if ( 1 == $pgntn_options["nofollow_link"] ) {
$link = str_replace( '