Skip to content

Commit

Permalink
version 2.7.4 released
Browse files Browse the repository at this point in the history
  • Loading branch information
manchumahara committed Jan 20, 2025
1 parent 8134062 commit 255312e
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 83 deletions.
111 changes: 79 additions & 32 deletions includes/WPNextPreviousLinkAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class WPNextPreviousLinkAdmin {
/**
* Initialize the class and set its properties.
*
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*
* @since 1.0.0
*/
Expand Down Expand Up @@ -129,7 +129,7 @@ public function enqueue_styles() {
$vendors_path_part = WPNEXTPREVIOUSLINK_ROOT_PATH . 'assets/vendors/';

$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash($_GET['page']) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended

wp_register_style( 'awesome-notifications', $vendors_url_part . 'awesome-notifications/style.css', [], $version );
wp_register_style( 'pickr', $vendors_url_part . 'pickr/themes/classic.min.css', [], $version );
Expand All @@ -139,7 +139,12 @@ public function enqueue_styles() {

if ( $current_page == 'wpnextpreviouslink' ) {

wp_register_style( 'wpnextpreviouslink-setting', $css_url_part . 'wpnextpreviouslink-setting.css', [ 'pickr', 'select2', 'awesome-notifications', 'wpnextpreviouslink-admin' ], $this->version, 'all' );
wp_register_style( 'wpnextpreviouslink-setting', $css_url_part . 'wpnextpreviouslink-setting.css', [
'pickr',
'select2',
'awesome-notifications',
'wpnextpreviouslink-admin'
], $this->version, 'all' );


/*wp_enqueue_style( 'wp-color-picker' );
Expand Down Expand Up @@ -180,7 +185,7 @@ public function enqueue_scripts() {
$vendors_path_part = WPNEXTPREVIOUSLINK_ROOT_PATH . 'assets/vendors/';

$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash($_GET['page']) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended


wp_register_script( 'jquery-validate', $vendors_url_part . 'jquery-validation/jquery.validate.min.js', [ 'jquery' ], $version, true );
Expand Down Expand Up @@ -310,7 +315,7 @@ public function get_plugin_basename() {
* @since 1.0.0
*/
public function admin_pages() {
$page = isset( $_GET['page'] ) ? sanitize_text_field(wp_unslash( $_GET['page'] ) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';//phpcs:ignore WordPress.Security.NonceVerification.Recommended

//setting menu
$hook = add_options_page(
Expand All @@ -332,10 +337,16 @@ public function menu_settings() {

if ( $doc ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wpnextpreviouslink_get_template_html( 'admin/support.php', [ 'admin_ref' => $this, 'settings' => $this->settings ] );
echo wpnextpreviouslink_get_template_html( 'admin/support.php', [
'admin_ref' => $this,
'settings' => $this->settings
] );
} else {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo wpnextpreviouslink_get_template_html( 'admin/settings.php', [ 'admin_ref' => $this, 'settings' => $this->settings ] );
echo wpnextpreviouslink_get_template_html( 'admin/settings.php', [
'admin_ref' => $this,
'settings' => $this->settings
] );
}
}//end menu_settings

Expand Down Expand Up @@ -370,7 +381,7 @@ public function get_settings_sections() {
/**
* Return the key value pair of post types
*
* @param type array $all_post_types
* @param type array $all_post_types
*
* @return type array
*/
Expand Down Expand Up @@ -403,10 +414,10 @@ public function get_settings_fields() {
*
* @access public
*
* @param array $links_array An array of the plugin's metadata
* @param string $plugin_file_name Path to the plugin file
* @param array $plugin_data An array of plugin data
* @param string $status Status of the plugin
* @param array $links_array An array of the plugin's metadata
* @param string $plugin_file_name Path to the plugin file
* @param array $plugin_data An array of plugin data
* @param string $status Status of the plugin
*
* @return array $links_array
*/
Expand Down Expand Up @@ -468,13 +479,13 @@ public function add_action_links( $links ) {
*
*/
public function plugin_upgrader_process_complete() {
$saved_version = get_option('wpnextpreviouslink_version');
$saved_version = get_option( 'wpnextpreviouslink_version' );

if ($saved_version === false || version_compare($saved_version , WPNEXTPREVIOUSLINK_VERSION, '<')) {
if ( $saved_version === false || version_compare( $saved_version, WPNEXTPREVIOUSLINK_VERSION, '<' ) ) {
set_transient( 'wpnextpreviouslink_upgraded_notice', 1 );

// Update the saved version
update_option('wpnextpreviouslink_version', WPNEXTPREVIOUSLINK_VERSION);
update_option( 'wpnextpreviouslink_version', WPNEXTPREVIOUSLINK_VERSION );
}
}//end plugin_upgrader_process_complete

Expand All @@ -491,9 +502,14 @@ public function plugin_activate_upgrade_notices() {

echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible">';
/* translators: %s. Core plugin's version */
echo '<p><img style="float: left; display: inline-block; margin-right: 15px;" src="' . esc_url( WPNEXTPREVIOUSLINK_ROOT_URL . 'assets/images/icon_48.png') . '" />' . sprintf( wp_kses( __( 'Thanks for installing/deactivating <strong>CBX Next Previous Article</strong> V%s - Codeboxr Team', 'wpnextpreviouslink' ), [ 'strong' => [] ] ), esc_attr( WPNEXTPREVIOUSLINK_VERSION ) ) . '</p>'; //phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
echo '<p><img style="float: left; display: inline-block; margin-right: 15px;" src="' . esc_url( WPNEXTPREVIOUSLINK_ROOT_URL . 'assets/images/icon_48.png' ) . '" />' . sprintf( wp_kses( __( 'Thanks for installing/deactivating <strong>CBX Next Previous Article</strong> V%s - Codeboxr Team', 'wpnextpreviouslink' ), [ 'strong' => [] ] ), esc_attr( WPNEXTPREVIOUSLINK_VERSION ) ) . '</p>'; //phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
/* translators: 1. Plugin setting url 2. Documentation url */
echo '<p>' . sprintf( wp_kses( __( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a>', 'wpnextpreviouslink' ), [ 'a' => [ 'href' => [], 'target' => [] ] ] ), esc_url( admin_url( 'options-general.php?page=wpnextpreviouslink' ) ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '<p>' . sprintf( wp_kses( __( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a>', 'wpnextpreviouslink' ), [
'a' => [
'href' => [],
'target' => []
]
] ), esc_url( admin_url( 'options-general.php?page=wpnextpreviouslink' ) ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '</div>';


Expand All @@ -506,12 +522,17 @@ public function plugin_activate_upgrade_notices() {

// Check the transient to see if we've just activated the plugin
if ( get_transient( 'wpnextpreviouslink_upgraded_notice' ) ) {
if(!$activation_notice_shown){
if ( ! $activation_notice_shown ) {
echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible">';
/* translators: %s. Core plugin's version */
echo '<p><img style="float: left; display: inline-block; margin-right: 15px;" src="' . esc_url( WPNEXTPREVIOUSLINK_ROOT_URL . 'assets/images/icon_48.png') . '" />' . sprintf( wp_kses( __( 'Thanks for upgrading <strong>CBX Next Previous Article</strong> V%s , enjoy the new features and bug fixes - Codeboxr Team', 'wpnextpreviouslink' ), [ 'strong' => [] ] ), esc_attr( WPNEXTPREVIOUSLINK_VERSION ) ) . '</p>'; //phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
echo '<p><img style="float: left; display: inline-block; margin-right: 15px;" src="' . esc_url( WPNEXTPREVIOUSLINK_ROOT_URL . 'assets/images/icon_48.png' ) . '" />' . sprintf( wp_kses( __( 'Thanks for upgrading <strong>CBX Next Previous Article</strong> V%s , enjoy the new features and bug fixes - Codeboxr Team', 'wpnextpreviouslink' ), [ 'strong' => [] ] ), esc_attr( WPNEXTPREVIOUSLINK_VERSION ) ) . '</p>'; //phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
/* translators: 1. Plugin setting url 2. Documentation url */
echo '<p>' . sprintf( wp_kses( __( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a>', 'wpnextpreviouslink' ), [ 'a' => [ 'href' => [], 'target' => [] ] ] ), esc_url( admin_url( 'options-general.php?page=wpnextpreviouslink' ) ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '<p>' . sprintf( wp_kses( __( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a>', 'wpnextpreviouslink' ), [
'a' => [
'href' => [],
'target' => []
]
] ), esc_url( admin_url( 'options-general.php?page=wpnextpreviouslink' ) ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '</div>';

$this->pro_addon_compatibility_campaign();
Expand Down Expand Up @@ -540,12 +561,22 @@ public function pro_addon_compatibility_campaign() {
echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible">';
echo '<p>' . esc_html__( 'CBX Next Previous Article Pro Addon V2.0.4 or later required to work with the current version core plugin CBX Next Previous Article.', 'wpnextpreviouslink' ) . '</p>';
/* translators: %s. Pro addon external link */
echo '<p>' . sprintf( wp_kses( __( 'Please update <a target="_blank" href="%s">CBX Next Previous Article Pro Addon</a> to version 2.0.4 or later - Codeboxr Team', 'wpnextpreviouslink' ), [ 'a' => [ 'href' => [], 'target' => [] ] ] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '<p>' . sprintf( wp_kses( __( 'Please update <a target="_blank" href="%s">CBX Next Previous Article Pro Addon</a> to version 2.0.4 or later - Codeboxr Team', 'wpnextpreviouslink' ), [
'a' => [
'href' => [],
'target' => []
]
] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p>';
echo '</div>';
}
} else {
/* translators: %s. Pro addon external link */
echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible"><p>' . sprintf( wp_kses( __( '<a target="_blank" href="%s">CBX Next Previous Article Pro Addon</a> has extended features and settings. try it - Codeboxr Team', 'wpnextpreviouslink' ), [ 'a' => [ 'href' => [], 'target' => [] ] ] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p></div>';
echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible"><p>' . sprintf( wp_kses( __( '<a target="_blank" href="%s">CBX Next Previous Article Pro Addon</a> has extended features and settings. try it - Codeboxr Team', 'wpnextpreviouslink' ), [
'a' => [
'href' => [],
'target' => []
]
] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress' ) . '</p></div>';
}
}//end pro_addon_compatibility_campaign

Expand All @@ -558,26 +589,42 @@ public function pro_addon_compatibility_campaign() {
*
* @return void
*/
public function custom_message_after_plugin_row_proaddon($plugin_file, $plugin_data){
public function custom_message_after_plugin_row_proaddon( $plugin_file, $plugin_data ) {
if ( $plugin_file !== 'wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php' ) {
return;
}

if(defined('WPNEXTPREVIOUSLINKADDON_VERSION')) return;

$pro_addon_version = WPNextPreviousLinkHelper::get_any_plugin_version('wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php');

$pro_latest_version = '2.0.7';
$pro_addon_version = WPNextPreviousLinkHelper::get_any_plugin_version( 'wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php' );
$compared_version = '2.0.8';
$need_update = false;

if($pro_addon_version != '' && version_compare( $pro_addon_version, $pro_latest_version, '<' ) ){
// Custom message to display
if ( defined( 'WPNEXTPREVIOUSLINKADDON_VERSION' ) ) {
//of pro addon is too old and doesn't have the update checker implemented
if(version_compare( $pro_addon_version, '2.0.7', '<' )){
$compared_version = '2.0.7';
$need_update = true;
}
}
else{
if ( $pro_addon_version != '' && version_compare( $pro_addon_version, $compared_version, '<' ) ) {
$need_update = true;
}
}


if ( $need_update) {
$plugin_manual_update = 'https://codeboxr.com/manual-update-pro-addon/';


/* translators:translators: %s: plugin setting url for licence */
$custom_message = wp_kses(sprintf( __( '<strong>Note:</strong> CBX Next Previous Article Pro Addon is custom plugin. This plugin can not be auto update from dashboard/plugin manager. For manual update please check <a target="_blank" href="%1$s">documentation</a>. <strong style="color: red;">It seems this plugin\'s current version is older than %2$s . To get the latest pro addon features, this plugin needs to upgrade to %2$s or later.</strong>', 'wpnextpreviouslink' ), esc_url( $plugin_manual_update ), $pro_latest_version ), ['strong' => ['style' => []],'a' => ['href' => [], 'target' => []]]);
$custom_message = wp_kses( sprintf( __( '<strong>Note:</strong> CBX Next Previous Article Pro Addon is custom plugin. This plugin can not be auto update from dashboard/plugin manager. For manual update please check <a target="_blank" href="%1$s">documentation</a>. <strong style="color: red;">It seems this plugin\'s current version is older than %2$s . To get the latest pro addon features, this plugin needs to upgrade to %2$s or later.</strong>', 'wpnextpreviouslink' ), esc_url( $plugin_manual_update ), $compared_version ), [
'strong' => [ 'style' => [] ],
'a' => [
'href' => [],
'target' => []
]
] );

// Output a row with custom content
echo '<tr class="plugin-update-tr">
Expand All @@ -596,7 +643,7 @@ public function custom_message_after_plugin_row_proaddon($plugin_file, $plugin_d
* @return void
* @since 2.7.1
*/
public function settings_reset_load(){
public function settings_reset_load() {
//security check
check_ajax_referer( 'settingsnonce', 'security' );

Expand Down
Loading

0 comments on commit 255312e

Please sign in to comment.