@@ -83,8 +83,8 @@ class WPNextPreviousLinkAdmin {
8383 /**
8484 * Initialize the class and set its properties.
8585 *
86- * @param string $plugin_name The name of this plugin.
87- * @param string $version The version of this plugin.
86+ * @param string $plugin_name The name of this plugin.
87+ * @param string $version The version of this plugin.
8888 *
8989 * @since 1.0.0
9090 */
@@ -129,7 +129,7 @@ public function enqueue_styles() {
129129 $ vendors_path_part = WPNEXTPREVIOUSLINK_ROOT_PATH . 'assets/vendors/ ' ;
130130
131131 $ suffix = ( defined ( 'SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ) ? '' : '.min ' ;
132- $ current_page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field ( wp_unslash ($ _GET ['page ' ]) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
132+ $ current_page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
133133
134134 wp_register_style ( 'awesome-notifications ' , $ vendors_url_part . 'awesome-notifications/style.css ' , [], $ version );
135135 wp_register_style ( 'pickr ' , $ vendors_url_part . 'pickr/themes/classic.min.css ' , [], $ version );
@@ -139,7 +139,12 @@ public function enqueue_styles() {
139139
140140 if ( $ current_page == 'wpnextpreviouslink ' ) {
141141
142- wp_register_style ( 'wpnextpreviouslink-setting ' , $ css_url_part . 'wpnextpreviouslink-setting.css ' , [ 'pickr ' , 'select2 ' , 'awesome-notifications ' , 'wpnextpreviouslink-admin ' ], $ this ->version , 'all ' );
142+ wp_register_style ( 'wpnextpreviouslink-setting ' , $ css_url_part . 'wpnextpreviouslink-setting.css ' , [
143+ 'pickr ' ,
144+ 'select2 ' ,
145+ 'awesome-notifications ' ,
146+ 'wpnextpreviouslink-admin '
147+ ], $ this ->version , 'all ' );
143148
144149
145150 /*wp_enqueue_style( 'wp-color-picker' );
@@ -180,7 +185,7 @@ public function enqueue_scripts() {
180185 $ vendors_path_part = WPNEXTPREVIOUSLINK_ROOT_PATH . 'assets/vendors/ ' ;
181186
182187 $ suffix = ( defined ( 'SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ) ? '' : '.min ' ;
183- $ current_page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field ( wp_unslash ($ _GET ['page ' ]) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
188+ $ current_page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
184189
185190
186191 wp_register_script ( 'jquery-validate ' , $ vendors_url_part . 'jquery-validation/jquery.validate.min.js ' , [ 'jquery ' ], $ version , true );
@@ -310,7 +315,7 @@ public function get_plugin_basename() {
310315 * @since 1.0.0
311316 */
312317 public function admin_pages () {
313- $ page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field (wp_unslash ( $ _GET ['page ' ] ) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
318+ $ page = isset ( $ _GET ['page ' ] ) ? sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ) : '' ;//phpcs:ignore WordPress.Security.NonceVerification.Recommended
314319
315320 //setting menu
316321 $ hook = add_options_page (
@@ -332,10 +337,16 @@ public function menu_settings() {
332337
333338 if ( $ doc ) {
334339 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
335- echo wpnextpreviouslink_get_template_html ( 'admin/support.php ' , [ 'admin_ref ' => $ this , 'settings ' => $ this ->settings ] );
340+ echo wpnextpreviouslink_get_template_html ( 'admin/support.php ' , [
341+ 'admin_ref ' => $ this ,
342+ 'settings ' => $ this ->settings
343+ ] );
336344 } else {
337345 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
338- echo wpnextpreviouslink_get_template_html ( 'admin/settings.php ' , [ 'admin_ref ' => $ this , 'settings ' => $ this ->settings ] );
346+ echo wpnextpreviouslink_get_template_html ( 'admin/settings.php ' , [
347+ 'admin_ref ' => $ this ,
348+ 'settings ' => $ this ->settings
349+ ] );
339350 }
340351 }//end menu_settings
341352
@@ -370,7 +381,7 @@ public function get_settings_sections() {
370381 /**
371382 * Return the key value pair of post types
372383 *
373- * @param type array $all_post_types
384+ * @param type array $all_post_types
374385 *
375386 * @return type array
376387 */
@@ -403,10 +414,10 @@ public function get_settings_fields() {
403414 *
404415 * @access public
405416 *
406- * @param array $links_array An array of the plugin's metadata
407- * @param string $plugin_file_name Path to the plugin file
408- * @param array $plugin_data An array of plugin data
409- * @param string $status Status of the plugin
417+ * @param array $links_array An array of the plugin's metadata
418+ * @param string $plugin_file_name Path to the plugin file
419+ * @param array $plugin_data An array of plugin data
420+ * @param string $status Status of the plugin
410421 *
411422 * @return array $links_array
412423 */
@@ -468,13 +479,13 @@ public function add_action_links( $links ) {
468479 *
469480 */
470481 public function plugin_upgrader_process_complete () {
471- $ saved_version = get_option ('wpnextpreviouslink_version ' );
482+ $ saved_version = get_option ( 'wpnextpreviouslink_version ' );
472483
473- if ($ saved_version === false || version_compare ($ saved_version , WPNEXTPREVIOUSLINK_VERSION , '< ' ) ) {
484+ if ( $ saved_version === false || version_compare ( $ saved_version , WPNEXTPREVIOUSLINK_VERSION , '< ' ) ) {
474485 set_transient ( 'wpnextpreviouslink_upgraded_notice ' , 1 );
475486
476487 // Update the saved version
477- update_option ('wpnextpreviouslink_version ' , WPNEXTPREVIOUSLINK_VERSION );
488+ update_option ( 'wpnextpreviouslink_version ' , WPNEXTPREVIOUSLINK_VERSION );
478489 }
479490 }//end plugin_upgrader_process_complete
480491
@@ -491,9 +502,14 @@ public function plugin_activate_upgrade_notices() {
491502
492503 echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible"> ' ;
493504 /* translators: %s. Core plugin's version */
494- 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
505+ 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
495506 /* translators: 1. Plugin setting url 2. Documentation url */
496- 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> ' ;
507+ echo '<p> ' . sprintf ( wp_kses ( __ ( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a> ' , 'wpnextpreviouslink ' ), [
508+ 'a ' => [
509+ 'href ' => [],
510+ 'target ' => []
511+ ]
512+ ] ), 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> ' ;
497513 echo '</div> ' ;
498514
499515
@@ -506,12 +522,17 @@ public function plugin_activate_upgrade_notices() {
506522
507523 // Check the transient to see if we've just activated the plugin
508524 if ( get_transient ( 'wpnextpreviouslink_upgraded_notice ' ) ) {
509- if (! $ activation_notice_shown) {
525+ if ( ! $ activation_notice_shown ) {
510526 echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible"> ' ;
511527 /* translators: %s. Core plugin's version */
512- 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
528+ 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
513529 /* translators: 1. Plugin setting url 2. Documentation url */
514- 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> ' ;
530+ echo '<p> ' . sprintf ( wp_kses ( __ ( 'Check <a href="%1$s">Plugin Setting</a> | <a target="_blank" href="%2$s" target="_blank">Documentation</a> ' , 'wpnextpreviouslink ' ), [
531+ 'a ' => [
532+ 'href ' => [],
533+ 'target ' => []
534+ ]
535+ ] ), 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> ' ;
515536 echo '</div> ' ;
516537
517538 $ this ->pro_addon_compatibility_campaign ();
@@ -540,12 +561,22 @@ public function pro_addon_compatibility_campaign() {
540561 echo '<div style="border-left-color:#6648fe;" class="notice notice-success is-dismissible"> ' ;
541562 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> ' ;
542563 /* translators: %s. Pro addon external link */
543- 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> ' ;
564+ 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 ' ), [
565+ 'a ' => [
566+ 'href ' => [],
567+ 'target ' => []
568+ ]
569+ ] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress ' ) . '</p> ' ;
544570 echo '</div> ' ;
545571 }
546572 } else {
547573 /* translators: %s. Pro addon external link */
548- 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> ' ;
574+ 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 ' ), [
575+ 'a ' => [
576+ 'href ' => [],
577+ 'target ' => []
578+ ]
579+ ] ), 'https://codeboxr.com/product/show-next-previous-article-for-wordpress?utm_source=clientdashboard&utm_medium=clientclick&utm_campaign=cdwordpress ' ) . '</p></div> ' ;
549580 }
550581 }//end pro_addon_compatibility_campaign
551582
@@ -558,26 +589,42 @@ public function pro_addon_compatibility_campaign() {
558589 *
559590 * @return void
560591 */
561- public function custom_message_after_plugin_row_proaddon ($ plugin_file , $ plugin_data) {
592+ public function custom_message_after_plugin_row_proaddon ( $ plugin_file , $ plugin_data ) {
562593 if ( $ plugin_file !== 'wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php ' ) {
563594 return ;
564595 }
565596
566- if (defined ('WPNEXTPREVIOUSLINKADDON_VERSION ' )) return ;
567597
568- $ pro_addon_version = WPNextPreviousLinkHelper::get_any_plugin_version ('wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php ' );
569598
570- $ pro_latest_version = '2.0.7 ' ;
599+ $ pro_addon_version = WPNextPreviousLinkHelper::get_any_plugin_version ( 'wpnextpreviouslinkaddon/wpnextpreviouslinkaddon.php ' );
600+ $ compared_version = '2.0.8 ' ;
601+ $ need_update = false ;
571602
572- if ($ pro_addon_version != '' && version_compare ( $ pro_addon_version , $ pro_latest_version , '< ' ) ){
573- // Custom message to display
603+ if ( defined ( 'WPNEXTPREVIOUSLINKADDON_VERSION ' ) ) {
604+ //of pro addon is too old and doesn't have the update checker implemented
605+ if (version_compare ( $ pro_addon_version , '2.0.7 ' , '< ' )){
606+ $ compared_version = '2.0.7 ' ;
607+ $ need_update = true ;
608+ }
609+ }
610+ else {
611+ if ( $ pro_addon_version != '' && version_compare ( $ pro_addon_version , $ compared_version , '< ' ) ) {
612+ $ need_update = true ;
613+ }
614+ }
574615
575616
617+ if ( $ need_update ) {
576618 $ plugin_manual_update = 'https://codeboxr.com/manual-update-pro-addon/ ' ;
577619
578-
579620 /* translators:translators: %s: plugin setting url for licence */
580- $ 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 ' => []]]);
621+ $ 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 ), [
622+ 'strong ' => [ 'style ' => [] ],
623+ 'a ' => [
624+ 'href ' => [],
625+ 'target ' => []
626+ ]
627+ ] );
581628
582629 // Output a row with custom content
583630 echo '<tr class="plugin-update-tr">
@@ -596,7 +643,7 @@ public function custom_message_after_plugin_row_proaddon($plugin_file, $plugin_d
596643 * @return void
597644 * @since 2.7.1
598645 */
599- public function settings_reset_load (){
646+ public function settings_reset_load () {
600647 //security check
601648 check_ajax_referer ( 'settingsnonce ' , 'security ' );
602649
0 commit comments