Skip to content

Commit a7ee40f

Browse files
committed
version 1.9.2 released
1 parent b1e50fa commit a7ee40f

6 files changed

Lines changed: 111 additions & 75 deletions

File tree

admin/class-cbxwpbookmark-admin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ public function custom_message_after_plugin_row_proaddon($plugin_file, $plugin_d
827827
if(defined('CBXWPBOOKMARKADDON_PLUGIN_NAME')) return;
828828

829829
$pro_addon_version = CBXWPBookmarkHelper::get_any_plugin_version('cbxwpbookmarkaddon/cbxwpbookmarkaddon.php');
830-
$pro_latest_version = '1.4.8';
830+
$pro_latest_version = '1.4.9';
831831

832832
if($pro_addon_version != '' && version_compare( $pro_addon_version, $pro_latest_version, '<' ) ){
833833
// Custom message to display
@@ -866,9 +866,9 @@ public function custom_message_after_plugin_row_mycredaddon($plugin_file, $plugi
866866
if(defined('CBXWPBOOKMARKMYCRED_PLUGIN_NAME')) return;
867867

868868
$pro_addon_version = CBXWPBookmarkHelper::get_any_plugin_version('cbxwpbookmarkmycred/cbxwpbookmarkmycred.php');
869-
$pro_latest_version = '1.0.5';
869+
$pro_latest_version = '1.0.6';
870870

871-
if($pro_addon_version != '' && version_compare( $pro_addon_version, '1.0.5', '<' ) ){
871+
if($pro_addon_version != '' && version_compare( $pro_addon_version, $pro_latest_version, '<' ) ){
872872
// Custom message to display
873873

874874
//$plugin_setting_url = admin_url( 'admin.php?page=cbxwpbookmark_settings#cbxwpbookmark_licences' );

cbxwpbookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Plugin Name: CBX Bookmark & Favorite
1616
* Plugin URI: https://codeboxr.com/product/cbx-wordpress-bookmark
1717
* Description: List/category based bookmark for WordPress, create your own private or public list of favorite posts, page, custom object
18-
* Version: 1.9.1
18+
* Version: 1.9.2
1919
* Author: Codeboxr Team
2020
* Author URI: https://codeboxr.com
2121
* License: GPL-2.0+
@@ -31,7 +31,7 @@
3131

3232

3333
defined( 'CBXWPBOOKMARK_PLUGIN_NAME' ) or define( 'CBXWPBOOKMARK_PLUGIN_NAME', 'cbxwpbookmark' );
34-
defined( 'CBXWPBOOKMARK_PLUGIN_VERSION' ) or define( 'CBXWPBOOKMARK_PLUGIN_VERSION', '1.9.1' );
34+
defined( 'CBXWPBOOKMARK_PLUGIN_VERSION' ) or define( 'CBXWPBOOKMARK_PLUGIN_VERSION', '1.9.2' );
3535
defined( 'CBXWPBOOKMARK_BASE_NAME' ) or define( 'CBXWPBOOKMARK_BASE_NAME', plugin_basename( __FILE__ ) );
3636
defined( 'CBXWPBOOKMARK_ROOT_PATH' ) or define( 'CBXWPBOOKMARK_ROOT_PATH', plugin_dir_path( __FILE__ ) );
3737
defined( 'CBXWPBOOKMARK_ROOT_URL' ) or define( 'CBXWPBOOKMARK_ROOT_URL', plugin_dir_url( __FILE__ ) );

includes/class-cbxwpbookmark-helper.php

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function create_tables() {
7474
* @return array
7575
*/
7676
public static function customizer_default_values() {
77-
$my_bookmark_url = cbxwpbookmarks_mybookmark_page_url();
77+
$my_bookmark_url = cbxwpbookmarks_mybookmark_page_url();
7878

7979
$customizer_default = [
8080
'shortcodes' => 'cbxwpbookmark-mycat,cbxwpbookmark',
@@ -118,10 +118,10 @@ public static function customizer_default_values() {
118118
}//end customizer_default_values
119119

120120
/**
121-
* Adjust customizer default values
122-
*
123-
* @param boolean $update
124-
* @param boolean $return
121+
* Adjust customizer default values
122+
*
123+
* @param boolean $update
124+
* @param boolean $return
125125
*
126126
* @return array|void
127127
*/
@@ -272,7 +272,7 @@ public static function show_cbxbookmark_btn( $object_id = 0, $object_type = null
272272

273273
$settings = new CBXWPBookmark_Settings_API();
274274

275-
$hide_for_guest = absint( $settings->get_opt( 'hide_for_guest', 'cbxwpbookmark_basics', 0 ) );
275+
$hide_for_guest = absint( $settings->get_field( 'hide_for_guest', 'cbxwpbookmark_basics', 0 ) );
276276
if ( $hide_for_guest && ! is_user_logged_in() ) {
277277
return '';
278278
}
@@ -760,7 +760,7 @@ public static function cbxbookmark_post_html( $instance ) {
760760
public static function cbxbookmark_most_html( $instance, $attr = [] ) {
761761
global $wpdb;
762762
$bookmark_table = $wpdb->prefix . 'cbxwpbookmark';
763-
$settings = new CBXWPBookmark_Settings_API();
763+
$settings = new CBXWPBookmark_Settings_API();
764764
$allowed_object_types = cbxwpbookmarks_allowed_object_type();
765765

766766
$object_types = CBXWPBookmarkHelper::object_types( true ); //get plain post type as array
@@ -1239,7 +1239,7 @@ public static function get_author_cbxwpbookmarks_url( $author_id = 0 ) {
12391239
* @return false|string
12401240
*/
12411241
public static function cbxwpbookmarks_mybookmark_page_url() {
1242-
$settings = new CBXWPBookmark_Settings_API();
1242+
$settings = new CBXWPBookmark_Settings_API();
12431243

12441244
$my_bookmark_page_id = absint( $settings->get_field( 'mybookmark_pageid', 'cbxwpbookmark_basics', 0 ) );
12451245

@@ -2412,7 +2412,7 @@ public static function cbxwpbookmark_setting_fields() {
24122412

24132413
$settings_builtin_fields =
24142414
[
2415-
'cbxwpbookmark_basics' => [
2415+
'cbxwpbookmark_basics' => [
24162416
'basics_heading' => [
24172417
'name' => 'basics_heading',
24182418
'label' => esc_html__( 'General Settings', 'cbxwpbookmark' ),
@@ -2642,7 +2642,7 @@ public static function cbxwpbookmark_setting_fields() {
26422642
],
26432643

26442644
],
2645-
'cbxwpbookmark_tools' => [
2645+
'cbxwpbookmark_tools' => [
26462646
'tools_heading' => [
26472647
'name' => 'tools_heading',
26482648
'label' => esc_html__( 'Tools Settings', 'cbxwpbookmark' ),
@@ -2979,8 +2979,8 @@ public static function cbxbookmark_create_page( $key = '', $slug = '', $page_tit
29792979
}//end cbxbookmark_create_page
29802980

29812981
/**
2982-
* Get any plugin version number
2983-
*
2982+
* Get any plugin version number
2983+
*
29842984
* @param $plugin_slug
29852985
*
29862986
* @return mixed|string
@@ -3006,4 +3006,49 @@ public static function get_any_plugin_version( $plugin_slug = '' ) {
30063006
// Return false if the plugin is not found
30073007
return '';
30083008
}//end method get_pro_addon_version
3009+
3010+
/**
3011+
* Returns codeboxr news feeds using transient cache
3012+
*
3013+
* @return false|mixed|\SimplePie\Item[]|null
3014+
*/
3015+
public static function codeboxr_news_feed() {
3016+
$cache_key = 'codeboxr_news_feed_cache';
3017+
$cached_feed = get_transient( $cache_key );
3018+
3019+
$news = false;
3020+
3021+
if ( false === $cached_feed ) {
3022+
include_once ABSPATH . WPINC . '/feed.php'; // Ensure feed functions are available
3023+
$feed = fetch_feed( 'https://codeboxr.com/feed?post_type=post' );
3024+
3025+
if ( is_wp_error( $feed ) ) {
3026+
return false; // Return false if there's an error
3027+
}
3028+
3029+
$feed->init();
3030+
3031+
$feed->set_output_encoding( 'UTF-8' ); // this is the encoding parameter, and can be left unchanged in almost every case
3032+
$feed->handle_content_type(); // this double-checks the encoding type
3033+
$feed->set_cache_duration( 21600 ); // 21,600 seconds is six hours
3034+
$limit = $feed->get_item_quantity( 10 ); // fetches the 18 most recent RSS feed stories
3035+
$items = $feed->get_items( 0, $limit );
3036+
$blocks = array_slice( $items, 0, 10 );
3037+
3038+
$news = [];
3039+
foreach ( $blocks as $block ) {
3040+
$url = $block->get_permalink();
3041+
$url = CBXWPBookmarkHelper::url_utmy( esc_url( $url ) );
3042+
$title = $block->get_title();
3043+
3044+
$news[] = ['url' => $url, 'title' => $title];
3045+
}
3046+
3047+
set_transient( $cache_key, $news, HOUR_IN_SECONDS * 6 ); // Cache for 6 hours
3048+
} else {
3049+
$news = $cached_feed;
3050+
}
3051+
3052+
return $news;
3053+
}//end method codeboxr_news_feed
30093054
}//end CBXWPBookmarkHelper

includes/class-cbxwpbookmark-setting.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,14 +1015,8 @@ function get_option( $option, $section, $default = '' ) {
10151015
*
10161016
* @return string
10171017
*/
1018-
function get_field( $option, $section, $default = '' ) {
1019-
$options = get_option( $section );
1020-
1021-
if ( isset( $options[ $option ] ) ) {
1022-
return $options[ $option ];
1023-
}
1024-
1025-
return $default;
1018+
function get_opt( $option, $section, $default = '' ) {
1019+
return $this->get_field( $option, $section, $default );
10261020
}//end method get_option
10271021

10281022
/**
@@ -1034,8 +1028,14 @@ function get_field( $option, $section, $default = '' ) {
10341028
*
10351029
* @return string
10361030
*/
1037-
function get_opt( $option, $section, $default = '' ) {
1038-
return $this->get_option( $option, $section, $default );
1031+
function get_field( $option, $section, $default = '' ) {
1032+
$options = get_option( $section );
1033+
1034+
if ( isset( $options[ $option ] ) ) {
1035+
return $options[ $option ];
1036+
}
1037+
1038+
return $default;
10391039
}//end method get_option
10401040

10411041
/**

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: codeboxr, manchumahara
33
Tags: bookmark,favorite,collection,user collection,user bookmark
44
Requires at least: 5.3
55
Tested up to: 6.7.2
6-
Stable tag: 1.9.1
6+
Stable tag: 1.9.2
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -169,6 +169,10 @@ How to install the plugin and get it working.
169169
== Screenshots ==
170170

171171
== Changelog ==
172+
= 1.9.2 =
173+
* [fixed] Fixed the method 'get_opt' in core and updated the pro addon based on that.
174+
* [updated] Pro addon plugin 1.4.9 compatible
175+
172176
= 1.9.1 =
173177
* [updated] Minor improvement
174178
* [updated] Pro addon plugin 1.4.8 released

0 commit comments

Comments
 (0)